Add action to go to next/previous git diff in editor

Co-Authored-By: Kay Simmons <kay@zed.dev>
This commit is contained in:
Julia 2022-10-24 16:33:43 -04:00
parent 8a095d0a55
commit c4b21a0ab5
9 changed files with 229 additions and 120 deletions

View file

@ -2592,10 +2592,13 @@ impl MultiBufferSnapshot {
pub fn git_diff_hunks_in_range<'a>(
&'a self,
row_range: Range<u32>,
reversed: bool,
) -> impl 'a + Iterator<Item = DiffHunk<u32>> {
self.as_singleton()
.into_iter()
.flat_map(move |(_, _, buffer)| buffer.git_diff_hunks_in_range(row_range.clone()))
.flat_map(move |(_, _, buffer)| {
buffer.git_diff_hunks_in_range(row_range.clone(), reversed)
})
}
pub fn range_for_syntax_ancestor<T: ToOffset>(&self, range: Range<T>) -> Option<Range<usize>> {