Patch 8.1.1447

8 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 2, 2019, 7:22:51 AM6/2/19
to vim...@googlegroups.com

Patch 8.1.1447
Problem: Not allowed to create an empty popup.
Solution: Remove restriction that there is some text. (closes #4470)
Files: src/popupwin.c, src/testdir/test_popupwin.vim


*** ../vim-8.1.1446/src/popupwin.c 2019-06-01 22:49:23.697685695 +0200
--- src/popupwin.c 2019-06-02 13:09:37.696928315 +0200
***************
*** 488,499 ****
int nr;

// Check arguments look OK.
! if (!(argvars[0].v_type == VAR_STRING
! && argvars[0].vval.v_string != NULL
! && STRLEN(argvars[0].vval.v_string) > 0)
! && !(argvars[0].v_type == VAR_LIST
! && argvars[0].vval.v_list != NULL
! && argvars[0].vval.v_list->lv_len > 0))
{
emsg(_(e_listreq));
return;
--- 488,495 ----
int nr;

// Check arguments look OK.
! if (!(argvars[0].v_type == VAR_STRING && argvars[0].vval.v_string != NULL)
! && !(argvars[0].v_type == VAR_LIST && argvars[0].vval.v_list != NULL))
{
emsg(_(e_listreq));
return;
***************
*** 560,571 ****
{
list_T *l = argvars[0].vval.v_list;

! if (l->lv_first->li_tv.v_type == VAR_STRING)
! // list of strings
! add_popup_strings(buf, l);
! else
! // list of dictionaries
! add_popup_dicts(buf, l);
}

// Delete the line of the empty buffer.
--- 556,570 ----
{
list_T *l = argvars[0].vval.v_list;

! if (l->lv_len > 0)
! {
! if (l->lv_first->li_tv.v_type == VAR_STRING)
! // list of strings
! add_popup_strings(buf, l);
! else
! // list of dictionaries
! add_popup_dicts(buf, l);
! }
}

// Delete the line of the empty buffer.
*** ../vim-8.1.1446/src/testdir/test_popupwin.vim 2019-06-01 22:49:23.701685671 +0200
--- src/testdir/test_popupwin.vim 2019-06-02 13:19:58.857248458 +0200
***************
*** 596,598 ****
--- 596,612 ----
call popup_close(winid, 'done')
call assert_equal('done', g:result)
endfunc
+
+ func Test_popup_empty()
+ let winid = popup_create('', {'padding': [2,2,2,2]})
+ redraw
+ let pos = popup_getpos(winid)
+ call assert_equal(4, pos.width)
+ call assert_equal(5, pos.height)
+
+ let winid = popup_create([], {'border': []})
+ redraw
+ let pos = popup_getpos(winid)
+ call assert_equal(2, pos.width)
+ call assert_equal(3, pos.height)
+ endfunc
*** ../vim-8.1.1446/src/version.c 2019-06-01 22:49:23.701685671 +0200
--- src/version.c 2019-06-02 13:21:01.044891751 +0200
***************
*** 769,770 ****
--- 769,772 ----
{ /* Add new patch number below this line */
+ /**/
+ 1447,
/**/

--
hundred-and-one symptoms of being an internet addict:
86. E-mail Deficiency Depression (EDD) forces you to e-mail yourself.

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