Compare commits

...
Author SHA1 Message Date
Martin BallandClaude Opus 5.5 568039cd7f fix(ui-egui): a key's edit pass no longer clears the settled pages
A pass that places no page (the edit pass a key triggers) matched the empty
shown pages and reset settled_pages to empty, so that pass asked for unsized
pictures and the next pass's exact-pixel pictures were rendered again on a
worker plus an extra frame (~33 ms CPU, ~4.7 ms main thread per key). Only
settle when at least one page was placed; zoom, resize and scroll still
settle to their exact pixels.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FypgCXNomWeGUu3duixKdm
2026-12-06 21:21:00 +00:00
+3 -1
View File
@@ -1065,7 +1065,9 @@ fn show_pages(app: &mut WordApp, ui: &mut Ui, layout: &Arc<DocLayout>, full: Rec
// The same places two passes running: the view is at rest, and these are the places pictures are made for.
let placed = |pages: &[PlacedPage]| pages.iter().map(|p| (p.page, p.rect)).collect::<Vec<_>>();
let now = placed(&out.pages);
if now == placed(&app.canvas.shown.pages) && now != app.canvas.settled_pages {
// A pass that placed no page (a key's edit pass) is not a rest: clearing the places would make the pictures
// that pass asks for the unsized ones, and the next pass's sized ones render all over again.
if !now.is_empty() && now == placed(&app.canvas.shown.pages) && now != app.canvas.settled_pages {
app.canvas.settled_pages = now;
// The pictures of the places just settled are made on the next pass.
ui.ctx().request_repaint();