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:
Cole Miller
2025-02-24 23:13:13 -05:00
committed by GitHub
co-authored by Max Brunsfeld Max
parent bcbb19e06e
commit 45146b6f30
6 changed files with 432 additions and 179 deletions
-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,
});
}
}