diff --git a/contributors/people.toml b/contributors/people.toml index cdaacd5..bbb6dd8 100644 --- a/contributors/people.toml +++ b/contributors/people.toml @@ -29,3 +29,6 @@ sync_github_name = false [people.saeedemperor] real_name = "Saeed Azarehgar" + +[people.vangel76] +sync_github_name = true diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 3d31bb1..1a86a75 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -37,7 +37,7 @@ pub fn specs() -> Vec { .params(r#"{"text": string, "matchCase"?: bool, "wholeWord"?: bool, "regex"?: bool}"#) .pure(), CommandSpec::new("edit.findNext", "Find Next", "Home › Editing › Find", |s, _| step(s, 1)).key("Mod+G / F3").pure(), - CommandSpec::new("edit.findPrevious", "Find Previous", "Home › Editing › Find", |s, _| step(s, -1)).key("Mod+Shift+G / Shift+F3").pure(), + CommandSpec::new("edit.findPrevious", "Find Previous", "Home › Editing › Find", |s, _| step(s, -1)).key("Mod+Shift+G").pure(), CommandSpec::new("edit.replace", "Replace", "Home › Editing", replace).key("Mod+H").params(r#"{"text": string, "with": string}"#), CommandSpec::new("edit.replaceAll", "Replace All", "Home › Editing › Replace", replace_all) .params(r#"{"text": string, "with": string, "matchCase"?: bool, "wholeWord"?: bool, "regex"?: bool}"#), diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 81347e6..13ea76d 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -36,6 +36,21 @@ fn every_command_has_unique_id() { assert!(n > 150, "{n} commands"); } +#[test] +fn every_shortcut_runs_one_command() { + // `by_shortcut` takes the first match, so a shared key silently shadows the later command (#186). + let reg = cmd::registry(); + let mut seen = std::collections::HashMap::new(); + for c in reg.all() { + for k in c.shortcut.split(" / ").filter(|k| !k.is_empty()) { + if let Some(other) = seen.insert(k.to_ascii_lowercase(), c.id) { + panic!("{k} is bound to both {other} and {}", c.id); + } + } + } + assert_eq!(reg.by_shortcut("Shift+F3").map(|c| c.id), Some("format.changeCase")); +} + #[test] fn typing_enter_undo() { let mut s = s();