Repository navigation
M7: the paragraph editor draws on its page only (#3061) - #3070
Conversation
|
The |
|
Follow-up: the same |
091d582 to
9779384
Compare
image_pixels_follow_the_frame_while_a_corner_is_dragged drags before the asynchronous page raster has arrived on a slow runner, and the preview (drawn from that raster) then draws no picture: 'not only at []' on windows-latest for storytold#3070 and storytold#3071 (a deny.toml-only change). With a 300 ms render delay added locally, main's test fails the same way and this one passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RUNQSPVXx3dDBabRZHAnjz
ahmadmuj
left a comment
There was a problem hiding this comment.
Checked page and viewport clipping with crop, rotation and zoom cases. Removing each bound independently makes the pixel regression fail. UI apply and in-memory save/reopen preserve all 56 paragraph rows and the next page's text. All 130 active editing tests pass.
The clipping change looks good in these headless Linux checks. I did not verify native Windows or rotated text appearance. Local WASM verification stopped at an uncached dependency; the hosted WASM check passes.
A paragraph running past its page's bottom edge, as HTML-to-PDF converters write when they rely on the page clip, opened in an editor that covered the next page with its box and text, and paragraph outlines crossed the gap between pages. The editor is clipped to its page within the document area (it also covered the tool bars when scrolled up), and outlines to their page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RUNQSPVXx3dDBabRZHAnjz
9779384 to
9194ec4
Compare
FredApps
left a comment
There was a problem hiding this comment.
The new test fails in CI at this head (test (ubuntu-latest)): a_paragraph_running_off_its_page_edits_without_covering_the_next_page panics at crates/ui-egui/tests/editing.rs:4915 in the first shown_on_its_page_only call ("the paragraph's outline: between the pages at x = 416"): left: [232, 232, 234, 255], right: [233, 233, 235, 255].
So the gap pixel at x = 416 is one level off the colour sampled at first.right() - 40, before the editor is even opened. Either something still paints in the gap there (the outline's clip rect is xf.rect.expand(1.0), so the stroke is clipped by the page but the page shadow is not part of it) or the reference pixel is not a clean gap colour. Please make the test compare against the same pixel without the paragraph (render once with the outlines off) rather than a fixed sample, or fix whatever is drawing there, and push a green run.
The clipping approach itself (with_clip_rect for the outlines, set_clip_rect on the editor Area) is the right place for it.
…ls without Edit text (storytold#3061) Review on storytold#3070: the gap between pages isn't one colour on every platform; on ubuntu CI the pixel at x = 416 was one level off the fixed sample taken 40 px from the page's right edge. The test now takes a screenshot of the same pages before Edit text is on (no paragraph outline), checks that the pages stay where they were, and compares every gap pixel with the same pixel there. Removing either clip still fails it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R3niW7kVeT8mi7TpWc8eAJ
|
@FredApps thanks, done in de25be1 the way you suggested. The test now screenshots the same pages before Edit text is on, so with no paragraph outline, and checks that turning Edit text on leaves both page rects where they were. It still catches the bug it was written for. Removing the outline painter's |
FredApps
left a comment
There was a problem hiding this comment.
Read the whole diff. It is a small, targeted fix: the Edit text outlines (page_input) and the open paragraph editor are clipped to the page rectangle intersected with the viewport, so a paragraph that runs past the page edge (relying on the page clip) no longer paints over the next page or the tool bars.
- The outline painter uses
with_clip_recton the existing clip, so it only ever narrows the area and respects scroll containers. - The editor Area clips to
xf.rect ∩ viewport_rect()computed beforeline_editoris borrowed, so it does not conflict with the mutable borrow, and the viewport term keeps it out of the toolbar when scrolled. - The regression test builds the real case (a 56-line paragraph that runs to y = -270 above an ordinary page 2). It compares the gap between the pages with the same render taken without Edit text, checks page 2 stays white, confirms the off-page lines are still in the editor, and checks the row of pixels above the document area after scrolling.
CI is green on this head.
…s it from its whole handle, not just the inner half (storytold#2276) crates/ui-egui/src/edit_text_ui.rs: storytold#3008's paragraph_box for the outlines with storytold#3070's page clip on their painter.
What this changes
Fixes #3061.
In the reporter's file, page 1's text runs past the page's bottom edge. HTML-to-PDF converters write this when they rely on the page clip. Normal view clips it at the edge, as it should.
In Edit text & images, clicking that paragraph opened an editor that drew its box and all its text over page 2, on top of page 2's own text. That is the second screenshot in the issue. The paragraphs' faint outlines also crossed the gap between the pages.
Now:
edit_text_ui::overlay), and also to the document area. The editor is a foregroundegui::Area, so a page scrolled up under the tool bar used to draw it over the tool bar too.page_input).xf.rect.contains).Before and after, on a synthetic two-page file whose page-1 paragraph runs to y = −270:
How you verified it
cargo fmt --all -- --check: cleancargo clippy -p pdfcraft-ui-egui --all-targets -- -D warnings: cleancargo test -p pdfcraft-ui-egui --test editing(130) and--test content, withCRAFT_FONTS_DIR: passTest:
a_paragraph_running_off_its_page_edits_without_covering_the_next_page. It builds a two-page PDF whose page-1 paragraph runs past the bottom edge, renders the window and checks pixels:Mutation check: 3 mutants, all caught, each reverted on its own:
Never-crash / provenance / parity
No new
unwrap, indexing orunsafe. Rect intersection only. No assets, no third-party code. No path, network or MCP change. No parity status changes: this is a display fix insideedit.text-edit.🤖 Generated with Claude Code
Summary by CodeRabbit