From b936b79424d435b83cdebed5507a9d3800e66e6c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 4 Sep 2020 18:34:09 +0200 Subject: patch 8.2.1589: term_start() options for size are overruled by 'termwinsize' Problem: Term_start() options for size are overruled by 'termwinsize'. (Sergey Vlasov) Solution: Set 'termwinsize' to the specified size. --- src/testdir/test_terminal2.vim | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/testdir/test_terminal2.vim') diff --git a/src/testdir/test_terminal2.vim b/src/testdir/test_terminal2.vim index 93ace42d8..f9f221b5c 100644 --- a/src/testdir/test_terminal2.vim +++ b/src/testdir/test_terminal2.vim @@ -109,6 +109,27 @@ func Test_terminal_termwinsize_minimum() set termwinsize= endfunc +func Test_terminal_termwinsize_overruled() + let cmd = GetDummyCmd() + set termwinsize=5x43 + let buf = term_start(cmd, #{term_rows: 7, term_cols: 50}) + call TermWait(buf) + call assert_equal([7, 50], term_getsize(buf)) + exe "bwipe! " .. buf + + let buf = term_start(cmd, #{term_cols: 50}) + call TermWait(buf) + call assert_equal([5, 50], term_getsize(buf)) + exe "bwipe! " .. buf + + let buf = term_start(cmd, #{term_rows: 7}) + call TermWait(buf) + call assert_equal([7, 43], term_getsize(buf)) + exe "bwipe! " .. buf + + set termwinsize= +endfunc + func Test_terminal_termwinkey() " make three tabpages, terminal in the middle 0tabnew @@ -397,13 +418,17 @@ func Test_terminal_does_not_truncate_last_newlines() call delete('Xfile') endfunc -func Test_terminal_no_job() +func GetDummyCmd() if has('win32') - let cmd = 'cmd /c ""' + return 'cmd /c ""' else CheckExecutable false - let cmd = 'false' + return 'false' endif +endfunc + +func Test_terminal_no_job() + let cmd = GetDummyCmd() let term = term_start(cmd, {'term_finish': 'close'}) call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) }) endfunc -- cgit v1.2.1