aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-04-03 22:08:10 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-04-03 22:12:10 +0200
commitbf52c0cb95b76b4ae17f138c9d98552c38185f46 (patch)
treea71192e4798e46a47eb49ea518312d181972e405
parent994c19d263f9c64c79b64e26099c4a625c161242 (diff)
downloadvis-bf52c0cb95b76b4ae17f138c9d98552c38185f46.tar.gz
vis-bf52c0cb95b76b4ae17f138c9d98552c38185f46.tar.xz
sam: focus first cursor after a x, y, g, v command
-rw-r--r--sam.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sam.c b/sam.c
index 0b04b55..79b8980 100644
--- 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;
}