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.

Use strikethrough on tab label to indicate file deletion (#20711)

Michael Sloanc03f5b351bd8
diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs
index 1f027ba29e4..bc8119c8296 100644
--- a/crates/editor/src/items.rs
+++ b/crates/editor/src/items.rs
@@ -635,12 +635,20 @@ impl Item for Editor {
Some(util::truncate_and_trailoff(description, MAX_TAB_TITLE_LEN))
});
+ let is_deleted: bool = self
+ .buffer()
+ .read(cx)
+ .as_singleton()
+ .and_then(|buffer| buffer.read(cx).file())
+ .map_or(true, |file| file.is_deleted());
+
h_flex()
.gap_2()
.child(
Label::new(self.title(cx).to_string())
.color(label_color)
- .italic(params.preview),
+ .italic(params.preview)
+ .strikethrough(is_deleted),
)
.when_some(description, |this, description| {
this.child(