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

6908428560

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
This commit is contained in:
zeertzjq
2024-09-24 06:51:02 +08:00
parent 66197dde70
commit c2fb1fc700
7 changed files with 102 additions and 29 deletions

View File

@@ -1534,7 +1534,7 @@ endfunc
set cpo&
func Test_getcmdtype()
func Test_getcmdtype_getcmdprompt()
call feedkeys(":MyCmd a\<C-R>=Check_cmdline(':')\<CR>\<Esc>", "xt")
let cmdtype = ''
@@ -1558,6 +1558,20 @@ func Test_getcmdtype()
cunmap <F6>
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?')\<CR>a\<CR>\<ESC>", "xt")
call assert_equal('Answer?', g:cmdprompt)
call assert_equal('', getcmdprompt())
augroup test_CmdlineEnter
au!
augroup END
augroup! test_CmdlineEnter
endfunc
func Test_getcmdwintype()