Repository navigation
Conversation
…ng (storytold#470) - A selected empty text box keeps its font on the end mark; the ribbon now shows that font instead of the theme's, so picking one no longer looks like it did nothing. - Font and size are enabled with nothing selected: the pick becomes the font and size new text boxes start with (this session), and the ribbon shows it. - While typing in a text box, dragging its dashed edge moves it and the rotation handle (now drawn) turns it, as in PowerPoint; presses inside the edge still place the caret and select text. Co-authored-by: Cursor <cursoragent@cursor.com>
FredApps
left a comment
There was a problem hiding this comment.
ReviewerA — source-read COMMENT (not an approval)
I read the head of the diff: text boxes get fonts for empty and new boxes, and can be moved and rotated while typing (#470). With nothing selected, format.size sets the size that new text boxes start with, and the CLI test and the command description say so ("with nothing selected: the size new text boxes start with"). PowerPoint has this behaviour (a default for the next new text box), so the oracle matches. Two features are combined (defaults for new boxes and move/rotate while typing), and the second involves the keyboard and pointer handling during text editing, where gridcraft#2040 and deckcraft#320 show how subtle focus is. A test for each would help. I read the CLI changes only. I have not run it, and no exact-head CI result exists for this head. Nothing was run.
I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.
Status: waiting_author.
aiongg
left a comment
There was a problem hiding this comment.
AI-generated review (Opus). Not a maintainer decision.
Changes needed:
Three changes in one PR: the ribbon now shows the font of an empty text box, the rotation handle works while typing, and a font/size picked with nothing selected becomes the default for new text boxes. The first two are small and look correct. The third adds new session-wide behaviour.
- crates/engine/src/cmd/format.rs:247 reads an empty box's formatting from its end mark. This matches what format_all stores (crates/model/src/edit.rs:212), so the ribbon now shows the picked font.
- crates/engine/src/tools.rs:403 and crates/ui-egui/src/canvas.rs:878 hit-test and draw the rotation handle while a box is being edited. This is consistent with the resize handles, which already worked mid-edit.
- Moving a box by its edge while editing is not new in this diff. The Frame hit at crates/engine/src/tools.rs:413-419 is unchanged.
- Session::text_default (crates/engine/src/lib.rs:462) is not saved with the document, cannot be undone, and carries over to every presentation opened in the same session.
- apply_text_default runs inside insert.textBox (crates/engine/src/cmd/insert.rs:286), so pasted plain text (crates/engine/src/cmd/edit.rs:415) and photo album text, captions and titles (crates/engine/src/cmd/insert.rs:1146, 1169, 1173) also get the picked font and size.
- With format.font/format.size switched to has_doc, a script that calls them with nothing selected now succeeds without changing the document, where it used to report that text or shapes must be selected.
- The check
sh.ph.as_ref().is_none_or(|_| true)at crates/ui-egui/src/canvas.rs:878 is always true and could be removed. - Splitting the empty-box state fix and the rotate-while-editing change from the new-box default would keep each topic separate.
Claims checked:
- verified: format.state on a selected empty text box now shows the font stored on its end mark (crates/engine/src/cmd/format.rs:247 falls back to para.end_props when there are no runs; format_all writes end_props at crates/model/src/edit.rs:212)
- verified: format.font/format.size are enabled whenever a document is open, and with nothing selected the pick becomes the font/size new text boxes start with, on every slide, and the ribbon shows it (crates/engine/src/cmd/format.rs:40-49 switch to has_doc; format.rs:315-326 store into s.text_default; insert.…
- contradicted: Only new text boxes get the picked default; existing text is untouched (crates/engine/src/cmd/insert.rs:286 applies it inside insert.textBox, which is also called by plain paste (crates/engine/src/cmd/edit.rs:415) and photo album text, captions and titles (crates/engine/src/cmd/insert.rs:1146,1169,…
- verified: While editing, a press on the dashed edge grabs and moves the box (crates/engine/src/tools.rs:413-419 returns Hit::Frame for the edited box's frame zone; this code is not changed by the diff, so the behaviour already existed)
- verified: The rotation handle is drawn and works while editing (crates/engine/src/tools.rs:403 no longer requires selection.text to be none; crates/ui-egui/src/canvas.rs:878 drops the !editing_this check)
- verified: Presses inside the edge still place the caret and select text (crates/engine/src/tools.rs:414-416 only takes EditZone::Frame; other presses fall through to hit_shape at tools.rs:422-428, unchanged)
- verified: No unwrap/panic in non-test code (the non-test hunks in crates/engine/src/cmd/format.rs:315-349, crates/engine/src/cmd/insert.rs:286-288 and crates/engine/src/tools.rs:403 use Option combinators only)
Recommendation: update the pull request; it will be reviewed again.
Reviewed at 9f193b0.
Summary
Reproduced the issue with engine pointer/command tests on
main:format.fonton a selected empty text box did store the font (on the paragraph's end mark), butformat.stateread only the first run, so the ribbon kept showing the theme font and the pick looked like it did nothing. An empty box's state now comes from its end mark.format.font/format.sizeare now enabled whenever a document is open. With nothing selected, the pick becomes the font/size new text boxes start with (Session::text_default, for the session, on every slide, until another pick), and the ribbon shows it (else the theme body font).Test plan
format.stateand applies to typed textformat.stateand go to typed-into and created-with-text boxes on later slides, while existing text is untouchedcargo xtask ci(fmt, clippy, test, assets, layers, wasm)Closes #470