From 0092df7c5148912cf2a3d9116f0bd10b0a9a6251 Mon Sep 17 00:00:00 2001 From: Joseph Lyons Date: Wed, 10 May 2023 16:46:52 -0400 Subject: [PATCH 1/6] v0.86.x preview --- crates/zed/RELEASE_CHANNEL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/zed/RELEASE_CHANNEL b/crates/zed/RELEASE_CHANNEL index 90012116c0..4de2f126df 100644 --- a/crates/zed/RELEASE_CHANNEL +++ b/crates/zed/RELEASE_CHANNEL @@ -1 +1 @@ -dev \ No newline at end of file +preview \ No newline at end of file From a17b5e8a8082f27c2ce84812f0c137420f1c6831 Mon Sep 17 00:00:00 2001 From: Joseph Lyons Date: Thu, 11 May 2023 11:37:34 -0400 Subject: [PATCH 2/6] Revert "More keybindings in macOs modals with buttons" This reverts commit 1398a1206299cbaf5e14b9de30d2fbfe83f04334. --- crates/gpui/src/platform/mac/window.rs | 39 ++------------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index bcff08d005..d96f9bc4ae 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -699,31 +699,6 @@ impl platform::Window for Window { msg: &str, answers: &[&str], ) -> oneshot::Receiver { - // macOs applies overrides to modal window buttons after they are added. - // Two most important for this logic are: - // * Buttons with "Cancel" title will be displayed as the last buttons in the modal - // * Last button added to the modal via `addButtonWithTitle` stays focused - // * Focused buttons react on "space"/" " keypresses - // * Usage of `keyEquivalent`, `makeFirstResponder` or `setInitialFirstResponder` does not change the focus - // - // See also https://developer.apple.com/documentation/appkit/nsalert/1524532-addbuttonwithtitle#discussion - // ``` - // By default, the first button has a key equivalent of Return, - // any button with a title of “Cancel” has a key equivalent of Escape, - // and any button with the title “Don’t Save” has a key equivalent of Command-D (but only if it’s not the first button). - // ``` - // - // To avoid situations when the last element added is "Cancel" and it gets the focus - // (hence stealing both ESC and Space shortcuts), we find and add one non-Cancel button - // last, so it gets focus and a Space shortcut. - // This way, "Save this file? Yes/No/Cancel"-ish modals will get all three buttons mapped with a key. - let latest_non_cancel_label = answers - .iter() - .enumerate() - .rev() - .find(|(_, &label)| label != "Cancel") - .filter(|&(label_index, _)| label_index > 0); - unsafe { let alert: id = msg_send![class!(NSAlert), alloc]; let alert: id = msg_send![alert, init]; @@ -734,20 +709,10 @@ impl platform::Window for Window { }; let _: () = msg_send![alert, setAlertStyle: alert_style]; let _: () = msg_send![alert, setMessageText: ns_string(msg)]; - - for (ix, answer) in answers - .iter() - .enumerate() - .filter(|&(ix, _)| Some(ix) != latest_non_cancel_label.map(|(ix, _)| ix)) - { + for (ix, answer) in answers.iter().enumerate() { let button: id = msg_send![alert, addButtonWithTitle: ns_string(answer)]; let _: () = msg_send![button, setTag: ix as NSInteger]; } - if let Some((ix, answer)) = latest_non_cancel_label { - let button: id = msg_send![alert, addButtonWithTitle: ns_string(answer)]; - let _: () = msg_send![button, setTag: ix as NSInteger]; - } - let (done_tx, done_rx) = oneshot::channel(); let done_tx = Cell::new(Some(done_tx)); let block = ConcreteBlock::new(move |answer: NSInteger| { @@ -755,7 +720,7 @@ impl platform::Window for Window { let _ = postage::sink::Sink::try_send(&mut done_tx, answer.try_into().unwrap()); } }); - + let block = block.copy(); let native_window = self.0.borrow().native_window; self.0 .borrow() From fd72d24060b3fa41f6c3d8b1ed22a70d094e57ba Mon Sep 17 00:00:00 2001 From: Joseph Lyons Date: Thu, 11 May 2023 11:42:14 -0400 Subject: [PATCH 3/6] zed 0.86.1 --- Cargo.lock | 2 +- crates/zed/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eee0873e5b..895fc370de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8531,7 +8531,7 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zed" -version = "0.86.0" +version = "0.86.1" dependencies = [ "activity_indicator", "anyhow", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 70c71cc18e..95378a9765 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Nathan Sobo "] description = "The fast, collaborative code editor." edition = "2021" name = "zed" -version = "0.86.0" +version = "0.86.1" publish = false [lib] From baedb7d0fc806fd764e4efa86584cee08f26f977 Mon Sep 17 00:00:00 2001 From: Joseph Lyons Date: Wed, 17 May 2023 12:38:43 -0400 Subject: [PATCH 4/6] v0.86.x stable --- crates/zed/RELEASE_CHANNEL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/zed/RELEASE_CHANNEL b/crates/zed/RELEASE_CHANNEL index 4de2f126df..870bbe4e50 100644 --- a/crates/zed/RELEASE_CHANNEL +++ b/crates/zed/RELEASE_CHANNEL @@ -1 +1 @@ -preview \ No newline at end of file +stable \ No newline at end of file From 5c3690c3f10c55cb6a30a0a9b0cbd1e1217ffd58 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 16 May 2023 15:16:34 +0300 Subject: [PATCH 5/6] Merge pull request #2470 from zed-industries/kb/fix-project-search-esc In project search on ESC, reduce multiple carets to one first --- assets/keymaps/default.json | 6 +++--- crates/gpui/src/keymap_matcher/binding.rs | 13 +++++++++++++ crates/workspace/src/workspace.rs | 6 ------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index d2fd4107e4..01a09e0cba 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -191,7 +191,7 @@ } }, { - "context": "BufferSearchBar > Editor", + "context": "BufferSearchBar", "bindings": { "escape": "buffer_search::Dismiss", "tab": "buffer_search::FocusEditor", @@ -200,13 +200,13 @@ } }, { - "context": "ProjectSearchBar > Editor", + "context": "ProjectSearchBar", "bindings": { "escape": "project_search::ToggleFocus" } }, { - "context": "ProjectSearchView > Editor", + "context": "ProjectSearchView", "bindings": { "escape": "project_search::ToggleFocus" } diff --git a/crates/gpui/src/keymap_matcher/binding.rs b/crates/gpui/src/keymap_matcher/binding.rs index aa40e8c6af..4d8334128b 100644 --- a/crates/gpui/src/keymap_matcher/binding.rs +++ b/crates/gpui/src/keymap_matcher/binding.rs @@ -11,6 +11,19 @@ pub struct Binding { context_predicate: Option, } +impl std::fmt::Debug for Binding { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "Binding {{ keystrokes: {:?}, action: {}::{}, context_predicate: {:?} }}", + self.keystrokes, + self.action.namespace(), + self.action.name(), + self.context_predicate + ) + } +} + impl Clone for Binding { fn clone(&self) -> Self { Self { diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 8a62a28c11..6350b43415 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -234,7 +234,6 @@ pub fn init(app_state: Arc, cx: &mut AppContext) { }, ); cx.add_action(Workspace::toggle_sidebar_item); - cx.add_action(Workspace::focus_center); cx.add_action(|workspace: &mut Workspace, _: &ActivatePreviousPane, cx| { workspace.activate_previous_pane(cx) }); @@ -1415,11 +1414,6 @@ impl Workspace { cx.notify(); } - pub fn focus_center(&mut self, _: &menu::Cancel, cx: &mut ViewContext) { - cx.focus_self(); - cx.notify(); - } - fn add_pane(&mut self, cx: &mut ViewContext) -> ViewHandle { let pane = cx.add_view(|cx| { Pane::new( From eb12b0b9ed20cccc84f7cd671274d03b86eb8b97 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Fri, 12 May 2023 06:11:04 +0300 Subject: [PATCH 6/6] Merge pull request #2463 from zed-industries/kb/reapply-modal-accessibility Reintroduce more accesible modal keybindings --- crates/gpui/src/platform/mac/window.rs | 37 +++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index d96f9bc4ae..50fcec52ec 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -699,6 +699,31 @@ impl platform::Window for Window { msg: &str, answers: &[&str], ) -> oneshot::Receiver { + // macOs applies overrides to modal window buttons after they are added. + // Two most important for this logic are: + // * Buttons with "Cancel" title will be displayed as the last buttons in the modal + // * Last button added to the modal via `addButtonWithTitle` stays focused + // * Focused buttons react on "space"/" " keypresses + // * Usage of `keyEquivalent`, `makeFirstResponder` or `setInitialFirstResponder` does not change the focus + // + // See also https://developer.apple.com/documentation/appkit/nsalert/1524532-addbuttonwithtitle#discussion + // ``` + // By default, the first button has a key equivalent of Return, + // any button with a title of “Cancel” has a key equivalent of Escape, + // and any button with the title “Don’t Save” has a key equivalent of Command-D (but only if it’s not the first button). + // ``` + // + // To avoid situations when the last element added is "Cancel" and it gets the focus + // (hence stealing both ESC and Space shortcuts), we find and add one non-Cancel button + // last, so it gets focus and a Space shortcut. + // This way, "Save this file? Yes/No/Cancel"-ish modals will get all three buttons mapped with a key. + let latest_non_cancel_label = answers + .iter() + .enumerate() + .rev() + .find(|(_, &label)| label != "Cancel") + .filter(|&(label_index, _)| label_index > 0); + unsafe { let alert: id = msg_send![class!(NSAlert), alloc]; let alert: id = msg_send![alert, init]; @@ -709,10 +734,20 @@ impl platform::Window for Window { }; let _: () = msg_send![alert, setAlertStyle: alert_style]; let _: () = msg_send![alert, setMessageText: ns_string(msg)]; - for (ix, answer) in answers.iter().enumerate() { + + for (ix, answer) in answers + .iter() + .enumerate() + .filter(|&(ix, _)| Some(ix) != latest_non_cancel_label.map(|(ix, _)| ix)) + { let button: id = msg_send![alert, addButtonWithTitle: ns_string(answer)]; let _: () = msg_send![button, setTag: ix as NSInteger]; } + if let Some((ix, answer)) = latest_non_cancel_label { + let button: id = msg_send![alert, addButtonWithTitle: ns_string(answer)]; + let _: () = msg_send![button, setTag: ix as NSInteger]; + } + let (done_tx, done_rx) = oneshot::channel(); let done_tx = Cell::new(Some(done_tx)); let block = ConcreteBlock::new(move |answer: NSInteger| {