# HG changeset patch # User Bram Moolenaar # Date 1615830303 -3600 # Node ID 72e9b861bc92621935ce8c2f5dfb7e7627c075b0 # Parent e06b3799d91334f7cb30184b4f7f6d7487628236 patch 8.2.2608: character input not fully tested Commit: https://github.com/vim/vim/commit/f4fcedc59d4cc5ae6b5270a933e8377030283c1c Author: Bram Moolenaar Date: Mon Mar 15 18:36:20 2021 +0100 patch 8.2.2608: character input not fully tested Problem: Character input not fully tested. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/7963) diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -1430,6 +1430,14 @@ func Test_input_func() delfunc Tcomplete call assert_equal('item1 item2 item3', c) + " Test for using special characters as default input + call feedkeys(":let c = input('name? ', \"x\y\")\\", 'xt') + call assert_equal('y', c) + + " Test for using as default input + call feedkeys(":let c = input('name? ', \"\\\")\x\", 'xt') + call assert_equal(' x', c) + call assert_fails("call input('F:', '', 'invalid')", 'E180:') call assert_fails("call input('F:', '', [])", 'E730:') endfunc diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim --- a/src/testdir/test_messages.vim +++ b/src/testdir/test_messages.vim @@ -259,6 +259,17 @@ func Test_message_more() call term_sendkeys(buf, 'q') call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))}) + " Execute a : command from the more prompt + call term_sendkeys(buf, ":%p#\n") + call term_wait(buf) + call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))}) + call term_sendkeys(buf, ":") + call term_wait(buf) + call WaitForAssert({-> assert_equal(':', term_getline(buf, 6))}) + call term_sendkeys(buf, "echo 'Hello'\n") + call term_wait(buf) + call WaitForAssert({-> assert_equal('Hello ', term_getline(buf, 5))}) + call StopVimInTerminal(buf) endfunc diff --git a/src/testdir/test_paste.vim b/src/testdir/test_paste.vim --- a/src/testdir/test_paste.vim +++ b/src/testdir/test_paste.vim @@ -149,4 +149,18 @@ func Test_xrestore() bwipe! endfunc +" Test for 'pastetoggle' +func Test_pastetoggle() + new + set pastetoggle= + set nopaste + call feedkeys("iHello\", 'xt') + call assert_true(&paste) + call feedkeys("i\", 'xt') + call assert_false(&paste) + call assert_equal('Hello', getline(1)) + set pastetoggle& + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim --- a/src/testdir/test_registers.vim +++ b/src/testdir/test_registers.vim @@ -709,4 +709,14 @@ func Test_insert_small_delete() bwipe! endfunc +" Record in insert mode using CTRL-O +func Test_record_in_insert_mode() + new + let @r = '' + call setline(1, ['foo']) + call feedkeys("i\qrbaz\q", 'xt') + call assert_equal('baz', @r) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim --- a/src/testdir/test_undo.vim +++ b/src/testdir/test_undo.vim @@ -733,4 +733,18 @@ func Test_undofile_cryptmethod_blowfish2 set undofile& undolevels& cryptmethod& endfunc +" Test for redoing with incrementing numbered registers +func Test_redo_repeat_numbered_register() + new + for [i, v] in [[1, 'one'], [2, 'two'], [3, 'three'], + \ [4, 'four'], [5, 'five'], [6, 'six'], + \ [7, 'seven'], [8, 'eight'], [9, 'nine']] + exe 'let @' .. i .. '="' .. v .. '\n"' + endfor + call feedkeys('"1p.........', 'xt') + call assert_equal(['', 'one', 'two', 'three', 'four', 'five', 'six', + \ 'seven', 'eight', 'nine', 'nine'], getline(1, '$')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2608, +/**/ 2607, /**/ 2606,