diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/cmdexpand.c | 2 | ||||
-rw-r--r-- | src/nvim/insexpand.c | 20 | ||||
-rw-r--r-- | src/nvim/popupmenu.c | 14 | ||||
-rw-r--r-- | src/nvim/popupmenu.h | 2 |
4 files changed, 20 insertions, 18 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index fe1199e69a..e1a282cb0b 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -356,7 +356,7 @@ static int cmdline_pum_create(CmdlineInfo *ccline, expand_T *xp, char **matches, .pum_info = NULL, .pum_extra = NULL, .pum_kind = NULL, - .pum_extrahlattr = -1, + .pum_user_hlattr = -1, }; } diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index f72167cfcb..d9cc398e45 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -171,7 +171,7 @@ struct compl_S { int cp_flags; ///< CP_ values int cp_number; ///< sequence number int cp_score; ///< fuzzy match score - int cp_extrahlattr; ///< extra extra highlight group attr + int cp_user_hlattr; ///< highlight attribute to combine with }; /// state information used for getting the next set of insert completion @@ -804,7 +804,7 @@ static inline void free_cptext(char *const *const cptext) /// returned in case of error. static int ins_compl_add(char *const str, int len, char *const fname, char *const *const cptext, const bool cptext_allocated, typval_T *user_data, const Direction cdir, - int flags_arg, const bool adup, int extra_hlattr) + int flags_arg, const bool adup, int user_hlattr) FUNC_ATTR_NONNULL_ARG(1) { compl_T *match; @@ -870,7 +870,7 @@ static int ins_compl_add(char *const str, int len, char *const fname, char *cons match->cp_fname = NULL; } match->cp_flags = flags; - match->cp_extrahlattr = extra_hlattr; + match->cp_user_hlattr = user_hlattr; if (cptext != NULL) { int i; @@ -1271,7 +1271,7 @@ static int ins_compl_build_pum(void) compl_match_array[i].pum_kind = comp->cp_text[CPT_KIND]; compl_match_array[i].pum_info = comp->cp_text[CPT_INFO]; compl_match_array[i].pum_score = comp->cp_score; - compl_match_array[i].pum_extrahlattr = comp->cp_extrahlattr; + compl_match_array[i].pum_user_hlattr = comp->cp_user_hlattr; if (comp->cp_text[CPT_MENU] != NULL) { compl_match_array[i++].pum_extra = comp->cp_text[CPT_MENU]; } else { @@ -2556,8 +2556,8 @@ static int ins_compl_add_tv(typval_T *const tv, const Direction dir, bool fast) bool empty = false; int flags = fast ? CP_FAST : 0; char *(cptext[CPT_COUNT]); - char *extra_hlname = NULL; - int extra_hlattr = -1; + char *user_hlname = NULL; + int user_hlattr = -1; typval_T user_data; user_data.v_type = VAR_UNKNOWN; @@ -2567,9 +2567,9 @@ static int ins_compl_add_tv(typval_T *const tv, const Direction dir, bool fast) cptext[CPT_MENU] = tv_dict_get_string(tv->vval.v_dict, "menu", true); cptext[CPT_KIND] = tv_dict_get_string(tv->vval.v_dict, "kind", true); cptext[CPT_INFO] = tv_dict_get_string(tv->vval.v_dict, "info", true); - extra_hlname = tv_dict_get_string(tv->vval.v_dict, "hl_group", false); - if (extra_hlname != NULL && *extra_hlname != NUL) { - extra_hlattr = syn_name2attr(extra_hlname); + user_hlname = tv_dict_get_string(tv->vval.v_dict, "hl_group", false); + if (user_hlname != NULL && *user_hlname != NUL) { + user_hlattr = syn_name2attr(user_hlname); } tv_dict_get_tv(tv->vval.v_dict, "user_data", &user_data); @@ -2592,7 +2592,7 @@ static int ins_compl_add_tv(typval_T *const tv, const Direction dir, bool fast) return FAIL; } int status = ins_compl_add((char *)word, -1, NULL, cptext, true, - &user_data, dir, flags, dup, extra_hlattr); + &user_data, dir, flags, dup, user_hlattr); if (status != OK) { tv_clear(&user_data); } diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c index 5fee636020..a259fbf09b 100644 --- a/src/nvim/popupmenu.c +++ b/src/nvim/popupmenu.c @@ -440,7 +440,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i /// Computes attributes of text on the popup menu. /// Returns attributes for every cell, or NULL if all attributes are the same. -static int *pum_compute_text_attrs(char *text, hlf_T hlf, int extra_hlattr) +static int *pum_compute_text_attrs(char *text, hlf_T hlf, int user_hlattr) { if ((hlf != HLF_PSI && hlf != HLF_PNI) || (win_hl_attr(curwin, HLF_PMSI) == win_hl_attr(curwin, HLF_PSI) @@ -486,8 +486,9 @@ static int *pum_compute_text_attrs(char *text, hlf_T hlf, int extra_hlattr) } else if (matched_start && ptr < text + leader_len) { new_attr = win_hl_attr(curwin, hlf == HLF_PSI ? HLF_PMSI : HLF_PMNI); } - if (extra_hlattr > 0) { - new_attr = hl_combine_attr(new_attr, extra_hlattr); + + if (user_hlattr > 0) { + new_attr = hl_combine_attr(new_attr, user_hlattr); } int char_cells = utf_ptr2cells(ptr); @@ -630,8 +631,8 @@ void pum_redraw(void) for (int round = 0; round < 3; round++) { hlf = hlfs[round]; attr = win_hl_attr(curwin, (int)hlf); - if (pum_array[idx].pum_extrahlattr > 0) { - attr = hl_combine_attr(attr, pum_array[idx].pum_extrahlattr); + if (pum_array[idx].pum_user_hlattr > 0) { + attr = hl_combine_attr(attr, pum_array[idx].pum_user_hlattr); } int width = 0; char *s = NULL; @@ -666,7 +667,8 @@ void pum_redraw(void) *p = saved; } - int *attrs = pum_compute_text_attrs(st, hlf, pum_array[idx].pum_extrahlattr); + int user_hlattr = pum_array[idx].pum_user_hlattr; + int *attrs = pum_compute_text_attrs(st, hlf, user_hlattr); if (pum_rl) { char *rt = reverse_text(st); diff --git a/src/nvim/popupmenu.h b/src/nvim/popupmenu.h index 57b65eaf87..817e0ba0b1 100644 --- a/src/nvim/popupmenu.h +++ b/src/nvim/popupmenu.h @@ -16,7 +16,7 @@ typedef struct { char *pum_info; ///< extra info int pum_score; ///< fuzzy match score int pum_idx; ///< index of item before sorting by score - int pum_extrahlattr; ///< extra highlight group attr for combine + int pum_user_hlattr; ///< highlight attribute to combine with } pumitem_T; EXTERN ScreenGrid pum_grid INIT( = SCREEN_GRID_INIT); |