Hi,
here is a bug in the highlighting of the statusline, when using group
items:
:set laststatus=2
:let &stl='+foobar+'
(shows "+foobar+"
-> is okay)
:let &stl='+%(foobar%)+'
(shows "+foobar+"
-> is okay)
:let &stl='+%(%#ErrorMsg#foobar%)+'
(shows "++", everything after the second + with error highlighting
-> not okay)
:let &stl='+%(%#WildMenu#««««««%#Normal#%)-%#Statusline#
(shows "+-+ +", starting with the '-' until the third '+'
everything highlighted with WildMenu highlighting
-> not okay)
Screenshots available here:
https://i.imgur.com/n7Sa1gr.png
This is a problem for statusline highlighter plugins, since the colors
leak from one section to the next and make it hard to reproduce. I just
found this problem per accident today, when I wanted to fix another bug
in vim-airline.
This patch fixes it:
diff --git a/src/buffer.c b/src/buffer.c
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3723,7 +3723,7 @@ build_stl_str_hl(
{
/* remove group if all items are empty */
for (n = groupitem[groupdepth] + 1; n < curitem; n++)
- if (item[n].type == Normal)
+ if (item[n].type == Normal || item[n].type == Highlight)
break;
if (n == curitem)
{
Best,
Christian
--
1,9 Prozent sind rechnerisch gesehen auch noch rund zwei Prozent.
-- Bernd Pfaffenbach
(Chefökonom des Bundeskanzleramtes, in der »Börsen-Zeitung« zu den
Aussichten für die Konjunktur in Deutschland)