To: vim_dev@googlegroups.com Subject: Patch 8.0.1721 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1721 Problem: No test for using the 'termsize' option. Solution: Add a test. Files: src/testdir/screendump.vim, src/testdir/test_terminal.vim *** ../vim-8.0.1720/src/testdir/screendump.vim 2018-04-11 20:53:45.765218228 +0200 --- src/testdir/screendump.vim 2018-04-15 22:17:49.700069740 +0200 *************** *** 57,63 **** " 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)) " Wait for "All" of the ruler in the status line to be shown. " This can be quite slow (e.g. when using valgrind). --- 57,68 ---- " 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}) ! 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). *** ../vim-8.0.1720/src/testdir/test_terminal.vim 2018-04-15 13:28:37.853603647 +0200 --- src/testdir/test_terminal.vim 2018-04-15 22:22:47.086026684 +0200 *************** *** 1356,1358 **** --- 1356,1391 ---- 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 *** ../vim-8.0.1720/src/version.c 2018-04-15 17:28:09.261690083 +0200 --- src/version.c 2018-04-15 22:19:20.495446799 +0200 *************** *** 764,765 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1721, /**/ -- hundred-and-one symptoms of being an internet addict: 190. You quickly hand over your wallet, leather jacket, and car keys during a mugging, then proceed to beat the crap out of your assailant when he asks for your laptop. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///