mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.0.1242: function argument with only dash is seen as number zero
Problem: Function argument with only dash is seen as number zero. (Wang Shidong) Solution: See a dash as a string. (Christian Brabandt)
This commit is contained in:
parent
89c394faca
commit
ffd99f729b
@ -2189,6 +2189,7 @@ test_arglist \
|
|||||||
test_hlsearch \
|
test_hlsearch \
|
||||||
test_increment \
|
test_increment \
|
||||||
test_increment_dbcs \
|
test_increment_dbcs \
|
||||||
|
test_ins_complete \
|
||||||
test_job_fails \
|
test_job_fails \
|
||||||
test_join \
|
test_join \
|
||||||
test_json \
|
test_json \
|
||||||
|
@ -1056,8 +1056,13 @@ call_vim_function(
|
|||||||
if (str_arg_only)
|
if (str_arg_only)
|
||||||
len = 0;
|
len = 0;
|
||||||
else
|
else
|
||||||
/* Recognize a number argument, the others must be strings. */
|
{
|
||||||
|
/* Recognize a number argument, the others must be strings. A dash
|
||||||
|
* is a string too. */
|
||||||
vim_str2nr(argv[i], NULL, &len, STR2NR_ALL, &n, NULL, 0);
|
vim_str2nr(argv[i], NULL, &len, STR2NR_ALL, &n, NULL, 0);
|
||||||
|
if (len == 1 && *argv[i] == '-')
|
||||||
|
len = 0;
|
||||||
|
}
|
||||||
if (len != 0 && len == (int)STRLEN(argv[i]))
|
if (len != 0 && len == (int)STRLEN(argv[i]))
|
||||||
{
|
{
|
||||||
argvars[i].v_type = VAR_NUMBER;
|
argvars[i].v_type = VAR_NUMBER;
|
||||||
|
@ -90,3 +90,22 @@ func Test_ins_complete()
|
|||||||
call delete('Xtestdata')
|
call delete('Xtestdata')
|
||||||
set cpt& cot& def& tags& tagbsearch& hidden&
|
set cpt& cot& def& tags& tagbsearch& hidden&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_omni_dash()
|
||||||
|
func Omni(findstart, base)
|
||||||
|
if a:findstart
|
||||||
|
return 5
|
||||||
|
else
|
||||||
|
echom a:base
|
||||||
|
return ['-help', '-v']
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
set omnifunc=Omni
|
||||||
|
new
|
||||||
|
exe "normal Gofind -\<C-x>\<C-o>"
|
||||||
|
call assert_equal("\n-\nmatch 1 of 2", execute(':2mess'))
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
delfunc Omni
|
||||||
|
set omnifunc=
|
||||||
|
endfunc
|
||||||
|
@ -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 */
|
||||||
|
/**/
|
||||||
|
1242,
|
||||||
/**/
|
/**/
|
||||||
1241,
|
1241,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user