diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-04-15 22:25:54 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-04-15 22:25:54 +0200 |
commit | a7eef3d87fa36d527d1cfc749b400df1e69dcb3d (patch) | |
tree | 1551696e4b917369d011cfb30d67fc24688439e3 | |
parent | 802bfb14636b24d86d0ca8e0947d808b9b7c941e (diff) |
patch 8.0.1721: no test for using the 'termsize' optionv8.0.1721
Problem: No test for using the 'termsize' option.
Solution: Add a test.
-rw-r--r-- | src/testdir/screendump.vim | 7 | ||||
-rw-r--r-- | src/testdir/test_terminal.vim | 33 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 41 insertions, 1 deletions
diff --git a/src/testdir/screendump.vim b/src/testdir/screendump.vim index 9812e7e6de..af9e371488 100644 --- a/src/testdir/screendump.vim +++ b/src/testdir/screendump.vim @@ -57,7 +57,12 @@ func RunVimInTerminal(arguments, options) " Add -v to have gvim run in the terminal (if possible) let cmd .= ' -v ' . a:arguments let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols}) - call assert_equal([rows, cols], term_getsize(buf)) + if &termsize == '' + call assert_equal([rows, cols], term_getsize(buf)) + else + let rows = term_getsize(buf)[0] + let cols = term_getsize(buf)[1] + endif " Wait for "All" of the ruler in the status line to be shown. " This can be quite slow (e.g. when using valgrind). diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 5f330f7b19..eb22b0f0c9 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -1356,3 +1356,36 @@ func Test_terminal_ansicolors_func() call term_wait(buf) exe buf . 'bwipe' endfunc + +func Test_terminal_termsize_option() + if !CanRunVimInTerminal() + return + endif + set termsize=6x40 + let text = [] + for n in range(10) + call add(text, repeat(n, 50)) + endfor + call writefile(text, 'Xwinsize') + let buf = RunVimInTerminal('Xwinsize', {}) + let win = bufwinid(buf) + call assert_equal([6, 40], term_getsize(buf)) + call assert_equal(6, winheight(win)) + call assert_equal(40, winwidth(win)) + + " resizing the window doesn't resize the terminal. + resize 10 + vertical resize 60 + call assert_equal([6, 40], term_getsize(buf)) + call assert_equal(10, winheight(win)) + call assert_equal(60, winwidth(win)) + + call StopVimInTerminal(buf) + call delete('Xwinsize') + + call assert_fails('set termsize=40', 'E474') + call assert_fails('set termsize=10+40', 'E474') + call assert_fails('set termsize=abc', 'E474') + + set termsize= +endfunc diff --git a/src/version.c b/src/version.c index 2d28206981..851f050220 100644 --- a/src/version.c +++ b/src/version.c @@ -763,6 +763,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1721, +/**/ 1720, /**/ 1719, |