diff options
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index ce788cc7a0..be376c2109 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1533,6 +1533,15 @@ void set_curbuf(buf_T *buf, int action) /// be pointing to freed memory. 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; |