Fix numpad keys not producing digits when NumLock is ON#1902
Merged
christianparpart merged 2 commits intomasterfrom Feb 25, 2026
Merged
Fix numpad keys not producing digits when NumLock is ON#1902christianparpart merged 2 commits intomasterfrom
christianparpart merged 2 commits intomasterfrom
Conversation
On Wayland, the native modifier bit for NumLock (XCB_MOD_MASK_2 = 0x10) is unreliable, so makeModifiers() often fails to set Modifier::NumLock. This caused two problems: - Legacy protocol + DECKPAM: numpad keys sent escape sequences (e.g. CSI E) instead of digits - Kitty protocol: CSI u sequences omitted the NumLock modifier, so shells didn't know to insert a digit for numpad keys The fix infers NumLock state from Qt's key event resolution: Qt reports Key_0..9 with KeypadModifier only when NumLock is ON (otherwise it reports navigation keys like Insert, End, etc.). For operator/Enter keys, NumLock is inferred from non-empty event text. Additionally, add numpadAssociatedText() to emit the third CSI u parameter (associated text codepoint) when ReportAssociatedText is enabled in the Kitty protocol, allowing shells to resolve numpad keys to their character values. Fixes #1901 Signed-off-by: Christian Parpart <christian@parpart.family>
26f940f to
8d25202
Compare
Yaraslaut
previously approved these changes
Feb 24, 2026
Member
Yaraslaut
left a comment
There was a problem hiding this comment.
oh, key mapping is a pain
one nitpick
- helper.cpp: Reduce numpad digit case repetition using fall-through with arithmetic mapping (per @Yaraslaut) Signed-off-by: Christian Parpart <christian@parpart.family>
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.
Key_0..9withKeypadModifieronly when NumLock is ON, making the inference definitionally correct.numpadAssociatedText()helper and emit the third CSI u parameter (associated text codepoint) in the Kitty keyboard protocol whenReportAssociatedTextis enabled, allowing shells to resolve numpad keys to their character values.Fixes #1901