Fast Previews and Show Channel: one command per mode, with default keys

Both were a single command taking the mode as a parameter, with no menu entry,
so nothing could carry a default key. Each mode is now its own command:
view.fastPreviews.off / adaptive / draft / fastDraft / wireframe (Cmd+Alt+1-5)
and view.channel.red / green / blue / alpha (Alt+1-4), redColorized /
greenColorized / blueColorized (Alt+Shift+1-3) and rgbStraight (Alt+Shift+4).
A channel's key again returns to RGB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pravdomil
2026-10-12 17:34:56 +02:00
co-authored by Claude Opus 5.5
parent 9efe75330c
commit 92e3939ca7
3 changed files with 68 additions and 1 deletions
+35
View File
@@ -375,6 +375,41 @@ fn defaults_have_no_conflicts_and_match_the_menus() {
assert!(t.bindables.len() > 500);
}
/// Each Fast Previews and Show Channel mode is a command with a default key.
#[test]
fn fast_previews_and_show_channel_modes_have_default_keys() {
let s = Session::default();
let t = s.shortcuts();
for (id, key) in [
("view.fastPreviews.off", "Cmd+Alt+1"),
("view.fastPreviews.adaptive", "Cmd+Alt+2"),
("view.fastPreviews.draft", "Cmd+Alt+3"),
("view.fastPreviews.fastDraft", "Cmd+Alt+4"),
("view.fastPreviews.wireframe", "Cmd+Alt+5"),
("view.channel.red", "Alt+1"),
("view.channel.green", "Alt+2"),
("view.channel.blue", "Alt+3"),
("view.channel.alpha", "Alt+4"),
("view.channel.redColorized", "Alt+Shift+1"),
("view.channel.greenColorized", "Alt+Shift+2"),
("view.channel.blueColorized", "Alt+Shift+3"),
("view.channel.rgbStraight", "Alt+Shift+4"),
] {
assert_eq!(t.shortcut_of(id, &json!(null)), Some(key), "{id}");
}
assert!(t.all_conflicts().is_empty(), "{:?}", t.all_conflicts());
// The commands set their mode; a channel's key again is RGB.
let mut s = Session::default();
s.execute("view.fastPreviews.fastDraft", json!({})).unwrap();
assert_eq!(s.state.viewer.fast_previews.id(), "fastDraft");
s.execute("view.channel.redColorized", json!({})).unwrap();
assert_eq!((s.state.viewer.channel.id(), s.state.viewer.colorized), ("red", true));
s.execute("view.channel.green", json!({})).unwrap();
assert_eq!((s.state.viewer.channel.id(), s.state.viewer.colorized), ("green", false));
s.execute("view.channel.green", json!({})).unwrap();
assert_eq!(s.state.viewer.channel.id(), "rgb");
}
/// Cmd+Left / Cmd+Right Arrow step a frame like Page Up / Page Down (Shift: 10 frames).
#[test]
fn cmd_arrows_step_frames_like_page_keys() {