feat: editor syntax tinting + framing parity #14

Merged
fiatcode merged 11 commits from feat/editor-syntax-tinting into main 2026-06-17 13:51:09 +07:00
Owner

Polishes the in-app markdown editor so it feels like the same app as the Glamour read view.

What changed

  • Framing parity — the editor now occupies the same box as the read view: a 2-column left inset (matching Glamour's document margin) and a 1-row top margin (matching its leading blank line). Text no longer jumps left/up on entering edit mode.
  • Hybrid syntax tinting — live colorization of the raw buffer: headings (bold), blockquotes + code-fence delimiters (faint), task markers (TODO/DOING/… colored to match the read view + todos dashboard), and [[wiki-links]] (link color). The cursor's current row is left raw — a deliberate "reveal source where you edit" affordance.

How it works

A pure string → string decorator (internal/views/edit_tint.go) post-processes textarea.View() output: it tints every escape-free row and skips rows that already carry ANSI (the cursor row's CursorLine background + end-of-buffer filler). The textarea's empty-but-styled prompt was neutralized so non-cursor rows stay escape-free — without that, the prompt put an escape on every row and suppressed all tinting.

Reuses theme.go's colorHighlight and mirrors internal/render's task-marker palette locally (the documented convention — not a shared package).

Scope

Render-layer only; internal/edit/ stays the sole disk writer. Explicit non-goals (v1): code-block body tinting, inline emphasis/inline-code tinting, tinting the cursor row.

Testing

Unit tests for the tinting core + an integration test asserting tinting reaches View(); editor goldens regenerated (run under NO_COLOR, so they cover the inset/margin). go vet ./... && go test ./... green.

Design spec + plan: docs/superpowers/specs/2026-06-17-editor-syntax-tinting-design.md, docs/superpowers/plans/2026-06-17-editor-syntax-tinting.md.

Polishes the in-app markdown editor so it feels like the same app as the Glamour read view. ## What changed - **Framing parity** — the editor now occupies the same box as the read view: a 2-column left inset (matching Glamour's document margin) and a 1-row top margin (matching its leading blank line). Text no longer jumps left/up on entering edit mode. - **Hybrid syntax tinting** — live colorization of the raw buffer: headings (bold), blockquotes + code-fence delimiters (faint), task markers (TODO/DOING/… colored to match the read view + todos dashboard), and `[[wiki-links]]` (link color). The cursor's current row is left raw — a deliberate "reveal source where you edit" affordance. ## How it works A pure `string → string` decorator (`internal/views/edit_tint.go`) post-processes `textarea.View()` output: it tints every escape-free row and skips rows that already carry ANSI (the cursor row's CursorLine background + end-of-buffer filler). The textarea's empty-but-styled prompt was neutralized so non-cursor rows stay escape-free — without that, the prompt put an escape on every row and suppressed all tinting. Reuses `theme.go`'s `colorHighlight` and mirrors `internal/render`'s task-marker palette locally (the documented convention — not a shared package). ## Scope Render-layer only; `internal/edit/` stays the sole disk writer. Explicit non-goals (v1): code-block *body* tinting, inline emphasis/inline-code tinting, tinting the cursor row. ## Testing Unit tests for the tinting core + an integration test asserting tinting reaches `View()`; editor goldens regenerated (run under NO_COLOR, so they cover the inset/margin). `go vet ./... && go test ./...` green. Design spec + plan: `docs/superpowers/specs/2026-06-17-editor-syntax-tinting-design.md`, `docs/superpowers/plans/2026-06-17-editor-syntax-tinting.md`.
fiatcode deleted branch feat/editor-syntax-tinting 2026-06-17 13:51:09 +07:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
fiatcode/weft!14
No description provided.