Repository navigation
Audit fixes: only treat Apple input sources as Pinyin, bypass game sub-categories, keep key order; send keystrokes held during a source switch to the app they were typed in - #7
Conversation
…ries, keep key order - Third-party Pinyin input methods are no longer mistaken for Apple Pinyin, so their own Shift+Space shortcut is passed through. - Apps in per-genre game categories (action-games, ...) are bypassed. - A shortcut typed right after held text is released behind that text instead of overtaking it. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
… typed in If another app came to the front during the up-to-0.6 s confirmation window, the held keys were posted to the session and landed in the new app. The frontmost PID is recorded when holding starts; an app change releases the held keys at once to that PID (dropped if it quit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b3663fe5e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func frontmostApplicationDidChange() { | ||
| guard deferredEvents != nil else { return } | ||
| deferralGeneration += 1 | ||
| finishDeferringInput() |
There was a problem hiding this comment.
Preserve deferral during the internal focus hand-off
When switching to a CJKV source without a native indicator, InputSourceManager.refreshFocusedInputContext deliberately activates ShiftIME and then restores the original app, waiting for that app to regain focus before completing the switch. That internal activation now invokes this method through the workspace observer and flushes the buffered keys immediately, before the hand-off finishes. Consequently, typing during this fallback can replay text to the background app before its input context adopts the new source, defeating the existing protection against Latin output. Distinguish this internal activation from a user-initiated app change and retain the buffer until the switch completion.
Useful? React with 👍 / 👎.
| public static func isApplePinyin(id: String, localizedName: String) -> Bool { | ||
| let normalizedID = id.lowercased() | ||
| let normalizedName = localizedName.lowercased() | ||
| guard normalizedID.hasPrefix("com.apple.inputmethod.") else { return false } |
There was a problem hiding this comment.
Align the existing classifier checks with the new restriction
Running make test fails with FAILED: Traditional Pinyin keyboard layout activation is recognized: Scripts/StateMachineChecks.swift still expects com.apple.keylayout.TraditionalPinyinKeyboard to be accepted, but this guard rejects it. The build job in .github/workflows/build-dmg.yml runs these checks before building the universal DMG, so this change blocks packaging. Update the check if rejecting that layout is intentional, or preserve its classification if it remains supported.
Useful? React with 👍 / 👎.
…hiftIME's own focus hand-off - The Apple-only check also rejected com.apple.keylayout.* sources such as TraditionalPinyinKeyboard, failing the state machine checks in CI. - Activating ShiftIME itself (and then the original app) to refresh the input context no longer counts as an app change, so held keys are not flushed before the switch completes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
變更
fix: only treat Apple input sources as Pinyin, bypass game sub-categories, keep key order
Pinyin, so their own Shift+Space shortcut is passed through.
instead of overtaking it.
fix: send keystrokes held during a source switch to the app they were typed in
If another app came to the front during the up-to-0.6 s confirmation
window, the held keys were posted to the session and landed in the new
app. The frontmost PID is recorded when holding starts; an app change
releases the held keys at once to that PID (dropped if it quit).
驗證
只做了 swiftc -parse 語法檢查;未在 macOS 編譯或實測。
🤖 Generated with Claude Code