Collection keys: Enter activates and F2 renames on every platform

The macOS rows that made Enter rename the lead and Cmd+Down activate it go.
This commit is contained in:
aiongg
2026-11-12 14:32:39 +00:00
parent f74d963e8f
commit ce5987d114
4 changed files with 20 additions and 4 deletions
+1 -3
View File
@@ -237,9 +237,7 @@ pub fn intent(os: Os, key: Key, mods: Mods, role: KeyRole) -> Option<Intent> {
Key::Space if plain && role.space => return Some(Intent::Space),
Key::Menu if plain && !mac => return Some(Intent::ContextMenu),
Key::F10 if only(Mods::SHIFT) => return Some(Intent::ContextMenu),
Key::F2 if plain && role.rename && !mac => return Some(Intent::Rename),
Key::Enter if plain && role.rename && mac => return Some(Intent::Rename),
Key::Down if mac && role.rename && only(Mods::CMD) => return Some(Intent::Activate),
Key::F2 if plain && role.rename => return Some(Intent::Rename),
Key::Enter if only(Mods::CMD) => return Some(Intent::SubmitForce),
Key::Down if only(Mods::ALT) => return Some(Intent::Open),
Key::Up if only(Mods::ALT) => return Some(Intent::Close),
+17
View File
@@ -0,0 +1,17 @@
//! The key table's collection rows.
use craft_behavior::Intent;
use craft_behavior::keys::{KeyRole, intent};
use craft_host::target::Os;
use craft_keymap::{Key, Mods};
/// On every platform F2 renames the lead of a renamable collection and Enter is left to activation.
#[test]
fn f2_renames_and_enter_activates_on_every_platform() {
let role = KeyRole::new().rename(true).space(true).moves(true);
for os in [Os::Mac, Os::Windows, Os::Linux] {
assert_eq!(intent(os, Key::F2, Mods::NONE, role), Some(Intent::Rename), "{os:?}: F2 renames");
assert_eq!(intent(os, Key::Enter, Mods::NONE, role), None, "{os:?}: Enter is activation, not rename");
assert_ne!(intent(os, Key::Down, Mods::CMD, role), Some(Intent::Activate), "{os:?}: Cmd+Down does not activate");
}
}
+1
View File
@@ -7,3 +7,4 @@ mod dock_apply;
mod fit;
#[path = "geometry/main.rs"]
mod geometry;
mod key_table;
+1 -1
View File
@@ -137,7 +137,7 @@ impl<Id> Default for Session<Id> {
///
/// - **Keys**: the rows are one Tab stop (the list's keys: arrows, Home, End and Page with Shift;
/// Cmd/Ctrl moves the lead alone; Left and Right close and open a group, Alt for every group;
/// Cmd/Ctrl+] and [ move the selected layers, Shift to the ends; Enter activates; the per-OS rename key renames). The panel's
/// Cmd/Ctrl+] and [ move the selected layers, Shift to the ends; Enter activates; F2 renames). The panel's
/// commands ([`LayersPanelCommands`]) are the app's: the stacking keys and the effects keys.
/// - **Pointer**: clicks select (Cmd/Ctrl toggles, Shift extends, the empty space clears), the eye
/// and lock columns sweep, Alt-click on an eye shows only that layer, the eye's right-click opens