patch 8.1.1984: more functions can be used as methods
Problem: More functions can be used as methods.
Solution: Make various functions usable as a method.
diff --git a/src/testdir/test_prompt_buffer.vim b/src/testdir/test_prompt_buffer.vim
index 028f337..199c1c2 100644
--- a/src/testdir/test_prompt_buffer.vim
+++ b/src/testdir/test_prompt_buffer.vim
@@ -48,6 +48,7 @@
\ 'new',
\ 'set buftype=prompt',
\ 'call prompt_setcallback(bufnr(""), function("TextEntered"))',
+ \ 'eval bufnr("")->prompt_setprompt("cmd: ")',
\ 'startinsert',
\ ], a:name)
endfunc
@@ -60,10 +61,10 @@
call WriteScript(scriptName)
let buf = RunVimInTerminal('-S ' . scriptName, {})
- call WaitForAssert({-> assert_equal('%', term_getline(buf, 1))})
+ call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))})
call term_sendkeys(buf, "hello\<CR>")
- call WaitForAssert({-> assert_equal('% hello', term_getline(buf, 1))})
+ call WaitForAssert({-> assert_equal('cmd: hello', term_getline(buf, 1))})
call WaitForAssert({-> assert_equal('Command: "hello"', term_getline(buf, 2))})
call WaitForAssert({-> assert_equal('Result: "hello"', term_getline(buf, 3))})
@@ -82,19 +83,19 @@
call WriteScript(scriptName)
let buf = RunVimInTerminal('-S ' . scriptName, {})
- call WaitForAssert({-> assert_equal('%', term_getline(buf, 1))})
+ call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))})
let bs = "\<BS>"
call term_sendkeys(buf, "hello" . bs . bs)
- call WaitForAssert({-> assert_equal('% hel', term_getline(buf, 1))})
+ call WaitForAssert({-> assert_equal('cmd: hel', term_getline(buf, 1))})
let left = "\<Left>"
call term_sendkeys(buf, left . left . left . bs . '-')
- call WaitForAssert({-> assert_equal('% -hel', term_getline(buf, 1))})
+ call WaitForAssert({-> assert_equal('cmd: -hel', term_getline(buf, 1))})
let end = "\<End>"
call term_sendkeys(buf, end . "x")
- call WaitForAssert({-> assert_equal('% -helx', term_getline(buf, 1))})
+ call WaitForAssert({-> assert_equal('cmd: -helx', term_getline(buf, 1))})
call term_sendkeys(buf, "\<C-U>exit\<CR>")
call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))})
@@ -113,8 +114,8 @@
new
set buftype=prompt
- call prompt_setcallback(bufnr(''), function('MyPromptCallback', [{}]))
- call prompt_setinterrupt(bufnr(''), function('MyPromptInterrupt', [{}]))
+ eval bufnr('')->prompt_setcallback(function('MyPromptCallback', [{}]))
+ eval bufnr('')->prompt_setinterrupt(function('MyPromptInterrupt', [{}]))
call test_garbagecollect_now()
" Must not crash
call feedkeys("\<CR>\<C-C>", 'xt')