mirror of
https://github.com/vim/vim.git
synced 2025-10-01 04:54:07 -04:00
patch 9.0.0740: prop_add_list() gives multiple errors for invalid argument
Problem: prop_add_list() gives multiple errors for invalid argument. Solution: Only give one error message.
This commit is contained in:
@@ -219,8 +219,8 @@ EXTERN char_u *emsg_assert_fails_context INIT(= NULL);
|
|||||||
|
|
||||||
EXTERN int did_endif INIT(= FALSE); // just had ":endif"
|
EXTERN int did_endif INIT(= FALSE); // just had ":endif"
|
||||||
#endif
|
#endif
|
||||||
EXTERN int did_emsg; // set by emsg() when the message
|
EXTERN int did_emsg; // incremented by emsg() when a
|
||||||
// is displayed or thrown
|
// message is displayed or thrown
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
EXTERN int did_emsg_silent INIT(= 0); // incremented by emsg() when
|
EXTERN int did_emsg_silent INIT(= 0); // incremented by emsg() when
|
||||||
// emsg_silent was set and did_emsg
|
// emsg_silent was set and did_emsg
|
||||||
|
@@ -383,6 +383,9 @@ func Test_prop_add_list()
|
|||||||
call assert_fails('call prop_add_list(test_null_dict(), [[2, 2, 2]])', 'E965:')
|
call assert_fails('call prop_add_list(test_null_dict(), [[2, 2, 2]])', 'E965:')
|
||||||
call assert_fails('call prop_add_list(#{type: "one"}, test_null_list())', 'E1298:')
|
call assert_fails('call prop_add_list(#{type: "one"}, test_null_list())', 'E1298:')
|
||||||
call assert_fails('call prop_add_list(#{type: "one"}, [test_null_list()])', 'E714:')
|
call assert_fails('call prop_add_list(#{type: "one"}, [test_null_list()])', 'E714:')
|
||||||
|
|
||||||
|
" only one error for multiple wrong values
|
||||||
|
call assert_fails('call prop_add_list(#{type: "one"}, [[{}, [], 0z00, 0.3]])', ['E728:', 'E728:'])
|
||||||
call DeletePropTypes()
|
call DeletePropTypes()
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -353,6 +353,7 @@ f_prop_add_list(typval_T *argvars, typval_T *rettv UNUSED)
|
|||||||
linenr_T end_lnum;
|
linenr_T end_lnum;
|
||||||
colnr_T end_col;
|
colnr_T end_col;
|
||||||
int error = FALSE;
|
int error = FALSE;
|
||||||
|
int prev_did_emsg = did_emsg;
|
||||||
|
|
||||||
if (check_for_dict_arg(argvars, 0) == FAIL
|
if (check_for_dict_arg(argvars, 0) == FAIL
|
||||||
|| check_for_list_arg(argvars, 1) == FAIL)
|
|| check_for_list_arg(argvars, 1) == FAIL)
|
||||||
@@ -389,13 +390,17 @@ f_prop_add_list(typval_T *argvars, typval_T *rettv UNUSED)
|
|||||||
|
|
||||||
pos_list = li->li_tv.vval.v_list;
|
pos_list = li->li_tv.vval.v_list;
|
||||||
start_lnum = list_find_nr(pos_list, 0L, &error);
|
start_lnum = list_find_nr(pos_list, 0L, &error);
|
||||||
start_col = list_find_nr(pos_list, 1L, &error);
|
if (!error)
|
||||||
end_lnum = list_find_nr(pos_list, 2L, &error);
|
start_col = list_find_nr(pos_list, 1L, &error);
|
||||||
end_col = list_find_nr(pos_list, 3L, &error);
|
if (!error)
|
||||||
|
end_lnum = list_find_nr(pos_list, 2L, &error);
|
||||||
|
if (!error)
|
||||||
|
end_col = list_find_nr(pos_list, 3L, &error);
|
||||||
if (error || start_lnum <= 0 || start_col <= 0
|
if (error || start_lnum <= 0 || start_col <= 0
|
||||||
|| end_lnum <= 0 || end_col <= 0)
|
|| end_lnum <= 0 || end_col <= 0)
|
||||||
{
|
{
|
||||||
emsg(_(e_invalid_argument));
|
if (prev_did_emsg == did_emsg)
|
||||||
|
emsg(_(e_invalid_argument));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prop_add_one(buf, type_name, id, NULL, 0, 0, start_lnum, end_lnum,
|
if (prop_add_one(buf, type_name, id, NULL, 0, 0, start_lnum, end_lnum,
|
||||||
|
@@ -699,6 +699,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 */
|
||||||
|
/**/
|
||||||
|
740,
|
||||||
/**/
|
/**/
|
||||||
739,
|
739,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user