Files
neovim/test/unit
Sébastien Hoffmann 8aa75843da fix(statusline)!: usefulness of %{%...%} in auto-hiding item groups #41817
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 %{%...%}.
2026-09-11 01:44:29 -04:00
..
2026-08-07 19:54:29 -04:00