tab: Add setting to hide the close button entirely (#23880)

Closes #23744

Release Notes:

- Changed the `always_show_close_button` key to `show_close_button` and
introduced a new `hidden` value, that allows never displaying the close
button.

---------

Co-authored-by: Peter Tripp <peter@zed.dev>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: smit <0xtimsb@gmail.com>
This commit is contained in:
Morgan Metz 2025-03-02 19:01:48 -08:00 committed by GitHub
parent ae6d350334
commit 0a4ff2f475
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 149 additions and 28 deletions

View file

@ -42,7 +42,7 @@ pub struct ItemSettings {
pub activate_on_close: ActivateOnClose,
pub file_icons: bool,
pub show_diagnostics: ShowDiagnostics,
pub always_show_close_button: bool,
pub show_close_button: ShowCloseButton,
}
#[derive(Deserialize)]
@ -60,6 +60,15 @@ pub enum ClosePosition {
Right,
}
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum ShowCloseButton {
Always,
#[default]
Hover,
Hidden,
}
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum ShowDiagnostics {
@ -104,7 +113,7 @@ pub struct ItemSettingsContent {
/// Whether to always show the close button on tabs.
///
/// Default: false
always_show_close_button: Option<bool>,
show_close_button: Option<ShowCloseButton>,
}
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]