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.
3d51ce18ab
This commit is contained in:
zeertzjq
2022-07-02 06:32:24 +08:00
parent 9b4d0137b8
commit 0b15c01912
2 changed files with 14 additions and 0 deletions

View File

@@ -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);