pub fn listing_name_spans(
entries: &[ListingEntry],
reg: &dyn ThemeRegistry,
) -> Vec<Vec<StyledSpan>>Expand description
Build one span per listing row covering the entry NAME, painted with
the same element listing_element_for gives that row’s icon.
DL.8b. The icon alone carried the colour until now, which left every name — including directories — painting as plain text. That was not the design (§2 has the mode owning “the per-row spans and icons”); only the icon half had shipped, and the bespoke painters DL.4/DL.5 deleted did style directory and dotfile names before that.
§Why the whole name, and what that spends
Editor file trees are unanimous the other way: nvim-tree, neo-tree,
oil.nvim, Zed and VS Code all paint the ICON by file type and reserve
the NAME’s colour for state — git status, hidden, symlink,
executable, opened. Colouring the name by type is the terminal-lister
convention (ls --color / eza / lf) and Emacs diredfl.
The louder one is the deliberate choice here, with one constraint:
the language colour is the lowest-precedence layer on a row. Each
line’s span goes LAST in its vector, and style_at_byte is
first-match-wins, so any state span a later slice prepends — git
status, symlink, executable — wins over the language colour without
re-plumbing this. Spending the name channel on type is reversible;
spending it in a way that BLOCKS state would not be.
Rows whose name is empty produce an empty span list rather than a zero-width span, so a degenerate entry cannot leave a stray run.