Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
task: Rebind UseSelectedQuery in modal to F2 (#12601)
Piotr Osiewicz18e2b43d6d30
diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.jsonindex 7141ee810b3..bee3b13c54a 100644--- a/assets/keymaps/default-macos.json+++ b/assets/keymaps/default-macos.json@@ -639,7 +639,7 @@{"context": "Picker","bindings": {- "alt-e": "picker::UseSelectedQuery",+ "f2": "picker::UseSelectedQuery","alt-enter": ["picker::ConfirmInput", { "secondary": false }],"cmd-alt-enter": ["picker::ConfirmInput", { "secondary": true }]}diff --git a/crates/tasks_ui/src/modal.rs b/crates/tasks_ui/src/modal.rsindex 6269043339c..34c1c127d65 100644--- a/crates/tasks_ui/src/modal.rs+++ b/crates/tasks_ui/src/modal.rs@@ -491,6 +491,22 @@ impl PickerDelegate for TasksModalDelegate {fn render_footer(&self, cx: &mut ViewContext<Picker<Self>>) -> Option<gpui::AnyElement> {let is_recent_selected = self.divider_index >= Some(self.selected_index);let current_modifiers = cx.modifiers();+ let left_button = if is_recent_selected {+ Some(("Edit task", picker::UseSelectedQuery.boxed_clone()))+ } else if !self.matches.is_empty() {+ Some(("Edit template", picker::UseSelectedQuery.boxed_clone()))+ } else if self+ .project+ .read(cx)+ .task_inventory()+ .read(cx)+ .last_scheduled_task(None)+ .is_some()+ {+ Some(("Rerun last task", Rerun::default().boxed_clone()))+ } else {+ None+ };Some(h_flex().w_full()@@ -499,23 +515,20 @@ impl PickerDelegate for TasksModalDelegate {.justify_between().rounded_b_md().bg(cx.theme().colors().ghost_element_selected)- .children(- KeyBinding::for_action(&picker::UseSelectedQuery, cx).map(|keybind| {- let edit_entry_label = if is_recent_selected {- "Edit task"- } else if !self.matches.is_empty() {- "Edit template"- } else {- "Rerun last task"- };-- Button::new("edit-current-task", edit_entry_label)- .label_size(LabelSize::Small)- .key_binding(keybind)- .on_click(|_, cx| {- cx.dispatch_action(picker::UseSelectedQuery.boxed_clone())- })- }),+ .child(+ left_button+ .map(|(label, action)| {+ let keybind = KeyBinding::for_action(&*action, cx);++ Button::new("edit-current-task", label)+ .label_size(LabelSize::Small)+ .when_some(keybind, |this, keybind| this.key_binding(keybind))+ .on_click(move |_, cx| {+ cx.dispatch_action(action.boxed_clone());+ })+ .into_any_element()+ })+ .unwrap_or_else(|| h_flex().into_any_element()),).map(|this| {if (current_modifiers.alt || self.matches.is_empty()) && !self.prompt.is_empty()