tab_switcher: Add support for tab switcher in assistant panel (#15475)
Additionally, I've generalized the implementation of tab switcher so that - instead of explicitly listing panels it supports (at the time of writing it was just the terminal panel and nothing else), it now relies on Panel::pane trait method. As long as that's implemented, you get a tab switcher support for free. Release Notes: - Added support for tab switcher in Assistant panel.
This commit is contained in:
parent
0540291204
commit
530feecdaa
6 changed files with 35 additions and 32 deletions
|
@ -171,7 +171,7 @@ impl TerminalPanel {
|
|||
|
||||
fn apply_tab_bar_buttons(&self, cx: &mut ViewContext<Self>) {
|
||||
let additional_buttons = self.additional_tab_bar_buttons.clone();
|
||||
self.pane().update(cx, |pane, cx| {
|
||||
self.pane.update(cx, |pane, cx| {
|
||||
pane.set_render_tab_bar_buttons(cx, move |pane, cx| {
|
||||
h_flex()
|
||||
.gap_2()
|
||||
|
@ -683,10 +683,6 @@ impl TerminalPanel {
|
|||
Some(())
|
||||
}
|
||||
|
||||
pub fn pane(&self) -> &View<Pane> {
|
||||
&self.pane
|
||||
}
|
||||
|
||||
fn has_no_terminals(&self, cx: &WindowContext) -> bool {
|
||||
self.pane.read(cx).items_len() == 0 && self.pending_terminals_to_add == 0
|
||||
}
|
||||
|
@ -849,6 +845,10 @@ impl Panel for TerminalPanel {
|
|||
fn toggle_action(&self) -> Box<dyn gpui::Action> {
|
||||
Box::new(ToggleFocus)
|
||||
}
|
||||
|
||||
fn pane(&self) -> Option<View<Pane>> {
|
||||
Some(self.pane.clone())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue