From 0b15c019124965920c5f2df8c8ee75cd46311d27 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 2 Jul 2022 06:32:24 +0800 Subject: vim-patch:9.0.0017: accessing memory beyond the end of the line Problem: Accessing memory beyond the end of the line. Solution: Stop Visual mode when closing a window. https://github.com/vim/vim/commit/3d51ce18ab1be4f9f6061568a4e7fabf00b21794 --- src/nvim/window.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/window.c') diff --git a/src/nvim/window.c b/src/nvim/window.c index 9ac027d80f..38597b8b77 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2741,6 +2741,8 @@ int win_close(win_T *win, bool free_buf, bool force) * to be the last one left, return now. */ if (wp->w_buffer != curbuf) { + reset_VIsual_and_resel(); // stop Visual mode + other_buffer = true; win->w_closing = true; apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, false, curbuf); -- cgit