Mercurial > vim
diff src/testdir/test_terminal.vim @ 15826:1f2edc01e7ed v8.1.0920
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
commit https://github.com/vim/vim/commit/29ae223ddcfcbbce46c7e1f4e8fa71b8f2674271
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Feb 14 21:22:01 2019 +0100
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Problem: In Terminal-Normal mode job output messes up the window.
Solution: Postpone scrolling and updating the buffer when in Terminal-Normal
mode.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 14 Feb 2019 21:30:05 +0100 |
parents | a3e2e7948ee4 |
children | 8f112782a2e9 |
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -299,6 +299,44 @@ func Test_terminal_scrollback() call term_wait(buf) exe buf . 'bwipe' set termwinscroll& + call delete('Xtext') +endfunc + +func Test_terminal_postponed_scrollback() + if !has('unix') + " tail -f only works on Unix + return + endif + + call writefile(range(50), 'Xtext') + call writefile([ + \ 'terminal', + \ 'call feedkeys("tail -n 100 -f Xtext\<CR>", "xt")', + \ 'sleep 100m', + \ 'call feedkeys("\<C-W>N", "xt")', + \ ], 'XTest_postponed') + let buf = RunVimInTerminal('-S XTest_postponed', {}) + " Check that the Xtext lines are displayed and in Terminal-Normal mode + call VerifyScreenDump(buf, 'Test_terminal_01', {}) + + silent !echo 'one more line' >>Xtext + " Sceen will not change, move cursor to get a different dump + call term_sendkeys(buf, "k") + call VerifyScreenDump(buf, 'Test_terminal_02', {}) + + " Back to Terminal-Job mode, text will scroll and show the extra line. + call term_sendkeys(buf, "a") + call VerifyScreenDump(buf, 'Test_terminal_03', {}) + + call term_wait(buf) + call term_sendkeys(buf, "\<C-C>") + call term_wait(buf) + call term_sendkeys(buf, "exit\<CR>") + call term_wait(buf) + call term_sendkeys(buf, ":q\<CR>") + call StopVimInTerminal(buf) + call delete('XTest_postponed') + call delete('Xtext') endfunc func Test_terminal_size() @@ -1512,6 +1550,8 @@ func Test_terminal_termwinkey() let job = term_getjob(buf) call feedkeys("\<C-L>\<C-C>", 'tx') call WaitForAssert({-> assert_equal("dead", job_status(job))}) + + set termwinkey& endfunc func Test_terminal_out_err()