Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ui: Make custom rows in `ContextMenu`s use a normal cursor (#15239)
Marshall Bowers95d82f88dede
diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rsindex 918b160c3c1..99121868b26 100644--- a/crates/ui/src/components/context_menu.rs+++ b/crates/ui/src/components/context_menu.rs@@ -149,8 +149,7 @@ impl ContextMenu {}pub fn label(mut self, label: impl Into<SharedString>) -> Self {- let label = label.into();- self.items.push(ContextMenuItem::Label(label));+ self.items.push(ContextMenuItem::Label(label.into()));self}@@ -295,9 +294,9 @@ impl ContextMenu {impl ContextMenuItem {fn is_selectable(&self) -> bool {match self {- ContextMenuItem::Separator => false,- ContextMenuItem::Label { .. } => false,- ContextMenuItem::Header(_) => false,+ ContextMenuItem::Header(_)+ | ContextMenuItem::Separator+ | ContextMenuItem::Label { .. } => false,ContextMenuItem::Entry { .. } => true,ContextMenuItem::CustomEntry { selectable, .. } => *selectable,}@@ -428,19 +427,19 @@ impl Render for ContextMenu {} => {let handler = handler.clone();let menu = cx.view().downgrade();+ let selectable = *selectable;ListItem::new(ix).inset(true)- .selected(if *selectable {+ .selected(if selectable {Some(ix) == self.selected_index} else {false})- .selectable(*selectable)- .on_click({- let context = self.action_context.clone();- let selectable = *selectable;- move |_, cx| {- if selectable {+ .selectable(selectable)+ .when(selectable, |item| {+ item.on_click({+ let context = self.action_context.clone();+ move |_, cx| {handler(context.as_ref(), cx);menu.update(cx, |menu, cx| {menu.clicked = true;@@ -448,7 +447,7 @@ impl Render for ContextMenu {}).ok();}- }+ })}).child(entry_render(cx)).into_any_element()