fix(statusline): set hl_group for statusline separators #616
+29
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, statusline segments have custom highlight groups, but the separators between the segments don't get any highlight group applied, resulting gaps/discontinuities in the statusline background with most colorschemes. This PR applies the highlight group provided to
trouble.statusline
, if any, to the separators as well as to any segments that don't supply their own highlight group.The fix involves a slight refactor of the
fix_statusline
functionality such that segment hl backgrounds are substituted in advance rather than via post hoc search and replace.I also added a clause to filter out empty segments which would otherwise result in extraneous separators, usually appended to the end of the statusline string. Let me know if these empty segments/extra separators were intentional and I'll revert that change.
Related Issue(s)
The author closed the issue when a workaround was posted, but I figured it would be worthwhile to fix this properly in the plugin.
Screenshots
Before: Note the gap between
open
andview:wait
as well as the double gap afterview:wait
After: The single remaining gap after
view:wait
is due to a bug in lualine.nvim; I'm submitting a PR there tooEDIT: With nvim-lualine/lualine.nvim#1368: No gaps!