mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.1522: some functions give two error messages
Problem: Some functions give two error messages. Solution: Do not give a second error message. (closes #12352)
This commit is contained in:
@@ -1044,8 +1044,11 @@ string_reduce(
|
|||||||
remove_funccal();
|
remove_funccal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation of "byteidx()" and "byteidxcomp()" functions
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
byteidx(typval_T *argvars, typval_T *rettv, int comp UNUSED)
|
byteidx_common(typval_T *argvars, typval_T *rettv, int comp UNUSED)
|
||||||
{
|
{
|
||||||
rettv->vval.v_number = -1;
|
rettv->vval.v_number = -1;
|
||||||
|
|
||||||
@@ -1065,7 +1068,8 @@ byteidx(typval_T *argvars, typval_T *rettv, int comp UNUSED)
|
|||||||
utf16idx = tv_get_bool(&argvars[2]);
|
utf16idx = tv_get_bool(&argvars[2]);
|
||||||
if (utf16idx < 0 || utf16idx > 1)
|
if (utf16idx < 0 || utf16idx > 1)
|
||||||
{
|
{
|
||||||
semsg(_(e_using_number_as_bool_nr), utf16idx);
|
if (utf16idx != -1)
|
||||||
|
semsg(_(e_using_number_as_bool_nr), utf16idx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1100,7 +1104,7 @@ byteidx(typval_T *argvars, typval_T *rettv, int comp UNUSED)
|
|||||||
void
|
void
|
||||||
f_byteidx(typval_T *argvars, typval_T *rettv)
|
f_byteidx(typval_T *argvars, typval_T *rettv)
|
||||||
{
|
{
|
||||||
byteidx(argvars, rettv, FALSE);
|
byteidx_common(argvars, rettv, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1109,7 +1113,7 @@ f_byteidx(typval_T *argvars, typval_T *rettv)
|
|||||||
void
|
void
|
||||||
f_byteidxcomp(typval_T *argvars, typval_T *rettv)
|
f_byteidxcomp(typval_T *argvars, typval_T *rettv)
|
||||||
{
|
{
|
||||||
byteidx(argvars, rettv, TRUE);
|
byteidx_common(argvars, rettv, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1419,7 +1423,10 @@ f_strchars(typval_T *argvars, typval_T *rettv)
|
|||||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||||
skipcc = tv_get_bool(&argvars[1]);
|
skipcc = tv_get_bool(&argvars[1]);
|
||||||
if (skipcc < 0 || skipcc > 1)
|
if (skipcc < 0 || skipcc > 1)
|
||||||
semsg(_(e_using_number_as_bool_nr), skipcc);
|
{
|
||||||
|
if (skipcc != -1)
|
||||||
|
semsg(_(e_using_number_as_bool_nr), skipcc);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
strchar_common(argvars, rettv, skipcc);
|
strchar_common(argvars, rettv, skipcc);
|
||||||
}
|
}
|
||||||
@@ -1529,7 +1536,8 @@ f_strcharpart(typval_T *argvars, typval_T *rettv)
|
|||||||
skipcc = tv_get_bool(&argvars[3]);
|
skipcc = tv_get_bool(&argvars[3]);
|
||||||
if (skipcc < 0 || skipcc > 1)
|
if (skipcc < 0 || skipcc > 1)
|
||||||
{
|
{
|
||||||
semsg(_(e_using_number_as_bool_nr), skipcc);
|
if (skipcc != -1)
|
||||||
|
semsg(_(e_using_number_as_bool_nr), skipcc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -160,6 +160,8 @@ func Test_strcharpart()
|
|||||||
call assert_equal('edit', "editor"[-10 : 3])
|
call assert_equal('edit', "editor"[-10 : 3])
|
||||||
END
|
END
|
||||||
call v9.CheckLegacyAndVim9Success(lines)
|
call v9.CheckLegacyAndVim9Success(lines)
|
||||||
|
|
||||||
|
call assert_fails('echo strcharpart("", 0, 0, {})', ['E728:', 'E728:'])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_getreg_empty_list()
|
func Test_getreg_empty_list()
|
||||||
|
@@ -1224,6 +1224,7 @@ func Test_byteidx()
|
|||||||
" error cases
|
" error cases
|
||||||
call assert_fails("call byteidx([], 0)", 'E730:')
|
call assert_fails("call byteidx([], 0)", 'E730:')
|
||||||
call assert_fails("call byteidx('abc', [])", 'E745:')
|
call assert_fails("call byteidx('abc', [])", 'E745:')
|
||||||
|
call assert_fails("call byteidx('abc', 0, {})", ['E728:', 'E728:'])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for byteidxcomp() using a character index
|
" Test for byteidxcomp() using a character index
|
||||||
@@ -1263,6 +1264,7 @@ func Test_byteidxcomp()
|
|||||||
" error cases
|
" error cases
|
||||||
call assert_fails("call byteidxcomp([], 0)", 'E730:')
|
call assert_fails("call byteidxcomp([], 0)", 'E730:')
|
||||||
call assert_fails("call byteidxcomp('abc', [])", 'E745:')
|
call assert_fails("call byteidxcomp('abc', [])", 'E745:')
|
||||||
|
call assert_fails("call byteidxcomp('abc', 0, {})", ['E728:', 'E728:'])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for byteidx() using a UTF-16 index
|
" Test for byteidx() using a UTF-16 index
|
||||||
@@ -1623,6 +1625,7 @@ func Test_utf16idx_from_charidx()
|
|||||||
" error cases
|
" error cases
|
||||||
call assert_equal(-1, utf16idx(test_null_string(), 0, v:true, v:true))
|
call assert_equal(-1, utf16idx(test_null_string(), 0, v:true, v:true))
|
||||||
call assert_fails('let l = utf16idx("ab", 0, v:false, [])', 'E1212:')
|
call assert_fails('let l = utf16idx("ab", 0, v:false, [])', 'E1212:')
|
||||||
|
call assert_fails('echo strchars("", {})', ['E728:', 'E728:'])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for strutf16len()
|
" Test for strutf16len()
|
||||||
|
@@ -695,6 +695,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 */
|
||||||
|
/**/
|
||||||
|
1522,
|
||||||
/**/
|
/**/
|
||||||
1521,
|
1521,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user