PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Merge PR #2756: M7: a paragraph number keeps naming the paragraph text_paragraphs listed (#2516)
aiongga456f516d9ac
diff --cc ROADMAP.mdindex c1bf7e4fa,fadacc4c9..40fabb8f3--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -171,12 -171,7 +171,14 @@@ Ranked; detail and the full milestone t| 8 | 1.0 polish: performance, right-to-left, missing languages, keyboard-only (M14) | 55–95 |## Progress log+- **2026-10-13 (M7, free image rotation):** A selected page image has a rotate knob (Shift: 15 degree steps) and `image_edit` a `rotate_by` action; the angle is written as one undoable `cm`. Snapping to page edges while moving is in #1740; resize snapping is not done. Estimates unchanged.++- **2026-10-20 (M6, calculation order page):** Prepare a form ▸ Calculation order, a page of its own, lists the calculated fields in the order they calculate with their formulas and values, moved with Up/Down arrows (as Acrobat's Set Field Calculation Order), Alt+↑/↓ or by dragging. A card says what is wrong with the order and holds Fix order; a loop has a card of its own that opens one of its formulas. On the page, each calculated field shows its step, and arrows show what the field in focus reads and what reads it. Estimates unchanged.+- **2026-10-20 (M6, calculation order):** The order a form's fields calculate in (`/CO`) is read, checked, fixed and set headlessly with `form_calculation_order`: it says which fields read one calculated later (they show stale values), which read each other in a loop, and which the PDF's order leaves out; Fix order moves only what must move, in one undo step, and the form recalculates. Editing a formula no longer moves its field to the end of the order, and a field the order lists twice calculates once. Estimates unchanged.+- **2026-10-19 (M6, renames keep formulas):** Renaming a field renames it in every calculation that reads it, in the same undo step: `AFSimple_Calculate` field lists, simplified field notation (the comment and the JavaScript after it) and `getField` calls naming it in one string literal; the rest of each script is kept as written. A sum used to drop the renamed field, notation read it as 0 and a script kept a stale value. Field Properties says how many formulas changed and `form_set_props` lists them as `formulas_updated`. Names built at run time and other events' scripts are not rewritten. Estimates unchanged.++ - **2026-10-16 (M7, #2516):** A paragraph number from `text_paragraphs` keeps naming the paragraph it listed after edits regroup the page: `text_edit`, `text_edit_layout` and `page_render`'s `hide_text_block` find it again by its text and box, and refuse one that was merged into a neighbour (the edited paragraph included) instead of rewriting the paragraph that took its number (`stale_paragraphs` lists the numbers gone). The inline editor's switch-paragraph click holds the same key. No stable identity across save and reopen yet (#2508).++- **2026-10-19 (M14, #3373):** The main menu and its long submenus scroll in short windows, keeping their commands reachable. Estimates unchanged.- **2026-10-19 (M3, #3387):** Save-prompt shortcuts yield to later consent and utility dialogs; a synthetic UI regression checks that an edited document stays open. Estimates unchanged.diff --cc crates/edit/src/lib.rsindex a70f11d36,e53aa6be3..83ad40487--- a/crates/edit/src/lib.rs+++ b/crates/edit/src/lib.rs@@@ -859,8 -859,8 +859,8 @@@ pub mod indicmod linebreak;pub mod text;pub use text::{- BlockStyle, LineEdit, MAX_FORM_DEPTH, MAX_FORM_VISITS, RangeStyle, ReadingBlocks, TextBlock, TextLine, TextSession, clear_block, reading_blocks,- reading_blocks_checked, replace_block, replace_line, rewrite_block, text_blocks, text_lines,- BlockKey, BlockStyle, LineEdit, MAX_FORM_DEPTH, MAX_FORM_VISITS, RangeStyle, ReadingBlocks, TextBlock, TextLine, block_overlapping, clear_block,- reading_blocks, reading_blocks_checked, replace_block, replace_line, rewrite_block, text_blocks, text_lines,++ BlockKey, BlockStyle, LineEdit, MAX_FORM_DEPTH, MAX_FORM_VISITS, RangeStyle, ReadingBlocks, TextBlock, TextLine, TextSession, block_overlapping,++ clear_block, reading_blocks, reading_blocks_checked, replace_block, replace_line, rewrite_block, text_blocks, text_lines,};pub mod added;pub use added::{diff --cc crates/ui-egui/src/canvas.rsindex 9ac135ffb,456d37bc9..54d2d268a--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@@ -499,12 -499,10 +499,13 @@@ pub struct DocView/// line being edited.pub(crate) edit_lines: HashMap<usize, (u64, Vec<pdfcraft_engine::TextBlock>)>,pub line_editor: Option<crate::edit_text_ui::LineEditor>,+ /// The paragraph editor whose edit was just queued. It opens again with its typing if the+ /// edit fails, as a refused form field does.+ pub(crate) applied_editor: Option<crate::edit_text_ui::LineEditor>,/// The box a click switched to while another paragraph was being edited: it opens once the/// queued edit has applied, so its index and geometry come from the document it now is (#2022).- pub(crate) pending_text_open: Option<(usize, usize)>,+ /// It is held as the paragraph's text and box, not an index: the edit can regroup the page.+ pub(crate) pending_text_open: Option<(usize, pdfcraft_engine::BlockKey)>,pub(crate) text_background: crate::edit_text_ui::TextBackground,pub(crate) move_background: crate::content_ui::MoveBackground,/// Edit text & images: the images per page (by document generation), and the selected one.