aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-03-22 01:26:32 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-03-22 18:43:01 +0100
commitf58a593cea3872c7b8b862375b6982436ee88ef2 (patch)
tree853ec6514799382a48bab3bb7a17452239f1399c /src
parent2b32053559669580f51da3cad2258f65c3adf9c4 (diff)
downloadrneovim-f58a593cea3872c7b8b862375b6982436ee88ef2.tar.gz
rneovim-f58a593cea3872c7b8b862375b6982436ee88ef2.tar.bz2
rneovim-f58a593cea3872c7b8b862375b6982436ee88ef2.zip
vim-patch:8.0.0483
Problem: Illegal memory access when using :all. (Dominique Pelle) Solution: Adjust the cursor position right after setting "curwin". https://github.com/vim/vim/commit/f79225ed4f81bc579bb3360ad2eb06adc8058153
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_window_cmd.vim12
-rw-r--r--src/nvim/window.c8
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();