Repository navigation
feat: 快捷菜单长按触发键支持区分左右 - #14
Closed
miantiao-me wants to merge 1 commit into
Closed
miantiao-me wants to merge 1 commit into
miantiao-me wants to merge 1 commit into
Conversation
Option, Control and Command can each open the quick menu on the left or
right key only, leaving the other side for normal use; "either side"
keeps the previous behavior. Existing features.json values ("option",
"control", "command") decode unchanged, so no config migration.
Detection now reads the unmasked modifierFlags raw value: the
device-dependent bits (NX_DEVICELALTKEYMASK and friends) tell the sides
apart, while librime still receives device-independent flags. A second
guard keeps side-only transitions (left ⌥ held, right ⌥ joins) out of
librime, exactly as the old dedup did.
- ModifierHold.Key grows 6 sided cases; a hold counts when the masked
flags equal generic-flag+side for a sided key, or generic-flag plus at
most one side bit for an unsided key
- withoutHoldKey keeps the generic flag while the opposite side is still
down, so ⌥+digit on that side isn't read as a plain menu key
- Swallowing the hold-key release clears librime's ascii_composer tap
latch via cancelModifierTap, so a surviving opposite-side release
can't toggle Chinese/English
- Settings picker offers either/left/right per key ×3 + off
- Tests cover sided arming, opposite-side join, sided release filtering,
generic-flag preservation and rawValue compatibility
foru17
added a commit
that referenced
this pull request
Oct 10, 2026
…ctuation, 以词定字 vs [ ] paging, left/right hold key Fixes #10, #11, #13. Includes #14 by @miantiao-me. Co-Authored-By: 面条 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
感谢贡献!已经合进 0.1.8 发布(公开仓库的提交 b4d69d5 由导出流程生成,署名里带上了你)。本机实测「只用右 ⌥」长按呼出菜单、左 ⌥ 不触发,工作正常。 评审时记下的几处小改进,后续我们来补: 因为公开仓库由私有仓库导出,这个 PR 无法直接合并,我先关闭它。 |
wangsizhu0504
pushed a commit
to wangsizhu0504/kime
that referenced
this pull request
Oct 12, 2026
…ctuation, 以词定字 vs [ ] paging, left/right hold key Fixes zoolapp#10, zoolapp#11, zoolapp#13. Includes zoolapp#14 by @miantiao-me. Co-Authored-By: 面条 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
需求
长按呼出快捷菜单的修饰键支持区分左右:Option / Control / Command 各提供「左右均可 / 仅左 / 仅右」+ 关闭,共 10 个选项。例如可只用右 ⌥ 触发,左 ⌥ 保留普通按键用途。
旧的
features.json配置值("option"、"control"、"command")语义保持「任意侧」,零迁移。实现
macOS
flagsChanged事件的modifierFlagsrawValue 本身携带设备相关位(NX_DEVICELALTKEYMASK等),原实现主动剥离了它。本 PR 恢复这一信息用于长按判定,librime 仍收设备无关 flags:ModifierHold.Key增加 6 个分侧 case;判定改为flags & relevantMask匹配「通用位 + 侧位」——分侧键要求侧位恰好等于目标侧;任意侧键接受单侧或无侧位(兼容虚拟键盘/远程桌面),两侧同按视为两个键不触发AIMEInputController.flagsChanged分两层取 flags;新增仅设备位变化不进 librime 的守卫(与旧去重行为等价);activate用同一快照初始化两份状态withoutHoldKey在对侧仍按住时保留通用位,使该侧 ⌥+数字不被当成普通菜单键;吞掉长按 release 时cancelModifierTap()清掉 librime ascii_composer 的 tap 锁存,防残留对侧 release 误切中英;右 Control 设备位按 IOLLEvent.h 实为1<<13(1<<7是 ALPHASHIFT_STATELESS)验证
swift test:12/12 ModifierHold + 全量回归通过(新增分侧武装/对侧加入/分侧释放/通用位保留/rawValue 兼容 5 个测试)xcodebuildDebug:BUILD SUCCEEDED兼容性