Reduce display_map snapshot creation (#39354)
Re-applies https://github.com/zed-industries/zed/pull/30840 This PR re-applies the initial [PR](https://github.com/zed-industries/zed/pull/30840). As it was closed because it was hard to land, because of the many conflicts. This PR re-applies the changes for it. In several cases we were creating multiple display_map snapshots within the same root-level function call. Creating a display_map snapshot is quite slow, and in some cases we were creating the snapshot multiple times. Release Notes: - N/A
This commit is contained in:
@@ -56,7 +56,8 @@ impl Vim {
|
||||
vim.copy_selections_content(editor, MotionKind::for_mode(vim.mode), window, cx);
|
||||
}
|
||||
|
||||
let (display_map, current_selections) = editor.selections.all_adjusted_display(cx);
|
||||
let display_map = editor.display_snapshot(cx);
|
||||
let current_selections = editor.selections.all_adjusted_display(&display_map);
|
||||
|
||||
// unlike zed, if you have a multi-cursor selection from vim block mode,
|
||||
// pasting it will paste it on subsequent lines, even if you don't yet
|
||||
@@ -173,7 +174,7 @@ impl Vim {
|
||||
original_indent_columns.push(original_indent_column);
|
||||
}
|
||||
|
||||
let cursor_offset = editor.selections.last::<usize>(cx).head();
|
||||
let cursor_offset = editor.selections.last::<usize>(&display_map).head();
|
||||
if editor
|
||||
.buffer()
|
||||
.read(cx)
|
||||
|
||||
Reference in New Issue
Block a user