Repository navigation
fix(input): clear composition with Command-Backspace - #1201
Open
riversky0014 wants to merge 1 commit into
Open
riversky0014 wants to merge 1 commit into
riversky0014 wants to merge 1 commit into
Conversation
riversky0014
force-pushed
the
codex/cmd-backspace-clear-composition
branch
from
November 6, 2026 03:19
ba34258 to
0797c14
Compare
Member
|
代碼看着不錯。 |
Author
|
我测试了 Finder, VSCode 与 Photos,只要是在输入框做输入的时候,按 command+backspace 不会出现问题,行为表现与现有的 option+backspace 表现一致。我是用 github actions 在这个分支上编译得到的 Rime MacOS APP,然后在我本地MacOS(15.7)上使用的,已经有使用一段时间了,command+backspace 的行为表现正常。另外其实是我从 搜狗输入法 迁移过来带来的习惯,command+backspace 在搜狗输入法上是删除当前键入框里的全部内容,故而想到给 Rime 增加这个功能 |
Member
|
輕信聲張,Finder 重命名文件時測試,⌘+⌫ 直接給文件刪了…… 我是不敢用了。系統快捷鍵還是留給系統和應用程序吧。 |
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.
When a composition is active, Command-Backspace currently bypasses Squirrel and is handed to the client application, so it cannot reliably clear the pending input. This adds a narrow exception: Command-Backspace discards the entire uncommitted composition and refreshes the marked text and candidate UI, including when the caret is in the middle or an earlier segment has already been selected.
On macOS, Command-Backspace is commonly used to delete back to the beginning of a line. Treating the pending input as a single editing unit makes clearing it with the same shortcut a natural extension of that convention. Once there is no composition, the event still belongs to the client app and retains its normal editing behavior.
The handler only consumes plain Command-Backspace while librime reports an active composition. Caps Lock does not disable the shortcut; Shift/Option/Control/Fn combinations, forward Delete, and other Command shortcuts are unchanged. Pending chord releases are cancelled before clearing so a chord timer cannot replay stale input.
Related: #805. This does not enable arbitrary Command key bindings; it handles one composition-editing shortcut when the event is delivered to Squirrel.
Validation:
git diff --check, Swift parser check, and repository-wide SwiftLint 0.65.1 passed (SwiftLint reports a complexity warning in the unchangedrimeUpdatemethod).NSEventobjects, and librime 1.16.0 against an isolated user-data directory. All 21 checks passed: full composition, middle caret, partially selected composition, Caps Lock, repeat events, empty/ASCII state, extra modifiers, other Command shortcuts, key release, and failed status lookup. Clear operations produced no committed text and requested a UI refresh.