editor: Shrink DisplayMapSnapshot from 824 to 256 bytes (#39568)

We have unnecessary clones for the fields here as most of the snapshots
contain the others hierarchically.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-10-06 08:08:49 +00:00
committed by GitHub
parent 9c7369f54d
commit 2bfcd60b88
48 changed files with 594 additions and 543 deletions
+3 -2
View File
@@ -263,7 +263,7 @@ impl Vim {
if prior_selections.iter().any(|s| {
self.update_editor(cx, |_, editor, cx| {
!s.start
.is_valid(&editor.snapshot(window, cx).buffer_snapshot)
.is_valid(&editor.snapshot(window, cx).buffer_snapshot())
})
.unwrap_or(true)
}) {
@@ -469,7 +469,8 @@ impl Vim {
};
if let Some(result) = self.update_editor(cx, |vim, editor, cx| {
let range = action.range.buffer_range(vim, editor, window, cx)?;
let snapshot = &editor.snapshot(window, cx).buffer_snapshot;
let snapshot = editor.snapshot(window, cx);
let snapshot = snapshot.buffer_snapshot();
let end_point = Point::new(range.end.0, snapshot.line_len(range.end));
let range = snapshot.anchor_before(Point::new(range.start.0, 0))
..snapshot.anchor_after(end_point);