mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 19:14:26 +00:00
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:
@@ -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),
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -7,3 +7,4 @@ mod dock_apply;
|
||||
mod fit;
|
||||
#[path = "geometry/main.rs"]
|
||||
mod geometry;
|
||||
mod key_table;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user