mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.97k stars 714 forks source link

[BUG] insert mode <c-x>l acts like <c-x>L #4833

Open vbauerster opened 1 year ago

vbauerster commented 1 year ago

Version of Kakoune

Kakoune v2022.10.31-64-g50978846

Reproducer

kak -n -e 'exec -buffer b,c itestme<esc>otestyou<esc>;exec i<c-x>ltest' a b c

Outcome

buffer a contains no lines, but completions got acquired from different buffer.

Expectations

no completions at all.

Additional information

No response

Screwtapello commented 1 year ago

The default value for the completers option includes word=all which means "complete words from all buffers"

Screwtapello commented 1 year ago

Oh wait, you mean <c-x> completion, not the standard completion mode.

krobelus commented 1 year ago

I think this is intended behavior.

If your buffer is

some-word
some line

and you type oso<c-x>l, it will suggest both lines. However, adding anything else to the input (like m) will disable the explicit line-completer again, so completers will be provided by the completers option.

So <c-x>l, <c-x>f etc. are only useful when you select the result with <c-n>.

You can add the behavior you expect with some mappings that manipulate the completers option. Maybe there is space to improve the default behavior.

krobelus commented 1 year ago

so to rephrase, explicit completers are reset on further typing

vbauerster commented 1 year ago

second exec in the reproducer operates in the context of client0 which happens to be buffer a which is empty. My understanding that <c-x>l in empty buffer should not aggregate complete candidates from other buffers, because its docs says l: line (current buffer). So exec i<c-x>ltest in empty buffer should produce no complete candidates contrary to exec i<c-x>Ltest.

krobelus commented 1 year ago

My understanding that l in empty buffer should not aggregate complete candidates from other buffers,

correct, and that does work: <c-x>l only includes lines from the current buffer, as can be observed with <c-x>l<c-n> But key insertion - like test here - will reset the explicit completer, so it doesn't matter which one you used (same result if you used <c-x>f)