aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/testdir/test_winbuf_close.vim14
-rw-r--r--src/nvim/window.c5
2 files changed, 17 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_winbuf_close.vim b/src/nvim/testdir/test_winbuf_close.vim
index ee43540fdd..7f5b80e8d3 100644
--- a/src/nvim/testdir/test_winbuf_close.vim
+++ b/src/nvim/testdir/test_winbuf_close.vim
@@ -160,7 +160,7 @@ func Test_winfixwidth_on_close()
endfunction
" Test that 'winfixheight' will be respected even there is non-leaf frame
-fun! Test_winfixheight_non_leaf_frame()
+func Test_winfixheight_non_leaf_frame()
vsplit
botright 11new
let l:wid = win_getid()
@@ -173,7 +173,7 @@ fun! Test_winfixheight_non_leaf_frame()
endf
" Test that 'winfixwidth' will be respected even there is non-leaf frame
-fun! Test_winfixwidth_non_leaf_frame()
+func Test_winfixwidth_non_leaf_frame()
split
topleft 11vnew
let l:wid = win_getid()
@@ -184,3 +184,13 @@ fun! Test_winfixwidth_non_leaf_frame()
call assert_equal(11, winwidth(l:wid))
%bwipe!
endf
+
+func Test_tabwin_close()
+ enew
+ let l:wid = win_getid()
+ tabedit
+ call win_execute(l:wid, 'close')
+ " Should not crash.
+ call assert_true(v:true)
+ %bwipe!
+endfunc
diff --git a/src/nvim/window.c b/src/nvim/window.c
index bcd955d1b0..4fa6d8e63c 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -3459,6 +3459,9 @@ int win_alloc_first(void)
first_tabpage = alloc_tabpage();
first_tabpage->tp_topframe = topframe;
curtab = first_tabpage;
+ curtab->tp_firstwin = firstwin;
+ curtab->tp_lastwin = lastwin;
+ curtab->tp_curwin = curwin;
return OK;
}
@@ -3627,6 +3630,8 @@ int win_new_tabpage(int after, char_u *filename)
newtp->tp_next = tp->tp_next;
tp->tp_next = newtp;
}
+ newtp->tp_firstwin = newtp->tp_lastwin = newtp->tp_curwin = curwin;
+
win_init_size();
firstwin->w_winrow = tabline_height();
win_comp_scroll(curwin);