commit
e1a4e8ea16
4 changed files with 68 additions and 29 deletions
|
@ -789,6 +789,7 @@ impl Pane {
|
|||
}
|
||||
|
||||
self.update_toolbar(cx);
|
||||
self.update_status_bar(cx);
|
||||
|
||||
if focus_item {
|
||||
self.focus_active_item(cx);
|
||||
|
@ -1450,6 +1451,22 @@ impl Pane {
|
|||
});
|
||||
}
|
||||
|
||||
fn update_status_bar(&mut self, cx: &mut ViewContext<Self>) {
|
||||
let workspace = self.workspace.clone();
|
||||
let pane = cx.view().clone();
|
||||
|
||||
cx.window_context().defer(move |cx| {
|
||||
let Ok(status_bar) = workspace.update(cx, |workspace, _| workspace.status_bar.clone())
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
status_bar.update(cx, move |status_bar, cx| {
|
||||
status_bar.set_active_pane(&pane, cx);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn render_tab(
|
||||
&self,
|
||||
ix: usize,
|
||||
|
|
|
@ -83,6 +83,9 @@ impl StatusBar {
|
|||
where
|
||||
T: 'static + StatusItemView,
|
||||
{
|
||||
let active_pane_item = self.active_pane.read(cx).active_item();
|
||||
item.set_active_pane_item(active_pane_item.as_deref(), cx);
|
||||
|
||||
self.left_items.push(Box::new(item));
|
||||
cx.notify();
|
||||
}
|
||||
|
@ -119,6 +122,9 @@ impl StatusBar {
|
|||
) where
|
||||
T: 'static + StatusItemView,
|
||||
{
|
||||
let active_pane_item = self.active_pane.read(cx).active_item();
|
||||
item.set_active_pane_item(active_pane_item.as_deref(), cx);
|
||||
|
||||
if position < self.left_items.len() {
|
||||
self.left_items.insert(position + 1, Box::new(item))
|
||||
} else {
|
||||
|
@ -141,6 +147,9 @@ impl StatusBar {
|
|||
where
|
||||
T: 'static + StatusItemView,
|
||||
{
|
||||
let active_pane_item = self.active_pane.read(cx).active_item();
|
||||
item.set_active_pane_item(active_pane_item.as_deref(), cx);
|
||||
|
||||
self.right_items.push(Box::new(item));
|
||||
cx.notify();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue