]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.1721: no test for using the 'termsize' option v8.0.1721
authorBram Moolenaar <Bram@vim.org>
Sun, 15 Apr 2018 20:25:54 +0000 (22:25 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 15 Apr 2018 20:25:54 +0000 (22:25 +0200)
Problem:    No test for using the 'termsize' option.
Solution:   Add a test.

src/testdir/screendump.vim
src/testdir/test_terminal.vim
src/version.c

index 9812e7e6de337d18ce1300b259988de067fe9cd3..af9e371488c1d5e767af6213787c00383d3d71a8 100644 (file)
@@ -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).
index 5f330f7b19596f54cdfc2111b1bd35c5dfe63465..eb22b0f0c9791e6fe231ab9d0a3248a0421db624 100644 (file)
@@ -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
index 2d28206981461446b566a8f10437d68b8c39a8ed..851f0502208298ebd4cac3e5e8f33f93d5023be1 100644 (file)
@@ -762,6 +762,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1721,
 /**/
     1720,
 /**/