diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-29 16:21:25 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-29 16:21:25 +0100 |
commit | 54acb90d9e672315e3bd13f8dc71f828df97c868 (patch) | |
tree | a6ace12d6378c530d8341c69a30ccf2c76a69c45 /src/testdir | |
parent | d5c8f11905abc1bdf3b8864dbc40187855ed9374 (diff) |
patch 9.0.0320: command line type of CmdlineChange differs from getcmdtype()v9.0.0320
Problem: Command line type of CmdlineChange differs from getcmdtype().
Solution: Use the same type. (closes #11005)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_cmdline.vim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index 81f0c6f0eb..f349ae49ed 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -3264,9 +3264,13 @@ endfunc func Test_setcmdline() func SetText(text, pos) + autocmd CmdlineChanged * let g:cmdtype = expand('<afile>') call assert_equal(0, setcmdline(a:text)) call assert_equal(a:text, getcmdline()) call assert_equal(len(a:text) + 1, getcmdpos()) + call assert_equal(getcmdtype(), g:cmdtype) + unlet g:cmdtype + autocmd! CmdlineChanged call assert_equal(0, setcmdline(a:text, a:pos)) call assert_equal(a:text, getcmdline()) @@ -3282,6 +3286,13 @@ func Test_setcmdline() call feedkeys(":\<C-R>=SetText('set rtp?', 2)\<CR>\<CR>", 'xt') call assert_equal('set rtp?', @:) + call feedkeys(":let g:str = input('? ')\<CR>", 't') + call feedkeys("\<C-R>=SetText('foo', 4)\<CR>\<CR>", 'xt') + call assert_equal('foo', g:str) + unlet g:str + + delfunc SetText + " setcmdline() returns 1 when not editing the command line. call assert_equal(1, 'foo'->setcmdline()) @@ -3294,6 +3305,8 @@ func Test_setcmdline() com! -nargs=* -complete=custom,CustomComplete DoCmd : call feedkeys(":DoCmd \<C-A>\<C-B>\"\<CR>", 'tx') call assert_equal('"DoCmd January February Mars', @:) + delcom DoCmd + delfunc CustomComplete " Called in <expr> cnoremap <expr>a setcmdline('let foo=') |