mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 15:28:17 +00:00
vim-patch:9.1.1398: completion: trunc does not follow Pmenu highlighting attributes (#34084)
Problem: When items are combined with user-defined highlight attributes
(e.g., strikethrough), trunc inherits these attributes, making
the text difficult to read.
Solution: trunc now uses the original Pmenu and PmenuSel highlight
attributes (glepnir)
closes: vim/vim#17340
0816f17e9a
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@@ -651,7 +651,9 @@ void pum_redraw(void)
|
||||
|
||||
for (int i = 0; i < pum_height; i++) {
|
||||
int idx = i + pum_first;
|
||||
const hlf_T *const hlfs = (idx == pum_selected) ? hlfsSel : hlfsNorm;
|
||||
const bool selected = idx == pum_selected;
|
||||
const hlf_T *const hlfs = selected ? hlfsSel : hlfsNorm;
|
||||
const int trunc_attr = win_hl_attr(curwin, selected ? HLF_PSI : HLF_PNI);
|
||||
hlf_T hlf = hlfs[0]; // start with "word" highlight
|
||||
int attr = win_hl_attr(curwin, (int)hlf);
|
||||
attr = hl_combine_attr(win_hl_attr(curwin, HLF_PNI), attr);
|
||||
@@ -825,6 +827,7 @@ void pum_redraw(void)
|
||||
grid_line_fill(lcol, grid_col + 1, schar_from_ascii(' '), orig_attr);
|
||||
if (need_fcs_trunc) {
|
||||
linebuf_char[lcol] = fcs_trunc != NUL ? fcs_trunc : schar_from_ascii('<');
|
||||
linebuf_attr[lcol] = trunc_attr;
|
||||
if (pum_width > 1 && linebuf_char[lcol + 1] == NUL) {
|
||||
linebuf_char[lcol + 1] = schar_from_ascii(' ');
|
||||
}
|
||||
@@ -837,6 +840,7 @@ void pum_redraw(void)
|
||||
linebuf_char[rcol - 2] = schar_from_ascii(' ');
|
||||
}
|
||||
linebuf_char[rcol - 1] = fcs_trunc != NUL ? fcs_trunc : schar_from_ascii('>');
|
||||
linebuf_attr[rcol - 1] = trunc_attr;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user