vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 726ff221ef448c3eaa5d6fdf803127e99a2ed631
parent 1243a17e13a9d3695f981e57bc26e20410779c56
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 11 Mar 2016 10:05:29 +0100

vis: respect count for <C-d> and <C-u>

Diffstat:
Mmain.c | 23+++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/main.c b/main.c @@ -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; }