fix(input): auto-detect DECCKM before routing CSI arrows as wheel events#280
Merged
Conversation
…nts (#279) CsiFunctionalDecoder unconditionally treated bare CSI A/B as alternate-scroll wheel events when Kitty was inactive, assuming the terminal honored DECCKM (?1h) and sent real arrows as SS3. Terminals that ignore DECCKM (VHS, some PTY wrappers) keep sending arrows as CSI form, so all arrow navigation broke silently. Add a DeckmConfirmed flag to TerminalModeContext. The parser sets it when it first sees an SS3 arrow key decoded as a KeyStroke — proof the terminal honored DECCKM. CsiFunctionalDecoder only routes CSI A/B as wheel after this confirmation; until then they are keyboard arrows.
SS3 F1-F4 (ESC O P/Q/R/S) use the SS3 encoding as a VT220 legacy independent of DECCKM. The prior check (`ss3Input is KeyStroke`) was too broad and would false-positive DECCKM confirmation when any SS3 key arrived, including F-keys. Narrow to arrow keys only.
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.
Summary
?1h). Terminals that ignore DECCKM (VHS, some PTY wrappers) send real arrow keys as CSI form, breaking all keyboard navigation.DeckmConfirmedflag toTerminalModeContext. The parser sets it when it first observes an SS3 arrow key — proof the terminal honored DECCKM.CsiFunctionalDecoderonly routes CSI A/B as wheel after this confirmation; until then they are keyboard arrows.Fixes #279
Test plan
Downarrow keys navigates lists correctly withPreferRawInput = true+AlternateScroll