* Tests: set the fit-one-page fixtures in bundled Inter
The fit-one-page fixtures count pages to the line, but they were set in the
default Aptos, which each host substitutes with whatever it has installed:
Arial on Windows, Liberation Sans on the Linux runners, DejaVu Sans on the
FreeBSD image (its only candidate). DejaVu Sans is taller, so at 11 pt it fits
27 of the fixture lines on a page where Arial fits 28, and the nightly FreeBSD
job failed fit_one_page_respects_step_pt and
fit_one_page_preserves_budget_across_document_serialization.
Set the fixtures in the bundled Inter, whose metrics keep a page boundary for
each 0.5 pt step, recount the fixed line counts for it, and start the boundary
searches below the boundary. The two tests that failed also assert that the
body is laid out in Inter, not a substitute.
* Tests: keep 7 to 12 body lines on the line-numbered fixture's final page
A boundary search left one body line on the final page, so counting the
line-number decorations too would still have stayed under the 12-line limit and
the test could not catch it. Use 33 lines, 8 on the final page in Inter, and
assert the body-only count is between 7 and 12.
* #3518: Review › Language can set the whole document's proofing language
review.language takes scope "selection" (default, unchanged) or "document":
every run and paragraph mark of every story (body, headers, footers, notes,
comments, text boxes, table cells, glossary) takes lang/noProof in one undo
step, selection unchanged, pending typing format follows. The Language dialog
gets an "Apply to the whole document" check box.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCVCCEo7u5wetHaJRU4
* #3518: whole-document OK sends only what was changed in the Language dialog
With "Apply to the whole document" ticked, OK sends noProof only if the user
changed it from the dialog's opening value, and lang if changed or if neither
changed (never the engine's en-US default). Heading reads "Mark the whole
document as:" while ticked. Glossary walker uses doc's PARA_WALK_DEPTH (now pub).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCVCCEo7u5wetHaJRU4
* #3518: whole-document OK with Do not check ticked marks the whole document
CodeRabbit: with the caret's text already not checked, the box was unchanged, so a
whole-document OK never sent noProof and the rest of the document stayed checked.
A ticked box is now always sent; an unticked, unchanged one is still omitted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #3518: refuse whole-document language changes under protection
Protection leaves only its exceptions editable, so document scope is refused before anything changes. The post-check now compares the glossary, which no story-level check reached.
* #3518: whole-document language keeps per-run proofing, returns selection, skips glossary while tracking
- Language dialog: whole-document OK sends noProof only when the box was changed, so a language-only change no longer marks everything no-proof.
- review.language scope "document" returns the caret/selection result (plus scope).
- Whole-document change skips glossary blocks while Track Changes and Track Formatting are on (tracked formatting does not cover them).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #3518: whole-document Do not check is sent when the box is clicked; report skipped glossary
- Language dialog: a whole-document OK sends noProof iff the Do-not-check box was clicked (proof_touched), so ticking it with the caret in a no-proof run still marks the whole document, while a language-only change leaves other runs alone.
- review.language document scope reports "glossarySkipped": true when the glossary was skipped under Track Changes + Track Formatting; doc comment reworded to state only the limitation.
- Docs status line and revision row bumped to 2026-11-16.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Martin Ball <martin.ball@ucsmedical.co.uk>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
* #1537: Ctrl/Cmd+Shift+V pastes text only when no formatting was copied, as in Word for Windows
With formatting picked up by Ctrl/Cmd+Shift+C it still pastes the formatting.
Closes#1537, #4943; takes over #1562.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: review — a browser's Mod+Shift+V paste event pastes text only, once (CodeRabbit)
On the web the key no longer pastes as well: the paste event that follows carries the text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: review — copied formatting stays for every Mod+Shift+V; a browser's paste after it is ignored (wanikhawar)
Copy Formatting keeps its formatting apart from the one-shot Format Painter brush, so a second
Mod+Shift+V pastes formatting again instead of text, and Mod+Shift+C no longer arms the brush.
After Mod+Shift+V pastes formatting, the browser's paste event for the same keystroke is ignored;
paste events read the modifiers held in event order. Only Mod+Shift+V itself falls back to Keep
Text Only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCYPZSei56X4AGFPSu5
* #1537: review — one format buffer, formatting-only copy, browser paste suppression only where it exists
- ignore_next_paste armed only for Mod+Shift+V on platforms that send a paste event after it (web); never for a rebound key
- the ignored paste is dropped before equation and picture-file handling
- Event::Paste takes paste_mods so they don't leak into later pastes
- Copy Formatting and Format Painter replace each other; a used-up brush no longer hands over to older copied formatting
- copied formatting carries no hyperlink or revision marks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: review — shared format buffer, no tracked paragraph changes, pointer press ends the paste wait
- picked_format strips ParaProps fmt_change/num_change
- Format Painter pick is stored in copied_format too; a used-up or cancelled brush leaves it
- a pointer press clears ignore_next_paste
- docs: repeat-until-replaced wording
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: review — a caret Paste Formatting keeps the target's own link and tracked marks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: review — an unrelated key's modifiers can't steer a later paste event
A separate paste_event_mods is set by Mod changes and Mod+V's press, and cleared by any other key, a pointer press or focus change; the release path keeps paste_mods.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: review — the text-only paste test checks the destination's own formatting stays (CodeRabbit)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: review — the docs say a Format Painter pick counts as picked-up formatting too (CodeRabbit)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: review — a dropped paste uses up its modifiers; range Paste Formatting keeps the link (alehel)
- The browser paste event dropped after a formatting paste now clears paste_event_mods too, so a
later menu-bar paste isn't read as Keep Text Only. Note the no-text clipboard case.
- Test that Paste Formatting over a selection keeps the target's hyperlink.
- session.rs: copied_format holds a Format Painter pick too.
- ROADMAP: entry moved up with the other 2026-11-04 entries; stray blank line dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: review — the wait for Mod+Shift+V's browser paste ends after a second, so a later menu-bar paste isn't dropped (FredApps)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCX8G9hbs6XYZFsgjbL
* #1537: review — an expired paste wait drops the chord's noted Mod+Shift too (CodeRabbit)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCX8G9hbs6XYZFsgjbL
* #1537: review — dropping the paired paste uses up its modifiers; range Paste Formatting keeps the target's link
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: review — restore ui-parity status line; add Paste Formatting row to typing-parity
docs/ui-parity.md: the rebase had replaced main's status line with an older one;
restore it and prepend this PR's entry. docs/typing-parity.md: add the
Ctrl/Cmd+Shift+V row to the Paste section, bump status line and history.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #1537: Ctrl/Cmd+Shift+V's V release never pastes a second time
On desktop the chord's key-down path pastes (text, or the copied formatting) but didn't mark the
paste as done, so releasing Shift before V left a plain Mod+V release that ran Paste again through
the clipboard-picture hook, inserting the text twice. The canvas's chord now marks the paste done;
the global-shortcut path (canvas unfocused, no release seen) doesn't, and a focus change clears
the mark so a lost release can't swallow a later Mod+V picture.
Docs: web text paste needs the browser to send its paired Paste event; with formatting copied that
event is dropped only within about a second of the key.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore: cut over image codecs and zip to craft-libs, fix main test regressions
* tests: store ODS mimetype and use standard ODF namespaces in mailings test
* Remove unused quick-xml workspace dependency
* fix: use standard ODF namespaces in file_dialogs test and preserve trailing line in markdown import_on_with_lines
* fix(geom): use png_chunks for PNG dimensions and p.fits(budget) in decode_for_drawing
#6537 declared a test change but committed 50 text files with CRLF, which
`cargo fmt --check` does not catch. Restore the bytes from c37baf76: no text
file carries CRLF, and the tree is identical to that commit again.
Refs #6537, #6539.
The #5858 early return kept page anchoring for any object that does not
move with text, which includes a body frame that came from an .odt with
text:anchor-type="page". Moving it then skipped the paragraph placement
and the save wrote the page anchor and number back, contradicting #5705's
an_odt_frame_moved_from_its_page_loses_the_page_number.
Only header/footer objects (and drops on a page with no anchoring text)
keep page anchoring now, which is what #5812 needed. The body test that
pinned the opposite is updated to the #5705 rule.
- Recognize a marked Fit One Page custom XML store across package and document
relationships, skipping passthrough only after loading successfully.
- Reserve the Fit One Page part path in EmbedWriter taken paths to prevent collisions.
- Track typography provenance per formatting location rather than sorted multisets.
- Validate stepPt parameter and reject non-positive or non-finite values.
- Report "already fits on one page" before an exhausted cumulative budget.
- Record original and reduced font sizes, line spacings and paragraph
spacings as multisets, so restoring neighbouring sizes clears the
exhausted budget, and paragraph spacing keeps the budget when line
spacing rounds back to its original.
- Resolve font and spacing budgets independently, letting the remaining
component be used instead of refusing the whole command.
- Persist FitState in a namespaced DOCX custom XML part and restore it on
read; add a DOCX round-trip regression.
Pass LayoutOptions::hides_deleted per story into the explicit-break scan and
the font floor, so hide_marked, revisions in balloons and moved-from text are
seen exactly as Print layout sees them. This keeps the guards from counting
deletions the page no longer contains.
- Anchor cumulative budget provenance to the original sizes and spacings
recorded before the first fit, instead of matching every current value
against every recorded value. Restoring body and heading sizes now resets
the budget.
- Build the initial and trial layouts from the session's hide_marked,
deletions_in_balloons and resolved numeral settings, so hidden or
ballooned deletions and numeral shaping paginate as in Session::layout.
- Add regressions for mixed body/heading sizes, mixed line spacings, and
Session::layout parity under non-default visibility and numeral settings.
Resolve each cell's conditional table-style character formatting before
checking whether a page break is hidden, matching min_blocks_font_size and
layout's region selection. A first-row or banded hidden override now agrees
with Print layout. Add a regression with a hidden first-row override.
- Round paragraph spacing up to hundredths, so a very small value is never
reduced by more than the requested factor.
- Ignore page-break characters in hidden or tracked-deleted runs, matching
Print layout visibility, so a hidden break cannot force a refusal.
- Scale paragraph spacing without rounding a small value to zero or
compressing past the requested factor.
- Detect resolved page_break_before and nested table paragraphs as explicit
breaks, and refuse before evaluating candidates.
- Count non-text body items in the final-page volume limit.
- Give the ribbon button an accessible label and test it through the
rendered Layout ribbon in both themes.
* View: editable Markdown source view for .md files (#5826)
Co-authored-by: oldgranola <marken.john206@gmail.com>
* Address review feedback on Markdown source view
- Fix view.markdownSourceText purity and input validation
- Single-pass block line mapping in markdown parser
- Reuse parsed documents and block line ranges on apply and leave
- Bound memory usage with MAX_SOURCE_BYTES and clamp caret byte offsets
- Isolate temp directories in tests and test caret validation
- Preserve dirty state while markdown text edits are pending
- Flush pending markdown text edits in swap_doc
* Address CodeRabbit review feedback on Markdown source view
- Exempt view.markdownSourceText in command refusal
- Preserve original source line mapping when filtering link definitions
- Map between egui char indices and byte-offset caret in history and undo
* Remap block line numbers in a single linear pass
* Refuse over-limit Markdown Source edits to prevent document truncation
* Keep a Markdown file's own text when it is opened from handed-over bytes
`file.open` kept a Markdown file's exact text only for path-backed opens, so a
platform that hands the bytes over (data) lost front matter, comments and the
author's line endings on the first save, and the rewritten flag could not say
so. The kept text now comes from the same bytes `read_document` decodes, still
bounded by MAX_SOURCE_BYTES through FileText::from_bytes; the path read stays
for opens without data.
---------
Co-authored-by: oldgranola <marken.john206@gmail.com>
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Add layout.fitOnePage, a speculative typography search that removes one
page from the document while preserving relative font hierarchy.
Every size receives the same half-point-rounded reduction; line spacing
never falls below 0.94 of its original and body text never below 8.5 pt.
The command refuses on explicit page breaks, excessive final-page content,
formatting protection, tracked formatting and the cumulative 1 pt budget,
and leaves the document unchanged when it refuses.
Add the Layout ribbon button, KeyTip and a code-drawn icon, cover the
command with 41 tests, and regenerate the parity checklist.
Paste selected WordCraft's own fragment whenever the system clipboard text matched, even when the host reported that another program owned the clipboard, so a plain-text copy made elsewhere could paste the earlier bold fragment back. Read privateClipboard in paste_content and in the Formatted Text source, using the session fragment only when ownership is true or the caller omits the flag (agents and the CLI keep working). Carry the flag through the Paste Special request and dialog so its format list matches.
* feat(engine): format Brazilian date fields and insert localized dates
* feat(ui): persist preferred date and time format
* feat(ui): implement Word-style Insert > Date & Time modal
* feat(ribbon): open Date & Time dialog from Insert tab
* test: Brazilian Word TIME fields respect document defaults after DOCX round-trip
* fix(docx): refresh Word date/time fields using their run language
* ci: add temporary date/time regression validation workflow
* style: apply rustfmt output to insert.rs
* style: apply rustfmt output to date_fields.rs
* style: apply rustfmt output to dialogs_insert.rs
* i18n: reuse translated date-format and language labels
* i18n(pt-BR): translate Update automatically in date/time dialog
* fix(i18n): translate date dialog options and audit generated date previews
* chore: remove temporary date/time regression workflow after focused validation
* fix(date): resolve inherited locale and preserve it in fixed text
* fix(ui): display date insertion errors without closing the dialog and document state
* test: cover inherited language, static date text, and escaped date pictures
* test(ui): exercise date language, picture, checkbox, OK, and invalid-value feedback via egui
* style: apply rustfmt to date insertion and regression tests
* fix(engine): borrow caret position while resolving inherited date language
* fix(date): honor selected locale when the date picture is omitted
* test(ui): target date dialog language combo instead of ribbon menu
* test(date): use raw field instruction literal in locale regression
* test(date): match actual single-backslash DATE field instruction
* test(ui): select actual date dialog language option by accessible label
* fix(i18n): add missing automatic date update translation (Romanian)
* fix(i18n): add missing automatic date update translation (Slovenian)
* fix(ui): open date_time dialog from keytip, normalize pt tags, and document items
* fix(ui): default date_time_update preference to false
---------
Co-authored-by: felipegavilanes-source <felipegavilanes@gmail.com>
Fixes#2201. Top/bottom page numbering preserves neighboring header/footer text, formatting and tables, recognizes existing PAGE fields through nested tables/text boxes, and updates gallery-generated numbering in place.
The latest review follow-up lets refreshed PAGE/NUMPAGES result caches vary during generated-number recognition. It retains those caches and paragraph marks during format/alignment changes; identical requests remain clean and add no undo step. Field instructions, flags and paragraph/run formatting remain conservatively checked. Original history, incoming progress notes and readiness estimates are preserved.
Local validation before the integration refresh:
- Actual RED: 13 existing tests passed; the new reopened cached-PAGE fixture failed because right alignment stayed centered.
- GREEN: all **14 preservation tests** pass, with all 13 originals an exact byte prefix. The fixture checks DOCX-reopened caches 7/12, no-op cleanliness/undo, later changes, content/marks/selection and undo/redo.
- Full engine package: **1,350 passed, zero failed, one existing ignored measurement**, including the focused 14. Engine formatting and strict all-target Clippy pass.
- Synthetic DOCX coverage; native Word interoperability was not exercised. No new whole-workspace local run is claimed.
Current head: `5eb4c8cb8b205ebcfcb5b1a48d55c5e21b1683e6`, a normal preserving merge of upstream `d40d1b27181b61990c84c75f77d5fd23ef81d452`. The new roadmap and format-parity documentation conflicts retain all incoming progress and revision history plus this PR's existing page-number notes. All **1,087 published files** match incoming upstream plus the five reviewed changes; both owned Rust files remain byte-for-byte unchanged from `ca615f3` and `447dec8`, and manifests/lock match incoming upstream. No new local Rust run is claimed for this documentation-only integration. The [preceding ca615f3 full hosted gate](https://github.com/storytold/wordcraft/actions/runs/42679017335/job/129368197175?pr=2251) passed in 13m38s. The [required current-head full gate](https://github.com/storytold/wordcraft/actions/runs/42693258780/job/129418282235?pr=2251) passed in **13m06s**; SonarCloud planning/scanning also passed. Required validation is complete. Maintainer edits are enabled; FredApps re-review remains requested.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
## Summary
* **Bug Fixes**
* Adding page numbers to headers and footers now preserves existing content and formatting, including content in tables and text boxes.
* Existing user-owned page fields remain unchanged, while generated page numbers can be updated without disturbing surrounding content.
* Repeating an identical page-number request no longer changes the document’s state or undo history.
* **Documentation**
* Updated page-numbering guidance to reflect these preservation behaviors.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->