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.

Truncate long diagnostic messages in the status bar (#51031)

João Soares7b6932485679
diff --git a/crates/diagnostics/src/items.rs b/crates/diagnostics/src/items.rs
index b4ca52ea723..67a6877bbe9 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<Self>) -> 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 9087cbba42b..6164ff3f7f1 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()))