edit
edit copied to clipboard
Holding Esc key causes vt-sequences to leak
Repro:
- Press and hold Esc
- Perform any action that generates a vt-sequence, e.g.:
- Scroll mouse wheel
- Press F1/../F12/ArrowKeys/Home/End etc.
Tested terminals:
- GNOME Terminal (Ubuntu 24.04)
- Windows Terminal (wsl/win32)
- conhost.exe
I see the mechanics of this behavior as a case of \x1b+\x1b for the input parser, where the first ESC is always the pressed Esc key. This behavior fires out of the blue in environments like adb shell, where the input is shredded (https://github.com/directvt/vtm/issues/803#issuecomment-3263425204) almost byte by byte.
Same thing on Alacritty.
If you look here, your bug comes from Token::Esc('\e') being yielded. I imagine another match branch with this would solve that bug:
'\x1b' => {
return Token::Ctrl('\x1b');
}