assistant: Display hamburger menu even when the panel is not focused (#15612)

This commit gives tab button renderers control over the condition in
which they should be displayed. Previously we displayed tab buttons only
when the pane was focused. Now tab renderers can return an Option of
AnyElement, which in turn makes it possible for them to control when and
how they're rendered. Pane and Terminal handlers still check for self
focus condition and Assistant Panel does not.



Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-08-01 15:08:48 +02:00 committed by GitHub
parent dc0f7436e0
commit 79213637e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 11 deletions

View file

@ -173,6 +173,9 @@ impl TerminalPanel {
let additional_buttons = self.additional_tab_bar_buttons.clone();
self.pane.update(cx, |pane, cx| {
pane.set_render_tab_bar_buttons(cx, move |pane, cx| {
if !pane.has_focus(cx) {
return None;
}
h_flex()
.gap_2()
.children(additional_buttons.clone())
@ -229,6 +232,7 @@ impl TerminalPanel {
})
})
.into_any_element()
.into()
});
});
}