0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.0198: ml_get error when switching buffer in Visual mode

Problem:    ml_get error when switching buffer in Visual mode.
Solution:   End Visual mode when switching buffer. (closes #10902)
This commit is contained in:
Bram Moolenaar
2022-08-13 14:09:44 +01:00
parent 6a76e84f55
commit cfeb8a584b
3 changed files with 30 additions and 0 deletions

View File

@@ -1818,6 +1818,14 @@ set_curbuf(buf_T *buf, int action)
static void
enter_buffer(buf_T *buf)
{
// when closing the current buffer stop Visual mode
if (VIsual_active
#if defined(EXITFREE)
&& !entered_free_all_mem
#endif
)
end_visual_mode();
// Get the buffer in the current window.
curwin->w_buffer = buf;
curbuf = buf;