aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/autocmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/autocmd.c')
-rw-r--r--src/nvim/autocmd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 01ebdfdafe..897c9533e5 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -1535,6 +1535,7 @@ win_found:
globaldir = aco->globaldir;
// the buffer contents may have changed
+ VIsual_active = aco->save_VIsual_active;
check_cursor();
if (curwin->w_topline > curbuf->b_ml.ml_line_count) {
curwin->w_topline = curbuf->b_ml.ml_line_count;
@@ -1563,14 +1564,16 @@ win_found:
curwin = save_curwin;
curbuf = curwin->w_buffer;
prevwin = win_find_by_handle(aco->save_prevwin_handle);
+
// In case the autocommand moves the cursor to a position that does not
// exist in curbuf
+ VIsual_active = aco->save_VIsual_active;
check_cursor();
}
}
- check_cursor(); // just in case lines got deleted
VIsual_active = aco->save_VIsual_active;
+ check_cursor(); // just in case lines got deleted
if (VIsual_active) {
check_pos(curbuf, &VIsual);
}