@@ -782,7 +782,7 @@ win_split_ins(
782782 /* add a status line when p_ls == 1 and splitting the first window */
783783 if (ONE_WINDOW && p_ls == 1 && oldwin -> w_status_height == 0 )
784784 {
785- if (oldwin -> w_height <= p_wmh && new_wp == NULL )
785+ if (VISIBLE_HEIGHT ( oldwin ) <= p_wmh && new_wp == NULL )
786786 {
787787 EMSG (_ (e_noroom ));
788788 return FAIL ;
@@ -892,7 +892,7 @@ win_split_ins(
892892 * height.
893893 */
894894 /* Current window requires at least 1 space. */
895- wmh1 = (p_wmh == 0 ? 1 : p_wmh );
895+ wmh1 = (p_wmh == 0 ? 1 : p_wmh ) + WINBAR_HEIGHT ( curwin ) ;
896896 needed = wmh1 + STATUS_HEIGHT ;
897897 if (flags & WSP_ROOM )
898898 needed += p_wh - wmh1 ;
@@ -1105,7 +1105,7 @@ win_split_ins(
11051105 {
11061106 /* height and row of new window is same as current window */
11071107 wp -> w_winrow = oldwin -> w_winrow ;
1108- win_new_height (wp , oldwin -> w_height + WINBAR_HEIGHT (oldwin ));
1108+ win_new_height (wp , VISIBLE_HEIGHT (oldwin ));
11091109 wp -> w_status_height = oldwin -> w_status_height ;
11101110 }
11111111 frp -> fr_height = curfrp -> fr_height ;
@@ -1180,8 +1180,8 @@ win_split_ins(
11801180 }
11811181 else /* new window below current one */
11821182 {
1183- wp -> w_winrow = oldwin -> w_winrow + oldwin -> w_height
1184- + STATUS_HEIGHT + WINBAR_HEIGHT ( oldwin ) ;
1183+ wp -> w_winrow = oldwin -> w_winrow + VISIBLE_HEIGHT ( oldwin )
1184+ + STATUS_HEIGHT ;
11851185 wp -> w_status_height = oldwin -> w_status_height ;
11861186 if (!(flags & WSP_BOT ))
11871187 oldwin -> w_status_height = STATUS_HEIGHT ;
@@ -1422,7 +1422,7 @@ make_windows(
14221422 else
14231423 {
14241424 /* Each window needs at least 'winminheight' lines and a status line. */
1425- maxcount = (curwin -> w_height + curwin -> w_status_height
1425+ maxcount = (VISIBLE_HEIGHT ( curwin ) + curwin -> w_status_height
14261426 - (p_wh - p_wmh )) / (p_wmh + STATUS_HEIGHT );
14271427 }
14281428
@@ -3204,8 +3204,7 @@ frame_fix_width(win_T *wp)
32043204 static void
32053205frame_fix_height (win_T * wp )
32063206{
3207- wp -> w_frame -> fr_height = wp -> w_height + wp -> w_status_height
3208- + WINBAR_HEIGHT (wp ) ;
3207+ wp -> w_frame -> fr_height = VISIBLE_HEIGHT (wp ) + wp -> w_status_height ;
32093208}
32103209
32113210/*
@@ -3230,9 +3229,14 @@ frame_minheight(frame_T *topfrp, win_T *next_curwin)
32303229 {
32313230 /* window: minimal height of the window plus status line */
32323231 m = p_wmh + topfrp -> fr_win -> w_status_height ;
3233- /* Current window is minimal one line high */
3234- if (p_wmh == 0 && topfrp -> fr_win == curwin && next_curwin == NULL )
3235- ++ m ;
3232+ if (topfrp -> fr_win == curwin && next_curwin == NULL )
3233+ {
3234+ /* Current window is minimal one line high and WinBar is
3235+ * visible. */
3236+ if (p_wmh == 0 )
3237+ ++ m ;
3238+ m += WINBAR_HEIGHT (curwin );
3239+ }
32363240 }
32373241 }
32383242 else if (topfrp -> fr_layout == FR_ROW )
@@ -4972,6 +4976,7 @@ frame_comp_pos(frame_T *topfrp, int *row, int *col)
49724976 frame_T * frp ;
49734977 int startcol ;
49744978 int startrow ;
4979+ int h ;
49754980
49764981 wp = topfrp -> fr_win ;
49774982 if (wp != NULL )
@@ -4984,7 +4989,9 @@ frame_comp_pos(frame_T *topfrp, int *row, int *col)
49844989 redraw_win_later (wp , NOT_VALID );
49854990 wp -> w_redr_status = TRUE;
49864991 }
4987- * row += wp -> w_height + wp -> w_status_height ;
4992+ /* WinBar will not show if the window height is zero */
4993+ h = VISIBLE_HEIGHT (wp ) + wp -> w_status_height ;
4994+ * row += h > topfrp -> fr_height ? topfrp -> fr_height : h ;
49884995 * col += wp -> w_width + wp -> w_vsep_width ;
49894996 }
49904997 else
@@ -5029,6 +5036,7 @@ win_setheight_win(int height, win_T *win)
50295036 height = p_wmh ;
50305037 if (height == 0 )
50315038 height = 1 ;
5039+ height += WINBAR_HEIGHT (curwin );
50325040 }
50335041
50345042 frame_setheight (win -> w_frame , height + win -> w_status_height );
@@ -5126,7 +5134,8 @@ frame_setheight(frame_T *curfrp, int height)
51265134 else
51275135 {
51285136 room_cmdline = Rows - p_ch - (lastwin -> w_winrow
5129- + lastwin -> w_height + lastwin -> w_status_height );
5137+ + VISIBLE_HEIGHT (lastwin )
5138+ + lastwin -> w_status_height );
51305139 if (room_cmdline < 0 )
51315140 room_cmdline = 0 ;
51325141 }
@@ -5415,7 +5424,7 @@ win_setminheight(void)
54155424 /* TODO: handle vertical splits */
54165425 room = - p_wh ;
54175426 FOR_ALL_WINDOWS (wp )
5418- room += wp -> w_height - p_wmh ;
5427+ room += VISIBLE_HEIGHT ( wp ) - p_wmh ;
54195428 if (room >= 0 )
54205429 break ;
54215430 -- p_wmh ;
0 commit comments