“c” behaves strangely when swapped with “h”
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Describe the bug
In order to be comfortable with the BÉPO keyboard layout, I have swapped hjkl and ctsr. Since VSCodeVim 1.21.0, there is some delay between the moment c is pressed and the cursor effectively moving to the left. If I press it multiple times in a row, it seems to move, but there is still a one-second delay before it is at its “real” position.
To Reproduce
Steps to reproduce the behavior:
-
Add this configuration:
"vim.normalModeKeyBindingsNonRecursive": [ { "before": ["c"], "after": ["h"] }, { "before": ["t"], "after": ["j"] }, { "before": ["s"], "after": ["k"] }, { "before": ["r"], "after": ["l"] }, ], -
Position the cursor so it has some space on its left.
-
Type
cand see the cursor having a one-second delay.
Expected behavior
Like for t, s and r, and even c in previous versions, there should be no delay.
Screenshots
[Extension Host] ModeHandler: debug: handling key=c.
[Extension Host] Remapper: debug: trying to find matching remap. keys=c. mode=Normal. keybindings=normalModeKeyBindingsMap.
[Extension Host] Remapper: verbose: key=c. keySlice=c.
[Extension Host] Remapper: debug: normalModeKeyBindingsMap. ambiguous match found. before=c. after=h. command=undefined. waiting for other key or timeout to finish.
[Extension Host] ModeHandler: debug: handleKeyEvent('c') took 2ms
[Extension Host] ModeHandler: debug: handling key=<timeoutfinished>.
[Extension Host] Remapper: debug: trying to find matching remap. keys=c. mode=Normal. keybindings=normalModeKeyBindingsMap.
[Extension Host] Remapper: verbose: key=c. keySlice=c.
[Extension Host] Remapper: debug: normalModeKeyBindingsMap. match found. before=c. after=h,<TimeoutFinished>. command=undefined. remainingKeys=. mapDepth=1.
[Extension Host] ModeHandler: debug: handling key=h.
[Extension Host] ModeHandler: debug: Selections: Adding Selection Change to be Ignored! Hash: [25, 23; 25, 23], Selections: [25, 23], [25, 23]
[Extension Host] ModeHandler: debug: handleKeyEvent('h') took 6ms
[Extension Host] ModeHandler: debug: handling key=<timeoutfinished>.
[Extension Host] ModeHandler: debug: handleKeyEvent('<timeoutfinished>') took 0ms
[Extension Host] ModeHandler: debug: handleKeyEvent('<timeoutfinished>') took 8ms
[Extension Host] Extension Startup: debug: Selections: Ignoring selection: [25, 23; 25, 23], Count left: 0
=> It seems there is some ambiguity, but I’ve defined the remap only once, so this is very strange.
Environment (please complete the following information):
- Extension (VsCodeVim) version: 1.21.3, 1.21.2, 1.21.1, 1.21.0
- VSCode version: 1.56.2 (but also on latest on my work PC)
- OS: NixOS 21.05, Windows 10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Remapper and ModeHandler paths named in the debug output, then reproduce the BÉPO keybinding configuration in VSCodeVim. Trace why c is treated as an ambiguous match while t, s, and r are not; done means the remapped c moves left without the timeout delay and existing keybinding behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100