diff options
author | glepnir <glephunter@gmail.com> | 2024-07-27 17:57:19 +0800 |
---|---|---|
committer | glepnir <glephunter@gmail.com> | 2024-07-27 18:05:37 +0800 |
commit | f132f8e9d43e3e5f56079bcae40d87b871d7b61b (patch) | |
tree | 83cc7df6dd6a2de04464ece1b9c76e6de0ad00ab /src/nvim/popupmenu.c | |
parent | aa853f362addded400d52d8fdfe5247c300c0e89 (diff) | |
download | rneovim-f132f8e9d43e3e5f56079bcae40d87b871d7b61b.tar.gz rneovim-f132f8e9d43e3e5f56079bcae40d87b871d7b61b.tar.bz2 rneovim-f132f8e9d43e3e5f56079bcae40d87b871d7b61b.zip |
vim-patch:9.1.0618: cannot mark deprecated attributes in completion menu
Problem: cannot mark deprecated attributes in completion menu
Solution: add hl_group to the Dictionary of supported completion fields
(glepnir)
closes: vim/vim#15314
https://github.com/vim/vim/commit/508e7856ec4afc9d6038b14bb6893668268dccab
Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'src/nvim/popupmenu.c')
-rw-r--r-- | src/nvim/popupmenu.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c index 64db351dfa..78952177a6 100644 --- a/src/nvim/popupmenu.c +++ b/src/nvim/popupmenu.c @@ -506,7 +506,7 @@ static int *pum_compute_text_attrs(char *text, hlf_T hlf) /// Displays text on the popup menu with specific attributes. static void pum_grid_puts_with_attrs(int col, int cells, const char *text, int textlen, - const int *attrs) + const int *attrs, int extra_hlattr) { const int col_start = col; const char *ptr = text; @@ -515,6 +515,9 @@ static void pum_grid_puts_with_attrs(int col, int cells, const char *text, int t while (*ptr != NUL && (textlen < 0 || ptr < text + textlen)) { int char_len = utfc_ptr2len(ptr); int attr = attrs[pum_rl ? (col_start + cells - col - 1) : (col - col_start)]; + if (extra_hlattr > 0) { + attr = hl_combine_attr(extra_hlattr , attr); + } grid_line_puts(col, ptr, char_len, attr); col += utf_ptr2cells(ptr); ptr += char_len; @@ -627,6 +630,9 @@ 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); + } int width = 0; char *s = NULL; @@ -685,7 +691,7 @@ void pum_redraw(void) if (attrs == NULL) { grid_line_puts(grid_col - cells + 1, rt, -1, attr); } else { - pum_grid_puts_with_attrs(grid_col - cells + 1, cells, rt, -1, attrs); + pum_grid_puts_with_attrs(grid_col - cells + 1, cells, rt, -1, attrs, pum_array[idx].pum_extrahlattr); } xfree(rt_start); @@ -695,7 +701,7 @@ void pum_redraw(void) if (attrs == NULL) { grid_line_puts(grid_col, st, -1, attr); } else { - pum_grid_puts_with_attrs(grid_col, vim_strsize(st), st, -1, attrs); + pum_grid_puts_with_attrs(grid_col, vim_strsize(st), st, -1, attrs, pum_array[idx].pum_extrahlattr); } xfree(st); |