Engine: text.delete and text.move are registered once (the newer docs win); a test keeps command ids unique

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-14 16:15:17 -04:00
co-authored by Claude Opus 5.5
parent 4517dd4e88
commit b1ca1230e6
2 changed files with 7 additions and 2 deletions
-2
View File
@@ -36,7 +36,6 @@ pub fn specs() -> Vec<CommandSpec> {
autocorrect_options
),
cmd!("text.insert", "Type Text", [], None, "{text} (\\n = new paragraph, \\u000b = line break)", has_text, insert),
cmd!("text.delete", "Delete Text", [], Some("Backspace"), "{dir?: backward|forward|wordBackward|wordForward}", has_text, delete),
// The input method's composition: shown in place, an undo step only once committed.
CommandSpec {
id: "text.compose",
@@ -58,7 +57,6 @@ pub fn specs() -> Vec<CommandSpec> {
has_text,
commit
),
cmd!(noundo "text.move", "Move Insertion Point", [], None, "{to: left|right|up|down|wordLeft|wordRight|lineStart|lineEnd|paraStart|paraEnd|start|end, extend?: bool}", has_text, move_caret),
cmd!(
"text.delete",
"Delete Text",
+7
View File
@@ -3454,3 +3454,10 @@ fn background_loads_are_adopted_through_a_command() {
assert!(s.execute("file.adopt", &json!({})).is_err());
std::fs::remove_file(&path).ok();
}
#[test]
fn every_command_id_is_registered_once() {
let mut seen = std::collections::HashSet::new();
let dups: Vec<&str> = crate::command_specs().iter().map(|c| c.id).filter(|id| !seen.insert(*id)).collect();
assert!(dups.is_empty(), "registered more than once: {dups:?}");
}