Skip to main content

entry_visual

Function entry_visual 

Source
pub fn entry_visual(
    path: &Path,
    is_dir: bool,
    nerd_fonts: bool,
) -> (&'static str, IconColor)
Expand description

Resolve (glyph, colour) for a directory or file entry.

is_dir selects the directory branch (folder glyph regardless of name); for files the lookup falls through name → extension → default. nerd_fonts == false returns a BMP-block fallback glyph (◆ ≡ ◇ ■ ♪ ▶ · – one per file family) with the colour still resolved per type.

Directories in BMP-fallback mode get ▤ (U+25A4, Geometric Shapes – present in every modern monospace font, and a drawer of files is what it reads as).

This returned two blank spaces until 2026-08-16. The reasoning was that the file tree already emits ▾ / ▸ as its expansion-state marker, so a folder glyph would be redundant – and that the one BMP glyph that obviously reads as “folder” is the same right-pointing triangle ▸, which would render a collapsed row as ▸ ▸ name, two identical arrows back to back.

Both points are true of the TREE and neither is true of oil, whose rows are bare filenames with no marker at all (its icon_byte is 0). So in BMP mode – the DEFAULT, since ui.nerd_fonts is opt-in – an oil directory was the only entry in the listing with no glyph, while every file had one. The collision constraint is real; the conclusion “therefore nothing” was drawn from the tree alone and applied to both.

▤ satisfies the constraint properly: it collides with neither expansion marker nor any file-family glyph, so the tree reads ▸ ▤ name – state + kind + name, the nvim-tree / VS Code convention – and oil reads ▤ name. Two cells wide like every file glyph, so the name column never shifts between row kinds.

Nerd-fonts mode keeps the distinct folder glyph (󰉋 is a private-use codepoint that doesn’t collide with the geometric-shape marker), so directories there read as ▸ 󰉋 name – marker + folder picto + name – which is the convention nvim-tree and VS Code follow. DL.6: the colour half has no consumers left. directory-listing-mode resolves entry colour through registered listing.* theme elements now, so a theme owns the palette; this table’s IconColor is only still reachable because the glyph and the colour are produced by the same ~200-arm match and splitting them is churn without a user-visible win. New callers want glyph_for_entry plus a theme element — not this.