Setting to show/hide terminal title (#8559)

This PR adds settings for hiding title (breadcrumbs) from the terminal
toolbar. If the title is hidden, the toolbar disappears completely.

Example:

```json
"terminal": {
  "toolbar": {
    "title": true,
  }
}
```

[The PR that added the "toolbar"
setting](https://github.com/zed-industries/zed/pull/7338) didn't affect
toolbars of the terminals that are placed in the editor pane. This PR
fixes that.


Release Notes:

- Added support for configuring the terminal toolbar ([8125](https://github.com/zed-industries/zed/issues/8125))
This commit is contained in:
Andrew Lygin 2024-03-02 00:37:02 +03:00 committed by GitHub
parent 400fb12f7e
commit 37f7957826
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 59 additions and 2 deletions

View file

@ -18,6 +18,11 @@ pub enum TerminalDockPosition {
Right,
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
pub struct Toolbar {
pub title: bool,
}
#[derive(Deserialize)]
pub struct TerminalSettings {
pub shell: Shell,
@ -36,6 +41,7 @@ pub struct TerminalSettings {
pub default_height: Pixels,
pub detect_venv: VenvSettings,
pub max_scroll_history_lines: Option<usize>,
pub toolbar: Toolbar,
}
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
@ -155,6 +161,8 @@ pub struct TerminalSettingsContent {
///
/// Default: 10_000
pub max_scroll_history_lines: Option<usize>,
/// Toolbar related settings
pub toolbar: Option<ToolbarContent>,
}
impl settings::Settings for TerminalSettings {
@ -274,3 +282,12 @@ pub enum WorkingDirectory {
/// this platform's home directory (if it can be found).
Always { directory: String },
}
// Toolbar related settings
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
pub struct ToolbarContent {
/// Whether to display the terminal title in its toolbar.
///
/// Default: true
pub title: Option<bool>,
}