Skip to content

fix(terminal): clear stale Windows IME modifiers - #12259

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/shift-issue
Aug 3, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/shift-issue

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Reconcile remembered Windows IME Shift/Ctrl ownership from KeyboardEvent.getModifierState() on keyboard events.
  • Clear modifiers released as Chromium IME Process keyups while preserving the modifier-lost Enter redispatch used by active composition chords.
  • Add regression coverage for a Korean IME-consumed Shift keyup followed by bare Enter.

Fixes #12256

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck:web
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/terminal-ime-deferred-newline.test.ts src/renderer/src/components/terminal-pane/keyboard-handlers-ime.test.tsx (38 tests)
  • Formatting, direct Oxlint quality/type-aware/React Doctor scans, diff check, and max-lines ratchet

check:code-quality:changed encountered a Windows Node 24 spawnSync pnpm.cmd EINVAL; each of its three Oxlint scans was run directly and passed.

AI Review Report

Reviewed modifier lifecycle, Chromium's modifier-lost composition Enter redispatch, editable-target scoping, and the existing Shift/Ctrl rollover behavior. The initial unconditional synchronization approach would have broken legitimate composition redispatches, so reconciliation preserves only an Enter owned by the active chord and clears it immediately after absorption.

Cross-platform review confirmed the new behavior remains gated by the existing Windows-only modifier state: macOS/Linux shortcut handling, labels, paths, shells, SSH/folder workspaces, and Electron host behavior are unchanged.

Security Audit

No new input sources, command execution, path handling, authentication, secrets, dependencies, or IPC are introduced. The change only reconciles renderer-local keyboard state from browser-provided modifier flags.

Notes

Regression introduced by #11293 (fe6f929c6e), which added heldImeEnterModifiers and released entries by matching event.key; Windows IME Process keyups bypass that match.

The reported composition-overlay offset is visually separate and remains out of scope because no shared root cause was identified.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds Windows IME modifier reconciliation to keyboard event handling. The handler updates tracked Shift and Ctrl state during modifier keydown, redispatched Enter keydown, and non-IME-Enter keyup events. A test verifies that a composing Process keyup clears held Shift state so a later Enter keydown is not prevented.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address issue #12256 by clearing stale Windows IME modifiers that cause unexpected terminal line breaks.
Out of Scope Changes check ✅ Passed The changes are limited to Windows IME modifier reconciliation and regression coverage related to issue #12256.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely describes the fix for stale Windows IME modifier state.
Description check ✅ Passed The description covers the required sections, user-visible change, testing, AI review, security audit, and platform-specific notes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@OrcaWin
OrcaWin merged commit 9e42b5f into main Aug 3, 2026
42 checks passed
nwparker pushed a commit that referenced this pull request Aug 3, 2026
nwparker pushed a commit that referenced this pull request Aug 3, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Korean IME input causes unexpected line breaks in the terminal

1 participant