Skip to content

Commit eba13e4

Browse files
committed
patch 8.2.2545: errors and crash when terminal window is zero height
Problem: Errors and crash when terminal window is zero height. (Leonid V. Fedorenchik) Solution: Do not resize when width or height is zero. (closes #7890)
1 parent bc327cc commit eba13e4

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/terminal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3800,6 +3800,11 @@ term_update_window(win_T *wp)
38003800
newrows = rows == 0 ? newrows : minsize ? MAX(rows, newrows) : rows;
38013801
newcols = cols == 0 ? newcols : minsize ? MAX(cols, newcols) : cols;
38023802

3803+
// If no cell is visible there is no point in resizing. Also, vterm can't
3804+
// handle a zero height.
3805+
if (newrows == 0 || newcols == 0)
3806+
return;
3807+
38033808
if (term->tl_rows != newrows || term->tl_cols != newcols)
38043809
{
38053810
term->tl_vterm_size_changed = TRUE;

src/testdir/test_terminal.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,19 @@ func Test_terminal_size()
470470
call delete('Xtext')
471471
endfunc
472472

473+
func Test_terminal_zero_height()
474+
split
475+
wincmd j
476+
anoremenu 1.1 WinBar.test :
477+
terminal ++curwin
478+
wincmd k
479+
wincmd _
480+
redraw
481+
482+
call term_sendkeys(bufnr(), "exit\r")
483+
bwipe!
484+
endfunc
485+
473486
func Test_terminal_curwin()
474487
let cmd = Get_cat_123_cmd()
475488
call assert_equal(1, winnr('$'))

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+
2545,
753755
/**/
754756
2544,
755757
/**/

0 commit comments

Comments
 (0)