vis

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

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

commit 248c7ff914bb4f6fd64a08f525a57396e68d2fc6
parent f8283f3ea6b752eea40c47df3dc6c87316338338
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun,  3 Apr 2016 22:08:10 +0200

sam: focus first cursor after a x, y, g, v command

Diffstat:
Msam.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/sam.c b/sam.c @@ -908,6 +908,8 @@ static bool cmd_select(Vis *vis, Win *win, Command *cmd, const char *argv[], Cur View *view = win->view; Text *txt = win->file->text; bool multiple_cursors = view_cursors_multiple(view); + Cursor *primary = view_cursors_primary_get(view); + for (Cursor *c = view_cursors(view), *next; c; c = next) { next = view_cursors_next(c); Filerange sel; @@ -926,6 +928,8 @@ static bool cmd_select(Vis *vis, Win *win, Command *cmd, const char *argv[], Cur ret &= sam_execute(vis, win, cmd->cmd, c, &sel); } + if (primary != view_cursors_primary_get(view)) + view_cursors_primary_set(view_cursors(view)); return ret; }