mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Merge PR #7870: Shortcuts: Ctrl+F4 closes the document beside Ctrl+W (Windows/Linux)
This commit is contained in:
commit
02eeecd59f
2 files changed
+22
-1
No files matched your search
@@ -1519,7 +1519,8 @@ pub const TEMPORARY_TOOLS: &[(&str, &str, &str)] = &[
|
||||
/// Photoshop's second default keys (#3665): (command, key). Each command keeps its main key
|
||||
/// (the one its menu shows) and answers these as well, as in Photoshop's default set: the
|
||||
/// legacy function keys F2 Cut, F3 Copy, F4 Paste and Shift+F7 Inverse; Shift+Backspace
|
||||
/// (Shift+Delete on a Mac) for Fill; and ⌘+ beside ⌘= for Zoom In.
|
||||
/// (Shift+Delete on a Mac) for Fill; ⌘+ beside ⌘= for Zoom In; and off the Mac, Ctrl+F4 beside
|
||||
/// Ctrl+W for Close (Windows' close-document key; macOS keeps Ctrl+F4 for window focus).
|
||||
pub const ALTERNATE_SHORTCUTS: &[(&str, &str)] = &[
|
||||
("edit.cut", "F2"),
|
||||
("edit.copy", "F3"),
|
||||
@@ -1527,6 +1528,8 @@ pub const ALTERNATE_SHORTCUTS: &[(&str, &str)] = &[
|
||||
("edit.fill", "Shift+Backspace"),
|
||||
("select.inverse", "Shift+F7"),
|
||||
("view.zoomIn", "Cmd++"),
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
("file.close", "Cmd+F4"),
|
||||
];
|
||||
|
||||
/// A command's default alternate keys ([`ALTERNATE_SHORTCUTS`]).
|
||||
|
||||
@@ -356,6 +356,24 @@ fn alternate_keys_run_their_command() {
|
||||
assert!(take_log(&h.ctx).is_empty());
|
||||
}
|
||||
|
||||
/// Ctrl+F4 closes the document beside Ctrl+W, as in Photoshop on Windows, through the same
|
||||
/// guarded Close: unsaved changes still get the save prompt.
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
#[test]
|
||||
fn ctrl_f4_closes_the_document() {
|
||||
let mut h = harness();
|
||||
put_focus(&mut h, Place::Canvas);
|
||||
press(&mut h, "Cmd+F4");
|
||||
assert!(matches!(take_log(&h.ctx).as_slice(), [(id, Outcome::Ran)] if id == "file.close"));
|
||||
assert!(h.state().discard.is_some(), "unsaved changes ask first");
|
||||
assert_eq!(h.state().session.documents().len(), 1);
|
||||
h.state_mut().discard = None;
|
||||
let st = h.state_mut().session.active_mut().unwrap();
|
||||
st.saved_revision = st.revision;
|
||||
press(&mut h, "Cmd+F4");
|
||||
assert!(h.state().session.documents().is_empty(), "a saved document closes");
|
||||
}
|
||||
|
||||
/// #352: ⌥[ ⌥] ⌥, ⌥. and ⇧⌥[ walk the Layers panel's rows from the keyboard.
|
||||
#[test]
|
||||
fn alt_brackets_walk_the_layers_panel() {
|
||||
|
||||
Reference in new issue
Block a user