vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit b0d2bb460e92da0106c9a5366297f1999d341ca9 parent 01457900cf3b6d70e228ef91fda35a14b82c5f2e Author: Marc André Tanner <mat@brain-dump.org> Date: Tue, 28 Jul 2015 12:30:47 +0200 vis: do not move cursor in multicursor mode after undo/redo Diffstat:
| M | vis.c | | | 8 | ++++++-- |
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/vis.c b/vis.c @@ -985,7 +985,9 @@ static void mark_line(const Arg *arg) { static void undo(const Arg *arg) { size_t pos = text_undo(vis->win->file->text); if (pos != EPOS) { - view_cursor_to(vis->win->view, pos); + View *view = vis->win->view; + if (view_cursors_count(view) == 1) + view_cursor_to(view, pos); /* redraw all windows in case some display the same file */ editor_draw(vis); } @@ -994,7 +996,9 @@ static void undo(const Arg *arg) { static void redo(const Arg *arg) { size_t pos = text_redo(vis->win->file->text); if (pos != EPOS) { - view_cursor_to(vis->win->view, pos); + View *view = vis->win->view; + if (view_cursors_count(view) == 1) + view_cursor_to(view, pos); /* redraw all windows in case some display the same file */ editor_draw(vis); }