feat(fix-cards): jump to the anchor

Jump on a Fix Card selects the anchor's span in the piece's
editor and makes the main window key (#204). The span is the
card's quote at its 1-based occurrence, resolved against the
LIVE session text so a dirty buffer still lands, and it rides
the reading flip-back's caret rail: caretHint widens from a
(location, token) tuple to FixCardRevealRequest (SwiftLint
large_tuple), one shared token counter so a jump and a flip-back
can never collide, a zero-length range stays a bare caret and a
non-zero range selects. A jump leaves reading mode first
(reading = false, not exitReading, which stamps its own
zero-length hint), writes nothing, and re-fires per click.

The palette offers Jump on every non-stale card that still shows
an action row; stale anchors have nothing to land on. The
landing math is ProseTextView.landingSpan - a bare caret hops
past leading blanks, a span never does (a quote that IS the
leading blanks selects those blanks) - and appliedText now
routes through anchorRange so Apply and Jump share one
occurrence math.

Two review rounds closed the view-layer gaps the pure pins
could not see: a jump dropped in reading mode; a main window
that never became key (NSApp.activate is a no-op once the
palette's click activated the app - the Coordinator makes
tv.window key instead); a cursor record taken before the scroll.

+3 tests (anchorRange occurrence math with a UTF-16 fixture, the
model's reveal stamp, landingSpan), each flip-verified. Rail
732/732; SwiftFormat and SwiftLint clean. DOX: Museion/AGENTS,
MuseionTests/AGENTS, GLOSSARY gains Jump.
This commit is contained in:
AlexKucera committed 2026-12-03 17:48:55 +01:00
1 parent d183d735d7
commit 97893147a6
10 files changed
+259 -52

No files matched your search

+20 -11
View File
@@ -3,8 +3,8 @@
// Museion
//
// #25 (S3.3): the Fix Cards palette becomes the card work surface. Open
// cards lead with their actions — Apply (a blocking ask), Skip, Done —
// closed cards dim behind them. No apply-all, no batch, nothing applies
// cards lead with their actions — Apply (a blocking ask), Skip, Done,
// Promote (#26), Jump (#204) — closed cards dim behind them. No apply-all, no batch, nothing applies
// without the ask (S3.3). #23's show-only surface kept its bones.
//
@@ -106,9 +106,10 @@ private struct CardList: View {
/// One card: pattern title, problem + fix body, rank · pass · lane ·
/// emitter mono meta (ADR-0006). A stale anchor reads distinct — orange —
/// and never offers Apply. Closed cards dim, record their status in the
/// meta, and offer no actions. The blocking Apply ask is the ROW's own
/// sheet: one card asks at a time, by construction (S3.3).
/// and never offers Apply or Jump (#204). Closed cards dim, record their
/// status in the meta, and keep only Promote and Jump — a closed card that
/// is already promoted keeps neither (its row is gone). The blocking Apply
/// ask is the ROW's own sheet: one card asks at a time (S3.3).
private struct CardRow: View {
let card: FixCardStore.StoredFixCard
@Environment(AppGateState.self) private var gate
@@ -134,14 +135,22 @@ private struct CardRow: View {
.font(.system(size: 11, design: DesignTokens.mono))
.foregroundStyle(stale ? .orange : DesignTokens.muted)
if open || card.promotedAt == nil {
// The actions this card offers (#25 S3.3, #26 S4.1):
// mechanical + valid → Apply (the blocking ask) and Skip;
// demonstration → Done and Skip (never Apply, ADR-0006);
// stale anchor → Skip only. Promote (its own ask) sits
// between the primary action and Skip, and outlives the
// card — closed cards keep it until promoted (#26: the
// The actions this card offers (#25 S3.3, #26 S4.1, #204):
// Jump on every card whose anchor still resolves (closed cards
// included — the span is still a real place; stale anchors offer
// none — nothing to land on); mechanical + valid → Apply (the
// blocking ask) and Skip; demonstration → Done and Skip (never
// Apply, ADR-0006); stale anchor → Skip only. Promote (its own
// ask) sits between the primary action and Skip, and outlives
// the card — closed cards keep it until promoted (#26: the
// Learning is the durable artifact).
HStack(spacing: 8) {
if !stale {
Button("Jump") { gate.posts.revealCard(card) }
.buttonStyle(.borderless)
.controlSize(.small)
.help("Select the anchored span in the piece")
}
if open, !stale {
if card.lane == .mechanical {
Button("Apply") { asking = true }