Skip to content

Commit

Permalink
patch 8.0.1645: test for terminal response to escape sequence may fail
Browse files Browse the repository at this point in the history
Problem:    Test for terminal response to escape sequence fails for some
            people. (toothpik)
Solution:   Run "cat" and let it echo the characters.
  • Loading branch information
brammool committed Mar 25, 2018
1 parent cf67a50 commit 086eb87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/testdir/test_terminal.vim
Original file line number Diff line number Diff line change
Expand Up @@ -833,25 +833,22 @@ func Test_terminal_response_to_control_sequence()
endif

let buf = Run_shell_in_terminal({})
call WaitFor({-> term_getline(buf, 1) != ""})
call WaitFor({-> term_getline(buf, 1) != ''})

call writefile(["\x1b[6n"], 'Xescape')
call term_sendkeys(buf, "cat Xescape\<cr>")
call term_sendkeys(buf, "cat\<CR>")
call WaitFor({-> term_getline(buf, 1) =~ 'cat'})

" wait for the response of control sequence from libvterm (and send it to tty)
sleep 200m
call term_wait(buf)
" Request the cursor position.
call term_sendkeys(buf, "\x1b[6n\<CR>")

" Wait for output from tty to display, below an empty line.
" It should show \e3;1R, but only 1R may show up
call assert_match('\<\d\+R', term_getline(buf, 3))
call WaitFor({-> term_getline(buf, 4) =~ '3;1R'})

call term_sendkeys(buf, "\<c-c>")
call term_wait(buf)
call Stop_shell_in_terminal(buf)
" End "cat" gently.
call term_sendkeys(buf, "\<CR>\<C-D>")

call Stop_shell_in_terminal(buf)
exe buf . 'bwipe'
call delete('Xescape')
unlet g:job
endfunc

Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1645,
/**/
1644,
/**/
Expand Down

0 comments on commit 086eb87

Please sign in to comment.