-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Key sequence terminating character is not considered to start a new one #6878
Comments
This comment was marked as resolved.
This comment was marked as resolved.
This issue is specific to insert mode the description is kind of a bit missleading. The problem is that in insert mode inserting text usually causes it to be inserted (this is not considered a keybinding but rather just the definition of insert mode). To solve this issue we would need to add a special handling for the last pending key in helix/helix-term/src/ui/editor.rs Line 857 in 096ed0c
self.keymap.get again for the last key (similar to helix/helix-term/src/ui/editor.rs Line 861 in 096ed0c
KeymapResult::NotFound is returned
|
this is already existing functionality in helix and a simple bugfix for that. Actually I think this bug doesn't just occur in insert mode but also in normal mode and visual mode. The general issue is that with |
@pascalkuthe I think your proposed fix doesn't behave as I'd expect. If we do as you suggest, then the test case of typing "jjk" in insert mode would insert "jj" and exit to normal mode. If I had set up my config file as KnorrFG did, I would expect that only "j" would be inserted. However, I can't think of a solution that doesn't set up a weird thing where no typable prefix of an insert-mode keybinding can be inserted until the binding fails to match. |
It's hard to know without looking at your code but the idea was that basically the last canceled chars get reprocessed to check for keybindings and to not insert the char for it in that case. So basically for the for loop I linked you would need to do |
Ah, I misunderstood your suggestion, I've implemented a fix based on your comment here: master...sscheele:helix:ins-bindings. However, I think a better approach might be to modify the trie code to add a Edit: |
This is a general issue and also a problem in normal mode so you are right that this is a bit to specific. I was sort of getting at that with
You can probably handle this generically in At the end of the function, you can special case |
Should we close this as duplicate of #2612 (which has more discussion)? Although this one gives a different model of the underlying problem, the high level symptom is the same. |
Hey,
first of all, let me thank you for Helix. I love it. <3
To the point: I have this in my config:
and typically this works. However, when I type the sequence
jjk
in insert mode, it will input jjk, instead of inputting j, and then exiting insert mode. This seems to happen because a character that terminates a possible key-sequence is not considered to be able to start a new one.This is quite annoying if you try to exit insert mode after typing a j as last character, like e.g. in
obj
. It's very minor, and you might not even consider it a bug, but I thought I'll bring it up.The text was updated successfully, but these errors were encountered: