From fdc17c57d71d7b9d5cd1dfa0eb7dc65566f602a0 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Tue, 26 Nov 2024 12:58:45 +0000 Subject: [PATCH] macos: Keybind improvements for binds involving shift (#21207) Fix cmd-pipe Remove redudnant jetbrains/sublime keybinds (these exist as `cmd-{` and `cmd-}` under default vscode keymap) and were broken as part of the recent keybind changes. Remove excess JSON whitespace from tests to make them more readable. --- assets/keymaps/default-macos.json | 2 +- crates/zed/src/zed.rs | 88 +++++-------------------------- 2 files changed, 15 insertions(+), 75 deletions(-) diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json index c8bc80a9c0..ddbbdd3faf 100644 --- a/assets/keymaps/default-macos.json +++ b/assets/keymaps/default-macos.json @@ -355,7 +355,7 @@ "alt-cmd-f12": "editor::GoToTypeDefinitionSplit", "alt-shift-f12": "editor::FindAllReferences", "ctrl-m": "editor::MoveToEnclosingBracket", - "cmd-shift-\\": "editor::MoveToEnclosingBracket", + "cmd-|": "editor::MoveToEnclosingBracket", "alt-cmd-[": "editor::Fold", "alt-cmd-]": "editor::UnfoldLines", "cmd-k cmd-l": "editor::ToggleFold", diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 5ba63b9c1f..4e3d05d2fb 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -3190,12 +3190,7 @@ mod tests { .fs .save( "/settings.json".as_ref(), - &r#" - { - "base_keymap": "Atom" - } - "# - .into(), + &r#"{"base_keymap": "Atom"}"#.into(), Default::default(), ) .await @@ -3205,16 +3200,7 @@ mod tests { .fs .save( "/keymap.json".as_ref(), - &r#" - [ - { - "bindings": { - "backspace": "test1::A" - } - } - ] - "# - .into(), + &r#"[{"bindings": {"backspace": "test1::A"}}]"#.into(), Default::default(), ) .await @@ -3257,16 +3243,7 @@ mod tests { .fs .save( "/keymap.json".as_ref(), - &r#" - [ - { - "bindings": { - "backspace": "test1::B" - } - } - ] - "# - .into(), + &r#"[{"bindings": {"backspace": "test1::B"}}]"#.into(), Default::default(), ) .await @@ -3286,12 +3263,7 @@ mod tests { .fs .save( "/settings.json".as_ref(), - &r#" - { - "base_keymap": "JetBrains" - } - "# - .into(), + &r#"{"base_keymap": "JetBrains"}"#.into(), Default::default(), ) .await @@ -3318,24 +3290,20 @@ mod tests { // From the Atom keymap use workspace::ActivatePreviousPane; // From the JetBrains keymap - use pane::ActivatePrevItem; + use diagnostics::Deploy; + workspace .update(cx, |workspace, _| { - workspace - .register_action(|_, _: &A, _| {}) - .register_action(|_, _: &B, _| {}); + workspace.register_action(|_, _: &A, _cx| {}); + workspace.register_action(|_, _: &B, _cx| {}); + workspace.register_action(|_, _: &Deploy, _cx| {}); }) .unwrap(); app_state .fs .save( "/settings.json".as_ref(), - &r#" - { - "base_keymap": "Atom" - } - "# - .into(), + &r#"{"base_keymap": "Atom"}"#.into(), Default::default(), ) .await @@ -3344,16 +3312,7 @@ mod tests { .fs .save( "/keymap.json".as_ref(), - &r#" - [ - { - "bindings": { - "backspace": "test2::A" - } - } - ] - "# - .into(), + &r#"[{"bindings": {"backspace": "test2::A"}}]"#.into(), Default::default(), ) .await @@ -3391,16 +3350,7 @@ mod tests { .fs .save( "/keymap.json".as_ref(), - &r#" - [ - { - "bindings": { - "backspace": null - } - } - ] - "# - .into(), + &r#"[{"bindings": {"backspace": null}}]"#.into(), Default::default(), ) .await @@ -3420,12 +3370,7 @@ mod tests { .fs .save( "/settings.json".as_ref(), - &r#" - { - "base_keymap": "JetBrains" - } - "# - .into(), + &r#"{"base_keymap": "JetBrains"}"#.into(), Default::default(), ) .await @@ -3433,12 +3378,7 @@ mod tests { cx.background_executor.run_until_parked(); - assert_key_bindings_for( - workspace.into(), - cx, - vec![("[", &ActivatePrevItem)], - line!(), - ); + assert_key_bindings_for(workspace.into(), cx, vec![("6", &Deploy)], line!()); } #[gpui::test]