comparison src/popupwin.c @ 16892:60c9ac14a2ec v8.1.1447

patch 8.1.1447: not allowed to create an empty popup commit https://github.com/vim/vim/commit/7b29dd850752b975baef47b66c590f5e978ad847 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 2 13:22:11 2019 +0200 patch 8.1.1447: not allowed to create an empty popup Problem: Not allowed to create an empty popup. Solution: Remove restriction that there is some text. (closes https://github.com/vim/vim/issues/4470)
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Jun 2019 13:30:05 +0200
parents 5131023c5728
children 52fc577a087d
comparison
equal deleted inserted replaced
16891:bdd52b0f05f5 16892:60c9ac14a2ec
486 buf_T *buf; 486 buf_T *buf;
487 dict_T *d; 487 dict_T *d;
488 int nr; 488 int nr;
489 489
490 // Check arguments look OK. 490 // Check arguments look OK.
491 if (!(argvars[0].v_type == VAR_STRING 491 if (!(argvars[0].v_type == VAR_STRING && argvars[0].vval.v_string != NULL)
492 && argvars[0].vval.v_string != NULL 492 && !(argvars[0].v_type == VAR_LIST && argvars[0].vval.v_list != NULL))
493 && STRLEN(argvars[0].vval.v_string) > 0)
494 && !(argvars[0].v_type == VAR_LIST
495 && argvars[0].vval.v_list != NULL
496 && argvars[0].vval.v_list->lv_len > 0))
497 { 493 {
498 emsg(_(e_listreq)); 494 emsg(_(e_listreq));
499 return; 495 return;
500 } 496 }
501 if (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL) 497 if (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL)
558 } 554 }
559 else 555 else
560 { 556 {
561 list_T *l = argvars[0].vval.v_list; 557 list_T *l = argvars[0].vval.v_list;
562 558
563 if (l->lv_first->li_tv.v_type == VAR_STRING) 559 if (l->lv_len > 0)
564 // list of strings 560 {
565 add_popup_strings(buf, l); 561 if (l->lv_first->li_tv.v_type == VAR_STRING)
566 else 562 // list of strings
567 // list of dictionaries 563 add_popup_strings(buf, l);
568 add_popup_dicts(buf, l); 564 else
565 // list of dictionaries
566 add_popup_dicts(buf, l);
567 }
569 } 568 }
570 569
571 // Delete the line of the empty buffer. 570 // Delete the line of the empty buffer.
572 curbuf = buf; 571 curbuf = buf;
573 ml_delete(buf->b_ml.ml_line_count, FALSE); 572 ml_delete(buf->b_ml.ml_line_count, FALSE);