diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-28 21:18:58 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-04-29 15:51:04 +0800 |
commit | 4adf2123dd94a3d5303fe200c7e909067e1cda34 (patch) | |
tree | f6dcfba23c192f0e127fc53448556b4108d53614 /test | |
parent | 1d97781dc53416072387b1d71aeaf11caecd8cf0 (diff) | |
download | rneovim-4adf2123dd94a3d5303fe200c7e909067e1cda34.tar.gz rneovim-4adf2123dd94a3d5303fe200c7e909067e1cda34.tar.bz2 rneovim-4adf2123dd94a3d5303fe200c7e909067e1cda34.zip |
vim-patch:8.2.4837: modifiers not simplified when timed out
Problem: Modifiers not simplified when timed out or using feedkeys() with
'n" flag.
Solution: Adjust how mapped flag and timeout are used. (closes vim/vim#10305)
https://github.com/vim/vim/commit/68a573ce2b996602a86b14d9b258ebb8c657604f
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/options/pastetoggle_spec.lua | 73 |
1 files changed, 60 insertions, 13 deletions
diff --git a/test/functional/options/pastetoggle_spec.lua b/test/functional/options/pastetoggle_spec.lua index aaf30c54f4..40c14fa187 100644 --- a/test/functional/options/pastetoggle_spec.lua +++ b/test/functional/options/pastetoggle_spec.lua @@ -7,6 +7,7 @@ local eq = helpers.eq local expect = helpers.expect local eval = helpers.eval local insert = helpers.insert +local meths = helpers.meths local sleep = helpers.sleep describe("'pastetoggle' option", function() @@ -19,19 +20,65 @@ describe("'pastetoggle' option", function() feed('j') eq(1, eval('&paste')) end) - it("multiple key 'pastetoggle' is waited for", function() - eq(0, eval('&paste')) - local pastetoggle = 'lllll' - command('set pastetoggle=' .. pastetoggle) - command('set timeoutlen=1 ttimeoutlen=10000') - feed(pastetoggle:sub(0, 2)) - -- sleep() for long enough that vgetorpeek() is gotten into, but short - -- enough that ttimeoutlen is not reached. - sleep(200) - feed(pastetoggle:sub(3, -1)) - -- Need another key so that the vgetorpeek() function returns. - feed('j') - eq(1, eval('&paste')) + describe("multiple key 'pastetoggle'", function() + before_each(function() + eq(0, eval('&paste')) + command('set timeoutlen=1 ttimeoutlen=10000') + end) + it('is waited for when chars are typed', function() + local pastetoggle = 'lllll' + command('set pastetoggle=' .. pastetoggle) + feed(pastetoggle:sub(0, 2)) + -- sleep() for long enough that vgetorpeek() is gotten into, but short + -- enough that ttimeoutlen is not reached. + sleep(200) + feed(pastetoggle:sub(3, -1)) + -- Need another key so that the vgetorpeek() function returns. + feed('j') + eq(1, eval('&paste')) + end) + + it('is not waited for when there are no typed chars after mapped chars', function() + command('set pastetoggle=abc') + command('imap d a') + meths.feedkeys('id', 't', true) + -- sleep() for long enough that vgetorpeek() is gotten into, but short + -- enough that ttimeoutlen is not reached. + sleep(200) + feed('bc') + -- Need another key so that the vgetorpeek() function returns. + feed('j') + -- 'ttimeoutlen' should NOT apply + eq(0, eval('&paste')) + end) + + it('is waited for when there are typed chars after mapped chars', function() + command('set pastetoggle=abc') + command('imap d a') + meths.feedkeys('idb', 't', true) + -- sleep() for long enough that vgetorpeek() is gotten into, but short + -- enough that ttimeoutlen is not reached. + sleep(200) + feed('c') + -- Need another key so that the vgetorpeek() function returns. + feed('j') + -- 'ttimeoutlen' should apply + eq(1, eval('&paste')) + end) + + it('is waited for when there are typed chars after noremapped chars', function() + command('set pastetoggle=abc') + command('inoremap d a') + meths.feedkeys('idb', 't', true) + -- sleep() for long enough that vgetorpeek() is gotten into, but short + -- enough that ttimeoutlen is not reached. + sleep(200) + feed('c') + -- Need another key so that the vgetorpeek() function returns. + feed('j') + -- 'ttimeoutlen' should apply + eq(1, eval('&paste')) + end) end) it('does not interfere with character-find', function() insert('foo,bar') |