Repository navigation
fix(terminal): prevent macOS dictation from duplicating text in the task terminal - #572
Open
binghaobhw wants to merge 1 commit into
Open
binghaobhw wants to merge 1 commit into
binghaobhw wants to merge 1 commit into
Conversation
…ask terminal Ending macOS dictation with the Command key delivers a bare Meta keydown while the dictation composition session is still active. xterm's CompositionHelper treats any keydown outside its Shift/Ctrl/Alt/CapsLock/ IME(229) exemption list as a real key interrupting the composition and eagerly flushes the composed text to the PTY; the subsequent compositionend then flushes the same text again, so every dictated phrase appeared twice. Swallow bare Meta presses in the custom key event handler, which runs before xterm's composition handling. A lone Meta press has no meaning to the terminal, and combo shortcuts (Cmd+C/Cmd+V) are unaffected because they arrive keyed by the non-modifier key. fixes cline#566
|
PR author is not in the allowed authors list. |
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
Ending macOS dictation with the Command key delivers a bare
Metakeydown while the dictation composition session is still active (isComposing: true). xterm'sCompositionHelper.keydowntreats any keydown outside its Shift/Ctrl/Alt/CapsLock/IME(229) exemption list as a real key interrupting the composition and eagerly flushes the composed text to the PTY; the subsequentcompositionendthen flushes the same text again — so every dictated phrase appeared twice in the terminal.Captured trace (textarea events + WebSocket sends) showing the double flush:
The fix swallows bare
Metapresses inattachCustomKeyEventHandler, which runs before xterm's composition handling. A lone Meta press has no meaning to a terminal, and combo shortcuts (Cmd+C / Cmd+V) are unaffected because those events arrive keyed by the non-modifier key.The underlying defect (Meta missing from the modifier exemptions) will also be reported upstream to xtermjs/xterm.js.
fixes #566
Test plan
npm run checkpasses (pre-commit hook: typecheck + fast tests)🤖 Generated with Claude Code