Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/assets/capabilities.snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -1892,6 +1892,16 @@
"key": "keys.highlight_keys",
"type": "strlist"
},
{
"default": [],
"key": "keys.syllable_jump_keys",
"type": "strlist"
},
{
"default": false,
"key": "keys.caret_scoped_candidates",
"type": "bool"
},
{
"default": [],
"key": "keys.select_char_keys",
Expand Down
4 changes: 3 additions & 1 deletion src/assets/pinyin_initials.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 汉字 → 拼音首字母(1-2 个,多音字取常用频率前两读)
# 由 scripts/gen-pinyin-initials.ps1 从 core 的 build/data/pinyin_map.txt 生成,请勿手改。
# 字数: 384
# 字数: 388
# 注:本版是旧表与 Linux 上重算结果的并集补齐——Linux 下仅限 Windows 的设置项不进标题语料,在 Linux 上重跑脚本会把表缩掉这批字;请在 Windows 上重跑。
一 y
三 s
Expand Down Expand Up @@ -36,6 +36,7 @@
停 t
僻 p
允 y
光 g
入 r
全 q
关 g
Expand Down Expand Up @@ -277,6 +278,7 @@
筛 s
签 q
简 j
算 s
管 g
箱 x
类 l
Expand Down
27 changes: 24 additions & 3 deletions src/assets/settings_manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2875,6 +2875,28 @@ label = "方向键 ↑ ↓"
value = "tab"
label = "Tab / Shift+Tab"

[[items]]
key = "keys.syllable_jump_keys"
group = "keys"
section = "候选操作"
type = "checkbox_group"
label = "按音节跳转"
hint = "在编码区按分段跳转,向右循环。勾选的键组优先用于跳转"
[[items.options]]
value = "arrows"
label = "方向键 ↑ ↓"
[[items.options]]
value = "tab"
label = "Tab / Shift+Tab"

[[items]]
key = "keys.caret_scoped_candidates"
group = "keys"
section = "候选操作"
type = "toggle"
label = "光标移动重算候选"
hint = "开启后,光标移到编码中间时只为光标前的编码出候选,选词上屏后保留余码。"

[[items]]
key = "keys.page_keys"
group = "keys"
Expand Down Expand Up @@ -3053,9 +3075,8 @@ options = [

# ── 自定义按键:两张表的完整逐键编辑入口 ──
#
# 与上面「候选操作」那四项勾选框的关系:那四项是**常用形态**(按组勾选),本节是**完整
# 形态**(逐键指定)。两者在 core 侧合流——四项会被折算进 session_actions 同一张表,本表
# 里显式配的键优先。故放在勾选项之后:先给常用的,再给需要时才展开的。
# 上面「候选操作」按组勾选,本节逐键指定。两者在 core 侧合流,键组也折算进 session_actions。
# 本表里显式配的键优先。故放在勾选项之后:先给常用的,再给需要时才展开的。
#
# ⚠️ 两项的分野**不是**「空闲时 vs 输入中」。`key_actions` 的三条通路(组合键热键、
# 修饰键 keyup、单字符引导键)在输入中同样触发——「按 Shift 切中英文」走的正是第二条。
Expand Down
3 changes: 2 additions & 1 deletion src/dialogs/comment_switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,14 @@ pub fn switch_key_note(enabled: bool, switch_key: &str, uses: &CtrlUses) -> Stri
}

/// 拼 [`CtrlUses`] 要的几张全局表(取不到的项不放,按 core 出厂值)。
const KEYS_READ: [&str; 7] = [
const KEYS_READ: [&str; 8] = [
"toggle_mode_keys",
"session_actions",
"key_actions",
"select_key_groups",
"page_keys",
"highlight_keys",
"syllable_jump_keys",
"select_char_keys",
];

Expand Down
1 change: 1 addition & 0 deletions src/key_conflict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ pub const CANDIDATE_FIELDS: &[(&str, &str)] = &[
("keys.select_key_groups", "次选/三选键"),
("keys.page_keys", "翻页键"),
("keys.highlight_keys", "高亮移动键"),
("keys.syllable_jump_keys", "按音节跳转"),
("keys.select_char_keys", "以词定字"),
];

Expand Down
2 changes: 2 additions & 0 deletions src/mockdata/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
"keys": {
"activate_ime": "ctrl+shift+[",
"add_word": "ctrl+equal",
"caret_scoped_candidates": false,
"commit_on_switch": true,
"ctrl_space_toggle": true,
"delete_candidate": "ctrl+shift+number",
Expand Down Expand Up @@ -281,6 +282,7 @@
"session_actions": {},
"softkeyboard": "ctrl+shift+k",
"switch_engine": "ctrl+shift+e",
"syllable_jump_keys": [],
"take_screenshot": "ctrl+shift+f11",
"toggle_full_width": "shift+space",
"toggle_mode_keys": [
Expand Down
29 changes: 27 additions & 2 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3083,7 +3083,7 @@ impl AppState {
/// 实时按键冲突检测:跑写回器到 current 的副本上(反映编辑中的最新 Signal 值),
/// 分三个场景域各自检测——**跨域不算冲突**(同一物理键在不同场景分时复用是正常设计):
/// - 触发键域:无候选/闲时触发模式(临时拼音/英文、混合、特殊模式)。
/// - 候选键域:有候选时操作候选(次选/翻页/高亮移动/以词定字)。
/// - 候选键域:有候选时操作候选(次选/翻页/高亮移动/音节跳转/以词定字)。
/// - 快捷键域:功能组合键(切换方案/标点/工具栏…、置顶/删除词条),归一化后同键即冲突。
///
/// 结果按**级别**分流,两者呈现方式不同(见 [`ConflictLevel`]):
Expand Down Expand Up @@ -3546,9 +3546,14 @@ fn collect_candidate_key_groups(cfg: &Config) -> Vec<KeyGroup> {
),
KeyGroup::new(
"highlight_keys",
"高亮移动键",
"高亮移动按键",
expand_strs(cfg.get_array("keys.highlight_keys")),
),
KeyGroup::new(
"syllable_jump_keys",
"按音节跳转",
expand_strs(cfg.get_array("keys.syllable_jump_keys")),
),
KeyGroup::new(
"select_char",
"以词定字",
Expand Down Expand Up @@ -4285,6 +4290,26 @@ mod trigger_conflict_tests {
);
}

#[test]
fn test_syllable_jump_candidate_key_conflicts() {
for (field, selected, jump, symbol, label) in [
("highlight_keys", "arrows", "arrows", "↑", "高亮移动按键"),
("highlight_keys", "tab", "tab", "Tab", "高亮移动按键"),
("page_keys", "shift_tab", "tab", "Tab", "翻页键"),
] {
let mut cfg = Config::from_value(json!({
"keys": { (field): [selected], "syllable_jump_keys": [jump] }
}));
let msg = check_candidate_key_conflicts(&cfg).expect("音节跳转键组应检出冲突");
assert!(msg.contains("候选键冲突"));
assert!(msg.contains(symbol));
assert!(msg.contains(label));
assert!(msg.contains("按音节跳转"));
cfg.set_path("keys.syllable_jump_keys", json!([]));
assert!(check_candidate_key_conflicts(&cfg).is_none());
}
}

#[test]
fn test_hotkey_domain_conflict_normalizes_order() {
// 两功能绑到同一组合键(写法顺序不同)→ 归一后应检出冲突。
Expand Down
Loading