Closed t-c-acc closed 1 year ago
Hi! Can you please tell me how to reproduce this exactly? What keys do I have to press exactly step by step in the scratch buffer to trigger the problem? But anyway, a setting of corfu-auto-prefix=0
is invalid. The smallest reasonable value is 1.
Just pressing the down arrow. It also happens without autocomplete and pressing C-M-i on a line with a single char.
(I edited the issue)
I cannot reproduce the problem. Can you give me the exact buffer content, point position and key sequence needed to demonstrate the problem? Corfu should not delete any text - there is no code in Corfu which does this. Maybe you want corfu-preview-current=nil
to disable the preview overlay?
With corfu-preview-current set to 'insert, there are lines deleted. When the next line is not empty, it deletes just one line, when there are empty lines after the completion, it deletes more.
The lines are deleted when previewing and if the completion is canceled they come back. If the completion is confirmed, they stay deleted.
Edit: I was mistaken, it does not fix it. Confirming the selection deletes lines.
With emacs -q --load ~/testinit.el
, testinit.el being what I posted above, without corfu-auto.
This deletes lines as described above.
It seems to delete lines with some meaning...
For example at the following code
(use-package modus-themes
:config
(
;; Add all your customizations prior to loading the themes
(setq modus-themes-italic-constructs t
modus-themes-bold-constructs t
modus-themes-mixed-fonts t)
;; Maybe define some palette overrides, such as by using our presets
(setq modus-themes-common-palette-overrides
nil)
[...]
when I press C-M-i at the '(' after the :config
it deletes up to the line before ;; Maybe [...]
In the following where everything is on the same level of indentation it only deletes one line (the (setq-default cursor-type '(bar . 2))
):
(setq-default visible-bell t)
(
(setq-default cursor-type '(bar . 2))
(set-fringe-mode 4)
(scroll-bar-mode -1)
It is not fixed by setting corfu-preview-current to nil, after all
OK. I tested and the bug is with Emacs completion-at-point. Sorry to bother you.
Oh wow, I can reproduce this now. It could be a bug in elisp-completion-at-point
or the emacs22
completion style. I tried the following snippet in emacs -Q:
(package-initialize)
(global-corfu-mode)
(setq completion-styles '(emacs22))
( ;; <-- place the cursor directly after the ( and press M-TAB
;; comment
something
The problem is that the completion bounds are somehow wrong, but only if the emacs22
completion style is used. The completion bounds cross the newlines over the ;; comment
. It also happens with default completion-at-point
without Corfu, such that multiple lines are deleted. It does not happen with the basic
, emacs21
or substring
completion styles.
This must be quite an old bug. Congratulations for finding it. If you consider the problem serious enough, you may report it upstream. ;)
Thanks :P
I sent a bug report to bug-gnu-emacs@gnu.org. I included a link to this bug report for your observations.
Thanks. Link to the bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64903
Using Debian 12 with the packaged Emacs 28.2 with GNOME
When corfu-auto is true, and corfu-auto-prefix is 0, pressing down-arrow/M-n/C-n (all bound only to corfu-next) during a completion, deletes some of the lines of text after the line being completed.
This does not happen when corfu-auto-prefix is 1.
Minimal init:
Edit:
It also happens when trying to compete (with C-M-i) a line that has only one character, not having corfu-auto enabled
Minimal init:
Same as above but without the ":custom [...]"