This repository was archived by the owner on Nov 12, 2026. It is now read-only.
Repository navigation
docs(proposals): an edit format shared by leaf and the core - #23
Merged
Merged
Conversation
adammharris
added a commit
to diaryx-org/twig
that referenced
this pull request
Oct 24, 2026
…tep keeps their inverse The splicer's one primitive is now apply(ops): Retain, Insert and Delete read from the start of the source, applied with one reparse and recorded as one undo step. A gesture still builds its replacement for a span, but replace_at_span records the fewest ops that turn the span's bytes into it (ast::ops::diff, Myers over characters, so no op ends inside a UTF-8 sequence, and one splice past 512 edits). Bold over a word is two inserts and the word retained, not the word deleted and written again, which is what a merge needs to keep a concurrent edit inside the word. edit_range, here and in the C ABI, records the span as asked. last_change keeps reporting the span asked. Editor gains Op, apply (several places in one edit; a position past the end or inside a character is InvalidArgument), last_ops (what the last edit, undo or redo did, in one canonical spelling), and set_history / keeps_history. An undo step holds the edit's inverse ops and its caret blob instead of a copy of the whole source; coalescing composes two steps' ops. History off records no steps, for a host such as leaf that keeps its own over last_ops. These are twig's tasks in leaf's draft proposal "An edit format shared by leaf and the core" (diaryx-org/leaf#23). BREAKING CHANGE: ast::splicer::HistoryEntry holds `ops: Vec<ast::ops::Op>` where it held `source: Vec<u8>`, and ast::splicer::Error has an OutOfRange variant. Behavioural-change: An undo or redo whose restored text the parser refuses now leaves its step on the stack, so it can be tried again. It used to drop the step.
adammharris
marked this pull request as ready for review
October 26, 2026 16:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A proposal, nothing built. It answers decision 11 of Diaryx's The author's app runs in a browser: edits to the open page need an edit format shared by the core and leaf's
Doc, which leaf designs first.What it proposes, from Adam's decisions of 2026-10-22:
eg-walker-merge, working name). historica's verified walk and its Verus proofs move into it, so leaf and historica share them.Open questions are at the top of the document. Tasks for the new crate, twig, historica, leaf and diaryx are at the end.