* 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>
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>
Moves craft-update, craft-pdf and the krilla patch from storytold/craft-libs
c5a1cbfb to dotCooCoo/craft-libs c7c84230, which is craft-libs main at
0a9d1f48 with storytold/craft-libs#687 and #696 merged in.
- The result window opens whenever the updater's status is not idle: at
the first start after an update it says the version that was installed
or why the update failed, and Help > Check for Updates shows Installing,
Ready and the launcher's choice. A check asked for from the ribbon now
shows the window on the next frame.
- Restart to Update closes the window and asks the app to quit. An update
that asks the app to close quits every window, after asking about each
document with unsaved changes.
- on_exit and the macOS terminate path start the waiting update's helper.
- The update prompt and the result window draw their words through the
interface catalog.
* Proofing: Check spelling as you type is one setting for every open document (#5740)
Each open document's view kept its own copy of the setting. Turned off with one document active, it stayed on in the others, and the settings saved for the next run took the value of whichever document was active then, so it came back on. A document made active now takes the saved preference, as Read Mode's page colour already does.
* Contributors: credit ashokram-si as Ashok Ram
* Proofing: every view made active follows the app-wide settings, a window's view put back too (#5740)
put_view restored a window's view with the Check spelling as you type value it had when it was taken, after switch_to had applied the shared preference, so the settings saved for the next run could take the old value again. One ViewState::follow_prefs now applies the app-wide settings a view keeps a copy of (Read Mode's page colour and Check spelling as you type) wherever a view is made active: switch_to, a new document's view, set_document and put_view.
* test(ui): Check spelling off in a second window stays off in every window (#5740)
The whole sequence through the app: View › New Window, spelling turned off in the second window, the first window's own view put back (put_view), a new document's window, back to the second window, then the saved settings read by a new app. Fails if put_view doesn't follow the setting.
---------
Co-authored-by: ashokram-si <347905169+ashokram-si@users.noreply.github.com>
In a section of several text columns the horizontal ruler was one white
strip from margin to margin. The space between each two columns is now
shaded like the margins, so the ruler shows where each column ends and
the next starts.
The edges of a space can be dragged, through layout.columns, one undo
step per drag, to change the spacing. Equal columns stay equal, so every
space changes with it, as in Word for Mac. Between unequal columns only
the column at that edge and the space change. As in Word for Mac, the
middle of a space has no grip of its own. Columns stay at least a
quarter inch wide and spaces 0-300 pt, as the Columns dialog allows,
snapped to 1/16 inch. Right-to-left sections are read from the right
edge.
Outside the main text, outside Print Layout and in a table the ruler is
unchanged. A selection across sections shows no spaces, since a drag
would set the columns of each section it touches; nor does a page the
caret isn't on. Columns from a file that the command wouldn't take back
(over 12, a column under a quarter inch, a space over 300 pt, wider than
the text) are shaded but not dragged. A tab stop's marker keeps its own
drag where it sits on an edge. The indent markers still follow the page
rather than the caret's column; that is #2196 (PR #2215).
Fixes#5197.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Martin Ball <martin.ball@ucscaregroup.co.uk>
* fix(ui): the File page scrolls across its full width, with the bar at the right edge (#5282)
Turn off horizontal auto_shrink on the File page ScrollArea so the scroll area expands across the full CentralPanel width. This positions the vertical scrollbar at the right edge of the window and allows mouse wheel scrolling over the entire panel width.
* fix(ui): the File page's scroll area reaches the window edge (#5282)
The side padding moves from the panel into the pages, so the scrollbar sits at
the edge and the wheel also works in the rightmost 40 points.
* test(ui): assert the File page's scrollbar sits at the window edge (#5282)