diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 0d3325ff8212b6ae9dcc5a9c34dd13e4c5324178..8cb3d1abf7d026e7201c60834f355d0f5e56671d 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>,