Patch 8.2.5039
Problem: Confusing error if first argument of popup_create() is wrong.
Solution: Give a more informative error.
Files: src/popupwin.c, src/testdir/test_popupwin.vim, src/errors.h,
src/testdir/dumps/Test_popup_settext_07.dump
*** ../vim-8.2.5038/src/popupwin.c 2022-05-29 14:12:38.374920230 +0100
--- src/popupwin.c 2022-05-29 15:56:18.190649268 +0100
***************
*** 1047,1053 ****
{
if (li->li_tv.v_type != VAR_DICT)
{
! emsg(_(e_dictionary_required));
return;
}
dict = li->li_tv.vval.v_dict;
--- 1047,1053 ----
{
if (li->li_tv.v_type != VAR_DICT)
{
! semsg(_(e_argument_1_list_item_nr_dictionary_required), lnum + 1);
return;
}
dict = li->li_tv.vval.v_dict;
***************
*** 1685,1691 ****
if (l != NULL && l->lv_len > 0)
{
! if (l->lv_first->li_tv.v_type == VAR_STRING)
// list of strings
add_popup_strings(buf, l);
else
--- 1685,1693 ----
if (l != NULL && l->lv_len > 0)
{
! if (l->lv_first == &range_list_item)
! emsg(_(e_using_number_as_string));
! else if (l->lv_first->li_tv.v_type == VAR_STRING)
// list of strings
add_popup_strings(buf, l);
else
*** ../vim-8.2.5038/src/testdir/test_popupwin.vim 2022-05-29
14:12:38.378920226 +0100
--- src/testdir/test_popupwin.vim 2022-05-29 17:10:14.335933195 +0100
***************
*** 1072,1078 ****
call assert_fails('call popup_create("text", #{borderchars: "none"})',
'E714:')
call popup_clear()
! call assert_fails('call popup_create([#{text: "text"}, 666], {})', 'E715:')
call popup_clear()
call assert_fails('call popup_create([#{text: "text", props: "none"}],
{})', 'E714:')
call popup_clear()
--- 1072,1078 ----
call assert_fails('call popup_create("text", #{borderchars: "none"})',
'E714:')
call popup_clear()
! call assert_fails('call popup_create([#{text: "text"}, 666], {})', 'E1284:
Argument 1, list item 2: Dictionary required')
call popup_clear()
call assert_fails('call popup_create([#{text: "text", props: "none"}],
{})', 'E714:')
call popup_clear()
***************
*** 1091,1096 ****
--- 1091,1101 ----
call popup_clear()
call assert_fails('call popup_create("text", #{tabpage : 4})', 'E997:')
call popup_clear()
+
+ call assert_fails('call popup_create(range(10), {})', 'E1024:')
+ call popup_clear()
+ call assert_fails('call popup_create([1, 2], {})', 'E1284: Argument 1, list
item 1: Dictionary required')
+ call popup_clear()
endfunc
func Test_win_execute_closing_curwin()
*** ../vim-8.2.5038/src/errors.h 2022-05-27 21:16:29.297019075 +0100
--- src/errors.h 2022-05-29 15:56:59.770623248 +0100
***************
*** 3284,3286 ****
--- 3284,3290 ----
EXTERN char e_bitshift_ops_must_be_postive[]
INIT(= N_("E1283: Bitshift amount must be a positive number"));
#endif
+ #if defined(FEAT_PROP_POPUP)
+ EXTERN char e_argument_1_list_item_nr_dictionary_required[]
+ INIT(= N_("E1284: Argument 1, list item %d: Dictionary required"));
+ #endif
*** ../vim-8.2.5038/src/testdir/dumps/Test_popup_settext_07.dump
2020-01-30 13:55:29.010670407 +0000
--- src/testdir/dumps/Test_popup_settext_07.dump 2022-05-29
15:39:43.111186311 +0100
***************
*** 7,10 ****
|~| @73
|~| @73
|~| @73
! |E+0#ffffff16#e000002|7|1|5|:| |D|i|c|t|i|o|n|a|r|y| |r|e|q|u|i|r|e|d|
+0#0000000#ffffff0@31|0|,|0|-|1| @8|A|l@1|
--- 7,10 ----
|~| @73
|~| @73
|~| @73
! |E+0#ffffff16#e000002|1|0|2|4|:| |U|s|i|n|g| |a| |N|u|m|b|e|r| |a|s| |a|
|S|t|r|i|n|g| +0#0000000#ffffff0@23|0|,|0|-|1| @8|A|l@1|
*** ../vim-8.2.5038/src/version.c 2022-05-29 14:12:38.378920226 +0100
--- src/version.c 2022-05-29 15:38:51.827204980 +0100
***************
*** 736,737 ****
--- 736,739 ----
{ /* Add new patch number below this line */
+ /**/
+ 5039,
/**/
--
GUARD #1: Where'd you get the coconut?
ARTHUR: We found them.
GUARD #1: Found them? In Mercea? The coconut's tropical!
ARTHUR: What do you mean?
GUARD #1: Well, this is a temperate zone.
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220529161405.1B9551C1929%40moolenaar.net.