Build Edit mode with debounced, byte-honest saves

The editing surface: the same hosted TextKit-1 text view gains an
editable branch with a per-keystroke line-scanner highlighter — chosen
over a parser re-parse because a mid-typing buffer is usually invalid
Markdown and 05 wants the delimiters themselves dimmed; apply only sets
attributes, so presentation-never-transforms is structural. Saves ride
a ~700ms injectable debounce through BoardWriter.writeBody —
toggleTaskMarker's idiom widened to the body span, frontmatter bytes
untouched, refusing to write when disk already holds that body, which
enforces all three gates (untouched, reverted, echo) at the layer that
owns the bytes with one isDirty predicate above it. Mode grammar lands
whole: ⌘E toggles with a checkmark, Return in Preview enters, Escape
returns, and every flip flushes first; window close flushes through
the existing retry/save-copy/discard modal, and the dismissal flush
deliberately reaches a tombstoned card. Dirty-buffer-wins: disk always
follows the snapshot, the buffer only when clean, both surfaces render
the buffer. Undo is the editor's own session-scoped NSUndoManager;
endEditSession names the pro-m1 one-commit-per-session boundary.

Claude-Session: https://claude.ai/code/session_01SR4XGjmBE16ZUYWpfFHXwY
This commit is contained in:
2026-07-28 10:46:02 -04:00
parent 6dc84176fb
commit e989c1f26e
16 changed files with 2195 additions and 78 deletions
+5 -13
View File
@@ -70,19 +70,11 @@ enum BodyMarkupRenderer {
return output
}
/// The raw Markdown as the **Edit placeholder** shows it: monospaced, unhighlighted, and
/// character for character what is on disk.
///
/// Here rather than in the placeholder view because the two surfaces share one substrate and
/// therefore one input type an attributed string and because "the text is the raw Markdown,
/// character for character no hidden transforms, no smart substitutions" (05 Edit) is a
/// promise about *this* function: it sets attributes and never touches a character.
static func rawText(_ body: String, context: Context) -> NSAttributedString {
NSAttributedString(string: body, attributes: [
.font: monospacedFont(context.pointSize),
.foregroundColor: NSColor.labelColor
])
}
// The Edit surface's raw, monospaced rendering used to live here as `rawText`, while Edit was a
// read-only placeholder sharing this file's substrate. It is now `MarkdownHighlighter`'s
// base attributes plus a span pass and the promise it carried travelled with it: the
// highlighter emits ranges, never a string, so "the text is the raw Markdown, character for
// character" (05 Edit) is structural rather than a convention.
// MARK: Block layout state