patch 9.1.0742: getcmdprompt() implementation can be improved
Problem: getcmdprompt() implementation can be improved
Solution: Improve and simplify it (h-east)
closes: #15743
Signed-off-by: h-east <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 17717d2..708f211 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -1650,6 +1650,17 @@
call feedkeys(":call input('Answer?')\<CR>a\<CR>\<ESC>", "xt")
call assert_equal('Answer?', g:cmdprompt)
call assert_equal('', getcmdprompt())
+ call feedkeys(":\<CR>\<ESC>", "xt")
+ call assert_equal('', g:cmdprompt)
+ call assert_equal('', getcmdprompt())
+
+ let str = "C" .. repeat("c", 1023) .. "xyz"
+ call feedkeys(":call input('" .. str .. "')\<CR>\<CR>\<ESC>", "xt")
+ call assert_equal(str, g:cmdprompt)
+
+ call feedkeys(':call input("Msg1\nMessage2\nAns?")' .. "\<CR>b\<CR>\<ESC>", "xt")
+ call assert_equal('Ans?', g:cmdprompt)
+ call assert_equal('', getcmdprompt())
augroup test_CmdlineEnter
au!