#2991: list Enter Isolation Mode in Keyboard Shortcuts

Mark object.isolate id as optional so runs_without_params includes it in the shortcut editor; engine already isolates the first selected object when id is omitted.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
nrq6993-a11y
2026-10-20 01:48:35 +07:00
committed by bflatastic
co-authored by Cursor
parent db9fa8e0a9
commit 62910d0327
3 changed files with 24 additions and 1 deletions
+1 -1
View File
@@ -227,7 +227,7 @@ pub fn specs() -> Vec<CommandSpec> {
has_selection,
|s, _| clip_edit(s, true)
),
cmd!("object.isolate", "Enter Isolation Mode", [], None, "{id}", has_doc, isolate),
cmd!("object.isolate", "Enter Isolation Mode", [], None, "{id?} (default: the selection's first object)", has_doc, isolate),
cmd!("object.exitIsolation", "Exit Isolation Mode", [], None, "{}", has_doc, exit_isolation),
cmd!(
"object.setProps",
+11
View File
@@ -1280,6 +1280,17 @@ fn next_object_above_and_below_pass_over_what_cant_be_selected() {
assert_eq!(selected(&s), vec![a]);
}
/// A keyboard shortcut runs `object.isolate` with no params; the first selected object is isolated (#2991).
#[test]
fn object_isolate_without_id_uses_the_selection() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 50.0, 50.0);
let _b = rect(&mut s, 100.0, 0.0, 50.0, 50.0);
sel(&mut s, &[a]);
s.execute("object.isolate", &json!({})).unwrap();
assert_eq!(s.doc().unwrap().isolation, Some(a));
}
/// In isolation mode Select › Same and Select › Object select only objects in the isolated group.
#[test]
fn select_menu_commands_stay_inside_the_isolated_group() {
+12
View File
@@ -1014,4 +1014,16 @@ mod tests {
assert!(assign(&mut ov, "symbol.breakLink", Some("Cmd+Alt+Shift+F9"), true).is_ok());
assert_eq!(effective_in(&ov, "symbol.breakLink").as_deref(), Some("Cmd+Alt+Shift+F9"));
}
/// #2991: Enter Isolation Mode has no default key but runs on the selection, so it belongs in
/// Edit › Keyboard Shortcuts.
#[test]
fn enter_isolation_mode_command_is_listed_and_assignable() {
let e = entry("object.isolate").expect("listed");
assert_eq!((e.label.as_str(), e.group.as_str(), e.is_tool), ("Enter Isolation Mode", "Object", false));
assert_eq!(default_of("object.isolate"), None);
let mut ov = BTreeMap::new();
assign(&mut ov, "object.isolate", Some("Cmd+Alt+Shift+F11"), false).unwrap();
assert_eq!(effective_in(&ov, "object.isolate").as_deref(), Some("Cmd+Alt+Shift+F11"));
}
}