Expand description
directory-listing-mode — the minor mode both listing majors
share, owning entry presentation.
Design: docs/dev/architecture/directory-listing-mode.md.
Sequencing: docs/dev/operations/slice-plans/directory-listing-mode.md
(this is DL.2).
§Why a minor rather than two contributions
crate::oil::OilMode and crate::file_tree::FileTreeMode need
identical presentation — a per-row icon and a per-row colour keyed
on what the row points at — while differing in behaviour (oil is
editable and diffs its rope on :w; the tree is read-only and
expands directories). Shared behaviour across two majors is a minor
mode, never the same contribution declared twice.
CV.5 is the bill for not having had one: the identical off-by-scroll
bug sat in both majors’ paint paths, the report named only oil, and
nothing announced that the tree was broken the same way. See
prefer-minor-modes-over-duplication.
§What it owns, and what it does not
Owns the theme-element vocabulary (§4 of the design), the display options a listing pane needs, and — from DL.3 — the per-row icons and spans.
Owns no keymap. <CR> means “open” in the tree and nothing in
oil, so entry navigation is major-owned. A mode owning no chords is
fine; what it must not do is own half of something.
Structs§
- Directory
Listing Mode - The shared presentation minor. See the module docs.
- Listing
Entries - Per-row entry data for a listing buffer, written by whichever major owns the buffer and read by this mode’s presentation.
- Listing
Entry - One row of a listing, in the shape entry presentation needs: where it points and whether it is a directory.
Constants§
- ELEM_
LISTING_ DIR - Directory rows.
- ELEM_
LISTING_ FILE - Theme element every listing row falls back to.
- ELEM_
LISTING_ HIDDEN - Dotfiles.
- LISTING_
LANGUAGE_ ELEMENTS - The per-language elements, as
(element name, palette key).
Functions§
- listing_
element_ for - Which
listing.*element a row resolves to. - listing_
inlays - Build one leading inlay per listing row: the glyph
[
lattice_core::ui::icons::glyph_for_entry] picks, painted with the elementlisting_element_forresolves. - listing_
name_ spans - Build one span per listing row covering the entry NAME, painted with
the same element
listing_element_forgives that row’s icon. - register_
listing_ modes - Register the shared listing minor. Called from the host’s mode boot
beside
oil::register_oil_modes/file_tree::register_file_tree_modes. - register_
listing_ theme_ elements - Register every
listing.*element underowner. Idempotent by name, so re-activation on a second listing buffer is free.