diff options
author | ii14 <59243201+ii14@users.noreply.github.com> | 2023-03-13 03:29:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-13 10:29:11 +0800 |
commit | 2daf0b37dbfe54a4510c1033531dbaefd168c387 (patch) | |
tree | 8f0c1f7ea449f6d38817398244852e458bcc79cd /test | |
parent | 673d2b52fa4335aa083c52e6686f0728e25b8ebd (diff) | |
download | rneovim-2daf0b37dbfe54a4510c1033531dbaefd168c387.tar.gz rneovim-2daf0b37dbfe54a4510c1033531dbaefd168c387.tar.bz2 rneovim-2daf0b37dbfe54a4510c1033531dbaefd168c387.zip |
feat(options)!: deprecate paste, remove pastetoggle (#22647)
we cannot remove 'paste'. It is very common in plugins and configs.
'pastetoggle' can and should be removed though, it's a total waste of everyone's time because it generates bug reports and doesn't work well, and is useless because bracketed-paste works better.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/options/pastetoggle_spec.lua | 90 | ||||
-rw-r--r-- | test/old/testdir/test_mksession.vim | 7 | ||||
-rw-r--r-- | test/old/testdir/test_options.vim | 1 | ||||
-rw-r--r-- | test/old/testdir/test_paste.vim | 17 |
4 files changed, 5 insertions, 110 deletions
diff --git a/test/functional/options/pastetoggle_spec.lua b/test/functional/options/pastetoggle_spec.lua deleted file mode 100644 index 40c14fa187..0000000000 --- a/test/functional/options/pastetoggle_spec.lua +++ /dev/null @@ -1,90 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local feed = helpers.feed -local command = helpers.command -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() - before_each(clear) - it("toggles 'paste'", function() - command('set pastetoggle=a') - eq(0, eval('&paste')) - feed('a') - -- Need another key so that the vgetorpeek() function returns. - feed('j') - eq(1, eval('&paste')) - end) - 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') - feed('0') - command('set pastetoggle=,sp') - feed('dt,') - expect(',bar') - end) -end) diff --git a/test/old/testdir/test_mksession.vim b/test/old/testdir/test_mksession.vim index 972397cb91..f60d89faae 100644 --- a/test/old/testdir/test_mksession.vim +++ b/test/old/testdir/test_mksession.vim @@ -943,15 +943,16 @@ func Test_mkvimrc() " the 'pastetoggle', 'wildchar' and 'wildcharm' option values should be " stored as key names in the vimrc file - set pastetoggle=<F5> + " set pastetoggle=<F5> set wildchar=<F6> set wildcharm=<F7> call assert_fails('mkvimrc Xtestvimrc') mkvimrc! Xtestvimrc - call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set pastetoggle=<F5>')) + " call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set pastetoggle=<F5>')) call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set wildchar=<F6>')) call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set wildcharm=<F7>')) - set pastetoggle& wildchar& wildcharm& + " set pastetoggle& wildchar& wildcharm& + set wildchar& wildcharm& call delete('Xtestvimrc') endfunc diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index b6b982e92e..d18802adc1 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -49,6 +49,7 @@ endfunc " Test for getting the value of 'pastetoggle' func Test_pastetoggle() + throw "Skipped: 'pastetoggle' is removed from Nvim" " character with K_SPECIAL byte let &pastetoggle = '…' call assert_equal('…', &pastetoggle) diff --git a/test/old/testdir/test_paste.vim b/test/old/testdir/test_paste.vim index 923f4f42a6..9ed3adca9b 100644 --- a/test/old/testdir/test_paste.vim +++ b/test/old/testdir/test_paste.vim @@ -1,21 +1,4 @@ -" Test for 'pastetoggle' -func Test_pastetoggle() - new - set pastetoggle=<F4> - set nopaste - call feedkeys("iHello\<F4>", 'xt') - call assert_true(&paste) - call feedkeys("i\<F4>", 'xt') - call assert_false(&paste) - call assert_equal('Hello', getline(1)) - " command-line completion for 'pastetoggle' value - call feedkeys(":set pastetoggle=\<Tab>\<C-B>\"\<CR>", 'xt') - call assert_equal('"set pastetoggle=<F4>', @:) - set pastetoggle& - bwipe! -endfunc - " Test for restoring option values when 'paste' is disabled func Test_paste_opt_restore() set autoindent expandtab ruler showmatch |