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))
+ 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;
{
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);
+ 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.
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