Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTRL+K (kill_to_line_end) selects autocomplete option #4963

Closed
johalun opened this issue Dec 1, 2022 · 6 comments
Closed

CTRL+K (kill_to_line_end) selects autocomplete option #4963

johalun opened this issue Dec 1, 2022 · 6 comments
Labels
C-bug Category: This is a bug

Comments

@johalun
Copy link

johalun commented Dec 1, 2022

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 (06a5bca)

@johalun johalun added the C-bug Category: This is a bug label Dec 1, 2022
@the-mikedavis the-mikedavis reopened this Dec 1, 2022
@the-mikedavis
Copy link
Member

(Misclick sorry 😅)

@the-mikedavis
Copy link
Member

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

@philipgiuliani
Copy link
Contributor

I can reproduce this more or less on master (59b886c). 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

@DylanBulfin
Copy link
Contributor

DylanBulfin commented Dec 8, 2022

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
Copy link
Contributor

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 #1792, made a new PR #5070 to try and resolve this for the completion menu as well

@the-mikedavis
Copy link
Member

Fixed in #5070

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants