Expand description
file-tree-mode – major mode for the file-tree buffer + its
BufferLocal-owned per-buffer state (root, entries,
nerd-fonts toggle).
Lives here (rather than in lattice-mode) per the
mode-architecture convention: “a mode lives with the crate
that owns its associated feature.” FileTreeBuffer lives
in this crate, so the mode + the three pieces of
file-tree-mode-owned state live here too.
§What the BufferLocals carry
M.3.2.c.5 made BufferLocals the single source of
truth for per-buffer mode-owned state. FileTreeBuffer
itself carries only the rendered rope + cursor / scroll;
every piece of “what does this buffer point at”
information lives in the three locals declared below:
FileTreeRoot– the directory the tree is rooted at.FileTreeEntries– the flat list of visible entries (root + every expanded subdir’s children). Mutated through the App-side toggle chokepoint that re-renders the rope.FileTreeNerdFonts– whether the rendered rope embeds nerd-font glyphs.
The App reads through these directly; there is no struct mirror to drift.
Structs§
- File
Tree Entries - Flat tree-of-entries backing the file-tree buffer.
Each entry carries its depth + expansion state. The rendered
rope is derived from this list – App-side toggle handlers
mutate the entries through the
[
crate::toggle_entries_at] helper and re-write this local - File
Tree Mode - Major mode for file-tree buffers. Read-only contribution
(
ReadOnly = true); any buffer whose major isfile-tree-moderejects mutating operators. - File
Tree Nerd Fonts - Whether the file-tree renders nerd-font icon glyphs inline.
- File
Tree Root - Filesystem path the file-tree buffer is rooted at. Single source of truth (M.3.2.c.5).
Functions§
- register_
file_ tree_ modes - Register every
lattice-file-tree-owned mode againstregistry. Called from the App’s boot path alongsidelattice_mode::register_foundation_modesetc. Mirrorslattice_oil::register_oil_modes.