mirror of
https://github.com/neovim/neovim.git
synced 2026-09-16 19:02:11 +00:00
Problem: auto-hiding item groups (minwid==0) are hidden unless they
contain a non-empty normal item or no items at all. In general, normal
items are those that show information: strings, numbers, flags.
Expression items %{...} are also treated as normal, see for example
the terminal exit code in the flags section.
But in contrast, when using re-evaluated expression items %{%...%},
the item group looks for normal items in the expression result.
This is useful for dynamically deciding which items should be in use.
Example: stl=%f%(\ %h%w%{%&buftype==''?'%m%r':''%}%).
But when the result only contains non-normal items like highlights, the
non-emptiness of the result doesn't ensure the item group to be shown.
Example: the diagnostics section uses %{%...%} to add highlighting,
and thus cannot use auto-hiding and has to resort to a non-idiomatic and
verbose solution to add padding between itself and the next section.
Solution: look for normal items (empty or not) in the expression result.
If there are none, treat the whole result as one normal item.
BREAKING CHANGE: it is no longer easily possible to use %{%...%} to add
dynamic content with non-normal items (e.g. highlighting) to an item
group with minwid==0 without influencing auto-hiding.
Workaround: add a dummy empty normal item like %{''} to the result.
Or refactor so that the whole item group is created inside %{%...%}.