Compare commits

...
Author SHA1 Message Date
Martin BallandClaude Opus 5.5 568039cd7f fix(ui-egui): a key's edit pass no longer clears the settled pages
A pass that places no page (the edit pass a key triggers) matched the empty
shown pages and reset settled_pages to empty, so that pass asked for unsized
pictures and the next pass's exact-pixel pictures were rendered again on a
worker plus an extra frame (~33 ms CPU, ~4.7 ms main thread per key). Only
settle when at least one page was placed; zoom, resize and scroll still
settle to their exact pixels.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FypgCXNomWeGUu3duixKdm
2026-12-06 21:21:00 +00:00
autocraft-bot[bot] 67096983b6 Merge pull request #9925 2026-12-06 20:15:42 +00:00
batistalucasv 41a8b4b0fc fix(xtask): check craft UI features enabled via package [features] table (#9648) 2026-12-06 17:15:42 -03:00
autocraft-bot[bot] 616ba02027 Merge pull request #9922 2026-12-06 19:38:20 +00:00
batistalucasv 9d7a7044b1 fix(wordcraft): log folder open failure on Unix when syncing nightly session directory (#9870) 2026-12-06 16:38:20 -03:00
autocraft-bot[bot] 152a511502 Merge pull request #9920 2026-12-06 19:23:07 +00:00
batistalucasv 3d0e56d7c6 fix(doc): combine note and body text-box alloc warnings into one per paste (#9918) 2026-12-06 16:23:07 -03:00
autocraft-bot[bot] 0acb3bb409 Merge pull request #9916 2026-12-06 19:06:41 +00:00
autocraft-bot[bot] 0c6325c0b7 Merge pull request #9912 2026-12-06 19:06:41 +00:00
autocraft-bot[bot] 3b9284ec9f Part 1: FindState::set_results in crates/engine/src/doc_state.rs now b
Part 1: `FindState::set_results` in crates/engine/src/doc_state.rs now bumps `results_gen` only when the matches actually change, and `clear_results` bumps only when results were non-empty. Find Next/Previous after a Navigation pane search finds identical matches, so `nav_results_gen` still matches and the pane keeps its highlights and Results list. A search with different matches still bumps the generation, so the advanced-find scope/option cases still show 0 highlights. Added the test `find_next_after_nav_pane_search_keeps_nav_pane_highlights` (edit.findNext and edit.findPrevious after a pane search keep 3 Found marks and '3 results'). fmt, clippy and the find/nav_pane tests pass.
2026-12-06 19:06:41 +00:00
batistalucasv 99cb9aa14d fix(ui-egui): read drawn size and send only edited sides from Size dialog (#9845) 2026-12-06 16:06:04 -03:00
batistalucasv debd74a5ee fix(ui-egui): tie Navigation pane search highlights to its own FindState results generation (#9698) 2026-12-06 15:46:11 -03:00
autocraft-bot[bot] 0368b9fc79 Merge pull request #9910 2026-12-06 18:36:02 +00:00
batistalucasv 61b4d191a7 test(engine): check saving template elsewhere leaves AutoSave stamp alone (#9905) 2026-12-06 15:36:02 -03:00
autocraft-bot[bot] 7186056198 Merge pull request #9907 2026-12-06 18:26:02 +00:00
batistalucasv b9ff92bf62 fix(wordcraft): log folder path when nightly session directory sync fails (#9869) 2026-12-06 15:26:02 -03:00
autocraft-bot[bot] 1f989efaa5 Merge pull request #9903 2026-12-06 18:05:20 +00:00
autocraft-bot[bot] 37b7a98d2a Merge pull request #9883 2026-12-06 18:05:20 +00:00
batistalucasv e8aebb1c88 fix(doc): warn once per paste on text-box part allocation failure (#9872) 2026-12-06 15:05:20 -03:00
autocraft-bot[bot] 24bc0410ec Merge pull request #9902 2026-12-06 17:50:12 +00:00
batistalucasv 79b16d95d2 test(ui-egui): locate print preview outline around page texture (#9895) 2026-12-06 14:50:12 -03:00
autocraft-bot[bot] b37ce04e8f Merge pull request #9893 2026-12-06 17:48:13 +00:00
autocraft-bot[bot] 3148a654b5 Part 2: rotation_window no longer sets InlineJobs on the install spe
Part 2: `rotation_window` no longer sets `InlineJobs` on the install spec, where it had no effect. It now builds the app's `Host` with a `ManualJobs` queue and installs it through `with_host`, so the page-texture loader runs its renders on the host's jobs. Part 1: I removed the settle loop. The new `rotation_window_with_jobs` returns the harness and its `ManualJobs`. It runs the queue after each of the 6 setup frames, then takes one more frame to upload what rendered. `rotation_window` calls it and drops the queue, so the other callers are unchanged. In the rotation drag test, the sample now goes `jobs.run_all()`, then `steps(&mut h, 1)`, then `at_rest`. All of these frames use `app_frame()` through `steps`, so none skips the app's input hook. `cargo fmt --check` is clean. clippy reports only an unused-dependency warning on `egui_extras` in `Cargo.toml`, which my change doesn't touch. The 25 `objects::` tests pass. The rotation drag tests also pass 3 times in a row.
2026-12-06 17:48:13 +00:00
autocraft-bot[bot] 33c9916168 Merge pull request #9898 2026-12-06 17:43:13 +00:00
batistalucasv 074f233ccf docs(ui-egui): clarify SHEET_EDGE background and drop white-only test (#9897) 2026-12-06 14:43:13 -03:00
batistalucasv 9efe148815 test(ui-egui): settle meshes and repaints before sampling at_rest in rotation drag test (#9821) 2026-12-06 14:32:05 -03:00
autocraft-bot[bot] 047726ddea Merge pull request #9894 2026-12-06 17:06:08 +00:00
RickiNano f78836c1b4 Save as Template over the document's own file keeps AutoSave going (#9865)
file.saveTemplate wrote through save_path and never updated
Session::disk_stamp, so after a template was saved over the document's
own .dotx or .dotm, the next AutoSave (ifUnchanged) took WordCraft's own
write for another program's change, refused, and turned AutoSave off.

Write with save_path_checked and keep the stamp it returns when the path
is the document's own file, as file.save's copy branch already does.
2026-12-06 18:06:08 +01:00
autocraft-bot[bot] ce23acdbe6 Merge pull request #9745 2026-12-06 15:52:42 +00:00
batistalucasv 20592b350a test(ui-egui): settle immediate repaints before measuring caret blink delay (#9859) 2026-12-06 12:52:42 -03:00
batistalucasv d8889fccd7 test(ui-egui): locate preview outline by stroke kind and check contrast against actual pane background 2026-12-06 12:40:48 -03:00
batistalucasv 7106bedb9e test(ui-egui): guard wheel-outside-box draft against missing hover check (#9844) 2026-12-06 12:34:04 -03:00
Martin BallandClaude Opus 5.5 508e22d6bb Move craft-libs to 0a15c60 (typing-speed fixes for 0.20.2) (#9862)
* Move craft-libs to 0a15c60 (#4285, #5610, #5315, #6020)

Brings the typing-speed fixes in craft-libs: the idle ribbon replays through
MemoView (#4285, which #8119's chrome slot versions rely on), Thumbnails
renders no picture in a measuring run (#5610, needed by #9417), page
pictures texel for texel (#5315), and a replayed text field keeps its
I-beam (#6020).

Adaptations:
- app/frame.rs keeps the ribbon output only from a real run: with the ribbon
  replaying, the measuring run's output (no tabs) replaced it, so KeyTips
  after an edit showed no badges (F10 then H did nothing).
- Tests that read painted shapes look inside replayed PaintChunks (as
  chrome/tests.rs already does); the icon signature includes texture
  coordinates now that icons share atlas pages (#4271/#4275).
- The save prompt asks Save / Don't Save / Cancel on every OS (craft-libs
  92ed66b43).
- A scrolled-out balloon card reports no name over the view (craft-libs
  #3504); the balloon test still checks that the check reads paint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FypgCXNomWeGUu3duixKdm

* Tests: the balloon and save-prompt checks guard what they did before the move

The balloon test's precondition is again that the scrolled-out card keeps its
name (now with bounds of no area, craft-libs#3504), so a name search would
still pass; the save-prompt test also needs the prompt's own Don't Save, not
just the title bar's Save.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FypgCXNomWeGUu3duixKdm

* Smoke test: the save prompt says Don't Save on every OS

craft-libs 92ed66b43 words the unsaved-changes prompt Save / Don't Save /
Cancel everywhere; the smoke test still looked for "No" off macOS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FypgCXNomWeGUu3duixKdm

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-12-06 15:24:21 +00:00
autocraft-bot[bot] 28fe0c22f7 Merge main (618cbf1d) into the pull request
Resolved the only conflict, in crates/layout/src/tests.rs, where both si

Resolved the only conflict, in crates/layout/src/tests.rs, where both sides had appended tests at the end of the file. I kept both sets: the pull request's header-share test and the tests main added. No conflict markers remain, the layout crate builds, and cargo fmt --check is clean. In cargo test -p wordcraft-layout, 999 tests pass and 5 hyphenation-related tests fail. I looked at only one of them; it found no break in a Polish word, which looks like hyphenation data missing in this workspace. I did not run them on the unmerged branches. The pull request's own test passes.
2026-12-06 14:10:43 +00:00
pakiatandClaude Opus 5.5 a0960a2f24 Ungroup: a header's or footer's share is of the upright page
Headers and footers are laid out upright on the page with its section's
own frame, also in a turned section, so `share_base_on` takes that frame
for them and keeps the recorded body frames for body anchors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-06 20:52:26 +07:00
pakiatandClaude Opus 5.5 79fcb028b5 Ungroup: a member's share is of the page frame layout placed the group on
Layout now records on each page the section frames it placed floating
objects with (`Page::sect_frames`): the page's own section, then each
continuous section starting on it, as laid out in the view (reflowed in
the continuous views, unturned in a turned section, Read Mode's too).
`share_base_on` takes the page and the anchor's section and uses that
frame, so a group in a continuous section partway down a page, or in a
turned section in Read Mode, ungroups into members of the sizes it drew.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-06 20:14:28 +07:00
pakiatandClaude Opus 5.5 52bf2b652e Ungroup: a member's share is of the page the view lays out on
`share_base_on` now takes the layout options and uses the page the
continuous views lay out on (as wide as the window in Web view), as
layout sizes the group there. `Session::view_layout_options` gives the
view's options, which `layout_with` now also uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-06 19:47:00 +07:00
pakiatandClaude Opus 5.5 3e127d222a Ungroup: a member's share is its length over what the share is of
A member drawn past 4000 pt now takes as its share its drawn length
over the length the group's share is of (the page's or margin's, on
the page the group is drawn on), not the group's share scaled by its
part of the group: a group drawn at the longest a share gives (a share
past it, from JSON import) no longer overstates its members. Layout
gives that length out (`share_base_on`), the one `relative_size` uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-06 19:11:01 +07:00
pakiat 02dd9df9dd Merge remote-tracking branch 'origin/main' into fix/relative-size-follow-ups
# Conflicts:
#	crates/engine/src/cmd/objects/tests.rs
2026-12-06 18:42:42 +07:00
pakiatandClaude Opus 5.5 1cb3dad2a6 Ungroup: a member past 4000 pt keeps its size as a share
A member a share-sized group draws past the 4000 pt an object's own
size stops at takes its part of the group's share of the page or
margin, so it keeps the size it showed; smaller ones take their size
outright, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-06 18:34:21 +07:00
pakiatandClaude Opus 5.5 e6be3e0a70 Relative size follow-ups: fitted boxes, large groups, inline ungroup
Follow-ups to #9716 from its review:
- A text box that fits its text keeps the height of its text whatever
  share of a height it holds, as Word for Windows draws it (five lines
  120.95 pt high where half the margin is 346.9 pt). The share is
  applied once, in `drawn_size`; `float_rect` places the object at the
  size it is given.
- A group's members, scaled with the group, fill it past 4000 pt, up to
  the longest side a share gives (`MAX_SHARE_LEN`), in drawing and in a
  connector's fallback ends alike.
- Ungrouping a group in line with text keeps its members at the size it
  showed them at (its own), not the size its share would give.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-06 17:12:49 +07:00
47 changed files with 1344 additions and 300 deletions
Generated
+198 -97
View File
@@ -1173,7 +1173,7 @@ dependencies = [
[[package]]
name = "craft"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-automation",
"craft-behavior",
@@ -1224,7 +1224,7 @@ dependencies = [
[[package]]
name = "craft-appkit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"block2 0.6.2",
"objc2 0.6.5",
@@ -1236,7 +1236,7 @@ dependencies = [
[[package]]
name = "craft-atomic"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"rustix 1.1.6",
]
@@ -1244,7 +1244,7 @@ dependencies = [
[[package]]
name = "craft-automation"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -1269,11 +1269,12 @@ dependencies = [
[[package]]
name = "craft-behavior"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"accesskit",
"bitflags 2.13.2",
"craft-host",
"craft-i18n",
"craft-keymap",
"craft-theme",
"craft-tracked",
@@ -1287,7 +1288,7 @@ dependencies = [
[[package]]
name = "craft-browse"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-docpath",
@@ -1305,12 +1306,12 @@ dependencies = [
[[package]]
name = "craft-cfb"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
[[package]]
name = "craft-cloud-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"egui",
]
@@ -1318,7 +1319,7 @@ dependencies = [
[[package]]
name = "craft-cms"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"md-5",
"rayon",
@@ -1327,12 +1328,12 @@ dependencies = [
[[package]]
name = "craft-codepage"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
[[package]]
name = "craft-color"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"serde",
]
@@ -1340,7 +1341,7 @@ dependencies = [
[[package]]
name = "craft-color-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-cms",
@@ -1360,7 +1361,7 @@ dependencies = [
[[package]]
name = "craft-control"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-ai-agents",
"craft-atomic",
@@ -1376,7 +1377,7 @@ dependencies = [
[[package]]
name = "craft-control-protocol"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"getrandom 0.3.4",
"serde_json",
@@ -1386,7 +1387,7 @@ dependencies = [
[[package]]
name = "craft-dds"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"rayon",
]
@@ -1394,7 +1395,7 @@ dependencies = [
[[package]]
name = "craft-dialogs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"block2 0.6.2",
"craft-appkit",
@@ -1420,7 +1421,7 @@ dependencies = [
[[package]]
name = "craft-doc-binary"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"chrono",
"craft-cfb",
@@ -1437,7 +1438,7 @@ dependencies = [
[[package]]
name = "craft-docpath"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"serde",
]
@@ -1445,7 +1446,7 @@ dependencies = [
[[package]]
name = "craft-docx"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"base64 0.23.1",
"chrono",
@@ -1465,7 +1466,7 @@ dependencies = [
[[package]]
name = "craft-draw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1484,7 +1485,7 @@ dependencies = [
[[package]]
name = "craft-drawingml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"chrono",
"craft-xml",
@@ -1496,7 +1497,7 @@ dependencies = [
[[package]]
name = "craft-flags"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-atomic",
"dirs",
@@ -1506,7 +1507,7 @@ dependencies = [
[[package]]
name = "craft-flow"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-wordmodel",
"image",
@@ -1516,7 +1517,7 @@ dependencies = [
[[package]]
name = "craft-font-catalog"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"fontique",
"harfrust 0.13.3",
@@ -1531,7 +1532,7 @@ dependencies = [
[[package]]
name = "craft-font-manager"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-font-catalog",
@@ -1550,7 +1551,7 @@ dependencies = [
[[package]]
name = "craft-font-os-windows"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"windows-registry",
"windows-sys 0.61.2",
@@ -1559,7 +1560,7 @@ dependencies = [
[[package]]
name = "craft-font-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"cap-primitives",
"craft-atomic",
@@ -1582,7 +1583,7 @@ dependencies = [
[[package]]
name = "craft-font-subset"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"brotli 9.1.3",
"harfbuzz-subset-sys",
@@ -1595,7 +1596,7 @@ dependencies = [
[[package]]
name = "craft-fonts-build"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-font-subset",
]
@@ -1603,7 +1604,7 @@ dependencies = [
[[package]]
name = "craft-gpu"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"egui-wgpu",
"log",
@@ -1615,7 +1616,7 @@ dependencies = [
[[package]]
name = "craft-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"bitflags 2.13.2",
"craft-i18n",
@@ -1628,7 +1629,7 @@ dependencies = [
[[package]]
name = "craft-html"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-codepage",
"craft-flow",
@@ -1641,7 +1642,7 @@ dependencies = [
[[package]]
name = "craft-i18n"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"brotli 9.1.3",
"brotli-decompressor 6.3.1",
@@ -1671,7 +1672,7 @@ dependencies = [
[[package]]
name = "craft-image-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-dds",
"craft-jpeg",
@@ -1698,7 +1699,7 @@ dependencies = [
[[package]]
name = "craft-imaging"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1716,7 +1717,7 @@ dependencies = [
[[package]]
name = "craft-jpeg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"thiserror 2.0.21",
]
@@ -1724,7 +1725,7 @@ dependencies = [
[[package]]
name = "craft-keymap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-host",
"craft-i18n",
@@ -1739,7 +1740,7 @@ dependencies = [
[[package]]
name = "craft-latex"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-flow",
"craft-math",
@@ -1750,7 +1751,7 @@ dependencies = [
[[package]]
name = "craft-markdown"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-flow",
"craft-html",
@@ -1760,7 +1761,7 @@ dependencies = [
[[package]]
name = "craft-math"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-xml",
"roxmltree",
@@ -1770,7 +1771,7 @@ dependencies = [
[[package]]
name = "craft-mcp-server"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"serde_json",
]
@@ -1778,7 +1779,7 @@ dependencies = [
[[package]]
name = "craft-menu"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1796,7 +1797,7 @@ dependencies = [
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"brotli-decompressor 6.3.1",
"chrono",
@@ -1808,7 +1809,7 @@ dependencies = [
[[package]]
name = "craft-metafile"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"encoding_rs",
"image",
@@ -1819,7 +1820,7 @@ dependencies = [
[[package]]
name = "craft-mime"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"chardetng",
"chrono",
@@ -1830,7 +1831,7 @@ dependencies = [
[[package]]
name = "craft-nightly"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"uds_windows",
"winsafe",
@@ -1839,7 +1840,7 @@ dependencies = [
[[package]]
name = "craft-odf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"aes",
"base64 0.23.1",
@@ -1865,7 +1866,7 @@ dependencies = [
[[package]]
name = "craft-ods"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-odf",
"craft-sheet",
@@ -1876,7 +1877,7 @@ dependencies = [
[[package]]
name = "craft-offcrypto"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"aes",
"base64 0.23.1",
@@ -1893,7 +1894,7 @@ dependencies = [
[[package]]
name = "craft-opc"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-xml",
"craft-zip",
@@ -1904,7 +1905,7 @@ dependencies = [
[[package]]
name = "craft-pages"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -1920,7 +1921,7 @@ dependencies = [
[[package]]
name = "craft-pdf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"krilla",
"serde",
@@ -1930,7 +1931,7 @@ dependencies = [
[[package]]
name = "craft-platform"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"arboard",
"async-channel",
@@ -1942,11 +1943,13 @@ dependencies = [
"craft-docpath",
"craft-host",
"craft-i18n",
"craft-png",
"craft-theme",
"fmv-macos-events",
"futures-lite",
"js-sys",
"log",
"notify",
"objc2-app-kit 0.3.2",
"objc2-core-foundation",
"objc2-core-graphics",
@@ -1954,6 +1957,7 @@ dependencies = [
"rfd",
"serde",
"serde_json",
"sha2 0.10.9",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
@@ -1965,10 +1969,19 @@ dependencies = [
"zbus",
]
[[package]]
name = "craft-png"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"png 0.18.1",
"thiserror 2.0.21",
]
[[package]]
name = "craft-print"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1992,7 +2005,7 @@ dependencies = [
[[package]]
name = "craft-proof"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"log",
"miniz_oxide 0.9.1",
@@ -2003,7 +2016,7 @@ dependencies = [
[[package]]
name = "craft-quit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"dispatch2",
"egui",
@@ -2016,7 +2029,7 @@ dependencies = [
[[package]]
name = "craft-review"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -2035,7 +2048,7 @@ dependencies = [
[[package]]
name = "craft-rtf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-codepage",
"craft-flow",
@@ -2048,7 +2061,7 @@ dependencies = [
[[package]]
name = "craft-settings"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-atomic",
"craft-host",
@@ -2065,17 +2078,17 @@ dependencies = [
[[package]]
name = "craft-sheet"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
[[package]]
name = "craft-ssip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
[[package]]
name = "craft-svg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-xml",
"flate2",
@@ -2092,7 +2105,7 @@ dependencies = [
[[package]]
name = "craft-table"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2104,7 +2117,7 @@ dependencies = [
[[package]]
name = "craft-text"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2128,7 +2141,7 @@ dependencies = [
[[package]]
name = "craft-theme"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"bitflags 2.13.2",
"craft-tracked",
@@ -2143,7 +2156,7 @@ dependencies = [
[[package]]
name = "craft-theme-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-atomic",
"craft-behavior",
@@ -2158,7 +2171,7 @@ dependencies = [
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2168,7 +2181,7 @@ dependencies = [
[[package]]
name = "craft-time"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2177,7 +2190,7 @@ dependencies = [
[[package]]
name = "craft-timeline"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2192,12 +2205,12 @@ dependencies = [
[[package]]
name = "craft-tracked"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
[[package]]
name = "craft-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-cloud-ui",
"craft-ui-canvas",
@@ -2211,7 +2224,7 @@ dependencies = [
[[package]]
name = "craft-ui-canvas"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-font-catalog",
@@ -2228,7 +2241,7 @@ dependencies = [
[[package]]
name = "craft-ui-contract"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"accesskit",
"craft-behavior",
@@ -2266,7 +2279,7 @@ dependencies = [
[[package]]
name = "craft-ui-macros"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -2277,7 +2290,7 @@ dependencies = [
[[package]]
name = "craft-ui-panels"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2295,7 +2308,7 @@ dependencies = [
[[package]]
name = "craft-ui-patterns"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2316,7 +2329,7 @@ dependencies = [
[[package]]
name = "craft-ui-shell"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2332,12 +2345,13 @@ dependencies = [
"raw-window-handle",
"serde",
"web-time",
"winit",
]
[[package]]
name = "craft-ui-test-kit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2348,7 +2362,7 @@ dependencies = [
[[package]]
name = "craft-ui-widgets"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2362,12 +2376,13 @@ dependencies = [
"log",
"serde",
"smallvec",
"unicode-segmentation",
]
[[package]]
name = "craft-update"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -2399,7 +2414,7 @@ dependencies = [
[[package]]
name = "craft-web-api"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"js-sys",
"serde_json",
@@ -2410,7 +2425,7 @@ dependencies = [
[[package]]
name = "craft-web-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-host",
"craft-platform",
@@ -2422,7 +2437,7 @@ dependencies = [
[[package]]
name = "craft-win32"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"winsafe",
]
@@ -2430,7 +2445,7 @@ dependencies = [
[[package]]
name = "craft-window"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-appkit",
"craft-atomic",
@@ -2462,7 +2477,7 @@ dependencies = [
[[package]]
name = "craft-wordmodel"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"base64 0.23.1",
"craft-math",
@@ -2476,7 +2491,7 @@ dependencies = [
[[package]]
name = "craft-xls"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-cfb",
"craft-sheet",
@@ -2489,7 +2504,7 @@ dependencies = [
[[package]]
name = "craft-xlsx"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"craft-drawingml",
"craft-opc",
@@ -2501,7 +2516,7 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"quick-xml 0.41.0",
"serde",
@@ -2511,7 +2526,7 @@ dependencies = [
[[package]]
name = "craft-zip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"flate2",
"thiserror 2.0.21",
@@ -3904,7 +3919,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"
[[package]]
name = "hayro-cmap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"brotli 8.0.4",
"hayro-postscript",
@@ -3913,7 +3928,7 @@ dependencies = [
[[package]]
name = "hayro-interpret"
version = "0.7.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"bitflags 2.13.2",
"hayro-cmap",
@@ -3931,7 +3946,7 @@ dependencies = [
[[package]]
name = "hayro-jbig2"
version = "0.3.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"fearless_simd",
"hayro-ccitt",
@@ -3949,12 +3964,12 @@ dependencies = [
[[package]]
name = "hayro-postscript"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
[[package]]
name = "hayro-syntax"
version = "0.7.2"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"flate2",
"hayro-ccitt",
@@ -4469,6 +4484,26 @@ dependencies = [
"hashbrown 0.17.1",
]
[[package]]
name = "inotify"
version = "0.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cc00ea907cab49550b7da656f80ebb97be1b997d931fbcd28d39734e17ce592"
dependencies = [
"bitflags 2.13.2",
"inotify-sys",
"libc",
]
[[package]]
name = "inotify-sys"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c033f80b2c113cdf91ab7a33faa9cbc014726dcad99880c8609af2a370edf37d"
dependencies = [
"libc",
]
[[package]]
name = "inout"
version = "0.2.2"
@@ -4680,10 +4715,30 @@ dependencies = [
"accesskit_consumer",
]
[[package]]
name = "kqueue"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d763e5b24120b4ddf50de6c92308156765aabfbbccebf401da7cff2d70a41ea"
dependencies = [
"kqueue-sys",
"libc",
]
[[package]]
name = "kqueue-sys"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087"
dependencies = [
"bitflags 2.13.2",
"libc",
]
[[package]]
name = "krilla"
version = "0.8.2"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"base64 0.22.1",
"bumpalo",
@@ -4822,7 +4877,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
[[package]]
name = "linesweeper"
version = "0.5.0"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
dependencies = [
"arrayvec",
"kurbo",
@@ -4973,6 +5028,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee"
dependencies = [
"libc",
"log",
"wasi",
"windows-sys 0.61.2",
]
@@ -5138,6 +5194,35 @@ dependencies = [
"memchr",
]
[[package]]
name = "notify"
version = "9.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5482d5bd11b91a337521980e5d52fe115bdccfb4c217099daaf0abd69159dc4e"
dependencies = [
"bitflags 2.13.2",
"inotify",
"kqueue",
"libc",
"log",
"mio",
"notify-types",
"objc2-core-foundation",
"objc2-core-services",
"walkdir",
"windows-sys 0.61.2",
"xxhash-rust",
]
[[package]]
name = "notify-types"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbd044e85df3d939d8e32a1c35a3b737c7d0a4eeb7acd737bd207644e00f4e5f"
dependencies = [
"bitflags 2.13.2",
]
[[package]]
name = "num-conv"
version = "0.2.2"
@@ -5429,6 +5514,16 @@ dependencies = [
"objc2-core-video",
]
[[package]]
name = "objc2-core-services"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "583300ad934cba24ff5292aee751ecc070f7ca6b39a574cc21b7b5e588e06a0b"
dependencies = [
"libc",
"objc2-core-foundation",
]
[[package]]
name = "objc2-core-text"
version = "0.3.2"
@@ -9709,6 +9804,12 @@ dependencies = [
"serde_json",
]
[[package]]
name = "xxhash-rust"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40de123dbb523ebcc00d61ec01840ad192578afc378d859f3429caa38308fad5"
[[package]]
name = "yeslogic-fontconfig-sys"
version = "6.0.1"
@@ -10093,4 +10194,4 @@ source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f
[[patch.unused]]
name = "hayro"
version = "0.7.1"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
source = "git+https://github.com/storytold/craft-libs?rev=0a15c60d5aee340c9430ced36af7c23fba9d1920#0a15c60d5aee340c9430ced36af7c23fba9d1920"
+39 -39
View File
@@ -37,22 +37,22 @@ wordcraft-pdf = { path = "crates/pdf" }
# reads the ca-valencia pack), #589 (French elision suggestions first), #497 (flag-based
# compounding), #496 (review follow-ups, en-AU) and the merged #482–#490/#495 stack; the font
# store's `language-pack` kind is #486 (CP4.1).
wordcraft-proof = { package = "craft-proof", git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-ssip = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
wordcraft-proof = { package = "craft-proof", git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-ssip = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
wordcraft-engine = { path = "crates/engine" }
wordcraft-mcp = { path = "crates/mcp" }
wordcraft-zotero = { path = "crates/zotero" }
wordcraft-control-key = { path = "crates/control-key" }
wordcraft-ui-egui = { path = "crates/ui-egui" }
wordcraft-validate = { path = "crates/validate" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", default-features = false }
craft-ui-test-kit = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0", default-features = false }
craft-ui-test-kit = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920" }
# foundation
kurbo = { version = "0.13", features = ["serde"] }
@@ -85,28 +85,28 @@ wuff = "0.2.9"
brotli-decompressor = "5"
vello_cpu = "0.2"
image = { version = "0.25", default-features = false }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", default-features = false, features = ["write"] }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0", default-features = false, features = ["write"] }
craft-wordmodel = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-docx = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", features = ["doc"] }
craft-doc-binary = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-flow = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-odf = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", features = ["text"] }
craft-markdown = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-html = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", features = ["flow"] }
craft-latex = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-math = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", features = ["detect"] }
craft-sheet = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-wordmodel = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-docx = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0", features = ["doc"] }
craft-doc-binary = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-flow = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-odf = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0", features = ["text"] }
craft-markdown = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-html = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0", features = ["flow"] }
craft-latex = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-math = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0", features = ["detect"] }
craft-sheet = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", version = "=0.1.0" }
# zlib streams (compressed metafile pictures in `.doc` drawings); already in the lock as a dependency of other crates.
miniz_oxide = "0.9"
cfb = "0.15"
@@ -174,14 +174,14 @@ debug = 0
# The framework's patches, which Cargo does not carry over to dependents: its vendored crates from craft-libs,
# and the egui and winit forks it builds with.
[patch.crates-io]
krilla = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920" }
hayro = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
emath = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
+2 -2
View File
@@ -1230,8 +1230,8 @@ mod smoke {
assert!(run.app.app.dialog_host_mut().shows_modal(), "the Save Changes prompt shows");
let tree = run.frames.tree();
// The framework words the answer as the platform does: "Don't Save" on macOS, "No" elsewhere.
let dont_save = if cfg!(target_os = "macos") { "Don't Save" } else { "No" };
// The framework words the answer "Don't Save" on every OS (craft-libs 92ed66b43).
let dont_save = "Don't Save";
// A button is named by the label inside it (`labelled_by`) as often as by its own name, and the label's own
// node is no button: the testing module's `name` and `is_interactive` read it as the fixture's `by_label` does.
let button = tree
+14 -4
View File
@@ -50,10 +50,20 @@ fn write_no_follow(path: &Path, bytes: &[u8]) -> io::Result<()> {
}
return Err(error);
}
if let Ok(directory) = File::open(directory)
&& let Err(e) = directory.sync_all()
{
log::warn!("couldn't sync {}: {e}", path.display());
match File::open(directory) {
Ok(dir) => {
if let Err(e) = dir.sync_all() {
log::warn!("couldn't sync {}: {e}", directory.display());
}
}
#[cfg(unix)]
Err(e) => {
log::warn!("couldn't open {} to sync: {e}", directory.display());
}
#[cfg(not(unix))]
Err(_) => {
// Opening a directory handle with File::open is not supported on Windows, so skipping the sync there is expected.
}
}
Ok(())
}
+1 -1
View File
@@ -452,7 +452,7 @@ pub fn reroute_group(group: &mut InlineObject) -> bool {
// Rendering scales the rectangle before spinning it. Undo only the group scale
// so route can rebuild an unrotated child frame without moving fallback ends.
let (x, y) = (fin(c.x) * sx, fin(c.y) * sy);
let (cw, ch) = ((fin(*w) * sx).clamp(0.0, 4000.0), (fin(*h) * sy).clamp(0.0, 4000.0));
let (cw, ch) = ((fin(*w) * sx).clamp(0.0, crate::para::MAX_SHARE_LEN), (fin(*h) * sy).clamp(0.0, crate::para::MAX_SHARE_LEN));
let (cx, cy) = (x + cw / 2.0, y + ch / 2.0);
let spin = float.spin();
let s0 = spin.apply(cx, cy, x, y);
+32
View File
@@ -49,6 +49,35 @@ impl std::fmt::Debug for MediaIndex {
}
}
/// Failed text-box part allocations recorded while adopting notes/comments, waiting to be merged
/// into the body adoption summary of the same paste (#9918).
#[derive(Clone, Default)]
pub(crate) struct PendingBoxAlloc {
pub(crate) failed: usize,
pub(crate) error: Option<String>,
}
impl PendingBoxAlloc {
pub(crate) fn merge(&mut self, other: PendingBoxAlloc) {
self.failed = self.failed.saturating_add(other.failed);
if self.error.is_none() {
self.error = other.error;
}
}
}
impl PartialEq for PendingBoxAlloc {
fn eq(&self, _: &Self) -> bool {
true
}
}
impl std::fmt::Debug for PendingBoxAlloc {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("PendingBoxAlloc")
}
}
impl Default for Document {
fn default() -> Self {
Document::new()
@@ -76,6 +105,7 @@ impl Document {
passthrough: BTreeMap::new(),
glossary: Vec::new(),
media_index: MediaIndex::default(),
pending_box_alloc: PendingBoxAlloc::default(),
kept: Default::default(),
missing_pictures: Default::default(),
fit_state: None,
@@ -155,6 +185,7 @@ impl Document {
passthrough,
glossary,
media_index: _,
pending_box_alloc: _,
kept: _,
missing_pictures: _,
fit_state: _,
@@ -177,6 +208,7 @@ impl Document {
passthrough: other_passthrough,
glossary: other_glossary,
media_index: _,
pending_box_alloc: _,
kept: _,
missing_pictures: _,
fit_state: _,
+105 -14
View File
@@ -254,6 +254,10 @@ struct BoxBudget {
costs: BTreeMap<u32, usize>,
/// Boxes left without a story because the paste's budget couldn't hold theirs.
skipped: usize,
/// Boxes left without a story because allocating a new part id failed.
alloc_failed: usize,
/// First part-allocation error seen while adopting text boxes, logged once at the end.
alloc_error: Option<String>,
/// A box the fragment has no story for may show this document's story of that id (a
/// fragment copied from this document without its parts). Off for another document's
/// fragment, whose ids mean nothing here.
@@ -262,7 +266,36 @@ struct BoxBudget {
impl BoxBudget {
fn new() -> BoxBudget {
BoxBudget { stories: MAX_PASTED_BOXES, bytes: MAX_PASTED_BOX_BYTES, active: Vec::new(), costs: BTreeMap::new(), skipped: 0, local: true }
BoxBudget {
stories: MAX_PASTED_BOXES,
bytes: MAX_PASTED_BOX_BYTES,
active: Vec::new(),
costs: BTreeMap::new(),
skipped: 0,
alloc_failed: 0,
alloc_error: None,
local: true,
}
}
fn merge_pending(&mut self, pending: crate::document::PendingBoxAlloc) {
self.alloc_failed = self.alloc_failed.saturating_add(pending.failed);
if self.alloc_error.is_none() {
self.alloc_error = pending.error;
}
}
fn into_pending(self) -> crate::document::PendingBoxAlloc {
crate::document::PendingBoxAlloc { failed: self.alloc_failed, error: self.alloc_error }
}
fn warn_alloc_failed(&self) {
if self.alloc_failed > 0 {
let reason = self.alloc_error.as_deref().unwrap_or("no free part id");
let noun = if self.alloc_failed == 1 { "text box is" } else { "text boxes are" };
// Once per paste, not once per box (follow-up to #9854).
log::warn!("adopt_text_box: {} {noun} left empty; cannot add a part: {reason}", self.alloc_failed);
}
}
}
@@ -1207,12 +1240,27 @@ impl Document {
/// `w:matchSrc`): a style whose id we already have comes along under a new id, and its
/// document defaults go into its base styles, which its unstyled paragraphs then use.
pub fn adopt_with(&mut self, src: Document, keep_styles: bool) -> Fragment {
self.adopt_in(src, keep_styles, &mut 0)
self.adopt_with_allocator(src, keep_styles, &mut |doc, blocks| doc.try_add_part(PartKind::TextBox, blocks))
}
fn adopt_with_allocator<F>(&mut self, src: Document, keep_styles: bool, add_part: &mut F) -> Fragment
where
F: FnMut(&mut Self, Blocks) -> Result<u32>,
{
let mut budget = BoxBudget::new();
let frag = self.adopt_in_with(src, keep_styles, &mut 0, &mut budget, add_part);
// Carry note/comment allocation failures into the matching insert_fragment / adopt_fragment
// so one cross-document paste emits a single summary warning (#9918).
self.pending_box_alloc.merge(budget.into_pending());
frag
}
/// [`Self::adopt_with`], its permission range ids from at least `perms` on (and past ours);
/// `perms` moves past them.
fn adopt_in(&mut self, mut src: Document, keep_styles: bool, perms: &mut u32) -> Fragment {
fn adopt_in_with<F>(&mut self, mut src: Document, keep_styles: bool, perms: &mut u32, budget: &mut BoxBudget, add_part: &mut F) -> Fragment
where
F: FnMut(&mut Self, Blocks) -> Result<u32>,
{
let mut renamed = BTreeMap::new();
let mut default_style = None;
if keep_styles {
@@ -1342,12 +1390,11 @@ impl Document {
part.blocks.iter_mut().for_each(|b| link.block(Arc::make_mut(b)));
}
// A note's or comment's text boxes get stories here now; the body's go with the fragment.
let mut budget = BoxBudget::new();
for (old, new) in &notes {
let Some(part) = src.parts.get(old) else { continue };
let mut blocks: Vec<Block> = part.blocks.iter().map(|b| (**b).clone()).collect();
blocks.iter_mut().for_each(|b| link.block(b));
self.adopt_text_boxes(&mut blocks, &parts, 0, &mut budget);
self.adopt_text_boxes_with(&mut blocks, &parts, 0, budget, add_part);
if let Some(p) = self.parts.get_mut(new) {
p.blocks = blocks.into_iter().map(Arc::new).collect();
}
@@ -1369,9 +1416,18 @@ impl Document {
/// id the reader hasn't given out (ranges it holds aren't in this document yet); it moves past
/// the adopted ones.
pub fn adopt_blocks(&mut self, src: Document, keep_styles: bool, perms: &mut u32) -> Vec<Block> {
let Fragment { mut blocks, parts, .. } = self.adopt_in(src, keep_styles, perms);
self.adopt_blocks_with(src, keep_styles, perms, &mut |doc, blocks| doc.try_add_part(PartKind::TextBox, blocks))
}
fn adopt_blocks_with<F>(&mut self, src: Document, keep_styles: bool, perms: &mut u32, add_part: &mut F) -> Vec<Block>
where
F: FnMut(&mut Self, Blocks) -> Result<u32>,
{
let mut budget = BoxBudget::new();
self.adopt_text_boxes(&mut blocks, &parts, 0, &mut budget);
budget.merge_pending(std::mem::take(&mut self.pending_box_alloc));
let Fragment { mut blocks, parts, .. } = self.adopt_in_with(src, keep_styles, perms, &mut budget, add_part);
self.adopt_text_boxes_with(&mut blocks, &parts, 0, &mut budget, add_part);
budget.warn_alloc_failed();
blocks
}
@@ -1579,7 +1635,15 @@ impl Document {
/// Give every text box in `blocks` a new story of its own, copied from `parts` (or, for a
/// fragment without them, from this document's text box of that id). A box whose story can't
/// be found keeps no story rather than showing an unrelated one.
#[cfg(test)]
fn adopt_text_boxes(&mut self, blocks: &mut [Block], parts: &BTreeMap<u32, Part>, depth: usize, budget: &mut BoxBudget) {
self.adopt_text_boxes_with(blocks, parts, depth, budget, &mut |doc, blocks| doc.try_add_part(PartKind::TextBox, blocks));
}
fn adopt_text_boxes_with<F>(&mut self, blocks: &mut [Block], parts: &BTreeMap<u32, Part>, depth: usize, budget: &mut BoxBudget, add_part: &mut F)
where
F: FnMut(&mut Self, Blocks) -> Result<u32>,
{
let mut any = false;
for b in blocks.iter() {
each_para(b, 0, &mut |p| any |= box_ids(p).next().is_some());
@@ -1593,7 +1657,7 @@ impl Document {
for o in p.objects.iter_mut() {
for story in o.text_box_slots() {
if let Some(old) = *story {
*story = self.adopt_text_box(old, parts, depth, budget);
*story = self.adopt_text_box(old, parts, depth, budget, add_part);
changed = true;
}
}
@@ -1609,7 +1673,10 @@ impl Document {
/// text boxes are shared with the source (copy-on-write), the others copied. A box showing a
/// story it is inside, or whose story the paste's budget can't hold, gets none (CWE-400);
/// only that box: a later box with a smaller story is still copied while the budget lasts.
fn adopt_text_box(&mut self, old: u32, parts: &BTreeMap<u32, Part>, depth: usize, budget: &mut BoxBudget) -> Option<u32> {
fn adopt_text_box<F>(&mut self, old: u32, parts: &BTreeMap<u32, Part>, depth: usize, budget: &mut BoxBudget, add_part: &mut F) -> Option<u32>
where
F: FnMut(&mut Self, Blocks) -> Result<u32>,
{
if depth >= MAX_BOX_DEPTH || budget.active.contains(&old) {
return None;
}
@@ -1644,17 +1711,20 @@ impl Document {
each_para(&b, 0, &mut |p| boxes |= box_ids(p).next().is_some());
if boxes {
let mut copy = (*b).clone();
self.adopt_text_boxes(std::slice::from_mut(&mut copy), parts, depth + 1, budget);
self.adopt_text_boxes_with(std::slice::from_mut(&mut copy), parts, depth + 1, budget, add_part);
blocks.push(Arc::new(copy));
} else {
blocks.push(b);
}
}
budget.active.pop();
let id = match self.try_add_part(PartKind::TextBox, blocks) {
let id = match add_part(self, blocks) {
Ok(id) => id,
Err(e) => {
log::warn!("adopt_text_boxes: cannot add a part: {e}");
budget.alloc_failed = budget.alloc_failed.saturating_add(1);
if budget.alloc_error.is_none() {
budget.alloc_error = Some(e.to_string());
}
return None;
}
};
@@ -1687,6 +1757,13 @@ impl Document {
/// fragment's parts (as a paste does), to place them in this document; a box the fragment
/// has no story for keeps none.
pub fn adopt_fragment(&mut self, frag: &Fragment) -> Vec<Block> {
self.adopt_fragment_with(frag, &mut |doc, blocks| doc.try_add_part(PartKind::TextBox, blocks))
}
fn adopt_fragment_with<F>(&mut self, frag: &Fragment, add_part: &mut F) -> Vec<Block>
where
F: FnMut(&mut Self, Blocks) -> Result<u32>,
{
let media_remap = self.adopt_media(&frag.media);
let mut blocks = frag.blocks.clone();
let mut remapped_parts;
@@ -1698,18 +1775,27 @@ impl Document {
&remapped_parts
};
let mut budget = BoxBudget { local: false, ..BoxBudget::new() };
self.adopt_text_boxes(&mut blocks, parts, 0, &mut budget);
budget.merge_pending(std::mem::take(&mut self.pending_box_alloc));
self.adopt_text_boxes_with(&mut blocks, parts, 0, &mut budget, add_part);
if budget.skipped > 0 {
log::warn!(
"{} text boxes are left empty; their stories are past what one copy brings ({MAX_PASTED_BOXES} stories, {MAX_PASTED_BOX_BYTES} bytes)",
budget.skipped
);
}
budget.warn_alloc_failed();
blocks
}
/// Insert a fragment at `pos`; returns the position after the pasted content.
pub fn insert_fragment(&mut self, pos: &Pos, frag: &Fragment) -> Result<Pos> {
self.insert_fragment_with(pos, frag, &mut |doc, blocks| doc.try_add_part(PartKind::TextBox, blocks))
}
fn insert_fragment_with<F>(&mut self, pos: &Pos, frag: &Fragment, add_part: &mut F) -> Result<Pos>
where
F: FnMut(&mut Self, Blocks) -> Result<u32>,
{
let media_remap = self.adopt_media(&frag.media);
// Tables that would nest deeper than the limit here become their paragraphs (#1596).
let room = MAX_TABLE_DEPTH.saturating_sub(pos.path.depth());
@@ -1718,6 +1804,9 @@ impl Document {
fit_tables(b, room, &mut blocks);
}
if blocks.is_empty() {
let mut budget = BoxBudget::new();
budget.merge_pending(std::mem::take(&mut self.pending_box_alloc));
budget.warn_alloc_failed();
return Ok(pos.clone());
}
let Some(dest_para) = self.para_at(pos) else {
@@ -1730,7 +1819,8 @@ impl Document {
remap_media_in(&mut blocks, &mut parts, &media_remap);
// Pasted text boxes get stories of their own (never shared with the copy's source).
let mut budget = BoxBudget::new();
self.adopt_text_boxes(&mut blocks, &parts, 0, &mut budget);
budget.merge_pending(std::mem::take(&mut self.pending_box_alloc));
self.adopt_text_boxes_with(&mut blocks, &parts, 0, &mut budget, add_part);
if budget.skipped > 0 {
// Once per paste, not once per box (review of #3874).
log::warn!(
@@ -1738,6 +1828,7 @@ impl Document {
budget.skipped
);
}
budget.warn_alloc_failed();
// Single paragraph: inline insert keeping runs.
if blocks.len() == 1
&& let Some(Block::Para(src)) = blocks.first()
+93
View File
@@ -576,6 +576,99 @@ fn a_box_over_the_budget_leaves_later_smaller_boxes_their_stories() {
assert_eq!(budget.costs.len(), 2, "each story costed once");
}
#[test]
fn part_allocation_failure_warns_once_per_paste_with_adopt_text_box_label() {
let small = para_block(Paragraph::with_text("small", CharProps::default()));
let mut p = Paragraph::new();
for _ in 0..3 {
p.insert_object(0, box_shape(Some(1)), &CharProps::default()).unwrap();
}
let mut parts = BTreeMap::new();
parts.insert(1, crate::Part { kind: PartKind::TextBox, blocks: vec![small], body: Default::default() });
let mut blocks = vec![Block::Para(p)];
let mut d = doc(&["x"]);
let mut budget = BoxBudget::new();
let mut remaining = 1usize;
let (_, during) = crate::test_log::warnings(|| {
d.adopt_text_boxes_with(&mut blocks, &parts, 0, &mut budget, &mut |doc, bl| {
if remaining > 0 {
remaining -= 1;
doc.try_add_part(PartKind::TextBox, bl)
} else {
Err(DocError::Invalid("no free part id".into()))
}
});
});
assert!(during.is_empty(), "must not log once per failing box: {during:?}");
let Some(Block::Para(p)) = blocks.first() else { panic!() };
let got: Vec<bool> = p.objects.iter().map(|o| matches!(o, InlineObject::Shape { story: Some(_), .. })).collect();
assert_eq!(got, [true, false, false], "first box allocates, remaining two stay empty");
assert_eq!(budget.alloc_failed, 2);
let (_, summary) = crate::test_log::warnings(|| budget.warn_alloc_failed());
assert_eq!(summary.len(), 1, "must log one summary warning: {summary:?}");
assert!(summary[0].starts_with("adopt_text_box:"), "{summary:?}");
assert!(summary[0].contains("2 text boxes are left empty"), "{summary:?}");
assert!(summary[0].contains("no free part id"), "{summary:?}");
}
#[test]
fn cross_document_paste_combines_note_and_body_alloc_warnings_into_one() {
let make_src = || {
let mut src = Document::new();
let tb1 = src.add_part(PartKind::TextBox, vec![para_block(Paragraph::with_text("note box", CharProps::default()))]);
let tb2 = src.add_part(PartKind::TextBox, vec![para_block(Paragraph::with_text("body box 1", CharProps::default()))]);
let tb3 = src.add_part(PartKind::TextBox, vec![para_block(Paragraph::with_text("body box 2", CharProps::default()))]);
let mut note_para = Paragraph::with_text("fn", CharProps::default());
note_para.insert_object(2, box_shape(Some(tb1)), &CharProps::default()).unwrap();
let fn_id = src.add_part(PartKind::Footnote, vec![para_block(note_para)]);
let mut body_para = Paragraph::with_text("hi", CharProps::default());
body_para
.insert_object(
2,
InlineObject::NoteRef { kind: crate::para::NoteKind::Footnote, id: fn_id, custom: String::new() },
&CharProps::default(),
)
.unwrap();
body_para.insert_object(0, box_shape(Some(tb2)), &CharProps::default()).unwrap();
body_para.insert_object(0, box_shape(Some(tb3)), &CharProps::default()).unwrap();
src.body = vec![para_block(body_para)];
src
};
// adopt_blocks: note + body failures combine into one summary warning.
let mut d = doc(&["x"]);
let mut perms = 1;
let (_, warned) = crate::test_log::warnings(|| {
d.adopt_blocks_with(make_src(), false, &mut perms, &mut |_, _| Err(DocError::Invalid("no free part id".into())))
});
assert_eq!(warned.len(), 1, "adopt_blocks must log once across notes and body: {warned:?}");
assert!(warned[0].starts_with("adopt_text_box: 3 text boxes are left empty"), "{warned:?}");
// adopt_with + insert_fragment: zero warnings during adopt_with, one combined warning on insert_fragment.
let mut d = doc(&["x"]);
let (frag, during_adopt) =
crate::test_log::warnings(|| d.adopt_with_allocator(make_src(), false, &mut |_, _| Err(DocError::Invalid("no free part id".into()))));
assert!(during_adopt.is_empty(), "adopt_with must defer note alloc warnings to paste: {during_adopt:?}");
let (_, during_insert) = crate::test_log::warnings(|| {
d.insert_fragment_with(&Pos::body(0, 1), &frag, &mut |_, _| Err(DocError::Invalid("no free part id".into()))).unwrap()
});
assert_eq!(during_insert.len(), 1, "insert_fragment must log one combined warning: {during_insert:?}");
assert!(during_insert[0].starts_with("adopt_text_box: 3 text boxes are left empty"), "{during_insert:?}");
// adopt_with + adopt_fragment: one combined warning, and pending count is drained.
let mut d = doc(&["x"]);
let (frag, during_adopt) =
crate::test_log::warnings(|| d.adopt_with_allocator(make_src(), false, &mut |_, _| Err(DocError::Invalid("no free part id".into()))));
assert!(during_adopt.is_empty(), "{during_adopt:?}");
let (_, during_frag) = crate::test_log::warnings(|| d.adopt_fragment_with(&frag, &mut |_, _| Err(DocError::Invalid("no free part id".into()))));
assert_eq!(during_frag.len(), 1, "adopt_fragment must log one combined warning: {during_frag:?}");
assert!(during_frag[0].starts_with("adopt_text_box: 3 text boxes are left empty"), "{during_frag:?}");
// A subsequent paste with no failures must not re-log the drained note failures.
let (_, after) = crate::test_log::warnings(|| d.adopt_fragment(&Fragment::from_text("ok")));
assert!(after.is_empty(), "{after:?}");
}
#[test]
fn many_boxes_sharing_one_story_paste_with_their_text() {
// Review of #3874: a document converted from PDF has thousands of boxes showing story
+4
View File
@@ -138,6 +138,10 @@ pub struct Document {
/// by `==`).
#[serde(skip)]
media_index: MediaIndex,
/// Text-box part allocation failures from note/comment adoption carried into the matching
/// fragment paste so one cross-document paste logs once (#9918); never saved, ignored by `==`.
#[serde(skip)]
pub(crate) pending_box_alloc: document::PendingBoxAlloc,
/// Markup kept from the file it was opened from, for writing back what isn't edited (see
/// [`kept`]); never saved, ignored by `==`.
#[serde(skip)]
+1 -1
View File
@@ -18,7 +18,7 @@ mod inline_kinds;
mod inline_object;
mod run;
pub use float::{AltText, Anchor, Float, FloatAlign, MAX_ALT_TEXT, RelSize, SizeFrom, Wrap, WrapText, cap_alt};
pub use float::{AltText, Anchor, Float, FloatAlign, MAX_ALT_TEXT, MAX_SHARE_LEN, RelSize, SizeFrom, Wrap, WrapText, cap_alt};
pub use inline_kinds::{NoteKind, PTabAlign, PTabBase, RubyAlign, ShapeKind, ruby_offset, ruby_raise};
pub use inline_object::{CanvasStyle, GroupChild, InlineObject, MAX_GROUP_CHILDREN};
pub use run::{COLUMN_BREAK, LINE_BREAK, NB_HYPHEN, NBSP, OBJ, PAGE_BREAK, Run, SOFT_HYPHEN, next_rev};
+5
View File
@@ -131,6 +131,11 @@ pub struct RelSize {
pub pct: u32,
}
/// Longest side a share of the page or a margin gives an object, points: ten times the largest
/// page Word makes (22 inches), the most a share reaches (1000 %, as Word reads it). It bounds a
/// group's members as the group scales them too, not the 4000 pt an object's own size stops at.
pub const MAX_SHARE_LEN: f32 = 15_840.0;
impl RelSize {
/// The length this share gives of `base` (points), `None` for a share of 0.
pub fn of(self, base: f32) -> Option<f32> {
+6 -1
View File
@@ -363,7 +363,12 @@ impl InlineObject {
.enumerate()
.filter_map(|(i, c)| {
let (cw, chh, _) = c.obj.frame()?;
let r = [x + fin(c.x) * sx, y + fin(c.y) * sy, (fin(cw) * sx).clamp(0.0, 4000.0), (fin(chh) * sy).clamp(0.0, 4000.0)];
let r = [
x + fin(c.x) * sx,
y + fin(c.y) * sy,
(fin(cw) * sx).clamp(0.0, super::MAX_SHARE_LEN),
(fin(chh) * sy).clamp(0.0, super::MAX_SHARE_LEN),
];
(!matches!(c.obj, InlineObject::Group { .. })).then_some((i, r))
})
.collect()
+3 -3
View File
@@ -736,7 +736,7 @@ fn find(s: &mut Session, v: &Value) -> CmdResult {
return Ok(json!({"count": s.find.results.len()}));
}
let story = s.sel.focus.story;
s.find.results = search(s, story)?;
s.find.set_results(search(s, story)?);
// Select the first match after the caret.
let caret = s.sel.focus.clone();
let idx = s.find.results.iter().position(|(a, _)| *a >= caret).unwrap_or(0);
@@ -775,13 +775,13 @@ fn advanced_find(s: &mut Session, v: &Value) -> CmdResult {
let n = found.len();
let matches: Vec<Value> = found.iter().take(200).map(|(a, b)| json!({"start": pos_json(a), "end": pos_json(b)})).collect();
s.find.current = 0;
s.find.results = found;
s.find.set_results(found);
Ok(json!({"count": n, "matches": matches, "highlight": s.find.highlight}))
}
fn step(s: &mut Session, dir: i64) -> CmdResult {
let story = s.sel.focus.story;
s.find.results = search(s, story)?;
s.find.set_results(search(s, story)?);
let n = s.find.results.len();
if n == 0 {
return Err(CmdError::Failed("no matches".into()));
+40 -8
View File
@@ -152,7 +152,9 @@ pub(super) fn ungroup(s: &mut Session, _: &Value) -> CmdResult {
return Err(CmdError::Disabled(INK_GROUP.into()));
}
// Its offsets, explicit: the members are placed from the same anchor.
let pos = if float.wrap == Wrap::Inline {
// In line with text it is drawn at its own size, whatever share it holds.
let was_inline = float.wrap == Wrap::Inline;
let pos = if was_inline {
if pos.path.depth() > 0 || !movable_story(s, pos.story) {
return Err(CmdError::Disabled("only groups in the body text, headers and footers can be ungrouped in line with text".into()));
}
@@ -164,14 +166,43 @@ pub(super) fn ungroup(s: &mut Session, _: &Value) -> CmdResult {
};
let obj = s.doc.para_at(&pos).and_then(|p| p.object_at(pos.off)).cloned().ok_or_else(|| CmdError::Failed("object vanished".into()))?;
let Some((w, h, float)) = obj.frame() else { return Err(CmdError::Failed("object vanished".into())) };
// A group sized as a share of the page or a margin shows its members at the size it is drawn
// at; they take their places and sizes there, not the share (each would be all of it).
let (w, h) = match (float.rel_w.is_some() || float.rel_h.is_some()).then(|| s.layout().object(&pos, s.page_hint)).flatten() {
Some(hit) => (hit.rect.w, hit.rect.h),
None => (w, h),
};
// A floating group sized as a share of the page or a margin shows its members at the size it
// is drawn at; they take their places and sizes there, not the share (each would be all of it).
// One that was in line with text was drawn at its own size.
let shared = !was_inline && (float.rel_w.is_some() || float.rel_h.is_some());
// Where the group is drawn: its size there, and the page whose width, height or margin its
// share is a share of.
let lay = shared.then(|| s.layout());
let drawn = lay.as_ref().and_then(|lay| {
let hit = lay.object(&pos, s.page_hint)?;
Some((hit.rect.w, hit.rect.h, lay.pages.get(hit.page)?))
});
let (w, h) = drawn.map_or((w, h), |(dw, dh, _)| (dw, dh));
let group_share = (float.rel_w, float.rel_h);
let float = Float { rel_w: None, rel_h: None, ..float.clone() };
// Each member where the group shows it: the group's turn moves its centre about the group's
// What the group's share is of on each axis, as layout placed it on that page: in the
// section its anchor is in (a header's or footer's goes with the page's), on the page that
// section is laid out on in the view (as wide as the window in the continuous views, on its
// side in a turned section).
let anchor_block = (pos.story == wordcraft_doc::StoryRef::Body).then(|| pos.path.0.first().copied()).flatten();
let si = anchor_block.and_then(|b| s.doc.sections().iter().position(|(end, _)| b as usize <= *end));
let view = s.view_layout_options();
let base_of = |share: Option<wordcraft_doc::para::RelSize>, across: bool| {
let (r, (_, _, page)) = (share?, drawn?);
Some(wordcraft_layout::share_base_on(&s.doc, page, si, &view, r.from, across))
};
let bases = (base_of(group_share.0, true), base_of(group_share.1, false));
// A member drawn past the 4000 pt an object's own size stops at keeps the size it showed as a
// share of what the group's share is of (its drawn length over that length); a smaller one
// takes its size outright.
let part = |share: Option<wordcraft_doc::para::RelSize>, member: f32, across: bool| {
let r = share.filter(|_| member > MAX_OFFSET)?;
let base = if across { bases.0 } else { bases.1 }?;
(base > 0.0).then(|| wordcraft_doc::para::RelSize {
pct: (f64::from(member) / f64::from(base) * 100_000.0).round().clamp(1.0, f64::from(u32::MAX)) as u32,
..r
})
}; // Each member where the group shows it: the group's turn moves its centre about the group's
// centre and adds to its own turn.
let members: Vec<InlineObject> = shown_members(&obj, [0.0, 0.0, w, h])
.into_iter()
@@ -186,6 +217,7 @@ pub(super) fn ungroup(s: &mut Session, _: &Value) -> CmdResult {
let alt = std::mem::take(&mut f.alt);
*f = Float { x: (float.x + x).clamp(-MAX_OFFSET, MAX_OFFSET), y: (float.y + y).clamp(-MAX_OFFSET, MAX_OFFSET), alt, ..float.clone() };
f.set_spin(spin);
(f.rel_w, f.rel_h) = (part(group_share.0, mw, true), part(group_share.1, mh, false));
}
c
})
+174
View File
@@ -2485,6 +2485,73 @@ fn a_share_of_the_page_stays_with_its_object() {
assert!((x0 - shown[0]).abs() < 0.5 && (x1 - (shown[0] + shown[2])).abs() < 0.5, "{rects:?} in {shown:?}");
}
/// #6770 review: a group in line with text is drawn at its own size whatever share it holds, so
/// ungrouping it leaves its members the sizes it showed them at, not the share's.
#[test]
fn an_inline_group_with_a_share_ungroups_at_its_own_size() {
use wordcraft_doc::para::{RelSize, SizeFrom, Wrap};
let mut s = Session::new(wordcraft_doc::Document::new());
s.run("document.setText", &json!({"text": "one\ntwo"})).unwrap();
s.sel = Selection::caret(s.doc.start_of(StoryRef::Body));
s.run("insert.shape", &json!({"kind": "rectangle", "width": 100, "height": 50})).unwrap();
s.run("arrange.bounds", &json!({"page": 0, "x": 100, "y": 150})).unwrap();
s.run("select.collapse", &json!({"end": true})).unwrap();
s.run("insert.shape", &json!({"kind": "ellipse", "width": 60, "height": 40})).unwrap();
s.run("arrange.bounds", &json!({"page": 0, "x": 300, "y": 200})).unwrap();
s.run("select.addObject", &json!({"index": 0})).unwrap();
s.run("arrange.group", &json!({})).unwrap();
super::select::with_obj(&mut s, |o| {
if let Some(f) = o.float_mut() {
f.wrap = Wrap::Inline;
f.rel_w = Some(RelSize { from: SizeFrom::Page, pct: 50_000 });
}
})
.unwrap();
s.touch();
s.run("arrange.ungroup", &json!({})).unwrap();
let sizes: Vec<(f32, f32)> = all_objects(&s).iter().filter_map(|(_, o)| o.frame().map(|(w, h, _)| (w, h))).collect();
let has = |w: f32, h: f32| sizes.iter().any(|&(x, y)| (x - w).abs() < 0.5 && (y - h).abs() < 0.5);
assert!(sizes.len() == 2 && has(100.0, 50.0) && has(60.0, 40.0), "{sizes:?}");
}
/// #9830 review: ungrouping a group its share of the page draws past 4000 pt leaves a member that
/// tall its size, as its share of what the group's share is of; the 4000 pt an object's own size
/// stops at would shrink it. A share past the longest a share draws (4000 % here, as JSON import
/// accepts) leaves the group drawn at that longest, and its members at their part of it.
#[test]
fn an_ungrouped_member_past_4000_pt_keeps_its_size() {
use wordcraft_doc::para::{RelSize, SizeFrom};
for pct in [1_000_000, 4_000_000] {
let mut s = Session::new(wordcraft_doc::Document::new());
s.run("document.setText", &json!({"text": "one\ntwo"})).unwrap();
let page_h = s.doc.last_section.page_h;
s.sel = Selection::caret(s.doc.start_of(StoryRef::Body));
s.run("insert.shape", &json!({"kind": "rectangle", "width": 100, "height": 50})).unwrap();
s.run("arrange.bounds", &json!({"page": 0, "x": 100, "y": 150})).unwrap();
s.run("select.collapse", &json!({"end": true})).unwrap();
s.run("insert.shape", &json!({"kind": "ellipse", "width": 60, "height": 40})).unwrap();
s.run("arrange.bounds", &json!({"page": 0, "x": 300, "y": 200})).unwrap();
s.run("select.addObject", &json!({"index": 0})).unwrap();
s.run("arrange.group", &json!({})).unwrap();
super::select::with_obj(&mut s, |o| {
if let Some(f) = o.float_mut() {
f.rel_h = Some(RelSize { from: SizeFrom::Page, pct });
}
})
.unwrap();
s.touch();
let (gpos, _) = selected(&s).unwrap();
let group_h = rect_of(&mut s, &gpos)[3];
let drawn = (page_h * pct as f32 / 100_000.0).min(wordcraft_doc::para::MAX_SHARE_LEN);
assert!((group_h - drawn).abs() < 0.5, "{pct}: {group_h}");
s.run("arrange.ungroup", &json!({})).unwrap();
let mut heights: Vec<f32> = all_objects(&s).iter().map(|(p, _)| rect_of(&mut s, p)[3]).collect();
heights.sort_by(f32::total_cmp);
// The group was 90 pt tall: the rectangle 50 of them, the ellipse 40.
let want = [group_h * 40.0 / 90.0, group_h * 50.0 / 90.0];
assert!(heights.len() == 2 && heights.iter().zip(want).all(|(h, w)| (h - w).abs() < 1.0), "{pct}: {heights:?}, not {want:?}");
}
}
/// #9802: `picture.size` / `shape.size` work from the drawn size when a share applies, and clear
/// the share of any side they set even when the new value equals the object's hidden own size.
#[test]
@@ -2536,3 +2603,110 @@ fn size_command_uses_drawn_size_and_clears_share_even_at_own_size() {
assert!((resized[2] - 100.0).abs() < 0.5, "{resized:?}");
assert!((resized[3] - page_h / 2.0).abs() < 0.5, "{resized:?}");
}
/// #9830 review: in Web view a share is of the page as wide as the window, so ungrouping a
/// share-sized group there works its members' shares out from that page: they keep their sizes.
#[test]
fn an_ungrouped_member_in_web_view_keeps_its_size() {
use wordcraft_doc::para::{RelSize, SizeFrom};
let mut s = Session::new(wordcraft_doc::Document::new());
s.run("document.setText", &json!({"text": "one\ntwo"})).unwrap();
s.sel = Selection::caret(s.doc.start_of(StoryRef::Body));
s.run("insert.shape", &json!({"kind": "rectangle", "width": 100, "height": 50})).unwrap();
s.run("arrange.bounds", &json!({"page": 0, "x": 100, "y": 150})).unwrap();
s.run("select.collapse", &json!({"end": true})).unwrap();
s.run("insert.shape", &json!({"kind": "ellipse", "width": 60, "height": 40})).unwrap();
s.run("arrange.bounds", &json!({"page": 0, "x": 300, "y": 200})).unwrap();
s.run("select.addObject", &json!({"index": 0})).unwrap();
s.run("arrange.group", &json!({})).unwrap();
s.view.mode = wordcraft_layout::ViewMode::Web;
s.view.web_width = 1000.0;
super::select::with_obj(&mut s, |o| {
if let Some(f) = o.float_mut() {
f.rel_w = Some(RelSize { from: SizeFrom::Page, pct: 2_000_000 });
}
})
.unwrap();
s.touch();
let (gpos, _) = selected(&s).unwrap();
let group_w = rect_of(&mut s, &gpos)[2];
assert!((group_w - wordcraft_doc::para::MAX_SHARE_LEN).abs() < 0.5, "{group_w}");
s.run("arrange.ungroup", &json!({})).unwrap();
let mut widths: Vec<f32> = all_objects(&s).iter().map(|(p, _)| rect_of(&mut s, p)[2]).collect();
widths.sort_by(f32::total_cmp);
// The group was 260 pt wide: the rectangle 100 of them, the ellipse 60.
let want = [group_w * 60.0 / 260.0, group_w * 100.0 / 260.0];
assert!(widths.len() == 2 && widths.iter().zip(want).all(|(w, x)| (w - x).abs() < 1.0), "{widths:?}, not {want:?}");
}
/// A session whose body is "one" then "two", the second paragraph in its own section (a
/// continuous one with a wider left margin when `continuous`), with a rectangle and an ellipse
/// in it grouped and selected on the page that section starts on: 260 pt wide, 90 pt tall.
fn grouped_in_second_section(continuous: bool) -> Session {
use wordcraft_doc::section::{SectionProps, SectionStart};
let mut d = wordcraft_doc::Document::from_text("one\ntwo");
let first = SectionProps { margin_left: 72.0, margin_right: 72.0, ..d.last_section.clone() };
d.para_mut(StoryRef::Body, &wordcraft_doc::Path::top(0)).unwrap().section = Some(Box::new(first));
if continuous {
d.last_section.start = SectionStart::Continuous;
(d.last_section.margin_left, d.last_section.margin_right) = (172.0, 72.0);
}
let mut s = Session::new(d);
s.sel = Selection::caret(Pos::body(1, 0));
// On the page the section starts on: its own when it starts a new one.
let page = if continuous { 0 } else { 1 };
s.run("insert.shape", &json!({"kind": "rectangle", "width": 100, "height": 50})).unwrap();
s.run("arrange.bounds", &json!({"page": page, "x": 100, "y": 300})).unwrap();
s.run("select.collapse", &json!({"end": true})).unwrap();
s.run("insert.shape", &json!({"kind": "ellipse", "width": 60, "height": 40})).unwrap();
s.run("arrange.bounds", &json!({"page": page, "x": 300, "y": 350})).unwrap();
s.run("select.addObject", &json!({"index": 0})).unwrap();
s.run("arrange.group", &json!({})).unwrap();
s
}
/// Ungroups the selected group after giving it a width share `share`, and checks that it was
/// drawn `group_w` wide and that its members keep the widths they were drawn at.
fn ungroups_keeping_widths(s: &mut Session, share: wordcraft_doc::para::RelSize, group_w: f32) {
super::select::with_obj(s, |o| {
if let Some(f) = o.float_mut() {
f.rel_w = Some(share);
}
})
.unwrap();
s.touch();
let (gpos, _) = selected(s).unwrap();
assert_eq!(gpos.path.0.first(), Some(&1), "the group is anchored in the second section");
let drawn = rect_of(s, &gpos)[2];
assert!((drawn - group_w).abs() < 0.5, "{drawn}, not {group_w}");
s.run("arrange.ungroup", &json!({})).unwrap();
let mut widths: Vec<f32> = all_objects(s).iter().map(|(p, _)| rect_of(s, p)[2]).collect();
widths.sort_by(f32::total_cmp);
// The group was 260 pt wide: the rectangle 100 of them, the ellipse 60.
let want = [drawn * 60.0 / 260.0, drawn * 100.0 / 260.0];
assert!(widths.len() == 2 && widths.iter().zip(want).all(|(w, x)| (w - x).abs() < 1.0), "{widths:?}, not {want:?}");
}
/// #9830 review: a group in a continuous section that starts partway down a page is sized from
/// that section's margins, not the page's first section's, and so are its members' shares.
#[test]
fn an_ungrouped_member_in_a_continuous_section_keeps_its_size() {
use wordcraft_doc::para::{RelSize, SizeFrom};
let mut s = grouped_in_second_section(true);
let text_w = s.doc.last_section.text_width();
ungroups_keeping_widths(&mut s, RelSize { from: SizeFrom::Margin, pct: 3_000_000 }, (text_w * 30.0).min(wordcraft_doc::para::MAX_SHARE_LEN));
}
/// #9830 review: in Read Mode a section whose text runs down is laid out on its page turned on
/// its side, not on the reflowed page, and its members' shares are worked out from that page.
#[test]
fn an_ungrouped_member_in_a_turned_section_in_read_mode_keeps_its_size() {
use wordcraft_doc::para::{RelSize, SizeFrom};
let mut s = grouped_in_second_section(false);
s.doc.last_section.text_direction = wordcraft_doc::props::TextDirection::Down;
s.touch();
s.view.read_mode = true;
s.view.read_width = 500.0;
let page_h = s.doc.last_section.page_h;
ungroups_keeping_widths(&mut s, RelSize { from: SizeFrom::Page, pct: 2_000_000 }, (page_h * 20.0).min(wordcraft_doc::para::MAX_SHARE_LEN));
}
+7 -1
View File
@@ -131,7 +131,13 @@ pub fn specs() -> Vec<CommandSpec> {
let path = p::req_str(v, "path")?;
// A .dotm keeps its name (#2852); anything else becomes a .dotx.
let path = if crate::cmd::user_templates::is_template_name(path) { path.to_string() } else { format!("{path}.dotx") };
crate::io::save_path(std::path::Path::new(&path), &s.doc).map_err(CmdError::Failed)?;
let written = std::path::Path::new(&path);
let stamp = crate::io::save_path_checked(written, &s.doc, None, &Default::default(), None).map_err(CmdError::Failed)?;
// A template over the document's own file is the file now: what AutoSave checks against
// (#9865), as for a copy saved there.
if s.path.as_deref() == Some(written) {
s.disk_stamp = Some(stamp);
}
Ok(json!({"path": path}))
})
.params(r#"{"path": string}"#)
+21
View File
@@ -111,6 +111,9 @@ pub struct FindState {
/// Matches from the last search: (start, end).
#[serde(skip)]
pub results: Vec<(Pos, Pos)>,
/// Generation counter bumped every time `results` changes.
#[serde(skip)]
pub results_gen: u64,
pub current: usize,
/// Reading Highlight: mark every match of `query` in the body.
pub highlight: bool,
@@ -119,6 +122,24 @@ pub struct FindState {
pub highlights: Option<(u64, Vec<(Pos, Pos)>)>,
}
impl FindState {
/// Replaces `results`, bumping `results_gen` only when they differ, so a repeated search that
/// finds the same matches (Find Next after a Navigation pane search) keeps the generation.
pub fn set_results(&mut self, results: Vec<(Pos, Pos)>) {
if self.results != results {
self.results = results;
self.results_gen = self.results_gen.wrapping_add(1);
}
}
pub fn clear_results(&mut self) {
if !self.results.is_empty() {
self.results.clear();
self.results_gen = self.results_gen.wrapping_add(1);
}
}
}
#[derive(Clone)]
pub(super) struct Undo {
pub(super) label: String,
+8 -2
View File
@@ -32,8 +32,9 @@ impl Session {
self.revision_layout_options().hides_deleted(story)
}
/// [`Session::layout`] with `typing` as the word being typed.
fn layout_with(&mut self, typing: Option<wordcraft_layout::TypingWord>) -> Arc<DocLayout> {
/// The view's options [`Session::layout`] lays the pages out with: the view, and the width
/// and height of the page the continuous views lay out on.
pub(crate) fn view_layout_options(&self) -> LayoutOptions {
let mode = if self.view.read_mode { ViewMode::Read } else { self.view.mode };
let width = match mode {
ViewMode::Read => self.view.read_width,
@@ -41,6 +42,11 @@ impl Session {
_ => DRAFT_WIDTH,
};
let height = if self.view.read_mode { self.view.read_height } else { 0.0 };
LayoutOptions { view: mode, web_width: width, read_height: height, ..LayoutOptions::default() }
}
/// [`Session::layout`] with `typing` as the word being typed.
fn layout_with(&mut self, typing: Option<wordcraft_layout::TypingWord>) -> Arc<DocLayout> {
let LayoutOptions { view: mode, web_width: width, read_height: height, .. } = self.view_layout_options();
let spacing = if self.view.read_mode { self.view.read_line_spacing.map(f32::to_bits) } else { None };
// Deletions in balloons depend on the view (the Comments pane, Read Mode, side by side), so
// a view change that moves them in or out of the text lays it out again.
+41
View File
@@ -16894,6 +16894,47 @@ fn an_if_unchanged_save_leaves_a_file_another_program_changed() {
let _ = std::fs::remove_dir_all(&dir);
}
/// #9865: a template saved over the document's own file is the file now, so AutoSave goes on
/// from it instead of taking WordCraft's own write for another program's.
#[test]
fn a_template_saved_over_the_own_file_keeps_autosave_going() {
use serde_json::json;
let dir = std::env::temp_dir().join(format!("wordcraft-9865-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let p = dir.join("own.dotx").to_string_lossy().to_string();
let mut s = crate::Session::new(wordcraft_doc::Document::from_text("Mine"));
s.run("file.save", &json!({"path": p})).unwrap();
s.run("text.insert", &json!({"text": "more "})).unwrap();
s.run("file.saveTemplate", &json!({"path": p})).unwrap();
s.run("text.insert", &json!({"text": "again "})).unwrap();
s.run("file.save", &json!({"ifUnchanged": true})).expect("the template is the file now");
let _ = std::fs::remove_dir_all(&dir);
}
/// #9905: saving a template to a different path leaves `disk_stamp` alone, so AutoSave still
/// refuses when another program changes the document's own file.
#[test]
fn a_template_saved_to_another_path_leaves_the_autosave_stamp_alone() {
use serde_json::json;
let dir = std::env::temp_dir().join(format!("wordcraft-9905-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let own = dir.join("own.docx");
let other = dir.join("other.dotx");
let mut s = crate::Session::new(wordcraft_doc::Document::from_text("Mine"));
s.run("file.save", &json!({"path": own.to_string_lossy()})).unwrap();
let stamp_before = s.disk_stamp;
s.run("text.insert", &json!({"text": "more "})).unwrap();
s.run("file.saveTemplate", &json!({"path": other.to_string_lossy()})).unwrap();
assert_eq!(s.disk_stamp, stamp_before, "saving a template elsewhere leaves the AutoSave stamp alone");
std::fs::write(&own, b"external").unwrap();
s.run("text.insert", &json!({"text": "again "})).unwrap();
let err = s.run("file.save", &json!({"ifUnchanged": true})).unwrap_err().to_string();
assert!(err.contains("changed or removed by another program"), "{err}");
assert_eq!(std::fs::read(&own).unwrap(), b"external");
let _ = std::fs::remove_dir_all(&dir);
}
/// #7069 review: the check a save that may write only over an unchanged file makes once its new
/// bytes are ready, just before they replace the file; the stamp it returns is the written file's.
#[test]
+25 -17
View File
@@ -61,10 +61,8 @@ pub(crate) fn floating(o: &InlineObject) -> Option<(f32, f32, &Float)> {
/// frame (table cells, text boxes, notes) positions relative to the page or margins fall back
/// to the box itself.
pub(crate) fn float_rect(frame: Option<PageFrame>, col: (f32, f32), y0: f32, w: f32, h: f32, float: &Float) -> Rect {
// Thinner than a point stays thin (a 0.25 pt rule, a flat line): Word keeps the size.
let (w, h) = (wordcraft_geom::finite(w).clamp(0.0, 4000.0), wordcraft_geom::finite(h).clamp(0.0, 4000.0));
// On a page, a share of the page or a margin sizes it instead (#6770), past 4000 pt too.
let (w, h) = frame.as_ref().map_or((w, h), |f| relative_size(f, float, w, h));
// The size it is drawn at ([`drawn_size`]), a share of the page or a margin already applied.
let (w, h) = (wordcraft_geom::finite(w).clamp(0.0, MAX_SHARE), wordcraft_geom::finite(h).clamp(0.0, MAX_SHARE));
// Each axis: the reference area's start and extent, in page coordinates. Across, as laid out
// before an even page is mirrored (less the shift it then gets).
let page_x = |f: &PageFrame| {
@@ -111,13 +109,22 @@ pub(crate) fn float_rect(frame: Option<PageFrame>, col: (f32, f32), y0: f32, w:
/// share past 100 % reaches past the page, past the 4000 pt an object's own size stops at too
/// (Word for Windows: 600 % of an A4 page's margin height is 4185 pt), up to [`MAX_SHARE`].
pub(crate) fn relative_size(f: &PageFrame, float: &Float, w: f32, h: f32) -> (f32, f32) {
let share = |len: Option<f32>| len.map(|l| wordcraft_geom::finite(l).clamp(0.0, MAX_SHARE));
let w = share(float.rel_w.and_then(|r| r.of(share_base(f, r.from, true)))).unwrap_or(w);
let h = share(float.rel_h.and_then(|r| r.of(share_base(f, r.from, false)))).unwrap_or(h);
(w, h)
}
/// What a share of `from` is a share of on the page `f`, across (`across`) or down: the page's
/// width or height, the text area's, or a margin's, as [`relative_size`] describes.
pub(crate) fn share_base(f: &PageFrame, from: wordcraft_doc::para::SizeFrom, across: bool) -> f32 {
use wordcraft_doc::para::SizeFrom;
let s = f.sect;
let even = f.even();
// The margins as they are on this page: swapped on an even page with mirror margins.
let (left, right, _) = f.sides();
let (top, bottom) = (s.margin_top.abs(), s.margin_bottom.abs());
let across = |from: SizeFrom| match from {
let wide = |from: SizeFrom| match from {
SizeFrom::Page => s.page_w,
SizeFrom::Margin => s.text_width(),
SizeFrom::LeftMargin => left,
@@ -128,7 +135,7 @@ pub(crate) fn relative_size(f: &PageFrame, float: &Float, w: f32, h: f32) -> (f3
SizeFrom::OutsideMargin => left,
SizeFrom::TopMargin | SizeFrom::BottomMargin => s.page_w,
};
let down = |from: SizeFrom| match from {
let tall = |from: SizeFrom| match from {
SizeFrom::Page => s.page_h,
SizeFrom::Margin => s.page_h - top - bottom,
SizeFrom::TopMargin => top,
@@ -137,22 +144,23 @@ pub(crate) fn relative_size(f: &PageFrame, float: &Float, w: f32, h: f32) -> (f3
SizeFrom::InsideMargin | SizeFrom::OutsideMargin => top,
SizeFrom::LeftMargin | SizeFrom::RightMargin => s.page_h,
};
let share = |len: Option<f32>| len.map(|l| wordcraft_geom::finite(l).clamp(0.0, MAX_SHARE));
let w = share(float.rel_w.and_then(|r| r.of(across(r.from)))).unwrap_or(w);
let h = share(float.rel_h.and_then(|r| r.of(down(r.from)))).unwrap_or(h);
(w, h)
if across { wide(from) } else { tall(from) }
}
/// Longest side a share of the page or a margin gives an object, points: ten times the largest
/// page Word makes (22 inches), the most a share reaches (1000 %, as Word reads it).
pub(crate) const MAX_SHARE: f32 = 15_840.0;
/// Longest side a share of the page or a margin gives an object ([`wordcraft_doc::para::MAX_SHARE_LEN`]).
pub(crate) const MAX_SHARE: f32 = wordcraft_doc::para::MAX_SHARE_LEN;
/// The size floating object `o`, `w` by `h` and placed as `float`, is drawn at on the page
/// `frame`: its share of the page or a margin ([`relative_size`]), then for a text box that
/// resizes to fit its text, as tall as its text is at that width.
/// `frame` ([`float_rect`] places it at that size): its own, up to 4000 pt, or its share of the
/// page or a margin ([`relative_size`]); then for a text box that resizes to fit its text, as tall
/// as its text is at that width, its share of a height notwithstanding (Word for Windows: five
/// lines 120.95 pt high where half the margin is 346.9 pt).
pub(crate) fn drawn_size(ctx: &mut Ctx, frame: Option<&PageFrame>, o: &InlineObject, w: f32, h: f32, float: &Float) -> (f32, f32) {
let (w, h) = frame.map_or((w, h), |f| relative_size(f, float, w, h));
(w, ctx.float_height(o, w, h))
// Thinner than a point stays thin (a 0.25 pt rule, a flat line): Word keeps the size.
let own = |v: f32| wordcraft_geom::finite(v).clamp(0.0, 4000.0);
let (w, h) = frame.map_or((own(w), own(h)), |f| relative_size(f, float, own(w), own(h)));
let fitted = ctx.float_height(o, w, h);
(w, if fitted == h { h } else { own(fitted) })
}
/// Where an object of `size` starts on one axis of `area` (start, extent): at `offset` from the
+5
View File
@@ -96,6 +96,7 @@ use notes::{NOTE_SEP, note_numbers};
use page::item_bottom;
use pass::layout_pass;
pub use pass::now_ms;
pub use pass::share_base_on;
pub use placed::{HfSlot, Placed, turn_point, turn_rect, unturn_point};
pub use strict::{MAX_PDF_PICTURE_SIDE, MAX_PNG_PICTURE_SIDE, StrictOutput, media_check, undecodable_pictures};
pub use substituted::MAX_SUBSTITUTED;
@@ -328,6 +329,10 @@ pub struct Page {
/// The top-level body tables placed on this page as floating tables (`w:tblpPr`): a click
/// outside one doesn't land in its cells ([`DocLayout::hit`]).
pub float_tables: Vec<Path>,
/// The section frames floating objects on this page were placed with, top down: its own
/// section's, then that of each continuous section starting on it, as laid out in the view
/// (reflowed in the continuous views, unturned in a turned section) ([`share_base_on`]).
pub sect_frames: Vec<(usize, Arc<SectionProps>)>,
}
/// The whole layout.
+11 -1
View File
@@ -395,7 +395,17 @@ impl PageBuilder<'_> {
self.page_items_start = decor.len();
self.block_marks.clear();
self.page_valign = s.valign;
self.pages.push(Page { w, h, section: self.sect_idx, number: self.number, body, first_block, items: decor, ..Default::default() });
self.pages.push(Page {
w,
h,
section: self.sect_idx,
number: self.number,
body,
first_block,
items: decor,
sect_frames: vec![(self.sect_idx, std::sync::Arc::new(s.clone()))],
..Default::default()
});
self.behind.push(0);
self.front.push(Vec::new());
self.col = 0;
+26
View File
@@ -188,6 +188,27 @@ fn reflow_sect(first: &SectionProps, opts: &LayoutOptions) -> SectionProps {
s
}
/// What a share of `from` is a share of, across or down, for a floating object drawn on `page` and
/// anchored in section `si` (`None`: a header's or footer's, laid out upright on the page with its section's own frame), in a layout
/// made with `opts`: as layout sized it, on the page frame it placed that section's objects with
/// there ([`Page::sect_frames`]: as wide as the window in the continuous views, on its side in a
/// turned section). Ungrouping a share-sized group works its members' shares out from it (#9830).
pub fn share_base_on(doc: &Document, page: &Page, si: Option<usize>, opts: &LayoutOptions, from: wordcraft_doc::para::SizeFrom, across: bool) -> f32 {
let sections = doc.sections();
let sect: &SectionProps = match si {
// Headers and footers are laid out upright on the page, with its section's own frame.
None => match sections.get(page.section) {
Some((_, s)) => s,
None => return 0.0,
},
Some(si) => match page.sect_frames.iter().rev().find(|(s, _)| *s <= si).or_else(|| page.sect_frames.first()) {
Some((_, s)) => s,
None => return 0.0,
},
};
let mirror = doc.settings.mirror_margins && !Mode::of(opts.view).reflow;
crate::floats::share_base(&crate::page::PageFrame { sect, margin_area: None, origin: (0.0, 0.0), number: page.number, mirror }, from, across)
}
fn new_page_builder<'p>(
sect: &'p SectionProps,
page_format: wordcraft_doc::section::NumFormat,
@@ -367,6 +388,11 @@ fn start_section_page<'p>(ctx: &mut Ctx, pb: &mut PageBuilder<'p>, hf: &HfLinks<
/// Continuous: new column layout below the current text (its tallest column).
fn continue_page(pb: &mut PageBuilder, sect: &SectionProps, block: usize) {
// Its objects are placed with its own section frame from here down.
let frame = (pb.sect_idx, Arc::new(sect.clone()));
if let Some(page) = pb.pages.last_mut() {
page.sect_frames.push(frame);
}
pb.close_column_lines();
pb.cols = sect.column_boxes();
pb.col = 0;
+29
View File
@@ -7740,6 +7740,21 @@ fn a_tight_outline_is_worked_out_at_the_size_the_object_is_drawn() {
assert_eq!(drawn, outline(&shape(300.0, 100.0), (300.0, 100.0)), "the outline of the shape at the size it is drawn");
assert_ne!(drawn, outline(&shape(50.0, 100.0), (50.0, 100.0)), "not at its own size");
}
/// #6770 review: a group's members fill it however far its share of the page sizes it, past the
/// 4000 pt an object's own size stops at.
#[test]
fn a_groups_members_fill_it_past_4000_pt() {
use wordcraft_doc::para::{GroupChild, RelSize, SizeFrom};
let mut d = Document::from_text("One");
let float = wordcraft_doc::para::Float { rel_h: Some(RelSize { from: SizeFrom::Page, pct: 600_000 }), ..page_float(0.0, 0.0) };
let member = GroupChild { x: 0.0, y: 0.0, obj: rect_shape(100.0, 100.0, Default::default()) };
let g = InlineObject::Group { w: 100.0, h: 100.0, float, ch_w: 100.0, ch_h: 100.0, children: vec![member], canvas: None };
d.insert_object(&Pos::body(0, 3), g, &Default::default()).unwrap();
let want = d.last_section.page_h * 6.0;
let r = shapes(&lay(&d).pages[0].items)[0];
assert!((r.h - want).abs() < 0.5, "{r:?}, not {want} high");
}
#[test]
fn text_boxes_show_in_headers_footers_cells_and_notes() {
crate::test_fonts();
@@ -21677,6 +21692,20 @@ fn top_and_bottom_float_in_cell_keeps_cache_hits_on_shift() {
assert_eq!(c.misses, misses + 1, "only the edited cell paragraph should miss the cache");
}
/// #9830 review: a share in a header or footer is of the page as headers and footers are laid out
/// on it, upright, even on a page whose body text runs down; the body's is of the page on its side.
#[test]
fn a_header_share_is_of_the_upright_page_in_a_turned_section() {
let mut d = Document::from_text("Body");
d.last_section.text_direction = wordcraft_doc::props::TextDirection::Down;
let (w, h) = (d.last_section.page_w, d.last_section.page_h);
let l = lay(&d);
let opts = LayoutOptions::default();
let base = |si| crate::share_base_on(&d, &l.pages[0], si, &opts, wordcraft_doc::para::SizeFrom::Page, true);
assert_eq!(base(None), w, "a header's share across is of the page's width");
assert_eq!(base(Some(0)), h, "the body's, laid out on the page on its side, is of its height");
}
/// #8530: a body paragraph framed against the page draws its pictures and shapes at the frame, in
/// line with its text and floating (a letterhead's logo in a frame, say). They were left out.
#[test]
+18
View File
@@ -535,3 +535,21 @@ fn a_linked_box_on_an_even_page_splits_the_text_at_its_size_there() {
assert!(drawn > 0);
assert_eq!(drawn, own, "the first box takes the text that fits it on page 2");
}
/// #6770 review: a text box that fits its text keeps the height of its text whatever share of a
/// height it holds (Word for Windows: five lines 120.95 pt high where half the margin is 346.9 pt).
#[test]
fn a_fitted_box_keeps_its_text_height_over_a_share_of_a_height() {
use wordcraft_doc::para::{Float, RelSize, SizeFrom};
crate::test_fonts();
let text = "Words that run on well past a narrow box. ".repeat(3);
let fitted = |rel: bool| {
let mut d = Document::from_text("one");
let rel_h = rel.then_some(RelSize { from: SizeFrom::Margin, pct: 50_000 });
let body = TextBody { auto_fit: true, ..Default::default() };
let id = text_box_with(&mut d, 0, &text, 144.0, 20.0, body, Float { rel_h, ..super::page_float(72.0, 72.0) });
frame_of(&lay(&d), id).h
};
let (shared, own) = (fitted(true), fitted(false));
assert!((shared - own).abs() < 0.01 && own < 200.0, "{shared}, not {own}");
}
+2 -2
View File
@@ -17,7 +17,7 @@ craft = { workspace = true, features = [
"text-find", "web-api", "web-host", "window",
] }
craft-html = { workspace = true }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920" }
wordcraft-geom = { workspace = true, features = ["image"] }
wordcraft-doc = { workspace = true }
wordcraft-fonts = { workspace = true }
@@ -77,7 +77,7 @@ craft-ui-test-kit = { workspace = true }
craft = { workspace = true, features = ["ui-testing"] }
[build-dependencies]
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", features = ["subset"] }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "0a15c60d5aee340c9430ced36af7c23fba9d1920", features = ["subset"] }
serde_json = { workspace = true }
toml = "1"
+2
View File
@@ -63,6 +63,7 @@ impl WordApp {
ribbon_dropped,
nav_search_focus,
nav_query,
nav_results_gen,
escape_free,
status_counts,
missing_fonts,
@@ -162,6 +163,7 @@ impl WordApp {
ribbon_dropped,
nav_search_focus,
nav_query,
nav_results_gen,
escape_free,
status_counts,
missing_fonts,
+10 -2
View File
@@ -108,12 +108,20 @@ impl WordApp {
// tabs and collapsed every one of them.
.top(Slot::new("ribbonDrop").drops().size(SlotSize::Content), WordApp::ribbon_slot_version, |ui, _cx, app: &mut WordApp| {
if !stale(app) {
*ribbon_out.borrow_mut() = Some(ribbon::show(app, ui));
let shown = ribbon::show(app, ui);
// A measuring run lays out no tabs; when the real run then replays, keep the last real output.
if !ui.is_sizing_pass() {
*ribbon_out.borrow_mut() = Some(shown);
}
}
})
.top(Slot::new("ribbon").size(SlotSize::Content), WordApp::ribbon_slot_version, |ui, _cx, app: &mut WordApp| {
if !stale(app) {
*ribbon_out.borrow_mut() = Some(ribbon::show(app, ui));
let shown = ribbon::show(app, ui);
// A measuring run lays out no tabs; when the real run then replays, keep the last real output.
if !ui.is_sizing_pass() {
*ribbon_out.borrow_mut() = Some(shown);
}
}
})
// As tall as the bar: a failure's line under the message puts Install below the first line, and a slot of
+3 -1
View File
@@ -1065,7 +1065,9 @@ fn show_pages(app: &mut WordApp, ui: &mut Ui, layout: &Arc<DocLayout>, full: Rec
// The same places two passes running: the view is at rest, and these are the places pictures are made for.
let placed = |pages: &[PlacedPage]| pages.iter().map(|p| (p.page, p.rect)).collect::<Vec<_>>();
let now = placed(&out.pages);
if now == placed(&app.canvas.shown.pages) && now != app.canvas.settled_pages {
// A pass that placed no page (a key's edit pass) is not a rest: clearing the places would make the pictures
// that pass asks for the unsized ones, and the next pass's sized ones render all over again.
if !now.is_empty() && now == placed(&app.canvas.shown.pages) && now != app.canvas.settled_pages {
app.canvas.settled_pages = now;
// The pictures of the places just settled are made on the next pass.
ui.ctx().request_repaint();
+12 -3
View File
@@ -3222,28 +3222,37 @@ fn non_animating_caret_does_not_request_fade_frames_on_blink() {
let blink = Duration::from_millis(530);
let fade_frame = Duration::from_millis(16);
let next_frame = |h: &H| h.output().viewport_output.get(&egui::ViewportId::ROOT).map_or(Duration::MAX, |viewport| viewport.repaint_delay);
let settle = |h: &mut H| {
for _ in 0..8 {
h.app_frame();
if next_frame(h) > Duration::ZERO {
break;
}
}
};
let delay_during_blink_fade = |h: &mut H| {
h.state_mut().canvas.glide.restart(craft::platform::clock::monotonic_ms() - 535.0);
h.app_frame();
next_frame(h)
};
settle(&mut h);
let delay = delay_during_blink_fade(&mut h);
assert!(delay <= fade_frame, "with animations on, a blink fade asks for 16 ms frames: {delay:?}");
h.state_mut().set_software_drawing(true);
h.app_frame();
settle(&mut h);
let delay = delay_during_blink_fade(&mut h);
assert!(delay > fade_frame && delay <= blink, "software drawing under System skips 16 ms fade frames and waits for the 530 ms blink: {delay:?}");
h.state_mut().ui.animations = crate::theme::Animations::On;
h.app_frame();
settle(&mut h);
let delay = delay_during_blink_fade(&mut h);
assert!(delay <= fade_frame, "explicit Animations::On still fades in software: {delay:?}");
h.state_mut().set_software_drawing(false);
h.state_mut().ui.caret_animation = false;
h.app_frame();
settle(&mut h);
let delay = delay_during_blink_fade(&mut h);
assert!(delay > fade_frame && delay <= blink, "caret_animation off skips 16 ms fade frames and waits for the 530 ms blink: {delay:?}");
}
+4 -2
View File
@@ -543,8 +543,10 @@ fn the_balloon_check_reads_painted_text_not_its_name() {
});
h.app_frame();
let card = card(&h);
assert!(h.query_all_by_label_contains("Original").any(|n| card.contains_rect(n.rect())), "the card's name still holds the comment's text");
assert!(!paints_inside(&h, card, "Original"), "though the card paints none of it: the balloon check reads paint, so it fails");
// The card still has its name (since craft-libs#3504 with bounds of no area on the column's edge), so a search
// of the window's names would still find the comment's text.
assert!(h.query_all_by_label_contains("WordCraft User: Original").next().is_some(), "the scrolled-out card keeps its name");
assert!(!paints_inside(&h, card, "Original"), "and paints none of the comment's text: the balloon check reads paint, so it fails");
}
/// #3268: clicking a balloon's Reply button, typing a reply and clicking away posts it as a
@@ -48,25 +48,39 @@ pub struct SizeForm {
/// The user's length unit, which only the app knows; read with the form.
#[serde(skip)]
lengths: Option<LengthUnits>,
/// Sides changed in this dialog, so OK sends only edited sides and leaves unchanged shares alone (#9845).
#[serde(skip)]
dirty_w: bool,
#[serde(skip)]
dirty_h: bool,
}
/// An object's picture, crop and size, bit for bit: what [`SizeForm::follow`] compares.
/// An object's picture, crop and shown size, bit for bit: what [`SizeForm::follow`] compares.
type Seen = (String, [u32; 4], [u32; 2]);
fn seen(o: &wordcraft_doc::para::InlineObject) -> Seen {
let (w, h) = o.frame().map_or((0.0, 0.0), |(w, h, _)| (w, h));
fn seen(o: &wordcraft_doc::para::InlineObject, (w, h): (f32, f32)) -> Seen {
match o {
wordcraft_doc::para::InlineObject::Image { media, crop, .. } => (media.clone(), crop.map(f32::to_bits), [w.to_bits(), h.to_bits()]),
_ => (String::new(), [0; 4], [w.to_bits(), h.to_bits()]),
}
}
/// The object's shown size: its drawn layout rect when a relative page/margin share applies, else its own frame size.
fn shown_size(app: &mut WordApp, at: &wordcraft_doc::Pos, o: &wordcraft_doc::para::InlineObject) -> Option<(f32, f32)> {
let (w, h, float) = o.frame()?;
if float.rel_w.is_some() || float.rel_h.is_some() {
Some(app.session.layout().object(at, app.session.page_hint).map_or((w, h), |r| (r.rect.w, r.rect.h)))
} else {
Some((w, h))
}
}
impl SizeForm {
/// The selected picture's or shape's size; None when nothing that has one is selected.
pub fn read(app: &WordApp) -> Option<SizeForm> {
pub fn read(app: &mut WordApp) -> Option<SizeForm> {
use wordcraft_doc::para::InlineObject;
let (at, o) = wordcraft_engine::cmd::objects::selected(&app.session)?;
let (w, h, _) = o.frame()?;
let (w, h) = shown_size(app, &at, &o)?;
let full = match &o {
InlineObject::Image { media, .. } => wordcraft_engine::cmd::objects::original_size(&app.session, media),
_ => None,
@@ -82,8 +96,10 @@ impl SizeForm {
original,
uncropped: full.map(|f| (f.w, f.h)),
pixels: full.and_then(|f| f.pixels),
seen: seen(&o),
seen: seen(&o, (w, h)),
lengths: Some(crate::options::lengths(app.session.units())),
dirty_w: false,
dirty_h: false,
})
}
@@ -91,10 +107,12 @@ impl SizeForm {
/// and the ribbon or the handles may crop, change or resize this one. The form then starts over
/// on what is selected, or there is nothing to size (false: close the dialog). OK and Reset
/// never work from numbers read from another object or an older state of this one.
pub fn follow(&mut self, app: &WordApp) -> bool {
pub fn follow(&mut self, app: &mut WordApp) -> bool {
match wordcraft_engine::cmd::objects::selected(&app.session) {
Some((at, o)) if at == self.at && seen(&o) == self.seen => true,
Some(_) => SizeForm::read(app).map(|f| *self = f).is_some(),
Some((at, o)) => match shown_size(app, &at, &o) {
Some(drawn) if at == self.at && seen(&o, drawn) == self.seen => true,
_ => SizeForm::read(app).map(|f| *self = f).is_some(),
},
None => false,
}
}
@@ -118,8 +136,11 @@ impl SizeForm {
pub fn set_width(&mut self, w: f32) {
if self.lock && self.width > 0.0 {
(self.width, self.height) = fit_size(w, self.height * w / self.width, true);
self.dirty_w = true;
self.dirty_h = true;
} else {
self.width = fit_size(w, self.height, false).0;
self.dirty_w = true;
}
}
@@ -127,8 +148,11 @@ impl SizeForm {
pub fn set_height(&mut self, h: f32) {
if self.lock && self.height > 0.0 {
(self.width, self.height) = fit_size(self.width * h / self.height, h, true);
self.dirty_w = true;
self.dirty_h = true;
} else {
self.height = fit_size(self.width, h, false).1;
self.dirty_h = true;
}
}
@@ -147,12 +171,22 @@ impl SizeForm {
pub fn reset(&mut self) {
if let Some((w, h)) = self.original {
(self.width, self.height) = fit_size(w, h, true);
self.dirty_w = true;
self.dirty_h = true;
}
}
/// `picture.size` parameters: both sides, as set here.
/// `picture.size` parameters: only the sides changed here.
pub fn params(&self) -> Value {
json!({"width": self.width, "height": self.height, "lockAspect": false})
let mut map = serde_json::Map::new();
if self.dirty_w {
map.insert("width".into(), json!(self.width));
}
if self.dirty_h {
map.insert("height".into(), json!(self.height));
}
map.insert("lockAspect".into(), json!(false));
Value::Object(map)
}
}
@@ -208,13 +242,16 @@ impl WordForm for SizeForm {
}
fn commands(&self) -> Vec<(String, Value)> {
if !self.dirty_w && !self.dirty_h {
return Vec::new();
}
vec![("picture.size".to_string(), self.params())]
}
}
/// Runs `follow` on the form of the open dialog `id`, writing it back only when it changed, so what the user is
/// typing survives a pass that follows nothing. False when the dialog has no form or `follow` says to close.
fn follow_form<F: WordForm>(app: &mut WordApp, id: DialogId, follow: impl FnOnce(&mut F, &WordApp) -> bool) -> bool {
fn follow_form<F: WordForm>(app: &mut WordApp, id: DialogId, follow: impl FnOnce(&mut F, &mut WordApp) -> bool) -> bool {
let Some(mut form) = app.dialog_host.get_by_id::<FormHost<F>>(id).map(|h| h.form().clone()) else {
return false;
};
@@ -682,18 +682,78 @@ fn size_dialog_follows_the_selection() {
a.run("picture.size", json!({})).unwrap();
let mut f: SizeForm = form(&mut a);
f.set_width(300.0);
assert!(f.follow(&a) && f.width == 300.0, "the same picture keeps the edits");
assert!(f.follow(&mut a) && f.width == 300.0, "the same picture keeps the edits");
// Cropped from the ribbon meanwhile: read again, Reset is what the new crop leaves.
a.run("picture.crop", json!({"left": 0.25, "right": 0.25})).unwrap();
assert!(f.follow(&a));
assert!(f.follow(&mut a));
assert_eq!((f.width, f.original), (30.0, Some((15.0, 15.0))));
a.run("select.collapse", json!({"end": true})).unwrap();
a.run("insert.picture", json!({"data": png_data(20, 40)})).unwrap();
assert!(f.follow(&a), "another picture selected");
assert!(f.follow(&mut a), "another picture selected");
assert_eq!((f.width, f.height, f.original), (15.0, 30.0, Some((15.0, 30.0))));
a.run("select.collapse", json!({"end": true})).unwrap();
a.run("text.insert", json!({"text": " caption"})).unwrap();
assert!(!f.follow(&a), "nothing to size");
assert!(!f.follow(&mut a), "nothing to size");
}
/// #9845: opening Size on a share-sized object shows its drawn size and pressing OK untouched
/// keeps both relative shares; editing one unlocked side clears only that side's share.
#[test]
fn size_dialog_unchanged_ok_keeps_relative_shares_and_uses_drawn_size() {
use crate::dialogs::host::WordForm as _;
use egui_kittest::kittest::Queryable;
use wordcraft_doc::para::{RelSize, SizeFrom};
let mut a = app();
a.run("insert.shape", json!({"kind": "rectangle", "width": 100.0, "height": 50.0})).unwrap();
a.run("arrange.bounds", json!({"page": 0, "x": 72.0, "y": 72.0})).unwrap();
let half_w = Some(RelSize { from: SizeFrom::Page, pct: 50_000 });
let full_h = Some(RelSize { from: SizeFrom::Page, pct: 100_000 });
let (pos, _) = wordcraft_engine::cmd::objects::selected(&a.session).unwrap();
let para = a.session.doc.para_mut(pos.story, &pos.path).unwrap();
if let Some(f) = para.objects.first_mut().and_then(|o| o.float_mut()) {
f.rel_w = half_w;
f.rel_h = full_h;
}
para.touch();
a.session.touch();
let (page_w, page_h) = (a.session.doc.last_section.page_w, a.session.doc.last_section.page_h);
a.run("picture.size", json!({})).unwrap();
let mut f: SizeForm = form(&mut a);
assert!((f.width - page_w * 0.5).abs() < 0.5, "dialog shows drawn width, not hidden 100: {}", f.width);
assert!((f.height - page_h).abs() < 0.5, "dialog shows drawn height, not hidden 50: {}", f.height);
assert!(f.commands().is_empty(), "unchanged OK must not send picture.size");
// Verify end-to-end clicking OK on the untouched dialog leaves shares and drawn size alone.
let mut h = crate::test_harness::builder().with_size(egui::vec2(1440.0, 900.0)).build_ui_state(
|ui, app: &mut WordApp| {
let ctx = ui.ctx().clone();
app.logic(&ctx);
app.ui(ui);
},
a,
);
crate::test_harness::frames(&mut h, 4);
h.get_by_role_and_label(egui::accesskit::Role::Button, "OK").click();
crate::test_harness::frames(&mut h, 3);
assert!(h.state().dialog_host.open_dialogs().is_empty(), "OK closes the dialog");
let (_, obj) = wordcraft_engine::cmd::objects::selected(&h.state().session).unwrap();
let (_, _, fl) = obj.frame().unwrap();
assert_eq!((fl.rel_w, fl.rel_h), (half_w, full_h), "untouched OK must preserve both shares");
// Editing only width (unlocked) sends only width, clearing rel_w while preserving rel_h.
f.set_width(200.0);
let cmds = f.commands();
assert_eq!(cmds.len(), 1);
assert_eq!(cmds[0].0, "picture.size");
assert_eq!(cmds[0].1.get("width").and_then(Value::as_f64), Some(200.0));
assert!(cmds[0].1.get("height").is_none(), "unchanged height must not be sent: {:?}", cmds[0].1);
h.state_mut().run(&cmds[0].0, cmds[0].1.clone()).unwrap();
let (_, obj) = wordcraft_engine::cmd::objects::selected(&h.state().session).unwrap();
let (w, _, fl) = obj.frame().unwrap();
assert!((w - 200.0).abs() < 0.5, "width updated: {w}");
assert_eq!((fl.rel_w, fl.rel_h), (None, full_h), "only edited side's share is cleared");
}
/// Types `text` over the Size section's Height (the Scale section has one too, after it) as a user does: a click
+7 -1
View File
@@ -16,7 +16,13 @@ pub(crate) fn find_in_navigation_pane(app: &mut WordApp, ctx: &egui::Context, te
ctx.data_mut(|d| d.insert_temp(qid, text.to_string()));
app.ui.nav_tab = "results".into();
let _ = app.run("view.navigationPane", json!({"value": true}));
let _ = app.run("edit.find", json!({"text": text}));
if !text.is_empty() {
let _ = app.run("edit.find", json!({"text": text}));
app.nav_results_gen = Some(app.session.find.results_gen);
} else {
app.session.find.clear_results();
app.nav_results_gen = None;
}
}
/// Go To's page box as `edit.goto` params: empty steps one page on, `+n` / `-n` move from the
+1
View File
@@ -781,6 +781,7 @@ fn frame_at(ctx: &egui::Context, app: &mut WordApp, width: f32) -> Vec<(String,
egui::Shape::Text(t) if egui_debug_text(t.galley.text()) => {}
egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.pos.x)),
egui::Shape::Vec(v) => v.iter().for_each(|s| collect(s, out)),
egui::Shape::PaintChunk(chunk) => chunk.iter().for_each(|c| collect(&c.shape, out)),
_ => {}
}
}
+2
View File
@@ -471,6 +471,8 @@ pub struct WordApp {
pub(crate) nav_search_focus: bool,
/// The query currently shown in the Navigation pane's search box (#9408).
pub(crate) nav_query: String,
/// The `FindState::results_gen` produced by the Navigation pane's last search (#9698).
pub(crate) nav_results_gen: Option<u64>,
/// The display scale (native pixels per point) seen in the last frame, 1.0 before the first;
/// `ui.interfaceSize` reports the size Auto draws at with it.
native_scale: f32,
+21 -4
View File
@@ -1015,6 +1015,16 @@ fn a_shape_dragged_onto_the_next_page_is_dropped_there() {
/// A settled canvas for the rotation regressions, without taking focus on the desktop.
fn rotation_window(app: WordApp) -> crate::table_resize::tests::H {
rotation_window_with_jobs(app).0
}
/// [`rotation_window`] with the queue of the host's jobs. The page pictures render on those jobs only when the test runs
/// the queue (`ManualJobs`), on the test thread, so when a picture uploads never depends on the runner's load. Setup
/// runs the queue after each frame and takes a last frame to upload what it rendered.
fn rotation_window_with_jobs(app: WordApp) -> (crate::table_resize::tests::H, std::sync::Arc<craft::host::ManualJobs>) {
let jobs = std::sync::Arc::new(craft::host::ManualJobs::new());
let host = craft::host::Host::builder(crate::APP).i18n(crate::i18n::catalogs()).lang(craft::i18n::Lang::EN).jobs(jobs.clone()).build();
let app = app.with_host(std::sync::Arc::new(host));
let mut h = crate::test_harness::builder().with_size(egui::vec2(1440.0, 900.0)).with_step_dt(0.25).build_ui_state(
|ui, app: &mut WordApp| {
let ctx = ui.ctx().clone();
@@ -1023,8 +1033,12 @@ fn rotation_window(app: WordApp) -> crate::table_resize::tests::H {
},
app,
);
crate::table_resize::tests::steps(&mut h, 6);
h
for _ in 0..6 {
crate::table_resize::tests::steps(&mut h, 1);
jobs.run_all();
}
crate::table_resize::tests::steps(&mut h, 1);
(h, jobs)
}
/// A dragged object's snap lines include the page margins and a neighbouring object's edges:
@@ -1465,7 +1479,7 @@ fn rotation_drag_keeps_text_boxes_outline_only_until_their_text_can_rotate() {
let bx = app.session.layout().find_object(0, |o| o.text_box.is_some()).unwrap();
app.run("select.range", json!({"anchor": bx.pos(), "focus": Pos { off: bx.off + OBJ.len_utf8(), ..bx.pos() }})).unwrap();
app.run("arrange.bounds", json!({"page": 0, "x": 150, "y": 180, "width": 200, "height": 100})).unwrap();
let mut h = rotation_window(app);
let (mut h, jobs) = rotation_window_with_jobs(app);
let original = serde_json::to_value(&h.state().session.doc).unwrap();
let depth = h.state().session.undo_depth();
let bx = h.state_mut().session.layout().find_object(0, |o| o.text_box.is_some()).unwrap();
@@ -1474,8 +1488,11 @@ fn rotation_drag_keeps_text_boxes_outline_only_until_their_text_can_rotate() {
let top = crate::canvas::page_to_screen(h.state_mut(), 0, cx, bx.rect.y).unwrap();
let radius = center.distance(top) + 22.0;
let (start, end) = (center - egui::vec2(0.0, radius), center + egui::vec2(radius, 0.0));
// The frame's textured meshes at rest: a preview texture would add one.
// The frame's textured meshes at rest: a preview texture would add one. The pictures of the pages render on the
// host's jobs, so run the queue and take a frame to upload them before sampling (#9821).
let meshes = |h: &crate::table_resize::tests::H| h.output().shapes.iter().filter(|s| matches!(s.shape, egui::Shape::Mesh(_))).count();
jobs.run_all();
steps(&mut h, 1);
let at_rest = meshes(&h);
h.event(egui::Event::PointerMoved(start));
button(&h, start, true);
+5 -3
View File
@@ -73,8 +73,10 @@ fn search(app: &mut WordApp, ui: &mut Ui, ctx: &egui::Context) {
ui.data_mut(|d| d.insert_temp(qid, q.clone()));
if !q.is_empty() {
let _ = app.session.run("edit.find", &json!({"text": q}));
app.nav_results_gen = Some(app.session.find.results_gen);
} else {
app.session.find.results.clear();
app.session.find.clear_results();
app.nav_results_gen = None;
}
}
}
@@ -131,9 +133,9 @@ struct Hit {
spans: Vec<Span<'static>>,
}
/// Whether `app.session.find.results` comes from the Navigation pane's current search (#9684).
/// Whether `app.session.find.results` comes from the Navigation pane's current search (#9684, #9698).
pub(crate) fn results_match(app: &WordApp) -> bool {
!app.nav_query.is_empty() && app.nav_query == app.session.find.query
!app.nav_query.is_empty() && app.nav_query == app.session.find.query && app.nav_results_gen == Some(app.session.find.results_gen)
}
fn results(app: &mut WordApp, ui: &mut Ui) {
+44 -31
View File
@@ -99,7 +99,8 @@ fn composite_page(image: &mut ColorImage, straight: &[u8], page_w: usize, x0: i6
}
}
/// Paper stays white in every theme. This neutral outline has 3:1 contrast against it.
/// Neutral outline drawn outside the page over the preview pane's background, with at least 3:1
/// contrast against the pane well.
const SHEET_EDGE: Color32 = Color32::from_gray(145);
const EDGE_WIDTH: f32 = 1.0;
/// Fit inside the plot frame with room for the stroke and its antialiasing.
@@ -334,27 +335,43 @@ mod tests {
}
let mut shapes = Vec::new();
sheet_shapes(&h.output().shapes, &mut shapes);
let (outline, clip) = shapes
let gap = 1.0 / h.ctx.pixels_per_point();
let (picture_idx, picture_bounds, picture_clip) = shapes
.iter()
.find_map(|&(shape, clip)| match shape {
egui::Shape::Rect(rect) if rect.stroke.color == SHEET_EDGE => Some((rect, clip)),
.enumerate()
.filter_map(|(i, &(shape, clip))| match shape {
egui::Shape::Mesh(mesh) if mesh.texture_id != egui::TextureId::default() => Some((i, mesh.calc_bounds(), clip)),
_ => None,
})
.expect("the actual preview emits its outline");
.max_by(|(_, a, _), (_, b, _)| a.area().total_cmp(&b.area()))
.expect("the actual preview draws the page texture");
let (outline_idx, outline, clip) = shapes[picture_idx + 1..]
.iter()
.enumerate()
.find_map(|(offset, &(shape, clip))| match shape {
egui::Shape::Rect(rect) if clip == picture_clip && rect.stroke.width > 0.0 => {
let picture = rect.rect.shrink(gap);
let visible = if fits { picture } else { picture.intersect(clip) };
let surrounds_picture = (picture_bounds.center() - visible.center()).length() < 2.0
&& (picture_bounds.size() - visible.size()).abs().max_elem() < 4.0;
surrounds_picture.then_some((picture_idx + 1 + offset, rect, clip))
}
_ => None,
})
.expect("the actual preview emits its outline around the page texture");
assert_eq!(outline.stroke_kind, StrokeKind::Outside);
assert_eq!(outline.fill, Color32::TRANSPARENT);
let contrast = contrast_against_white(outline.stroke.color);
assert!(contrast >= 3.0, "rendered sheet edge contrast {contrast:.2}:1 is below 3:1");
let picture = outline.rect.shrink(1.0 / h.ctx.pixels_per_point());
let visible = if fits { picture } else { picture.intersect(clip) };
let draws_picture = shapes.iter().any(|&(shape, _)| match shape {
egui::Shape::Mesh(mesh) if mesh.texture_id != egui::TextureId::default() => {
let bounds = mesh.calc_bounds();
(bounds.center() - visible.center()).length() < 2.0 && (bounds.size() - visible.size()).abs().max_elem() < 4.0
}
_ => false,
});
assert!(draws_picture, "the outline follows the page texture at zoom factor {factor}");
let bg = shapes[..outline_idx]
.iter()
.rev()
.find_map(|&(shape, _)| match shape {
egui::Shape::Rect(r) if r.fill != Color32::TRANSPARENT && r.rect.contains_rect(clip) => Some(r.fill),
_ => None,
})
.unwrap_or_else(|| h.ctx.style_of(h.ctx.theme()).visuals.panel_fill);
let contrast = contrast_ratio(outline.stroke.color, bg);
assert!(contrast >= 3.0, "rendered sheet edge contrast against {bg:?} ({contrast:.2}:1) is below 3:1");
let picture = outline.rect.shrink(gap);
if fits {
assert!(clip.contains_rect(outline.rect.expand(outline.stroke.width)), "all four outline sides fit");
} else {
@@ -505,20 +522,16 @@ mod tests {
}
}
#[test]
fn sheet_edge_meets_3_to_1_contrast_against_white() {
let srgb = f64::from(SHEET_EDGE.r()) / 255.0;
let lum = if srgb <= 0.04045 { srgb / 12.92 } else { ((srgb + 0.055) / 1.055).powf(2.4) };
let contrast = 1.05 / (lum + 0.05);
assert!(contrast >= 3.0, "sheet edge contrast {contrast:.2}:1 is below 3:1");
}
fn contrast_against_white(c: Color32) -> f64 {
let lin = |u: u8| {
let srgb = f64::from(u) / 255.0;
if srgb <= 0.04045 { srgb / 12.92 } else { ((srgb + 0.055) / 1.055).powf(2.4) }
fn contrast_ratio(a: Color32, b: Color32) -> f64 {
let luminance = |c: Color32| {
let lin = |u: u8| {
let srgb = f64::from(u) / 255.0;
if srgb <= 0.04045 { srgb / 12.92 } else { ((srgb + 0.055) / 1.055).powf(2.4) }
};
0.2126 * lin(c.r()) + 0.7152 * lin(c.g()) + 0.0722 * lin(c.b())
};
let lum = 0.2126 * lin(c.r()) + 0.7152 * lin(c.g()) + 0.0722 * lin(c.b());
1.05 / (lum + 0.05)
let (la, lb) = (luminance(a), luminance(b));
let (hi, lo) = if la >= lb { (la, lb) } else { (lb, la) };
(hi + 0.05) / (lo + 0.05)
}
}
+22 -17
View File
@@ -772,11 +772,7 @@ mod tests {
wheel_commits: Vec<bool>,
}
let entries = vec![
craft::ui::contract::Entry::new("14".to_owned(), "14"),
craft::ui::contract::Entry::new("15".to_owned(), "15"),
craft::ui::contract::Entry::new("16".to_owned(), "16"),
];
let entries: Vec<craft::ui::contract::Entry<String>> = Vec::new();
let mut h = crate::test_harness::builder().with_size(vec2(320.0, 120.0)).build_ui_state(
move |ui, state: &mut State| {
let key = egui::Id::unique("test.wheelRun");
@@ -806,24 +802,33 @@ mod tests {
h.step();
h.step();
// Scroll outside the box in the same pass as typing a draft, then commit with Tab (no Enter).
// Type "1" first so the draft gesture is already active, then wheel outside the box in the
// same pass as typing "7", then commit by clicking outside (no Enter).
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
h.step();
h.step();
h.event(egui::Event::PointerMoved(egui::pos2(box_rect.max.x + 80.0, box_rect.max.y + 40.0)));
h.event(egui::Event::MouseWheel {
unit: egui::MouseWheelUnit::Line,
delta: vec2(0.0, -1.0),
phase: egui::TouchPhase::Move,
modifiers: egui::Modifiers::NONE,
source: egui::MouseWheelSource::Wheel,
});
h.event(egui::Event::Text("15".into()));
h.event(egui::Event::Text("1".into()));
h.step();
h.key_press(egui::Key::Tab);
let outside = egui::pos2(box_rect.max.x + 80.0, box_rect.max.y + 40.0);
h.event(egui::Event::PointerMoved(outside));
h.step();
h.input_mut().events.extend([
egui::Event::MouseWheel {
unit: egui::MouseWheelUnit::Line,
delta: vec2(0.0, -1.0),
phase: egui::TouchPhase::Move,
modifiers: egui::Modifiers::NONE,
source: egui::MouseWheelSource::Wheel,
},
egui::Event::Text("7".into()),
]);
h.step();
h.event(egui::Event::PointerButton { pos: outside, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE });
h.step();
h.event(egui::Event::PointerButton { pos: outside, button: egui::PointerButton::Primary, pressed: false, modifiers: egui::Modifiers::NONE });
h.step();
h.step();
assert_eq!(h.state().size, "15");
assert_eq!(h.state().size, "17");
assert_eq!(h.state().wheel_commits, vec![false], "wheel outside box must not start a wheel run");
}
}
+20 -11
View File
@@ -202,23 +202,25 @@ mod tests {
use crate::WordApp;
/// Flattens nested `Shape::Vec` and replayed `Shape::PaintChunk` groups into `out`.
fn collect_shapes<'a>(shapes: &'a [egui::epaint::ClippedShape], out: &mut Vec<&'a egui::Shape>) {
for clipped in shapes {
match &clipped.shape {
egui::Shape::Vec(v) => {
for s in v {
out.push(s);
}
}
fn walk<'a>(shape: &'a egui::Shape, out: &mut Vec<&'a egui::Shape>) {
match shape {
egui::Shape::Vec(children) => children.iter().for_each(|c| walk(c, out)),
egui::Shape::PaintChunk(chunk) => chunk.iter().for_each(|c| walk(&c.shape, out)),
other => out.push(other),
}
}
for clipped in shapes {
walk(&clipped.shape, out);
}
}
fn button_icon_signature(shapes: &[&egui::Shape], rect: egui::Rect) -> Vec<(egui::TextureId, usize, Vec<[i32; 2]>)> {
fn button_icon_signature(shapes: &[&egui::Shape], rect: egui::Rect) -> Vec<(egui::TextureId, usize, Vec<[i32; 4]>)> {
// SvgIcon paints a textured mesh (distinct from text glyphs and flat background rects).
// Recording its texture id, vertex count, and bounds-relative vertices distinguishes
// every rendered icon even when buttons share the same size or arrangement.
// Recording its texture id, vertex count, bounds-relative vertices and their texture
// coordinates (icons share packed atlas pages) distinguishes every rendered icon even when
// buttons share the same size or arrangement.
let mut sig = Vec::new();
for s in shapes {
if let egui::Shape::Mesh(mesh) = s {
@@ -227,7 +229,14 @@ mod tests {
let pts = mesh
.vertices
.iter()
.map(|v| [((v.pos.x - bounds.min.x) * 10.0).round() as i32, ((v.pos.y - bounds.min.y) * 10.0).round() as i32])
.map(|v| {
[
((v.pos.x - bounds.min.x) * 10.0).round() as i32,
((v.pos.y - bounds.min.y) * 10.0).round() as i32,
(v.uv.x * 4096.0).round() as i32,
(v.uv.y * 4096.0).round() as i32,
]
})
.collect();
sig.push((mesh.texture_id, mesh.vertices.len(), pts));
}
+1
View File
@@ -174,6 +174,7 @@ mod tests {
collect_rects(s, out);
}
}
egui::Shape::PaintChunk(chunk) => chunk.iter().for_each(|c| collect_rects(&c.shape, out)),
_ => {}
}
}
+11 -10
View File
@@ -1528,16 +1528,17 @@ fn table_style_options_align_in_two_columns() {
"rows should remain Gap::Tight ({tight_gap} pt) apart, got {row_gap_1} and {row_gap_2}"
);
// A horizontal gap at least `space.gap.stack` separates the widest left-column label from the second column.
let text_rect = |label: &str| {
h.output()
.shapes
.iter()
.find_map(|s| match &s.shape {
egui::Shape::Text(t) if t.galley.text() == label => Some(egui::Rect::from_min_size(t.pos, t.galley.size())),
_ => None,
})
.unwrap_or_else(|| panic!("painted text for {label:?}"))
};
// A replayed ribbon paints through `Shape::PaintChunk`, so look inside nested groups too.
fn find_text(shape: &egui::Shape, label: &str) -> Option<egui::Rect> {
match shape {
egui::Shape::Text(t) if t.galley.text() == label => Some(egui::Rect::from_min_size(t.pos, t.galley.size())),
egui::Shape::Vec(v) => v.iter().find_map(|s| find_text(s, label)),
egui::Shape::PaintChunk(chunk) => chunk.iter().find_map(|c| find_text(&c.shape, label)),
_ => None,
}
}
let text_rect =
|label: &str| h.output().shapes.iter().find_map(|s| find_text(&s.shape, label)).unwrap_or_else(|| panic!("painted text for {label:?}"));
let left_label_max_right =
["Header Row", "Total Row", "Banded Rows"].into_iter().map(|label| text_rect(label).right()).fold(f32::NEG_INFINITY, f32::max);
let col_gap = first_col.left() - left_label_max_right;
+8 -5
View File
@@ -2092,13 +2092,16 @@ fn save_prompt_shows_why_the_save_failed() {
h.run_steps(4);
// The prompt shows it, and so does the status line the failed save wrote it to (`prompt_message` above is the prompt's own).
assert!(h.query_all_by_label(reason.as_str()).next().is_some(), "the reason is in the prompt");
// The accepting button: the platform's word for Save (the framework asks Yes, No, Cancel off macOS). macOS also
// keeps a hidden, greyed Save in the title bar, so ask for the one on screen.
let accept = if cfg!(target_os = "macos") { "Save" } else { "Yes" };
// The accepting button: Save on every platform (the framework asks Save, Don't Save, Cancel). The title bar
// also keeps a hidden, greyed Save, so ask for the one on screen.
let offered = h
.query_all_by_role_and_label(egui::accesskit::Role::Button, accept)
.query_all_by_role_and_label(egui::accesskit::Role::Button, "Save")
.any(|n| !n.accesskit_node().is_hidden() && !n.accesskit_node().is_disabled());
assert!(offered, "{accept} again is offered");
assert!(offered, "Save again is offered");
let dont_save = h
.query_all_by_role_and_label(egui::accesskit::Role::Button, "Don't Save")
.any(|n| !n.accesskit_node().is_hidden() && !n.accesskit_node().is_disabled());
assert!(dont_save, "the prompt itself is up, not just the title bar's Save");
let _ = std::fs::remove_dir_all(&dir);
}
+65
View File
@@ -581,3 +581,68 @@ fn find_next_from_dialog_does_not_paint_nav_pane_highlights_when_pane_query_diff
assert_eq!(found_count(&mut h), 0, "Find Next with a different query must not paint nav pane highlights");
assert!(h.query_by_label("0 results").is_some(), "Results tab must not list matches from a different query");
}
#[test]
fn advanced_find_with_same_text_but_different_scope_or_options_does_not_repaint_nav_pane_highlights() {
let cases = [
("in: selection", true, json!({"text": "Kilns", "in": "selection"})),
("matchCase", false, json!({"text": "Kilns", "matchCase": true})),
("wholeWord", false, json!({"text": "Kilns", "wholeWord": true})),
];
for (label, select_first, params) in cases {
let mut app =
WordApp::new(Session::new(wordcraft_doc::Document::from_text("Kilns fire clay. kilns cool. Kilnstones warm.")), Services::default());
app.session.view.nav_pane = true;
let mut h = crate::test_harness::builder().with_size(egui::vec2(800.0, 500.0)).build_eframe(|_| app);
h.run_steps(2);
let found_count = |h: &mut egui_kittest::Harness<WordApp>| {
let lay = h.state_mut().session.layout();
crate::canvas::mark_areas(h.state_mut(), &lay, &[]).iter().filter(|m| m.kind == craft::pages::ui::MarkKind::Found).count()
};
h.get_by_role_and_label(egui::accesskit::Role::TextInput, "Search document").focus();
h.step();
h.event(egui::Event::Text("Kilns".into()));
h.run_steps(2);
assert_eq!(found_count(&mut h), 3, "{label}: nav pane search highlights all three matches");
assert!(h.query_by_label("3 results").is_some(), "{label}: Results tab lists all three matches");
if select_first {
let start = wordcraft_doc::Pos::body(0, 0);
let end = wordcraft_doc::Pos::body(0, 10);
h.state_mut().run("select.range", json!({"anchor": start, "focus": end})).unwrap();
}
h.state_mut().run("edit.advancedFind", params).unwrap();
h.run_steps(2);
assert_eq!(h.state().session.find.query, "Kilns", "{label}: dialog searched the same text");
assert!(!h.state().session.find.results.is_empty(), "{label}: dialog produced its own filtered results");
assert_eq!(found_count(&mut h), 0, "{label}: dialog results must not replace nav pane highlights");
assert!(h.query_by_label("0 results").is_some(), "{label}: Results tab must not show dialog-filtered results");
}
}
#[test]
fn find_next_after_nav_pane_search_keeps_nav_pane_highlights() {
for command in ["edit.findNext", "edit.findPrevious"] {
let mut app =
WordApp::new(Session::new(wordcraft_doc::Document::from_text("Kilns fire clay. kilns cool. Kilnstones warm.")), Services::default());
app.session.view.nav_pane = true;
let mut h = crate::test_harness::builder().with_size(egui::vec2(800.0, 500.0)).build_eframe(|_| app);
h.run_steps(2);
let found_count = |h: &mut egui_kittest::Harness<WordApp>| {
let lay = h.state_mut().session.layout();
crate::canvas::mark_areas(h.state_mut(), &lay, &[]).iter().filter(|m| m.kind == craft::pages::ui::MarkKind::Found).count()
};
h.get_by_role_and_label(egui::accesskit::Role::TextInput, "Search document").focus();
h.step();
h.event(egui::Event::Text("Kilns".into()));
h.run_steps(2);
assert_eq!(found_count(&mut h), 3, "{command}: nav pane search highlights all three matches");
h.state_mut().run(command, json!({})).unwrap();
h.run_steps(2);
assert_eq!(found_count(&mut h), 3, "{command}: stepping through the pane's hits keeps the highlights");
assert!(h.query_by_label("3 results").is_some(), "{command}: Results tab still lists the matches");
}
}
+4
View File
@@ -30,6 +30,7 @@ pub(crate) struct WindowUi {
pub(crate) ribbon_dropped: bool,
pub(crate) nav_search_focus: bool,
pub(crate) nav_query: String,
pub(crate) nav_results_gen: Option<u64>,
pub(crate) escape_free: bool,
pub(crate) status_counts: (u64, crate::StatusCounts),
/// Per window, as each window shows its own layout: one shared list would be read again
@@ -85,6 +86,7 @@ impl WindowUi {
ribbon_dropped: false,
nav_search_focus: false,
nav_query: String::new(),
nav_results_gen: None,
escape_free: false,
status_counts: NOT_COUNTED,
missing_fonts: Default::default(),
@@ -210,6 +212,7 @@ impl WordApp {
ribbon_dropped,
nav_search_focus,
nav_query,
nav_results_gen,
escape_free,
status_counts,
missing_fonts,
@@ -311,6 +314,7 @@ impl WordApp {
ribbon_dropped,
nav_search_focus,
nav_query,
nav_results_gen,
escape_free,
status_counts,
missing_fonts,
+79 -1
View File
@@ -240,6 +240,22 @@ pub fn check(crates: &[Crate]) -> Vec<Violation> {
out
}
/// Extract `dep/feature` and `dep?/feature` activations from a package's `[features]` map (#9648).
fn feature_table_dep_features(pkg: &Value) -> Vec<(&str, &str)> {
let mut out = Vec::new();
for entries in pkg["features"].as_object().into_iter().flat_map(|m| m.values()) {
for item in entries.as_array().into_iter().flatten().filter_map(Value::as_str) {
if let Some((raw_dep, feat)) = item.split_once('/') {
let dep = raw_dep.strip_suffix('?').unwrap_or(raw_dep);
if !dep.is_empty() && !feat.is_empty() {
out.push((dep, feat));
}
}
}
}
out
}
/// Build the model from `cargo metadata --format-version 1 --no-deps`.
pub fn from_metadata(meta: &Value) -> Result<Vec<Crate>, String> {
let pkgs = meta["packages"].as_array().ok_or("metadata: no packages array")?;
@@ -247,16 +263,23 @@ pub fn from_metadata(meta: &Value) -> Result<Vec<Crate>, String> {
let mut out = Vec::new();
for p in pkgs {
let name = p["name"].as_str().ok_or("package without name")?.to_owned();
let table_features = feature_table_dep_features(p);
let mut deps = Vec::new();
for d in p["dependencies"].as_array().into_iter().flatten() {
let dname = d["name"].as_str().unwrap_or_default().to_owned();
let dep_key = d["rename"].as_str().unwrap_or(&dname);
let kind = match d["kind"].as_str() {
Some("dev") => DepKind::Dev,
Some("build") => DepKind::Build,
_ => DepKind::Normal,
};
let workspace = members.contains(&dname.as_str()) || d["path"].is_string();
let features = d["features"].as_array().into_iter().flatten().filter_map(|v| v.as_str().map(str::to_owned)).collect();
let mut features: Vec<String> = d["features"].as_array().into_iter().flatten().filter_map(|v| v.as_str().map(str::to_owned)).collect();
for &(target, feat) in &table_features {
if target == dep_key && !features.iter().any(|existing| existing == feat) {
features.push(feat.to_owned());
}
}
deps.push(Dep { name: dname, kind, workspace, features });
}
out.push(Crate { name, deps });
@@ -410,4 +433,59 @@ mod tests {
assert_eq!(doc.deps[2].kind, Dev);
assert!(check(&g).is_empty());
}
#[test]
fn craft_ui_features_from_package_features_table_flagged() {
let meta: Value = serde_json::from_str(
r#"{"packages":[
{
"name": "wordcraft-mcp",
"dependencies": [
{"name": "craft", "kind": null, "features": ["automation"]},
{"name": "craft", "rename": "craft_opt", "kind": null, "optional": true, "features": []}
],
"features": {
"gui": ["craft/ui"],
"weak": ["craft?/window"],
"renamed": ["craft_opt/ui-app"],
"safe": ["craft/control"]
}
},
{
"name": "wordcraft-engine",
"dependencies": [
{"name": "craft", "kind": null, "features": []}
],
"features": {
"safe": ["craft/automation", "craft?/settings"]
}
},
{
"name": "wordcraft-ui-egui",
"dependencies": [
{"name": "craft", "kind": null, "features": []}
],
"features": {
"test-ui": ["craft/ui-testing", "craft?/ui"]
}
}
]}"#,
)
.unwrap();
let g = from_metadata(&meta).unwrap();
let v = check(&g);
let deps: Vec<(&str, &str)> = v
.iter()
.filter_map(|item| match item {
Violation::UiBelowL6 { krate, dep, layer: 5 } => Some((krate.as_str(), dep.as_str())),
_ => None,
})
.collect();
assert_eq!(
deps,
vec![("wordcraft-mcp", "craft[ui-app]"), ("wordcraft-mcp", "craft[ui]"), ("wordcraft-mcp", "craft[window]")],
"unexpected violations: {v:?}"
);
assert_eq!(v.len(), 3, "non-UI features and L6 crates must not be flagged: {v:?}");
}
}