diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_window_cmd.vim | 12 | ||||
-rw-r--r-- | src/nvim/window.c | 8 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index a5f27fba8a..188a7ed0f3 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -67,6 +67,18 @@ function Test_window_cmd_wincmd_gf() augroup! test_window_cmd_wincmd_gf endfunc +func Test_next_split_all() + " This was causing an illegal memory access. + n x + norm axxx + split + split + s/x + s/x + all + bwipe! +endfunc + func Test_window_quit() e Xa split Xb diff --git a/src/nvim/window.c b/src/nvim/window.c index ce322e1185..82e97ea00d 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2018,10 +2018,12 @@ int win_close(win_T *win, int free_buf) } curbuf = curwin->w_buffer; close_curwin = TRUE; + + // The cursor position may be invalid if the buffer changed after last + // using the window. + check_cursor(); } - if (p_ea - && (*p_ead == 'b' || *p_ead == dir) - ) { + if (p_ea && (*p_ead == 'b' || *p_ead == dir)) { win_equal(curwin, true, dir); } else { win_comp_pos(); |