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.

assistant2: Truncate context pill labels (#26721)

Danilo Leal2183fc674d52
diff --git a/crates/assistant2/src/ui/context_pill.rs b/crates/assistant2/src/ui/context_pill.rs
index e0b8ee2f976..00b3dba8671 100644
--- a/crates/assistant2/src/ui/context_pill.rs
+++ b/crates/assistant2/src/ui/context_pill.rs
@@ -126,7 +126,13 @@ impl RenderOnce for ContextPill {
h_flex()
.id("context-data")
.gap_1()
- .child(Label::new(context.name.clone()).size(LabelSize::Small))
+ .child(
+ div().max_w_64().child(
+ Label::new(context.name.clone())
+ .size(LabelSize::Small)
+ .truncate(),
+ ),
+ )
.when_some(context.parent.as_ref(), |element, parent_name| {
if *dupe_name {
element.child(
@@ -174,21 +180,22 @@ impl RenderOnce for ContextPill {
})
.hover(|style| style.bg(color.element_hover.opacity(0.5)))
.child(
- Label::new(name.clone())
- .size(LabelSize::Small)
- .color(Color::Muted),
+ div().px_0p5().max_w_64().child(
+ Label::new(name.clone())
+ .size(LabelSize::Small)
+ .color(Color::Muted)
+ .truncate(),
+ ),
)
.child(
- div().px_0p5().child(
- Label::new(match kind {
- ContextKind::File => "Active Tab",
- ContextKind::Thread
- | ContextKind::Directory
- | ContextKind::FetchedUrl => "Active",
- })
- .size(LabelSize::XSmall)
- .color(Color::Muted),
- ),
+ Label::new(match kind {
+ ContextKind::File => "Active Tab",
+ ContextKind::Thread | ContextKind::Directory | ContextKind::FetchedUrl => {
+ "Active"
+ }
+ })
+ .size(LabelSize::XSmall)
+ .color(Color::Muted),
)
.child(
Icon::new(IconName::Plus)