Skip to content

Commit

Permalink
patch 9.0.0403: 'equalalways' may be off when 'laststatus' is zero
Browse files Browse the repository at this point in the history
Problem:    'equalalways' may be off when 'laststatus' is zero.
Solution:   call last_status() before win_equal(). (Luuk van Baal,
            closes #11070)
  • Loading branch information
luukvbaal authored and brammool committed Sep 7, 2022
1 parent bb6c407 commit fd7e60a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
15 changes: 15 additions & 0 deletions src/testdir/test_window_cmd.vim
Expand Up @@ -1617,4 +1617,19 @@ func Test_window_alloc_failure()
tabonly
endfunc

func Test_win_equal_last_status()
let save_lines = &lines
set lines=20
set splitbelow
set laststatus=0

split | split | quit
call assert_equal(winheight(1), winheight(2))

let &lines = save_lines
set splitbelow&
set laststatus&
endfunc


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

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
403,
/**/
402,
/**/
Expand Down
14 changes: 8 additions & 6 deletions src/window.c
Expand Up @@ -2712,6 +2712,14 @@ win_close(win_T *win, int free_buf)
// using the window.
check_cursor();
}

/*
* If last window has a status line now and we don't want one, remove the
* status line. Do this before win_equal(), because it may change the
* height of a window
*/
last_status(FALSE);

if (p_ea && (*p_ead == 'b' || *p_ead == dir))
// If the frame of the closed window contains the new current window,
// only resize that frame. Otherwise resize all windows.
Expand Down Expand Up @@ -2741,12 +2749,6 @@ win_close(win_T *win, int free_buf)
--dont_parse_messages;
#endif

/*
* If last window has a status line now and we don't want one,
* remove the status line.
*/
last_status(FALSE);

// After closing the help window, try restoring the window layout from
// before it was opened.
if (help_window)
Expand Down

0 comments on commit fd7e60a

Please sign in to comment.