diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-03-11 10:05:29 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-03-11 10:05:29 +0100 |
| commit | ca50d217dc37d4f408c9d2f4696572e1c698a831 (patch) | |
| tree | a6f86720bbd6b288216896ac01cfa36da2f61256 /main.c | |
| parent | 054f792ac6c1502d5f9bb2b251b3f96c4cb27f6b (diff) | |
| download | vis-ca50d217dc37d4f408c9d2f4696572e1c698a831.tar.gz vis-ca50d217dc37d4f408c9d2f4696572e1c698a831.tar.xz | |
vis: respect count for <C-d> and <C-u>
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -1320,19 +1320,22 @@ static const char *cursors_navigate(Vis *vis, const char *keys, const Arg *arg) if (!view_cursors_multiple(view)) return wscroll(vis, keys, arg); Cursor *c = view_cursors_primary_get(view); - if (arg->i < 0) { - c = view_cursors_next(c); - if (!c) - c = view_cursors(view); - } else { - c = view_cursors_prev(c); - if (!c) { - c = view_cursors(view); - for (Cursor *n = c; n; n = view_cursors_next(n)) - c = n; + for (int count = vis_count_get_default(vis, 1); count > 0; count--) { + if (arg->i < 0) { + c = view_cursors_next(c); + if (!c) + c = view_cursors(view); + } else { + c = view_cursors_prev(c); + if (!c) { + c = view_cursors(view); + for (Cursor *n = c; n; n = view_cursors_next(n)) + c = n; + } } } view_cursors_primary_set(c); + vis_count_set(vis, VIS_COUNT_UNKNOWN); return keys; } |
