helix icon indicating copy to clipboard operation
helix copied to clipboard

CTRL+K (kill_to_line_end) selects autocomplete option

Open johalun opened this issue 2 years ago • 5 comments

Summary

When I go to insert mode on code that pops up the autocomplete list I can't do CTRL+K (kill_to_line_end), instead it selects an option from the autocomplete menu and inserts into the editor. On a comment for example where there's no autocomplete options, CTRL+K works as expected.

Reproduction Steps

I tried this:

  1. cd helix # clone of helix repo
  2. hx helix-core/src/diagnostic.rs
  3. Put cursor on something that will autocomplete, for example on the i in usize
  4. Go to insert mode
  5. See the autocomplete menu popup with us completions like usize2x etc
  6. Press CTRL+K to kill to end of line

I expected this to happen: The characters after the cursor to be deleted

Instead, this happened: usize is replaced with the last item in the autocomplete list usizex8

Helix log

Nothing relevant in the log

Platform

macOS

Terminal Emulator

iTerm2

Helix Version

helix 22.05 (06a5bca7)

johalun avatar Dec 01 '22 18:12 johalun

(Misclick sorry 😅)

the-mikedavis avatar Dec 01 '22 21:12 the-mikedavis

Can you reproduce this on master? It looks like you're on a branch based on #2377

the-mikedavis avatar Dec 01 '22 21:12 the-mikedavis

I can reproduce this more or less on master (59b886cf5e89dadfd73d93b638b2c552ce5537f6). Found out about CTRL+k today but everytime before I use it the LSP pops up with the suggestions and CTRL+k inserts the first suggestion from the list.

Tested in elixir files using elixir-ls.

  1. Switching to insert mode: Screenshot 2022-12-05 at 09 43 49
  2. Clicking CTRL+k Screenshot 2022-12-05 at 09 43 56

philipgiuliani avatar Dec 05 '22 08:12 philipgiuliani

I'm new to the codebase so I could be wrong, but it seems that whenever the completion menu pops up, it takes precedence in handling certain key commands such as C-k (kill to end of line) ,C-j (insert newline), tab, etc. The workaround is to press C-c to exit the completion menu first. (check the menu file for input handling info).

DylanBulfin avatar Dec 08 '22 14:12 DylanBulfin

There was a similar issue with pickers at one point, where C-k navigation overwrote the intended behavior of C-k killing to end of line in the prompt. This was addressed by https://github.com/helix-editor/helix/pull/1792, made a new PR https://github.com/helix-editor/helix/pull/5070 to try and resolve this for the completion menu as well

DylanBulfin avatar Dec 08 '22 15:12 DylanBulfin

Fixed in https://github.com/helix-editor/helix/pull/5070

the-mikedavis avatar Feb 15 '23 14:02 the-mikedavis