Build the full-visibility lane layout
The lane strip replaces the placeholder board: window width divides
across the lanes' width units (no horizontal scroll, no minimum width,
degenerate compression accepted), a lane of n units flowing its cards
into n round-robin masonry columns via a measurement-cached Layout.
Width has two deliberately opposite controls, both landing here: the
right-edge drag (ported verbatim from the pathfinder's ColumnResize)
freezes the 1x standard at drag start, snaps between integer widths
with the asymmetric shadow-leads tick and 10pt re-entry, grows the
window one standard width per snap so siblings keep their exact
pixels, and rubber-bands at the screen's visible frame — uncapped
otherwise; the Increase/Decrease Lane Width items (new Board menu,
Cmd-Opt-arrows) are the stepper's keyboard face and re-divide the
existing window width instead, never touching the window. Width
changes write through the new .resize WriteOperation ("Couldn't
resize…" in the banner vocabulary, which grows with the surfaces by
design); malformed width values render as one unit and stay untouched
on disk. 27 new tests port the pathfinder's resize-math suite onto
the uncapped range and pin the write path's fidelity.
Claude-Session: https://claude.ai/code/session_01SR4XGjmBE16ZUYWpfFHXwY
This commit is contained in:
@@ -605,6 +605,46 @@ public final class BoardStore {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Lane width
|
||||
|
||||
/// Writes a lane's width — the one commit point both width mechanisms share (03-board-ui.md §
|
||||
/// Lane): the right-edge drag's release and the stepper's ⌥⌘→/⌥⌘← both land here, and they differ
|
||||
/// only in what they did to the *window* on the way (the drag grew it, the stepper did not).
|
||||
///
|
||||
/// **The value written is an integer, replacing whatever was there.** `width` is a lenient field
|
||||
/// on the read side — missing, malformed, zero and negative all render as one unit
|
||||
/// (`LaneLayoutMath.displayUnits`) with the author's bytes left alone — but an explicit width
|
||||
/// change is the user overwriting that value, so the Writer puts a plain integer in its place
|
||||
/// (01-storage-format.md § Frontmatter).
|
||||
///
|
||||
/// Three ways this does nothing, all deliberate: a count below 1 clamps to 1 (a lane spans at
|
||||
/// least one unit), an id that is not in the snapshot is ignored (the lane vanished under the
|
||||
/// gesture — the reload that removed it is the authority), and a count already equal to what the
|
||||
/// lane displays writes nothing (a drag that ends where it started must not stamp `modified` or
|
||||
/// mint a git commit).
|
||||
///
|
||||
/// Failures are already the banner's: `performWrite` posts every `BoardWriteError` before it
|
||||
/// rethrows, so the rethrow is swallowed here rather than propagated to a gesture that has no
|
||||
/// second thing to do about it. The lane stays at its old width, which is the truth — nothing was
|
||||
/// written.
|
||||
public func setLaneWidth(_ id: ItemID, units: Int) {
|
||||
let clamped = max(1, units)
|
||||
guard let lane = snapshot.lanes.first(where: { $0.id == id }),
|
||||
LaneLayoutMath.displayUnits(of: lane) != clamped
|
||||
else { return }
|
||||
|
||||
let folder = rootURL.appendingPathComponent(id.rawValue)
|
||||
// The closure's signature is spelled out because of `try?`: with the error discarded at the
|
||||
// call site Swift stops inferring the typed `throws(BoardWriteError)` and widens it to `any
|
||||
// Error`, which `performWrite` will not take. Same wart as the value-returning call sites
|
||||
// `performWrite`'s doc comment records, arriving from the other direction.
|
||||
try? performWrite { () throws(BoardWriteError) -> Void in
|
||||
try BoardWriter.updateIndex(inItemFolder: folder, operation: .resize(title: nil)) { document in
|
||||
document.set(FrontmatterKeys.width, to: .int(clamped))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Selection (delegated)
|
||||
|
||||
// The three thin pass-throughs to `transient`, and the only ones.
|
||||
|
||||
Reference in New Issue
Block a user