Skip to content

fix(terminal): preserve macOS Korean composition - #12280

Merged
nwparker merged 1 commit into
stablyai:mainfrom
nwparker:nwparker/korean-typing
Aug 3, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
nwparker:nwparker/korean-typing

Conversation

@nwparker

@nwparker nwparker commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve macOS 2-Set Korean composition in xterm terminals.
  • Return initial Hangul jamo keydowns to the native IME instead of letting xterm consume and preventDefault them before composition starts.
  • Scope the bypass to recognized Korean input sources and unmodified jamo keys, leaving shortcuts and other input sources unchanged.
  • Add native macOS exact-byte coverage for physical 2-Set input.

Native reproduction before the fix: physical gksrmf reached the PTY as ㅎㅏㄴ글.

After the fix: the same physical keys reach the PTY as 한글 (ed959ceab8800a).

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Ran:

  • Native macOS 2-Set Korean headful E2E before and after the fix; reproduced the wrong exact PTY bytes, then passed with 한글.
  • 210 focused terminal IME tests across 9 files.
  • Node and web TypeScript checks.
  • Oxlint and React Doctor checks on all changed files.
  • Oxfmt and git diff --check.
  • The native E2E setup rebuilt the Electron app and bundled CLI successfully.

AI Review Report

Reviewed the event boundary from macOS keydown through xterm composition and PTY bytes. The main risk was over-bypassing normal terminal keys or existing CJK/Vietnamese handling. The implementation gates jamo handling on a recognized Korean input source, rejects Ctrl/Alt/Meta chords, and leaves active compositions with xterm's existing composition helper.

Cross-platform compatibility was explicitly checked. Production behavior changes only on macOS when a Korean input source is active. Linux/IBus, Windows IME, SSH/folder-workspace routing, shortcut labels, paths, and shell behavior are unchanged. The macOS-only native test is platform- and environment-gated.

Security Audit

No production command execution, dependency, IPC, authentication, secret, or path-handling changes. Input handling is constrained to single Hangul jamo code points and unmodified key events. The native test invokes fixed AppleScript commands through execFileSync; its only interpolation is the numeric Electron process ID, and it runs only behind an explicit macOS test gate.

Notes

The native regression requires macOS Accessibility access and Apple 2-Set Korean selected, then runs with ORCA_E2E_NATIVE_MACOS_KOREAN=1.

@nwparker
nwparker merged commit 035d8c2 into stablyai:main Aug 3, 2026
41 checks passed
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2a3fec2b-50a0-4b54-b6f9-d0e605f207f7

📥 Commits

Reviewing files that changed from the base of the PR and between f82d410 and 841e157.

📒 Files selected for processing (5)
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-candidates.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.test.ts
  • tests/e2e/terminal-macos-2set-korean-native.spec.ts

📝 Walkthrough

Walkthrough

The change adds forwardHangulJamo to macOS native text-input feature detection. Korean input sources enable the feature, while other sources keep it disabled. Native text handling now recognizes and forwards Hangul Jamo keys when enabled. Unit tests cover source detection and modifier behavior. A conditional macOS headful end-to-end test verifies native 2-Set Korean input, PTY bytes, and terminal boundary events.


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.

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.

1 participant