Show context menu on project panel empty space right click (#3954)

Deals with https://github.com/zed-industries/community/issues/2383

Release Notes:

- Fixed context menu not shown when right clicking empty project panel
space
This commit is contained in:
Kirill Bulatov 2024-01-08 22:16:18 +02:00 committed by GitHub
commit a2a0628bfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1515,6 +1515,16 @@ impl Render for ProjectPanel {
el.on_action(cx.listener(Self::reveal_in_finder))
.on_action(cx.listener(Self::open_in_terminal))
})
.on_mouse_down(
MouseButton::Right,
cx.listener(move |this, event: &MouseDownEvent, cx| {
// When deploying the context menu anywhere below the last project entry,
// act as if the user clicked the root of the last worktree.
if let Some(entry_id) = this.last_worktree_root_id {
this.deploy_context_menu(event.position, entry_id, cx);
}
}),
)
.track_focus(&self.focus_handle)
.child(
uniform_list(