From 7b6932485679b7492893542ca7b15630f6ea0ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Soares?= <37777652+Dnreikronos@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:25:52 -0300 Subject: [PATCH] Truncate long diagnostic messages in the status bar (#51031) Closes #50186 Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) ## Screenshots: ### Before: image ### After: image Release Notes: - Fixed long diagnostic messages in the status bar pushing right-side buttons (terminal, agent, etc.) off screen --- crates/diagnostics/src/items.rs | 3 ++- crates/workspace/src/status_bar.rs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/diagnostics/src/items.rs b/crates/diagnostics/src/items.rs index b4ca52ea7239b6e4e76160a475d703ddd2933f44..67a6877bbe95778815d9470c0d9c8360657328f3 100644 --- a/crates/diagnostics/src/items.rs +++ b/crates/diagnostics/src/items.rs @@ -28,7 +28,7 @@ pub struct DiagnosticIndicator { impl Render for DiagnosticIndicator { fn render(&mut self, _: &mut Window, cx: &mut Context) -> impl IntoElement { - let indicator = h_flex().gap_2(); + let indicator = h_flex().gap_2().min_w_0().overflow_x_hidden(); if !ProjectSettings::get_global(cx).diagnostics.button { return indicator.hidden(); } @@ -67,6 +67,7 @@ impl Render for DiagnosticIndicator { Some( Button::new("diagnostic_message", SharedString::new(message)) .label_size(LabelSize::Small) + .truncate(true) .tooltip(|_window, cx| { Tooltip::for_action( "Next Diagnostic", diff --git a/crates/workspace/src/status_bar.rs b/crates/workspace/src/status_bar.rs index 9087cbba42b054c1b247bdf3d9402688de4b7add..6164ff3f7f1ba3ee2b578beb6aa0c3ccced50884 100644 --- a/crates/workspace/src/status_bar.rs +++ b/crates/workspace/src/status_bar.rs @@ -68,12 +68,14 @@ impl StatusBar { fn render_left_tools(&self) -> impl IntoElement { h_flex() .gap_1() + .min_w_0() .overflow_x_hidden() .children(self.left_items.iter().map(|item| item.to_any())) } fn render_right_tools(&self) -> impl IntoElement { h_flex() + .flex_shrink_0() .gap_1() .overflow_x_hidden() .children(self.right_items.iter().rev().map(|item| item.to_any()))