fix: support dual key bindings for Ctrl+Shift layout switching#141
fix: support dual key bindings for Ctrl+Shift layout switching#141wyu71 merged 1 commit intolinuxdeepin:masterfrom
Conversation
Reviewer's GuideImplements dual key binding support for the Ctrl+Shift layout-switching shortcut by returning two key combinations from the enum mapping and writing them into separate config entries, while keeping existing behavior for other shortcuts and ensuring a fallback single-binding path. Sequence diagram for dual key binding write-back on Ctrl+Shift selectionsequenceDiagram
actor User
participant ShortcutsComboBox
participant ShortcutsModule
participant Fcitx5ConfigProxy
User ->> ShortcutsComboBox: select CtrlShift option
ShortcutsComboBox ->> ShortcutsModule: onActivated(currentIndex)
ShortcutsModule ->> ShortcutsModule: reversed = reverseEnumerateForwardKeys(currentIndex)
alt reversed is two dimensional array (CtrlShift)
ShortcutsModule ->> Fcitx5ConfigProxy: setValue(Hotkey/EnumerateForwardKeys/0, [Control, Shift_L], true)
ShortcutsModule ->> Fcitx5ConfigProxy: setValue(Hotkey/EnumerateForwardKeys/1, [Control, Shift, Control_L], true)
else reversed is single binding (e.g. AltShift)
ShortcutsModule ->> Fcitx5ConfigProxy: setValue(Hotkey/EnumerateForwardKeys/0, reversed, true)
ShortcutsModule ->> Fcitx5ConfigProxy: setValue(Hotkey/EnumerateForwardKeys/1, [""], true)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- reverseEnumerateForwardKeys now returns heterogeneous types (string vs nested array) but only this onActivated handler is aware of that; consider normalizing its return type or centralizing the branching logic so other current/future callers don’t have to special-case it.
- The Ctrl+Shift handling directly embeds the two key sequences as literals; it may be clearer and less error-prone to derive these from a shared mapping/utility (similar to the existing ALT_SHIFT handling) rather than hardcoding the arrays inline.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- reverseEnumerateForwardKeys now returns heterogeneous types (string vs nested array) but only this onActivated handler is aware of that; consider normalizing its return type or centralizing the branching logic so other current/future callers don’t have to special-case it.
- The Ctrl+Shift handling directly embeds the two key sequences as literals; it may be clearer and less error-prone to derive these from a shared mapping/utility (similar to the existing ALT_SHIFT handling) rather than hardcoding the arrays inline.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Return two key combinations for Ctrl+Shift shortcut instead of single value. Ctrl+Shift快捷键返回两组按键组合,支持多组快捷键写入配置。 Log: 修复Ctrl+Shift切换快捷键支持双按键组合 PMS: BUG-357563 Influence: Ctrl+Shift布局切换快捷键现在支持两组按键绑定,切换行为更准确。
deepin pr auto review这份代码的修改主要是对快捷键配置逻辑的优化和重构,特别是针对枚举快捷键的处理方式。以下是对该代码的详细审查意见: 1. 语法与逻辑审查优点:
潜在问题与建议:
2. 代码质量优点:
改进建议:
3. 代码性能
4. 代码安全
总结这是一次高质量的代码重构。主要改进点在于:
唯一的小建议是考虑将具体的按键名称字符串(如 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, wyu71 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Return two key combinations for Ctrl+Shift shortcut instead of single value.
Ctrl+Shift快捷键返回两组按键组合,支持多组快捷键写入配置。
Log: 修复Ctrl+Shift切换快捷键支持双按键组合
PMS: BUG-357563
Influence: Ctrl+Shift布局切换快捷键现在支持两组按键绑定,切换行为更准确。
Summary by Sourcery
Bug Fixes: