Skip to content

0.4.0 as one tree, for CI only - #17

Closed
anderix wants to merge 8 commits into
mainfrom
the-words-say-editor
Closed

anderix wants to merge 8 commits into
mainfrom
the-words-say-editor

Conversation

@anderix

@anderix anderix commented Sep 21, 2026

Copy link
Copy Markdown
Member

Draft, not for merging: the six-slice chain (#11 to #16) as one diff against main, so every workflow runs on the final tree tonight. Merge the six in order; close this once they are in.

anderix and others added 8 commits September 21, 2026 14:25
The three applications can now write a document back, and nothing in
them can change one yet. That order is deliberate: the save path is
verified with no editing in the product, on the one test that already
existed, that a document nobody changed comes back as an equal tree.

`Document::write_verified` serializes the document, reads the bytes back
and compares the content and styles trees with the ones they were
written from; a difference is `Error::Unfaithful` and nothing reaches
the disk. The corpus test covers every document of every format.

The shell owns the write as it owns the read. Save and Save as…, with
Ctrl+S and Ctrl+Shift+S, put the bytes into a `.part` file beside the
target and rename it over, carrying the target's permissions; macOS
writes in place, because the sandbox grant covers the file and not its
directory, and the `NSItemReplacementDirectory` arm is that platform's
session's. Close, Open, Reload, Quit and the window's own close button
ask Save, Discard or Cancel before a modified document is thrown away.

`Editing` is the state a view is handed on every frame: whether edit
mode is on, and an undo of bounded snapshots of the content tree, with
a modified flag that goes false again when undo reaches the state the
file holds and stays true when a new edit branches below a save. Edit
mode is Ctrl+E or the Edit menu; a window opens reading unless the one
preference the suite keeps says otherwise, in `odox/settings.toml`
under the platform's configuration directory, written only when that
checkbox changes.

`Viewer` becomes `View`, with `document_mut` for the save and `reindex`
for the spreadsheet after an undo. DESIGN.md §11 states the rules; the
fourteen new messages carry the fleet's German.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The core can now change a document, in the three ways the views will
ask for, and no view asks yet. Each write is tested by mutating a
corpus document and comparing everything else.

`Element` gains a path of child indices to reach a node again without
holding a reference into the tree, mutable access by that path, and
attribute writes; `Document::name` spells a new name in the prefix the
document declares for its namespace, so a document that writes `t:`
for the text namespace is written its own way.

`SheetDocument::set_cell` puts a value in a cell by sheet, row and
column. A row or cell the document wrote once with a repeat count is
split into the run before, the one, and the run after, with the counts
fixed, so the one changes and its neighbours in the run keep what they
had; a row or cell past what the document wrote is created, with one
repeated empty run filling the gap. A cell under a neighbour's span or
holding a formula is refused, and nothing moves. `Value::from_input`
reads what a person typed the way a spreadsheet does, and the cached
text is the value's shortest spelling, which a spreadsheet application
reformats from the value when it next opens the file.

`Presentation::set_geometry` writes a shape's four `svg:` attributes,
each in the unit it was read in. A shape placed by `draw:transform` is
refused rather than answered wrongly.

`odox_core::edit` edits a paragraph through its flat text, built from
the tree and not from the renderer's layout. Characters are deleted
from the nodes that hold them, new text goes into the text node at the
start of the range, every element that contributes no characters — a
bookmark, a frame, a field, a note — stays where it was, and
whitespace is then written the way ODF requires. Adjacent text nodes
are joined, because the parser keeps an entity reference as a node of
its own and two left side by side would not read back as themselves. A
split carries a zero-length element at the split point to the first
half. The test replaces six kinds of text across a grid of ranges in
every paragraph of every corpus document and checks the result against
string arithmetic, the marker count, and a re-parse.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The first editing a person can do. In xods, typing on the picked cell
replaces it, Enter or F2 opens it with what it holds, Enter commits and
moves down, Tab commits and moves right, Escape puts it back, and
Delete clears it. The text box sits in the cell, in the cell's own font
on the page's paper, with the caret at the end. A spreadsheet edits
without the mode, by every spreadsheet's convention.

What is typed goes through `Value::from_input` and `set_cell`, with the
tree recorded first so that Ctrl+Z takes it back. Leaving a cell as it
was is not an edit, so stepping through a currency does not retype it
as a number: the editor opens on the value's input form and compares
against it. A cell that holds a formula, or one under a neighbour's
span, is not opened, and the cell bar says why until the pick moves;
`SheetDocument::can_edit` is that question, asked by the window before
it opens an editor and by `set_cell` before it writes.

Once anything in the document has changed, every formula's cached
result is drawn faint, because which of them went stale cannot be told
without evaluating them, and a spreadsheet application recalculates on
opening the file.

The shell keeps its keys to itself while a text field has the focus,
so Ctrl+Z inside a cell undoes the typing and not the document, and
tells the view when a question is up over the window, so the Enter
that answers it does not open a cell.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
In xodp, in edit mode, a click picks one of the slide's own shapes, a
drag moves it, and a drag on a corner handle moves that corner with the
opposite one fixed. Each frame of the drag writes the four `svg:`
attributes through `set_geometry`, so the shape is drawn where it is
rather than previewed, and the tree is recorded once when the drag
begins, so a drag is one undo step. Escape and a click on the empty
page put the pick down; changing slide does too.

The hit is tested where the button went down. egui reports a drag only
once the pointer has travelled past its threshold and gives the
pointer's position then, ten points from an eight-point handle, which
is how the first attempt at a resize deselected the shape instead.

What is not picked: a shape placed by `draw:transform`, which states no
corner; a line, placed by its ends; a connector; a group; and
everything the master page contributes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
In edit mode a click on a paragraph opens it as a text box in place, at
the paragraph's own font, size, colour, indent and width, on the page's
paper: in xodt for the flow, and in xodp for a shape's label, which is
the same paragraph through the same box. Escape puts the paragraph
back, Ctrl+Enter or a click elsewhere keeps what was typed, Enter is a
new paragraph once it is kept, and Backspace with the caret at the very
start joins the paragraph onto the one before it and reopens the box
there with the caret at the join.

What is written is the difference between what the box was given and
what it hands back. `odox_core::edit::rewrite` compares the two from
both ends and replaces only the middle, putting the new text into the
node that held the old before the old comes out, so a span or a marker
outside the change is untouched and what replaces a bold word is bold;
a newline inside the change splits the paragraph, each half with the
original's style. `apply` and `join_with_previous` do that by a path
under a root, which is how both views reach a paragraph again.

The renderer keeps a path of child indices as it walks, reports the
paragraph a click landed on, and draws the box in place of the
paragraph the path names. A slide's label is drawn from the shape and
edited from the page, so the canvas tells the flow where its root sits
and hands the box's state through. A frame anchored inside a paragraph
is reached by a clone, so nothing in it is edited in place. On a slide
in edit mode a drag moves the shape and does not select its text.

Two things found on the way. A measuring pass is an invisible ui, and
an invisible ui is disabled: a text box added in one surrendered the
focus the real one had just taken, so the box closed itself on the
next frame; a sizing pass now takes the box's height and no box. And a
proportional line height was resolved against the paragraph's size and
applied to every run, so a title whose size lives on its span sat in a
line thirteen points tall and its click target with it; each run now
takes its own.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Every surface that said viewer, reader, or "reads and does not write"
now says what 0.4.0 is: a lightweight editor that changes what is there
and saves the document back as it was opened. The README, both store
listings and their App Review notes, the privacy statement, the desktop
entries, the Debian descriptions, the man pages, the crate descriptions,
the launcher's help and the repository guide.

The promise changes from nothing written to nothing written until Save,
and then only the file that was opened or the one named; no temporary
file left beside it, no backup, no cache, and one preference in a
settings file written only when it is changed. The store subtitles
become "Edit OpenDocument text", "Edit OpenDocument sheets" and "Edit
OpenDocument slides", in German "Textdokumente bearbeiten" and its
siblings, and every field is counted against its limit in both
languages. The App Review notes say `CFBundleTypeRole` Editor and the
read-write entitlement, which the Mac session changes in the bundle.

The desktop entries move from Office;Viewer to WordProcessor,
Spreadsheet and Presentation. The version is 0.4.0 and the changelog
says what it carries. The privacy entry is canonical here and is copied
to excelano.com/legal, which is a change in that repository.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
A Wayland session delivers no file drop to a winit window, so the
sentence names the platforms where one does.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
A Wayland session delivers no file drop to a winit window, so the drop
path is taken out of the shell rather than left working on some
desktops and not others, and no document mentions one. A document is
opened from the command line, from Ctrl+O, or from the desktop.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@anderix

anderix commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

The six are merged in order; this draft served its purpose.

@anderix anderix closed this Sep 21, 2026
@anderix
anderix deleted the the-words-say-editor branch September 21, 2026 22:21
@anderix anderix mentioned this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant