Skip to content

Commit 39d4cab

Browse files
committed
patch 8.2.2560: setting 'winminheigt' does not take tabline into account
Problem: Setting 'winminheigt' does not take tabline into account. Solution: Subtract the tabline from the available height. (closes #7899)
1 parent 3650fd7 commit 39d4cab

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/testdir/test_options.vim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,26 @@ func Test_opt_winminheight()
10151015
set winheight&
10161016
endfunc
10171017

1018+
func Test_opt_winminheight_term()
1019+
CheckRunVimInTerminal
1020+
1021+
" The tabline should be taken into account.
1022+
let lines =<< trim END
1023+
set wmh=0 stal=2
1024+
below sp | wincmd _
1025+
below sp | wincmd _
1026+
below sp | wincmd _
1027+
below sp
1028+
END
1029+
call writefile(lines, 'Xwinminheight')
1030+
let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11})
1031+
call term_sendkeys(buf, ":set wmh=1\n")
1032+
call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))})
1033+
1034+
call StopVimInTerminal(buf)
1035+
call delete('Xwinminheight')
1036+
endfunc
1037+
10181038
" Test for the 'winminwidth' option
10191039
func Test_opt_winminwidth()
10201040
only!

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+
2560,
753755
/**/
754756
2559,
755757
/**/

src/window.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5860,7 +5860,7 @@ win_setminheight(void)
58605860
// loop until there is a 'winminheight' that is possible
58615861
while (p_wmh > 0)
58625862
{
5863-
room = Rows - p_ch;
5863+
room = Rows - p_ch - tabline_height();
58645864
needed = frame_minheight(topframe, NULL);
58655865
if (room >= needed)
58665866
break;

0 commit comments

Comments
 (0)