diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index f025131758760d6c4db5250e2bbdb12a50d4ee01..be5c1efbdf7b158e3b8f80828fb75eb4a2307d61 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -391,6 +391,7 @@ pub struct Pane { Option) -> bool>>, can_toggle_zoom: bool, should_display_tab_bar: Rc) -> bool>, + should_display_welcome_page: bool, render_tab_bar_buttons: Rc< dyn Fn( &mut Pane, @@ -574,6 +575,7 @@ impl Pane { can_split_predicate: None, can_toggle_zoom: true, should_display_tab_bar: Rc::new(|_, cx| TabBarSettings::get_global(cx).show), + should_display_welcome_page: false, render_tab_bar_buttons: Rc::new(default_render_tab_bar_buttons), render_tab_bar: Rc::new(Self::render_tab_bar), show_tab_bar_buttons: TabBarSettings::get_global(cx).show_tab_bar_buttons, @@ -681,7 +683,9 @@ impl Pane { self.last_focus_handle_by_item .insert(active_item.item_id(), focused.downgrade()); } - } else if let Some(welcome_page) = self.welcome_page.as_ref() { + } else if self.should_display_welcome_page + && let Some(welcome_page) = self.welcome_page.as_ref() + { if self.focus_handle.is_focused(window) { welcome_page.read(cx).focus_handle(cx).focus(window, cx); } @@ -793,6 +797,10 @@ impl Pane { self.should_display_tab_bar = Rc::new(should_display_tab_bar); } + pub fn set_should_display_welcome_page(&mut self, should_display_welcome_page: bool) { + self.should_display_welcome_page = should_display_welcome_page; + } + pub fn set_can_split( &mut self, can_split_predicate: Option< @@ -4391,7 +4399,7 @@ impl Render for Pane { } }, )); - if has_worktrees { + if has_worktrees || !self.should_display_welcome_page { placeholder } else { if self.welcome_page.is_none() { diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 019329a8a8b932b6f1dddd056322acfad6932f6a..9f242d670d1ca7004c703496346e7bc196f969e5 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -1446,6 +1446,7 @@ impl Workspace { cx, ); center_pane.set_can_split(Some(Arc::new(|_, _, _, _| true))); + center_pane.set_should_display_welcome_page(true); center_pane }); cx.subscribe_in(¢er_pane, window, Self::handle_pane_event)