Merge pull request #1549 from marcoarnulfo/fix/duplicate-shortcut

Keyboard Shortcuts: Duplicate is listed, so it can be given a shortcut
This commit is contained in:
BFlat 2026-10-13 09:07:31 +07:00 committed by GitHub
commit 523fd6e185
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View File

@ -132,7 +132,15 @@ pub fn specs() -> Vec<CommandSpec> {
has_selection_or_guides,
clear
),
cmd!("edit.duplicate", "Duplicate", [], None, "{dx?, dy?} duplicate the selection in place (offset optional)", has_selection, duplicate),
cmd!(
"edit.duplicate",
"Duplicate",
["Edit"],
None,
"{dx?, dy?} duplicate the selection in place (offset optional)",
has_selection,
duplicate
),
]
}

View File

@ -955,4 +955,13 @@ mod tests {
let mut seen = HashSet::new();
assert!(entries().iter().all(|e| seen.insert(e.key.clone())), "duplicate entries");
}
#[test]
fn duplicate_can_be_given_a_shortcut() {
// Duplicate has no default chord (#1539): it must still be listed so one can be set.
assert_eq!(entry("edit.duplicate").map(|e| e.group.as_str()), Some("Edit"));
let mut ov = BTreeMap::new();
assign(&mut ov, "edit.duplicate", Some("Cmd+Alt+Shift+F8"), false).unwrap();
assert_eq!(effective_in(&ov, "edit.duplicate").as_deref(), Some("Cmd+Alt+Shift+F8"));
}
}