vim-patch:8.2.4028: ml_get error with :doautoall and Visual area

Problem:    ml_get error with :doautoall and Visual area. (Sean Dewar)
Solution:   Disable Visual mode while executing autocommands.
cb1956d6f2

This should also fix #16937 for nvim_buf_call, so test for it.
This commit is contained in:
Sean Dewar
2022-01-07 17:33:01 +00:00
parent d984a8d130
commit 6820420d3e
4 changed files with 32 additions and 2 deletions

View File

@@ -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".