Build lane chrome — title bar, badge, inline rename
The lane title bar becomes real: leading SF Symbol (hand-written names render leniently, unknown ones fall back to the level default), title or secondary untitled placeholder, a quiet count badge that counts exactly the cards the body renders (so the m5 search filter is followed by construction), and a new-card button. The whole bar is the reorder drag surface — no grip — with click-vs-movement splitting select from drag; a pure proposal function maps the drag to an insertion index and release commits through the Writer's same-parent degenerate reorder, compacting and retrying when midpoint precision runs out. Clicking never edits: inline rename is Return on the sole selected card or Board > Rename for either kind, a third transient editor beside the placeholder that tracks its target by UUID, commits on focus loss, discards silently when the target vanishes, and removes the title key on an empty commit. The new-card placeholder renders at last — the settled Cmd-N target rule (pure, tested) files it after the anchor card, at a selected lane's bottom, or into the last-active lane; Return commits and re-selects the lane, Cmd-Return also opens the card window, and a failed create discards the overlay. New Card / New Lane / Rename land in the menus with focused-editor and read-only validation; rename gets its own WriteOperation case in the banner vocabulary. 59 new tests. Claude-Session: https://claude.ai/code/session_01SR4XGjmBE16ZUYWpfFHXwY
This commit is contained in:
@@ -38,6 +38,29 @@ enum Ranks: Sendable {
|
||||
return mid
|
||||
}
|
||||
|
||||
/// The rank an item takes when it lands at display position `index` among `orders` — the
|
||||
/// visible siblings it is joining, **in display order and with the item itself already
|
||||
/// excluded**.
|
||||
///
|
||||
/// One function for the three cases every insertion gesture has (a lane drag's release, a
|
||||
/// drop between two cards, ⌘N's after-the-anchor position), so no call site re-derives which
|
||||
/// of `insertAtHead`/`midpoint`/`append` its position calls for:
|
||||
///
|
||||
/// - at or before the head → `insertAtHead(ofVisible:)`;
|
||||
/// - at or past the end (an empty `orders` included) → `append(toVisible:)`;
|
||||
/// - between two siblings → their `midpoint`.
|
||||
///
|
||||
/// **`nil` means the gap is exhausted, not that the insertion is illegal**: `midpoint` returns
|
||||
/// no value when two neighbours are adjacent `Double`s or share an order (the duplicate-order
|
||||
/// tie). That is the renumber trigger (01-storage-format.md § Ordering) and the caller's cue to
|
||||
/// compact and ask again — never something to paper over with an arbitrary rank, which would
|
||||
/// silently reorder the board.
|
||||
static func insertionRank(amongVisible orders: [Double], at index: Int) -> Double? {
|
||||
if orders.isEmpty || index >= orders.count { return append(toVisible: orders) }
|
||||
if index <= 0 { return insertAtHead(ofVisible: orders) }
|
||||
return midpoint(between: orders[index - 1], and: orders[index])
|
||||
}
|
||||
|
||||
/// `count` fresh ranks, whole multiples of 1024 in ascending order
|
||||
/// (1024, 2048, …) — the renumber target when midpoint precision is
|
||||
/// exhausted. Deterministic by construction; the writer applies these,
|
||||
|
||||
Reference in New Issue
Block a user