Commit Graph
3271 Commits
Author SHA1 Message Date
batistalucasv 2bda4e5a41 M2.1: Resolve Fit One Page stores by marker, reserve path, and location provenance (#6433)
- 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.
2026-11-12 23:44:54 -03:00
batistalucasv 3f7bff9204 M2.1: Only inspect the Fit One Page DOCX part by name (#6433)
Check the fixed custom XML part name before parsing, so unrelated custom XML
stores are not read twice just to look for the fit budget.
2026-11-12 19:35:12 -03:00
batistalucasv d30a8392f9 M2.1: Harden Fit One Page budget provenance and DOCX persistence (#6433)
- 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.
2026-11-12 19:32:10 -03:00
batistalucasv 15c5b68da6 M2.1: Use session deletion visibility in Fit One Page guards (#6433)
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.
2026-11-12 18:23:58 -03:00
batistalucasv 1c3839aa16 M2.1: Fix Fit One Page provenance and Print options (#6433)
- 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.
2026-11-12 18:17:45 -03:00
batistalucasv f392c14f6b Merge upstream/main into feat/fit-one-page-upstream 2026-11-12 16:44:42 -03:00
FredApps 6bf96e65e4 Merge pull request #6225 from batistalucasv/fix/6205-image-copy-paste
Clipboard: transfer copied images to system clipboard and preserve media across internal paste (#6205)
2026-11-12 20:20:29 +01:00
batistalucasv 48d9c2a46c M2.1: Fix remaining Rust 1.100 Clippy lints (#6433)
Replace indexed row/cell loops with mutable iterators in the layout table
tests and the table eraser test. Test-only; no behaviour change.
2026-11-12 15:57:34 -03:00
Codex d54fb78544 test: avoid range indexing in layout and eraser fixtures (#6225) 2026-11-12 19:43:54 +01:00
batistalucasv a45e37b90d M2.1: Fix Rust 1.100 Clippy lint in LaTeX table test (#6433)
The gate's Clippy flags needless_range_loop in the borderless/bordered table
fixtures. Iterate the rows and cells mutably instead; no behaviour change.
2026-11-12 15:42:08 -03:00
Codex aa6deaee03 test: use mutable cells in LaTeX table setup (#6225) 2026-11-12 19:39:50 +01:00
Codex 869350d4c7 Clean combined UI parity history after main merge (#6225) 2026-11-12 19:31:52 +01:00
batistalucasv 139aa7a51b Merge branch 'main' into fix/6205-image-copy-paste 2026-11-12 15:30:43 -03:00
FredApps 76d5f13a03 Merge pull request #6232 from batistalucasv/fix/6180-linux-save-as-ext
Save As: on Linux the file type picked in the save dialog sets the extension (#6180)
2026-11-12 19:29:52 +01:00
batistalucasv b71f257f1b M2.1: Match table region formatting in Fit One Page break scan (#6433)
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.
2026-11-12 15:24:10 -03:00
batistalucasv d87e6f7930 M2.1: Fix remaining Fit One Page review findings (#6433)
- 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.
2026-11-12 15:14:13 -03:00
batistalucasv ed09a2158f M2.1: Fix Fit One Page review findings (#6433)
- 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.
2026-11-12 15:01:22 -03:00
FredApps 11318f9226 Merge main and preserve both UI parity histories (#6225) 2026-11-12 18:13:35 +01:00
FredApps 0196647dc6 Merge main and preserve both UI parity histories (#6232) 2026-11-12 18:13:35 +01:00
10e5bb8bce View: editable Markdown source view for .md files (#5826) (#6004)
* 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>
2026-11-12 17:59:04 +01:00
batistalucasv c8e64d72cc UI: vertical scrollbar track advances one screen (#5853) (#5892) 2026-11-12 17:58:46 +01:00
batistalucasv 98619947d7 M2.1: Layout: add Fit One Page (#6433)
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.
2026-11-12 13:45:53 -03:00
batistalucasv 664b033071 Save As: don't open the rfd fallback after the portal dialog was given up (#6180)
Giving the dialog up cancels the request. If the portal then fails with an
error other than its cancellation code, the worker opened the rfd dialog even
though nothing was waiting for the answer, leaving an unwanted Save dialog on
screen. The fallback now checks this request's cancellation token first.
2026-11-12 12:52:55 -03:00
batistalucasv 1a8fd899d3 Clipboard: keep the ownership flag Paste Special captured (#6225)
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.
2026-11-12 12:38:27 -03:00
batistalucasv 2d286fe252 Save As: only the request that armed the portal cancel token disarms it (#6180)
An abandoned portal request finishing late cleared the token of a newer
request in the shared slot, which left the newer Save dialog uncancellable.
Each arming now carries an identity and only its owner clears the slot; a
regression test arms two requests and disarms the older one.
2026-11-12 12:36:00 -03:00
batistalucasv ab90b7142e Clipboard: honor another program's clipboard ownership on paste (#6225)
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.
2026-11-12 12:22:28 -03:00
batistalucasv 02f8022e57 Merge remote-tracking branch 'upstream/main' into fix/6205-image-copy-paste
# Conflicts:
#	docs/gaps.md
#	docs/ui-parity.md
2026-11-12 10:41:04 -03:00
batistalucasv afcb2ce46e Docs: record clipboard picture copying in gaps and UI parity (#6205) 2026-11-12 10:37:38 -03:00
batistalucasvandCommandCodeBot 4671e47b50 Save As: cancel a stalled portal request and recognize the Flatpak document portal (#6180)
- 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>
2026-11-12 10:15:36 -03:00
batistalucasv cd4e63849e Clipboard: qualify the CF_HTML helper in the Windows host (#6205) 2026-11-12 10:06:07 -03:00
batistalucasv a1d4495cfb Clipboard: account for fragment media and test CF_HTML offsets (#6205) 2026-11-12 09:53:17 -03:00
FredApps 07f977372d CI: nightly release dry run (#6367)
release.yml also runs nightly on main with craft-common-actions' dry-run: every release build
except macOS, with nothing signed, pushed or drafted. Breakage that only the release build hits
(riscv64, Flatpak, FreeBSD, packaging) then shows up the next morning instead of on release
day, as it did on 11 Nov 2026.
2026-11-11 23:04:54 +01:00
batistalucasv cc27f29a01 Save As on Linux: the file type picked in the save dialog sets the extension (#6180) 2026-11-11 18:08:29 -03:00
Dylan M. Taylor 06c2ae6f9d ci: use StepSecurity's maintained actions (#6343)
Each third-party action that StepSecurity publishes a secure drop-in
replacement for now uses that replacement, pinned to a commit with its
version as a comment. Versions follow what we used: the newest
StepSecurity release in the same major, or the closest major they
publish. dtolnay/rust-toolchain refs that named a toolchain (stable,
nightly, 1.76) become the replacement's `toolchain` input.
2026-11-11 14:59:04 -05:00
Dylan M. Taylor a58b41a716 chore: bump version to 0.18.1 for the Flatpak update fix (#6344) 2026-11-11 14:56:11 -05:00
Dylan M. Taylor d86d2b69f8 Fix Flatpak permissions for update checks and self-updates (#6339)
* fix(flatpak): allow release checks and self-update helpers

* test: keep Flatpak permission parsing within strict Clippy rules
2026-11-11 14:24:25 -05:00
FredApps a8db235e05 Release: WordCraft v0.18.0 (#6294) 2026-11-11 19:35:57 +01:00
batistalucasv 4706420e94 tools: chunk LCS alignment past MAX_LCS window to prevent false revisions (#6110) (#6124) 2026-11-11 19:11:33 +01:00
batistalucasv ae7ae89eb2 fix(engine): surface character-level compare fallback on long paragraphs (#6111) (#6120) 2026-11-11 19:09:43 +01:00
Dylan M. Taylor 1327d20055 Merge pull request #6333 from storytold/chore/craft-update-6e03f65
Updates: take craft-update from craft-libs main at 6e03f65bf
2026-11-11 12:53:23 -05:00
Dylan M. Taylor 9dba000e86 Updates: take craft-update from craft-libs main at 6e03f65bf 2026-11-11 12:53:17 -05:00
batistalucasv 7013411a2f cli: skip update-fields with warning on protected document (#5839) (#5849) 2026-11-11 18:53:10 +01:00
Dylan M. Taylor 411a4915a1 ci: run Harden-Runner on every job (#6327)
Adds step-security/harden-runner (audit, pinned to v2.22.4 like
craft-common-actions) as the first step of each job that did not have it,
so every workflow in the org's public repos reports its egress to
StepSecurity. Audit, not block: block-mode allow lists come from each
job's observed traffic.
2026-11-11 12:44:00 -05:00
bmh129andbmh129 639b8133ea Linux: stay on native Wayland when the X11 libraries are missing (#3359)
The deb and rpm only recommend the X11 libraries, and the release tarball
doesn't install them. When the display-server choice (#2184) or
WORDCRAFT_WAYLAND=0 asked for XWayland without them, the app failed to
start: winit panicked in xkbcommon-dl without libxkbcommon-x11 (seen on
Fedora 44 and Ubuntu 26.04).

uses_x11 now also takes a check of the libraries winit's X11 backend opens
(libX11, libXcursor, libX11-xcb, libXi, libxkbcommon-x11), asked only when
X11 would be forced. If any is missing, X11 isn't forced and the log line
names them. The packages now also recommend libX11-xcb and
libxkbcommon-x11, and the README lists the libraries XWayland needs.

Tests: missing_x11_libraries_leave_the_app_on_wayland (every way of asking
for X11, and that asking for Wayland doesn't run the check).

Co-authored-by: bmh129 <11478682+bmh129@users.noreply.github.com>
2026-11-11 12:04:55 -05:00
FredApps e0659e45ce CI: Print installs its Linux packages through the shared fallback mirrors (#6308)
The Print job runs its own apt-get, so it failed while ubuntu.com did not resolve on the runners
(11 Nov 2026). configure-apt-mirrors (craft-common-actions) points apt at mirrors outside
ubuntu.com when those don't answer, as the shared jobs already do.
2026-11-11 17:56:20 +01:00
batistalucasv ad5e1a65fc #6159: refuse ui.screenshot on secondary document windows and support root window selection (#6169) 2026-11-11 14:22:51 +01:00
batistalucasvandfelipegavilanes-source bf426c1804 Insert > Date & Time: Word-style dialog with regional formats and field support (#5093) (#6022)
* 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>
2026-11-11 14:21:31 +01:00
batistalucasv b67d3b8735 Engine: fall back to fsync on Apple targets when full flush is unsupported (#6155) (#6161) 2026-11-11 14:20:39 +01:00
batistalucasv e3fef2a9c3 backstage: right-align template titles and thumbnails in RTL (#6151) (#6163) 2026-11-11 14:19:51 +01:00
batistalucasv 28af39b610 Clipboard: preserve system clipboard and ownership when copy has no selection (#6205) 2026-11-11 09:34:43 -03:00