* M3: restore native Wayland pinch through the resolved winit fork
Refresh #1580 on current main, pin the tested companion winit port and keep vendor changes as provenance. Permit only the exact temporary fork revision until storytold/winit#20 is merged. Retain the egui scale regressions and document current validation limits.
* docs: record native pinch verification and keep roadmap quotes contiguous
Document current-head GNOME feedback and protocol evidence, retain untested compositor and teardown limits, and address the MD028 review finding without changing runtime code or dependency-origin policy.
---------
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Since the craft framework port, Find tools and commands (Ctrl+K) listed every row
disabled, so Enter and clicks ran nothing. The open palette counted as a modal in the
app's command gate (menus::gated), and craft-libs applies that gate to the palette's own
rows, which it resolves and fires as the window under the palette has them.
- The command gate counts dialogs and prompts only. While the palette is open its modal
layer still keeps the keys and the controls under it from the commands; menus::gated
keeps the palette for the menu bar's keys and the native menu, as 0.22.0's menu gate did.
- The palette's tool rows fire tool.group with the group in a parameter, which nothing
handled; run_catalog_command now opens the named tool, as it does for tools.<id>.
- split_view_render::a_late_edit_turns_the_page_in_both_panes opens the palette with
Ctrl+K and types its query, and runs again; its row leaves docs/port-known-gaps.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alt.rs: main now resolves indirect structure kids (#5611), checks the parent and computes the new parent /K before it reads the page, and marks content through decode_page_streams/Marked (damaged streams refuse). This PR's mutation_mcids ownership checks replace main's has_child_structure + mcids in both actions, and its reachable-parent check runs with main's parent checks, before any write. Since main validates the parent first, the missing-/P + missing-content case now refuses with NoParent (test renamed), still without mutation. tools.rs and roadmap keep main's text plus this PR's refusal notes.
Main split organize/src/import.rs into import/{carry,combine,copy,fields}.rs and already made set_attachments UTF-16-safe and indirect-/Names-safe (this PR's other two hunks), so those take main's version. Ported the PR's core change: insert_file_pages now merges the source's catalog attachments via carry::collect_attachments + attachments::entries (made pub(crate)) + set_attachments. PR's engine regression test file kept as-is; parity evidence/notes merged onto main's entries (it/ paths); ROADMAP/docs entries added to main's text. cargo check -p pdfcraft-organize -p pdfcraft-engine --tests passes locally.
Auto-tag Apply finds text that repeats near the top or bottom edge of
most pages before assigning roles: the same text, digits and lone roman
numerals aside, within 4 units of the same height, on at least 40% of
the pages and at least two. It wraps that text in
/Artifact <</Type /Pagination /Subtype /Header|/Footer>> BDC ... EMC
with no MCID instead of tagging it (ISO 32000-2 14.8.2.2). A group of
changing, heading-sized text is left as headings. Running text is left
out of the body style and heading levels, MCIDs number the tagged
objects only, and AutoTagResult counts headers and footers.
a11y::running_text lists the findings without changing the document;
accessibility_autotag_apply returns them as running_text and
running_count, and its note says so.
Adapted from pdfcer (MIT, same author) at ccb49b46, block_layout.rs,
with distinct pages counted instead of objects.
Closes#7065
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
**Update on 2026-11-03 (`db57e7de`).** Merged main `ecdd1e65` and preserved both sets of parity evidence. The picker now uses the public `ComboBox::show_ui` response to track the open menu and clear its search when it closes. All 30 print UI tests passed locally on macOS arm64, including the three printer-picker regressions. Formatting and `cargo xtask parity` passed. [CI](https://github.com/storytold/pdfcraft/actions/runs/41673448570) and [SonarCloud](https://github.com/storytold/pdfcraft/actions/runs/41673448592) track this commit.
## What this changes
Fixes#4399.
The printer picker opens a wider, taller menu with a name filter. Long device names wrap, while Search and Save as PDF stay visible as the device list scrolls. Search ignores case, trims surrounding spaces and keeps the current destination until a row is chosen. Reopening clears the filter and brings the selected device into view.
The large-fleet test now checks that the selected row is between Search and Save as PDF after reopening, without manually scrolling at that point. This catches a broken automatic reveal instead of hiding it with a test-side scroll.
## How you verified it
- At `d14aed41`, the [hosted gate](https://github.com/storytold/pdfcraft/actions/runs/40305529036/job/121513571419) passes: 5,194 tests, 21 skipped. All three `printer_picker` tests explicitly pass, including the new reopening visibility assertion. Formatting, strict Clippy, layers, assets, parity and wasm checks pass in that gate.
- CodeRabbit's refreshed documentation check passes at 100%; both remaining test helpers are documented.
- The three original UI regressions failed against the original production module. They cover a 120-device fleet, Unicode/case matching, selection, reopening, no matches, long names and a 1024×768 window. A separate earlier before/after check caught an initially clipped Save as PDF row by physically clicking it.
- Earlier macOS validation inspected headless captures and exercised the real Print dialog through its control channel. Those are earlier-run results, not a new native macOS run on this head.
- The current local Windows Cargo 1.95 run cannot resolve the pinned craft-menu manifest and does not reach the UI tests. Runtime validation of this latest test update is the hosted gate above; no local test pass is claimed.
## Safety, provenance and reach
- [x] No new panicking shortcuts, unsafe code or input-derived indexing.
- [x] No new assets, fonts or dependencies.
- [x] Existing printer discovery, properties and print submission paths are used.
- [x] Automation remains available through `printers`, `printer_options` and `doc_print`; UI controls remain opt-in.
- [x] Printer-selection parity evidence and M10 progress notes are updated.
## Limits of verification
Physical printing was not tested. Keyboard injection into the earlier background native macOS window did not enter text; filter typing and selection were verified through egui_kittest.
AI assistance: implementation, tests and validation used Codex.
A launcher with StartupNotify=true passes an activation token in
XDG_ACTIVATION_TOKEN (Wayland) or DESKTOP_STARTUP_ID (X11) and shows a
busy cursor until a window hands it back. winit hands back only a token
given through with_activation_token, and eframe never gives one, so GNOME
kept the busy cursor for 15 seconds after PdfCraft's window appeared, and
a Wayland window opened without keyboard focus.
Vendored winit patch 14: the first window created without a token takes
the environment's. Later windows don't reuse the spent token; an empty or
oversized (over 1,024 bytes) token is ignored, since on X11 an oversized
one would fail window creation. The variable stays in the environment:
removing it while other threads may read it is unsound.
Tests: startup_token's policy tests in the vendored crate (three fail with
the policy reverted) and apps/pdfcraft/tests/winit_startup_token.rs, which
keeps the patch in the build (fails with the Window::new wiring reverted).
* Add Bosnian (bs) to the interface languages
bs.tsv: Bosnian (Latin script, Ijekavian) catalog covering every key of
PdfCraft's other catalogs, its wording shared with storytold/craft-i18n
locales/bs/ and the strings craft-i18n lacks translated new. Every bs-*
locale selects it; counts use one/few/other. Locale and plural tests,
localization docs and an attribution entry (AI-assisted, not yet
reviewed by a native speaker).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z
* Bosnian: date-format language, English picker name, word-count ellipsis
Preferences > Date format offers exactly the interface languages, so
Bosnian gets its month and day names there; the picker falls back to
"Bosnian" when no face can draw the native name; Word Count keeps the
command label's trailing ellipsis.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z
* bs: wording from the craft-i18n catalog review
The Bosnian catalog review (storytold/craft-i18n#72) asked for one word
per concept; this catalog follows: pan is "pomjeranje" (not
"pomicanje"), a spreadsheet is "proračunska tabela", Greek & Cyrillic
reads "Grčko pismo i ćirilica". Placeholders and ellipses are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z
* bs: take the catalog from craft-i18n, keep only PdfCraft's code
PdfCraft now reads its translations from storytold/craft-i18n (#6055),
and this PR's Bosnian rows are there (storytold/craft-i18n#141, in the
pinned commit), so crates/ui-egui/src/i18n/bs.tsv goes. What stays is
PdfCraft's part, redone against the new registry: the bs row in
LANGUAGES, "Bosnian" as its English picker name, Bosnian date names,
locale, persistence and one/few/other plural tests (Bosnian follows the
Russian rule in the legacy rule table), and the docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z
* docs: Bosnian revision row in the revision history; language totals
The 2026-11-04 Bosnian row had landed in the key-languages table instead
of the revision history; it is now the history's first row. The summary
counts 21 other languages, 35 catalogs plus English, 36 in Preferences,
as LANGUAGES lists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z
* Docs: list bs as a ui.set / ui.state language value
---------
Co-authored-by: Claude <noreply@anthropic.com>
Main now has page actions, timers and layers (#6985) and shared text
allowances for inspection (#6015). Conflicts:
- render/inspect/annotations.rs: main's collect_link (which notes
JavaScript even when the link isn't listed) takes this branch's link
script budget and its once-only warning; push_link is gone.
- automation form_tools.rs, js tests.rs, docs/acroform-script-workflows.md:
both sides added at the same place; both kept.
Adapted to main: the link runner's Job gets `timer: None`, and, as a
button's script does, the document's layers and the fields as page
actions and timers show them (live_state).
vendor/README.md conflicted: main took hayro-interpret patch 104 (RGB
colours in isolated DeviceCMYK groups). This branch's viewer overrides
become patches 105 (annotation_overrides) and 106 (appearance_overrides)
in the README, in vendor/hayro-interpret/src/interpret/mod.rs, in the
raster test and in docs/acroform-script-workflows.md.
* feat(a11y): auto-tag Apply tags headings by size and weight
Apply now chooses H1-H6 or P per text object instead of P for all.
The body style is the half-point size showing the most characters (bold
when most of those are bold). A short object (at most 3 lines, 200
characters, with a letter) is a heading when it is 1.15x the body, or
bold at 0.9x the body over a regular body in at most 2 lines. Heading
styles rank across the document, larger and bolder first, capped at H6,
and a level never skips past the one before it so heading-nesting
passes.
Size is Tf x Tm x CTM with q/Q tracked; bold is Metrics.bold. Text in
render mode 3 (an OCR layer) is not counted. Font metrics are measured
once per font object per document, at most 256 fonts.
AutoTagResult gains a headings count. Parity, gaps, roadmap and the
apply tool's note say headings are tagged.
Fixes#7062.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(a11y): rank heading styles by map and skip clip-only text
Look up each heading style's rank in a map built once after sorting,
so ranking is linear in the number of text objects. Text in render
mode 7 (clip only) paints nothing, so it is excluded from heading
evidence like mode 3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: KenM76 <KenM76>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(js, forms): field setItems, setAction and a bounded toSource (#269)
Ported from #344 by @DWAA1660 onto the per-document script session.
- `field.setItems(items)` replaces a combo or list box's items (text, or
[text, export] pairs). The value stays when an item still has it, and
otherwise becomes the first item's. Written as the field's /Opt (pairs
only where the export value differs), /I dropped, field redrawn.
- `field.setAction(trigger, script)` installs a JavaScript action for one
trigger (MouseUp/Down/Enter/Exit, OnFocus/OnBlur, Keystroke, Validate,
Calculate, Format), replacing only that trigger's action.
- `Object.prototype.toSource()` writes plain data (strings, numbers,
booleans, null, undefined, arrays, objects) that eval reads back. It
refuses functions, cycles, more than 64 levels, 10,000 values or 1 MiB
with an error the script can catch.
Co-authored-by: DWAA1660 <dwatnip123@gmail.com>
* feat(engine): run a form's open, Will Save and Will Print actions and its widgets' pointer and focus scripts (#269)
Ported from #344 by @DWAA1660 onto the per-document script session: each
runs in the document's retained realm, so state the document scripts and
earlier events left is kept.
- The catalog /OpenAction's JavaScript (and its /Next chain, bounded and
cycle-safe; other action types skipped) runs once on opening, after the
document scripts, for background opens and reloads too, and again on
Revert in a fresh realm. Event Doc/Open.
- `Session::run_document_actions` runs /AA /WS (Will Save) or /AA /WP
(Will Print). A failing action is reported and never stops the save or
print. doc_save and doc_print run them first and report what they said
(`will_save`, `will_print`).
- Scripts that run unasked (open, Will Save, Will Print, pointer over,
focus) may only ask for highlight, zoom, focus or a page; a click's
Mouse Down / Mouse Up keep their requests.
- `Session::field_trigger` runs a widget's Mouse Enter, Mouse Exit, Mouse
Down, Mouse Up, Focus or Blur JavaScript (one undoable edit), reading only
that widget's dictionary. `field_focus` now runs an AcroForm widget's On
Focus / On Blur as well as XFA enter/exit.
- New tool `js_event`; form_focus's description says AcroForm focus
scripts run too.
Co-authored-by: DWAA1660 <dwatnip123@gmail.com>
* feat(ui): Will Save before saving, Will Print before printing, and widget pointer scripts in the app (#269, #247)
Ported from #344 by @DWAA1660.
- Save (both paths) runs the document's Will Save actions first, and Print
its Will Print actions; what they change is saved or printed, and what
they say is shown.
- The pointer moving onto or off a form widget queues its Mouse Enter /
Mouse Exit script, a press its Mouse Down. A click on a check box or radio
button queues its Mouse Up after the toggle, so the script reads the value
the click stored (#247). The queue runs after the frame's edit.
Co-authored-by: DWAA1660 <dwatnip123@gmail.com>
* docs(parity): document actions and widget triggers are partly supported (#269)
Co-authored-by: DWAA1660 <dwatnip123@gmail.com>
* test: check toSource's text (scripts can't eval it) and the trigger event names (#269)
Co-authored-by: DWAA1660 <dwatnip123@gmail.com>
* test: a check box's Mouse Up reads its new value; keep the fixtures on screen and the realm across an in-place save (#247, #269)
Co-authored-by: DWAA1660 <dwatnip123@gmail.com>
* fix(engine, forms, js, ui): review fixes for document actions and field triggers
- widget trigger actions follow /Next, each action its own edit; errors don't stop the chain
- setAction installs on the field the object stands for when names repeat
- toSource refuses non-plain objects and a __proto__ key
- doc_print checks the destination before Will Print; js_event returns only its own output
- combo/list clicks run Mouse Up; a refused click's Mouse Up doesn't run
- label crops are re-read when Will Print changed the document
Co-authored-by: DWAA1660 <dwatnip123@gmail.com>
* forms: run a pointer trigger on the field it hit and refresh the edited field's draft
A trigger now carries the field's object, so of fields sharing a name the one under the
pointer runs its own script (Session::field_trigger_target); js_event passes the field it
resolved. A trigger script changing the field being edited shows in its editor unless the
user already typed there, as focus scripts do.
Co-authored-by: DWAA1660 <dwatnip123@gmail.com>
* forms: carry the field's identity through focus scripts and js_event
Focus transitions now track the field object, so moving between fields sharing a name is a
move and the field that gained or lost focus runs its own script
(Session::field_focus_target). js_event takes an optional field_id from form_fields to pick
one of fields sharing a name.
Co-authored-by: DWAA1660 <dwatnip123@gmail.com>
---------
Co-authored-by: DWAA1660 <dwatnip123@gmail.com>