Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

editor: Refactor excerpts removed event handling (#50695)

Dino0b58d3493612
diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs
index 658239db9a5..00a48a9ab3d 100644
--- a/crates/editor/src/display_map.rs
+++ b/crates/editor/src/display_map.rs
@@ -1006,11 +1006,6 @@ impl DisplayMap {
&self.block_map.folded_buffers
}
- #[instrument(skip_all)]
- pub(super) fn clear_folded_buffer(&mut self, buffer_id: language::BufferId) {
- self.block_map.folded_buffers.remove(&buffer_id);
- }
-
#[instrument(skip_all)]
pub fn insert_creases(
&mut self,
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 5504305f86e..0d1238da216 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -24147,9 +24147,13 @@ impl Editor {
self.display_map.update(cx, |display_map, cx| {
display_map.invalidate_semantic_highlights(*buffer_id);
display_map.clear_lsp_folding_ranges(*buffer_id, cx);
- display_map.clear_folded_buffer(*buffer_id);
});
}
+
+ self.display_map.update(cx, |display_map, cx| {
+ display_map.unfold_buffers(removed_buffer_ids.iter().copied(), cx);
+ });
+
jsx_tag_auto_close::refresh_enabled_in_any_buffer(self, multibuffer, cx);
cx.emit(EditorEvent::ExcerptsRemoved {
ids: ids.clone(),