Problem: When text with 'leadmultispace' (or other listchars whitespace
characters) is visually selected, the listchar characters do not
render with their designated highlight group (Whitespace/NonText).
They inherit the syntax color of surrounding text instead.
Solution: In win_line(), when attr_pri is set (Visual selection active),
combine extra_attr with char_attr using hl_combine_attr() instead
of skipping the assignment entirely.
fixes: #19872
pwd
/Users/dipayandutta/Developer/vim-official
cat /tmp/repro.vim
─────┬────────────────────────────────────────────────────────────────────────────────────
│ File: /tmp/repro.vim
─────┼────────────────────────────────────────────────────────────────────────────────────
1 │ set nocompatible
2 │ set list
3 │ set listchars=leadmultispace:|\ \ \ <----------
4 │ set expandtab tabstop=4 shiftwidth=4
5 │ highlight Whitespace ctermfg=1
6 │ highlight Visual ctermbg=4
─────┴────────────────────────────────────────────────────────────────────────────────────
cat /tmp/testfile.py
─────┬────────────────────────────────────────────────────────────────────────────────────
│ File: /tmp/testfile.py
─────┼────────────────────────────────────────────────────────────────────────────────────
1 │ def foo():
2 │ if True:
3 │ pass
─────┴───────────────────
src/vim -u /tmp/repro.vim /tmp/testfile.py
image.png (view on web)
https://github.com/vim/vim/pull/19877
(1 file)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
In src/drawline.c:
> + if (wlv.line_attr) + wlv.char_attr = hl_combine_attr(wlv.line_attr, + hl_combine_attr(wlv.extra_attr, wlv.char_attr)); + else #endif - wlv.char_attr = wlv.extra_attr; + wlv.char_attr = hl_combine_attr(wlv.extra_attr, wlv.char_attr);
This gives char_attr higher priority than extra_attr, but previously only extra_attr is used. I wonder if it's better to give extra_attr higher priority instead:
- if (wlv.line_attr) - wlv.char_attr = hl_combine_attr(wlv.line_attr, - hl_combine_attr(wlv.extra_attr, wlv.char_attr)); - else -#endif - wlv.char_attr = wlv.extra_attr; - wlv.char_attr = hl_combine_attr(wlv.extra_attr, wlv.char_attr); + if (wlv.line_attr) + wlv.char_attr = hl_combine_attr(wlv.line_attr, + hl_combine_attr(wlv.char_attr, wlv.extra_attr)); + else +#endif + wlv.char_attr = hl_combine_attr(wlv.char_attr, wlv.extra_attr);
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()