mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.1.1961: more functions can be used as a method
Problem: More functions can be used as a method. Solution: Allow more functions to be used as a method. Add a test for mapcheck().
This commit is contained in:
@@ -6699,6 +6699,8 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
|
|||||||
mapped, and have it do the original mapping too. Sketch: >
|
mapped, and have it do the original mapping too. Sketch: >
|
||||||
exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n')
|
exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n')
|
||||||
|
|
||||||
|
< Can also be used as a |method|: >
|
||||||
|
GetKey()->maparg('n')
|
||||||
|
|
||||||
mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
|
mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
|
||||||
Check if there is a mapping that matches with {name} in mode
|
Check if there is a mapping that matches with {name} in mode
|
||||||
@@ -6733,6 +6735,9 @@ mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
|
|||||||
< This avoids adding the "_vv" mapping when there already is a
|
< This avoids adding the "_vv" mapping when there already is a
|
||||||
mapping for "_v" or for "_vvv".
|
mapping for "_v" or for "_vvv".
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetKey()->mapcheck('n')
|
||||||
|
|
||||||
match({expr}, {pat} [, {start} [, {count}]]) *match()*
|
match({expr}, {pat} [, {start} [, {count}]]) *match()*
|
||||||
When {expr} is a |List| then this returns the index of the
|
When {expr} is a |List| then this returns the index of the
|
||||||
first item where {pat} matches. Each item is used as a
|
first item where {pat} matches. Each item is used as a
|
||||||
@@ -6791,6 +6796,9 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()*
|
|||||||
the pattern. 'smartcase' is NOT used. The matching is always
|
the pattern. 'smartcase' is NOT used. The matching is always
|
||||||
done like 'magic' is set and 'cpoptions' is empty.
|
done like 'magic' is set and 'cpoptions' is empty.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetList()->match('word')
|
||||||
|
<
|
||||||
*matchadd()* *E798* *E799* *E801* *E957*
|
*matchadd()* *E798* *E799* *E801* *E957*
|
||||||
matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
|
matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
|
||||||
Defines a pattern to be highlighted in the current window (a
|
Defines a pattern to be highlighted in the current window (a
|
||||||
@@ -6846,6 +6854,9 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
|
|||||||
available from |getmatches()|. All matches can be deleted in
|
available from |getmatches()|. All matches can be deleted in
|
||||||
one operation by |clearmatches()|.
|
one operation by |clearmatches()|.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetGroup()->matchadd('TODO')
|
||||||
|
<
|
||||||
*matchaddpos()*
|
*matchaddpos()*
|
||||||
matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
|
matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
|
||||||
Same as |matchadd()|, but requires a list of positions {pos}
|
Same as |matchadd()|, but requires a list of positions {pos}
|
||||||
@@ -6880,6 +6891,9 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
|
|||||||
|getmatches()| with an entry "pos1", "pos2", etc., with the
|
|getmatches()| with an entry "pos1", "pos2", etc., with the
|
||||||
value a list like the {pos} item.
|
value a list like the {pos} item.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetGroup()->matchaddpos([23, 11])
|
||||||
|
|
||||||
matcharg({nr}) *matcharg()*
|
matcharg({nr}) *matcharg()*
|
||||||
Selects the {nr} match item, as set with a |:match|,
|
Selects the {nr} match item, as set with a |:match|,
|
||||||
|:2match| or |:3match| command.
|
|:2match| or |:3match| command.
|
||||||
@@ -6892,6 +6906,9 @@ matcharg({nr}) *matcharg()*
|
|||||||
Highlighting matches using the |:match| commands are limited
|
Highlighting matches using the |:match| commands are limited
|
||||||
to three matches. |matchadd()| does not have this limitation.
|
to three matches. |matchadd()| does not have this limitation.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetMatch()->matcharg()
|
||||||
|
|
||||||
matchdelete({id} [, {win}) *matchdelete()* *E802* *E803*
|
matchdelete({id} [, {win}) *matchdelete()* *E802* *E803*
|
||||||
Deletes a match with ID {id} previously defined by |matchadd()|
|
Deletes a match with ID {id} previously defined by |matchadd()|
|
||||||
or one of the |:match| commands. Returns 0 if successful,
|
or one of the |:match| commands. Returns 0 if successful,
|
||||||
@@ -6900,6 +6917,9 @@ matchdelete({id} [, {win}) *matchdelete()* *E802* *E803*
|
|||||||
If {win} is specified, use the window with this number or
|
If {win} is specified, use the window with this number or
|
||||||
window ID instead of the current window.
|
window ID instead of the current window.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetMatch()->matchdelete()
|
||||||
|
|
||||||
matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
|
matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
|
||||||
Same as |match()|, but return the index of first character
|
Same as |match()|, but return the index of first character
|
||||||
after the match. Example: >
|
after the match. Example: >
|
||||||
@@ -6919,6 +6939,9 @@ matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
|
|||||||
< result is "-1".
|
< result is "-1".
|
||||||
When {expr} is a |List| the result is equal to |match()|.
|
When {expr} is a |List| the result is equal to |match()|.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetText()->matchend('word')
|
||||||
|
|
||||||
matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()*
|
matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()*
|
||||||
Same as |match()|, but return a |List|. The first item in the
|
Same as |match()|, but return a |List|. The first item in the
|
||||||
list is the matched string, same as what matchstr() would
|
list is the matched string, same as what matchstr() would
|
||||||
@@ -6929,6 +6952,9 @@ matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()*
|
|||||||
< Results in: ['acd', 'a', '', 'c', 'd', '', '', '', '', '']
|
< Results in: ['acd', 'a', '', 'c', 'd', '', '', '', '', '']
|
||||||
When there is no match an empty list is returned.
|
When there is no match an empty list is returned.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetList()->matchlist('word')
|
||||||
|
|
||||||
matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()*
|
matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()*
|
||||||
Same as |match()|, but return the matched string. Example: >
|
Same as |match()|, but return the matched string. Example: >
|
||||||
:echo matchstr("testing", "ing")
|
:echo matchstr("testing", "ing")
|
||||||
@@ -6942,6 +6968,9 @@ matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()*
|
|||||||
When {expr} is a |List| then the matching item is returned.
|
When {expr} is a |List| then the matching item is returned.
|
||||||
The type isn't changed, it's not necessarily a String.
|
The type isn't changed, it's not necessarily a String.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetText()->matchstr('word')
|
||||||
|
|
||||||
matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()*
|
matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()*
|
||||||
Same as |matchstr()|, but return the matched string, the start
|
Same as |matchstr()|, but return the matched string, the start
|
||||||
position and the end position of the match. Example: >
|
position and the end position of the match. Example: >
|
||||||
@@ -6960,6 +6989,8 @@ matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()*
|
|||||||
< result is ["x", 1, 2, 3].
|
< result is ["x", 1, 2, 3].
|
||||||
The type isn't changed, it's not necessarily a String.
|
The type isn't changed, it's not necessarily a String.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetText()->matchstrpos('word')
|
||||||
*max()*
|
*max()*
|
||||||
max({expr}) Return the maximum value of all items in {expr}.
|
max({expr}) Return the maximum value of all items in {expr}.
|
||||||
{expr} can be a list or a dictionary. For a dictionary,
|
{expr} can be a list or a dictionary. For a dictionary,
|
||||||
@@ -7010,6 +7041,9 @@ mkdir({name} [, {path} [, {prot}]])
|
|||||||
|
|
||||||
Not available on all systems. To check use: >
|
Not available on all systems. To check use: >
|
||||||
:if exists("*mkdir")
|
:if exists("*mkdir")
|
||||||
|
|
||||||
|
< Can also be used as a |method|: >
|
||||||
|
GetName()->mkdir()
|
||||||
<
|
<
|
||||||
*mode()*
|
*mode()*
|
||||||
mode([expr]) Return a string that indicates the current mode.
|
mode([expr]) Return a string that indicates the current mode.
|
||||||
@@ -7055,6 +7089,9 @@ mode([expr]) Return a string that indicates the current mode.
|
|||||||
the leading character(s).
|
the leading character(s).
|
||||||
Also see |visualmode()|.
|
Also see |visualmode()|.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
DoFull()->mode()
|
||||||
|
|
||||||
mzeval({expr}) *mzeval()*
|
mzeval({expr}) *mzeval()*
|
||||||
Evaluate MzScheme expression {expr} and return its result
|
Evaluate MzScheme expression {expr} and return its result
|
||||||
converted to Vim data structures.
|
converted to Vim data structures.
|
||||||
@@ -7069,6 +7106,9 @@ mzeval({expr}) *mzeval()*
|
|||||||
:mz (define h (make-hash)) (hash-set! h "list" l)
|
:mz (define h (make-hash)) (hash-set! h "list" l)
|
||||||
:echo mzeval("l")
|
:echo mzeval("l")
|
||||||
:echo mzeval("h")
|
:echo mzeval("h")
|
||||||
|
<
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetExpr()->mzeval()
|
||||||
<
|
<
|
||||||
{only available when compiled with the |+mzscheme| feature}
|
{only available when compiled with the |+mzscheme| feature}
|
||||||
|
|
||||||
|
@@ -655,23 +655,23 @@ static funcentry_T global_functions[] =
|
|||||||
{"luaeval", 1, 2, FEARG_1, f_luaeval},
|
{"luaeval", 1, 2, FEARG_1, f_luaeval},
|
||||||
#endif
|
#endif
|
||||||
{"map", 2, 2, FEARG_1, f_map},
|
{"map", 2, 2, FEARG_1, f_map},
|
||||||
{"maparg", 1, 4, 0, f_maparg},
|
{"maparg", 1, 4, FEARG_1, f_maparg},
|
||||||
{"mapcheck", 1, 3, 0, f_mapcheck},
|
{"mapcheck", 1, 3, FEARG_1, f_mapcheck},
|
||||||
{"match", 2, 4, 0, f_match},
|
{"match", 2, 4, FEARG_1, f_match},
|
||||||
{"matchadd", 2, 5, 0, f_matchadd},
|
{"matchadd", 2, 5, FEARG_1, f_matchadd},
|
||||||
{"matchaddpos", 2, 5, 0, f_matchaddpos},
|
{"matchaddpos", 2, 5, FEARG_1, f_matchaddpos},
|
||||||
{"matcharg", 1, 1, 0, f_matcharg},
|
{"matcharg", 1, 1, FEARG_1, f_matcharg},
|
||||||
{"matchdelete", 1, 2, 0, f_matchdelete},
|
{"matchdelete", 1, 2, FEARG_1, f_matchdelete},
|
||||||
{"matchend", 2, 4, 0, f_matchend},
|
{"matchend", 2, 4, FEARG_1, f_matchend},
|
||||||
{"matchlist", 2, 4, 0, f_matchlist},
|
{"matchlist", 2, 4, FEARG_1, f_matchlist},
|
||||||
{"matchstr", 2, 4, 0, f_matchstr},
|
{"matchstr", 2, 4, FEARG_1, f_matchstr},
|
||||||
{"matchstrpos", 2, 4, 0, f_matchstrpos},
|
{"matchstrpos", 2, 4, FEARG_1, f_matchstrpos},
|
||||||
{"max", 1, 1, FEARG_1, f_max},
|
{"max", 1, 1, FEARG_1, f_max},
|
||||||
{"min", 1, 1, FEARG_1, f_min},
|
{"min", 1, 1, FEARG_1, f_min},
|
||||||
{"mkdir", 1, 3, 0, f_mkdir},
|
{"mkdir", 1, 3, FEARG_1, f_mkdir},
|
||||||
{"mode", 0, 1, 0, f_mode},
|
{"mode", 0, 1, FEARG_1, f_mode},
|
||||||
#ifdef FEAT_MZSCHEME
|
#ifdef FEAT_MZSCHEME
|
||||||
{"mzeval", 1, 1, 0, f_mzeval},
|
{"mzeval", 1, 1, FEARG_1, f_mzeval},
|
||||||
#endif
|
#endif
|
||||||
{"nextnonblank", 1, 1, 0, f_nextnonblank},
|
{"nextnonblank", 1, 1, 0, f_nextnonblank},
|
||||||
{"nr2char", 1, 2, 0, f_nr2char},
|
{"nr2char", 1, 2, 0, f_nr2char},
|
||||||
|
@@ -25,7 +25,7 @@ STARTTEST
|
|||||||
:mz (vim-set-buff-line (vim-eval "line('.')") "1 changed line 1")
|
:mz (vim-set-buff-line (vim-eval "line('.')") "1 changed line 1")
|
||||||
:" scalar test
|
:" scalar test
|
||||||
:let tmp_string = mzeval('"string"')
|
:let tmp_string = mzeval('"string"')
|
||||||
:let tmp_1000 = mzeval('1000')
|
:let tmp_1000 = '1000'->mzeval()
|
||||||
:if tmp_string . tmp_1000 == "string1000"
|
:if tmp_string . tmp_1000 == "string1000"
|
||||||
:let scalar_res = "OK"
|
:let scalar_res = "OK"
|
||||||
:else
|
:else
|
||||||
|
@@ -655,8 +655,8 @@ func Test_mode()
|
|||||||
exe "normal Rabc\<C-X>\<C-L>\<F2>\<Esc>u"
|
exe "normal Rabc\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||||
call assert_equal('R-Rc', g:current_modes)
|
call assert_equal('R-Rc', g:current_modes)
|
||||||
|
|
||||||
call assert_equal('n', mode(0))
|
call assert_equal('n', 0->mode())
|
||||||
call assert_equal('n', mode(1))
|
call assert_equal('n', 1->mode())
|
||||||
|
|
||||||
" i_CTRL-O
|
" i_CTRL-O
|
||||||
exe "normal i\<C-O>:call Save_mode()\<Cr>\<Esc>"
|
exe "normal i\<C-O>:call Save_mode()\<Cr>\<Esc>"
|
||||||
@@ -793,7 +793,7 @@ endfunc
|
|||||||
|
|
||||||
func Test_match_func()
|
func Test_match_func()
|
||||||
call assert_equal(4, match('testing', 'ing'))
|
call assert_equal(4, match('testing', 'ing'))
|
||||||
call assert_equal(4, match('testing', 'ing', 2))
|
call assert_equal(4, 'testing'->match('ing', 2))
|
||||||
call assert_equal(-1, match('testing', 'ing', 5))
|
call assert_equal(-1, match('testing', 'ing', 5))
|
||||||
call assert_equal(-1, match('testing', 'ing', 8))
|
call assert_equal(-1, match('testing', 'ing', 8))
|
||||||
call assert_equal(1, match(['vim', 'testing', 'execute'], 'ing'))
|
call assert_equal(1, match(['vim', 'testing', 'execute'], 'ing'))
|
||||||
@@ -802,7 +802,7 @@ endfunc
|
|||||||
|
|
||||||
func Test_matchend()
|
func Test_matchend()
|
||||||
call assert_equal(7, matchend('testing', 'ing'))
|
call assert_equal(7, matchend('testing', 'ing'))
|
||||||
call assert_equal(7, matchend('testing', 'ing', 2))
|
call assert_equal(7, 'testing'->matchend('ing', 2))
|
||||||
call assert_equal(-1, matchend('testing', 'ing', 5))
|
call assert_equal(-1, matchend('testing', 'ing', 5))
|
||||||
call assert_equal(-1, matchend('testing', 'ing', 8))
|
call assert_equal(-1, matchend('testing', 'ing', 8))
|
||||||
call assert_equal(match(['vim', 'testing', 'execute'], 'ing'), matchend(['vim', 'testing', 'execute'], 'ing'))
|
call assert_equal(match(['vim', 'testing', 'execute'], 'ing'), matchend(['vim', 'testing', 'execute'], 'ing'))
|
||||||
@@ -811,13 +811,13 @@ endfunc
|
|||||||
|
|
||||||
func Test_matchlist()
|
func Test_matchlist()
|
||||||
call assert_equal(['acd', 'a', '', 'c', 'd', '', '', '', '', ''], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)'))
|
call assert_equal(['acd', 'a', '', 'c', 'd', '', '', '', '', ''], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)'))
|
||||||
call assert_equal(['d', '', '', '', 'd', '', '', '', '', ''], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2))
|
call assert_equal(['d', '', '', '', 'd', '', '', '', '', ''], 'acd'->matchlist('\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2))
|
||||||
call assert_equal([], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 4))
|
call assert_equal([], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 4))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_matchstr()
|
func Test_matchstr()
|
||||||
call assert_equal('ing', matchstr('testing', 'ing'))
|
call assert_equal('ing', matchstr('testing', 'ing'))
|
||||||
call assert_equal('ing', matchstr('testing', 'ing', 2))
|
call assert_equal('ing', 'testing'->matchstr('ing', 2))
|
||||||
call assert_equal('', matchstr('testing', 'ing', 5))
|
call assert_equal('', matchstr('testing', 'ing', 5))
|
||||||
call assert_equal('', matchstr('testing', 'ing', 8))
|
call assert_equal('', matchstr('testing', 'ing', 8))
|
||||||
call assert_equal('testing', matchstr(['vim', 'testing', 'execute'], 'ing'))
|
call assert_equal('testing', matchstr(['vim', 'testing', 'execute'], 'ing'))
|
||||||
@@ -826,7 +826,7 @@ endfunc
|
|||||||
|
|
||||||
func Test_matchstrpos()
|
func Test_matchstrpos()
|
||||||
call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing'))
|
call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing'))
|
||||||
call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2))
|
call assert_equal(['ing', 4, 7], 'testing'->matchstrpos('ing', 2))
|
||||||
call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5))
|
call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5))
|
||||||
call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 8))
|
call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 8))
|
||||||
call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing'))
|
call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing'))
|
||||||
|
@@ -35,7 +35,7 @@ function SetUp()
|
|||||||
" we start from a clean state.
|
" we start from a clean state.
|
||||||
call delete("Xtopdir", "rf")
|
call delete("Xtopdir", "rf")
|
||||||
new
|
new
|
||||||
call mkdir('Xtopdir')
|
eval 'Xtopdir'->mkdir()
|
||||||
cd Xtopdir
|
cd Xtopdir
|
||||||
let g:topdir = getcwd()
|
let g:topdir = getcwd()
|
||||||
call mkdir('Xdir1')
|
call mkdir('Xdir1')
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
" Tests for maparg().
|
" Tests for maparg().
|
||||||
" Also test utf8 map with a 0x80 byte.
|
" Also test utf8 map with a 0x80 byte.
|
||||||
|
" Also test mapcheck()
|
||||||
|
|
||||||
function s:SID()
|
function s:SID()
|
||||||
return str2nr(matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$'))
|
return str2nr(matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$'))
|
||||||
@@ -22,7 +23,7 @@ function Test_maparg()
|
|||||||
call assert_equal({'silent': 1, 'noremap': 1, 'lhs': 'bar', 'mode': 'v',
|
call assert_equal({'silent': 1, 'noremap': 1, 'lhs': 'bar', 'mode': 'v',
|
||||||
\ 'nowait': 0, 'expr': 1, 'sid': sid, 'lnum': lnum + 2,
|
\ 'nowait': 0, 'expr': 1, 'sid': sid, 'lnum': lnum + 2,
|
||||||
\ 'rhs': 'isbar', 'buffer': 1},
|
\ 'rhs': 'isbar', 'buffer': 1},
|
||||||
\ maparg('bar', '', 0, 1))
|
\ 'bar'->maparg('', 0, 1))
|
||||||
let lnum = expand('<sflnum>')
|
let lnum = expand('<sflnum>')
|
||||||
map <buffer> <nowait> foo bar
|
map <buffer> <nowait> foo bar
|
||||||
call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'foo', 'mode': ' ',
|
call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'foo', 'mode': ' ',
|
||||||
@@ -46,6 +47,45 @@ function Test_maparg()
|
|||||||
unmap abc
|
unmap abc
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
func Test_mapcheck()
|
||||||
|
call assert_equal('', mapcheck('a'))
|
||||||
|
call assert_equal('', mapcheck('abc'))
|
||||||
|
call assert_equal('', mapcheck('ax'))
|
||||||
|
call assert_equal('', mapcheck('b'))
|
||||||
|
|
||||||
|
map a something
|
||||||
|
call assert_equal('something', mapcheck('a'))
|
||||||
|
call assert_equal('something', mapcheck('a', 'n'))
|
||||||
|
call assert_equal('', mapcheck('a', 'c'))
|
||||||
|
call assert_equal('', mapcheck('a', 'i'))
|
||||||
|
call assert_equal('something', 'abc'->mapcheck())
|
||||||
|
call assert_equal('something', 'ax'->mapcheck())
|
||||||
|
call assert_equal('', mapcheck('b'))
|
||||||
|
unmap a
|
||||||
|
|
||||||
|
map ab foobar
|
||||||
|
call assert_equal('foobar', mapcheck('a'))
|
||||||
|
call assert_equal('foobar', mapcheck('abc'))
|
||||||
|
call assert_equal('', mapcheck('ax'))
|
||||||
|
call assert_equal('', mapcheck('b'))
|
||||||
|
unmap ab
|
||||||
|
|
||||||
|
map abc barfoo
|
||||||
|
call assert_equal('barfoo', mapcheck('a'))
|
||||||
|
call assert_equal('barfoo', mapcheck('a', 'n', 0))
|
||||||
|
call assert_equal('', mapcheck('a', 'n', 1))
|
||||||
|
call assert_equal('barfoo', mapcheck('abc'))
|
||||||
|
call assert_equal('', mapcheck('ax'))
|
||||||
|
call assert_equal('', mapcheck('b'))
|
||||||
|
unmap abc
|
||||||
|
|
||||||
|
abbr ab abbrev
|
||||||
|
call assert_equal('abbrev', mapcheck('a', 'i', 1))
|
||||||
|
call assert_equal('', mapcheck('a', 'n', 1))
|
||||||
|
call assert_equal('', mapcheck('a', 'i', 0))
|
||||||
|
unabbr ab
|
||||||
|
endfunc
|
||||||
|
|
||||||
function Test_range_map()
|
function Test_range_map()
|
||||||
new
|
new
|
||||||
" Outside of the range, minimum
|
" Outside of the range, minimum
|
||||||
|
@@ -15,7 +15,7 @@ function Test_match()
|
|||||||
2match MyGroup2 /FIXME/
|
2match MyGroup2 /FIXME/
|
||||||
3match MyGroup3 /XXX/
|
3match MyGroup3 /XXX/
|
||||||
call assert_equal(['MyGroup1', 'TODO'], matcharg(1))
|
call assert_equal(['MyGroup1', 'TODO'], matcharg(1))
|
||||||
call assert_equal(['MyGroup2', 'FIXME'], matcharg(2))
|
call assert_equal(['MyGroup2', 'FIXME'], 2->matcharg())
|
||||||
call assert_equal(['MyGroup3', 'XXX'], matcharg(3))
|
call assert_equal(['MyGroup3', 'XXX'], matcharg(3))
|
||||||
|
|
||||||
" --- Check that "matcharg()" returns an empty list if the argument is not 1,
|
" --- Check that "matcharg()" returns an empty list if the argument is not 1,
|
||||||
@@ -44,7 +44,7 @@ function Test_match()
|
|||||||
" --- Check that "matchdelete()" deletes the matches defined in the previous
|
" --- Check that "matchdelete()" deletes the matches defined in the previous
|
||||||
" --- test correctly.
|
" --- test correctly.
|
||||||
call matchdelete(m1)
|
call matchdelete(m1)
|
||||||
call matchdelete(m2)
|
eval m2->matchdelete()
|
||||||
call matchdelete(m3)
|
call matchdelete(m3)
|
||||||
call assert_equal([], getmatches())
|
call assert_equal([], getmatches())
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ function Test_match()
|
|||||||
" --- Check that "clearmatches()" clears all matches defined by ":match" and
|
" --- Check that "clearmatches()" clears all matches defined by ":match" and
|
||||||
" --- "matchadd()".
|
" --- "matchadd()".
|
||||||
let m1 = matchadd("MyGroup1", "TODO")
|
let m1 = matchadd("MyGroup1", "TODO")
|
||||||
let m2 = matchadd("MyGroup2", "FIXME", 42)
|
let m2 = "MyGroup2"->matchadd("FIXME", 42)
|
||||||
let m3 = matchadd("MyGroup3", "XXX", 60, 17)
|
let m3 = matchadd("MyGroup3", "XXX", 60, 17)
|
||||||
match MyGroup1 /COFFEE/
|
match MyGroup1 /COFFEE/
|
||||||
2match MyGroup2 /HUMPPA/
|
2match MyGroup2 /HUMPPA/
|
||||||
@@ -118,7 +118,7 @@ function Test_match()
|
|||||||
call clearmatches()
|
call clearmatches()
|
||||||
|
|
||||||
call setline(1, 'abcdΣabcdef')
|
call setline(1, 'abcdΣabcdef')
|
||||||
call matchaddpos("MyGroup1", [[1, 4, 2], [1, 9, 2]])
|
eval "MyGroup1"->matchaddpos([[1, 4, 2], [1, 9, 2]])
|
||||||
1
|
1
|
||||||
redraw!
|
redraw!
|
||||||
let v1 = screenattr(1, 1)
|
let v1 = screenattr(1, 1)
|
||||||
|
@@ -761,6 +761,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1961,
|
||||||
/**/
|
/**/
|
||||||
1960,
|
1960,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user