From 4551b2a2007bd378629654089074391e7e47c2cf Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 6 Nov 2026 23:13:48 -0800 Subject: [PATCH] Document tool shortcut selection behavior --- crates/ui-egui/src/input/shortcuts.rs | 5 +++-- crates/ui-egui/src/input/tool_key_default_tests.rs | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/input/shortcuts.rs b/crates/ui-egui/src/input/shortcuts.rs index 212d16b63d..cf23556c35 100644 --- a/crates/ui-egui/src/input/shortcuts.rs +++ b/crates/ui-egui/src/input/shortcuts.rs @@ -903,8 +903,9 @@ fn handle_escape_and_view_keys(app: &mut PhotocraftApp, ctx: &egui::Context) { crate::opacity_keys::handle(app, ctx); } -/// Selects a tool from its letter key. Pressing the key of the current group cycles within it; with -/// the Shift-switch preference only ⇧+key cycles. Returns true when a tool key was handled. +/// Selects a tool from its letter key. Entering a group uses its remembered eligible tool or the +/// first eligible tool in toolbar order. Pressing the key of the current group cycles within it. +/// With the Shift-switch preference, only ⇧+key cycles. Returns true when a tool key was handled. fn select_tool_by_key(app: &mut PhotocraftApp, ctx: &egui::Context, pressed: &impl Fn(Key) -> bool) -> bool { let shift_switch = app.session.prefs().tools.use_shift_key_for_tool_switch; for t in Tool::ALL { diff --git a/crates/ui-egui/src/input/tool_key_default_tests.rs b/crates/ui-egui/src/input/tool_key_default_tests.rs index 6e5347ed17..5b846d5e7f 100644 --- a/crates/ui-egui/src/input/tool_key_default_tests.rs +++ b/crates/ui-egui/src/input/tool_key_default_tests.rs @@ -21,6 +21,7 @@ fn press(app: &mut PhotocraftApp, ctx: &egui::Context, key: Key, modifiers: Modi ctx.end_pass().textures_delta.clear(); } +/// A fresh app enters each default letter group at its first toolbar tool under either preference. #[test] fn fresh_tool_letters_pick_the_first_tool_in_toolbar_order() { for shift_switch in [true, false] { @@ -43,6 +44,7 @@ fn fresh_tool_letters_pick_the_first_tool_in_toolbar_order() { } } +/// A remembered Magic Wand takes precedence over the fresh W default, even when hidden. #[test] fn plain_w_returns_to_the_remembered_magic_wand() { for hidden in [false, true] { @@ -59,6 +61,8 @@ fn plain_w_returns_to_the_remembered_magic_wand() { } } +/// Shift+W follows the flyout order and wraps. With the default preference, plain W keeps +/// the current tool when it already belongs to the group. #[test] fn shift_w_cycles_in_toolbar_order() { let mut app = app();