From c2fb1fc700db28cb554be9da8e79443b5d3a5fe9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 24 Sep 2024 06:51:02 +0800 Subject: vim-patch:9.1.0741: No way to get prompt for input()/confirm() Problem: No way to get prompt for input()/confirm() Solution: add getcmdprompt() function (Shougo Matsushita) (Shougo Matsushita) closes: vim/vim#15667 https://github.com/vim/vim/commit/6908428560a0d6ae27bf7af6fcb6dc362e31926c Co-authored-by: Shougo Matsushita --- test/old/testdir/test_cmdline.vim | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index d00b5bbf46..ba71f4b785 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -1534,7 +1534,7 @@ endfunc set cpo& -func Test_getcmdtype() +func Test_getcmdtype_getcmdprompt() call feedkeys(":MyCmd a\=Check_cmdline(':')\\", "xt") let cmdtype = '' @@ -1558,6 +1558,20 @@ func Test_getcmdtype() cunmap call assert_equal('', getcmdline()) + + call assert_equal('', getcmdprompt()) + augroup test_CmdlineEnter + autocmd! + autocmd CmdlineEnter * let g:cmdprompt=getcmdprompt() + augroup END + call feedkeys(":call input('Answer?')\a\\", "xt") + call assert_equal('Answer?', g:cmdprompt) + call assert_equal('', getcmdprompt()) + + augroup test_CmdlineEnter + au! + augroup END + augroup! test_CmdlineEnter endfunc func Test_getcmdwintype() -- cgit From 65b6cd1b3a43024f6c2d9d6f31b8ae3a69dabb56 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 26 Sep 2024 22:15:54 +0800 Subject: vim-patch:9.1.0742: getcmdprompt() implementation can be improved Problem: getcmdprompt() implementation can be improved Solution: Improve and simplify it (h-east) closes: vim/vim#15743 https://github.com/vim/vim/commit/25876a6cdd439054d0b3f920ccca0a435481de15 Co-authored-by: h-east --- test/old/testdir/test_cmdline.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index ba71f4b785..d8a217fd05 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -1567,6 +1567,17 @@ func Test_getcmdtype_getcmdprompt() call feedkeys(":call input('Answer?')\a\\", "xt") call assert_equal('Answer?', g:cmdprompt) call assert_equal('', getcmdprompt()) + call feedkeys(":\\", "xt") + call assert_equal('', g:cmdprompt) + call assert_equal('', getcmdprompt()) + + let str = "C" .. repeat("c", 1023) .. "xyz" + call feedkeys(":call input('" .. str .. "')\\\", "xt") + call assert_equal(str, g:cmdprompt) + + call feedkeys(':call input("Msg1\nMessage2\nAns?")' .. "\b\\", "xt") + call assert_equal('Ans?', g:cmdprompt) + call assert_equal('', getcmdprompt()) augroup test_CmdlineEnter au! -- cgit