Diff view: Fold excerpts of deleted files by default (#25436)
Release Notes: - N/A
This commit is contained in:
parent
2b28b5969f
commit
d1302a7a08
2 changed files with 18 additions and 5 deletions
|
@ -1448,7 +1448,7 @@ impl MultiBuffer {
|
|||
excerpt.range.context.start,
|
||||
))
|
||||
}
|
||||
|
||||
/// Sets excerpts, returns `true` if at least one new excerpt was added.
|
||||
pub fn set_excerpts_for_path(
|
||||
&mut self,
|
||||
path: PathKey,
|
||||
|
@ -1456,7 +1456,7 @@ impl MultiBuffer {
|
|||
ranges: Vec<Range<Point>>,
|
||||
context_line_count: u32,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
) -> bool {
|
||||
let buffer_snapshot = buffer.update(cx, |buffer, _| buffer.snapshot());
|
||||
|
||||
let mut insert_after = self
|
||||
|
@ -1475,6 +1475,7 @@ impl MultiBuffer {
|
|||
let mut new_excerpt_ids = Vec::new();
|
||||
let mut to_remove = Vec::new();
|
||||
let mut to_insert = Vec::new();
|
||||
let mut added_a_new_excerpt = false;
|
||||
let snapshot = self.snapshot(cx);
|
||||
|
||||
let mut excerpts_cursor = snapshot.excerpts.cursor::<Option<&Locator>>(&());
|
||||
|
@ -1489,6 +1490,7 @@ impl MultiBuffer {
|
|||
continue;
|
||||
}
|
||||
(Some(_), None) => {
|
||||
added_a_new_excerpt = true;
|
||||
to_insert.push(new_iter.next().unwrap());
|
||||
continue;
|
||||
}
|
||||
|
@ -1552,6 +1554,8 @@ impl MultiBuffer {
|
|||
} else {
|
||||
self.buffers_by_path.insert(path, new_excerpt_ids);
|
||||
}
|
||||
|
||||
added_a_new_excerpt
|
||||
}
|
||||
|
||||
pub fn paths(&self) -> impl Iterator<Item = PathKey> + '_ {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue