editor: Remove buffer and display map fields from SelectionsCollection (#42175)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-11-07 11:21:14 +01:00
committed by GitHub
parent c2416d6bab
commit 88a8e53696
18 changed files with 394 additions and 367 deletions
+7 -3
View File
@@ -315,11 +315,15 @@ impl ProjectDiagnosticsEditor {
cx: &mut Context<Self>,
retain_selections: bool,
) {
let buffer_ids = self.multibuffer.read(cx).all_buffer_ids();
let selected_buffers = self.editor.update(cx, |editor, cx| {
let snapshot = self
.editor
.update(cx, |editor, cx| editor.display_snapshot(cx));
let buffer = self.multibuffer.read(cx);
let buffer_ids = buffer.all_buffer_ids();
let selected_buffers = self.editor.update(cx, |editor, _| {
editor
.selections
.all_anchors(cx)
.all_anchors(&snapshot)
.iter()
.filter_map(|anchor| anchor.start.buffer_id)
.collect::<HashSet<_>>()
+6 -2
View File
@@ -156,7 +156,9 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
// Cursor is at the first diagnostic
editor.update(cx, |editor, cx| {
assert_eq!(
editor.selections.display_ranges(cx),
editor
.selections
.display_ranges(&editor.display_snapshot(cx)),
[DisplayPoint::new(DisplayRow(3), 8)..DisplayPoint::new(DisplayRow(3), 8)]
);
});
@@ -232,7 +234,9 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
// Cursor keeps its position.
editor.update(cx, |editor, cx| {
assert_eq!(
editor.selections.display_ranges(cx),
editor
.selections
.display_ranges(&editor.display_snapshot(cx)),
[DisplayPoint::new(DisplayRow(8), 8)..DisplayPoint::new(DisplayRow(8), 8)]
);
});