aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-07-28 12:30:47 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-07-28 13:21:50 +0200
commita19159c506577a168655afcd961381dd1f995610 (patch)
treee47329a2f5af3fa14d9fffa1461698ae16d04116
parent3cc2390fed1cb4a626100e4bec428575a3e95f1a (diff)
downloadvis-a19159c506577a168655afcd961381dd1f995610.tar.gz
vis-a19159c506577a168655afcd961381dd1f995610.tar.xz
vis: do not move cursor in multicursor mode after undo/redo
-rw-r--r--vis.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/vis.c b/vis.c
index 0f4cc20..b10f798 100644
--- 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);
}