Add clip_to_line_end to display_map/snapshot and set it to ensure vim positioning in normal mode

Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Keith Simmons 2022-03-25 18:09:37 -07:00
parent bb9b36dccd
commit 0aaf270650
10 changed files with 142 additions and 104 deletions

View file

@ -7,7 +7,7 @@ mod normal;
mod vim_tests;
use collections::HashMap;
use editor::Editor;
use editor::{CursorShape, Editor};
use editor_utils::VimEditorExt;
use gpui::{action, MutableAppContext, ViewContext, WeakViewHandle};
@ -59,7 +59,7 @@ impl VimState {
active_editor.set_keymap_context_layer::<Self>(mode.keymap_context_layer());
active_editor.set_input_enabled(*mode == Mode::Insert);
if *mode != Mode::Insert {
active_editor.adjust_selections(cx);
active_editor.clip_selections(cx);
}
});
}
@ -89,6 +89,7 @@ impl VimState {
if let Some(editor) = editor.upgrade(cx) {
editor.update(cx, |editor, cx| {
editor.set_cursor_shape(cursor_shape, cx);
editor.set_clip_at_line_ends(cursor_shape == CursorShape::Block, cx);
});
}
}