From 40bbbd3226fd66ed9b98453537034031081ecb17 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 28 Nov 2023 15:06:37 -0500 Subject: [PATCH] Update command_palette.rs --- .../command_palette2/src/command_palette.rs | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/crates/command_palette2/src/command_palette.rs b/crates/command_palette2/src/command_palette.rs index 5f3fb4a98595afc3b6930370bd552f0912af6344..ec77d935612207f65abacffe7fe0d60fb3affb17 100644 --- a/crates/command_palette2/src/command_palette.rs +++ b/crates/command_palette2/src/command_palette.rs @@ -1,7 +1,7 @@ use collections::{CommandPaletteFilter, HashMap}; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - actions, Action, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, + actions, rems, Action, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, Keystroke, ParentElement, Render, Styled, View, ViewContext, VisualContext, WeakView, }; use picker::{Picker, PickerDelegate}; @@ -79,7 +79,10 @@ impl Render for CommandPalette { type Element = Div; fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { - v_stack().w_96().child(self.picker.clone()) + v_stack() + .min_w_96() + .max_w(rems(36.)) + .child(self.picker.clone()) } } @@ -301,15 +304,19 @@ impl PickerDelegate for CommandPaletteDelegate { }; Some( - ListItem::new(ix).selected(selected).child( - h_stack() - .justify_between() - .child(HighlightedLabel::new( - command.name.clone(), - r#match.positions.clone(), - )) - .children(KeyBinding::for_action(&*command.action, cx)), - ), + ListItem::new(ix) + .variant(ui::ListItemVariant::Inset) + .selected(selected) + .child( + h_stack() + .w_full() + .justify_between() + .child(HighlightedLabel::new( + command.name.clone(), + r#match.positions.clone(), + )) + .children(KeyBinding::for_action(&*command.action, cx)), + ), ) } }