Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
pane: Add settings to hide the tab bar buttons (#23752)
Danilo Leal5331418f3a94
diff --git a/assets/settings/default.json b/assets/settings/default.jsonindex ad982a7179c..4650aec6742 100644--- a/assets/settings/default.json+++ b/assets/settings/default.json@@ -592,7 +592,9 @@// Whether or not to show the tab bar in the editor"show": true,// Whether or not to show the navigation history buttons.- "show_nav_history_buttons": true+ "show_nav_history_buttons": true,+ /// Whether or not to show the tab bar buttons.+ "show_tab_bar_buttons": true},// Settings related to the editor's tabs"tabs": {diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rsindex eeb810bc233..098faf8897e 100644--- a/crates/workspace/src/pane.rs+++ b/crates/workspace/src/pane.rs@@ -304,6 +304,7 @@ pub struct Pane {&mut Context<Pane>,) -> (Option<AnyElement>, Option<AnyElement>),>,+ show_tab_bar_buttons: bool,_subscriptions: Vec<Subscription>,tab_bar_scroll_handle: ScrollHandle,/// Is None if navigation buttons are permanently turned off (and should not react to setting changes).@@ -509,6 +510,7 @@ impl Pane {.into();(None, right_children)}),+ show_tab_bar_buttons: TabBarSettings::get_global(cx).show_tab_bar_buttons,display_nav_history_buttons: Some(TabBarSettings::get_global(cx).show_nav_history_buttons,),@@ -659,9 +661,13 @@ impl Pane {}fn settings_changed(&mut self, cx: &mut Context<Self>) {+ let tab_bar_settings = TabBarSettings::get_global(cx);+if let Some(display_nav_history_buttons) = self.display_nav_history_buttons.as_mut() {- *display_nav_history_buttons = TabBarSettings::get_global(cx).show_nav_history_buttons;+ *display_nav_history_buttons = tab_bar_settings.show_nav_history_buttons;}+ self.show_tab_bar_buttons = tab_bar_settings.show_tab_bar_buttons;+if !PreviewTabsSettings::get_global(cx).enabled {self.preview_item_id = None;}@@ -2581,12 +2587,15 @@ impl Pane {},).map(|tab_bar| {- let render_tab_buttons = self.render_tab_bar_buttons.clone();- let (left_children, right_children) = render_tab_buttons(self, window, cx);-- tab_bar- .start_children(left_children)- .end_children(right_children)+ if self.show_tab_bar_buttons {+ let render_tab_buttons = self.render_tab_bar_buttons.clone();+ let (left_children, right_children) = render_tab_buttons(self, window, cx);+ tab_bar+ .start_children(left_children)+ .end_children(right_children)+ } else {+ tab_bar+ }}).children(pinned_tabs.len().ne(&0).then(|| {h_flex()diff --git a/crates/workspace/src/workspace_settings.rs b/crates/workspace/src/workspace_settings.rsindex 90202f50267..f6d3a176d68 100644--- a/crates/workspace/src/workspace_settings.rs+++ b/crates/workspace/src/workspace_settings.rs@@ -147,6 +147,7 @@ pub struct WorkspaceSettingsContent {pub struct TabBarSettings {pub show: bool,pub show_nav_history_buttons: bool,+ pub show_tab_bar_buttons: bool,}#[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]@@ -159,6 +160,10 @@ pub struct TabBarSettingsContent {////// Default: truepub show_nav_history_buttons: Option<bool>,+ /// Whether or not to show the tab bar buttons.+ ///+ /// Default: true+ pub show_tab_bar_buttons: Option<bool>,}#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]diff --git a/docs/src/configuring-zed.md b/docs/src/configuring-zed.mdindex 163c17b2b8b..41a886088cc 100644--- a/docs/src/configuring-zed.md+++ b/docs/src/configuring-zed.md@@ -714,7 +714,8 @@ List of `string` values```json"tab_bar": {"show": true,- "show_nav_history_buttons": true+ "show_nav_history_buttons": true,+ "show_tab_bar_buttons": true}```@@ -738,6 +739,16 @@ List of `string` values`boolean` values+### Tab Bar Buttons++- Description: Whether or not to show the tab bar buttons.+- Setting: `show_tab_bar_buttons`+- Default: `true`++**Options**++`boolean` values+## Editor Tabs- Description: Configuration for the editor tabs.