* 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
- 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.
- 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.
system_clipboard::fill recomputed privateClipboard whenever the host could report ownership, overwriting the value the Paste Special dialog captured when it opened. Only compute it when the caller supplied none, so the dialog's format list and the paste agree while ribbon and agent calls keep reading ownership from the clipboard.
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.
- Recognize the XDG document portal mount inside a Flatpak sandbox
(`/run/flatpak/doc/`), so a changed extension reopens the dialog for the
overwrite confirmation like the host mount does.
- Give the portal SaveFile request a real cancellation path: the CancelToken is
armed before the waiting thread starts and cancelled when the system dialog is
given up (File > Open > Browse in WordCraft...). The request closes and the
answer reads as a cancel, so a portal that stops answering cannot keep Save As
stuck; a late cancel after the answer is ignored.
- Map the cancellation error to a cancelled dialog instead of the rfd fallback.
- Regression tests for the Flatpak mount, the CancelHandle arm/cancel/disarm,
and the UI calling the host's cancel hook when the dialog is given up.
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
* 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>
#4501 split functions for `clippy::cognitive_complexity` and was meant to change no behaviour. A post-merge review of the whole diff found four places where it did. This PR restores the old behaviour in each.
- **Layout (`crates/layout/src/pass.rs`).** From section 2 on, headers, footers and footnote separators were measured under the previous section's document grid, with its SECTION/SECTIONPAGES values. Before #4501 the grid was reset first. With a docGrid line pitch in section 1 (common in CJK documents), section 2's body top moved and pages could break differently. The order is now:
1. `begin_section_state`: reset the grid, set the fields and separators.
2. `section_tops`: measure the header and footer room.
3. `apply_section_grid`: switch to the section's own grid.
New regression test `a_sections_header_is_measured_without_the_previous_sections_grid`. Without the fix, section 2's body top is 265.6 pt; with it, 226.9 pt, the same as with no grid.
- **ODT (`crates/formats/src/odt/styles.rs`).** A later paragraph default-style with no font, or a mono font, wiped the default font. It is now kept, as before #4501. Covered by a test.
- **Canvas (`crates/ui-egui/src/canvas/input.rs`).** A press that was handled showed the hover-link tooltip for one frame, which the old early `return` had skipped. This covers Ctrl+click on a link, switching to the header or footer, entering an equation, and a miss. `handle_primary_press` now returns `bool`. No test.
- **Czech suggestions (`crates/proof/src/cs/suggest.rs`).** The one-letter edits are bounded by the word's letter count as typed again. That count is clamped to the lowercased length so indexing can't go out of range. #4501 had bounded them by the lowercased length, which differs for e.g. `İ`.
`cargo xtask ci` passes locally (all 8 steps, 4606 tests).
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Bug Fixes**
* Default document fonts remain available when a later paragraph style does not specify a usable font, and a later monospaced default does not replace an earlier proportional font.
* Headers, footers, and note separators use the layout settings and section values of their own section, helping prevent content from overlapping.
* Link hover tooltips are suppressed during canvas-handled clicks and return when the pointer hovers over the link after the press is released.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What
Builds on #3131 (the contextual tab glide); this PR is based on that branch.
- Every ribbon button and tab fades its hover in and out. Before, only some buttons did.
- Disabled buttons do not answer hover or press.
- A ribbon group glows from its bottom edge while the pointer is anywhere in it. The glow is about 9 pt tall and fades out upwards and towards both sides. It fades in and out with the pointer.
- The tab underline slides to the tab you choose, with the same ease as the contextual tab glide.
- The ribbon content fades and slides in (14 pt, 0.16 s) from the side the new tab lies on.
All motion follows the animation setting: with animations off, nothing moves and nothing fades.
## Screenshots
<img width="298" height="115" alt="image" src="https://github.com/user-attachments/assets/9b5ba886-1dcd-4260-a2dd-cecdf199e111" />
<img width="498" height="192" alt="ribbon-animated-dark" src="https://github.com/user-attachments/assets/bc43168b-183a-4ec0-875c-a9550f22fb36" />
<img width="548" height="158" alt="ribbon-animated" src="https://github.com/user-attachments/assets/4d50427e-376d-4a6a-a0bd-b1ed42fe0c9c" />
## Tests
- Pure tests for the underline slide and the tab change direction.
- `cargo test -p wordcraft-ui-egui` and clippy `-D warnings` pass.
## Related
- Overlaps with #3256 and #1420 (issue #1419): both also slide the underline and fade the content on a tab change. The hover fade and the group glow are new here. Whichever lands first, the other needs a small merge in `ribbon.rs`.
- Possibly related: issue #585.
- The Search box text centring is its own PR, #3802 (issue #3779).
- Based on #3131.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **New Features**
* Ribbon tabs animate as they appear and disappear, with a sliding active-tab indicator and fading, directional transitions between tab content. Departing contextual tabs remain visible briefly but cannot be selected or appear in the overflow menu.
* Tab and overflow-button hover feedback is animated. Ribbon groups display a soft accent glow when hovered.
* **Bug Fixes**
* Disabled buttons no longer show hover or pressed backgrounds. With animations disabled, tabs and content appear immediately.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
* fix(clipboard): size-check a Wayland clipboard picture before it is decoded
* address review: refuse a clipboard PNG the renderer cannot decode within its budget
* #5124: the window moves by its title bar behind a modal dialog
On macOS WordCraft draws its own title bar, and since modal dialogs
(#3859, #4076) the dialog's backdrop covers it, so the window couldn't be
dragged while a dialog was open. Word for Mac lets you drag the document
window by its title bar behind its Font dialog (and beeps on the click).
- The title bar (and the Backstage's top band on macOS) notes the part
that drags the window each frame. When the modal backdrop's drag starts
there, it moves the window; the press still shakes the dialog, as Word
beeps.
- Only the backdrop's own drag counts, so a drag on the dialog, its tabs
or its popups, where it reaches over the title bar, moves only the
dialog.
Tested by the developer on a Mac.
Fixes#5124.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #5124: only the macOS title bar moves the window behind a dialog
Review (CodeRabbit):
- Elsewhere the system's title bar already moves the window; WordCraft's
own bar under it now doesn't, behind a modal dialog either, so nothing
changes on Linux and Windows.
- A drag from just inside the dialog's edge, where it reaches over the
title bar, moves only the dialog, as the nudge already tells it apart.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #5124: the window moves by its title bar behind Colors too; modal_open tests
Colors is an egui Modal, not a window with the backdrop of block_behind, so
a drag on the macOS title bar did nothing behind it. It now shares the check
with the other modal windows.
The new tests pin modal_open with nothing open, a modeless dialog, a modal
dialog, the file browser and Colors, and that the title bar moves the window
in each of those while the dialog stays open.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #5124: the modal drag test covers the top of File's side menu
On macOS File's side menu covers the title bar, and its top band moves the
window. The test now drags there too, so losing the band's note_title_drag
call fails it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
A text box inside a group (Word's cards made of a coloured bar and a text
box) could not be edited: every click selected the whole group, and typing
then replaced the group with the typed text. Layout now keeps each group's
text box areas on the group's object, and hit testing treats them like a
text box on its own: inside is the box's text, the border and the group's
other members still grab the group (#6027).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>