Closed kmoschcau closed 7 months ago
The trailing symbols are meant to finish off the highlight section. I think it is hygienic to keep navic's highlights to its own section. Any section that comes after it should defined its highlights on its own, even if it if padding element.
But how am I supposed to remove this cell then? You will always get this if your statusline background uses a different color than the Normal
highlight group. The only other option that remains is to not have padding, which doesn't seem great to me either.
Edit: OK I think I see the problem now. Lualine with its padding does not expect a highlight reset, but if you use it in other ways it would be prudent to use a highlight reset.
Edit2: Not even overriding the color for the navic element in lualine works. Only removing the right side padding works. But yeah I'll just leave it at that. At this point the only other thing I could think of, is for navic to somehow detect it's being used in an environment where the reset is not needed and just not apply it in that case.
For anyone else stumbling across this in the future, I ended up solving it with a lualine component like this:
{
"navic",
fmt = function(text)
return string.gsub(text, "%%%*$", "")
end,
}
This fixes an issue where a single, differently colored cell is showing up in the status line.
I was having this problem that when I set up the highlights of navic to match those of my lualine, I got this:![image](https://github.com/SmiteshP/nvim-navic/assets/9497302/9e40584f-b40b-4a27-973b-04a1ed249789)
After some searching I found out that this is caused by a trailing highlight reset (
%*
), which then causes the following padding added by lualine to be colored differently. When I disabled the right-side padding in my lualine config for this element, the problem also went away. So I figured you are not supposed to reset the final highlight of your lualine element. Thus this change simply removes the last highlight reset from the formatted element string.