vis

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

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

commit b606d69428ef3b20a1a64d96e1b4f7d9e8f66f2c
parent c3dd0d297a4253a0f32e43247b9450f2afc5de2f
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Mon, 28 Mar 2016 11:02:33 +0200

vis: Ctrl-{j,k} do not create duplicate cursors, instead advance primary one

Diffstat:
Mmain.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c @@ -1232,7 +1232,14 @@ static const char *cursors_new(Vis *vis, const char *keys, const Arg *arg) { view_line_up(cursor); size_t newpos = view_cursors_pos(cursor); view_cursors_to(cursor, oldpos); - view_cursors_new(view, newpos); + if (!view_cursors_new(view, newpos)) { + if (arg->i == -1) { + cursor = view_cursors_prev(cursor); + } else if (arg->i == +1) { + cursor = view_cursors_next(cursor); + } + view_cursors_primary_set(cursor); + } } vis_count_set(vis, VIS_COUNT_UNKNOWN); return keys;