Skip to content

Commit fd7e60a

Browse files
luukvbaalbrammool
authored andcommitted
patch 9.0.0403: 'equalalways' may be off when 'laststatus' is zero
Problem: 'equalalways' may be off when 'laststatus' is zero. Solution: call last_status() before win_equal(). (Luuk van Baal, closes #11070)
1 parent bb6c407 commit fd7e60a

3 files changed

Lines changed: 25 additions & 6 deletions

File tree

src/testdir/test_window_cmd.vim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,4 +1617,19 @@ func Test_window_alloc_failure()
16171617
tabonly
16181618
endfunc
16191619

1620+
func Test_win_equal_last_status()
1621+
let save_lines = &lines
1622+
set lines=20
1623+
set splitbelow
1624+
set laststatus=0
1625+
1626+
split | split | quit
1627+
call assert_equal(winheight(1), winheight(2))
1628+
1629+
let &lines = save_lines
1630+
set splitbelow&
1631+
set laststatus&
1632+
endfunc
1633+
1634+
16201635
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,8 @@ static char *(features[]) =
703703

704704
static int included_patches[] =
705705
{ /* Add new patch number below this line */
706+
/**/
707+
403,
706708
/**/
707709
402,
708710
/**/

src/window.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2712,6 +2712,14 @@ win_close(win_T *win, int free_buf)
27122712
// using the window.
27132713
check_cursor();
27142714
}
2715+
2716+
/*
2717+
* If last window has a status line now and we don't want one, remove the
2718+
* status line. Do this before win_equal(), because it may change the
2719+
* height of a window
2720+
*/
2721+
last_status(FALSE);
2722+
27152723
if (p_ea && (*p_ead == 'b' || *p_ead == dir))
27162724
// If the frame of the closed window contains the new current window,
27172725
// only resize that frame. Otherwise resize all windows.
@@ -2741,12 +2749,6 @@ win_close(win_T *win, int free_buf)
27412749
--dont_parse_messages;
27422750
#endif
27432751

2744-
/*
2745-
* If last window has a status line now and we don't want one,
2746-
* remove the status line.
2747-
*/
2748-
last_status(FALSE);
2749-
27502752
// After closing the help window, try restoring the window layout from
27512753
// before it was opened.
27522754
if (help_window)

0 commit comments

Comments
 (0)