summaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 108d596769..669cfa9a97 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -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;