Skip to main content

lattice_listing/
lib.rs

1//! Filesystem entry listings as buffers — the two views the editor
2//! offers over a directory tree.
3//!
4//! - [`oil`] — a flat, **editable** listing of one directory
5//!   (oil.nvim-style). `:w` diffs the rope against a snapshot and
6//!   executes the renames / deletes / creates it implies.
7//! - [`file_tree`] — a hierarchical, **read-only** tree with
8//!   expand/collapse.
9//!
10//! ## Why one crate (DL.0)
11//!
12//! These shipped as `lattice-oil` and `lattice-file-tree` and were
13//! merged, because they are the same domain seen twice rather than two
14//! features that happen to be adjacent:
15//!
16//! - no consumer ever took one without the other — `lattice-host` and
17//!   both renderers depend on both, so the split bought no modularity
18//!   anyone used;
19//! - both carried a directory reader of near-identical shape (DL.7
20//!   converged them onto [`dir::read_dir_sorted`]);
21//! - their entry models (`oil::OilEntry`, `file_tree::FileTreeEntry`)
22//!   are one concept in two shapes.
23//!
24//! That duplication is what let a single arithmetic slip live in four
25//! paint paths (CV.5) and is what the `directory-listing-mode` work
26//! (see `docs/dev/architecture/directory-listing-mode.md`) exists to
27//! remove: one minor mode, activated on both majors, owning the icons
28//! and the theme-rooted highlighting they both need.
29//!
30//! ## What deliberately did NOT converge (DL.7)
31//!
32//! The merge's stated debt was "two directory readers, two rope
33//! renderers, two entry models". Only the first was real:
34//!
35//! - **Entry models stay separate.** [`file_tree::FileTreeEntry`]
36//!   carries `depth` and expansion state because a tree has both;
37//!   [`oil::OilEntry`] is a flat, editable row and has neither.
38//!   Merging them would either bloat oil with fields that mean nothing
39//!   there, or drop the state the tree needs — and the shared shape
40//!   they *both* project into already exists
41//!   ([`listing_mode::ListingEntry`]), which is what the presentation
42//!   layer consumes. There is nothing left to unify.
43//! - **Rope renderers stay separate.** Oil's is bare names joined by
44//!   newlines, because `:w` diffs that text back into filesystem
45//!   operations; the tree's is indent + expand marker + name. Two
46//!   formats, deliberately. What actually mattered — that neither
47//!   embeds icons — is already true, and is what let both move to the
48//!   shared paint path.
49//!
50//! Recorded because "three duplications" reads like unfinished work
51//! otherwise. Two of the three were never duplication.
52//!
53//! **The merge itself changed no behaviour.** The duplicated readers,
54//! renderers and entry models are still duplicated here, deliberately —
55//! converging them is DL.6, and folding it into the move would have
56//! made the move unreviewable. See the slice plan.
57
58pub mod dir;
59pub mod file_tree;
60pub mod install;
61pub mod listing_mode;
62pub mod oil;
63
64pub use install::install;