summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-16 18:02:07 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-16 18:02:07 +0000
commit8103527da7f12ff21c2566222748518ee093432c (patch)
tree5840fd003b0c0eb5852dfa683ac058efa224dddc /src/testdir
parentf79cbf6512863c167bc794035df067e3a3e474f3 (diff)
downloadvim-git-8103527da7f12ff21c2566222748518ee093432c.tar.gz
patch 8.2.3828: when opening a terminal from a timer first typed char is lostv8.2.3828
Problem: when opening a terminal from a timer the first typed character is lost. (Virginia Senioria) Solution: When opening a terminal while waiting for a character put K_IGNORE in the input buffer.
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_terminal.vim26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 3dc7776a9..3fda75dfb 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1596,6 +1596,7 @@ endfunc
" 4. 0.5 sec later: should be done, clean up
func Test_terminal_statusline()
CheckUnix
+ CheckFeature timers
set statusline=x
terminal
@@ -1611,6 +1612,31 @@ func Test_terminal_statusline()
set statusline=
endfunc
+func CheckTerminalWindowWorks(buf)
+ call WaitForAssert({-> assert_match('!sh \[running\]', term_getline(a:buf, 10))})
+ call term_sendkeys(a:buf, "exit\<CR>")
+ call WaitForAssert({-> assert_match('!sh \[finished\]', term_getline(a:buf, 10))})
+ call term_sendkeys(a:buf, ":q\<CR>")
+ call WaitForAssert({-> assert_match('^\~', term_getline(a:buf, 10))})
+endfunc
+
+func Test_start_terminal_from_timer()
+ CheckUnix
+ CheckFeature timers
+
+ " Open a terminal window from a timer, typed text goes to the terminal
+ call writefile(["call timer_start(100, { -> term_start('sh') })"], 'XtimerTerm')
+ let buf = RunVimInTerminal('-S XtimerTerm', {})
+ call CheckTerminalWindowWorks(buf)
+
+ " do the same in Insert mode
+ call term_sendkeys(buf, ":call timer_start(200, { -> term_start('sh') })\<CR>a")
+ call CheckTerminalWindowWorks(buf)
+
+ call StopVimInTerminal(buf)
+ call delete('XtimerTerm')
+endfunc
+
func Test_terminal_window_focus()
let winid1 = win_getid()
terminal