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
|
@ -98,7 +98,8 @@ pub enum Event {
|
|||
ids: Vec<ExcerptId>,
|
||||
},
|
||||
ExcerptsEdited {
|
||||
ids: Vec<ExcerptId>,
|
||||
excerpt_ids: Vec<ExcerptId>,
|
||||
buffer_ids: Vec<BufferId>,
|
||||
},
|
||||
DiffHunksToggled,
|
||||
Edited {
|
||||
|
@ -767,7 +768,9 @@ impl MultiBuffer {
|
|||
this.convert_edits_to_buffer_edits(edits, &snapshot, &original_start_columns);
|
||||
drop(snapshot);
|
||||
|
||||
let mut buffer_ids = Vec::new();
|
||||
for (buffer_id, mut edits) in buffer_edits {
|
||||
buffer_ids.push(buffer_id);
|
||||
edits.sort_by_key(|edit| edit.range.start);
|
||||
this.buffers.borrow()[&buffer_id]
|
||||
.buffer
|
||||
|
@ -844,7 +847,8 @@ impl MultiBuffer {
|
|||
}
|
||||
|
||||
cx.emit(Event::ExcerptsEdited {
|
||||
ids: edited_excerpt_ids,
|
||||
excerpt_ids: edited_excerpt_ids,
|
||||
buffer_ids,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1004,7 +1008,9 @@ impl MultiBuffer {
|
|||
this.convert_edits_to_buffer_edits(edits, &snapshot, &[]);
|
||||
drop(snapshot);
|
||||
|
||||
let mut buffer_ids = Vec::new();
|
||||
for (buffer_id, mut edits) in buffer_edits {
|
||||
buffer_ids.push(buffer_id);
|
||||
edits.sort_unstable_by_key(|edit| edit.range.start);
|
||||
|
||||
let mut ranges: Vec<Range<usize>> = Vec::new();
|
||||
|
@ -1026,7 +1032,8 @@ impl MultiBuffer {
|
|||
}
|
||||
|
||||
cx.emit(Event::ExcerptsEdited {
|
||||
ids: edited_excerpt_ids,
|
||||
excerpt_ids: edited_excerpt_ids,
|
||||
buffer_ids,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue