1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-09-03 14:26:17 +03:00

fix e behavior in operator-pending mode of vim example

`e`'s behavior is actually not same as `w`. For example, let's say we
have the following text and the cursor is on 'f'.

```
foo bar
```

Then `de` deletes the text 'foo' but `dw` deletes the text 'foo '
including the trailing space.
Этот коммит содержится в:
rhysd
2024-08-03 23:06:40 +09:00
родитель 6f5ca389ff
Коммит 9087e75c1f

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

@@ -116,14 +116,12 @@ impl Vim {
key: Key::Char('e'),
ctrl: false,
..
} if matches!(self.mode, Mode::Operator(_)) => {
textarea.move_cursor(CursorMove::WordForward) // `e` behaves like `w` in operator-pending mode
} => {
textarea.move_cursor(CursorMove::WordEnd);
if matches!(self.mode, Mode::Operator(_)) {
textarea.move_cursor(CursorMove::Forward); // Include the text under the cursor
}
}
Input {
key: Key::Char('e'),
ctrl: false,
..
} => textarea.move_cursor(CursorMove::WordEnd),
Input {
key: Key::Char('b'),
ctrl: false,