Mercurial > vim
diff src/testdir/test_cmdline.vim @ 29964:444dd4cc49d6 v9.0.0320
patch 9.0.0320: command line type of CmdlineChange differs from getcmdtype()
Commit: https://github.com/vim/vim/commit/54acb90d9e672315e3bd13f8dc71f828df97c868
Author: zeertzjq <zeertzjq@outlook.com>
Date: Mon Aug 29 16:21:25 2022 +0100
patch 9.0.0320: command line type of CmdlineChange differs from getcmdtype()
Problem: Command line type of CmdlineChange differs from getcmdtype().
Solution: Use the same type. (closes https://github.com/vim/vim/issues/11005)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 29 Aug 2022 17:30:03 +0200 |
parents | b366b19d1a3e |
children | d891115c0aea |
line wrap: on
line diff
--- 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=')