Closes https://github.com/zed-industries/zed/issues/20422 <img width="700" alt="Screenshot 2024-11-29 at 22 00 20" src="https://github.com/user-attachments/assets/4a17d00c-d64f-4b33-97a7-a57766ce6d17"> Release Notes: - N/A
Unified · Split
| @@ -559,6 +559,8 @@ · 558 unmodified lines | |||
| 559 | "close_position": "right", | 559 | "close_position": "right", |
| 560 | // Whether to show the file icon for a tab. | 560 | // Whether to show the file icon for a tab. |
| 561 | "file_icons": false, | 561 | "file_icons": false, |
| 562 | // Whether to always show the close button on tabs. | ||
| 563 | "always_show_close_button": false, | ||
| 562 | // What to do after closing the current tab. | 564 | // What to do after closing the current tab. |
| 563 | // | 565 | // |
| 564 | // 1. Activate the tab that was open previously (default) | 566 | // 1. Activate the tab that was open previously (default) |
| @@ -42,6 +42,7 @@ pub struct ItemSettings { · 41 unmodified lines | |||
| 42 | pub close_position: ClosePosition, | 42 | pub close_position: ClosePosition, |
| 43 | pub activate_on_close: ActivateOnClose, | 43 | pub activate_on_close: ActivateOnClose, |
| 44 | pub file_icons: bool, | 44 | pub file_icons: bool, |
| 45 | pub always_show_close_button: bool, | ||
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | #[derive(Deserialize)] | 48 | #[derive(Deserialize)] |
| @@ -85,6 +86,10 @@ pub struct ItemSettingsContent { · 37 unmodified lines | |||
| 85 | /// | 86 | /// |
| 86 | /// Default: history | 87 | /// Default: history |
| 87 | pub activate_on_close: Option<ActivateOnClose>, | 88 | pub activate_on_close: Option<ActivateOnClose>, |
| 89 | /// Whether to always show the close button on tabs. | ||
| 90 | /// | ||
| 91 | /// Default: false | ||
| 92 | always_show_close_button: Option<bool>, | ||
| 88 | } | 93 | } |
| 89 | 94 | ||
| 90 | #[derive(Clone, Default, Serialize, Deserialize, JsonSchema)] | 95 | #[derive(Clone, Default, Serialize, Deserialize, JsonSchema)] |
| @@ -1951,7 +1951,9 @@ impl Pane { · 1950 unmodified lines | |||
| 1951 | }; | 1951 | }; |
| 1952 | 1952 | ||
| 1953 | let icon = item.tab_icon(cx); | 1953 | let icon = item.tab_icon(cx); |
| 1954 | let close_side = &ItemSettings::get_global(cx).close_position; | 1954 | let settings = ItemSettings::get_global(cx); |
| 1955 | let close_side = &settings.close_position; | ||
| 1956 | let always_show_close_button = settings.always_show_close_button; | ||
| 1955 | let indicator = render_item_indicator(item.boxed_clone(), cx); | 1957 | let indicator = render_item_indicator(item.boxed_clone(), cx); |
| 1956 | let item_id = item.item_id(); | 1958 | let item_id = item.item_id(); |
| 1957 | let is_first_item = ix == 0; | 1959 | let is_first_item = ix == 0; |
| @@ -2046,7 +2048,9 @@ impl Pane { · 88 unmodified lines | |||
| 2046 | end_slot_action = &CloseActiveItem { save_intent: None }; | 2048 | end_slot_action = &CloseActiveItem { save_intent: None }; |
| 2047 | end_slot_tooltip_text = "Close Tab"; | 2049 | end_slot_tooltip_text = "Close Tab"; |
| 2048 | IconButton::new("close tab", IconName::Close) | 2050 | IconButton::new("close tab", IconName::Close) |
| 2049 | .visible_on_hover("") | 2051 | .when(!always_show_close_button, |button| { |
| 2052 | button.visible_on_hover("") | ||
| 2053 | }) | ||
| 2050 | .shape(IconButtonShape::Square) | 2054 | .shape(IconButtonShape::Square) |
| 2051 | .icon_color(Color::Muted) | 2055 | .icon_color(Color::Muted) |
| 2052 | .size(ButtonSize::None) | 2056 | .size(ButtonSize::None) |
| @@ -634,7 +634,8 @@ List of `string` values · 633 unmodified lines | |||
| 634 | "close_position": "right", | 634 | "close_position": "right", |
| 635 | "file_icons": false, | 635 | "file_icons": false, |
| 636 | "git_status": false, | 636 | "git_status": false, |
| 637 | "activate_on_close": "history" | 637 | "activate_on_close": "history", |
| 638 | "always_show_close_button": false | ||
| 638 | }, | 639 | }, |
| 639 | ``` | 640 | ``` |
| 640 | 641 | ||
| @@ -698,6 +699,12 @@ List of `string` values · 57 unmodified lines | |||
| 698 | } | 699 | } |
| 699 | ``` | 700 | ``` |
| 700 | 701 | ||
| 702 | ### Always show the close button | ||
| 703 | |||
| 704 | - Description: Whether to always show the close button on tabs. | ||
| 705 | - Setting: `always_show_close_button` | ||
| 706 | - Default: `false` | ||
| 707 | |||
| 701 | ## Editor Toolbar | 708 | ## Editor Toolbar |
| 702 | 709 | ||
| 703 | - Description: Whether or not to show various elements in the editor toolbar. | 710 | - Description: Whether or not to show various elements in the editor toolbar. |