From 20b9f9c0f2c4c587d7d7891b681c3ef28319da3e Mon Sep 17 00:00:00 2001 From: ihavecoke Date: Wed, 2 Oct 2024 17:35:27 +0800 Subject: [PATCH] input: Move caret to line start or end with selected content (#288) Ref: https://support.apple.com/en-hk/102650 --------- Co-authored-by: Jason Lee --- crates/ui/src/input/input.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/ui/src/input/input.rs b/crates/ui/src/input/input.rs index f95291d8..60e1662d 100644 --- a/crates/ui/src/input/input.rs +++ b/crates/ui/src/input/input.rs @@ -77,6 +77,10 @@ pub fn init(cx: &mut AppContext) { KeyBinding::new("shift-home", SelectToHome, Some(CONTEXT)), KeyBinding::new("shift-end", SelectToEnd, Some(CONTEXT)), #[cfg(target_os = "macos")] + KeyBinding::new("shift-cmd-left", SelectToHome, Some(CONTEXT)), + #[cfg(target_os = "macos")] + KeyBinding::new("shift-cmd-right", SelectToEnd, Some(CONTEXT)), + #[cfg(target_os = "macos")] KeyBinding::new("ctrl-cmd-space", ShowCharacterPalette, Some(CONTEXT)), #[cfg(target_os = "macos")] KeyBinding::new("cmd-a", SelectAll, Some(CONTEXT)), @@ -97,8 +101,12 @@ pub fn init(cx: &mut AppContext) { #[cfg(target_os = "macos")] KeyBinding::new("ctrl-a", Home, Some(CONTEXT)), #[cfg(target_os = "macos")] + KeyBinding::new("cmd-left", Home, Some(CONTEXT)), + #[cfg(target_os = "macos")] KeyBinding::new("ctrl-e", End, Some(CONTEXT)), #[cfg(target_os = "macos")] + KeyBinding::new("cmd-right", End, Some(CONTEXT)), + #[cfg(target_os = "macos")] KeyBinding::new("cmd-z", Undo, Some(CONTEXT)), #[cfg(target_os = "macos")] KeyBinding::new("cmd-shift-z", Redo, Some(CONTEXT)),