Skip to content

Fix macOS IME input mode detection - #6699

Merged
AmethystLiang merged 2 commits into
mainfrom
bug-help-chinese-but-not-vietnamese
Jun 29, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
bug-help-chinese-but-not-vietnamese

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Summary:

  • Prefer macOS AppleSelectedInputSources input modes before falling back to AppleCurrentKeyboardLayoutInputSourceID.
  • Refresh terminal IME input-source features from focused keyboard activity so CJK punctuation gates do not stay stale.
  • Keep direct CJK punctuation forwarding while avoiding broad punctuation forwarding for Vietnamese input sources.

Tests:

  • pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/app.test.ts src/renderer/src/components/terminal-pane/terminal-ime-input-source.test.ts src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.test.ts

Ensure ASCII and CJK direct punctuation keys are only treated as keydown
candidates if `forwardAsciiPunctuation` is enabled in the current input
source features. This avoids forwarding punctuation when the feature is
disabled, satisfying requirements where certain input methods (such as
Vietnamese) should not have punctuation forwarding enabled.
@AmethystLiang
AmethystLiang merged commit 61bb2f9 into main Jun 29, 2026
2 of 3 checks passed
@coderabbitai

coderabbitai Bot commented Jun 29, 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

Run ID: bb5d2430-3ecc-4118-bd0a-fabff84e2314

📥 Commits

Reviewing files that changed from the base of the PR and between 01cf5e3 and 5b242f2.

📒 Files selected for processing (8)
  • src/main/ipc/app.test.ts
  • src/main/ipc/app.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • 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-forwarder.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.ts

📝 Walkthrough

Walkthrough

The macOS app:getKeyboardInputSourceId IPC handler is reworked to read AppleSelectedInputSources from the HIToolbox preferences plist via /usr/bin/plutil, reverse-scanning records to return the selected input mode or bundle ID, and falling back to /usr/bin/defaults read AppleCurrentKeyboardLayoutInputSourceID when no input mode is found. A generalized readCommandStdout helper replaces the previous probe function. In the renderer, createMacNativeTextInputSourceTracker gains a queued/in-flight refresh guard, a cooldown-throttled keyboard-activity refresh path, and keydown/keyup capture listeners. The IME forwarder now treats CJK direct punctuation as an unconditional candidate independent of the forwardAsciiPunctuation feature flag, and reorders guards in forwardCommittedText. Tests are added or updated throughout to cover these paths.

✨ 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.

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Gate punctuation forwarding on input source feature

Ensure ASCII and CJK direct punctuation keys are only treated as keydown
candidates if `forwardAsciiPunctuation` is enabled in the current input
source features. This avoids forwarding punctuation when the feature is
disabled, satisfying requirements where certain input methods (such as
Vietnamese) should not have punctuation forwarding enabled.

* Fix macOS IME input mode detection
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