test: revert test and doc changes from #6724, add a test for #6716

Multi-char 'pastetoggle' now works without breaking character-find.
This commit is contained in:
zeertzjq 2022-04-27 18:24:42 +08:00
parent 9660ddd512
commit 3090648584
2 changed files with 23 additions and 21 deletions

View File

@ -4483,8 +4483,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that typing <F10> in paste mode inserts "<F10>", since in paste
mode everything is inserted literally, except the 'pastetoggle' key
sequence.
No timeout is used, this means that a multi-key 'pastetoggle' can not
be triggered manually.
When the value has several bytes 'ttimeoutlen' applies.
*'pex'* *'patchexpr'*
'patchexpr' 'pex' string (default "")

View File

@ -4,16 +4,13 @@ local clear = helpers.clear
local feed = helpers.feed
local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local sleep = helpers.sleep
local expect = helpers.expect
local eval = helpers.eval
local insert = helpers.insert
local sleep = helpers.sleep
describe("'pastetoggle' option", function()
before_each(function()
clear()
command('set nopaste')
end)
before_each(clear)
it("toggles 'paste'", function()
command('set pastetoggle=a')
eq(0, eval('&paste'))
@ -22,19 +19,25 @@ describe("'pastetoggle' option", function()
feed('j')
eq(1, eval('&paste'))
end)
it('does not wait for timeout', function()
command('set pastetoggle=abc')
command('set ttimeoutlen=9999999')
it("multiple key 'pastetoggle' is waited for", function()
eq(0, eval('&paste'))
-- n.b. need <esc> to return from vgetorpeek()
feed('abc<esc>')
eq(1, eval('&paste'))
feed('ab')
sleep(10)
feed('c<esc>')
expect('bc')
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'))
end)
it('does not interfere with character-find', function()
insert('foo,bar')
feed('0')
command('set pastetoggle=,sp')
feed('dt,')
expect(',bar')
end)
end)