Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Re-understand that the line just below git deletion is "inside" hunk
Julia48cdefe6cff2
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 82945fc00b9..380cf1a5e60 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -7308,11 +7308,11 @@ impl Editor {let display_point = initial_point.to_display_point(snapshot);let mut hunks = hunks.map(|hunk| diff_hunk_to_display(hunk, &snapshot))- .skip_while(|hunk| {+ .filter(|hunk| {if is_wrapped {- false+ true} else {- hunk.contains_display_row(display_point.row())+ !hunk.contains_display_row(display_point.row())}}).dedup();diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rsindex 6421fc6f7a3..a847e33c1a1 100644--- a/crates/editor/src/editor_tests.rs+++ b/crates/editor/src/editor_tests.rs@@ -6800,6 +6800,46 @@ async fn go_to_hunk(deterministic: Arc<Deterministic>, cx: &mut gpui::TestAppCon.unindent(),);+ cx.update_editor(|editor, cx| {+ editor.go_to_prev_hunk(&GoToPrevHunk, cx);+ });++ cx.assert_editor_state(+ &r#"+ use some::modified;++ ˇ+ fn main() {+ println!("hello there");++ println!("around the");+ println!("world");+ }+ "#+ .unindent(),+ );++ cx.update_editor(|editor, cx| {+ for _ in 0..3 {+ editor.go_to_prev_hunk(&GoToPrevHunk, cx);+ }+ });++ cx.assert_editor_state(+ &r#"+ use some::modified;+++ fn main() {+ ˇ println!("hello there");++ println!("around the");+ println!("world");+ }+ "#+ .unindent(),+ );+cx.update_editor(|editor, cx| {editor.fold(&Fold, cx);diff --git a/crates/editor/src/git.rs b/crates/editor/src/git.rsindex 34521381262..0ec7358df72 100644--- a/crates/editor/src/git.rs+++ b/crates/editor/src/git.rs@@ -36,7 +36,7 @@ impl DisplayDiffHunk {DisplayDiffHunk::Unfolded {display_row_range, ..- } => display_row_range.start..=display_row_range.end - 1,+ } => display_row_range.start..=display_row_range.end,};range.contains(&display_row)@@ -77,8 +77,8 @@ pub fn diff_hunk_to_display(hunk: DiffHunk<u32>, snapshot: &DisplaySnapshot) ->} else {let start = hunk_start_point.to_display_point(snapshot).row();- let hunk_end_row_inclusive = hunk.buffer_range.end.max(hunk.buffer_range.start);- let hunk_end_point = Point::new(hunk_end_row_inclusive, 0);+ let hunk_end_row = hunk.buffer_range.end.max(hunk.buffer_range.start);+ let hunk_end_point = Point::new(hunk_end_row, 0);let end = hunk_end_point.to_display_point(snapshot).row();DisplayDiffHunk::Unfolded {