Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
editor: Add `diffs_expanded` to key context when diff hunks are expanded (#40617)
Josh Piasecki3de3a369f502
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 0d3325ff821..8cb3d1abf7d 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -2631,6 +2631,10 @@ impl Editor {key_context.add("end_of_input");}+ if self.has_any_expanded_diff_hunks(cx) {+ key_context.add("diffs_expanded");+ }+key_context}@@ -19336,6 +19340,16 @@ impl Editor {})}+ fn has_any_expanded_diff_hunks(&self, cx: &App) -> bool {+ if self.buffer.read(cx).all_diff_hunks_expanded() {+ return true;+ }+ let ranges = vec![Anchor::min()..Anchor::max()];+ self.buffer+ .read(cx)+ .has_expanded_diff_hunks_in_ranges(&ranges, cx)+ }+fn toggle_diff_hunks_in_ranges(&mut self,ranges: Vec<Range<Anchor>>,