2503 Commits
Author SHA1 Message Date
FredApps 1feb7c3f05 Merge pull request #7147 from indy2kro/fix/7010-active-pane-edge-under-menus
fix(ui): split view's active-pane line is drawn under open menus (#7010)
2026-11-20 21:46:33 +07:00
FredApps c05499f707 Merge pull request #2923 from regendorf-ux/pr/tab-rename
Rename the open file from its tab (Rename… and double-click), with names that work on every system (#2102, #2867)
2026-11-20 21:03:47 +07:00
aiongg 3f3b3e634a Adopt the shared AGENTS.md (RFC-0072) (#7937)
* Adopt the shared AGENTS.md (RFC-0072) and test rules (RFC-0071)

* Point removed AGENTS.md section references at the shared standards
2026-11-20 18:10:17 +07:00
FredApps 60ca578c37 test(ui): await native button script completion 2026-11-19 00:37:30 +01:00
FredApps f9bfa19e74 test: keep startup password assertions independent of worker order 2026-11-18 21:26:45 +01:00
Valentin Klein 439401188d Double-clicking a one-letter word selects only that word
Double-clicking a one-letter word in the paragraph editor now selects only that word, so typing replaces just it.

Fixes #7413

<details><summary>Details for review</summary>

**Cause:** the paragraph editor uses `egui::TextEdit`, whose double-click selection combines previous-word and next-word navigation around the nearest caret. With the caret at the start of a word (or end of one) the previous-word step skips the space and lands in the neighbouring word, so the left half of `a` in `Take a calm walk.` selected `Take a`. I confirmed the cause in the pinned egui fork (`select_word_at`) and that the issue's analysis matches. The fork is a pinned dependency, so I fixed it in PdfCraft rather than in egui.

**Fix:** after the editor is shown, a double-click is narrowed to the word under the caret: the word that starts at the caret, or the one that ends at it. This reuses egui's own word boundaries (`ccursor_previous_word`/`ccursor_next_word`), so what counts as a word is unchanged. Only a double-click with the pointer over a word glyph is narrowed; one on a space is left to egui (the caret a space hit reduces to ends the word before it). The added-text editor (`content_ui.rs`) gets the same correction. The other multiline boxes (comments, form fields, fill and sign, dialogs) are left as they are: they are short notes and fields, not page text, and most are added with `ui.add`, which returns no galley to test the pointer against. Right-to-left runs are a known limit: there the glyph test finds no glyph and egui's selection is kept. Shift-double-clicks are left to egui too (it extends the selection then). Shift-clicks and Shift-double-clicks that follow a narrowed double-click, in a row and in either direction, keep the word selected until a plain click or new selection: egui's word anchor cannot be set from outside and `set_char_range` clears it, so the click is completed in PdfCraft to give the result egui gives after its own double-click.

**Tests** (`crates/ui-egui/src/tools/edit_text_ui.rs`):
- `a_double_click_at_a_word_edge_means_that_word`
- `double_clicking_a_one_letter_word_selects_only_that_word` (drives a real `TextEdit` with a double-click 20% into the `a`; without the fix it selects `Take a`, I checked this)
- `a_shift_double_click_keeps_the_extended_selection` (with Shift held, the selection egui extends is kept; without the Shift check it is cut to `a`)
- `a_shift_click_after_the_narrowed_double_click_keeps_the_word` (Shift-click and Shift-double-click before, after and inside the narrowed word, compared with egui's own double-click of `calm`; without the completion a Shift-click before `a` selects `ke ` and drops it)
- `shift_clicks_in_a_row_keep_extending_from_the_narrowed_word` and `shift_double_clicks_in_a_row_extend_by_words_from_the_narrowed_word` (before, after, before again in one box, compared with egui's own double-click of `calm`; with the anchor dropped after the first extension the later clicks lose `a`)
- `a_one_letter_word_that_starts_a_wrapped_row_is_narrowed` (a narrow box where `a` starts the second row; at a soft wrap the end of a row and the start of the next share an index)
- `a_key_that_moves_the_selection_ends_the_word_anchor` (double-click `a`, Shift+Right, then Shift-click before: extends from the selection's own start as egui does)
- `a_double_click_on_a_space_is_left_to_egui` (four points across the space after `Take`: the selection equals egui's own; without the glyph check the left half selects `Take`)

Checked: `cargo test -p pdfcraft-ui-egui` (1021 unit tests pass, plus the integration tests), clippy `-D warnings --all-targets`, rustfmt, `xtask layers`, `xtask assets`. Ten integration tests (`ocr::*`, `comments::the_selection_bar_stays_inside_the_pages_area`, `editing::a_custom_property_whose_name_the_tools_refuse_is_listed_and_left_alone`) fail the same way on current upstream/main without my change. I did not run the native app by hand.

</details>
2026-11-18 16:37:57 +07:00
.CooCoo 0293facd77 Tests: frame budgets scale with a calibration workload on slow machines
## What this changes

UI frame-budget tests scale the 40 ms budget against a fixed workload of 18 million integer updates. Calibration runs before and after each round's frames, each run taking the fastest of three trials, and the faster of the two runs sets that round's budget. A 17 ms reference sets the scale, capped at three times the base budget. Calibration does not call egui or PdfCraft.

Each frame measurement uses the budget calculated for that round. The `PERF` lines include both calibration durations, scale factor, budget, average frame time, and worst frame time. The wheel-input frame test checks against the same calibrated budget.

## How you verified it

- [x] `cargo fmt --check`
- [x] clippy with `-D warnings` on the crates I changed
- [x] tests pass on the crates I changed
- [ ] `cargo xtask layers` and `cargo xtask assets` (if you touched crate boundaries or any asset)

- `cargo fmt --all -- --check`
- `cargo clippy -p pdfcraft-ui-egui --all-targets -- -D warnings`
- `cargo test -p pdfcraft-ui-egui --test perf -- --nocapture --test-threads=1`

On Windows, the four performance tests passed with calibration between 16.33 and 16.57 ms, factor 1.00, and a 40 ms budget. A temporary 45 ms delay in every measured step made the comments test fail in all three rounds, with a best average of 47.81 ms. Scaling calibration and average frame durations by 2.5 passed all four tests with budgets between 96.40 and 98.17 ms. Both temporary changes were removed.

On 17dca72, `cargo test -p pdfcraft-ui-egui --test perf -- --nocapture --test-threads=1` passed 5 tests on Windows with calibration between 17.34 and 17.60 ms and budgets between 40.80 and 41.17 ms. `contention_during_one_calibration_does_not_raise_the_budget` fails when only the calibration before the frames sets the budget.

On 0baf089 (`main` at 5aaa818 merged in), the same command passed 7 tests on Windows with calibration between 16.86 and 17.33 ms and budgets between 40 and 40.47 ms, and `cargo check --workspace --tests` passed. `the_returned_budget_is_the_selected_rounds_faster_calibration` drives the rounds with fixed calibrations and averages and fails when only the calibration before the frames sets the budget.
2026-11-18 16:34:15 +07:00
Livio Oswald 55983f1f92 M12: forms show and add pages from page templates (#1429)
## What this changes

Part of #1429. The form in that report keeps pages it shows on demand as **page templates**: the name dictionary's `/Templates` tree names pages kept out of the page tree, and `/Pages` names visible ones (ISO 32000-2 §7.7.4). Until now their fields were listed as unplaced, and the form's JavaScript could not reach them, so buttons that add a page or show a section did nothing.

- **organize**: `templates`, `spawn_template` and `set_template_hidden`.
  - A spawned page is a copy of the template page.
  - With renaming, its fields become fields of their own under `P<page>.<template>.<name>`.
  - Without renaming, its widgets join the template's fields and share their values. A template field that is its own widget is split into field + widget first.
  - Hiding a template takes its page out of the tree, keeps what it inherited (MediaBox, Resources, …) and refuses to hide the last page.
- **js**: `this.templates`, `getTemplate(name)`, `Template.name`, `Template.hidden` (setting it shows or hides the page), `Template.spawn(nPage, bRename, bOverlay)` and `spawnPageFromTemplate`, with positional or named arguments and the documented defaults (0 / true / true). Non-number pages are clamped.
- **engine**: new `Edit::SpawnTemplate` and `Edit::SetTemplateHidden`.
  - Both are checked against the assemble permission and applied in the same undo step as the script's field changes.
  - Only a button's or the console's script may change the pages. A field's own scripts (format, keystroke, validate, calculate) are told so on the console.
  - At most 100 template pages per script run, because each spawn copies the document. A loop that asks for more stops there with one console note.
- **automation**: `page_templates` (read-only), `page_template_spawn` and `page_template_set_hidden`.
- Undo labels translated in all 34 catalogues.

Not in this PR:
- `bOverlay` true (laying a template over an existing page). The script is told so on the console once and nothing changes.
- `createTemplate` / `removeTemplate`.
- An Organize-panel UI for templates.
- `numPages` is not updated inside the running script.
- Mouse Up actions on radio buttons and checkboxes (the other half of #1429) are in the open #2546.

## How you verified it

- [x] `cargo fmt --check`
- [x] clippy with `-D warnings` on the crates I changed (organize, js, engine, automation, ui-egui)
- [x] tests pass on the crates I changed

  | Crate | Result |
  |---|---|
  | organize | 188 passed |
  | js | 97 passed |
  | engine lib | 382 passed |
  | engine it | 21 passed |
  | automation | 45 + 282 passed |
  | ui-egui i18n | 65 passed |

- [x] `cargo xtask layers`, `cargo xtask assets` and `cargo xtask parity`

**Tests.**
- organize has 9 unit tests: listing, renamed and shared spawns, appending past the end, show/hide, the last page and unknown names refused, hostile template trees, repeated unrenamed copies, and inherited attributes kept when hiding.
- js has 5 tests: listing, `spawn` defaults, both argument forms, `hidden` read back, and clamping.
- engine has 5 integration tests: one undo step, renamed and shared spawns surviving save + reopen, overlay noted, field scripts refused, and the 100-page budget.
- automation has 2 tool tests.

Each behaviour was seen failing by reverting it:
- no renaming
- no field sharing
- no MediaBox fallback
- hidden page dropping inherited attributes
- no budget
- field scripts allowed to spawn
- requests not applied
- wrong default flags

Under a loaded machine `tests::xfa_model::a_slow_engine_start_does_not_count_against_the_script` (an existing timing test) failed once and passes on its own. It is not touched here.

## Never-crash

- [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests, unless it is provably infallible with a comment saying why
- [x] No indexing or slicing with input-derived positions; checked or saturating arithmetic; allocations sized by input are capped; recursion is bounded
  - Name trees are capped at 4096 names.
  - Field walks are capped at 32 levels and 100 000 nodes, with seen-sets.
  - Spawns are capped at 100 per script run.
  - Template names are clipped and charged to the script's output budget.
- [x] No `unsafe`
- [x] Any crash this fixes has a small synthetic regression test (no crash fixed; the hostile-tree test covers cyclic and malformed `/Templates`)

## Provenance

- [x] No asset from an Adobe product, and no Adobe icon recreated, traced or imitated
- [x] No font files committed here
- [x] No GPL/AGPL code copied in
- [x] Behaviour comes from the specification or black-box observation, **not** from reading another implementation's source. The sources are ISO 32000-2 §7.7.4 and §12.7.6 and the public Acrobat JavaScript API reference for `Template`/`spawnPageFromTemplate`.
- [x] Every new asset has an `ATTRIBUTION.toml` entry and `cargo xtask assets` passes (no new assets)

## Security

- [x] `--root` confinement still holds on every path, including ones reached by nested tool dispatch (the new tools take a document id, no paths)
- [x] MCP and the UI control channel stay opt-in, loopback-only and token-authenticated
- [x] No new outbound network access

## Parity and reach

- [x] `parity/acrobat-features.toml` updated: `organize.page-templates` is now `partial`, with notes on what is still missing
- [x] Reachable headlessly through an `automation` tool (`page_templates`, `page_template_spawn`, `page_template_set_hidden`, and `js_run` for scripts)
- [x] Docs updated if this changes a documented behaviour (crate doc comments)

## Anything a reviewer should look at first

- `share_fields_with_originals` in `crates/organize/src/import/fields.rs`: how an unrenamed copy's widgets are reparented onto the template's fields. When a template field is its own widget, it is split into a field with two widget kids.
- The 100-page budget per script run in `crates/engine/src/js.rs`. Each spawn copies the document, so a `for` loop over `spawn` in a hostile form is bounded there.
2026-11-18 16:32:59 +07:00
Perchenko Anton 0c39992c99 Print: make a long printer list easier to browse and search (#4399)
**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.
2026-11-18 16:31:06 +07:00
regendorf-ux 3516508589 Edit text: space between paragraphs
## What this changes

`edit.line-paragraph-spacing` was partial: line spacing existed, the space between paragraphs did
not. Now a line break in the edited text starts a paragraph, and the paragraphs are set apart:

- `BlockStyle.paragraph_spacing: Option<f64>` (points, beyond the line spacing). `rewrite_block`
  splits the text at line breaks, wraps and justifies each paragraph on its own (the last line of
  each paragraph is never stretched), and steps down by the line spacing plus the gap before a
  paragraph's first line; underlines follow. `None` is half the font size when the text has
  several paragraphs, so a plain Enter already reads as a paragraph; a non-finite value is refused.
- The row-model rewrite (`text_regions`) keeps the rows a line break started apart from wrapped
  ones: the gap goes before those, and a row the page already had sits where it was, shifted by
  the spacing added above it.
- Format text panel: a Paragraph spacing field (points) next to the line spacing; the tool
  `text_edit` takes `paragraph_spacing`.
- Rows for the two labels in all 21 languages; `parity/acrobat-features.toml`
  `edit.line-paragraph-spacing` → shipped (notes: space before and after as separate values are
  still missing).

## How you verified it

Re-run on 2026-10-15 after merging `main` into the branch (41809cf7, then afa8e184). The merge needed the language catalogs (upstream's rows and this PR's kept), ATTRIBUTION.toml's checksums and the tests both sides had appended at the same place; the new Vietnamese catalog got this PR's 2 labels (written by an AI model, like the other languages' rows, so a native speaker's review is welcome). Reconciled with #1486 (line breaks kept when editing a multi-line paragraph): the default gap between paragraphs applies to upright text only; turned text keeps its rows where they were unless a spacing is set. #1539 merged without conflict. A needless borrow clippy found on Windows is fixed.

Full run on Windows (Rust 1.98) at the branch merged with `main` 41809cf7; after `main` afa8e184 was merged, re-checked on macOS (this PR's tests, the `i18n` tests, `cargo clippy --all-targets -- -D warnings` on the changed crates and their dependents (automation, edit, engine, ui-egui, audit, redact, the apps), `cargo xtask assets`):

- [x] `cargo fmt --all --check`, `cargo xtask assets`, `cargo xtask layers`, doctests: exit 0
- [x] `cargo clippy --workspace --all-targets -- -D warnings`: clean on Windows; on macOS the only warnings are `main`'s own (`crates/ui-egui/tests/view.rs`: two helpers used only by a non-macOS test)
- [x] This PR's tests pass: `paragraph_breaks_get_their_own_spacing`, `the_format_panel_has_a_paragraph_spacing_field`, and `main`'s `turned_paragraph_keeps_its_line_breaks_when_a_word_is_added`
- [ ] `cargo nextest run --workspace`: 3422 of 3433 passed on Windows. The 11 failures fail the same way on `main` without this change: the parity file's duplicate keys (also `cargo xtask parity`; #2419 / #2473), the zh-hant duplicates and the Vietnamese coverage tests in `i18n` (none lists this PR's labels), `signing_with_translated_labels_through_tools` (#2429), `canvas::tests::explicit_search_jumps_record_history_and_keep_match_destination`, `view::single_page_swipe_that_reaches_the_edge_does_not_turn_but_a_fresh_one_does`, `editing::files_dropped_beside_the_pages_panel_still_open_as_documents` (intermittent)

**Tests.** `paragraph_breaks_get_their_own_spacing` (edit): a one-line source rewritten as
"First one\nSecond one" gets the row step alone (15 pt for a 10 pt one-liner), 35 pt with a 20 pt
spacing, 15 pt with 0, and a wrapped single paragraph keeps the ordinary 12 pt step.
`the_format_panel_has_a_paragraph_spacing_field` (ui-egui): the field is in the panel while a
paragraph is being edited.

## Anything a reviewer should look at first

- The labels in the 20 non-English language files were written by an AI model from the English
  wording; a native speaker's review of those rows would be welcome.
- Justification now stops at each paragraph's last line (before, only the block's last line was
  left unstretched); with a single paragraph nothing changes.
- **Overlap with #1487** ("M7: line and paragraph spacing", opened the day before this one): it adds the
  same `BlockStyle.paragraph_spacing`, a spacing field in the Format panel and the `text_edit` argument.
  On top of that, this PR stops justification at each paragraph's last line, adds a UI test beside the
  edit-crate test, and carries the label in all 21 catalogs. Whichever you prefer is fine: if #1487
  lands first I'll rebase this down to what it adds on top of it, or close it.
- **Fits #2249** ("lay out Format text as Acrobat's panel"): that redesign shows paragraph spacing
  disabled as *Planned* and replaces `edit_text_ui::extras_panel`, where this PR's field lives. This PR
  supplies what the control would drive (`BlockStyle.paragraph_spacing` applied by `text_regions.rs`);
  if #2249 lands first I'll move the field into its panel and enable it there.

## Never-crash

- [x] No new `unwrap`/`expect`/`panic!` outside tests
- [x] The spacing is validated (finite, clamped to 0–14 400 pt); rows are indexed with `get`
- [x] No `unsafe`

## Provenance

- [x] No asset added; no code from another implementation

## Security

- [x] No network access

## Parity and reach

- [x] `parity/acrobat-features.toml` updated with what is still missing
- [x] Headless through `text_edit` (`paragraph_spacing`)
- [x] No documented behaviour changed (`docs/` has no entry for it)

- **Merged with main dc41044b** (2026-10-15): #2510's Vietnamese and Lithuanian catalogs added rows beside this branch's in `vi.tsv` and `lt.tsv` (and `ATTRIBUTION.toml`'s sha256 lines), nothing else. Main's rows kept, this branch's rows main lacks after them, hashes recomputed. Re-checked after the merge: `cargo xtask assets` ok, `i18n::tests` 117/117.
- **Merged with main 5fdd820b** (2026-10-15): #1895's catalog rows conflicted with this branch's in `es.tsv` and `vi.tsv` (and `ATTRIBUTION.toml`'s sha256 lines), nothing else. Main's rows kept, this branch's rows main lacks after them, hashes recomputed. Re-checked after the merge: `cargo xtask assets` ok, clippy -D warnings on this branch's crates ok, `i18n::tests` 117/117.
- **Merged with main bc7a12b9** (2026-10-17): only the translation catalogs' new rows and `ATTRIBUTION.toml`'s hashes met this branch (both sides kept, hashes recomputed). Re-checked on macOS: `cargo check --workspace --all-targets`, `cargo xtask assets`, `i18n::tests` 115/115.
- **Merged with main 3f5a784c** (2026-10-17): tests and docs both sides added kept (upstream's first), translation rows and `ATTRIBUTION.toml`'s hashes by key. Re-checked on macOS: `cargo check --workspace --all-targets`, `cargo xtask assets`, `i18n::tests` 115/115.
- **Merged with main dab31491** (2026-10-18, in two steps: 932bf9c6, then dab31491 without conflicts): main and this branch both added tests at the end of `crates/edit/src/tests.rs` and `crates/ui-egui/tests/editing.rs`; both kept, each with its own closing brace (this branch's first), no test lost: the `#[test]` count is main's plus this branch's; and `ATTRIBUTION.toml`'s sha256 lines (main's file kept, every hash recomputed from the merged tree). Re-checked after the merge: `cargo check --workspace --all-targets` ok, `cargo xtask assets` ok, `i18n::tests` 119/119, this branch's tests 2/2.
- **CodeRabbit fixes** (2026-10-21): choosing a font family no longer spreads rows apart when no spacing is set, and applying a spacing replaces the gap a paragraph already had instead of adding to it, so repeating it gives the same result. Each has a test in its own file that fails without the fix.
- **Merged with main 6dec57bf** (2026-10-21): upstream rebuilt the Format text panel and deleted the function this PR's Paragraph spacing row lived in, so the row moved into the new panel, replacing its disabled placeholder; upstream already had the "Paragraph spacing" label in every catalog, so this PR's duplicate rows were dropped, and ATTRIBUTION.toml took main's copy with the hashes recomputed.
- **Merged with main 6898094e** (2026-10-21): only the translation-catalog hashes in ATTRIBUTION.toml met this branch.
- **Round-2 CodeRabbit fixes** (2026-10-21): the draft's line breaks are matched to the source rows by where they came from instead of by position, so a break inserted inside a source row puts the spacing before the new paragraph and later rows keep their source steps. Each has a test in its own file.
- **Merged with main dbc7130b** (2026-10-21): only the translation-catalog hashes in ATTRIBUTION.toml met this branch.
- **Merged with main ffaf3123** (2026-10-21): only the translation-catalog hashes in ATTRIBUTION.toml met this branch.
- **Merged with main adea2c90** (2026-10-23): the parity row both sides changed keeps upstream's evidence with this PR's entries on top; this PR's test moved into upstream's new tests/it layout.
- **Merged with main 57e531cc** (2026-10-23): only the translation-catalog hashes in ATTRIBUTION.toml met this branch.
- **Merged with main a2ec27b4** (2026-10-23): upstream's changes met this PR in pdfcraft-automation, pdfcraft-edit, pdfcraft-ui-egui; checked.
- **Merged with main 6718f1f3** (2026-10-24): upstream's changes met this PR in pdfcraft-automation, pdfcraft-edit, pdfcraft-ui-egui; checked.
- **Merged with main 418ac6a2** (2026-10-25): upstream's changes met this PR in pdfcraft-automation, pdfcraft-edit, pdfcraft-ui-egui; checked.
- **Merged with main 1dd2737b4** (2026-10-27): upstream's changes met this PR in pdfcraft-automation, pdfcraft-edit, pdfcraft-ui-egui; checked.
- **Merged with main 0cba87ae** (2026-11-01): upstream's changes met this PR in pdfcraft-automation, pdfcraft-edit, pdfcraft-ui-egui; checked.
- **Merged with main 3936f93a** (2026-11-02): upstream's changes met this PR in pdfcraft-automation, pdfcraft-edit, pdfcraft-ui-egui; checked.
2026-11-18 16:29:06 +07:00
Cristi Radu 4f9d93c173 fix(ui): Edit ▸ Copy and Paste are enabled for selected comments (#7123)
Fixes #7123

## What this changes

With a drawn annotation (or any comment) selected, Edit ▸ Copy is now enabled, and Edit ▸ Paste is enabled once comments have been copied, matching ⌘C / ⌘V.

**Root cause.** `run_menu_command` already sends the clipboard items as their keys (`menus.rs:561`: Copy pushes `Event::Copy`, Paste requests a paste), and `clipboard_keys` handles those by copying the selected comments when no text is selected and by pasting copied XFDF onto the canvas. Only the enabled state was out of sync. `menu_state` enabled Copy for selected text, a picked image, Edit-a-PDF objects or Organize, and Paste only for objects or pages, so both stayed greyed out with a comment selected.

**Fix.** There are two new arms in `menu_state` (`crates/ui-egui/src/menus.rs`), placed after the existing image, object and page arms so those still take precedence:
- Copy follows `comment.copy` when a comment is selected and no text is. Selected text is what ⌘C copies first, so it is left to the existing text rule.
- Paste follows `comment.paste` when the comment clipboard holds something, outside Organize and Prepare Form, where the canvas does not take pastes.

## How you verified it

- [x] `cargo fmt --check`
- [x] clippy with `-D warnings` on `pdfcraft-ui-egui` (the only warning is in vendored `hayro-interpret`, which was already there)
- [x] tests pass on `pdfcraft-ui-egui`, except for failures that also happen on `main` on my machine (Windows, MSVC): `comments::the_selection_bar_stays_inside_the_pages_area` fails every time, and `print::printing_landscape_sheets_tells_cups_to_turn_them` and `print::each_printer_keeps_what_it_last_printed_with_across_a_restart` fail some runs and not others

**Test.** `comments::edit_copy_and_paste_are_enabled_for_a_selected_comment` draws a square, selects it, and checks that Edit ▸ Copy is enabled. It then runs Edit ▸ Copy through `run_menu_command` and checks that the comment was copied and that Paste is now enabled. Finally it deselects the comment and checks that Copy is greyed out again. It fails on `main` (`Edit ▸ Copy is enabled with a comment selected`) and passes with the fix.

## Never-crash

- [x] No new `unwrap`/`expect`/`panic!` outside tests, no indexing, no `unsafe`

## Anything a reviewer should look at first

- **Paste is enabled from app state, without reading the clipboard.** After copying a comment, if another app later puts plain text on the system clipboard, Edit ▸ Paste looks enabled but pastes nothing, as ⌘V already does in that case. I did not read the clipboard just to draw the menu (see #6169 / #6379).
- **Copy follows `comment.copy`, which needs only an open document.** So Edit ▸ Copy is now enabled for a selected comment on a document that forbids copying. The same was already true of ⌘C and Edit ▸ Copy comments, so this is not a new way to copy. Whether copy-restricted documents should block copying comments at all is a separate question, and this PR leaves it alone.
- **The command palette is unchanged.** `edit.copy` run from the palette (`command_enabled` / `execute`) still covers only text; this PR fixes the menus the issue reports.
2026-11-18 16:28:05 +07:00
Yousef 4448ee940b fix(ui): mirror the macOS title bar when the traffic lights are on the right (RTL system languages)
## What this changes

On macOS with a **right-to-left system language** (Arabic, Hebrew, Persian, …) AppKit lays the traffic lights out from the **right** end of the title bar. That happens even though PdfCraft has no right-to-left localization, and whatever PdfCraft's own interface language is (I checked 0.8.0 in English on an Arabic system: same result). The integrated tab strip (#789 / #1055) always kept its clearance on the left. So:

- the lights covered the **theme** and **keyboard-shortcuts** buttons and crowded **Discord**, so they couldn't be clicked;
- Home sat beside an empty 70 pt gap where the lights would have been.

Before (0.8.0, Arabic system language):

| | Strip |
|---|---|
| Expected left-to-right design | `[● ● ●] [Home] [tabs…] [+ Open] ……… [Discord] [?] [theme]` |
| 0.8.0, RTL system | `[ 70 pt gap ] [Home] [+ Open] ……… [Discord] [?][theme] under [● ● ●]` |
| This PR, RTL system | `[theme] [?] [Discord] ……… [Open +] [tabs…] [Home] [● ● ●]` |

The fix:

1. **Ask the window which side the lights are on** instead of guessing from a language: `NSWindow.windowTitlebarLayoutDirection`, which Apple documents for apps that use `titlebarAppearsTransparent` and put controls under the title bar ("the layout direction may be RTL even in applications that do not have a RTL language localization"). Safe `objc2-app-kit` calls only (same approach as `drag_pointer.rs`), on the main thread, cached in `PdfCraftApp::titlebar_lights_right` once a window has answered. The new features (`NSApplication`, `NSResponder`, `NSWindow`, `NSUserInterfaceLayout`) are already in the tree through winit/rfd, except the empty `NSUserInterfaceLayout` feature.
2. **Mirror the strip** when they are on the right, so the existing design holds with the lights at the other end: Home beside the lights, the tabs reading from the right (the first tab beside Home), then Open; Discord, shortcuts and theme at the far end, in mirrored order. The scroll arrows keep their visual sides.
   - egui's `ScrollArea` only scrolls content that grows to the right, so mirrored, the tabs keep a left-to-right scroll area inside a box exactly their width (`tabs_shown_width`), set beside Home.
   - Tab dragging (#1537) reads the slots in reading order with x flipped (`reading_order`), so `drop_index` and `drop_marker` serve both directions unchanged.
   - The Combine files tab block moved into `combine_tab()` (unchanged behaviour) so it can be drawn first when mirrored and still read last.

Left-to-right systems, Windows, Linux (including the GNOME header bar) and the web are unchanged: everything new hangs off `mirrored`, which is only true on macOS with the integrated title bar and lights on the right.

## How you verified it

- [x] `cargo fmt --check`
- [x] `cargo clippy -p pdfcraft-ui-egui --all-targets -- -D warnings`: clean. With Rust 1.95, `main` itself trips `clippy::collapsible_match` in `crates/edit/src/images.rs` and `clippy::nonminimal_bool` in `crates/ui-egui/src/compare_ui.rs`, files this PR doesn't touch, so the run allowed those two lints; a separate pass with them as warnings finds them only there.
- [x] `cargo test -p pdfcraft-ui-egui --no-fail-fast`: 2,911 passed, 0 failed, after the rebase on `main` (`d749fd80`, 2026-11-12) on Windows 11; `pdfcraft-cli` + `pdfcraft`: 198 passed. The rebase moved the mirrored drag into `main`'s new `tab_drag`, which split view's strips share: the main strip passes `mirrored`, the second pane's strip does not. The macOS tests below run only on macOS; on Windows I ran them with the macOS gate lifted locally (not committed): they pass, and with the scrolling fix switched off its test fails.
- [x] `cargo xtask layers` and `cargo xtask assets`

New tests (macOS, `crates/ui-egui/tests/ui.rs`):
- `the_integrated_title_bar_mirrors_with_traffic_lights_at_the_right`: everything stays in the 28 pt band and clear of the lights; Home is beside the lights, the tabs read from the right, then Open; theme, shortcuts and Discord are at the far left in mirrored order.
- `dragging_a_tab_in_the_mirrored_title_bar_follows_its_reading_order`: dragging left moves a tab later in the order, and dragging right moves it earlier.

Unit tests in `chrome.rs`: `mirrored_tabs_drop_in_their_reading_order`, `shown_tabs_take_their_capped_widths_and_the_gaps`.

**Seen failing before the fix:** with mirroring switched off, both UI tests fail. With only the x-flip removed, the drag test fails and the layout test passes, so each test pins its own part.

Checked by eye on macOS with an Arabic system language: the real app (dev build, portable mode, three sample PDFs) shows `[theme][?][Discord] … [فتح +][third][second][first][Home][● ● ●]`, with nothing under the lights.

## Never-crash

- [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests
- [x] No indexing with input-derived positions (the tab loop indexes `app.views` with indices from `0..len`, as before)
- [x] No `unsafe`: the AppKit calls are safe methods in `objc2-app-kit` 0.3; `MainThreadMarker::new()` returns `None` off the main thread, and a missing window returns `None` (then the strip stays as it was and asks again next frame)
- [x] No crash fixed here

## Provenance

- [x] No asset from an Adobe product
- [x] No font files
- [x] No GPL/AGPL code
- [x] Behaviour from Apple's public AppKit documentation and black-box observation of PdfCraft itself
- [x] No new assets

## Security

- [x] `--root` confinement untouched
- [x] MCP and the control channel untouched
- [x] No network access

## Parity and reach

- [ ] `parity/`: not applicable (a layout fix, not a feature)
- [ ] `automation` tool: not applicable (window chrome)
- [x] Docs: no documented behaviour changes

## Anything a reviewer should look at first

- **Mirroring follows the lights, not the interface language.** The rest of the app isn't mirrored for RTL languages, so mirroring only the title bar could look like a partial RTL mode. But the title bar's order is anchored to the lights (Home beside them is the #789 design), and AppKit picks their side from the system language, not ours. Tying it to `windowTitlebarLayoutDirection` also covers an English UI on an Arabic system.
- **Overflowing tabs when mirrored:** the scroll area still starts at offset 0, its left end, which holds the last tabs. The active tab is scrolled into view on every change (as before), so it's always visible, but at startup with many tabs the first ones (beside Home) may start out of view. Starting it scrolled to the right end would need the content width before the first frame; I left that out to keep this small. Happy to add it.
- **A flaky test I saw locally:** `files_and_quit_from_the_operating_system` failed 3 times in ~40 full `--test ui` runs while the machine was also building and running the app, then 0/20 on a quiet machine, both with and without this change. It opens a file on the open worker and waits a fixed 4 frames, so it looks timing-sensitive under load rather than related to this change.
- Also adds my own entry to `contributors/people.toml` (separate commit, `sync_github_name = true`).
2026-11-18 16:27:08 +07:00
Valentin KleinandClaude Sonnet 5.5 df3f58d8b8 Set Page Boxes crops the margin you type on UserUnit pages (#7445)
* Convert Set Page Boxes margins by the page UserUnit

The dialog's margins are physical (pt, in, mm, cm) but were written as user-space units, so a UserUnit 2 page cropped twice the requested margin.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Say that page_set_box margins are user-space units

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Print readiness reads page boxes in points; Set Page Boxes batch keeps its wording

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 00:31:36 -06:00
Cristi Radu b549727855 fix(ui): paint the active-pane line on the pane's layer, test it under an open menu
A layer no area owns is drawn after every area of its order, so at Middle
the line would cross the floating bars instead. Painted on the pane's own
layer after its pages, it sits over them and under every area.
2026-11-18 06:44:29 +02:00
Cristi Radu 89ec8ed9f4 fix(ui): split view's active-pane line is drawn under open menus (#7010)
The line had a layer of its own at Order::Foreground. egui draws a layer
no area owns after every area of that order, so it crossed open menus and
popups. Order::Middle keeps it over the pages and under the menus.
2026-11-18 06:44:28 +02:00
mtlcl410 bd0a21c2de M3: full screen fills the screen or keeps the page display, and Esc closes the find bar before leaving (#576, #4273, #5302) (#5325)
Full screen can fill the screen edge to edge, fixing the fake full screen
in #379, or keep the normal page display, via a preference. The forms bar
is hidden in full screen. Up-arrow and wheel no longer jump back a page,
and Esc closes one thing at a time (the find bar before leaving full
screen).

Bundles #576, #4273 and #5302.
2026-11-18 11:00:42 +07:00
FredApps 3d43364928 fix(crypt): write RC4 fixtures through the legacy entry points
Pinning craft-pdf to the #1852 merge SHA also picked up d74e60b2, which
makes create() and set_encryption() refuse RC4-40 and RC4-128. Tests,
helpers and the protect example that still write those schemes now use
create_legacy and set_encryption_legacy. Edit::Protect does the same
when the chosen algorithm is legacy, so a file that must stay readable
by a reader without AES can still be written.
2026-11-16 14:11:36 +01:00
Adrian f8d8aef6e4 M5: preserve macOS Minimize alongside Ctrl+M Comments (#3741) 2026-11-16 04:28:05 -05:00
Adrian 2ace804522 M5: test Ctrl+M as Windows and Linux send it (#3741)
Real Ctrl events carry both ctrl and command, so a Cmd+Ctrl+M binding,
which the registry tries first, would also match them. The test now
sends that shape on Windows instead of the command modifier alone.
2026-11-16 04:27:47 -05:00
Adrian fdf9350045 Ctrl+M opens the Comments panel (#3741)
Bind comment.list to Ctrl+M (Cmd+M on macOS). The command opens the
panel rather than toggling it, so pressing it with the panel already
open keeps it open. The binding comes from the command registry, so the
View menu, the palette and Help > Keyboard shortcuts show it.
2026-11-16 04:27:47 -05:00
Francesco UrbaniandFredApps 90d847ce17 Select the current query when refocusing search fields (#4533)
* Search field receives a focus request

* Find keeps an IME composition when the find field already has the keyboard

Selecting the query on Find made the next IME update replace the whole
query when the field was composing: egui replaces the selected range,
and only egui can end a composition from inside the field. The query is
now selected only when the field takes the keyboard from elsewhere, in
one helper for the find bar and the Search panel.

* Test that the Search panel keeps an IME composition when asked for the keyboard again

* A repeated Find selects the query while the field has the keyboard

`owns_ime_events` is only `has_focus` on the pinned egui, so a second Find
while the find field (or the Search panel field) still had the keyboard
kept the caret and typing appended to the old query. Follow the IME
composition from the field's own events and cursor instead: a non-empty
pre-edit starts it, a commit or empty pre-edit ends it, and any other edit,
click or loss of focus ends it too. Only a live composition keeps the
selection; every other Find selects all of the query.

Tests: a repeated Find with the keyboard still in the field, for both
fields, and a Find after a committed composition.

---------

Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-16 10:00:37 +01:00
NineandClaude Opus 5.5 799fdd14b9 bs: Bosnian language support (#5445)
* 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>
2026-11-16 08:59:35 +01:00
TheSuperStew e191b0ea69 M3: select text across pages (view.text-select)
Allow a text selection to run across pages, keeping main's same-page table-row selection (head_x) and the JavaScript link click dispatch from #2081.
2026-11-15 22:55:35 +01:00
Michael Higgins 10727c520b fix(web): open document links with noopener and send COOP same-origin (#5091)
## What this changes

On the web build, `PdfCraftApp::open_url` now opens links with `window.open(url, "_blank", "noopener,noreferrer")` via `web-sys`, instead of `egui::OpenUrl::new_tab`. eframe opens new tabs without features, which gave the opened page a `window.opener` handle it could use to navigate the PdfCraft tab. Every app-level open goes through `open_url`: document links, button URI actions, `app.launchURL`, help links and the releases page. Desktop builds are unchanged.

The web packaging now sends `Cross-Origin-Opener-Policy: same-origin`: `_headers`, `.htaccess`, and the nginx example in `packaging/web/README.md` (`HOSTING.md`), whose old "doesn't need COOP" note is rewritten.

Fixes #5084

## How you verified it

`cargo fmt --check` and `cargo clippy --all-targets -- -D warnings` are clean on `pdfcraft-ui-egui`, including the review fixes. Tests not run yet; CI runs them. `cargo check -p pdfcraft-ui-egui --target wasm32-unknown-unknown` passes too, with no warnings in `links.rs`.

- [x] `cargo fmt --check`
- [x] clippy with `-D warnings` on the crates I changed
- [ ] tests pass on the crates I changed

## Anything a reviewer should look at first

- COOP `same-origin` has no effect inside an iframe, so the `postMessage` embedding bridge is unaffected. A page on another origin that opens PdfCraft with `window.open` does lose its window handle. Nothing in the repo does that.
- Not covered: `dialogs/credits.rs` uses `ui.hyperlink_to` for fixed GitHub URLs, which on the web may open in the PdfCraft tab itself.
2026-11-15 17:27:37 +01:00
Osvaldo Duran Melendez b81d150fc6 Merge remote-tracking branch 'upstream/main' into pr-fix/tab-rename 2026-11-15 09:37:43 -05:00
Dylan M. Taylor 93309e6b1c Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	crates/ui-egui/src/platform/pickers.rs
2026-11-15 12:54:24 +00:00
Dylan M. Taylor 3f20c6848b Test fast optimize completion after picker 2026-11-15 12:29:26 +00:00
Dylan M. Taylor b7256c81bc test(pickers): avoid racing completed optimization 2026-11-15 07:23:35 -05:00
Hector Villarreal aef22858a9 Select a table by rows when a drag crosses its columns (#3669)
## What this changes

Fixes #3850.

Partly addresses #3682: drags within one column of its two-column page now select that column's text (the tester's harness measured 3/9 → 7/9 on `cols.pdf`). Drags from one column into the next still follow reading order, as on `main`; they need column-correct reading order (#3676).

Selecting text in a table selected the wrong things. A table reads column by column, so a plain drag along one row, or down and across a few rows, took the rest of the first column and the top of the next ones between its ends. On some rows the highlight jumped to the column headers and half the table. Copy gave the cells out of order. Preview selects these by rows, and this makes PdfCraft do the same.

Rebased on `main` after the module split (#4889): the row selection is in `crates/render/src/text.rs`, the padded-cell join and barcode rows in `text/order.rs` and `text/layout.rs`, the drag's pointer end in `crates/ui-egui/src/canvas/selection.rs` and `canvas.rs`.

- **Visual rows** (`PageText::visual_between`, used by `Selection::rects` and `Selection::text`). The drag selects by rows when reading order between its ends would not follow them: the rest of the first row, the rows between, and the start of the last. Copy gives the cells tab-separated, as Column select does. Rows are used when either of these holds:
  - Reading order strays above or below the rows dragged over.
  - The drag ends in another column. That means across a gutter that no text of those rows crosses (checked a few lines above and below as well, so a justified line's wide word gap does not count), or with the pointer past the end of both lines.
- **Limits on the rows.** Rows never take lines left of everywhere the drag has been, and they stay in the column when the drag does. A drag in the right column of side-by-side text that ends on a hanging list marker does not pull in the left column. Running text keeps reading order whenever it covers the same glyphs, and so does a column of running text beside a sidebar. A drag down one article or table column keeps reading order too. A line's extent for these limits is its ink: spaces padding it out don't count.
- **Pointer position.** `Span::Run` records where the drag's pointer ended (`head_x`). It can lie well past the nearest glyph, as in the empty end of a table row. Select all, a clicked word, line or page, and four-click page selection keep reading order.
- **Hit testing.** `PageText::nearest` still takes the glyph whose em box holds the point first (#3693). Failing that, it prefers the row level with the pointer, so past the end of a short row a longer row just below no longer captures the drag. Between rows, the old distance rule still applies.
- **Padded cells.** Report generators pad each cell of a row with trailing spaces. When a cell's padding stops short of the next cell (more than the 3-height continuation gap), the next cell on its baseline now joins the row, within 8 line heights (`PADDED_FIELD`, `PADDED_REACH`). Without this, the row's last cells were read after the whole table, in selection, copy and `text_extract` alike.
- **Barcodes drawn with a font** (new since the last review). Mexican CFDI invoices and receipts print their QR or Aztec code with a barcode font: rows of glyphs stacked flush, 5 pt from the seal's text and on nearly the same baselines. Each code row joined the seal line beside it, so the seal read interleaved with the code, some seal lines came after the whole code, and a drag down the seal jumped through it. Rows of at least 8 glyphs, 4 or more stacked flush with one glyph count and the same edges (`barcode_rows`), now join no other text and read after the page's text. A point beside the code is not taken by the code row level with it.

## How you verified it

- [x] `cargo fmt --all --check`
- [x] `cargo clippy --workspace --all-targets --locked -- -D warnings`
- [x] tests pass on the crates I changed, and on the crates that use text extraction:

  | Crate or suite | Passed |
  |---|---|
  | `pdfcraft-render` (lib + integration) | 476 + 64 |
  | `pdfcraft-ui-egui --lib` | 696 |
  | `pdfcraft-ui-egui --test it` (`column_select`, `text_select`, `drag_selects`, `selection_works`) | 33 |
  | `pdfcraft-automation` | 359 |
  | `pdfcraft-engine` | 442 |
  | `pdfcraft-export` | 43 |

- [x] `cargo xtask layers`, `cargo xtask assets`, `cargo check -p pdfcraft-render --target wasm32-unknown-unknown`, `cargo xtask parity`

**Tests.** I reverted each fix and watched these fail:

- `column_select.rs::a_plain_drag_along_one_table_row_selects_only_that_row` (UI, select tool and highlighter). Before the fix it got `"Apple\nPear\nQty\n12"` instead of `"Apple\t12"`.
- `column_select.rs::a_drag_ending_between_the_columns_selects_the_rows` (UI). Without `head_x` it got `"Name\nApple\nPear"`.
- `column_select.rs::a_drag_down_text_beside_a_barcode_selects_only_the_text` (UI). Without the barcode rows it got `"ABCDEFGHIJKL one two three\nFGHIJKLMNOPQ\n…"`.
- `text/tests.rs::a_barcode_drawn_with_a_font_reads_apart_from_the_text_beside_it`
- `text/tests.rs::a_point_beside_a_barcode_takes_the_text_not_the_code_row`
- `text/tests.rs::a_point_level_with_a_row_takes_that_rows_nearest_glyph`
- `text/tests.rs::a_drag_in_the_right_column_takes_nothing_from_the_left`

Also new in `text/tests.rs`: `a_drag_along_one_table_row_selects_that_row`, `a_drag_over_table_rows_selects_those_rows`, `a_drag_that_reading_order_already_covers_keeps_it`, `a_pointer_ending_beside_the_column_takes_the_rows`, `a_cell_padded_with_spaces_joins_the_next_cell_of_its_row`, `a_justified_gap_is_not_a_gutter`, and the running-text, sidebar, heading and vertical-text cases from earlier review rounds. In `column_select.rs`: double-click drags, select all and four-click page selection on uneven columns.

All fixtures are synthetic.

**Corpus.** Before the rebase, text extraction of the pinned pdf.js corpus was byte-identical with and without this PR. The barcode change leaves it identical too: the plain text of the first 60 pages of each of its 989 PDFs (1,525 pages) is the same with and without it.

**Real-world files** (private, not attached):

- **Text extraction:** on a personal folder of PDFs (bank and hotel reports, payslips, policies, contracts, slide decks), the only files that differed from `main` before the rebase were bank statements whose padded rows now keep their amounts. The barcode change alters one page across 105 files: a statement's CFDI page, whose seal now reads in order.
- **Simulated drags:** about 53,700 random drags across those files. Selection takes at most about 145 µs per frame.
- **Two-column contract:** on a bilingual two-column contract, 2,649 drags kept inside one column leak into the other column less often than before (1,224 vs 1,591). In no file does the new code leak a two-column drag where the old one did not, except across table rows, where rows running across the page is intended.

## Never-crash

- [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests
- [x] No indexing with input-derived positions in the new code (`get`). Allocations are bounded by the page's glyphs, and `side_by_side` compares at most `SIDE_BY_SIDE_LINES` lines. Barcode rows are found with one hash map over the page's rows. NaN boxes rank last in `nearest` (`total_cmp`) and are never barcode rows. No recursion.
- [x] No `unsafe`
- [ ] Any crash this fixes has a small synthetic regression test (n/a, no crash)

## Provenance

- [x] No asset from an Adobe product, and no Adobe icon recreated, traced or imitated
- [x] No font files committed here
- [x] No GPL/AGPL code copied in
- [x] Behaviour comes from black-box observation (Preview's selection on the same files), not from reading another implementation's source
- [x] No new assets

## Security

- [x] `--root` confinement untouched
- [x] MCP and the UI control channel untouched
- [x] No new outbound network access

## Parity and reach

- [x] `parity/acrobat-features.toml`: `view.text-select` gains the new evidence and a note. Selection across pages is still missing, as before.
- [x] Reachable headlessly: the padded-cell join and barcode rows change `text_extract` too. Visual-row selection is a pointer interaction, like the rest of plain drag selection.
- [x] `ROADMAP.md` progress log line

## Anything a reviewer should look at first

1. **A deliberate behaviour change.** `alt_drag_selects_only_the_text_inside_the_rectangle` asserted that a plain drag from "Name" to "12" selects in reading order: `"Name\nApple\nPear\nQty\n12"`. It now selects the two rows dragged over, `"Name\tQty\nApple\t12"`, and I changed the assertion. Reading order itself is unchanged (`a_column_selection_takes_one_table_column` still asserts it), and so is a drag down one column.
2. **The gutter test is a heuristic.** "Another column" means a vertical strip at least one line height wide that no text in the dragged rows, or 4 line heights around them, crosses. That catches table columns and side-by-side text, and ignores justified word gaps in practice. Thin columns with ragged edges may still fool it.
3. **The padded-cell join changes reading order.** It applies only to a segment whose box runs on at least 2 line heights of trailing spaces past its last visible glyph, and only towards a cell on the same baseline within 8 line heights.
4. **Barcode rows change reading order.** A stack of 4+ flush rows of 8+ glyphs, each with the same glyph count, height and edges, reads after the page's text. Text set solid still has lines of different lengths and counts; a hex dump set solid in a monospaced font would also match, and would then read last.
5. **Overlap with #2431** (narrow article gutters, #2387). The two PRs touch different code paths and should rebase cleanly.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **New Features**
  * Text drags across table-like layouts now select cells by visual row, with copied cells separated by tabs. Multi-click and Shift-click selections can also follow visual rows where applicable; select-all and other non-row selections retain reading order.
  * Text selection and pointer placement work more accurately around columns, gutters, and barcode-like text, reducing unintended selection of nearby content. Barcode text is kept separate from adjacent text.
* **Documentation**
  * Updated feature coverage and progress notes to reflect text-selection behavior and regression testing.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-15 12:11:23 +01:00
FredApps b5327e03f6 Merge branch 'main' into fix/7175-update-download-test 2026-11-15 00:04:42 +01:00
FredAppsandFredApps 2524889a6b i18n: move the craft-i18n pin to e56d262 (#7319)
* i18n: move the craft-i18n pin to e56d262

Brings in the translations merged to craft-i18n since the last pin.
The flatpak manifests name the same commit.

* i18n: read the newer catalog's rows in three UI tests

The craft-i18n pin brings French rows for the hotbar settings button and
its search field, a reworded German password warning, and French rows
that keep the source's menu-path arrow. The hotbar and script-prompt
tests now take those strings from the catalog. The font coverage test
still checks every letter, and skips a symbol only when the row's English
text has it too.

---------

Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-11-14 22:26:17 +01:00
FredApps 1a5cf6b023 fix(ui): distinguish insert text annotation icon (#7170) 2026-11-14 22:26:03 +01:00
FredApps 54b91598a3 Move selected comments together with arrow keys (#7165)
* Move selected comments together with arrow keys

* Test keyboard nudging of selected lines

* test(ui): cover locked and duplicate nudge selections
2026-11-14 22:25:50 +01:00
Christian Lappin 0cb03234f6 Keep the download update test stable in Linux coverage 2026-11-14 14:53:31 -05:00
Osvaldo Duran Melendez df267834ba Merge remote-tracking branch 'upstream/main' into pr-fix/tab-rename
# Conflicts:
#	Cargo.lock
2026-11-14 14:05:37 -05:00
Dylan M. Taylor eead454105 Cut over remaining codecs, xfa XML, and export packaging to craft-libs (#7326)
* chore: cut over image, png, tiff, and zune-jpeg to craft-image-codecs

* chore: cut over xfa XML parsing from roxmltree to craft-xml

* chore: cut over export DOCX and PPTX packaging to craft-opc and craft-xml

* style: cargo fmt
2026-11-14 13:49:46 -05:00
FredApps 346d803080 Merge pull request #7203 from christianlappin/fix/7050-macos-save-xattrs
Fix macOS saves for PDFs with extended attributes
2026-11-14 17:13:09 +01:00
Dylan M. Taylor 937c3fc7e1 print: initialize driver_settings on craft-print Job 2026-11-14 04:10:10 +00:00
FredApps 0aed40d670 Merge branch 'main' into port-2081 2026-11-13 19:45:32 +01:00
FredApps 2a639868dd Merge branch 'main' into port-2081 2026-11-13 18:59:56 +01:00
FredApps 1771844b84 fix(link-js): address the review on the #2081 port
- A link that fails puts the realm's timers back as they were before its
  own script ran, and turns no layer: timers it set are dropped, timers it
  cleared come back (timers::save/restore in Realm::run_job).
- In a read-only document a link's requests still apply when its field
  changes can't; the outcome carries the read-only error.
- app.openDoc during a calculation (calculateNow) is noted on the console
  and not queued, as for a field script running on its own.
- Link script streams are decoded once per stream, whatever their source
  length, and /Filter [] reads as the raw source.
- The web build sets the view's zoom, page and highlight before a link
  script runs, as the desktop does.
2026-11-13 18:48:33 +01:00
Christian Lappin 11a7f02cc0 Fix Finder association attribute sizing on macOS 2026-11-13 05:58:15 -05:00
Richard Buschbeck 7f754fc9fd test(ui): run the Home recent Reveal test inline so its toast check can't race
home_recent_context_menu_reveals_the_target_without_opening_or_removing_it
never set run_inline, so reveal_path checked the missing file on a
pdfcraft-reveal worker thread while the test waited a fixed three frames
before asserting the "The file no longer exists" toast. On a loaded runner
the worker can report after those frames and the assertion fails. Set
run_inline, as the reveal unit test in tab_context.rs already does.
2026-11-13 11:40:55 +01:00
asadosteaksnlandasadosteaksnl 175992b5a2 fix(ui): Recognize Text's settings scroll in a short window, its buttons stay in reach (#6599) (#6760)
* fix(ui): Recognize Text's settings scroll in a short window, its buttons stay in reach (#6599)

On a small screen or at a large display scale the dialog was taller than the window: it was
centred with its title and its Cancel / Recognize text row off the screen, and nothing scrolled.

The four settings groups (Pages, Settings, Skip, Output folder) now sit in a vertical scroll area
capped to the window's height, as Preferences does (#3557). The title, the engine notice and the
button row stay outside it, so they are always on screen; when the settings fit, nothing changes.

The test opens the dialog in 400 to 700 pt windows and checks the title and both buttons are on
screen, and that the last group scrolls in between the title and the buttons while they stay put.
Without the fix it fails at 400 pt with the title at y = -267.

* contributors: credit asadosteaksnl as Kas

* fix(ui): Recognize Text's settings scroll in as little as 40 pt, so its buttons fit the smallest window (#6599)

A 120 pt floor still pushed the dialog off a window shorter than about 340 pt: at 173 pt (the
smallest window, 520 pt, at the largest interface size, 300%) the title sat at y = -32. The test
now checks 173, 208 and 260 pt windows too, as the Preferences layout test does.

* test(ui): the short-window Recognize Text test clicks Cancel and checks a 640 pt wide window (#6599)

Cancel being on screen isn't proof it can be clicked: the test now clicks it at every height and checks the dialog closes. The window is 640 pt across, a 1280-pixel screen at 200%, and every control is checked to fit across as well as down.

* test(ui): the Recognize Text title stays put while the settings scroll (#6599)

* Revert "contributors: credit asadosteaksnl as Kas"

This reverts commit 52470f66a7.

* docs(ui): document the Recognize Text dialog's body (#6599)

* test(ui): the Recognize Text test also covers tall windows where nothing scrolls (#6599)

The dialog is about 935 pt tall, so it scrolls up to a 900 pt window; at 1100 pt everything fits. Both now run, so the test also pins the case where the settings fit and the layout is unchanged.

---------

Co-authored-by: asadosteaksnl <353856209+asadosteaksnl@users.noreply.github.com>
2026-11-13 02:42:37 +01:00
FredApps 330cde8035 Merge pull request #5559 from vangel76/feat/recent-reveal-5452
Reveal recent files in the system file manager from Home (#5452)
2026-11-13 02:19:00 +01:00
FredApps ad153f5ded test(ui): the link test's openDoc path is absolute on Windows too 2026-11-12 21:22:55 +01:00
FredApps feec1853c0 Merge main into port-2081
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).
2026-11-12 20:53:37 +01:00
FredApps 522fa442f5 Merge main into port-4751
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.
2026-11-12 18:15:19 +01:00
Osvaldo Duran Melendez 224b29701e Merge remote-tracking branch 'upstream/main' into pr-fix/tab-rename 2026-11-12 06:36:32 -05:00
d749fd8062 Print colour management: the app converts printed pictures into a printer profile (#6269) (#6853)
* Print: app-managed colour converts printed pictures into a printer profile (#6269)

doc_print takes color_management (printer, the default, or app). With app,
color_profile (an ICC file or an installed profile's name), rendering_intent
and black_point_compensation convert each rendered page picture from sRGB
into the printer's RGB or grey profile before it is sent. app prints the
pages as pictures; CMYK and non-destination profiles are refused.
print_color_profiles lists the installed RGB and grey profiles.

The conversion is craft-cms at craft-print's rev, in pdfcraft_print::colour,
hooked into print_raster::rasterize. Raster carries the colour and is Clone
rather than Copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Print colour: look for installed profiles inside the read root when confined

With automation roots, print_color_profiles and doc_print's color_profile
name lookup read the system's colour folders, outside the roots. They now
look in the read root instead (as text_font_files does), check each file
against it before reading it, and are refused without read authority.
Under --root they look in the root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* automation: keep colour profile discovery inside --root, links followed

Under --root alone, print_color_profiles and the color_profile name
lookup listed the root's .icc files without checking each against the
root, so a link inside it could read a profile outside. Each discovered
file now goes through the same --root resolution as any other read
(links followed) before it is opened.

colour_profile_links_out_of_the_root_are_not_read makes such a link and
checks it is neither listed nor found by name; it fails without the
check (the link is listed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* print: as_chunks for the grey fill; area print keeps managed colour

Clippy 1.99 (`chunks_exact_to_as_chunks`) flags the constant-width
`chunks_exact_mut(4)` in the grey conversion; use `as_chunks_mut::<4>()`.

main's print-area path built `Raster` without the new `colour` field;
build it through `PrintDraft::raster()` so a printed area is colour
managed like a printed page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Lock craft-cms at the craft-libs commit craft-print now uses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(print): read only regular files as printer profiles, and no more than the cap

A FIFO or device named `.icc`/`.icm` in a profile folder was listed and
read, and opening a FIFO for reading waits for a writer. The listing now
keeps regular files only (links followed), `PrinterProfile::read` refuses
anything else before opening it, and the read goes through a limit one
byte past `MAX_PROFILE_BYTES`, so a file that grew after it was measured
is refused rather than read whole.

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>
2026-11-12 06:28:18 +01:00