Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

tab_switcher: Add file and project search icons (#17115)

Daste103f757c114c
diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs
index ddf39e0bfa2..eec4f735ec3 100644
--- a/crates/diagnostics/src/diagnostics.rs
+++ b/crates/diagnostics/src/diagnostics.rs
@@ -645,37 +645,42 @@ impl Item for ProjectDiagnosticsEditor {
}
fn tab_content(&self, params: TabContentParams, _: &WindowContext) -> AnyElement {
- if self.summary.error_count == 0 && self.summary.warning_count == 0 {
- Label::new("No problems")
- .color(params.text_color())
- .into_any_element()
- } else {
- h_flex()
- .gap_1()
- .when(self.summary.error_count > 0, |then| {
+ h_flex()
+ .gap_1()
+ .when(
+ self.summary.error_count == 0 && self.summary.warning_count == 0,
+ |then| {
then.child(
h_flex()
.gap_1()
- .child(Icon::new(IconName::XCircle).color(Color::Error))
- .child(
- Label::new(self.summary.error_count.to_string())
- .color(params.text_color()),
- ),
+ .child(Icon::new(IconName::Check).color(Color::Success))
+ .child(Label::new("No problems").color(params.text_color())),
)
- })
- .when(self.summary.warning_count > 0, |then| {
- then.child(
- h_flex()
- .gap_1()
- .child(Icon::new(IconName::Warning).color(Color::Warning))
- .child(
- Label::new(self.summary.warning_count.to_string())
- .color(params.text_color()),
- ),
- )
- })
- .into_any_element()
- }
+ },
+ )
+ .when(self.summary.error_count > 0, |then| {
+ then.child(
+ h_flex()
+ .gap_1()
+ .child(Icon::new(IconName::XCircle).color(Color::Error))
+ .child(
+ Label::new(self.summary.error_count.to_string())
+ .color(params.text_color()),
+ ),
+ )
+ })
+ .when(self.summary.warning_count > 0, |then| {
+ then.child(
+ h_flex()
+ .gap_1()
+ .child(Icon::new(IconName::Warning).color(Color::Warning))
+ .child(
+ Label::new(self.summary.warning_count.to_string())
+ .color(params.text_color()),
+ ),
+ )
+ })
+ .into_any_element()
}
fn telemetry_event_text(&self) -> Option<&'static str> {
diff --git a/crates/tab_switcher/src/tab_switcher.rs b/crates/tab_switcher/src/tab_switcher.rs
index e8966ac5b91..0b3eaf9e8a5 100644
--- a/crates/tab_switcher/src/tab_switcher.rs
+++ b/crates/tab_switcher/src/tab_switcher.rs
@@ -378,6 +378,9 @@ impl PickerDelegate for TabSwitcherDelegate {
.inset(true)
.selected(selected)
.child(h_flex().w_full().child(label))
+ .when_some(tab_match.item.tab_icon(cx), |el, icon| {
+ el.start_slot(div().child(icon))
+ })
.map(|el| {
if self.selected_index == ix {
el.end_slot::<AnyElement>(close_button)
diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs
index 1869e33383d..f19bfa70101 100644
--- a/crates/terminal_view/src/terminal_view.rs
+++ b/crates/terminal_view/src/terminal_view.rs
@@ -1008,7 +1008,7 @@ impl Item for TerminalView {
};
h_flex()
- .gap_2()
+ .gap_1()
.group("term-tab-icon")
.child(
h_flex()