Skip to content

Commit ae0f151

Browse files
committed
patch 8.2.2679: status line missing for non-current window with winbar
Problem: Winbar drawn over status line for non-current window with winbar if frame is zero height. (Leonid V. Fedorenchik) Solution: Do not draw the window if the frame height is zero. (closes #8037)
1 parent 82820d9 commit ae0f151

File tree

4 files changed

+57
-6
lines changed

4 files changed

+57
-6
lines changed

src/drawscreen.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,20 @@ update_screen(int type_arg)
377377
return OK;
378378
}
379379

380+
/*
381+
* Return the row for drawing the statusline and the ruler of window "wp".
382+
*/
383+
static int
384+
statusline_row(win_T *wp)
385+
{
386+
#if defined(FEAT_PROP_POPUP)
387+
// If the window is really zero height the winbar isn't displayed.
388+
if (wp->w_frame->fr_height == wp->w_status_height && !popup_is_popup(wp))
389+
return wp->w_winrow;
390+
#endif
391+
return W_WINROW(wp) + wp->w_height;
392+
}
393+
380394
/*
381395
* Redraw the status line of window wp.
382396
*
@@ -401,6 +415,8 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
401415
return;
402416
busy = TRUE;
403417

418+
row = statusline_row(wp);
419+
404420
wp->w_redr_status = FALSE;
405421
if (wp->w_status_height == 0)
406422
{
@@ -500,7 +516,6 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
500516
len = this_ru_col - 1;
501517
}
502518

503-
row = W_WINROW(wp) + wp->w_height;
504519
screen_puts(p, row, wp->w_wincol, attr);
505520
screen_fill(row, row + 1, len + wp->w_wincol,
506521
this_ru_col + wp->w_wincol, fillchar, fillchar, attr);
@@ -524,8 +539,7 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
524539
fillchar = fillchar_status(&attr, wp);
525540
else
526541
fillchar = fillchar_vsep(&attr);
527-
screen_putchar(fillchar, W_WINROW(wp) + wp->w_height, W_ENDCOL(wp),
528-
attr);
542+
screen_putchar(fillchar, row, W_ENDCOL(wp), attr);
529543
}
530544
busy = FALSE;
531545
}
@@ -680,7 +694,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
680694
cursor_off();
681695
if (wp->w_status_height)
682696
{
683-
row = W_WINROW(wp) + wp->w_height;
697+
row = statusline_row(wp);
684698
fillchar = fillchar_status(&attr, wp);
685699
off = wp->w_wincol;
686700
width = wp->w_width;
@@ -1468,8 +1482,13 @@ win_update(win_T *wp)
14681482
wp->w_lines_valid = 0;
14691483
}
14701484

1471-
// Window is zero-height: nothing to draw.
1472-
if (wp->w_height + WINBAR_HEIGHT(wp) == 0)
1485+
// Window frame is zero-height: nothing to draw.
1486+
if (wp->w_height + WINBAR_HEIGHT(wp) == 0
1487+
|| (wp->w_frame->fr_height == wp->w_status_height
1488+
#if defined(FEAT_PROP_POPUP)
1489+
&& !popup_is_popup(wp)
1490+
#endif
1491+
))
14731492
{
14741493
wp->w_redr_type = 0;
14751494
return;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
|[+1&#ffffff0|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
2+
> +0&&@74
3+
|~+0#4040ff13&| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|~| @73
8+
|~| @73
9+
|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
10+
| +0&&@74

src/testdir/test_winbar.vim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ source check.vim
44
CheckFeature menu
55

66
source shared.vim
7+
source screendump.vim
78

89
func Test_add_remove_menu()
910
new
@@ -121,4 +122,23 @@ func Test_redraw_after_scroll()
121122
bwipe!
122123
endfunc
123124

125+
func Test_winbar_not_visible()
126+
CheckScreendump
127+
128+
let lines =<< trim END
129+
split
130+
nnoremenu WinBar.Test :test
131+
set winminheight=0
132+
wincmd j
133+
wincmd _
134+
END
135+
call writefile(lines, 'XtestWinbarNotVisble')
136+
let buf = RunVimInTerminal('-S XtestWinbarNotVisble', #{rows: 10})
137+
call VerifyScreenDump(buf, 'Test_winbar_not_visible', {})
138+
139+
" clean up
140+
call StopVimInTerminal(buf)
141+
call delete('XtestWinbarNotVisble')
142+
endfunction
143+
124144
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

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

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2679,
753755
/**/
754756
2678,
755757
/**/

0 commit comments

Comments
 (0)