feat: editor markdown-aware editing — bullets, marker cycle, indent, open-at-top #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/editor-markdown-editing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Makes weft's in-app editor behave like a native markdown editor, following the syntax-tinting/framing round (#14). Two rounds of work on one branch, both spec'd + planned + reviewed.
What changed
Bullet continuation (Enter)
-bullet continues the list at the same indent; Enter on an empty bullet ends the list; non-bullet Enter inserts a normal newline. Continuation is always a plain-(never carries a marker forward).Workflow-marker cycle (Ctrl+T)
plain → TODO → DONE → plain(the only markers used in the graph), no-op on non-bullets. Cursor rides with the text.Indent / de-indent (Tab / Shift+Tab)
Fixes
SetValueside effect).InsertString/replaceCurrentLine, which (unliketa.Update) never repositioned the viewport, so a new bullet at the bottom of a page stayed off-screen until you typed. Fixed with asyncViewport()poke of the existingrepositionMsg.How it works
Decision logic is pure functions in
internal/views/edit_markdown.go(bulletPrefix,isEmptyBullet,cycleMarkerLine,indentLine,dedentLine);EditorView.Update()intercepts the keys and applies results via a reusablereplaceCurrentLinehelper — mirroring the existinglinkCompleter/acceptCompletionsplit. Render-layer only;internal/edit/stays the sole disk writer.Scope / non-goals
TODO/DONE only (not the full Logseq marker set);
-bullets only (no[ ]checkboxes, ordered lists, or*/+); Tab indents the current line, not a subtree; empty-bullet Enter clears the line (no multi-level outdent). Deferred: hanging-indent of wrapped bullet text in edit mode — blocked onbubbles/textarea(fixed-width prompt gutter, no per-line variable indent); logged as a weft TODO.Testing
Pure unit tests for every helper + integration tests through
Update()(continuation/terminate/cycle/indent transitions, cursor columns, open-at-top, and a viewport-reposition regression guard). Help golden regenerated.go vet ./... && go test ./...green.Specs + plans under
docs/superpowers/.