1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-08-28 11:36:17 +03:00

fix vim example's text selection should be inclusive in visual mode

Vim's text selection is inclusive. For example, when a cursor is on 'r'
of 'bar', 'r' is included in the selection. However tui-textarea's text
selection is exclusive on the end of the range. Move cursor forward to
emulate Vim's behavior better.
Этот коммит содержится в:
rhysd
2024-08-02 00:07:35 +09:00
родитель 76f1ab6b5a
Коммит 60943f8b14

Просмотреть файл

@@ -338,6 +338,7 @@ impl Vim {
ctrl: false,
..
} if self.mode == Mode::Visual => {
textarea.move_cursor(CursorMove::Forward); // Vim's text selection is inclusive
textarea.copy();
return Transition::Mode(Mode::Normal);
}
@@ -346,6 +347,7 @@ impl Vim {
ctrl: false,
..
} if self.mode == Mode::Visual => {
textarea.move_cursor(CursorMove::Forward); // Vim's text selection is inclusive
textarea.cut();
return Transition::Mode(Mode::Normal);
}
@@ -354,6 +356,7 @@ impl Vim {
ctrl: false,
..
} if self.mode == Mode::Visual => {
textarea.move_cursor(CursorMove::Forward); // Vim's text selection is inclusive
textarea.cut();
return Transition::Mode(Mode::Insert);
}