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.

Don't show diff review button on folded buffers (#46968)

Danilo Leal2618f2922f0b
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 1ecb03e2246..7f29097c152 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -3112,12 +3112,21 @@ impl EditorElement {
let display_row = indicator.display_row;
let row_index = (display_row.0.saturating_sub(range.start.0)) as usize;
- // Don't show on rows with expand excerpt buttons
let row_info = row_infos.get(row_index);
if row_info.is_some_and(|row_info| row_info.expand_info.is_some()) {
return None;
}
+ let buffer_id = row_info.and_then(|info| info.buffer_id);
+ if buffer_id.is_none() {
+ return None;
+ }
+
+ let editor = self.editor.read(cx);
+ if buffer_id.is_some_and(|buffer_id| editor.is_buffer_folded(buffer_id, cx)) {
+ return None;
+ }
+
let buffer_row = row_info.and_then(|info| info.buffer_row);
Some((display_row, buffer_row))
}