src/popupwin.c
static void
add_popup_dicts(buf_T *buf, list_T *l)
{
    listitem_T  *li;
    listitem_T  *pli;
    linenr_T    lnum = 0;
    char_u	*p;
    dict_T	*dict;

    // first add the text lines
    for (li = l->lv_first; li != NULL; li = li->li_next)
    {
	if (li->li_tv.v_type != VAR_DICT)
	{
	    emsg(_(e_dictreq));
	    return;
	}
	dict = li->li_tv.vval.v_dict;
	p = dict == NULL ? NULL
			      : dict_get_string(dict, (char_u *)"text", FALSE);
	ml_append_buf(buf, lnum++,
			       p == NULL ? (char_u *)"" : p, (colnr_T)0, TRUE);
    }

    // add the text properties
    lnum = 1;
    for (li = l->lv_first; li != NULL; li = li->li_next, ++lnum)
    {
	dictitem_T	*di;
	list_T		*plist;

	dict = li->li_tv.vval.v_dict;
	di = dict_find(dict, (char_u *)"props", -1);
	if (di != NULL)
	{
	    if (di->di_tv.v_type != VAR_LIST)
	    {
		emsg(_(e_listreq));
		return;
	    }
	    plist = di->di_tv.vval.v_list;
	    if (plist != NULL)
	    {
		for (pli = plist->lv_first; pli != NULL; pli = pli->li_next)
		{
		    if (pli->li_tv.v_type != VAR_DICT)
		    {
			emsg(_(e_dictreq));
			return;
		    }
		    dict = pli->li_tv.vval.v_dict;
		    if (dict != NULL)
		    {
			int col = dict_get_number(dict, (char_u *)"col");

			prop_add_common( lnum, col, dict, buf, NULL);
		    }
		}
	    }
	}
    }
}
/*
 * Add lines to the popup from a list of dictionaries.
 */
Add lines to the popup from a list of dictionaries.
Add lines to the popup from a list of dictionaries .
static void
add_popup_dicts(buf_T *buf, list_T *l)
{
    listitem_T  *li;
    listitem_T  *pli;
    linenr_T    lnum = 0;
    char_u	*p;
    dict_T	*dict;
    for (li = l->lv_first; li != NULL; li = li->li_next)
    {
	if (li->li_tv.v_type != VAR_DICT)
	{
	    emsg(_(e_dictreq));
	    return;
	}
	dict = li->li_tv.vval.v_dict;
	p = dict == NULL ? NULL
			      : dict_get_string(dict, (char_u *)"text", FALSE);
	ml_append_buf(buf, lnum++,
			       p == NULL ? (char_u *)"" : p, (colnr_T)0, TRUE);
    }
    lnum = 1;
    for (li = l->lv_first; li != NULL; li = li->li_next, ++lnum)
    {
	dictitem_T	*di;
	list_T		*plist;
	dict = li->li_tv.vval.v_dict;
	di = dict_find(dict, (char_u *)"props", -1);
	if (di != NULL)
	{
	    if (di->di_tv.v_type != VAR_LIST)
	    {
		emsg(_(e_listreq));
		return;
	    }
	    plist = di->di_tv.vval.v_list;
	    if (plist != NULL)
	    {
		for (pli = plist->lv_first; pli != NULL; pli = pli->li_next)
		{
		    if (pli->li_tv.v_type != VAR_DICT)
		    {
			emsg(_(e_dictreq));
			return;
		    }
		    dict = pli->li_tv.vval.v_dict;
		    if (dict != NULL)
		    {
			int col = dict_get_number(dict, (char_u *)"col");
			prop_add_common( lnum, col, dict, buf, NULL);
		    }
		}
	    }
	}
    }
}
static void add_popup_dicts ( buf_T * buf , list_T * l ) { listitem_T * li ; listitem_T * pli ; linenr_T lnum = 0 ; char_u * p ; dict_T * dict ; for ( li = l -> lv_first ; li != NULL ; li = li -> li_next ) { if ( li -> li_tv . v_type != VAR_DICT ) { emsg ( _ ( e_dictreq ) ) ; return ; } dict = li -> li_tv . vval . v_dict ; p = dict == NULL ? NULL : dict_get_string ( dict , ( char_u * ) " " , FALSE ) ; ml_append_buf ( buf , lnum ++ , p == NULL ? ( char_u * ) " " : p , ( colnr_T ) 0 , TRUE ) ; } lnum = 1 ; for ( li = l -> lv_first ; li != NULL ; li = li -> li_next , ++ lnum ) { dictitem_T * di ; list_T * plist ; dict = li -> li_tv . vval . v_dict ; di = dict_find ( dict , ( char_u * ) " " , -1 ) ; if ( di != NULL ) { if ( di -> di_tv . v_type != VAR_LIST ) { emsg ( _ ( e_listreq ) ) ; return ; } plist = di -> di_tv . vval . v_list ; if ( plist != NULL ) { for ( pli = plist -> lv_first ; pli != NULL ; pli = pli -> li_next ) { if ( pli -> li_tv . v_type != VAR_DICT ) { emsg ( _ ( e_dictreq ) ) ; return ; } dict = pli -> li_tv . vval . v_dict ; if ( dict != NULL ) { int col = dict_get_number ( dict , ( char_u * ) " " ) ; prop_add_common ( lnum , col , dict , buf , NULL ) ; } } } } } }
Add lines to the popup from a list of dictionaries.
Add lines to the popup from a list of dictionaries .
// first add the text lines // add the text properties