@@ -1356,3 +1356,36 @@ func Test_terminal_ansicolors_func()
1356
1356
call term_wait (buf )
1357
1357
exe buf . ' bwipe'
1358
1358
endfunc
1359
+
1360
+ func Test_terminal_termsize_option ()
1361
+ if ! CanRunVimInTerminal ()
1362
+ return
1363
+ endif
1364
+ set termsize= 6 x40
1365
+ let text = []
1366
+ for n in range (10 )
1367
+ call add (text, repeat (n , 50 ))
1368
+ endfor
1369
+ call writefile (text, ' Xwinsize' )
1370
+ let buf = RunVimInTerminal (' Xwinsize' , {})
1371
+ let win = bufwinid (buf )
1372
+ call assert_equal ([6 , 40 ], term_getsize (buf ))
1373
+ call assert_equal (6 , winheight (win ))
1374
+ call assert_equal (40 , winwidth (win ))
1375
+
1376
+ " resizing the window doesn't resize the terminal.
1377
+ resize 10
1378
+ vertical resize 60
1379
+ call assert_equal ([6 , 40 ], term_getsize (buf ))
1380
+ call assert_equal (10 , winheight (win ))
1381
+ call assert_equal (60 , winwidth (win ))
1382
+
1383
+ call StopVimInTerminal (buf )
1384
+ call delete (' Xwinsize' )
1385
+
1386
+ call assert_fails (' set termsize=40' , ' E474' )
1387
+ call assert_fails (' set termsize=10+40' , ' E474' )
1388
+ call assert_fails (' set termsize=abc' , ' E474' )
1389
+
1390
+ set termsize=
1391
+ endfunc
0 commit comments