Repository navigation
Conversation
Typing "가나" and pressing Cmd+Backspace leaves "나" on the line. "가" has reached the pty while "나" is still in the preedit, so the line-kill byte goes out synchronously, erases what the shell has, and only then does xterm flush "나" from its timer. xterm guards this in CompositionHelper.keydown by flushing the preedit before a non-composition key runs, but Orca's window-level capture handler calls stopImmediatePropagation, so xterm never sees the keydown. The compositionend path sends the committed glyph from a timer, so it is asynchronous regardless. keyboard-handlers already defers for this reason, but only for Enter. Widen it to every sendInput action while a composition is pending. Enter keeps deferredNewlineSender, which also owns the Windows redispatch ledger; other keys call sendTerminalInputAfterComposition directly so they do not leave absorb credits nothing will consume. Also fixes Cmd+Delete, Cmd+Arrow, Ctrl+Backspace, and the Alt meta sequences, which shared the same unsequenced path on all platforms. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…mposition With committed text on the line and a syllable still composing, a cursor-movement chord relocated the composing character to wherever the cursor landed: Option+Left word-jump turned "가나 다라 마바[사]" into "가나 [사]다라 마바", and Cmd+Left moved the syllable to the line start. With a Japanese preedit the relocated text also overwrote the glyph at the destination cell. Reported with reproduction steps in stablyai#12871. The ordering fix already covers these chords; this pins the previously untested resolver branches so the symptom cannot quietly return: - Option+ArrowLeft / ArrowRight word jumps (\eb / \ef) - Cmd+ArrowRight line-end jump (\x05) - a multi-character Japanese preedit committing before the chord byte - Ctrl+ArrowLeft word jump on Windows (\eb) Verified non-vacuous: against the pre-fix keyboard-handlers.ts all five new cases fail with the chord byte recorded ahead of the commit.
Contributor
Author
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
Regression tests for the user-visible symptom reported in #12871: with committed text on the line and a syllable still composing, a cursor-movement chord relocated the composing character to wherever the cursor landed —
Option+←turned가나 다라 마바[사]into가나 [사]다라 마바,Cmd+←moved the syllable to the line start, and with a Japanese preedit the relocated text also overwrote the glyph at the destination cell.This branch carries #12732 unchanged (
359fd2e09by @kunsanglee, authorship preserved — that commit is the fix and the ordering mechanism is entirely theirs) and adds one test-only commit on top, pinning the resolver branches the existing suite does not cover:Option+ArrowLeft/Option+ArrowRightword jumps (\eb/\ef) — the chord in the original reportCmd+ArrowRightline-end jump (\x05)かな) committing before the chord byte — pins the overwrite variantCtrl+ArrowLeftword jump on Windows (\eb)Not meant to supersede #12732 — if maintainers prefer to land it directly, I am happy to rebase this to a test-only follow-up (or for the tests to be cherry-picked into #12732; also fine with closing this if that is easier).
Screenshots
No visual change.
Testing
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/keyboard-handlers-ime-deferred-input.test.tsx— 10/10 pass (5 existing + 5 new)keyboard-handlers.tsreverted to its pre-fix(terminal): send a composing cursor chord once, not twice #12732 state, all five new cases fail with the chord byte recorded ahead of the commit (['pty:...', 'commit:사']instead of['commit:사', 'pty:...'])oxlint(default + react-doctor config) andoxfmt— clean via lint-staged pre-commitpnpm run typecheck:web— cleanpnpm test(full suite, clean shell, macOS arm64) — 46,345 passed / 83 skipped; the 5 failures are unrelated to this change and accounted for:src/main/native-chat/transcript-watch.test.ts+transcript-watch-liveness.test.ts— load-dependent flakes: both pass in isolation (28/28 and 7/7), and repeated full runs fail different unrelated files each time (src/relay/agent-exec-handler.test.ts, a GitHub project-view suite) while this PR's area stays greenconfig/scripts/check-root-directory-entries.test.mjs(3 cases) — fails on stock macOS regardless of this change: the guard script usesdeclare -A(bash 4+) but the test spawns plainbash, which resolves to/bin/bash3.2 on macOS, so the script exits 2 before asserting anythingsrc/relay/agent-exec-handler.test.tsasserts spawn env againstprocess.env, so session-injected variables make it fail there; it passes in a clean shellpnpm build— not run; test-only change, no production code touchedThe new cases reuse the file's existing harness and assert relative order on the same recorded list, so they pin behavior (commit before chord byte) rather than implementation details.
AI Review Report
Reviewed for vacuity (all five new cases verified to fail against the pre-fix handler), for whether the assertions are behavioral rather than structural (they assert the recorded commit/pty order, not internals), and for platform assumptions (the Windows case forces the platform via the same
userAgentstub the neighboring suites use;macOptionAsAltstays'false', matching the harness default, and theAlt+Arrowresolver branch does not consult it). No production code, shortcuts, labels, paths, or shell behavior are touched.Security Audit
Test-only change. No input handling at a trust boundary, no command execution, no path handling, no auth, no secrets, no IPC, and no dependency changes.
Notes