Add support for visual ranges ending with a newline

These primarily happen when first entering visual mode, but can also
be created with objects like `vi{`.

Along the way fix the way ranges like `vi{` are selected to be more
similar to nvim.
This commit is contained in:
Conrad Irwin 2023-07-27 21:39:37 -06:00
parent b53fb8633e
commit 5edcb74760
21 changed files with 301 additions and 135 deletions

View file

@ -1,4 +1,3 @@
use editor::display_map::Clip;
use gpui::keymap_matcher::KeymapContext;
use language::CursorShape;
use serde::{Deserialize, Serialize};
@ -88,10 +87,10 @@ impl VimState {
)
}
pub fn default_clip(&self) -> Clip {
pub fn clip_at_line_ends(&self) -> bool {
match self.mode {
Mode::Insert | Mode::Visual { .. } => Clip::None,
Mode::Normal => Clip::EndOfLine,
Mode::Insert | Mode::Visual { .. } => false,
Mode::Normal => true,
}
}