Add keyboard control over context menus

Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
Max Brunsfeld 2023-11-29 09:39:20 -08:00
parent 77acba9e4c
commit ac34229118
5 changed files with 125 additions and 65 deletions

View file

@ -10,11 +10,11 @@ fn build_menu(cx: &mut WindowContext, header: impl Into<SharedString>) -> View<C
ContextMenu::build(cx, |menu, _| {
menu.header(header)
.separator()
.entry("Print current time", |_event, cx| {
.entry("Print current time", |cx| {
println!("dispatching PrintCurrentTime action");
cx.dispatch_action(PrintCurrentDate.boxed_clone())
})
.entry("Print best foot", |_event, cx| {
.entry("Print best foot", |cx| {
cx.dispatch_action(PrintBestFood.boxed_clone())
})
})