aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_mapping.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-04-27 14:27:55 +0200
committerGitHub <noreply@github.com>2019-04-27 14:27:55 +0200
commite5b53381a27861578498dab3ab9ba7b989677787 (patch)
treeb8cd55c7d9010aed7627dc85918d2b21efdc5d31 /src/nvim/testdir/test_mapping.vim
parent9d77a0768697aced470c72ba71d0e04cf45f0fd0 (diff)
parent16cc3cf9eb7e9b2caefc77311fb3e14743102418 (diff)
downloadrneovim-e5b53381a27861578498dab3ab9ba7b989677787.tar.gz
rneovim-e5b53381a27861578498dab3ab9ba7b989677787.tar.bz2
rneovim-e5b53381a27861578498dab3ab9ba7b989677787.zip
Merge #9942 from janlazo/vim-8.1.0837
vim-patch:8.1.{837,1180,1194,1203,1207,1209}
Diffstat (limited to 'src/nvim/testdir/test_mapping.vim')
-rw-r--r--src/nvim/testdir/test_mapping.vim40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim
index 32593a423a..67f07ff6de 100644
--- a/src/nvim/testdir/test_mapping.vim
+++ b/src/nvim/testdir/test_mapping.vim
@@ -4,6 +4,8 @@ if !has('multi_byte')
finish
endif
+source shared.vim
+
func Test_abbreviation()
" abbreviation with 0x80 should work
inoreab чкпр vim
@@ -173,6 +175,9 @@ func Test_abbr_after_line_join()
endfunc
func Test_map_timeout()
+ if !has('timers')
+ return
+ endif
nnoremap aaaa :let got_aaaa = 1<CR>
nnoremap bb :let got_bb = 1<CR>
nmap b aaa
@@ -182,7 +187,7 @@ func Test_map_timeout()
call feedkeys("\<Esc>", "t")
endfunc
set timeout timeoutlen=200
- call timer_start(300, 'ExitInsert')
+ let timer = timer_start(300, 'ExitInsert')
" After the 'b' Vim waits for another character to see if it matches 'bb'.
" When it times out it is expanded to "aaa", but there is no wait for
" "aaaa". Can't check that reliably though.
@@ -197,6 +202,39 @@ func Test_map_timeout()
nunmap b
set timeoutlen&
delfunc ExitInsert
+ call timer_stop(timer)
+endfunc
+
+func Test_map_timeout_with_timer_interrupt()
+ if !has('job') || !has('timers')
+ return
+ endif
+
+ " Confirm the timer invoked in exit_cb of the job doesn't disturb mapped key
+ " sequence.
+ new
+ let g:val = 0
+ nnoremap \12 :let g:val = 1<CR>
+ nnoremap \123 :let g:val = 2<CR>
+ set timeout timeoutlen=1000
+
+ func ExitCb(job, status)
+ let g:timer = timer_start(1, {_ -> feedkeys("3\<Esc>", 't')})
+ endfunc
+
+ call job_start([&shell, &shellcmdflag, 'echo'], {'exit_cb': 'ExitCb'})
+ call feedkeys('\12', 'xt!')
+ call assert_equal(2, g:val)
+
+ bwipe!
+ nunmap \12
+ nunmap \123
+ set timeoutlen&
+ call WaitFor({-> exists('g:timer')})
+ call timer_stop(g:timer)
+ unlet g:timer
+ unlet g:val
+ delfunc ExitCb
endfunc
func Test_cabbr_visual_mode()