Constrain context menu to the width of the widest item

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-05-25 14:24:53 +02:00
parent f403d87eff
commit 3b2f1644fb
8 changed files with 200 additions and 93 deletions

View file

@ -38,7 +38,7 @@ pub struct ProjectPanel {
selection: Option<Selection>,
edit_state: Option<EditState>,
filename_editor: ViewHandle<Editor>,
context_menu: ViewHandle<ContextMenu<Self>>,
context_menu: ViewHandle<ContextMenu>,
handle: WeakViewHandle<Self>,
}
@ -220,6 +220,14 @@ impl ProjectPanel {
action: Box::new(AddDirectory),
},
ContextMenuItem::Separator,
ContextMenuItem::Item {
label: "Rename".to_string(),
action: Box::new(Rename),
},
ContextMenuItem::Item {
label: "Delete".to_string(),
action: Box::new(Delete),
},
],
cx,
);