Skip to content

Commit a7eef3d

Browse files
committed
patch 8.0.1721: no test for using the 'termsize' option
Problem: No test for using the 'termsize' option. Solution: Add a test.
1 parent 802bfb1 commit a7eef3d

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

src/testdir/screendump.vim

+6-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ func RunVimInTerminal(arguments, options)
5757
" Add -v to have gvim run in the terminal (if possible)
5858
let cmd .= ' -v ' . a:arguments
5959
let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols})
60-
call assert_equal([rows, cols], term_getsize(buf))
60+
if &termsize == ''
61+
call assert_equal([rows, cols], term_getsize(buf))
62+
else
63+
let rows = term_getsize(buf)[0]
64+
let cols = term_getsize(buf)[1]
65+
endif
6166

6267
" Wait for "All" of the ruler in the status line to be shown.
6368
" This can be quite slow (e.g. when using valgrind).

src/testdir/test_terminal.vim

+33
Original file line numberDiff line numberDiff line change
@@ -1356,3 +1356,36 @@ func Test_terminal_ansicolors_func()
13561356
call term_wait(buf)
13571357
exe buf . 'bwipe'
13581358
endfunc
1359+
1360+
func Test_terminal_termsize_option()
1361+
if !CanRunVimInTerminal()
1362+
return
1363+
endif
1364+
set termsize=6x40
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

src/version.c

+2
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ static char *(features[]) =
762762

763763
static int included_patches[] =
764764
{ /* Add new patch number below this line */
765+
/**/
766+
1721,
765767
/**/
766768
1720,
767769
/**/

0 commit comments

Comments
 (0)