Implement staging of partially-staged hunks (#25520)

Closes: #25475 

This PR makes it possible to stage uncommitted hunks that overlap but do
not coincide with an unstaged hunk.

Release Notes:

- Made it possible to stage hunks that are already partially staged

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Max <max@zed.dev>
This commit is contained in:
authored and GitHub committed 2025-02-24 23:13:13 -05:00
1 parent bcbb19e06e
commit 45146b6f30
6 files changed
+432 -179

No files matched your search

-3
View File
@@ -131,7 +131,6 @@ pub struct MultiBufferDiffHunk {
pub diff_base_byte_range: Range<usize>,
/// Whether or not this hunk also appears in the 'secondary diff'.
pub secondary_status: DiffHunkSecondaryStatus,
pub secondary_diff_base_byte_range: Option<Range<usize>>,
}
impl MultiBufferDiffHunk {
@@ -3506,7 +3505,6 @@ impl MultiBufferSnapshot {
buffer_range: hunk.buffer_range.clone(),
diff_base_byte_range: hunk.diff_base_byte_range.clone(),
secondary_status: hunk.secondary_status,
secondary_diff_base_byte_range: hunk.secondary_diff_base_byte_range,
})
})
}
@@ -3876,7 +3874,6 @@ impl MultiBufferSnapshot {
buffer_range: hunk.buffer_range.clone(),
diff_base_byte_range: hunk.diff_base_byte_range.clone(),
secondary_status: hunk.secondary_status,
secondary_diff_base_byte_range: hunk.secondary_diff_base_byte_range,
});
}
}