Skip to content

Commit

Permalink
patch 9.0.0017: accessing memory beyond the end of the line
Browse files Browse the repository at this point in the history
Problem:    Accessing memory beyond the end of the line.
Solution:   Stop Visual mode when closing a window.
  • Loading branch information
brammool committed Jul 1, 2022
1 parent c2a79b8 commit 3d51ce1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/testdir/test_visual.vim
Expand Up @@ -1469,5 +1469,17 @@ func Test_visual_paste_clipboard()
bwipe!
endfunc

func Test_visual_area_adjusted_when_hiding()
" The Visual area ended after the end of the line after :hide
call setline(1, 'xxx')
vsplit Xfile
call setline(1, 'xxxxxxxx')
norm! $o
hid
norm! zW
bwipe!
bwipe!
endfunc


" vim: shiftwidth=2 sts=2 expandtab
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -735,6 +735,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
17,
/**/
16,
/**/
Expand Down
2 changes: 2 additions & 0 deletions src/window.c
Expand Up @@ -2594,6 +2594,8 @@ win_close(win_T *win, int free_buf)
*/
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);
Expand Down

0 comments on commit 3d51ce1

Please sign in to comment.