aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/autocmd.c
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-02-03 16:44:42 +0000
committerGitHub <noreply@github.com>2022-02-03 16:44:42 +0000
commit9efdd927ff50f22e623133976ddd57538f9cd491 (patch)
tree78afdbf98bb5e265f5a17f9551d77b17f677264f /src/nvim/autocmd.c
parentf5c4c1d7684d9d39dd469e10322ce6a5df5c3281 (diff)
parent452b46fcf79de52317e2c41adb083d461a93ace5 (diff)
downloadrneovim-9efdd927ff50f22e623133976ddd57538f9cd491.tar.gz
rneovim-9efdd927ff50f22e623133976ddd57538f9cd491.tar.bz2
rneovim-9efdd927ff50f22e623133976ddd57538f9cd491.zip
Merge pull request #16976 from seandewar/vim-8.2.4018
vim-patch:8.2.{4018,4026,4028} & `nvim_win_call` fixes
Diffstat (limited to 'src/nvim/autocmd.c')
-rw-r--r--src/nvim/autocmd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 94ac389139..2e7f9c5136 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -1069,8 +1069,6 @@ void ex_doautoall(exarg_T *eap)
do_modelines(0);
}
}
-
- check_cursor(); // just in case lines got deleted
}
/// Check *argp for <nomodeline>. When it is present return false, otherwise
@@ -1171,6 +1169,10 @@ void aucmd_prepbuf(aco_save_T *aco, buf_T *buf)
curbuf = buf;
aco->new_curwin_handle = curwin->handle;
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;
}
/// Cleanup after executing autocommands for a (hidden) buffer.
@@ -1267,6 +1269,12 @@ 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);
+ }
}
/// Execute autocommands for "event" and file name "fname".