Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
keymap editor: Refine how we display matching keystrokes (#35796)
Danilo Leal262365ca241c
diff --git a/crates/settings_ui/src/keybindings.rs b/crates/settings_ui/src/keybindings.rsindex 60e527677a5..599bb0b18f5 100644--- a/crates/settings_ui/src/keybindings.rs+++ b/crates/settings_ui/src/keybindings.rs@@ -2415,6 +2415,7 @@ impl Render for KeybindingEditorModal {.header(ModalHeader::new().child(v_flex()+ .w_full().pb_1p5().mb_1().gap_0p5()@@ -2438,17 +2439,55 @@ impl Render for KeybindingEditorModal {.section(Section::new().child(v_flex()- .gap_2()+ .gap_2p5().child(v_flex()- .child(Label::new("Edit Keystroke")).gap_1()- .child(self.keybind_editor.clone()),+ .child(Label::new("Edit Keystroke"))+ .child(self.keybind_editor.clone())+ .child(h_flex().gap_px().when(+ matching_bindings_count > 0,+ |this| {+ let label = format!(+ "There {} {} {} with the same keystrokes.",+ if matching_bindings_count == 1 {+ "is"+ } else {+ "are"+ },+ matching_bindings_count,+ if matching_bindings_count == 1 {+ "binding"+ } else {+ "bindings"+ }+ );++ this.child(+ Label::new(label)+ .size(LabelSize::Small)+ .color(Color::Muted),+ )+ .child(+ Button::new("show_matching", "View")+ .label_size(LabelSize::Small)+ .icon(IconName::ArrowUpRight)+ .icon_color(Color::Muted)+ .icon_size(IconSize::XSmall)+ .on_click(cx.listener(+ |this, _, window, cx| {+ this.show_matching_bindings(+ window, cx,+ );+ },+ )),+ )+ },+ )),).when_some(self.action_arguments_editor.clone(), |this, editor| {this.child(v_flex()- .mt_1p5().gap_1().child(Label::new("Edit Arguments")).child(editor),@@ -2459,50 +2498,25 @@ impl Render for KeybindingEditorModal {this.child(Banner::new().severity(error.severity)- // For some reason, the div overflows its container to the- //right. The padding accounts for that.- .child(- div()- .size_full()- .pr_2()- .child(Label::new(error.content.clone())),- ),+ .child(Label::new(error.content.clone())),)}),),).footer(- ModalFooter::new()- .start_slot(- div().when(matching_bindings_count > 0, |this| {- this.child(- Button::new("show_matching", format!(- "There {} {} {} with the same keystrokes. Click to view",- if matching_bindings_count == 1 { "is" } else { "are" },- matching_bindings_count,- if matching_bindings_count == 1 { "binding" } else { "bindings" }- ))- .style(ButtonStyle::Transparent)- .color(Color::Accent)- .on_click(cx.listener(|this, _, window, cx| {- this.show_matching_bindings(window, cx);- }))- )- })- )- .end_slot(- h_flex()- .gap_1()- .child(- Button::new("cancel", "Cancel")- .on_click(cx.listener(|_, _, _, cx| cx.emit(DismissEvent))),- )- .child(Button::new("save-btn", "Save").on_click(cx.listener(- |this, _event, _window, cx| {- this.save_or_display_error(cx);- },- ))),- ),+ ModalFooter::new().end_slot(+ h_flex()+ .gap_1()+ .child(+ Button::new("cancel", "Cancel")+ .on_click(cx.listener(|_, _, _, cx| cx.emit(DismissEvent))),+ )+ .child(Button::new("save-btn", "Save").on_click(cx.listener(+ |this, _event, _window, cx| {+ this.save_or_display_error(cx);+ },+ ))),+ ),),)}diff --git a/crates/settings_ui/src/ui_components/keystroke_input.rs b/crates/settings_ui/src/ui_components/keystroke_input.rsindex 03d27d0ab95..ee5c4036eae 100644--- a/crates/settings_ui/src/ui_components/keystroke_input.rs+++ b/crates/settings_ui/src/ui_components/keystroke_input.rs@@ -529,7 +529,7 @@ impl Render for KeystrokeInput {.w_full().flex_1().justify_between()- .rounded_lg()+ .rounded_sm().overflow_hidden().map(|this| {if is_recording {diff --git a/crates/ui_input/src/ui_input.rs b/crates/ui_input/src/ui_input.rsindex 309b3f62f6c..1a5bebaf1e9 100644--- a/crates/ui_input/src/ui_input.rs+++ b/crates/ui_input/src/ui_input.rs@@ -168,7 +168,7 @@ impl Render for SingleLineInput {.py_1p5().flex_grow().text_color(style.text_color)- .rounded_lg()+ .rounded_sm().bg(style.background_color).border_1().border_color(style.border_color)