diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index f5e4c4b90c..0a198763bb 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -160,3 +160,30 @@ func Test_map_meta_quotes() set nomodified iunmap endfunc + +func Test_map_timeout() + nnoremap aaaa :let got_aaaa = 1 + nnoremap bb :let got_bb = 1 + nmap b aaa + new + func ExitInsert(timer) + let g:line = getline(1) + call feedkeys("\", "t") + endfunc + set timeout timeoutlen=200 + call 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. + call feedkeys("b", "xt!") + call assert_equal("aa", g:line) + call assert_false(exists('got_aaa')) + call assert_false(exists('got_bb')) + + bwipe! + nunmap aaaa + nunmap bb + nunmap b + set timeoutlen& + delfunc ExitInsert +endfunc