зеркало из
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.
Этот коммит содержится в:
@@ -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);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user