Fix toggle fold in deleted hunk (#25967)
Updates #25835 Updates #25951 Closes #ISSUE Release Notes: - Fixed toggling folds from within deleted hunks
This commit is contained in:
parent
c03bf1af36
commit
2a7a4a80c6
1 changed files with 9 additions and 4 deletions
|
@ -12965,13 +12965,18 @@ impl Editor {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let multi_buffer_snapshot = self.buffer.read(cx).snapshot(cx);
|
let multi_buffer_snapshot = self.buffer.read(cx).snapshot(cx);
|
||||||
let buffer_ids: HashSet<_> = multi_buffer_snapshot
|
let buffer_ids: HashSet<_> = self
|
||||||
.ranges_to_buffer_ranges(self.selections.disjoint_anchor_ranges())
|
.selections
|
||||||
.map(|(snapshot, _, _)| snapshot.remote_id())
|
.disjoint_anchor_ranges()
|
||||||
|
.flat_map(|range| multi_buffer_snapshot.buffer_ids_for_range(range))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
let should_unfold = buffer_ids
|
||||||
|
.iter()
|
||||||
|
.any(|buffer_id| self.is_buffer_folded(*buffer_id, cx));
|
||||||
|
|
||||||
for buffer_id in buffer_ids {
|
for buffer_id in buffer_ids {
|
||||||
if self.is_buffer_folded(buffer_id, cx) {
|
if should_unfold {
|
||||||
self.unfold_buffer(buffer_id, cx);
|
self.unfold_buffer(buffer_id, cx);
|
||||||
} else {
|
} else {
|
||||||
self.fold_buffer(buffer_id, cx);
|
self.fold_buffer(buffer_id, cx);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue