fix: resolve #614 - numpad keys not working in VSCode terminal#258
Open
WqyJh wants to merge 1 commit into
Open
fix: resolve #614 - numpad keys not working in VSCode terminal#258WqyJh wants to merge 1 commit into
WqyJh wants to merge 1 commit into
Conversation
The upstream @opentui/core parseKeypress only maps UPPERCASE SS3 escape sequences (e.g. \x1bOP -> f1) to key names. Numpad keys send lowercase SS3 sequences (e.g. \x1bOp for KP0) which are parsed to name="" and then silently dropped by TextareaRenderable because the sequence starts with ESC (char code 27 < 32). This only affects terminals without kitty keyboard protocol (VSCode, Windows Terminal, etc.). Terminals with kitty protocol use CSI u mode which is correctly handled. Workaround: in the prompt onKeyDown handler, detect SS3 numpad sequences by their pattern (\x1bO + lowercase letter) and map them to the correct characters, inserting them directly into the textarea input. Also partially addresses the voice input issue (Bug 2 in XiaomiMiMo#614) which is more fully fixed by PR XiaomiMiMo#613 (voice recording silent failure detection). Fixes XiaomiMiMo#614
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.
Fixes XiaomiMiMo#614
Summary
Fixes numpad keys (0-9, +, -, *, /, .) not registering any input when running MiMo Code in VSCode's integrated terminal or other terminals without kitty keyboard protocol.
Root Cause
@opentui/core'sparseKeypressonly maps UPPERCASE SS3 escape sequences to key names (e.g.\x1bOP-> "f1"). Numpad keys send lowercase SS3 sequences (e.g.\x1bOpfor KP0,\x1bOqfor KP1). These are parsed toname=""and then silently dropped byTextareaRenderable.handleKeyPressbecause the sequence starts with ESC (char code 27 < 32).Terminals with kitty keyboard protocol (Kitty, Ghostty) are unaffected — they use CSI
umode which is correctly handled viakittyKeyMap.Fix
Workaround in the prompt's
onKeyDownhandler: detect SS3 numpad sequences by their pattern (\x1bO+ lowercase letter) and map them to the correct characters, inserting them directly into the textarea.Also partially addresses Bug 2 (voice input silent failure) from the same issue, which is more fully fixed by PR XiaomiMiMo#613.
Testing
bunx turbo typecheck— all packages passMirrored from XiaomiMiMo/MiMo-Code#620 — original author @MrRealORG.