settings: Add max tabs option (#18933)

Add a `max_tabs` option to the settings that ensure no more than this
amount of tabs are open in a pane. If set to `null`, there is no limit.

Closes #4784

Release Notes:

- Added a `max_tabs` option to cap the maximum number of open tabs.
This commit is contained in:
Ulysse Buonomo 2024-12-14 05:32:55 +01:00 committed by GitHub
parent 0be7cf8ea8
commit cd5d8b4173
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 107 additions and 0 deletions

View file

@ -1,3 +1,5 @@
use std::num::NonZeroUsize;
use anyhow::Result;
use collections::HashMap;
use gpui::AppContext;
@ -20,6 +22,7 @@ pub struct WorkspaceSettings {
pub use_system_path_prompts: bool,
pub command_aliases: HashMap<String, String>,
pub show_user_picture: bool,
pub max_tabs: Option<NonZeroUsize>,
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)]
@ -133,6 +136,11 @@ pub struct WorkspaceSettingsContent {
///
/// Default: true
pub show_user_picture: Option<bool>,
// Maximum open tabs in a pane. Will not close an unsaved
// tab. Set to `None` for unlimited tabs.
//
// Default: none
pub max_tabs: Option<NonZeroUsize>,
}
#[derive(Deserialize)]