M1: = zooms in as - zooms out (#973)

Plain `-` zoomed out but plain `=` (the `+` key without Shift) did nothing,
so a canvas zoomed out with `-` couldn't be zoomed back in the same way;
held down, `-` reaches the 2% floor and `=` leaves you there. Ctrl+Shift+=
zoomed in while Ctrl+Shift+- did nothing either.

Found with a trace of the input on GNOME Wayland: Ctrl+wheel, Ctrl+=,
Ctrl+-, Ctrl+Shift+= and `-` all reach the canvas and zoom; `=` and
Ctrl+Shift+- arrive too but no binding takes them.

`view.zoomIn` gains `=` and `view.zoomOut` gains `Shift+Cmd+-`, pinned in
the shortcut parity table; neither key was bound elsewhere and the menus
still show Ctrl/Cmd and `+`/`-`. A keymap test checks each zoom-in key
has its zoom-out twin on both platforms.
This commit is contained in:
Ridzzz0Alam
2026-10-21 17:41:30 +02:00
parent 35da7b7cff
commit f619dca716
3 changed files with 25 additions and 4 deletions
+4 -2
View File
@@ -220,8 +220,10 @@ pub static KEYS: &[Binding] = &[
k(View, "view.prevPage", &["PageUp"]),
k(View, "view.nextPage", &["PageDown"]),
// Zoom
k(Zoom, "view.zoomIn", &["Cmd+=", "Shift+=", "Shift+Cmd+="]),
k(Zoom, "view.zoomOut", &["Cmd+-", "-", "Shift+-"]),
// Each zoom-in key has its zoom-out twin on the key beside it: `-` alone zooms out, so `=`
// alone (the `+` key without Shift) zooms in (#973).
k(Zoom, "view.zoomIn", &["Cmd+=", "Shift+=", "Shift+Cmd+=", "="]),
k(Zoom, "view.zoomOut", &["Cmd+-", "-", "Shift+-", "Shift+Cmd+-"]),
k(Zoom, "view.zoom100", &["Shift+0", "Cmd+0"]),
k(Zoom, "view.zoomFit", &["Shift+1"]),
k(Zoom, "view.zoomSelection", &["Shift+2"]),
+19
View File
@@ -168,6 +168,25 @@ fn display_per_platform() {
assert_eq!(primary("polygon.none", mac), None);
}
/// Each way of zooming in has its zoom-out twin on the key beside it, as the keys arrive from a US
/// keyboard (#973: `-` alone zoomed out but `=` alone did nothing, so zooming back in was stuck).
#[test]
fn zoom_keys_come_in_pairs() {
let none = Mods::default();
let shift = mods(true, false, false, false);
let cmd = mods(false, false, true, false);
let shift_cmd = mods(true, false, true, false);
for p in PLATFORMS {
for (zoom_in, zoom_out, m) in [("Equals", "Minus", none), ("Equals", "Minus", cmd), ("Plus", "Minus", shift_cmd), ("Plus", "Minus", shift)] {
assert_eq!(id_for(p, Context::Canvas, zoom_in, m), Some("view.zoomIn"), "{zoom_in} {m:?} on {p:?}");
assert_eq!(id_for(p, Context::Canvas, zoom_out, m), Some("view.zoomOut"), "{zoom_out} {m:?} on {p:?}");
}
// The menus still show Cmd/Ctrl and `+`.
assert_eq!(primary("view.zoomIn", p), Some("Cmd+="));
assert_eq!(primary("view.zoomOut", p), Some("Cmd+-"));
}
}
#[test]
fn tool_keys_come_from_the_keymap() {
assert_eq!(ToolId::Move.shortcut(), "V");
+2 -2
View File
@@ -162,8 +162,8 @@ static ROWS: &[Row] = &[
doc(Zoom, "Zoom out", &["Cmd+-", "-"], &[], Bound("view.zoomOut"), ""),
doc(Zoom, "Zoom to fit", &["Shift+1"], &[], Bound("view.zoomFit"), ""),
doc(Zoom, "Zoom to the selection", &["Shift+2"], &[], Bound("view.zoomSelection"), ""),
pin(Zoom, "view.zoomIn", &["Shift+Cmd+="], &[]),
pin(Zoom, "view.zoomOut", &["Shift+-"], &[]),
pin(Zoom, "view.zoomIn", &["Shift+Cmd+=", "="], &[]),
pin(Zoom, "view.zoomOut", &["Shift+-", "Shift+Cmd+-"], &[]),
pin(Zoom, "view.zoom100", &["Shift+0", "Cmd+0"], &[]),
pin(Zoom, "view.prevFrame", &["Shift+N", "Home"], &[]),
pin(Zoom, "view.nextFrame", &["N", "End"], &[]),