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:
@@ -485,7 +485,7 @@ impl Vim {
|
||||
if object == Object::Paragraph && range.start != range.end {
|
||||
let row_of_selection_end_line = selection.end.to_point(map).row;
|
||||
let new_selection_end = if map
|
||||
.buffer_snapshot
|
||||
.buffer_snapshot()
|
||||
.line_len(MultiBufferRow(row_of_selection_end_line))
|
||||
== 0
|
||||
{
|
||||
@@ -505,7 +505,7 @@ impl Vim {
|
||||
if selection.end.to_point(map).row > new_start_point.row {
|
||||
if original_point.column
|
||||
== map
|
||||
.buffer_snapshot
|
||||
.buffer_snapshot()
|
||||
.line_len(MultiBufferRow(original_point.row))
|
||||
{
|
||||
selection.start = movement::saturating_left(
|
||||
@@ -635,7 +635,7 @@ impl Vim {
|
||||
let row = end.row.saturating_sub(1);
|
||||
selection.end = Point::new(
|
||||
row,
|
||||
map.buffer_snapshot.line_len(MultiBufferRow(row)),
|
||||
map.buffer_snapshot().line_len(MultiBufferRow(row)),
|
||||
)
|
||||
.to_display_point(map)
|
||||
} else {
|
||||
@@ -658,12 +658,13 @@ impl Vim {
|
||||
s.move_with(|map, selection| {
|
||||
let end = selection.end.to_point(map);
|
||||
let start = selection.start.to_point(map);
|
||||
if end.row < map.buffer_snapshot.max_point().row {
|
||||
if end.row < map.buffer_snapshot().max_point().row {
|
||||
selection.end = Point::new(end.row + 1, 0).to_display_point(map)
|
||||
} else if start.row > 0 {
|
||||
selection.start = Point::new(
|
||||
start.row - 1,
|
||||
map.buffer_snapshot.line_len(MultiBufferRow(start.row - 1)),
|
||||
map.buffer_snapshot()
|
||||
.line_len(MultiBufferRow(start.row - 1)),
|
||||
)
|
||||
.to_display_point(map)
|
||||
}
|
||||
@@ -706,9 +707,11 @@ impl Vim {
|
||||
let end = selection.end.to_point(map);
|
||||
if end.column == 0 && end > start {
|
||||
let row = end.row.saturating_sub(1);
|
||||
selection.end =
|
||||
Point::new(row, map.buffer_snapshot.line_len(MultiBufferRow(row)))
|
||||
.to_display_point(map);
|
||||
selection.end = Point::new(
|
||||
row,
|
||||
map.buffer_snapshot().line_len(MultiBufferRow(row)),
|
||||
)
|
||||
.to_display_point(map);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -755,7 +758,7 @@ impl Vim {
|
||||
.disjoint_anchors_arc()
|
||||
.iter()
|
||||
.map(|selection| {
|
||||
let start = selection.start.bias_left(&display_map.buffer_snapshot);
|
||||
let start = selection.start.bias_left(&display_map.buffer_snapshot());
|
||||
start..start
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Reference in New Issue
Block a user