mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(eval/method): add missing method support for existing built-ins
These functions were ported with the vim-patch token, but didn't actually port the method call support that was in their patches (method call syntax wasn't ported yet). Add the missing method call support and latest docs for: - assert_nobeep:5b8cabfef7
- buffer_name, buffer_number: (obsolete)a8eee21e75
- charidx:17793ef23a
- flatten:077a1e670a
- prompt_getprompt:077cc7aa0e
- searchcount:e8f5ec0d30
- strptime:10455d43fe
- win_gettype:00f3b4e007
- win_splitmove:d20dcb3d01
Also fix assert_beeps, assert_nobeep and getenv to accept exactly one argument. Previously, they could erroneously accept one or more.
This commit is contained in:
parent
7e1a2301ff
commit
752ca2cb9f
@ -3262,7 +3262,7 @@ char2nr({string} [, {utf8}]) *char2nr()*
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChar()->char2nr()
|
||||
|
||||
<
|
||||
*charidx()*
|
||||
charidx({string}, {idx} [, {countcc}])
|
||||
Return the character index of the byte at {idx} in {string}.
|
||||
@ -3285,6 +3285,9 @@ charidx({string}, {idx} [, {countcc}])
|
||||
echo charidx('áb́ć', 3) returns 1
|
||||
echo charidx('áb́ć', 6, 1) returns 4
|
||||
echo charidx('áb́ć', 16) returns -1
|
||||
<
|
||||
Can also be used as a |method|: >
|
||||
GetName()->charidx(idx)
|
||||
|
||||
chdir({dir}) *chdir()*
|
||||
Change the current working directory to {dir}. The scope of
|
||||
@ -4364,6 +4367,9 @@ flatten({list} [, {maxdepth}]) *flatten()*
|
||||
:echo flatten([1, [2, [3, 4]], 5], 1)
|
||||
< [1, 2, [3, 4], 5]
|
||||
|
||||
Can also be used as a |method|: >
|
||||
mylist->flatten()
|
||||
<
|
||||
float2nr({expr}) *float2nr()*
|
||||
Convert {expr} to a Number by omitting the part after the
|
||||
decimal point.
|
||||
@ -7596,6 +7602,9 @@ prompt_getprompt({buf}) *prompt_getprompt()*
|
||||
If the buffer doesn't exist or isn't a prompt buffer, an empty
|
||||
string is returned.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetBuffer()->prompt_getprompt()
|
||||
|
||||
prompt_setcallback({buf}, {expr}) *prompt_setcallback()*
|
||||
Set prompt callback for buffer {buf} to {expr}. When {expr}
|
||||
is an empty string the callback is removed. This has only
|
||||
@ -8376,7 +8385,9 @@ searchcount([{options}]) *searchcount()*
|
||||
value. see |cursor()|, |getpos()
|
||||
(default: cursor's position)
|
||||
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetSearchOpts()->searchcount()
|
||||
<
|
||||
searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()*
|
||||
Search for the declaration of {name}.
|
||||
|
||||
@ -9653,7 +9664,9 @@ strptime({format}, {timestring}) *strptime()*
|
||||
:echo strftime("%c", strptime("%Y%m%d%H%M%S", "19970427115355") + 3600)
|
||||
< Sun Apr 27 12:53:55 1997
|
||||
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetFormat()->strptime(timestring)
|
||||
<
|
||||
strridx({haystack}, {needle} [, {start}]) *strridx()*
|
||||
The result is a Number, which gives the byte index in
|
||||
{haystack} of the last occurrence of the String {needle}.
|
||||
@ -10526,6 +10539,9 @@ win_gettype([{nr}]) *win_gettype()*
|
||||
popup window then 'buftype' is "terminal" and win_gettype()
|
||||
returns "popup".
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetWinid()->win_gettype()
|
||||
<
|
||||
win_gotoid({expr}) *win_gotoid()*
|
||||
Go to window with ID {expr}. This may also change the current
|
||||
tabpage.
|
||||
@ -10581,6 +10597,9 @@ win_splitmove({nr}, {target} [, {options}]) *win_splitmove()*
|
||||
present, the values of 'splitbelow' and
|
||||
'splitright' are used.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetWinid()->win_splitmove(target)
|
||||
<
|
||||
*winbufnr()*
|
||||
winbufnr({nr}) The result is a Number, which is the number of the buffer
|
||||
associated with window {nr}. {nr} can be the window number or
|
||||
|
@ -157,6 +157,9 @@ assert_nobeep({cmd}) *assert_nobeep()*
|
||||
produces a beep or visual bell.
|
||||
Also see |assert_beeps()|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetCmd()->assert_nobeep()
|
||||
<
|
||||
*assert_notequal()*
|
||||
assert_notequal({expected}, {actual} [, {msg}])
|
||||
The opposite of `assert_equal()`: add an error message to
|
||||
|
@ -33,7 +33,7 @@ return {
|
||||
arglistid={args={0, 2}},
|
||||
argv={args={0, 2}},
|
||||
asin={args=1, base=1, func="float_op_wrapper", data="&asin"}, -- WJMc
|
||||
assert_beeps={args={1}, base=1},
|
||||
assert_beeps={args=1, base=1},
|
||||
assert_equal={args={2, 3}, base=2},
|
||||
assert_equalfile={args={2, 3}, base=1},
|
||||
assert_exception={args={1, 2}},
|
||||
@ -41,7 +41,7 @@ return {
|
||||
assert_false={args={1, 2}, base=1},
|
||||
assert_inrange={args={3, 4}, base=3},
|
||||
assert_match={args={2, 3}, base=2},
|
||||
assert_nobeep={args={1}},
|
||||
assert_nobeep={args=1, base=1},
|
||||
assert_notequal={args={2, 3}, base=2},
|
||||
assert_notmatch={args={2, 3}, base=2},
|
||||
assert_report={args=1, base=1},
|
||||
@ -53,8 +53,8 @@ return {
|
||||
bufadd={args=1, base=1},
|
||||
bufexists={args=1, base=1},
|
||||
buffer_exists={args=1, base=1, func='f_bufexists'}, -- obsolete
|
||||
buffer_name={args={0, 1}, func='f_bufname'}, -- obsolete
|
||||
buffer_number={args={0, 1}, func='f_bufnr'}, -- obsolete
|
||||
buffer_name={args={0, 1}, base=1, func='f_bufname'}, -- obsolete
|
||||
buffer_number={args={0, 1}, base=1, func='f_bufnr'}, -- obsolete
|
||||
buflisted={args=1, base=1},
|
||||
bufload={args=1, base=1},
|
||||
bufloaded={args=1, base=1},
|
||||
@ -71,7 +71,7 @@ return {
|
||||
chanclose={args={1, 2}},
|
||||
chansend={args=2},
|
||||
char2nr={args={1, 2}, base=1},
|
||||
charidx={args={2, 3}},
|
||||
charidx={args={2, 3}, base=1},
|
||||
chdir={args=1, base=1},
|
||||
cindent={args=1, base=1},
|
||||
clearmatches={args={0, 1}, base=1},
|
||||
@ -121,7 +121,7 @@ return {
|
||||
filter={args=2, base=1},
|
||||
finddir={args={1, 3}, base=1},
|
||||
findfile={args={1, 3}, base=1},
|
||||
flatten={args={1, 2}},
|
||||
flatten={args={1, 2}, base=1},
|
||||
float2nr={args=1, base=1},
|
||||
floor={args=1, base=1, func="float_op_wrapper", data="&floor"},
|
||||
fmod={args=2, base=1},
|
||||
@ -152,7 +152,7 @@ return {
|
||||
getcompletion={args={2, 3}, base=1},
|
||||
getcurpos={},
|
||||
getcwd={args={0, 2}, base=1},
|
||||
getenv={args={1}, base=1},
|
||||
getenv={args=1, base=1},
|
||||
getfontname={args={0, 1}},
|
||||
getfperm={args=1, base=1},
|
||||
getfsize={args=1, base=1},
|
||||
@ -262,7 +262,7 @@ return {
|
||||
pow={args=2, base=1},
|
||||
prevnonblank={args=1, base=1},
|
||||
printf={args=varargs(1), base=2},
|
||||
prompt_getprompt={args=1},
|
||||
prompt_getprompt={args=1, base=1},
|
||||
prompt_setcallback={args={2, 2}, base=1},
|
||||
prompt_setinterrupt={args={2, 2}, base=1},
|
||||
prompt_setprompt={args={2, 2}, base=1},
|
||||
@ -299,7 +299,7 @@ return {
|
||||
screenrow={},
|
||||
screenstring={args=2, base=1},
|
||||
search={args={1, 4}, base=1},
|
||||
searchcount={args={0,1}},
|
||||
searchcount={args={0, 1}, base=1},
|
||||
searchdecl={args={1, 3}, base=1},
|
||||
searchpair={args={3, 7}},
|
||||
searchpairpos={args={3, 7}},
|
||||
@ -359,7 +359,7 @@ return {
|
||||
string={args=1, base=1},
|
||||
strlen={args=1, base=1},
|
||||
strpart={args={2, 4}, base=1},
|
||||
strptime={args=2},
|
||||
strptime={args=2, base=1},
|
||||
strridx={args={2, 3}, base=1},
|
||||
strtrans={args=1, base=1},
|
||||
strwidth={args=1, base=1},
|
||||
@ -407,12 +407,12 @@ return {
|
||||
win_execute={args={2, 3}, base=2},
|
||||
win_findbuf={args=1, base=1},
|
||||
win_getid={args={0, 2}, base=1},
|
||||
win_gettype={args={0,1}},
|
||||
win_gettype={args={0, 1}, base=1},
|
||||
win_gotoid={args=1, base=1},
|
||||
win_id2tabwin={args=1, base=1},
|
||||
win_id2win={args=1, base=1},
|
||||
win_screenpos={args=1, base=1},
|
||||
win_splitmove={args={2, 3}},
|
||||
win_splitmove={args={2, 3}, base=1},
|
||||
winbufnr={args=1, base=1},
|
||||
wincol={},
|
||||
windowsversion={},
|
||||
|
@ -165,9 +165,7 @@ func Test_prompt_buffer_getbufinfo()
|
||||
call assert_equal('This is a test: ', prompt_getprompt('%'))
|
||||
|
||||
call prompt_setprompt( bufnr( '%' ), '' )
|
||||
" Nvim doesn't support method call syntax yet.
|
||||
" call assert_equal('', '%'->prompt_getprompt())
|
||||
call assert_equal('', prompt_getprompt('%'))
|
||||
call assert_equal('', '%'->prompt_getprompt())
|
||||
|
||||
call prompt_setprompt( bufnr( '%' ), 'Another: ' )
|
||||
call assert_equal('Another: ', prompt_getprompt('%'))
|
||||
|
Loading…
Reference in New Issue
Block a user