comparison src/testdir/test_terminal.vim @ 13543:98d832e4e394 v8.0.1645

patch 8.0.1645: test for terminal response to escape sequence may fail commit https://github.com/vim/vim/commit/086eb876951aa0b0bee3de4ed0569bf4b70c6f31 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 25 21:24:12 2018 +0200 patch 8.0.1645: test for terminal response to escape sequence may fail Problem: Test for terminal response to escape sequence fails for some people. (toothpik) Solution: Run "cat" and let it echo the characters.
author Christian Brabandt <cb@256bit.org>
date Sun, 25 Mar 2018 21:30:07 +0200
parents 296d02b0637f
children 87a9c1be0ae3
comparison
equal deleted inserted replaced
13542:24d2938ab577 13543:98d832e4e394
831 if !has('unix') 831 if !has('unix')
832 return 832 return
833 endif 833 endif
834 834
835 let buf = Run_shell_in_terminal({}) 835 let buf = Run_shell_in_terminal({})
836 call WaitFor({-> term_getline(buf, 1) != ""}) 836 call WaitFor({-> term_getline(buf, 1) != ''})
837 837
838 call writefile(["\x1b[6n"], 'Xescape') 838 call term_sendkeys(buf, "cat\<CR>")
839 call term_sendkeys(buf, "cat Xescape\<cr>") 839 call WaitFor({-> term_getline(buf, 1) =~ 'cat'})
840 840
841 " wait for the response of control sequence from libvterm (and send it to tty) 841 " Request the cursor position.
842 sleep 200m 842 call term_sendkeys(buf, "\x1b[6n\<CR>")
843 call term_wait(buf)
844 843
845 " Wait for output from tty to display, below an empty line. 844 " Wait for output from tty to display, below an empty line.
846 " It should show \e3;1R, but only 1R may show up 845 call WaitFor({-> term_getline(buf, 4) =~ '3;1R'})
847 call assert_match('\<\d\+R', term_getline(buf, 3)) 846
848 847 " End "cat" gently.
849 call term_sendkeys(buf, "\<c-c>") 848 call term_sendkeys(buf, "\<CR>\<C-D>")
850 call term_wait(buf) 849
851 call Stop_shell_in_terminal(buf) 850 call Stop_shell_in_terminal(buf)
852
853 exe buf . 'bwipe' 851 exe buf . 'bwipe'
854 call delete('Xescape')
855 unlet g:job 852 unlet g:job
856 endfunc 853 endfunc
857 854
858 " Run Vim, start a terminal in that Vim with the kill argument, 855 " Run Vim, start a terminal in that Vim with the kill argument,
859 " :qall works. 856 " :qall works.