Repository navigation
Conversation
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.
Problem
On macOS with an IME-based keyboard layout (reproduced with the Vietnamese Telex input method, but the same applies to any CJK/IME input), a single
Enterpress is delivered to the chat input as twokeydownevents:KeyboardEvent.isComposing === true,keyCode === 229),The webview keydown handler treated both events as a "send":
Result: every prompt that ends with a composed word is sent twice — the full prompt, plus a second message that only contains the duplicated last word (e.g.
Hi em là aifollowed byai). Non-IME layouts (English) are unaffected because they never enter a composition state.Fix
Ignore keydown events that are part of an IME composition:
The first (composing) event no longer sends, so the composition is committed normally into an intact textarea; the following post-composition event sends the full prompt exactly once.
keyCode === 229is kept as a fallback for IMEs that do not setisComposing.No behavior change for non-IME input, and no need for a second Enter press.
Testing
npx tsc -p . --noEmit— passesnpx eslint src --max-warnings 0— passes