diff options
| author | Sébastien Hoffmann <contact@shoffmann.dev> | 2026-09-11 07:44:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-11 01:44:29 -0400 |
| commit | 8aa75843da5aa9b5ffa3e7c2d1238a4344ac37b1 (patch) | |
| tree | bb132f29691a827b72765379af06ba851665550f /runtime/lua/vim/async/_queue.lua | |
| parent | 1d79874a2c69b0c5d4327f99c4c178556e3f7656 (diff) | |
| download | rneovim-8aa75843da5aa9b5ffa3e7c2d1238a4344ac37b1.tar.gz rneovim-8aa75843da5aa9b5ffa3e7c2d1238a4344ac37b1.tar.bz2 rneovim-8aa75843da5aa9b5ffa3e7c2d1238a4344ac37b1.zip | |
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 %{%...%}.
Diffstat (limited to 'runtime/lua/vim/async/_queue.lua')
0 files changed, 0 insertions, 0 deletions