fix(vt): Ctrl+letter keys not forwarded to child processes under kitty kb protocol#3414
Open
michaellukashov wants to merge 1 commit into
Open
fix(vt): Ctrl+letter keys not forwarded to child processes under kitty kb protocol#3414michaellukashov wants to merge 1 commit into
michaellukashov wants to merge 1 commit into
Conversation
Contributor
|
Выглядит разумно |
…rotocol When kitty keyboard protocol is active, Ctrl+letter combinations (A-Z) were being encoded as kitty escape sequences (e.g. \e[4;5u for Ctrl+D) and written to the child process's stdin. Non-far2l child processes don't recognize kitty escapes and received nothing usable. Fall through from the kitty encoding path to VT_TranslateSpecialKey for simple Ctrl+letter (ctrl-only, no alt/shift), which produces the standard raw control bytes 0x01-0x1A that all processes expect.
05dfe16 to
16599ab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(vt): Ctrl+letter keys not forwarded to child processes under kitty keyboard protocol
Problem
When kitty keyboard protocol is active in the VT shell, Ctrl+letter combinations (A-Z) generate kitty escape sequences (
ESC[4;5ufor Ctrl+D) instead of raw control bytes (0x04). Non-far2l child processes — like any terminal application that doesn't implement kitty keyboard protocol — receive nothing for these keypresses. This breaks Ctrl+D, Ctrl+K, Ctrl+U, Ctrl+A, Ctrl+E in editors, shells, and TUI applications running inside far2l's VT panels.Root Cause
TranslateKeyEventinfar2l/src/vt/vtshell.cppchecks_kitty_kb_flagsfirst. When set (child negotiated kitty keyboard protocol),VT_TranslateKeyToKittyalways wins — even for keys that have trivial legacy encodings. The kitty escape sequences are only understood by terminals implementing that protocol, not by arbitrary child processes.Fix
In
TranslateKeyEvent, after kitty translation produces a result for Ctrl+letter keys (ctrl only, no alt/shift, VK between A-Z), fall through to the legacyVT_TranslateSpecialKeypath which correctly maps Ctrl+D→\x04, Ctrl+K→\x0b, etc. All other keys (arrows, F-keys, modifiers, multi-modifier combos) continue to use kitty protocol unchanged.Additional changes
cfmakeraw(CREAD|CLOCAL, VMIN=1/VTIME=0, defensive clearing of IUTF8/IXOFF/IUCLC/ECHOCTL). Addeddup()failure check. Previously, raw mode could fail silently.g_tty_profilerpointer access (g_tty_profiler.frames→g_tty_profiler->frames) inTTYBackend.cppWriterThreadFiles changed
far2l/src/vt/vtshell.cppVerification
Tested under WindowsTerminal → SSH → far2l running oh-my-pi (a TUI application). Before: Ctrl+D/K/U/A/E produce no effect. After: all Ctrl+letter keys work correctly (confirmed with
FAR2L_TTY_DIAG=1and byte-level tracing).