Skip to content

Save, before anything can edit - #11

Merged
anderix merged 1 commit into
mainfrom
save-before-anything-can-edit
Sep 21, 2026
Merged

anderix merged 1 commit into
mainfrom
save-before-anything-can-edit

Conversation

@anderix

@anderix anderix commented Sep 21, 2026

Copy link
Copy Markdown
Member

The first slice of 0.4.0, the editing release. Nothing in the three applications can change a document yet, and all three can now write one back: the save path is proven on the test that already existed, that a document nobody changed comes back as an equal tree.

Document::write_verified serializes, reads the bytes back and compares the content and styles trees with the ones they were written from. A difference refuses the save with Error::Unfaithful and nothing reaches the disk; the corpus test covers every document of every format. The shell writes through a .part file beside the target and renames it over, carrying the permissions; macOS writes in place because the sandbox grant covers the file and not its directory, and that platform's NSItemReplacementDirectory arm waits for a session at the machine.

Save and Save as… are on the File menu with Ctrl+S and Ctrl+Shift+S. Close, Open, Reload, Quit and the window's close button ask Save, Discard or Cancel before a modified document is thrown away. The Edit menu has Undo and Redo over a bounded stack of tree snapshots, the Edit mode toggle (Ctrl+E), and the one preference the suite keeps, opening documents in edit mode, in odox/settings.toml under the platform's configuration directory and written only when the checkbox changes. Viewer becomes View, DESIGN.md gains §11, and the new messages carry the fleet's German.

Checked: clippy with -D warnings, fmt, the catalogue check, the full test suite, and the window on X11 for edit mode, both menus and the preference file. Save as… could not be driven from a script because the portal's dialog is a Wayland window; the write behind it is the tested write_verified and the tested file replacement, and the dialog is the same rfd portal call as Open. One manual Save as… before merging is the check that remains.

🤖 Generated with Claude Code

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]>
@anderix
anderix merged commit 1efd958 into main Sep 21, 2026
6 checks passed
@anderix
anderix deleted the save-before-anything-can-edit 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