summaryrefslogtreecommitdiffstats
path: root/src/autocmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-01-07 15:45:18 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-07 15:45:18 +0000
commitcb1956d6f2aece8ad93e19e5d4c7e0b5e405f056 (patch)
treec0cda08cdaac9137bb73622a3b5d502a27fa7253 /src/autocmd.c
parent2b04d5f1ef0dfaac1706e413947a7297285fa7b9 (diff)
patch 8.2.4028: ml_get error with :doautoall and Visual areav8.2.4028
Problem: ml_get error with :doautoall and Visual area. (Sean Dewar) Solution: Disable Visual mode while executing autocommands.
Diffstat (limited to 'src/autocmd.c')
-rw-r--r--src/autocmd.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/autocmd.c b/src/autocmd.c
index 862370fc6e..37f2480a88 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -1424,8 +1424,6 @@ ex_doautoall(exarg_T *eap)
if (call_do_modelines && did_aucmd)
do_modelines(0);
}
-
- check_cursor(); // just in case lines got deleted
}
/*
@@ -1532,6 +1530,10 @@ aucmd_prepbuf(
curbuf = buf;
aco->new_curwin_id = curwin->w_id;
set_bufref(&aco->new_curbuf, curbuf);
+
+ // disable the Visual area, the position may be invalid in another buffer
+ aco->save_VIsual_active = VIsual_active;
+ VIsual_active = FALSE;
}
/*
@@ -1656,6 +1658,11 @@ win_found:
check_cursor();
}
}
+
+ check_cursor(); // just in case lines got deleted
+ VIsual_active = aco->save_VIsual_active;
+ if (VIsual_active)
+ check_pos(curbuf, &VIsual);
}
static int autocmd_nested = FALSE;