Repository navigation
A paragraph is edited where it sits - #15
Merged
anderix merged 1 commit intoSep 21, 2026
Merged
Conversation
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]>
Closed
Merged
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The fifth slice of 0.4.0, on top of #14. 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, in xodt for the flow and in xodp for a shape's label. Escape puts it back, Ctrl+Enter or a click elsewhere keeps what was typed, Enter is a new paragraph once kept, and Backspace at the very start joins the paragraph onto the one before it.
What is written is the difference between what the box was given and what it hands back:
odox_core::edit::rewritereplaces only the middle that changed, into the node that held the old text, so spans and markers outside the change are untouched and what replaces a bold word is bold; a newline inside the change splits the paragraph. The renderer keeps a path as it walks and reports the paragraph a click landed on; the canvas tells the flow where a label's root sits under the page.Two fixes found on the way: a text box in a measuring pass surrendered the focus of the real one (a sizing pass is an invisible, and so disabled, ui), and a proportional line height was resolved against the paragraph's size rather than each run's, which put a title in a thirteen-point line.
Checked: clippy with
-D warnings, fmt, the catalogue check, the full test suite (the edit suite now covers the diff, the split on typed newlines, and apply and join by path), and on X11: a paragraph typed into and saved, a paragraph split with Enter, a paragraph joined into the heading before it with Backspace, and the corpus deck's title edited inside its span and saved asodox corpus deck edited.🤖 Generated with Claude Code