Unfold buffers in multibuffers when editing them (#25677)
Release Notes: - Multibuffers: Unfold excerpts when editing their contents. Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
b5a1ae6526
commit
be1ac78e11
5 changed files with 98 additions and 43 deletions
|
@ -13314,8 +13314,9 @@ impl Editor {
|
|||
return;
|
||||
}
|
||||
let folded_excerpts = self.buffer().read(cx).excerpts_for_buffer(buffer_id, cx);
|
||||
self.display_map
|
||||
.update(cx, |display_map, cx| display_map.fold_buffer(buffer_id, cx));
|
||||
self.display_map.update(cx, |display_map, cx| {
|
||||
display_map.fold_buffers([buffer_id], cx)
|
||||
});
|
||||
cx.emit(EditorEvent::BufferFoldToggled {
|
||||
ids: folded_excerpts.iter().map(|&(id, _)| id).collect(),
|
||||
folded: true,
|
||||
|
@ -13329,7 +13330,7 @@ impl Editor {
|
|||
}
|
||||
let unfolded_excerpts = self.buffer().read(cx).excerpts_for_buffer(buffer_id, cx);
|
||||
self.display_map.update(cx, |display_map, cx| {
|
||||
display_map.unfold_buffer(buffer_id, cx);
|
||||
display_map.unfold_buffers([buffer_id], cx);
|
||||
});
|
||||
cx.emit(EditorEvent::BufferFoldToggled {
|
||||
ids: unfolded_excerpts.iter().map(|&(id, _)| id).collect(),
|
||||
|
@ -15212,8 +15213,16 @@ impl Editor {
|
|||
.retain(|buffer_id, _| buffer.buffer(*buffer_id).is_some());
|
||||
cx.emit(EditorEvent::ExcerptsRemoved { ids: ids.clone() })
|
||||
}
|
||||
multi_buffer::Event::ExcerptsEdited { ids } => {
|
||||
cx.emit(EditorEvent::ExcerptsEdited { ids: ids.clone() })
|
||||
multi_buffer::Event::ExcerptsEdited {
|
||||
excerpt_ids,
|
||||
buffer_ids,
|
||||
} => {
|
||||
self.display_map.update(cx, |map, cx| {
|
||||
map.unfold_buffers(buffer_ids.iter().copied(), cx)
|
||||
});
|
||||
cx.emit(EditorEvent::ExcerptsEdited {
|
||||
ids: excerpt_ids.clone(),
|
||||
})
|
||||
}
|
||||
multi_buffer::Event::ExcerptsExpanded { ids } => {
|
||||
self.refresh_inlay_hints(InlayHintRefreshReason::NewLinesShown, cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue