Patch 9.0.0740

2 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 13, 2022, 9:01:27 AM10/13/22
to vim...@googlegroups.com

Patch 9.0.0740
Problem: prop_add_list() gives multiple errors for invalid argument.
Solution: Only give one error message.
Files: src/textprop.c, src/globals.h, src/testdir/test_textprop.vim


*** ../vim-9.0.0739/src/textprop.c 2022-09-17 18:57:32.500190048 +0100
--- src/textprop.c 2022-10-13 13:59:49.051327164 +0100
***************
*** 353,358 ****
--- 353,359 ----
linenr_T end_lnum;
colnr_T end_col;
int error = FALSE;
+ int prev_did_emsg = did_emsg;

if (check_for_dict_arg(argvars, 0) == FAIL
|| check_for_list_arg(argvars, 1) == FAIL)
***************
*** 389,401 ****

pos_list = li->li_tv.vval.v_list;
start_lnum = list_find_nr(pos_list, 0L, &error);
! start_col = list_find_nr(pos_list, 1L, &error);
! end_lnum = list_find_nr(pos_list, 2L, &error);
! end_col = list_find_nr(pos_list, 3L, &error);
if (error || start_lnum <= 0 || start_col <= 0
! || end_lnum <= 0 || end_col <= 0)
{
! emsg(_(e_invalid_argument));
return;
}
if (prop_add_one(buf, type_name, id, NULL, 0, 0, start_lnum, end_lnum,
--- 390,406 ----

pos_list = li->li_tv.vval.v_list;
start_lnum = list_find_nr(pos_list, 0L, &error);
! if (!error)
! start_col = list_find_nr(pos_list, 1L, &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
! || end_lnum <= 0 || end_col <= 0)
{
! if (prev_did_emsg == did_emsg)
! emsg(_(e_invalid_argument));
return;
}
if (prop_add_one(buf, type_name, id, NULL, 0, 0, start_lnum, end_lnum,
*** ../vim-9.0.0739/src/globals.h 2022-10-04 16:23:39.014042183 +0100
--- src/globals.h 2022-10-13 13:46:48.544762959 +0100
***************
*** 219,226 ****

EXTERN int did_endif INIT(= FALSE); // just had ":endif"
#endif
! EXTERN int did_emsg; // set by emsg() when the message
! // is displayed or thrown
#ifdef FEAT_EVAL
EXTERN int did_emsg_silent INIT(= 0); // incremented by emsg() when
// emsg_silent was set and did_emsg
--- 219,226 ----

EXTERN int did_endif INIT(= FALSE); // just had ":endif"
#endif
! EXTERN int did_emsg; // incremented by emsg() when a
! // message is displayed or thrown
#ifdef FEAT_EVAL
EXTERN int did_emsg_silent INIT(= 0); // incremented by emsg() when
// emsg_silent was set and did_emsg
*** ../vim-9.0.0739/src/testdir/test_textprop.vim 2022-10-11 21:01:44.382815392 +0100
--- src/testdir/test_textprop.vim 2022-10-13 13:59:32.511355730 +0100
***************
*** 383,388 ****
--- 383,391 ----
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()])', 'E714:')
+
+ " only one error for multiple wrong values
+ call assert_fails('call prop_add_list(#{type: "one"}, [[{}, [], 0z00, 0.3]])', ['E728:', 'E728:'])
call DeletePropTypes()
bw!
endfunc
*** ../vim-9.0.0739/src/version.c 2022-10-13 13:17:37.519640382 +0100
--- src/version.c 2022-10-13 13:47:57.088625601 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 740,
/**/

--
There are three kinds of people: Those who can count & those who can't.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages