mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-30 13:36:52 -06:00
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:
co-authored by
Claude Opus 5.5
parent
4517dd4e88
commit
b1ca1230e6
@@ -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",
|
||||
|
||||
@@ -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:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user