diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-07-27 21:44:05 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-07-27 21:56:44 +0800 |
commit | b8b0e9db3f91fbaa8835b90c683c33310064c8c8 (patch) | |
tree | 350d237bd0f5f74fe146b8b73f83243ec4d3d56a /src/nvim/popupmenu.c | |
parent | 985c636aa6dfcec2a1b788549c3f3ac058c8d141 (diff) | |
download | rneovim-b8b0e9db3f91fbaa8835b90c683c33310064c8c8.tar.gz rneovim-b8b0e9db3f91fbaa8835b90c683c33310064c8c8.tar.bz2 rneovim-b8b0e9db3f91fbaa8835b90c683c33310064c8c8.zip |
vim-patch:9.1.0629: Rename of pum hl_group is incomplete
Problem: Rename of pum hl_group is incomplete in source.
Solution: Also rename the test function. Rename to user_hlattr in code
to avoid confusion with pum_extra. Add test with matched text
highlighting (zeertzjq).
closes: vim/vim#15348
https://github.com/vim/vim/commit/4100852e099133a0c9603e1087e5dc6d82001ce7
Diffstat (limited to 'src/nvim/popupmenu.c')
-rw-r--r-- | src/nvim/popupmenu.c | 14 |
1 files changed, 8 insertions, 6 deletions
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); |