forked from aniani/vim
patch 8.1.0166: using dict_add_nr_str() is clumsy
Problem: Using dict_add_nr_str() is clumsy. Solution: Split into two functions. (Ozaki Kiichi, closes #3154)
This commit is contained in:
@@ -2809,7 +2809,7 @@ channel_part_info(channel_T *channel, dict_T *dict, char *name, ch_part_T part)
|
|||||||
status = "buffered";
|
status = "buffered";
|
||||||
else
|
else
|
||||||
status = "closed";
|
status = "closed";
|
||||||
dict_add_nr_str(dict, namebuf, 0, (char_u *)status);
|
dict_add_string(dict, namebuf, (char_u *)status);
|
||||||
|
|
||||||
STRCPY(namebuf + tail, "mode");
|
STRCPY(namebuf + tail, "mode");
|
||||||
switch (chanpart->ch_mode)
|
switch (chanpart->ch_mode)
|
||||||
@@ -2819,7 +2819,7 @@ channel_part_info(channel_T *channel, dict_T *dict, char *name, ch_part_T part)
|
|||||||
case MODE_JSON: s = "JSON"; break;
|
case MODE_JSON: s = "JSON"; break;
|
||||||
case MODE_JS: s = "JS"; break;
|
case MODE_JS: s = "JS"; break;
|
||||||
}
|
}
|
||||||
dict_add_nr_str(dict, namebuf, 0, (char_u *)s);
|
dict_add_string(dict, namebuf, (char_u *)s);
|
||||||
|
|
||||||
STRCPY(namebuf + tail, "io");
|
STRCPY(namebuf + tail, "io");
|
||||||
if (part == PART_SOCK)
|
if (part == PART_SOCK)
|
||||||
@@ -2832,22 +2832,22 @@ channel_part_info(channel_T *channel, dict_T *dict, char *name, ch_part_T part)
|
|||||||
case JIO_BUFFER: s = "buffer"; break;
|
case JIO_BUFFER: s = "buffer"; break;
|
||||||
case JIO_OUT: s = "out"; break;
|
case JIO_OUT: s = "out"; break;
|
||||||
}
|
}
|
||||||
dict_add_nr_str(dict, namebuf, 0, (char_u *)s);
|
dict_add_string(dict, namebuf, (char_u *)s);
|
||||||
|
|
||||||
STRCPY(namebuf + tail, "timeout");
|
STRCPY(namebuf + tail, "timeout");
|
||||||
dict_add_nr_str(dict, namebuf, chanpart->ch_timeout, NULL);
|
dict_add_number(dict, namebuf, chanpart->ch_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
channel_info(channel_T *channel, dict_T *dict)
|
channel_info(channel_T *channel, dict_T *dict)
|
||||||
{
|
{
|
||||||
dict_add_nr_str(dict, "id", channel->ch_id, NULL);
|
dict_add_number(dict, "id", channel->ch_id);
|
||||||
dict_add_nr_str(dict, "status", 0, (char_u *)channel_status(channel, -1));
|
dict_add_string(dict, "status", (char_u *)channel_status(channel, -1));
|
||||||
|
|
||||||
if (channel->ch_hostname != NULL)
|
if (channel->ch_hostname != NULL)
|
||||||
{
|
{
|
||||||
dict_add_nr_str(dict, "hostname", 0, (char_u *)channel->ch_hostname);
|
dict_add_string(dict, "hostname", (char_u *)channel->ch_hostname);
|
||||||
dict_add_nr_str(dict, "port", channel->ch_port, NULL);
|
dict_add_number(dict, "port", channel->ch_port);
|
||||||
channel_part_info(channel, dict, "sock", PART_SOCK);
|
channel_part_info(channel, dict, "sock", PART_SOCK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -5737,7 +5737,7 @@ job_info(job_T *job, dict_T *dict)
|
|||||||
list_T *l;
|
list_T *l;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
dict_add_nr_str(dict, "status", 0L, (char_u *)job_status(job));
|
dict_add_string(dict, "status", (char_u *)job_status(job));
|
||||||
|
|
||||||
item = dictitem_alloc((char_u *)"channel");
|
item = dictitem_alloc((char_u *)"channel");
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
@@ -5755,15 +5755,13 @@ job_info(job_T *job, dict_T *dict)
|
|||||||
#else
|
#else
|
||||||
nr = job->jv_proc_info.dwProcessId;
|
nr = job->jv_proc_info.dwProcessId;
|
||||||
#endif
|
#endif
|
||||||
dict_add_nr_str(dict, "process", nr, NULL);
|
dict_add_number(dict, "process", nr);
|
||||||
dict_add_nr_str(dict, "tty_in", 0L,
|
dict_add_string(dict, "tty_in", job->jv_tty_in);
|
||||||
job->jv_tty_in != NULL ? job->jv_tty_in : (char_u *)"");
|
dict_add_string(dict, "tty_out", job->jv_tty_out);
|
||||||
dict_add_nr_str(dict, "tty_out", 0L,
|
|
||||||
job->jv_tty_out != NULL ? job->jv_tty_out : (char_u *)"");
|
|
||||||
|
|
||||||
dict_add_nr_str(dict, "exitval", job->jv_exitval, NULL);
|
dict_add_number(dict, "exitval", job->jv_exitval);
|
||||||
dict_add_nr_str(dict, "exit_cb", 0L, job->jv_exit_cb);
|
dict_add_string(dict, "exit_cb", job->jv_exit_cb);
|
||||||
dict_add_nr_str(dict, "stoponexit", 0L, job->jv_stoponexit);
|
dict_add_string(dict, "stoponexit", job->jv_stoponexit);
|
||||||
|
|
||||||
l = list_alloc();
|
l = list_alloc();
|
||||||
if (l != NULL)
|
if (l != NULL)
|
||||||
|
|||||||
40
src/dict.c
40
src/dict.c
@@ -327,16 +327,11 @@ dict_add(dict_T *d, dictitem_T *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a number or string entry to dictionary "d".
|
* Add a number entry to dictionary "d".
|
||||||
* When "str" is NULL use number "nr", otherwise use "str".
|
|
||||||
* Returns FAIL when out of memory and when key already exists.
|
* Returns FAIL when out of memory and when key already exists.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
dict_add_nr_str(
|
dict_add_number(dict_T *d, char *key, varnumber_T nr)
|
||||||
dict_T *d,
|
|
||||||
char *key,
|
|
||||||
varnumber_T nr,
|
|
||||||
char_u *str)
|
|
||||||
{
|
{
|
||||||
dictitem_T *item;
|
dictitem_T *item;
|
||||||
|
|
||||||
@@ -344,16 +339,31 @@ dict_add_nr_str(
|
|||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
item->di_tv.v_lock = 0;
|
item->di_tv.v_lock = 0;
|
||||||
if (str == NULL)
|
item->di_tv.v_type = VAR_NUMBER;
|
||||||
|
item->di_tv.vval.v_number = nr;
|
||||||
|
if (dict_add(d, item) == FAIL)
|
||||||
{
|
{
|
||||||
item->di_tv.v_type = VAR_NUMBER;
|
dictitem_free(item);
|
||||||
item->di_tv.vval.v_number = nr;
|
return FAIL;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
item->di_tv.v_type = VAR_STRING;
|
|
||||||
item->di_tv.vval.v_string = vim_strsave(str);
|
|
||||||
}
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add a string entry to dictionary "d".
|
||||||
|
* Returns FAIL when out of memory and when key already exists.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
dict_add_string(dict_T *d, char *key, char_u *str)
|
||||||
|
{
|
||||||
|
dictitem_T *item;
|
||||||
|
|
||||||
|
item = dictitem_alloc((char_u *)key);
|
||||||
|
if (item == NULL)
|
||||||
|
return FAIL;
|
||||||
|
item->di_tv.v_lock = 0;
|
||||||
|
item->di_tv.v_type = VAR_STRING;
|
||||||
|
item->di_tv.vval.v_string = str != NULL ? vim_strsave(str) : NULL;
|
||||||
if (dict_add(d, item) == FAIL)
|
if (dict_add(d, item) == FAIL)
|
||||||
{
|
{
|
||||||
dictitem_free(item);
|
dictitem_free(item);
|
||||||
|
|||||||
19
src/edit.c
19
src/edit.c
@@ -4884,18 +4884,13 @@ ins_compl_insert(int in_compl_func)
|
|||||||
dict = dict_alloc_lock(VAR_FIXED);
|
dict = dict_alloc_lock(VAR_FIXED);
|
||||||
if (dict != NULL)
|
if (dict != NULL)
|
||||||
{
|
{
|
||||||
dict_add_nr_str(dict, "word", 0L,
|
dict_add_string(dict, "word", compl_shown_match->cp_str);
|
||||||
EMPTY_IF_NULL(compl_shown_match->cp_str));
|
dict_add_string(dict, "abbr", compl_shown_match->cp_text[CPT_ABBR]);
|
||||||
dict_add_nr_str(dict, "abbr", 0L,
|
dict_add_string(dict, "menu", compl_shown_match->cp_text[CPT_MENU]);
|
||||||
EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_ABBR]));
|
dict_add_string(dict, "kind", compl_shown_match->cp_text[CPT_KIND]);
|
||||||
dict_add_nr_str(dict, "menu", 0L,
|
dict_add_string(dict, "info", compl_shown_match->cp_text[CPT_INFO]);
|
||||||
EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_MENU]));
|
dict_add_string(dict, "user_data",
|
||||||
dict_add_nr_str(dict, "kind", 0L,
|
compl_shown_match->cp_text[CPT_USER_DATA]);
|
||||||
EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_KIND]));
|
|
||||||
dict_add_nr_str(dict, "info", 0L,
|
|
||||||
EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_INFO]));
|
|
||||||
dict_add_nr_str(dict, "user_data", 0L,
|
|
||||||
EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_USER_DATA]));
|
|
||||||
}
|
}
|
||||||
set_vim_var_dict(VV_COMPLETED_ITEM, dict);
|
set_vim_var_dict(VV_COMPLETED_ITEM, dict);
|
||||||
if (!in_compl_func)
|
if (!in_compl_func)
|
||||||
|
|||||||
134
src/evalfunc.c
134
src/evalfunc.c
@@ -4338,9 +4338,9 @@ get_buffer_signs(buf_T *buf, list_T *l)
|
|||||||
|
|
||||||
if (d != NULL)
|
if (d != NULL)
|
||||||
{
|
{
|
||||||
dict_add_nr_str(d, "id", sign->id, NULL);
|
dict_add_number(d, "id", sign->id);
|
||||||
dict_add_nr_str(d, "lnum", sign->lnum, NULL);
|
dict_add_number(d, "lnum", sign->lnum);
|
||||||
dict_add_nr_str(d, "name", 0L, sign_typenr2name(sign->typenr));
|
dict_add_string(d, "name", sign_typenr2name(sign->typenr));
|
||||||
|
|
||||||
list_append_dict(l, d);
|
list_append_dict(l, d);
|
||||||
}
|
}
|
||||||
@@ -4363,18 +4363,16 @@ get_buffer_info(buf_T *buf)
|
|||||||
if (dict == NULL)
|
if (dict == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dict_add_nr_str(dict, "bufnr", buf->b_fnum, NULL);
|
dict_add_number(dict, "bufnr", buf->b_fnum);
|
||||||
dict_add_nr_str(dict, "name", 0L,
|
dict_add_string(dict, "name", buf->b_ffname);
|
||||||
buf->b_ffname != NULL ? buf->b_ffname : (char_u *)"");
|
dict_add_number(dict, "lnum", buf == curbuf ? curwin->w_cursor.lnum
|
||||||
dict_add_nr_str(dict, "lnum", buf == curbuf ? curwin->w_cursor.lnum
|
: buflist_findlnum(buf));
|
||||||
: buflist_findlnum(buf), NULL);
|
dict_add_number(dict, "loaded", buf->b_ml.ml_mfp != NULL);
|
||||||
dict_add_nr_str(dict, "loaded", buf->b_ml.ml_mfp != NULL, NULL);
|
dict_add_number(dict, "listed", buf->b_p_bl);
|
||||||
dict_add_nr_str(dict, "listed", buf->b_p_bl, NULL);
|
dict_add_number(dict, "changed", bufIsChanged(buf));
|
||||||
dict_add_nr_str(dict, "changed", bufIsChanged(buf), NULL);
|
dict_add_number(dict, "changedtick", CHANGEDTICK(buf));
|
||||||
dict_add_nr_str(dict, "changedtick", CHANGEDTICK(buf), NULL);
|
dict_add_number(dict, "hidden",
|
||||||
dict_add_nr_str(dict, "hidden",
|
buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0);
|
||||||
buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Get a reference to buffer variables */
|
/* Get a reference to buffer variables */
|
||||||
dict_add_dict(dict, "variables", buf->b_vars);
|
dict_add_dict(dict, "variables", buf->b_vars);
|
||||||
@@ -4663,10 +4661,10 @@ f_getchangelist(typval_T *argvars, typval_T *rettv)
|
|||||||
return;
|
return;
|
||||||
if (list_append_dict(l, d) == FAIL)
|
if (list_append_dict(l, d) == FAIL)
|
||||||
return;
|
return;
|
||||||
dict_add_nr_str(d, "lnum", (long)buf->b_changelist[i].lnum, NULL);
|
dict_add_number(d, "lnum", (long)buf->b_changelist[i].lnum);
|
||||||
dict_add_nr_str(d, "col", (long)buf->b_changelist[i].col, NULL);
|
dict_add_number(d, "col", (long)buf->b_changelist[i].col);
|
||||||
# ifdef FEAT_VIRTUALEDIT
|
# ifdef FEAT_VIRTUALEDIT
|
||||||
dict_add_nr_str(d, "coladd", (long)buf->b_changelist[i].coladd, NULL);
|
dict_add_number(d, "coladd", (long)buf->b_changelist[i].coladd);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -4790,9 +4788,9 @@ f_getcharsearch(typval_T *argvars UNUSED, typval_T *rettv)
|
|||||||
{
|
{
|
||||||
dict_T *dict = rettv->vval.v_dict;
|
dict_T *dict = rettv->vval.v_dict;
|
||||||
|
|
||||||
dict_add_nr_str(dict, "char", 0L, last_csearch());
|
dict_add_string(dict, "char", last_csearch());
|
||||||
dict_add_nr_str(dict, "forward", last_csearch_forward(), NULL);
|
dict_add_number(dict, "forward", last_csearch_forward());
|
||||||
dict_add_nr_str(dict, "until", last_csearch_until(), NULL);
|
dict_add_number(dict, "until", last_csearch_until());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5193,17 +5191,14 @@ f_getjumplist(typval_T *argvars, typval_T *rettv)
|
|||||||
return;
|
return;
|
||||||
if (list_append_dict(l, d) == FAIL)
|
if (list_append_dict(l, d) == FAIL)
|
||||||
return;
|
return;
|
||||||
dict_add_nr_str(d, "lnum", (long)wp->w_jumplist[i].fmark.mark.lnum,
|
dict_add_number(d, "lnum", (long)wp->w_jumplist[i].fmark.mark.lnum);
|
||||||
NULL);
|
dict_add_number(d, "col", (long)wp->w_jumplist[i].fmark.mark.col);
|
||||||
dict_add_nr_str(d, "col", (long)wp->w_jumplist[i].fmark.mark.col,
|
|
||||||
NULL);
|
|
||||||
# ifdef FEAT_VIRTUALEDIT
|
# ifdef FEAT_VIRTUALEDIT
|
||||||
dict_add_nr_str(d, "coladd", (long)wp->w_jumplist[i].fmark.mark.coladd,
|
dict_add_number(d, "coladd", (long)wp->w_jumplist[i].fmark.mark.coladd);
|
||||||
NULL);
|
|
||||||
# endif
|
# endif
|
||||||
dict_add_nr_str(d, "bufnr", (long)wp->w_jumplist[i].fmark.fnum, NULL);
|
dict_add_number(d, "bufnr", (long)wp->w_jumplist[i].fmark.fnum);
|
||||||
if (wp->w_jumplist[i].fname != NULL)
|
if (wp->w_jumplist[i].fname != NULL)
|
||||||
dict_add_nr_str(d, "filename", 0L, wp->w_jumplist[i].fname);
|
dict_add_string(d, "filename", wp->w_jumplist[i].fname);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -5321,18 +5316,18 @@ f_getmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dict_add_nr_str(dict, "pattern", 0L, cur->pattern);
|
dict_add_string(dict, "pattern", cur->pattern);
|
||||||
}
|
}
|
||||||
dict_add_nr_str(dict, "group", 0L, syn_id2name(cur->hlg_id));
|
dict_add_string(dict, "group", syn_id2name(cur->hlg_id));
|
||||||
dict_add_nr_str(dict, "priority", (long)cur->priority, NULL);
|
dict_add_number(dict, "priority", (long)cur->priority);
|
||||||
dict_add_nr_str(dict, "id", (long)cur->id, NULL);
|
dict_add_number(dict, "id", (long)cur->id);
|
||||||
# if defined(FEAT_CONCEAL) && defined(FEAT_MBYTE)
|
# if defined(FEAT_CONCEAL) && defined(FEAT_MBYTE)
|
||||||
if (cur->conceal_char)
|
if (cur->conceal_char)
|
||||||
{
|
{
|
||||||
char_u buf[MB_MAXBYTES + 1];
|
char_u buf[MB_MAXBYTES + 1];
|
||||||
|
|
||||||
buf[(*mb_char2bytes)((int)cur->conceal_char, buf)] = NUL;
|
buf[(*mb_char2bytes)((int)cur->conceal_char, buf)] = NUL;
|
||||||
dict_add_nr_str(dict, "conceal", 0L, (char_u *)&buf);
|
dict_add_string(dict, "conceal", (char_u *)&buf);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
list_append_dict(rettv->vval.v_list, dict);
|
list_append_dict(rettv->vval.v_list, dict);
|
||||||
@@ -5533,7 +5528,7 @@ get_tabpage_info(tabpage_T *tp, int tp_idx)
|
|||||||
if (dict == NULL)
|
if (dict == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dict_add_nr_str(dict, "tabnr", tp_idx, NULL);
|
dict_add_number(dict, "tabnr", tp_idx);
|
||||||
|
|
||||||
l = list_alloc();
|
l = list_alloc();
|
||||||
if (l != NULL)
|
if (l != NULL)
|
||||||
@@ -5649,23 +5644,23 @@ get_win_info(win_T *wp, short tpnr, short winnr)
|
|||||||
if (dict == NULL)
|
if (dict == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dict_add_nr_str(dict, "tabnr", tpnr, NULL);
|
dict_add_number(dict, "tabnr", tpnr);
|
||||||
dict_add_nr_str(dict, "winnr", winnr, NULL);
|
dict_add_number(dict, "winnr", winnr);
|
||||||
dict_add_nr_str(dict, "winid", wp->w_id, NULL);
|
dict_add_number(dict, "winid", wp->w_id);
|
||||||
dict_add_nr_str(dict, "height", wp->w_height, NULL);
|
dict_add_number(dict, "height", wp->w_height);
|
||||||
#ifdef FEAT_MENU
|
#ifdef FEAT_MENU
|
||||||
dict_add_nr_str(dict, "winbar", wp->w_winbar_height, NULL);
|
dict_add_number(dict, "winbar", wp->w_winbar_height);
|
||||||
#endif
|
#endif
|
||||||
dict_add_nr_str(dict, "width", wp->w_width, NULL);
|
dict_add_number(dict, "width", wp->w_width);
|
||||||
dict_add_nr_str(dict, "bufnr", wp->w_buffer->b_fnum, NULL);
|
dict_add_number(dict, "bufnr", wp->w_buffer->b_fnum);
|
||||||
|
|
||||||
#ifdef FEAT_TERMINAL
|
#ifdef FEAT_TERMINAL
|
||||||
dict_add_nr_str(dict, "terminal", bt_terminal(wp->w_buffer), NULL);
|
dict_add_number(dict, "terminal", bt_terminal(wp->w_buffer));
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_QUICKFIX
|
#ifdef FEAT_QUICKFIX
|
||||||
dict_add_nr_str(dict, "quickfix", bt_quickfix(wp->w_buffer), NULL);
|
dict_add_number(dict, "quickfix", bt_quickfix(wp->w_buffer));
|
||||||
dict_add_nr_str(dict, "loclist",
|
dict_add_number(dict, "loclist",
|
||||||
(bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL), NULL);
|
(bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Add a reference to window variables */
|
/* Add a reference to window variables */
|
||||||
@@ -7652,15 +7647,15 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact)
|
|||||||
char_u *mapmode = map_mode_to_chars(mp->m_mode);
|
char_u *mapmode = map_mode_to_chars(mp->m_mode);
|
||||||
dict_T *dict = rettv->vval.v_dict;
|
dict_T *dict = rettv->vval.v_dict;
|
||||||
|
|
||||||
dict_add_nr_str(dict, "lhs", 0L, lhs);
|
dict_add_string(dict, "lhs", lhs);
|
||||||
dict_add_nr_str(dict, "rhs", 0L, mp->m_orig_str);
|
dict_add_string(dict, "rhs", mp->m_orig_str);
|
||||||
dict_add_nr_str(dict, "noremap", mp->m_noremap ? 1L : 0L , NULL);
|
dict_add_number(dict, "noremap", mp->m_noremap ? 1L : 0L);
|
||||||
dict_add_nr_str(dict, "expr", mp->m_expr ? 1L : 0L, NULL);
|
dict_add_number(dict, "expr", mp->m_expr ? 1L : 0L);
|
||||||
dict_add_nr_str(dict, "silent", mp->m_silent ? 1L : 0L, NULL);
|
dict_add_number(dict, "silent", mp->m_silent ? 1L : 0L);
|
||||||
dict_add_nr_str(dict, "sid", (long)mp->m_script_ID, NULL);
|
dict_add_number(dict, "sid", (long)mp->m_script_ID);
|
||||||
dict_add_nr_str(dict, "buffer", (long)buffer_local, NULL);
|
dict_add_number(dict, "buffer", (long)buffer_local);
|
||||||
dict_add_nr_str(dict, "nowait", mp->m_nowait ? 1L : 0L, NULL);
|
dict_add_number(dict, "nowait", mp->m_nowait ? 1L : 0L);
|
||||||
dict_add_nr_str(dict, "mode", 0L, mapmode);
|
dict_add_string(dict, "mode", mapmode);
|
||||||
|
|
||||||
vim_free(lhs);
|
vim_free(lhs);
|
||||||
vim_free(mapmode);
|
vim_free(mapmode);
|
||||||
@@ -13652,13 +13647,12 @@ f_undotree(typval_T *argvars UNUSED, typval_T *rettv)
|
|||||||
dict_T *dict = rettv->vval.v_dict;
|
dict_T *dict = rettv->vval.v_dict;
|
||||||
list_T *list;
|
list_T *list;
|
||||||
|
|
||||||
dict_add_nr_str(dict, "synced", (long)curbuf->b_u_synced, NULL);
|
dict_add_number(dict, "synced", (long)curbuf->b_u_synced);
|
||||||
dict_add_nr_str(dict, "seq_last", curbuf->b_u_seq_last, NULL);
|
dict_add_number(dict, "seq_last", curbuf->b_u_seq_last);
|
||||||
dict_add_nr_str(dict, "save_last",
|
dict_add_number(dict, "save_last", (long)curbuf->b_u_save_nr_last);
|
||||||
(long)curbuf->b_u_save_nr_last, NULL);
|
dict_add_number(dict, "seq_cur", curbuf->b_u_seq_cur);
|
||||||
dict_add_nr_str(dict, "seq_cur", curbuf->b_u_seq_cur, NULL);
|
dict_add_number(dict, "time_cur", (long)curbuf->b_u_time_cur);
|
||||||
dict_add_nr_str(dict, "time_cur", (long)curbuf->b_u_time_cur, NULL);
|
dict_add_number(dict, "save_cur", (long)curbuf->b_u_save_nr_cur);
|
||||||
dict_add_nr_str(dict, "save_cur", (long)curbuf->b_u_save_nr_cur, NULL);
|
|
||||||
|
|
||||||
list = list_alloc();
|
list = list_alloc();
|
||||||
if (list != NULL)
|
if (list != NULL)
|
||||||
@@ -13882,20 +13876,20 @@ f_winsaveview(typval_T *argvars UNUSED, typval_T *rettv)
|
|||||||
return;
|
return;
|
||||||
dict = rettv->vval.v_dict;
|
dict = rettv->vval.v_dict;
|
||||||
|
|
||||||
dict_add_nr_str(dict, "lnum", (long)curwin->w_cursor.lnum, NULL);
|
dict_add_number(dict, "lnum", (long)curwin->w_cursor.lnum);
|
||||||
dict_add_nr_str(dict, "col", (long)curwin->w_cursor.col, NULL);
|
dict_add_number(dict, "col", (long)curwin->w_cursor.col);
|
||||||
#ifdef FEAT_VIRTUALEDIT
|
#ifdef FEAT_VIRTUALEDIT
|
||||||
dict_add_nr_str(dict, "coladd", (long)curwin->w_cursor.coladd, NULL);
|
dict_add_number(dict, "coladd", (long)curwin->w_cursor.coladd);
|
||||||
#endif
|
#endif
|
||||||
update_curswant();
|
update_curswant();
|
||||||
dict_add_nr_str(dict, "curswant", (long)curwin->w_curswant, NULL);
|
dict_add_number(dict, "curswant", (long)curwin->w_curswant);
|
||||||
|
|
||||||
dict_add_nr_str(dict, "topline", (long)curwin->w_topline, NULL);
|
dict_add_number(dict, "topline", (long)curwin->w_topline);
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
dict_add_nr_str(dict, "topfill", (long)curwin->w_topfill, NULL);
|
dict_add_number(dict, "topfill", (long)curwin->w_topfill);
|
||||||
#endif
|
#endif
|
||||||
dict_add_nr_str(dict, "leftcol", (long)curwin->w_leftcol, NULL);
|
dict_add_number(dict, "leftcol", (long)curwin->w_leftcol);
|
||||||
dict_add_nr_str(dict, "skipcol", (long)curwin->w_skipcol, NULL);
|
dict_add_number(dict, "skipcol", (long)curwin->w_skipcol);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -689,7 +689,7 @@ dbg_parsearg(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ":breakadd".
|
* ":breakadd". Also used for ":profile".
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ex_breakadd(exarg_T *eap)
|
ex_breakadd(exarg_T *eap)
|
||||||
@@ -1497,16 +1497,16 @@ add_timer_info(typval_T *rettv, timer_T *timer)
|
|||||||
return;
|
return;
|
||||||
list_append_dict(list, dict);
|
list_append_dict(list, dict);
|
||||||
|
|
||||||
dict_add_nr_str(dict, "id", timer->tr_id, NULL);
|
dict_add_number(dict, "id", timer->tr_id);
|
||||||
dict_add_nr_str(dict, "time", (long)timer->tr_interval, NULL);
|
dict_add_number(dict, "time", (long)timer->tr_interval);
|
||||||
|
|
||||||
profile_start(&now);
|
profile_start(&now);
|
||||||
remaining = proftime_time_left(&timer->tr_due, &now);
|
remaining = proftime_time_left(&timer->tr_due, &now);
|
||||||
dict_add_nr_str(dict, "remaining", (long)remaining, NULL);
|
dict_add_number(dict, "remaining", (long)remaining);
|
||||||
|
|
||||||
dict_add_nr_str(dict, "repeat",
|
dict_add_number(dict, "repeat",
|
||||||
(long)(timer->tr_repeat < 0 ? -1 : timer->tr_repeat + 1), NULL);
|
(long)(timer->tr_repeat < 0 ? -1 : timer->tr_repeat + 1));
|
||||||
dict_add_nr_str(dict, "paused", (long)(timer->tr_paused), NULL);
|
dict_add_number(dict, "paused", (long)(timer->tr_paused));
|
||||||
|
|
||||||
di = dictitem_alloc((char_u *)"callback");
|
di = dictitem_alloc((char_u *)"callback");
|
||||||
if (di != NULL)
|
if (di != NULL)
|
||||||
|
|||||||
26
src/ops.c
26
src/ops.c
@@ -1723,12 +1723,12 @@ yank_do_autocmd(oparg_T *oap, yankreg_T *reg)
|
|||||||
|
|
||||||
buf[0] = (char_u)oap->regname;
|
buf[0] = (char_u)oap->regname;
|
||||||
buf[1] = NUL;
|
buf[1] = NUL;
|
||||||
dict_add_nr_str(v_event, "regname", 0, buf);
|
dict_add_string(v_event, "regname", buf);
|
||||||
|
|
||||||
buf[0] = get_op_char(oap->op_type);
|
buf[0] = get_op_char(oap->op_type);
|
||||||
buf[1] = get_extra_op_char(oap->op_type);
|
buf[1] = get_extra_op_char(oap->op_type);
|
||||||
buf[2] = NUL;
|
buf[2] = NUL;
|
||||||
dict_add_nr_str(v_event, "operator", 0, buf);
|
dict_add_string(v_event, "operator", buf);
|
||||||
|
|
||||||
buf[0] = NUL;
|
buf[0] = NUL;
|
||||||
buf[1] = NUL;
|
buf[1] = NUL;
|
||||||
@@ -1741,7 +1741,7 @@ yank_do_autocmd(oparg_T *oap, yankreg_T *reg)
|
|||||||
reglen + 1);
|
reglen + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dict_add_nr_str(v_event, "regtype", 0, buf);
|
dict_add_string(v_event, "regtype", buf);
|
||||||
|
|
||||||
/* Lock the dictionary and its keys */
|
/* Lock the dictionary and its keys */
|
||||||
dict_set_items_ro(v_event);
|
dict_set_items_ro(v_event);
|
||||||
@@ -7641,19 +7641,19 @@ cursor_pos_info(dict_T *dict)
|
|||||||
#if defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (dict != NULL)
|
if (dict != NULL)
|
||||||
{
|
{
|
||||||
dict_add_nr_str(dict, "words", word_count, NULL);
|
dict_add_number(dict, "words", word_count);
|
||||||
dict_add_nr_str(dict, "chars", char_count, NULL);
|
dict_add_number(dict, "chars", char_count);
|
||||||
dict_add_nr_str(dict, "bytes", byte_count
|
dict_add_number(dict, "bytes", byte_count
|
||||||
# ifdef FEAT_MBYTE
|
# ifdef FEAT_MBYTE
|
||||||
+ bom_count
|
+ bom_count
|
||||||
# endif
|
# endif
|
||||||
, NULL);
|
);
|
||||||
dict_add_nr_str(dict, VIsual_active ? "visual_bytes" : "cursor_bytes",
|
dict_add_number(dict, VIsual_active ? "visual_bytes" : "cursor_bytes",
|
||||||
byte_count_cursor, NULL);
|
byte_count_cursor);
|
||||||
dict_add_nr_str(dict, VIsual_active ? "visual_chars" : "cursor_chars",
|
dict_add_number(dict, VIsual_active ? "visual_chars" : "cursor_chars",
|
||||||
char_count_cursor, NULL);
|
char_count_cursor);
|
||||||
dict_add_nr_str(dict, VIsual_active ? "visual_words" : "cursor_words",
|
dict_add_number(dict, VIsual_active ? "visual_words" : "cursor_words",
|
||||||
word_count_cursor, NULL);
|
word_count_cursor);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13222,11 +13222,11 @@ get_winbuf_options(int bufopt)
|
|||||||
if (varp != NULL)
|
if (varp != NULL)
|
||||||
{
|
{
|
||||||
if (opt->flags & P_STRING)
|
if (opt->flags & P_STRING)
|
||||||
dict_add_nr_str(d, opt->fullname, 0L, *(char_u **)varp);
|
dict_add_string(d, opt->fullname, *(char_u **)varp);
|
||||||
else if (opt->flags & P_NUM)
|
else if (opt->flags & P_NUM)
|
||||||
dict_add_nr_str(d, opt->fullname, *(long *)varp, NULL);
|
dict_add_number(d, opt->fullname, *(long *)varp);
|
||||||
else
|
else
|
||||||
dict_add_nr_str(d, opt->fullname, *(int *)varp, NULL);
|
dict_add_number(d, opt->fullname, *(int *)varp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ void dictitem_remove(dict_T *dict, dictitem_T *item);
|
|||||||
void dictitem_free(dictitem_T *item);
|
void dictitem_free(dictitem_T *item);
|
||||||
dict_T *dict_copy(dict_T *orig, int deep, int copyID);
|
dict_T *dict_copy(dict_T *orig, int deep, int copyID);
|
||||||
int dict_add(dict_T *d, dictitem_T *item);
|
int dict_add(dict_T *d, dictitem_T *item);
|
||||||
int dict_add_nr_str(dict_T *d, char *key, varnumber_T nr, char_u *str);
|
int dict_add_number(dict_T *d, char *key, varnumber_T nr);
|
||||||
|
int dict_add_string(dict_T *d, char *key, char_u *str);
|
||||||
int dict_add_list(dict_T *d, char *key, list_T *list);
|
int dict_add_list(dict_T *d, char *key, list_T *list);
|
||||||
int dict_add_dict(dict_T *d, char *key, dict_T *dict);
|
int dict_add_dict(dict_T *d, char *key, dict_T *dict);
|
||||||
long dict_len(dict_T *d);
|
long dict_len(dict_T *d);
|
||||||
|
|||||||
@@ -5360,19 +5360,16 @@ get_errorlist(qf_info_T *qi_arg, win_T *wp, int qf_idx, list_T *list)
|
|||||||
|
|
||||||
buf[0] = qfp->qf_type;
|
buf[0] = qfp->qf_type;
|
||||||
buf[1] = NUL;
|
buf[1] = NUL;
|
||||||
if ( dict_add_nr_str(dict, "bufnr", (long)bufnum, NULL) == FAIL
|
if ( dict_add_number(dict, "bufnr", (long)bufnum) == FAIL
|
||||||
|| dict_add_nr_str(dict, "lnum", (long)qfp->qf_lnum, NULL) == FAIL
|
|| dict_add_number(dict, "lnum", (long)qfp->qf_lnum) == FAIL
|
||||||
|| dict_add_nr_str(dict, "col", (long)qfp->qf_col, NULL) == FAIL
|
|| dict_add_number(dict, "col", (long)qfp->qf_col) == FAIL
|
||||||
|| dict_add_nr_str(dict, "vcol", (long)qfp->qf_viscol, NULL) == FAIL
|
|| dict_add_number(dict, "vcol", (long)qfp->qf_viscol) == FAIL
|
||||||
|| dict_add_nr_str(dict, "nr", (long)qfp->qf_nr, NULL) == FAIL
|
|| dict_add_number(dict, "nr", (long)qfp->qf_nr) == FAIL
|
||||||
|| dict_add_nr_str(dict, "module", 0L,
|
|| dict_add_string(dict, "module", qfp->qf_module) == FAIL
|
||||||
qfp->qf_module == NULL ? (char_u *)"" : qfp->qf_module) == FAIL
|
|| dict_add_string(dict, "pattern", qfp->qf_pattern) == FAIL
|
||||||
|| dict_add_nr_str(dict, "pattern", 0L,
|
|| dict_add_string(dict, "text", qfp->qf_text) == FAIL
|
||||||
qfp->qf_pattern == NULL ? (char_u *)"" : qfp->qf_pattern) == FAIL
|
|| dict_add_string(dict, "type", buf) == FAIL
|
||||||
|| dict_add_nr_str(dict, "text", 0L,
|
|| dict_add_number(dict, "valid", (long)qfp->qf_valid) == FAIL)
|
||||||
qfp->qf_text == NULL ? (char_u *)"" : qfp->qf_text) == FAIL
|
|
||||||
|| dict_add_nr_str(dict, "type", 0L, buf) == FAIL
|
|
||||||
|| dict_add_nr_str(dict, "valid", (long)qfp->qf_valid, NULL) == FAIL)
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
qfp = qfp->qf_next;
|
qfp = qfp->qf_next;
|
||||||
@@ -5576,7 +5573,7 @@ qf_getprop_defaults(qf_info_T *qi, int flags, dict_T *retdict)
|
|||||||
int status = OK;
|
int status = OK;
|
||||||
|
|
||||||
if (flags & QF_GETLIST_TITLE)
|
if (flags & QF_GETLIST_TITLE)
|
||||||
status = dict_add_nr_str(retdict, "title", 0L, (char_u *)"");
|
status = dict_add_string(retdict, "title", (char_u *)"");
|
||||||
if ((status == OK) && (flags & QF_GETLIST_ITEMS))
|
if ((status == OK) && (flags & QF_GETLIST_ITEMS))
|
||||||
{
|
{
|
||||||
list_T *l = list_alloc();
|
list_T *l = list_alloc();
|
||||||
@@ -5586,19 +5583,19 @@ qf_getprop_defaults(qf_info_T *qi, int flags, dict_T *retdict)
|
|||||||
status = FAIL;
|
status = FAIL;
|
||||||
}
|
}
|
||||||
if ((status == OK) && (flags & QF_GETLIST_NR))
|
if ((status == OK) && (flags & QF_GETLIST_NR))
|
||||||
status = dict_add_nr_str(retdict, "nr", 0L, NULL);
|
status = dict_add_number(retdict, "nr", 0);
|
||||||
if ((status == OK) && (flags & QF_GETLIST_WINID))
|
if ((status == OK) && (flags & QF_GETLIST_WINID))
|
||||||
status = dict_add_nr_str(retdict, "winid", qf_winid(qi), NULL);
|
status = dict_add_number(retdict, "winid", qf_winid(qi));
|
||||||
if ((status == OK) && (flags & QF_GETLIST_CONTEXT))
|
if ((status == OK) && (flags & QF_GETLIST_CONTEXT))
|
||||||
status = dict_add_nr_str(retdict, "context", 0L, (char_u *)"");
|
status = dict_add_string(retdict, "context", (char_u *)"");
|
||||||
if ((status == OK) && (flags & QF_GETLIST_ID))
|
if ((status == OK) && (flags & QF_GETLIST_ID))
|
||||||
status = dict_add_nr_str(retdict, "id", 0L, NULL);
|
status = dict_add_number(retdict, "id", 0);
|
||||||
if ((status == OK) && (flags & QF_GETLIST_IDX))
|
if ((status == OK) && (flags & QF_GETLIST_IDX))
|
||||||
status = dict_add_nr_str(retdict, "idx", 0L, NULL);
|
status = dict_add_number(retdict, "idx", 0);
|
||||||
if ((status == OK) && (flags & QF_GETLIST_SIZE))
|
if ((status == OK) && (flags & QF_GETLIST_SIZE))
|
||||||
status = dict_add_nr_str(retdict, "size", 0L, NULL);
|
status = dict_add_number(retdict, "size", 0);
|
||||||
if ((status == OK) && (flags & QF_GETLIST_TICK))
|
if ((status == OK) && (flags & QF_GETLIST_TICK))
|
||||||
status = dict_add_nr_str(retdict, "changedtick", 0L, NULL);
|
status = dict_add_number(retdict, "changedtick", 0);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -5609,12 +5606,7 @@ qf_getprop_defaults(qf_info_T *qi, int flags, dict_T *retdict)
|
|||||||
static int
|
static int
|
||||||
qf_getprop_title(qf_info_T *qi, int qf_idx, dict_T *retdict)
|
qf_getprop_title(qf_info_T *qi, int qf_idx, dict_T *retdict)
|
||||||
{
|
{
|
||||||
char_u *t;
|
return dict_add_string(retdict, "title", qi->qf_lists[qf_idx].qf_title);
|
||||||
|
|
||||||
t = qi->qf_lists[qf_idx].qf_title;
|
|
||||||
if (t == NULL)
|
|
||||||
t = (char_u *)"";
|
|
||||||
return dict_add_nr_str(retdict, "title", 0L, t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -5659,7 +5651,7 @@ qf_getprop_ctx(qf_info_T *qi, int qf_idx, dict_T *retdict)
|
|||||||
status = FAIL;
|
status = FAIL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
status = dict_add_nr_str(retdict, "context", 0L, (char_u *)"");
|
status = dict_add_string(retdict, "context", (char_u *)"");
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -5674,7 +5666,7 @@ qf_getprop_idx(qf_info_T *qi, int qf_idx, dict_T *retdict)
|
|||||||
if (qi->qf_lists[qf_idx].qf_count == 0)
|
if (qi->qf_lists[qf_idx].qf_count == 0)
|
||||||
/* For empty lists, qf_index is set to 1 */
|
/* For empty lists, qf_index is set to 1 */
|
||||||
idx = 0;
|
idx = 0;
|
||||||
return dict_add_nr_str(retdict, "idx", idx, NULL);
|
return dict_add_number(retdict, "idx", idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -5709,24 +5701,23 @@ qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict)
|
|||||||
if (flags & QF_GETLIST_TITLE)
|
if (flags & QF_GETLIST_TITLE)
|
||||||
status = qf_getprop_title(qi, qf_idx, retdict);
|
status = qf_getprop_title(qi, qf_idx, retdict);
|
||||||
if ((status == OK) && (flags & QF_GETLIST_NR))
|
if ((status == OK) && (flags & QF_GETLIST_NR))
|
||||||
status = dict_add_nr_str(retdict, "nr", qf_idx + 1, NULL);
|
status = dict_add_number(retdict, "nr", qf_idx + 1);
|
||||||
if ((status == OK) && (flags & QF_GETLIST_WINID))
|
if ((status == OK) && (flags & QF_GETLIST_WINID))
|
||||||
status = dict_add_nr_str(retdict, "winid", qf_winid(qi), NULL);
|
status = dict_add_number(retdict, "winid", qf_winid(qi));
|
||||||
if ((status == OK) && (flags & QF_GETLIST_ITEMS))
|
if ((status == OK) && (flags & QF_GETLIST_ITEMS))
|
||||||
status = qf_getprop_items(qi, qf_idx, retdict);
|
status = qf_getprop_items(qi, qf_idx, retdict);
|
||||||
if ((status == OK) && (flags & QF_GETLIST_CONTEXT))
|
if ((status == OK) && (flags & QF_GETLIST_CONTEXT))
|
||||||
status = qf_getprop_ctx(qi, qf_idx, retdict);
|
status = qf_getprop_ctx(qi, qf_idx, retdict);
|
||||||
if ((status == OK) && (flags & QF_GETLIST_ID))
|
if ((status == OK) && (flags & QF_GETLIST_ID))
|
||||||
status = dict_add_nr_str(retdict, "id", qi->qf_lists[qf_idx].qf_id,
|
status = dict_add_number(retdict, "id", qi->qf_lists[qf_idx].qf_id);
|
||||||
NULL);
|
|
||||||
if ((status == OK) && (flags & QF_GETLIST_IDX))
|
if ((status == OK) && (flags & QF_GETLIST_IDX))
|
||||||
status = qf_getprop_idx(qi, qf_idx, retdict);
|
status = qf_getprop_idx(qi, qf_idx, retdict);
|
||||||
if ((status == OK) && (flags & QF_GETLIST_SIZE))
|
if ((status == OK) && (flags & QF_GETLIST_SIZE))
|
||||||
status = dict_add_nr_str(retdict, "size",
|
status = dict_add_number(retdict, "size",
|
||||||
qi->qf_lists[qf_idx].qf_count, NULL);
|
qi->qf_lists[qf_idx].qf_count);
|
||||||
if ((status == OK) && (flags & QF_GETLIST_TICK))
|
if ((status == OK) && (flags & QF_GETLIST_TICK))
|
||||||
status = dict_add_nr_str(retdict, "changedtick",
|
status = dict_add_number(retdict, "changedtick",
|
||||||
qi->qf_lists[qf_idx].qf_changedtick, NULL);
|
qi->qf_lists[qf_idx].qf_changedtick);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/tag.c
12
src/tag.c
@@ -905,11 +905,11 @@ do_tag(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
dict_add_nr_str(dict, "text", 0L, tag_name);
|
dict_add_string(dict, "text", tag_name);
|
||||||
dict_add_nr_str(dict, "filename", 0L, fname);
|
dict_add_string(dict, "filename", fname);
|
||||||
dict_add_nr_str(dict, "lnum", lnum, NULL);
|
dict_add_number(dict, "lnum", lnum);
|
||||||
if (lnum == 0)
|
if (lnum == 0)
|
||||||
dict_add_nr_str(dict, "pattern", 0L, cmd);
|
dict_add_string(dict, "pattern", cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, "ltag %s", tag);
|
vim_snprintf((char *)IObuff, IOSIZE, "ltag %s", tag);
|
||||||
@@ -3923,7 +3923,7 @@ add_tag_field(
|
|||||||
vim_strncpy(buf, start, len);
|
vim_strncpy(buf, start, len);
|
||||||
}
|
}
|
||||||
buf[len] = NUL;
|
buf[len] = NUL;
|
||||||
retval = dict_add_nr_str(dict, field_name, 0L, buf);
|
retval = dict_add_string(dict, field_name, buf);
|
||||||
vim_free(buf);
|
vim_free(buf);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -3968,7 +3968,7 @@ get_tags(list_T *list, char_u *pat, char_u *buf_fname)
|
|||||||
tp.command_end) == FAIL
|
tp.command_end) == FAIL
|
||||||
|| add_tag_field(dict, "kind", tp.tagkind,
|
|| add_tag_field(dict, "kind", tp.tagkind,
|
||||||
tp.tagkind_end) == FAIL
|
tp.tagkind_end) == FAIL
|
||||||
|| dict_add_nr_str(dict, "static", is_static, NULL) == FAIL)
|
|| dict_add_number(dict, "static", is_static) == FAIL)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
|
||||||
vim_free(full_fname);
|
vim_free(full_fname);
|
||||||
|
|||||||
@@ -4729,11 +4729,11 @@ f_term_getcursor(typval_T *argvars, typval_T *rettv)
|
|||||||
d = dict_alloc();
|
d = dict_alloc();
|
||||||
if (d != NULL)
|
if (d != NULL)
|
||||||
{
|
{
|
||||||
dict_add_nr_str(d, "visible", term->tl_cursor_visible, NULL);
|
dict_add_number(d, "visible", term->tl_cursor_visible);
|
||||||
dict_add_nr_str(d, "blink", blink_state_is_inverted()
|
dict_add_number(d, "blink", blink_state_is_inverted()
|
||||||
? !term->tl_cursor_blink : term->tl_cursor_blink, NULL);
|
? !term->tl_cursor_blink : term->tl_cursor_blink);
|
||||||
dict_add_nr_str(d, "shape", term->tl_cursor_shape, NULL);
|
dict_add_number(d, "shape", term->tl_cursor_shape);
|
||||||
dict_add_nr_str(d, "color", 0L, cursor_color_get(term->tl_cursor_color));
|
dict_add_string(d, "color", cursor_color_get(term->tl_cursor_color));
|
||||||
list_append_dict(l, d);
|
list_append_dict(l, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5059,18 +5059,17 @@ f_term_scrape(typval_T *argvars, typval_T *rettv)
|
|||||||
break;
|
break;
|
||||||
list_append_dict(l, dcell);
|
list_append_dict(l, dcell);
|
||||||
|
|
||||||
dict_add_nr_str(dcell, "chars", 0, mbs);
|
dict_add_string(dcell, "chars", mbs);
|
||||||
|
|
||||||
vim_snprintf((char *)rgb, 8, "#%02x%02x%02x",
|
vim_snprintf((char *)rgb, 8, "#%02x%02x%02x",
|
||||||
fg.red, fg.green, fg.blue);
|
fg.red, fg.green, fg.blue);
|
||||||
dict_add_nr_str(dcell, "fg", 0, rgb);
|
dict_add_string(dcell, "fg", rgb);
|
||||||
vim_snprintf((char *)rgb, 8, "#%02x%02x%02x",
|
vim_snprintf((char *)rgb, 8, "#%02x%02x%02x",
|
||||||
bg.red, bg.green, bg.blue);
|
bg.red, bg.green, bg.blue);
|
||||||
dict_add_nr_str(dcell, "bg", 0, rgb);
|
dict_add_string(dcell, "bg", rgb);
|
||||||
|
|
||||||
dict_add_nr_str(dcell, "attr",
|
dict_add_number(dcell, "attr", cell2attr(attrs, fg, bg));
|
||||||
cell2attr(attrs, fg, bg), NULL);
|
dict_add_number(dcell, "width", width);
|
||||||
dict_add_nr_str(dcell, "width", width, NULL);
|
|
||||||
|
|
||||||
++pos.col;
|
++pos.col;
|
||||||
if (width == 2)
|
if (width == 2)
|
||||||
|
|||||||
10
src/undo.c
10
src/undo.c
@@ -3567,14 +3567,14 @@ u_eval_tree(u_header_T *first_uhp, list_T *list)
|
|||||||
dict = dict_alloc();
|
dict = dict_alloc();
|
||||||
if (dict == NULL)
|
if (dict == NULL)
|
||||||
return;
|
return;
|
||||||
dict_add_nr_str(dict, "seq", uhp->uh_seq, NULL);
|
dict_add_number(dict, "seq", uhp->uh_seq);
|
||||||
dict_add_nr_str(dict, "time", (long)uhp->uh_time, NULL);
|
dict_add_number(dict, "time", (long)uhp->uh_time);
|
||||||
if (uhp == curbuf->b_u_newhead)
|
if (uhp == curbuf->b_u_newhead)
|
||||||
dict_add_nr_str(dict, "newhead", 1, NULL);
|
dict_add_number(dict, "newhead", 1);
|
||||||
if (uhp == curbuf->b_u_curhead)
|
if (uhp == curbuf->b_u_curhead)
|
||||||
dict_add_nr_str(dict, "curhead", 1, NULL);
|
dict_add_number(dict, "curhead", 1);
|
||||||
if (uhp->uh_save_nr > 0)
|
if (uhp->uh_save_nr > 0)
|
||||||
dict_add_nr_str(dict, "save", uhp->uh_save_nr, NULL);
|
dict_add_number(dict, "save", uhp->uh_save_nr);
|
||||||
|
|
||||||
if (uhp->uh_alt_next.ptr != NULL)
|
if (uhp->uh_alt_next.ptr != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -789,6 +789,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
166,
|
||||||
/**/
|
/**/
|
||||||
165,
|
165,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user