Add setting for making the tab's close button always visible (#21352)

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
This commit is contained in:
Danilo Leal 2024-12-02 07:48:10 -03:00 committed by GitHub
parent 740ba7817b
commit dacd919e27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 3 deletions

View file

@ -1951,7 +1951,9 @@ impl Pane {
};
let icon = item.tab_icon(cx);
let close_side = &ItemSettings::get_global(cx).close_position;
let settings = ItemSettings::get_global(cx);
let close_side = &settings.close_position;
let always_show_close_button = settings.always_show_close_button;
let indicator = render_item_indicator(item.boxed_clone(), cx);
let item_id = item.item_id();
let is_first_item = ix == 0;
@ -2046,7 +2048,9 @@ impl Pane {
end_slot_action = &CloseActiveItem { save_intent: None };
end_slot_tooltip_text = "Close Tab";
IconButton::new("close tab", IconName::Close)
.visible_on_hover("")
.when(!always_show_close_button, |button| {
button.visible_on_hover("")
})
.shape(IconButtonShape::Square)
.icon_color(Color::Muted)
.size(ButtonSize::None)