Compare commits

...
Author SHA1 Message Date
6c6ac698ca Layout: a paragraph with a hidden mark is shown on one line with the next one (#3986) (#6913)
* Layout: a paragraph with a hidden mark is shown on one line with the next one (#3986) (#4134)

Lands #4134 rebased onto main; only docs conflicts were resolved (both sides kept).

Co-Authored-By: Menonro <25549525+Menonro@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCXtSjB6e5jmy9Uq7u8

* Layout: hidden-mark join fixes from review of #6913

- A paragraph moved off the shared line (next column or page) gets its
  own top and bottom border room again (flow.rs `Rooms` were stale).
- Hit testing cuts a line at a joined paragraph only when that paragraph
  still shares the line (`shares_line`), not when its first word wrapped below.
- A cell or header paragraph going on from a hidden mark takes the shared
  line's top as its paragraph origin, so paragraph-anchored drawings follow it.
- A text frame is placed apart: it is not joined, keeps its number.

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

* #4134: joined text's later lines start below a taller shared line; table frames don't join

A paragraph going on from the line of one whose mark is hidden kept only its
first line clear of that line: under a taller heading its second line started
inside the heading's line, back at the left margin. Its later lines now keep
clear of the rest of the shared line, with the room for its bottom border, in
the body and in boxes (cells, headers, text boxes).

The guard against joining a text frame resolves the paragraph with the table's
paragraph formatting, as its layout does, so a frame given by the table style
is placed apart with its list number instead of joining.

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

* #4134: joined text's first line shares the line again with exact spacing

The area that holds a joined paragraph's later lines below a taller shared
line started just below its first line. The line breaker checks a row
against wrap areas at its own estimate, the mark's font height, which is
taller than an exact line height below it: the first row then met the area
and moved below the shared line. The area now starts below whichever is
taller, so the first line shares the line under every line spacing rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx

* #4134: joined text's later lines clear the shared line when a large word wraps

The area that keeps a continuation's later lines below the shared line now starts just below the first row at the line breaker's row estimate, which is what the breaker tests rows with. The probe's first line can be taller than the real one when a large word fits it but wraps off the narrower shared line, and starting the area below that taller line let the real second line start inside the heading's line. The test adds a 30 pt word at three places that wrap it to the second line, in the body and in a cell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx

---------

Co-authored-by: Menonro <25549525+Menonro@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-26 11:48:47 +01:00
skylar taylor-barrick 68c024a624 Nightly: open the Launcher's files rather than its --, and stop blocking a refused launch on macOS (#7849)
Nightly launch fix under Skylar's Exec 454: the Launcher's trailing `--` no longer reaches the file list, and a refused launch no longer blocks on macOS (the reason goes to stderr and the app exits 2). Two CodeRabbit findings folded in: documents keep command-line order across the separator, and a document named like a launch argument (`-NS…`, `-psn_`, `-Apple…`) survives because the split comes before the strip.
2026-11-26 04:04:23 -06:00
Lucas Batista Vargas 104556e47d chore: bump craft-libs to 0b8bbaf4c8 and egui to b9770908e0 (#7837) 2026-11-26 08:52:55 +00:00
56 changed files with 1501 additions and 295 deletions
Generated
+132 -109
View File
@@ -1183,7 +1183,7 @@ dependencies = [
[[package]]
name = "craft"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-automation",
"craft-behavior",
@@ -1221,10 +1221,20 @@ dependencies = [
"toml",
]
[[package]]
name = "craft-appkit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"block2 0.6.2",
"objc2-app-kit 0.3.2",
"objc2-foundation 0.3.2",
]
[[package]]
name = "craft-atomic"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"rustix 1.1.6",
]
@@ -1232,7 +1242,7 @@ dependencies = [
[[package]]
name = "craft-automation"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -1257,7 +1267,7 @@ dependencies = [
[[package]]
name = "craft-behavior"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"accesskit",
"bitflags 2.13.2",
@@ -1275,7 +1285,7 @@ dependencies = [
[[package]]
name = "craft-browse"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-docpath",
@@ -1293,12 +1303,12 @@ dependencies = [
[[package]]
name = "craft-cfb"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
[[package]]
name = "craft-cloud-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"egui",
]
@@ -1306,7 +1316,7 @@ dependencies = [
[[package]]
name = "craft-cms"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"md-5",
"rayon",
@@ -1315,12 +1325,12 @@ dependencies = [
[[package]]
name = "craft-codepage"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
[[package]]
name = "craft-color"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"serde",
]
@@ -1328,7 +1338,7 @@ dependencies = [
[[package]]
name = "craft-color-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-cms",
@@ -1348,7 +1358,7 @@ dependencies = [
[[package]]
name = "craft-control"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"getrandom 0.3.4",
"serde",
@@ -1358,7 +1368,7 @@ dependencies = [
[[package]]
name = "craft-dds"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"rayon",
]
@@ -1366,7 +1376,7 @@ dependencies = [
[[package]]
name = "craft-dialogs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"block2 0.6.2",
"craft-atomic",
@@ -1391,7 +1401,7 @@ dependencies = [
[[package]]
name = "craft-doc-binary"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"chrono",
"craft-cfb",
@@ -1408,7 +1418,7 @@ dependencies = [
[[package]]
name = "craft-docpath"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"serde",
]
@@ -1416,7 +1426,7 @@ dependencies = [
[[package]]
name = "craft-docx"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"base64 0.23.1",
"chrono",
@@ -1436,7 +1446,7 @@ dependencies = [
[[package]]
name = "craft-draw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1455,7 +1465,7 @@ dependencies = [
[[package]]
name = "craft-drawingml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"chrono",
"craft-xml",
@@ -1467,7 +1477,7 @@ dependencies = [
[[package]]
name = "craft-flow"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-wordmodel",
"image",
@@ -1477,7 +1487,7 @@ dependencies = [
[[package]]
name = "craft-font-catalog"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"fontique",
"harfrust 0.13.3",
@@ -1492,7 +1502,7 @@ dependencies = [
[[package]]
name = "craft-font-manager"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-font-catalog",
@@ -1505,17 +1515,27 @@ dependencies = [
"egui",
"log",
"serde",
"skrifa 0.44.0",
"skrifa 0.47.0",
]
[[package]]
name = "craft-font-os-windows"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"windows-registry",
"windows-sys 0.61.2",
]
[[package]]
name = "craft-font-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"cap-primitives",
"craft-atomic",
"craft-font-catalog",
"craft-font-os-windows",
"flate2",
"log",
"ruzstd",
@@ -1527,12 +1547,13 @@ dependencies = [
"thiserror 2.0.21",
"toml",
"ureq",
"wuff",
]
[[package]]
name = "craft-font-subset"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"brotli 9.1.3",
"harfbuzz-subset-sys",
@@ -1545,7 +1566,7 @@ dependencies = [
[[package]]
name = "craft-fonts-build"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-font-subset",
]
@@ -1553,7 +1574,7 @@ dependencies = [
[[package]]
name = "craft-gpu"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"egui-wgpu",
"log",
@@ -1565,7 +1586,7 @@ dependencies = [
[[package]]
name = "craft-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"bitflags 2.13.2",
"craft-i18n",
@@ -1578,7 +1599,7 @@ dependencies = [
[[package]]
name = "craft-html"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-codepage",
"craft-flow",
@@ -1591,7 +1612,7 @@ dependencies = [
[[package]]
name = "craft-i18n"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"chrono",
"fixed_decimal",
@@ -1619,7 +1640,7 @@ dependencies = [
[[package]]
name = "craft-image-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-dds",
"craft-jpeg",
@@ -1646,7 +1667,7 @@ dependencies = [
[[package]]
name = "craft-imaging"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1664,7 +1685,7 @@ dependencies = [
[[package]]
name = "craft-jpeg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"thiserror 2.0.21",
]
@@ -1672,7 +1693,7 @@ dependencies = [
[[package]]
name = "craft-keymap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-host",
"craft-i18n",
@@ -1687,7 +1708,7 @@ dependencies = [
[[package]]
name = "craft-latex"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-flow",
"craft-math",
@@ -1698,7 +1719,7 @@ dependencies = [
[[package]]
name = "craft-markdown"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-flow",
"craft-html",
@@ -1708,7 +1729,7 @@ dependencies = [
[[package]]
name = "craft-math"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-xml",
"roxmltree",
@@ -1718,7 +1739,7 @@ dependencies = [
[[package]]
name = "craft-mcp-server"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"serde_json",
]
@@ -1726,7 +1747,7 @@ dependencies = [
[[package]]
name = "craft-menu"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1744,7 +1765,7 @@ dependencies = [
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"brotli-decompressor 6.3.1",
"chrono",
@@ -1756,7 +1777,7 @@ dependencies = [
[[package]]
name = "craft-metafile"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"encoding_rs",
"image",
@@ -1767,7 +1788,7 @@ dependencies = [
[[package]]
name = "craft-mime"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"chardetng",
"chrono",
@@ -1778,7 +1799,7 @@ dependencies = [
[[package]]
name = "craft-odf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"aes",
"base64 0.23.1",
@@ -1804,7 +1825,7 @@ dependencies = [
[[package]]
name = "craft-ods"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-odf",
"craft-sheet",
@@ -1815,7 +1836,7 @@ dependencies = [
[[package]]
name = "craft-offcrypto"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"aes",
"base64 0.23.1",
@@ -1832,7 +1853,7 @@ dependencies = [
[[package]]
name = "craft-opc"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-xml",
"craft-zip",
@@ -1843,7 +1864,7 @@ dependencies = [
[[package]]
name = "craft-pages"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -1859,7 +1880,7 @@ dependencies = [
[[package]]
name = "craft-pdf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"krilla",
"serde",
@@ -1869,7 +1890,7 @@ dependencies = [
[[package]]
name = "craft-platform"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"arboard",
"async-channel",
@@ -1905,7 +1926,7 @@ dependencies = [
[[package]]
name = "craft-print"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1929,7 +1950,7 @@ dependencies = [
[[package]]
name = "craft-proof"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"log",
"miniz_oxide 0.9.1",
@@ -1940,7 +1961,7 @@ dependencies = [
[[package]]
name = "craft-quit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"dispatch2",
"egui",
@@ -1953,7 +1974,7 @@ dependencies = [
[[package]]
name = "craft-review"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -1972,7 +1993,7 @@ dependencies = [
[[package]]
name = "craft-rtf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-codepage",
"craft-flow",
@@ -1985,7 +2006,7 @@ dependencies = [
[[package]]
name = "craft-settings"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-atomic",
"craft-host",
@@ -2002,17 +2023,17 @@ dependencies = [
[[package]]
name = "craft-sheet"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
[[package]]
name = "craft-ssip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
[[package]]
name = "craft-svg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-xml",
"flate2",
@@ -2029,7 +2050,7 @@ dependencies = [
[[package]]
name = "craft-table"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2041,7 +2062,7 @@ dependencies = [
[[package]]
name = "craft-text"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2065,7 +2086,7 @@ dependencies = [
[[package]]
name = "craft-theme"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"bitflags 2.13.2",
"craft-tracked",
@@ -2080,7 +2101,7 @@ dependencies = [
[[package]]
name = "craft-theme-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-atomic",
"craft-behavior",
@@ -2095,7 +2116,7 @@ dependencies = [
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2105,7 +2126,7 @@ dependencies = [
[[package]]
name = "craft-time"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2114,7 +2135,7 @@ dependencies = [
[[package]]
name = "craft-timeline"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2129,12 +2150,12 @@ dependencies = [
[[package]]
name = "craft-tracked"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
[[package]]
name = "craft-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-cloud-ui",
"craft-ui-canvas",
@@ -2148,7 +2169,7 @@ dependencies = [
[[package]]
name = "craft-ui-canvas"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-i18n",
@@ -2164,7 +2185,7 @@ dependencies = [
[[package]]
name = "craft-ui-contract"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"accesskit",
"craft-behavior",
@@ -2202,7 +2223,7 @@ dependencies = [
[[package]]
name = "craft-ui-macros"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -2213,7 +2234,7 @@ dependencies = [
[[package]]
name = "craft-ui-panels"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2231,7 +2252,7 @@ dependencies = [
[[package]]
name = "craft-ui-patterns"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2252,7 +2273,7 @@ dependencies = [
[[package]]
name = "craft-ui-shell"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2273,7 +2294,7 @@ dependencies = [
[[package]]
name = "craft-ui-test-kit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2284,7 +2305,7 @@ dependencies = [
[[package]]
name = "craft-ui-widgets"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2303,7 +2324,7 @@ dependencies = [
[[package]]
name = "craft-update"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"chrono",
"craft-host",
@@ -2332,7 +2353,7 @@ dependencies = [
[[package]]
name = "craft-web-api"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"js-sys",
"serde_json",
@@ -2343,7 +2364,7 @@ dependencies = [
[[package]]
name = "craft-web-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-host",
"craft-platform",
@@ -2355,7 +2376,7 @@ dependencies = [
[[package]]
name = "craft-win32"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"winsafe",
]
@@ -2363,8 +2384,9 @@ dependencies = [
[[package]]
name = "craft-window"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-appkit",
"craft-atomic",
"craft-behavior",
"craft-host",
@@ -2380,6 +2402,7 @@ dependencies = [
"serde_json",
"wayland-client",
"winsafe",
"x11rb",
]
[[package]]
@@ -2393,7 +2416,7 @@ dependencies = [
[[package]]
name = "craft-wordmodel"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"base64 0.23.1",
"craft-math",
@@ -2407,7 +2430,7 @@ dependencies = [
[[package]]
name = "craft-xls"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-cfb",
"craft-sheet",
@@ -2420,7 +2443,7 @@ dependencies = [
[[package]]
name = "craft-xlsx"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"craft-drawingml",
"craft-opc",
@@ -2432,7 +2455,7 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"quick-xml 0.41.0",
"serde",
@@ -2442,7 +2465,7 @@ dependencies = [
[[package]]
name = "craft-zip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"flate2",
"thiserror 2.0.21",
@@ -2760,7 +2783,7 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
[[package]]
name = "ecolor"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
dependencies = [
"bytemuck",
"emath",
@@ -2769,7 +2792,7 @@ dependencies = [
[[package]]
name = "eframe"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
dependencies = [
"ahash",
"bytemuck",
@@ -2804,7 +2827,7 @@ dependencies = [
[[package]]
name = "egui"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
dependencies = [
"accesskit",
"ahash",
@@ -2823,7 +2846,7 @@ dependencies = [
[[package]]
name = "egui-wgpu"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
dependencies = [
"ahash",
"bytemuck",
@@ -2842,7 +2865,7 @@ dependencies = [
[[package]]
name = "egui-winit"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
dependencies = [
"accesskit_winit",
"arboard",
@@ -2868,7 +2891,7 @@ dependencies = [
[[package]]
name = "egui_extras"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
dependencies = [
"ahash",
"egui",
@@ -2881,7 +2904,7 @@ dependencies = [
[[package]]
name = "egui_glow"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
dependencies = [
"bytemuck",
"egui",
@@ -2894,7 +2917,7 @@ dependencies = [
[[package]]
name = "egui_kittest"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
dependencies = [
"dify",
"eframe",
@@ -2920,7 +2943,7 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
[[package]]
name = "emath"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
dependencies = [
"bytemuck",
]
@@ -3001,7 +3024,7 @@ dependencies = [
[[package]]
name = "epaint"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
dependencies = [
"ahash",
"bytemuck",
@@ -3027,7 +3050,7 @@ dependencies = [
[[package]]
name = "epaint_default_fonts"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
[[package]]
name = "equivalent"
@@ -3750,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"
[[package]]
name = "hayro-cmap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"brotli 8.0.4",
"hayro-postscript",
@@ -3759,7 +3782,7 @@ dependencies = [
[[package]]
name = "hayro-interpret"
version = "0.7.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"bitflags 2.13.2",
"hayro-cmap",
@@ -3777,7 +3800,7 @@ dependencies = [
[[package]]
name = "hayro-jbig2"
version = "0.3.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"fearless_simd",
"hayro-ccitt",
@@ -3795,12 +3818,12 @@ dependencies = [
[[package]]
name = "hayro-postscript"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
[[package]]
name = "hayro-syntax"
version = "0.7.2"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"flate2",
"hayro-ccitt",
@@ -4474,9 +4497,9 @@ dependencies = [
[[package]]
name = "jpeg-encoder"
version = "0.6.1"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b454d911ac55068f53495488d8ccd0646eaa540c033a28ee15b07838afafb01f"
checksum = "a0370574b86f7eca156b9f298392b5e69a23f8c86f3f865add60bbc2e79467a6"
[[package]]
name = "js-sys"
@@ -4529,7 +4552,7 @@ dependencies = [
[[package]]
name = "krilla"
version = "0.8.2"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"base64 0.22.1",
"bumpalo",
@@ -4668,7 +4691,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
[[package]]
name = "linesweeper"
version = "0.5.0"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
dependencies = [
"arrayvec",
"kurbo",
@@ -9841,19 +9864,19 @@ dependencies = [
[[patch.unused]]
name = "egui_demo_lib"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
[[patch.unused]]
name = "egui_inspection"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
[[patch.unused]]
name = "egui_system_font_provider"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564"
[[patch.unused]]
name = "hayro"
version = "0.7.1"
source = "git+https://github.com/storytold/craft-libs?rev=b436ae992591173ce53fdb1314421ba2d8897e49#b436ae992591173ce53fdb1314421ba2d8897e49"
source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541"
+52 -52
View File
@@ -37,20 +37,20 @@ 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 = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-ssip = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
wordcraft-proof = { package = "craft-proof", git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-ssip = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", 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" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0", default-features = false }
craft-ui-test-kit = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0", default-features = false }
craft-ui-test-kit = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
# foundation
kurbo = { version = "0.13", features = ["serde"] }
@@ -81,28 +81,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 = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0", default-features = false, features = ["write"] }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0", default-features = false, features = ["write"] }
craft-wordmodel = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-docx = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0", features = ["doc"] }
craft-doc-binary = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-flow = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-odf = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0", features = ["text"] }
craft-markdown = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-html = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0", features = ["flow"] }
craft-latex = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-math = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0", features = ["detect"] }
craft-sheet = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49", version = "=0.1.0" }
craft-wordmodel = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-docx = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0", features = ["doc"] }
craft-doc-binary = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-flow = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-odf = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0", features = ["text"] }
craft-markdown = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-html = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0", features = ["flow"] }
craft-latex = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-math = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0", features = ["detect"] }
craft-sheet = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" }
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", 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"
@@ -170,27 +170,27 @@ 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 = "b436ae992591173ce53fdb1314421ba2d8897e49" }
hayro = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
emath = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
egui = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
egui-winit = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
egui_glow = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
egui_extras = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
eframe = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541" }
hayro = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
emath = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
egui = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
egui-winit = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
egui_glow = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
egui_extras = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
eframe = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" }
winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" }
+6 -6
View File
@@ -37,9 +37,9 @@ use std::rc::Rc;
use std::sync::Arc;
use std::sync::Mutex;
use craft::host::{FileError, Files, PickId, PickRequest, Picked, WriteIntent};
use craft::host::{FileError, Files, PendingPick, PickId, PickRequest, Picked, WriteIntent};
use craft::platform::browser_files::BrowserFiles;
use craft::platform::open::{DropTarget, DroppedFile, IntakeSender};
use craft::platform::open::{DroppedFile, IntakeSender};
use craft::web_host::web::{FileData, Host, Message};
use wordcraft_ui_egui::{Services, WordApp};
@@ -131,7 +131,7 @@ fn deliver_open(intake: &IntakeSender, name: &str, data: &FileData) {
return;
}
let file = DroppedFile { path: None, name, bytes: Some(Arc::from(array.to_vec())) };
intake.dropped(vec![file], DropTarget::Elsewhere);
intake.dropped(vec![file]);
}
/// The files of a hosted page: reads go to the browser's files, but a save goes to the host page,
@@ -167,8 +167,8 @@ impl Files for HostedFiles {
}
}
fn pick_pending(&self) -> bool {
self.inner.pick_pending()
fn pending_pick(&self) -> Option<PendingPick> {
self.inner.pending_pick()
}
fn read(&self, path: &Path) -> Result<Vec<u8>, FileError> {
@@ -192,7 +192,7 @@ impl Files for HostedFiles {
let answer = match sent {
// A Save As or first Save makes the page hold the document as this file: the answer
// names it, and the next Save posts the name with `save_as` false.
Ok(()) if request.save_as => Picked::Paths(vec![PathBuf::from(&name)]),
Ok(()) if request.save_as => Picked::Saved { path: PathBuf::from(&name), file_type: None },
// An overwrite of the opened file, or a copy: the document's file stays as it is.
Ok(()) => Picked::Downloaded(name),
Err(error) => Picked::Failed(error),
+3 -3
View File
@@ -10,7 +10,7 @@ use craft::host::{Files, Host, Wake};
use craft::platform::appearance::SystemReader;
use craft::platform::browser_files::BrowserFiles;
use craft::platform::clipboard::{Clipboard, ClipboardError, EventClipboard, Flavor, LateOffers, TEXT};
use craft::platform::open::{DropTarget, DroppedFile, FileIntake, IntakeSender};
use craft::platform::open::{DroppedFile, FileIntake, IntakeSender};
use craft::print::spool::Spool;
use craft::settings::SharedSettings;
use craft::ui::InstallSpec;
@@ -227,7 +227,7 @@ impl eframe::App for WebShell {
match f.bytes_async().await {
Ok(bytes) => {
let file = DroppedFile { path: None, name, bytes: Some(Arc::from(bytes)) };
sender.dropped(vec![file], DropTarget::Elsewhere);
sender.dropped(vec![file]);
}
Err(e) => log::error!("couldn't read dropped file {name}: {e}"),
}
@@ -412,7 +412,7 @@ fn guard_unload(dirty: Rc<Cell<bool>>, files: Arc<BrowserFiles>) -> Result<(), S
let window = web_sys::window().ok_or("no window")?;
let on_unload = wasm_bindgen::closure::Closure::<dyn FnMut(web_sys::BeforeUnloadEvent)>::new(move |e: web_sys::BeforeUnloadEvent| {
// A save still in the browser's picker hasn't written anything yet.
if dirty.get() || files.pick_pending() {
if dirty.get() || files.pending_pick().is_some() {
e.prevent_default();
// Older browsers ask only when `returnValue` is set.
e.set_return_value("unsaved changes");
+19 -1
View File
@@ -111,6 +111,14 @@ pub fn prepare(mut launch: Launch, validate: impl FnOnce(&Path) -> Result<PathBu
Ok(launch)
}
/// The root the Launcher hands a nightly on this platform, in that platform's own spelling: `C:\NightlyData\profiles\wordcraft`
/// on Windows, `/nightly-data/profiles/wordcraft` elsewhere. A test that fixtures the hand-off uses this rather than a
/// literal, because a root literal in the other platform's spelling is not absolute here and `parse` refuses it (#7849).
#[cfg(test)]
pub(crate) fn launcher_root() -> &'static str {
if cfg!(windows) { r"C:\NightlyData\profiles\wordcraft" } else { "/nightly-data/profiles/wordcraft" }
}
/// Resolve the selected private root before the caller's first startup effect.
pub fn validate_root(root: &Path) -> Result<PathBuf, String> {
crate::profile_root::validate(root, |key| std::env::var_os(key), std::env::current_exe().ok().as_deref(), crate::profile_root::probe_writable)
@@ -124,7 +132,7 @@ mod tests {
values.iter().map(OsString::from).collect()
}
fn absolute() -> &'static str {
if cfg!(windows) { r"C:\NightlyData\profiles\wordcraft" } else { "/nightly-data/profiles/wordcraft" }
super::launcher_root()
}
fn nightly() -> Vec<OsString> {
args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--"])
@@ -164,6 +172,16 @@ mod tests {
}
}
/// #7849: `/nightly-data/...` carries no drive prefix and so is not absolute on Windows, and `C:\...`
/// is one relative name on Unix. A launch that carries the other platform's root spelling is refused
/// instead of run against a directory this platform never meant.
#[test]
fn a_root_absolute_only_in_the_other_platforms_spelling_is_refused() {
let foreign = if cfg!(windows) { "/nightly-data/profiles/wordcraft" } else { r"C:\NightlyData\profiles\wordcraft" };
let argv = args(&["--launch-profile", VERSION, "--profile-root", foreign, "--"]);
assert!(parse(argv).is_err(), "the other platform's root spelling must not stand in: {foreign}");
}
#[test]
fn the_launcher_version_check_is_a_version_query_only_in_its_exact_form() {
let pair = &["--launch-profile", VERSION, "--profile-root", absolute()];
+119 -9
View File
@@ -38,7 +38,7 @@ use craft::platform::appearance::SystemReader;
use craft::platform::clipboard::{Clipboard, ClipboardImage, SystemClipboard};
use craft::platform::default_app::{DefaultApp, DefaultAppError};
use craft::platform::logs::{self, LogNames, crash};
use craft::platform::open::{DropTarget, DroppedFile, FileIntake, IntakeSender};
use craft::platform::open::{DroppedFile, FileIntake, IntakeSender};
use craft::print::spool::Spool;
use craft::settings::SharedSettings;
use craft::ui::InstallSpec;
@@ -121,7 +121,7 @@ impl eframe::App for App {
// Once per frame, before any pass; the files stay in `raw` for the runtime's own reading.
let files = dropped_files(raw);
if !files.is_empty() {
self.drops.dropped(files, DropTarget::Elsewhere);
self.drops.dropped(files);
}
embed::before_input(ctx, |out| self.app.frame_input(out));
}
@@ -273,6 +273,30 @@ fn build_sha() -> &'static str {
option_env!("WORDCRAFT_BUILD_SHA").map(|s| s.get(..8).unwrap_or(s)).unwrap_or("dev")
}
/// Split the command line at its first `--`: the options before it, the documents after it. The
/// Launcher's nightly hand-off arrives as `--` followed by the file names (`launch_profile::parse`
/// puts that separator first), so it is dropped here rather than opened as a document.
fn split_at_delimiter(args: Vec<String>) -> (Vec<String>, Vec<String>) {
match args.iter().position(|a| a == "--") {
Some(i) => {
let mut options = args;
let files = options.split_off(i + 1);
options.pop();
(options, files)
}
None => (args, Vec::new()),
}
}
/// The documents to open, in the order the command line gave them: the words before `--` that the flag
/// loop kept, then the ones after it. The separator moves no document, and the Launcher, which sends
/// none before it, opens just its own file names in order.
fn documents_to_open(before: Vec<String>, after: Vec<String>) -> Vec<String> {
let mut documents = before;
documents.extend(after);
documents
}
/// The arguments as text, and apart the files whose names aren't valid Unicode, such as a Latin-1
/// one (#1440). A `--control` port, a token or a token file that isn't is an error.
fn text_args(arguments: Vec<std::ffi::OsString>) -> (Vec<String>, Vec<std::path::PathBuf>) {
@@ -342,14 +366,24 @@ fn initialize_nightly_process_identity() -> Result<(), process_identity::Identit
)
}
/// Tell the person why a Launcher launch was refused, with a native message box on a desktop
/// session (a Launcher start has no terminal to read standard error from).
/// Whether a refusal may also open a native message box. Standard error always carries the reason;
/// this only adds a box where one renders without the app's event loop. Never on macOS: rfd's alert
/// there needs the AppKit run loop this start has not reached, so a refused nightly launch hung in
/// an invisible modal instead of exiting (GridCraft Mac smoke, 2026-11-26).
fn refusal_dialog(flavor: build_flavor::BuildFlavor, desktop_session: bool, macos: bool) -> bool {
build_flavor::needs_native_error(flavor, desktop_session) && !macos
}
/// Tell the person why a Launcher launch was refused: on standard error always, and with a native
/// message box on a desktop session whose modal renders without the app's run loop (Windows,
/// X11/Wayland) — a Launcher start has no terminal to read standard error from, and on macOS a modal
/// before the event loop never appears.
fn report_launch_profile_error(error: &str) {
complain(format_args!("launch profile: {error}"));
let desktop_session = cfg!(windows)
|| cfg!(target_os = "macos")
|| (cfg!(target_os = "linux") && ["DISPLAY", "WAYLAND_DISPLAY"].into_iter().any(|key| std::env::var_os(key).is_some_and(|v| !v.is_empty())));
if build_flavor::needs_native_error(build_flavor::COMPILED, desktop_session) {
if refusal_dialog(build_flavor::COMPILED, desktop_session, cfg!(target_os = "macos")) {
if let Err(identity) = initialize_nightly_process_identity() {
complain(format_args!("launch profile: {identity}"));
return;
@@ -445,11 +479,16 @@ fn main() -> eframe::Result {
log::error!("couldn't start again without another program's AppImage variables, so the self-update is off in this window: {e}");
}
let mut flags = ControlOptions::default();
let mut files = Vec::new();
let mut sample = false;
let (args, other_files) = text_args(arguments);
// Only macOS (Finder / LaunchServices) adds these; elsewhere `-NS…` could be a real file name.
// The Launcher's own hand-off: `--` ends the options, so nothing after it is read as one and
// the separator itself never becomes a document.
let (args, after_separator) = split_at_delimiter(args);
// Only macOS (Finder / LaunchServices) adds these, and only to the options: a Finder launch carries
// no separator for them to sit after, and the Launcher starts the app itself, so a document whose
// name merely looks like one of these (`-NSNotes.docx`) is still opened (#7849 review).
let args = if cfg!(target_os = "macos") { without_launch_args(args) } else { args };
let mut documents: Vec<String> = Vec::new();
let mut bad_control: Option<Option<String>> = None;
let mut missing_value: Option<&'static str> = None;
let mut args = args.into_iter().peekable();
@@ -492,9 +531,12 @@ fn main() -> eframe::Result {
let _ = std::io::Write::write_all(&mut std::io::stdout(), USAGE.as_bytes());
return Ok(());
}
_ => files.push(a),
_ => documents.push(a),
}
}
// After the loop, so a document before `--` opens before the ones after it (a stable launch's
// `a.docx -- b.docx` used to be reversed when the Launcher's list was the one collected first).
let files = documents_to_open(documents, after_separator);
// After the loop, so `--version` later on the line still wins.
if let Some(port) = bad_control {
let got = port.map(|p| format!(", got {p:?}")).unwrap_or_default();
@@ -1036,7 +1078,7 @@ mod smoke {
std::fs::create_dir_all(&dir).unwrap();
let path = dir.join("dropped.txt");
std::fs::write(&path, "Dropped words").unwrap();
run.sender.dropped(vec![DroppedFile { path: Some(path), name: "dropped.txt".into(), bytes: None }], DropTarget::Elsewhere);
run.sender.dropped(vec![DroppedFile { path: Some(path), name: "dropped.txt".into(), bytes: None }]);
run.settle();
assert!(run.app.app.session.doc.plain_text(wordcraft_doc::StoryRef::Body).contains("Dropped words"), "the dropped file opened");
let _ = std::fs::remove_dir_all(dir);
@@ -1077,3 +1119,71 @@ mod smoke {
}
}
}
#[cfg(test)]
mod command_line_tests {
use super::{documents_to_open, split_at_delimiter};
/// The argv the Launcher starts a nightly with, as `prepare_launch` hands it on. The root is the one this
/// platform would pass: `/nightly-data/...` has no drive prefix, so on Windows `parse` rightly refuses it.
fn launcher_argv(tail: &[&str]) -> Vec<String> {
let mut argv: Vec<std::ffi::OsString> = ["--launch-profile", "nightly-v1", "--profile-root", super::launch_profile::launcher_root(), "--"]
.iter()
.map(std::ffi::OsString::from)
.collect();
argv.extend(tail.iter().map(std::ffi::OsString::from));
super::launch_profile::parse(argv).unwrap().args.iter().map(|a| a.to_string_lossy().into_owned()).collect()
}
#[test]
fn the_launchers_separator_is_never_a_document() {
let (options, files) = split_at_delimiter(launcher_argv(&[]));
assert!(options.is_empty(), "{options:?}");
assert!(files.is_empty(), "the separator must not reach the documents: {files:?}");
}
#[test]
fn documents_after_the_separator_are_kept_in_order() {
let (options, files) = split_at_delimiter(launcher_argv(&["a.file"]));
assert!(options.is_empty(), "{options:?}");
assert_eq!(files, ["a.file"]);
let (_, files) = split_at_delimiter(launcher_argv(&["a.file", "--version", "--sample"]));
assert_eq!(files, ["a.file", "--version", "--sample"], "after -- every word is a document");
// A real document path, as Windows hands one on: kept whole, in order, backslashes and spaces intact.
let (_, files) = split_at_delimiter(launcher_argv(&[r"C:\Users\user\Holiday letter.docx", "a.file"]));
assert_eq!(files, [r"C:\Users\user\Holiday letter.docx", "a.file"], "a real path after -- stays a document, in order");
}
/// A document whose name looks like a LaunchServices option is one only after the separator: the strip
/// for macOS runs on the options, after the split, so `-- -NSNotes.docx report.docx` opens both.
#[test]
fn a_document_named_like_a_launch_argument_survives_the_separator() {
let (options, after) = split_at_delimiter(["-psn_0_12345", "--", "-NSNotes.docx", "report.docx"].map(String::from).to_vec());
assert!(super::without_launch_args(options).is_empty(), "the option before the separator goes");
let hazard: Vec<String> = ["-NSNotes.docx", "report.docx"].map(String::from).to_vec();
assert!(super::without_launch_args(hazard).is_empty(), "before the split the strip takes the document and the one after it");
assert_eq!(documents_to_open(Vec::new(), after), ["-NSNotes.docx", "report.docx"], "what follows the separator is opened, in order");
}
/// A stable line that carries its own separator: `a.file` before `--` opens before `b.file` after it.
/// The flag loop keeps `a.file` (its `_` arm, one push) and `documents_to_open` puts the two lists
/// back in command-line order; the reverse, appending the loop's list to the separator's, opened them
/// backwards (found in review of #7849).
#[test]
fn documents_before_the_separator_keep_their_place_before_the_ones_after_it() {
let (options, after) = split_at_delimiter(["--sample", "a.file", "--", "b.file"].map(String::from).to_vec());
assert_eq!(options, ["--sample", "a.file"], "--sample is a switch and a.file is left for the loop");
assert_eq!(documents_to_open(vec!["a.file".into()], after), ["a.file", "b.file"]);
let (_, after) = split_at_delimiter(launcher_argv(&["b.file"]));
assert_eq!(documents_to_open(Vec::new(), after), ["b.file"], "the Launcher sends nothing before the separator");
}
#[test]
fn a_refusal_never_blocks_on_a_modal_before_the_event_loop_on_macos() {
use crate::build_flavor::BuildFlavor;
assert!(super::refusal_dialog(BuildFlavor::NightlyV1, true, false), "a desktop refusal still shows the box where one renders");
assert!(!super::refusal_dialog(BuildFlavor::NightlyV1, true, true), "macOS has no run loop yet: the modal would hang");
assert!(!super::refusal_dialog(BuildFlavor::NightlyV1, false, false), "a headless session has no box");
assert!(!super::refusal_dialog(BuildFlavor::Stable, true, false), "only a nightly refusal explains itself in a box");
}
}
+189 -8
View File
@@ -1,7 +1,8 @@
use super::ctx::{Ctx, page_anchored};
use super::ctx::{Ctx, Joining, page_anchored};
use super::floats::{
ObjFrame, ObjectPlacement, WrapArea, align_in, float_rect, floating, left_out_objects, place_objects, rel_exclusions, wrap_area,
};
use super::flow::again;
use super::page::PageFrame;
use super::placed::Placed;
use super::table_flow::below;
@@ -262,12 +263,19 @@ pub(crate) fn layout_box(ctx: &mut Ctx, input: BoxInput<'_>) -> BoxLayout {
let frames = !matches!(story, StoryRef::Part(id) if ctx.doc.parts.get(&id).is_some_and(|p| p.kind == wordcraft_doc::PartKind::TextBox));
// The bottom of the last paragraph's lines.
let mut prev_end = 0.0f32;
// Where the last paragraph, whose mark is hidden, ended: the next one goes on from there.
let mut joint: Option<Joint> = None;
let outer_joined = ctx.joined;
for (i, b) in blocks.iter().enumerate() {
last_top = y;
let mut path = prefix.to_vec();
path.push(i as u32);
match &**b {
Block::Para(p) => {
// A paragraph after one whose mark is hidden goes on from that one's last line
// (Word, #3986; see `Joint`); one that shows nothing passes the place on.
let (mark_hidden, shows_nothing, taken) = Joint::arrive(ctx, &mut joint, (i, p), (width, frames), table);
let p = taken.as_ref().map_or(p, |t| &t.para);
let label = ctx.next_label(p);
let listed = label.is_some();
let mut pl = ctx.para_labelled(p, width, table, &[], label.clone());
@@ -306,8 +314,10 @@ pub(crate) fn layout_box(ctx: &mut Ctx, input: BoxInput<'_>) -> BoxLayout {
});
// Paragraph-relative floats start above the effective space before, as in the
// body path. Keep text and wrap exclusions relative to the text's actual top.
let para_top = y;
// A paragraph going on from a shared line has its origin at that line's top.
let para_top = taken.as_ref().map_or(y, |t| t.joint.top);
y += if i == 0 { before } else { before.max(0.0) };
TakenUp::start(taken.as_ref(), &mut y, &mut excl);
// Floating objects anchored here: place them, then wrap the text around them.
// One left out of the layout (hidden, or deleted in the final text) takes no room.
let mut floats = HashMap::new();
@@ -354,10 +364,11 @@ pub(crate) fn layout_box(ctx: &mut Ctx, input: BoxInput<'_>) -> BoxLayout {
if !rel.is_empty() {
pl = ctx.para_labelled(p, width, table, &rel, label);
}
TakenUp::clear(taken.as_ref(), &mut excl);
// Bordered paragraphs: room for their borders, those of a group joined in one box.
let cell = table.map(|t| &t.para);
let (above, below) = (joined(ctx.doc, blocks, i, i.checked_sub(1), cell), joined(ctx.doc, blocks, i, Some(i + 1), cell));
let mut edges = Edges::own(&pl, 0, pl.lines.len());
let mut edges = Edges::own(&pl, 0, pl.lines.len()).sharing(&pl);
if above {
edges.top = 0.0;
}
@@ -370,6 +381,7 @@ pub(crate) fn layout_box(ctx: &mut Ctx, input: BoxInput<'_>) -> BoxLayout {
edges.up = (y + lead - prev_end).max(0.0);
}
prev_end = push_para(&mut items, (story, &path), &pl, (0, pl.lines.len()), (0.0, y + lead), width, edges);
joint = Joint::after(&pl, (0, pl.lines.len()), i, (0.0, y + lead), edges.bottom).filter(|_| mark_hidden && !shows_nothing).or(joint);
// Pictures, shapes and text boxes: drawn, their areas and text boxes' text.
if !p.objects.is_empty() {
let at = ObjFrame {
@@ -412,7 +424,9 @@ pub(crate) fn layout_box(ctx: &mut Ctx, input: BoxInput<'_>) -> BoxLayout {
let last = i + 1 == blocks.len();
let normal = || pl.rp.style == "Normal" || ctx.doc.styles.get(&pl.rp.style).is_none();
let after = if last && (pl.rp.after_auto || (in_cell && ctxl && normal())) { 0.0 } else { pl.rp.space_after };
y += edges.top + pl.height + edges.bottom + after;
y += edges.top + pl.height + edges.bottom;
// One going on from the line of the paragraph before ends below that line (#3986).
y = TakenUp::end(taken.as_ref(), ctx, (y, after), outer_joined);
prev_after = after;
prev_after_auto = pl.rp.after_auto;
prev_listed = listed;
@@ -445,6 +459,7 @@ pub(crate) fn layout_box(ctx: &mut Ctx, input: BoxInput<'_>) -> BoxLayout {
y = y.max(legacy_header_reach(y, &legacy_reach));
let floats_bottom = float_tables.iter().map(|r| r.bottom()).fold(float_objects_bottom, f32::max);
ctx.hide_deleted = outer_hide;
ctx.joined = outer_joined;
BoxLayout { items, height: y.max(0.0), floats_bottom, last_top: last_top.max(0.0), table_areas, page_table_wraps }
}
@@ -700,6 +715,162 @@ impl Edges {
joined: [false; 2],
}
}
/// A paragraph going on from the line of the one before, whose mark is hidden (#3986), takes
/// no room for its borders on that line, nor below it when that line is all it has: the
/// shared line shows the first paragraph's shading and borders (Word).
pub(crate) fn sharing(mut self, pl: &ParaLayout) -> Edges {
if pl.shares_line() {
self.top = 0.0;
if pl.lines.len() <= 1 {
self.bottom = 0.0;
}
}
self
}
}
/// Where a paragraph whose mark is hidden ends (#3986). Word shows it on one line with the next
/// paragraph: that one's text goes on from where this one's ends, beside it on its last line.
/// Paragraphs that show nothing (an empty one with a hidden mark, say) pass the place on.
#[derive(Clone, Copy, Debug)]
pub(crate) struct Joint {
/// The block that goes on from here.
pub(crate) next: usize,
/// The page (the count of pages) and column of the last line (body text only).
pub(crate) page: usize,
pub(crate) col: usize,
/// The last line's top, height and baseline (from its top), the left edge of its column and
/// the x its text ends at.
pub(crate) top: f32,
pub(crate) height: f32,
baseline: f32,
left: f32,
end: f32,
/// The room under the line for the paragraph's bottom border: what follows the shared line
/// starts below it.
room: f32,
}
impl Joint {
/// After lines `l0..l1` of paragraph layout `pl`, block `block`, the first of them at `y` in
/// a column whose left edge is at `x`, with `room` under them for its bottom border.
pub(crate) fn after(pl: &ParaLayout, (l0, l1): (usize, usize), block: usize, (x, y): (f32, f32), room: f32) -> Option<Joint> {
let li = l1.checked_sub(1)?;
let (first, last) = (pl.lines.get(l0)?, pl.lines.get(li)?);
// Right-to-left text runs the other way: its lines aren't joined.
if pl.rp.bidi || !last.vis.is_empty() {
return None;
}
let end = pl.x_of(li, pl.text_len)?;
let (top, height, baseline) = (y + last.top - first.top, last.height, last.baseline - last.top);
Some(Joint { next: block + 1, page: 0, col: 0, top, height, baseline, left: x, end: x + end, room })
}
/// Paragraph `p`, block `i`, arriving at `joint`: whether its mark is hidden, whether it shows
/// nothing, and how it goes on from the place the one before left (if that one's mark was hidden).
fn arrive(
ctx: &mut Ctx,
joint: &mut Option<Joint>,
(i, p): (usize, &Paragraph),
(width, frames): (f32, bool),
table: Option<&para::CellText>,
) -> (bool, bool, Option<TakenUp>) {
let chr = table.map(|t| &t.chr);
let mark_hidden = ctx.mark_hidden(p, chr);
let shows_nothing = mark_hidden && ctx.text_hidden(p, chr);
let came = joint.take().filter(|j| j.next == i);
*joint = came.filter(|_| shows_nothing).map(|j| Joint { next: i + 1, ..j });
let taken = came.filter(|_| !shows_nothing).and_then(|j| j.take_up(ctx, p, (width, frames), table));
(mark_hidden, shows_nothing, taken)
}
/// The bottom of the shared line, with the room for the first paragraph's bottom border.
pub(crate) fn bottom(&self) -> f32 {
self.top + self.height + self.room
}
/// How the next paragraph `q`, laid out `width` wide, goes on from here: how far below the
/// shared line's top it starts (its first line's text sits on this paragraph's baseline, not
/// above it), and the areas it keeps clear of: its first line, this paragraph's text, down to
/// the bottom of that line only; its later lines, the rest of the shared line (a heading's,
/// taller than the text going on from it), with the room for its bottom border (Word).
pub(crate) fn fit(&self, ctx: &mut Ctx, q: &Paragraph, width: f32, table: Option<&para::CellText>) -> (f32, Vec<WrapArea>) {
let eq = ctx.eq_count;
let probe = again(ctx, eq, |ctx| ctx.para_labelled(q, width, table, &[], None));
let (gap, height) = probe.lines.first().map_or((0.0, self.height), |l| ((self.baseline - (l.baseline - l.top)).max(0.0), l.height));
let rect = Rect::new(self.left, self.top, (self.end - self.left).max(0.0), (gap + height - 0.01).max(0.01));
let mut areas = vec![(rect, false, None, WrapText::Right, false)];
// Just below the first row as the line breaker tests it: the breaker tests every row at
// its estimate (`row_est`), not at the line's height, so the first row never meets this
// area and every later row, starting lower, does and moves below it. The probe's own first
// line can be taller than the real one (a large word that wraps off the narrower shared
// line), so its height can't be used here.
let below = self.top + gap + probe.row_est + 0.01;
if self.bottom() > below {
areas.push((Rect::new(self.left, below, width.max(0.01), self.bottom() - below), true, None, WrapText::BothSides, false));
}
(gap, areas)
}
/// The areas [`Joint::fit`] gave taken out of `excl` again, the paragraph laid out.
pub(crate) fn unfit(areas: &[WrapArea], excl: &mut Vec<WrapArea>) {
for area in areas {
if let Some(k) = excl.iter().position(|a| a.0 == area.0 && a.1 == area.1 && a.2.is_none() && a.3 == area.3) {
excl.remove(k);
}
}
}
/// Paragraph `p` of a box `width` wide going on from here, unless a page break comes before
/// it, it runs right to left or it is a text frame (`frames`: placed apart, sharing no line):
/// without its space before, as [`Joint::fit`] lays it out.
fn take_up(self, ctx: &mut Ctx, p: &Paragraph, (width, frames): (f32, bool), table: Option<&para::CellText>) -> Option<TakenUp> {
let own = ctx.doc.styles.resolve_para_in(&p.props, table.map(|t| &t.para));
if own.page_break_before || own.bidi || (frames && own.frame.is_some()) {
return None;
}
let mut para = p.clone();
para.props.space_before = Some(0.0);
para.props.space_before_auto = Some(false);
ctx.joined = Some(Joining::new(para.rev, 0.0));
let (gap, areas) = self.fit(ctx, &para, width, table);
Some(TakenUp { joint: self, para, gap, areas })
}
}
/// A paragraph of a box going on from a [`Joint`]: the paragraph without its space before, how
/// far below the shared line's top it starts and the areas its lines keep clear of.
struct TakenUp {
joint: Joint,
para: Paragraph,
gap: f32,
areas: Vec<WrapArea>,
}
impl TakenUp {
/// Where it starts: `y` below the shared line's top, its lines keeping clear of that line.
fn start(taken: Option<&TakenUp>, y: &mut f32, excl: &mut Vec<WrapArea>) {
let Some(t) = taken else { return };
*y = t.joint.top + t.gap;
excl.extend(t.areas.iter().cloned());
}
/// Its lines laid out: the areas they kept clear of come out of `excl`.
fn clear(taken: Option<&TakenUp>, excl: &mut Vec<WrapArea>) {
if let Some(t) = taken {
Joint::unfit(&t.areas, excl);
}
}
/// Where what follows a paragraph ending at `y`, with `after` its space after, starts: below
/// the shared line at least, with the first paragraph's bottom border. With the copy laid
/// out, the paragraph's own layouts are its own again (`outer`).
fn end(taken: Option<&TakenUp>, ctx: &mut Ctx, (y, after): (f32, f32), outer: Option<Joining>) -> f32 {
let Some(t) = taken else { return y + after };
ctx.joined = outer;
y.max(t.joint.bottom()) + after
}
}
/// Paragraph lines plus their shading and borders; returns the bottom of the lines. The
@@ -717,12 +888,21 @@ pub(crate) fn push_para(
return y;
};
let h = last.top + last.height - first.top;
let lines = Placed::Lines { story, path: Path(path.to_vec()), para: pl.clone(), l0, l1, x, y, turn: TextDirection::Horizontal };
// The line a paragraph shares with the one before, whose mark is hidden, shows that one's
// shading and borders: this one's start on its own next line, without a top border (Word, #3986).
let shared = l0 == 0 && pl.shares_line();
let Some(own) = pl.lines.get(if shared { 1 } else { l0 }).filter(|_| !shared || l1 > 1) else {
items.push(lines);
return y + h;
};
let (y_own, e) = if shared { (y + own.top - first.top, Edges { top: 0.0, up: 0.0, ..e }) } else { (y, e) };
// Indents are logical: a right-to-left paragraph's start indent (and hanging indent) is on the right.
let start = pl.rp.indent_left.min(pl.rp.indent_left + pl.rp.indent_first);
let (li, ri) = if pl.rp.bidi { (pl.rp.indent_right, start) } else { (start, pl.rp.indent_right) };
let left = x + li;
let right = x + width - ri;
let (top, bottom) = (y - e.top - e.up, y + h + e.bottom);
let (top, bottom) = (y_own - e.top - e.up, y + h + e.bottom);
// The outer edges of the side borders.
let sides = pl.rp.borders.unwrap_or_default();
let (lx, rx) = (left - border_room(sides.left), right + border_room(sides.right));
@@ -731,7 +911,7 @@ pub(crate) fn push_para(
let (sl, sr) = (lx.min(left - pad), rx.max(right + pad));
items.push(Placed::Fill { rect: Rect::new(sl, top, sr - sl, bottom - top), color: c });
}
items.push(Placed::Lines { story, path: Path(path.to_vec()), para: pl.clone(), l0, l1, x, y, turn: TextDirection::Horizontal });
items.push(lines);
if let Some(b) = &pl.rp.borders {
// All four lines lie beyond their distance from the text (`lx`, `rx`: the side lines'
// outer edges); `box_rules` runs the top and bottom over the side lines to those edges.
@@ -739,9 +919,10 @@ pub(crate) fn push_para(
let (cl, cr) = (lx + half(b.left), rx - half(b.right));
let tb = b.top.filter(|t| e.top > 0.0 && t.is_visible());
let bb = b.bottom.filter(|t| e.bottom > 0.0 && t.is_visible());
let ty = tb.map_or(top, |t| y - t.space - t.width / 2.0);
let ty = tb.map_or(top, |t| y_own - t.space - t.width / 2.0);
let by = bb.map_or(bottom, |t| y + h + t.space + t.width / 2.0);
box_rules(items, (cl, ty, cr, by), [tb, bb, b.left, b.right], e.joined);
// Open at the top where it goes on over the shared line.
box_rules(items, (cl, ty, cr, by), [tb, bb, b.left, b.right], [e.joined[0] || shared, e.joined[1]]);
}
y + h
}
+3
View File
@@ -27,6 +27,9 @@ pub(crate) struct Key {
pub(crate) sref: u64,
/// The word being typed in this paragraph, left without a spelling squiggle.
pub(crate) typing: Option<(usize, usize)>,
/// A copy of the paragraph going on from the line of the one before (`ctx::Joining`): its
/// space before and whether it shares that line ([`ParaEnv::joined`](crate::para::ParaEnv)).
pub(crate) joined: Option<(u32, bool)>,
}
/// Memoised paragraph layouts.
+82 -4
View File
@@ -51,6 +51,9 @@ pub(crate) struct Ctx<'a> {
/// Empty body paragraphs with hidden marks or continuous section breaks, in order:
/// they take no room (see [`place_para`]).
pub(crate) quiet_marks: Vec<usize>,
/// The paragraph being laid out as going on from the line of the one before, whose mark is
/// hidden: its list number is counted but not drawn (#3986).
pub(crate) joined: Option<Joining>,
/// Empty paragraphs closing a continuous section right after another section's mark, in
/// order: each takes its line while it fits, then stays at the page's bottom (#3907).
pub(crate) stacked_marks: Vec<usize>,
@@ -79,6 +82,31 @@ pub(crate) struct Ctx<'a> {
pub(crate) header_repeats: usize,
}
/// A paragraph going on from the line of the one before, whose mark is hidden (#3986): a copy of
/// the document's, which keeps its revision, given the space before that puts its text on that
/// line's baseline.
#[derive(Clone, Copy, Debug)]
pub(crate) struct Joining {
/// The paragraph's revision.
pub(crate) rev: u64,
/// The space before the copy is given.
before: f32,
/// Whether it still shares that line: not once its first line has moved on to the next
/// column or page, where it is laid out as on its own (the copy's space before kept).
pub(crate) shares: bool,
}
impl Joining {
pub(crate) fn new(rev: u64, before: f32) -> Self {
Joining { rev, before, shares: true }
}
/// What tells the copy's layouts apart from each other and from the paragraph's own.
fn key(self) -> (u32, bool) {
(self.before.to_bits(), self.shares)
}
}
struct ParaEnvInput<'a> {
width: f32,
label: Option<(String, Level)>,
@@ -87,6 +115,7 @@ struct ParaEnvInput<'a> {
eq_number: u32,
typing_word: Option<(usize, usize)>,
fitted: &'a [(usize, f32)],
joined: bool,
}
/// A header or footer (`story`) laid out for page `number` of a section (`sect`, `mirror`): its
@@ -227,12 +256,31 @@ impl Ctx<'_> {
grid: para::Grid::default(),
fit_objects: false,
fitted: &[],
joined: false,
};
let pl = Arc::new(para::layout_para(&p, &env));
self.numbers.insert(n, pl.clone());
pl
}
/// Whether `p` is laid out going on from the line of the paragraph before, sharing it (#3986).
fn shares_line(&self, p: &Paragraph) -> bool {
self.joined.is_some_and(|j| j.rev == p.rev && j.shares)
}
/// Whether `p`'s paragraph mark is hidden, with hidden text not shown: Word then shows the
/// paragraph on one line with the next one (#3986). A section's closing mark never joins.
pub(crate) fn mark_hidden(&self, p: &Paragraph, table_chr: Option<&CharProps>) -> bool {
!self.opts.show_hidden && p.section.is_none() && self.doc.styles.resolve_char_in(p.props.style.as_deref(), table_chr, &p.mark).hidden
}
/// Whether `p` shows none of its text (it has none, or all of it is hidden and not shown).
pub(crate) fn text_hidden(&self, p: &Paragraph, table_chr: Option<&CharProps>) -> bool {
p.text.is_empty()
|| (!self.opts.show_hidden
&& p.runs.iter().all(|r| r.len == 0 || self.doc.styles.resolve_char_in(p.props.style.as_deref(), table_chr, &r.props).hidden))
}
/// The list label of `p`, advancing the list counters: call it once per paragraph, in
/// document order (only for paragraphs that will show).
/// Whether `p` gets a list label ([`Ctx::next_label`] is `Some`), without counting it.
@@ -269,7 +317,16 @@ impl Ctx<'_> {
let typing = key.typing;
let pl = Arc::new(para::layout_para(
p,
&self.para_env(ParaEnvInput { width, label, table, exclusions, eq_number, typing_word: typing, fitted: &fitted }),
&self.para_env(ParaEnvInput {
width,
label,
table,
exclusions,
eq_number,
typing_word: typing,
fitted: &fitted,
joined: self.shares_line(p),
}),
));
self.cache.paras.insert(key, pl.clone());
pl
@@ -302,7 +359,16 @@ impl Ctx<'_> {
self.cache.misses += 1;
let pl = Arc::new(para::layout_para(
p,
&self.para_env(ParaEnvInput { width, label, table: None, exclusions: &[], eq_number, typing_word: None, fitted: &[] }),
&self.para_env(ParaEnvInput {
width,
label,
table: None,
exclusions: &[],
eq_number,
typing_word: None,
fitted: &[],
joined: self.shares_line(p),
}),
));
self.cache.paras.insert(key, pl.clone());
Some(pl)
@@ -330,7 +396,16 @@ impl Ctx<'_> {
let typing = key.typing;
let m = measure(&para::layout_para(
p,
&self.para_env(ParaEnvInput { width, label, table, exclusions: &[], eq_number, typing_word: typing, fitted: &fitted }),
&self.para_env(ParaEnvInput {
width,
label,
table,
exclusions: &[],
eq_number,
typing_word: typing,
fitted: &fitted,
joined: self.shares_line(p),
}),
));
self.cache.measures.insert(key, m);
m
@@ -415,6 +490,7 @@ impl Ctx<'_> {
hide_deleted: self.hide_deleted,
sref: if self.fields.styleref.is_some() && styleref::has_styleref(p) { self.fields.styleref_key(p) } else { 0 },
typing: self.opts.typing_word.filter(|t| t.rev == p.rev).map(|t| (t.start, t.end)),
joined: self.joined.filter(|j| j.rev == p.rev).map(Joining::key),
};
(key, eq_number)
}
@@ -435,7 +511,7 @@ impl Ctx<'_> {
}
fn para_env<'b>(&'b self, input: ParaEnvInput<'b>) -> para::ParaEnv<'b> {
let ParaEnvInput { width, label, table, exclusions, eq_number, typing_word, fitted } = input;
let ParaEnvInput { width, label, table, exclusions, eq_number, typing_word, fitted, joined } = input;
para::ParaEnv {
doc: self.doc,
width,
@@ -454,6 +530,7 @@ impl Ctx<'_> {
grid: self.grid,
fit_objects: self.boxes.inside(),
fitted,
joined,
}
}
}
@@ -525,6 +602,7 @@ mod tests {
track_totals: false,
pct_base: None,
quiet_marks: Vec::new(),
joined: None,
stacked_marks: Vec::new(),
mirror: false,
table_keys: Vec::new(),
+96 -5
View File
@@ -1,6 +1,6 @@
use super::boxes::{BoxInput, BoxLayout, Edges, joined, layout_box, push_para};
use super::boxes::{BoxInput, BoxLayout, Edges, Joint, joined, layout_box, push_para};
use super::cache::has_page_number_fields;
use super::ctx::Ctx;
use super::ctx::{Ctx, Joining};
use super::floats::{
FloatAnchor, LateFloats, ObjFrame, ObjectPlacement, anchor_floats, body_wraps, continued_exclusions, fitting, late_floats, place_late,
place_objects,
@@ -15,9 +15,89 @@ use super::{
#[cfg(test)]
use crate::WRAP_RELAYS;
/// A body paragraph. One after a paragraph whose mark is hidden goes on from that one's last line,
/// as Word shows them, on one line (#3986): see [`Joint`].
pub(crate) fn place_para(ctx: &mut Ctx, pb: &mut PageBuilder, p: &Paragraph, block: usize, body_top: f32) {
let joint = pb.joint.take().filter(|j| !pb.web && j.next == block && j.page == pb.pages.len() && j.col == pb.col);
let mark_hidden = ctx.mark_hidden(p, None);
// Nothing of it is shown: the place passes on to the paragraph after it.
if mark_hidden && ctx.text_hidden(p, None) {
place_para_alone(ctx, pb, p, block, body_top);
pb.joint = joint.map(|mut j| {
j.next = block + 1;
j
});
return;
}
let goes_on = joint.filter(|_| {
p.section.is_none()
&& ctx.quiet_marks.binary_search(&block).is_err()
&& ctx.stacked_marks.binary_search(&block).is_err()
&& !ctx.doc.styles.resolve_para(&p.props).page_break_before
&& !ctx.doc.styles.resolve_para(&p.props).bidi
});
match goes_on {
Some(j) => place_para_joined(ctx, pb, p, (block, body_top), j),
None => place_para_alone(ctx, pb, p, block, body_top),
}
if mark_hidden {
let path = Path::top(block);
pb.joint = pb.page().and_then(|page| {
page.items.iter().rev().find_map(|it| match it {
Placed::Lines { story: StoryRef::Body, path: at, para, l0, l1, x, y, turn: TextDirection::Horizontal, .. } if *at == path => {
let room = if *l1 >= para.lines.len() { Rooms::of(ctx, block, para).bottom } else { 0.0 };
Joint::after(para, (*l0, *l1), block, (*x, *y), room)
}
_ => None,
})
});
if let Some(j) = pb.joint.as_mut() {
(j.page, j.col) = (pb.pages.len(), pb.col);
}
}
}
/// `p` going on from the last line of the paragraph before (`j`): its first line starts at that
/// line's top, beside that paragraph's text, with no space before and its list number counted
/// but not drawn; its space after and line spacing are its own (Word, #3986).
fn place_para_joined(ctx: &mut Ctx, pb: &mut PageBuilder, p: &Paragraph, (block, body_top): (usize, f32), j: Joint) {
// The copy keeps the paragraph's revision, so the word being typed in it is found and its
// layouts are reused from one pass to the next: the cache tells them apart by `Joining`.
let mut q = p.clone();
q.props.space_before = Some(0.0);
q.props.space_before_auto = Some(false);
let outer = ctx.joined.replace(Joining::new(q.rev, 0.0));
let (gap, areas) = j.fit(ctx, &q, pb.col_w(), None);
if gap > 0.0 {
q.props.space_before = Some(gap);
ctx.joined = Some(Joining::new(q.rev, gap));
}
pb.y = j.top;
pb.prev = None;
pb.unmark_block();
pb.excl.extend(areas.iter().cloned());
place_para_alone(ctx, pb, &q, block, body_top);
ctx.joined = outer;
Joint::unfit(&areas, &mut pb.excl);
// The shared line is at least as tall as the first paragraph's, with its bottom border: what
// follows starts below it.
if (pb.pages.len(), pb.col) == (j.page, j.col) {
pb.y = pb.y.max(j.bottom() + ctx.doc.styles.resolve_para(&q.props).space_after);
}
}
/// A paragraph going on from the line of the one before (#3986) whose first line moves on to the
/// next column or page no longer shares that line: it is laid out as it is on its own there, its
/// list number drawn and its first-line indent and alignment its own.
fn unjoin(ctx: &mut Ctx, p: &Paragraph) {
if let Some(j) = ctx.joined.as_mut().filter(|j| j.rev == p.rev) {
j.shares = false;
}
}
/// A closing mark before a continuous section takes no room after content. An otherwise empty
/// section starting a new page retains its paragraph line.
pub(crate) fn place_para(ctx: &mut Ctx, pb: &mut PageBuilder, p: &Paragraph, block: usize, body_top: f32) {
fn place_para_alone(ctx: &mut Ctx, pb: &mut PageBuilder, p: &Paragraph, block: usize, body_top: f32) {
if !pb.web && ctx.quiet_marks.binary_search(&block).is_ok() {
let follows_section = block.checked_sub(1).and_then(|i| ctx.doc.body.get(i)).and_then(|b| b.as_para()).is_some_and(|p| p.section.is_some());
let section = pb.sect_idx;
@@ -127,7 +207,7 @@ impl Rooms {
fn of(ctx: &Ctx, block: usize, pl: &ParaLayout) -> Self {
let above = joined(ctx.doc, &ctx.doc.body, block, block.checked_sub(1), None);
let below = joined(ctx.doc, &ctx.doc.body, block, Some(block + 1), None);
let own = Edges::own(pl, 0, pl.lines.len());
let own = Edges::own(pl, 0, pl.lines.len()).sharing(pl);
Rooms { above, below, top: if above { 0.0 } else { own.top }, bottom: if below { 0.0 } else { own.bottom } }
}
}
@@ -360,6 +440,7 @@ impl<'a> Flow<'a> {
// keeps the lines and the next paragraph together at the top of a column too (#6821).
if pb.y + need > pb.bottom + 0.01 && (!pb.fresh() || Self::strict_widow_control(ctx, pb)) && need <= pb.next_room(self.body_top) {
pb.advance(self.block, self.body_top);
unjoin(ctx, self.p);
pb.y += rp.space_before.min(0.0);
return rp.space_before.min(0.0);
}
@@ -557,6 +638,7 @@ impl<'a> Flow<'a> {
fn move_on(&mut self, ctx: &mut Ctx, pb: &mut PageBuilder) {
pb.advance(self.block, self.body_top);
if self.l0 == 0 {
unjoin(ctx, self.p);
let y0 = pb.y;
self.reanchor(ctx, pb, (y0, 0.0), &[]);
self.anchor_y = y0;
@@ -846,6 +928,11 @@ fn line_numbers(ctx: &mut Ctx, pb: &mut PageBuilder, pl: &ParaLayout, (l0, l1):
{
for li in l0..l1 {
let Some(line) = pl.lines.get(li).filter(|l| !l.beside) else { continue };
// The first line of a paragraph going on from the line of the one before (#3986)
// shares that line, numbered already, unless its first word went on the next one.
if li == 0 && pl.shares_line() {
continue;
}
pb.line_no = pb.line_no.saturating_add(1);
let n = pb.line_no.saturating_add(ln.start.saturating_sub(1));
if ln.count_by > 1 && !n.is_multiple_of(ln.count_by) {
@@ -895,7 +982,7 @@ fn place_para_in_flow(ctx: &mut Ctx, pb: &mut PageBuilder, p: &Paragraph, block:
}
let before = f.gap_before(ctx, pb, broke_before);
pb.y += before;
let rooms = Rooms::of(ctx, block, &f.pl);
let mut rooms = Rooms::of(ctx, block, &f.pl);
let applied_before = f.keep_together(ctx, pb, rooms, before);
// A different top only matters when there is something to wrap around.
if spot(pb) != placed_at || ((pb.y - f.guess).abs() > 0.01 && !pb.excl.is_empty()) {
@@ -904,7 +991,10 @@ fn place_para_in_flow(ctx: &mut Ctx, pb: &mut PageBuilder, p: &Paragraph, block:
f.anchor_y = y0 - applied_before;
}
while f.l0 < f.n() {
// A paragraph moved on from the shared line (`unjoin`) is laid out again with borders of its own.
rooms = Rooms::of(ctx, block, &f.pl);
f.keep_again(ctx, pb, rooms);
rooms = Rooms::of(ctx, block, &f.pl);
f.place_due_late(ctx, pb);
f.relay_wrap(ctx, pb);
f.relay_pages(ctx, pb);
@@ -1098,6 +1188,7 @@ fn next_first_line(ctx: &mut Ctx, block: usize, width: f32, depth: usize, new_pa
grid: ctx.grid,
fit_objects: false,
fitted: &[],
joined: false,
};
Arc::new(para::layout_para(p, &env))
}
+8
View File
@@ -319,6 +319,14 @@ pub fn page_lines(page: &Page, story: StoryRef) -> Vec<LineHit<'_>> {
}
}
}
// A paragraph going on from the last line of one whose mark is hidden shares that line
// (#3986): the first one's part of it ends where the second one's text starts.
let joins: Vec<(f32, f32, f32)> = v.iter().filter(|l| l.para.shares_line() && l.li == 0).map(|l| (l.top, l.bottom, l.left)).collect();
for (top, bottom, left) in joins {
for l in v.iter_mut().filter(|l| l.top < bottom && top < l.bottom && l.left < left && left < l.right) {
l.right = left;
}
}
v
}
+13 -1
View File
@@ -1,4 +1,4 @@
use super::boxes::{BoxInput, box_rules, layout_box};
use super::boxes::{BoxInput, Joint, box_rules, layout_box};
use super::ctx::{Ctx, with_pin};
use super::floats::{EarlyFloats, WrapArea};
use super::notes::{NOTE_SEP, NOTE_SEP_W, NoteBox, NoteSeps, v_span};
@@ -35,6 +35,8 @@ pub(crate) struct PageBuilder<'a> {
/// The previous paragraph ended with a page break (its mark stayed with the break): the next
/// paragraph, first on the new page, gets no space before (Word).
pub(crate) after_break_mark: bool,
/// Where the last paragraph, whose mark is hidden, ended: the next one goes on from there.
pub(crate) joint: Option<Joint>,
/// The next section starts on a new page: this section's closing mark, when empty, needs no
/// room (Word leaves it on a full page rather than starting a page for it).
pub(crate) next_starts_page: bool,
@@ -228,6 +230,16 @@ impl PageBuilder<'_> {
self.block_marks.push(pg.items.len().saturating_sub(behind));
}
}
/// Takes back the mark of a block that has placed nothing yet: it goes on from the line of
/// the block before (#3986), and justified vertical alignment keeps the two together.
pub(crate) fn unmark_block(&mut self) {
if let Some(pg) = self.pages.last() {
let behind = self.behind.last().copied().unwrap_or(0);
if self.block_marks.last() == Some(&pg.items.len().saturating_sub(behind)) {
self.block_marks.pop();
}
}
}
/// Justified vertical alignment: share the room left below the page's text out equally
/// between the gaps of its blocks, so the last line sits on the bottom margin (above the
/// footnotes). A page with one block, or several columns, stays at the top.
+12
View File
@@ -101,9 +101,20 @@ pub struct ParaLayout {
/// Room after a cluster between Asian text and Latin text or digits ([`auto_space`]), by
/// cluster index, sorted. It is part of the cluster's advance, but takes no room at a line's end.
pub auto_space: Vec<(usize, f32)>,
/// It goes on from the last line of the paragraph before, whose mark is hidden, and shares
/// that line ([`ParaEnv::joined`]).
pub joined: bool,
/// How tall the line breaker takes a row to be when it checks it against wrap areas.
pub(crate) row_est: f32,
}
impl ParaLayout {
/// Whether its first line is the one it shares with the paragraph before, whose mark is
/// hidden (#3986), rather than a line of its own below it (its first word didn't fit there).
pub(crate) fn shares_line(&self) -> bool {
self.joined && self.lines.first().is_some_and(|l| l.top <= 0.01)
}
/// The room a horizontal rule at cluster `k` is placed in, from its left edge to the end of
/// what the line has left. A first-line indent moves that end along (Word, measured with
/// 50 % and fixed-width rules beside floats on either side and with first-line and hanging
@@ -359,6 +370,7 @@ mod label_spacing_tests {
read_line_spacing: None,
fit_objects: false,
fitted: &[],
joined: false,
};
let mut p = Paragraph::with_text(if wrap { "Alpha probe synthetic business text repeated" } else { "Alpha probe" }, Default::default());
p.props.line_spacing = Some(spacing);
+22 -6
View File
@@ -63,6 +63,9 @@ struct Breaker<'e> {
row_first: usize,
/// Spans skipped in a row because the next word didn't fit (see `Scan::skip`).
skipped: usize,
/// The paragraph goes on from the line of the one before (#3986): its first line starts right
/// after that one's text, and takes its place there whatever its own alignment.
joined: bool,
/// A left tab past the right indent that wrapped to start the next line.
wrapped_tab: Option<usize>,
}
@@ -188,7 +191,9 @@ impl<'e> Breaker<'e> {
n: pl.clusters.len(),
width,
base_right: (width - rp.indent_right).max(1.0),
first_left: rp.indent_left + rp.indent_first,
// On the line it shares with the paragraph before (#3986), kept clear of that one's
// text by an exclusion, a joined paragraph's own indents don't hold its text back.
first_left: if env.joined { (rp.indent_left + rp.indent_first).min(0.0) } else { rp.indent_left + rp.indent_first },
default_tab: settings.default_tab,
hanging_at: if rp.indent_first < 0.0 { Some(rp.indent_left) } else { None },
tab_origin: if settings.odf.is_some_and(|o| o.tabs_from_indent) { rp.indent_left } else { 0.0 },
@@ -222,13 +227,20 @@ impl<'e> Breaker<'e> {
row_rest: VecDeque::new(),
row_first: 0,
skipped: 0,
joined: env.joined,
wrapped_tab: None,
}
}
/// The first line's start: a joined paragraph's first line pushed below the shared line (its
/// first word didn't fit there) starts at the paragraph's left indent, as its other lines do.
fn first_indent(&self) -> f32 {
if self.joined && self.top > 0.0 { self.rp.indent_left } else { self.first_left }
}
/// The left edge of the row's first span: the indent, behind a drop cap on its lines.
fn row_left(&self, pl: &ParaLayout) -> f32 {
let lo = if self.first { self.first_left } else { self.rp.indent_left };
let lo = if self.first { self.first_indent() } else { self.rp.indent_left };
match pl.drop_cap {
Some((_, dl, dw)) if dw > 0.0 && self.lines.len() < dl as usize => self.first_left.max(self.rp.indent_left) + dw,
_ => lo,
@@ -271,7 +283,7 @@ impl<'e> Breaker<'e> {
/// The start of a line: its span, and the list label if it is the first.
fn begin_line(&mut self, pl: &mut ParaLayout) -> Scan {
let beside = !self.row_rest.is_empty() && self.lines.len() > self.row_first;
let row_lo = if self.first { self.first_left } else { self.rp.indent_left };
let row_lo = if self.first { self.first_indent() } else { self.rp.indent_left };
let (left, right_edge, narrowed) = self.next_span(pl);
let x = if self.first { self.place_label(pl, left) } else { left };
Scan {
@@ -563,7 +575,10 @@ impl<'e> Breaker<'e> {
let last_tab = (c0..c1).rev().find(|k| pl.clusters.get(*k).is_some_and(|c| c.kind == ClKind::Tab));
let align_from = last_tab.map(|k| k + 1).unwrap_or(c0);
let display = pl.displays.iter().find(|(ci, _)| *ci >= c0 && *ci < c1).map(|d| d.1);
let shift = match (display, rp.align) {
// The line a paragraph shares with the one before, whose mark is hidden, starts in that
// one, and takes its place right after that one's text (Word, #3986).
let align = if self.joined && self.lines.is_empty() { Align::Left } else { rp.align };
let shift = match (display, align) {
(Some(MathJc::Left), _) => 0.0,
(Some(MathJc::Right), _) => slack,
(Some(_), _) => slack / 2.0,
@@ -587,13 +602,13 @@ impl<'e> Breaker<'e> {
}
// A line ending in a manual line break is stretched too, unless `doNotExpandShiftReturn` says not to.
let stretch_end = sc.end == LineEnd::Wrap || (sc.end == LineEnd::LineBreak && self.expand_break);
let justify = display.is_none() && ((rp.align == Align::Justify && stretch_end) || rp.align == Align::Distribute);
let justify = display.is_none() && ((align == Align::Justify && stretch_end) || align == Align::Distribute);
// A line that only fits with shrunk spaces is shrunk, the last line of the paragraph too.
let shrink = display.is_none() && self.shrink_spaces && slack < 0.0 && last_tab.is_none();
if shrink {
shrink_line_spaces(pl, &mut sc.xs, c0, c1, content_end, slack);
} else if justify && slack > 0.0 {
justify_line(pl, &mut sc.xs, (c0, c1, align_from), (content_end, slack), rp.align == Align::Distribute);
justify_line(pl, &mut sc.xs, (c0, c1, align_from), (content_end, slack), align == Align::Distribute);
}
}
@@ -692,6 +707,7 @@ impl<'e> Breaker<'e> {
fn finish(mut self, pl: &mut ParaLayout) {
self.hang_drop_cap(pl);
pl.height = self.top;
pl.row_est = self.est_h;
pl.lines = std::mem::take(&mut self.lines);
let label_shift = self.label_shifts.get(pl.label_line()).copied().unwrap_or(0.0);
if let Some(lab) = pl.label.as_mut() {
+3
View File
@@ -401,4 +401,7 @@ pub struct ParaEnv<'a> {
/// Heights of the paragraph's inline text boxes that resize to fit their text, by object
/// index: they take these instead of their saved heights.
pub fitted: &'a [(usize, f32)],
/// The paragraph goes on from the line of the one before, whose mark is hidden (#3986): its
/// list number is counted and sets its indents, but isn't drawn.
pub joined: bool,
}
+6 -3
View File
@@ -533,13 +533,14 @@ fn mark_break_opportunities(clusters: &mut [Cluster], bt: &BreakText, rp: &Resol
}
}
/// The list label, shaped; none on a paragraph containing only a page break: Word hides it there.
/// The list counter has already advanced, so the following item keeps its number.
/// The list label, shaped; none on a paragraph containing only a page break, nor on one that goes
/// on from the line of the paragraph before (#3986): Word hides it there. The list counter has
/// already advanced, so the following item keeps its number.
fn list_label(cx: &Cx, b: &mut Builder, mark_style: u32) -> Option<Label> {
let (p, rp) = (cx.p, cx.rp);
let break_only =
b.clusters.iter().any(|c| c.kind == ClKind::PageBreak) && b.clusters.iter().all(|c| matches!(c.kind, ClKind::PageBreak | ClKind::Marker));
let (text, lvl) = cx.env.label.as_ref().filter(|_| !break_only)?;
let (text, lvl) = cx.env.label.as_ref().filter(|_| !break_only && !cx.env.joined)?;
let rc = cx.res.char(&p.mark.clone().overlaid(&lvl.chr));
// A bullet no installed font can draw would come from whatever icon font has its
// private-use code (Font Awesome's Twitter logo at U+F081, #1683): it shows the level's
@@ -713,6 +714,8 @@ pub fn layout_para(p: &Paragraph, env: &ParaEnv) -> ParaLayout {
left_out: Vec::new(),
enclosures,
auto_space,
joined: env.joined,
row_est: 0.0,
};
let auto = env.doc.settings.auto_hyphenation && !pl.rp.suppress_hyphens;
pl.hyph_after = hyphenation_points(&bt.text, |i| bt.to_para(i), &pl, auto, env.doc.settings.hyphenate_caps, &runs);
+2
View File
@@ -110,6 +110,7 @@ fn new_ctx<'a>(
track_totals: true,
pct_base: None,
quiet_marks: Vec::new(),
joined: None,
stacked_marks: Vec::new(),
mirror: false,
table_keys: Vec::new(),
@@ -211,6 +212,7 @@ fn new_page_builder<'p>(
orig_bottom: 0.0,
prev: None,
after_break_mark: false,
joint: None,
next_starts_page: false,
restart_at: None,
excl: Vec::new(),
+1
View File
@@ -233,6 +233,7 @@ pub fn measure_table_columns(doc: &wordcraft_doc::Document, t: &Table) -> Vec<(f
grid: crate::para::Grid::default(),
fit_objects: false,
fitted: &[],
joined: false,
};
let (mut min, mut max) = (EMPTY_TEXT, EMPTY_TEXT);
if cell.props.vmerge != VMerge::Continue && !cell.props.text_direction.is_turned() {
+405
View File
@@ -13,6 +13,7 @@ mod complex;
mod float_top;
mod grid;
mod header_legacy_float;
mod joined;
mod keep_next_section;
mod ligature;
pub(crate) mod linear;
@@ -2252,6 +2253,410 @@ fn empty_list_paragraph_with_a_hidden_mark_counts_but_shows_nothing() {
}
}
#[test]
fn a_paragraph_with_a_hidden_mark_goes_on_into_the_next_one() {
// Word (#3986): a paragraph whose mark is hidden is shown on one line with the next one. The
// next one's text goes on from where the first one's ends; its number is counted but not
// drawn ("1. AlphaOmega", then "3. Beta") and it takes no line of its own. A paragraph that
// shows nothing in between passes the joint on. In a table cell as in the body.
let doc = |paras: &[(&str, bool)], in_cell: bool| {
let text: Vec<&str> = paras.iter().map(|(t, _)| *t).collect();
let mut d = Document::from_text(&text.join("\n"));
let id = Arc::make_mut(&mut d.numbering).add_list(wordcraft_doc::ListKind::Numbered);
let last = d.body.len() - 1;
let end = paras.last().map_or(0, |(t, _)| t.len());
d.format_paragraphs(&Pos::body(0, 0), &Pos::body(last, end), &|p| {
p.numbering = Some(wordcraft_doc::props::NumRef { num: id, level: 0 });
})
.unwrap();
for (i, (_, hidden)) in paras.iter().enumerate() {
if *hidden {
d.para_mut(StoryRef::Body, &Path::top(i)).unwrap().mark.hidden = Some(true);
}
}
if in_cell {
let mut table = Table::new(1, 1, 400.0);
table.rows[0].cells[0].blocks = std::mem::take(&mut d.body);
d.body = vec![std::sync::Arc::new(Block::Table(table))];
}
d
};
// Each paragraph's number, the top of its first line, and the x its text starts and ends at.
let laid = |d: &Document, show_hidden: bool| {
let l = layout(d, &mut LayoutCache::new(), &LayoutOptions { show_hidden, ..Default::default() });
let lines: Vec<(Option<String>, f32, f32, f32)> = l
.pages
.iter()
.flat_map(|p| &p.items)
.filter_map(|it| match it {
Placed::Lines { para, l0, l1, x, y, .. } => {
let last = l1.checked_sub(1)?;
Some((para.label.as_ref().map(|label| label.text.clone()), *y, x + para.x_of(*l0, 0)?, x + para.x_of(last, para.text_len)?))
}
_ => None,
})
.collect();
lines
};
for in_cell in [false, true] {
let plain = laid(&doc(&[("Alpha", false), ("Beta", false)], in_cell), false);
let beta_y = plain[1].1;
// Text: "Omega" on Alpha's line, after Alpha's text.
let joined = laid(&doc(&[("Alpha", true), ("Omega", false), ("Beta", false)], in_cell), false);
let labels: Vec<_> = joined.iter().map(|l| l.0.as_deref()).collect();
assert_eq!(labels, vec![Some("1."), None, Some("3.")], "in_cell={in_cell}");
assert!((joined[1].1 - joined[0].1).abs() < 0.01, "in_cell={in_cell}: Omega at {} not on Alpha's line {}", joined[1].1, joined[0].1);
assert!((joined[1].2 - joined[0].3).abs() < 0.5, "in_cell={in_cell}: Omega starts at {}, Alpha ends at {}", joined[1].2, joined[0].3);
assert!((joined[2].1 - beta_y).abs() < 0.01, "in_cell={in_cell}: Beta at {} instead of {beta_y}", joined[2].1);
// An empty paragraph: no line of its own, no number.
let empty = laid(&doc(&[("Alpha", true), ("", false), ("Beta", false)], in_cell), false);
let labels: Vec<_> = empty.iter().map(|l| l.0.as_deref()).collect();
assert_eq!(labels, vec![Some("1."), None, Some("3.")], "in_cell={in_cell}");
assert!((empty[2].1 - beta_y).abs() < 0.01, "in_cell={in_cell}: Beta at {} instead of {beta_y}", empty[2].1);
// Through an empty paragraph with a hidden mark (which shows nothing).
let chain = laid(&doc(&[("Alpha", true), ("", true), ("Omega", false), ("Beta", false)], in_cell), false);
let labels: Vec<_> = chain.iter().map(|l| l.0.as_deref()).collect();
assert_eq!(labels, vec![Some("1."), None, None, Some("4.")], "in_cell={in_cell}");
assert!((chain[2].1 - chain[0].1).abs() < 0.01, "in_cell={in_cell}: Omega not on Alpha's line");
// Hidden text shown: each paragraph on its own line, with its number.
let shown = laid(&doc(&[("Alpha", true), ("Omega", false), ("Beta", false)], in_cell), true);
let labels: Vec<_> = shown.iter().map(|l| l.0.as_deref()).collect();
assert_eq!(labels, vec![Some("1."), Some("2."), Some("3.")], "in_cell={in_cell}");
assert!(shown[1].1 > shown[0].1 + 5.0, "in_cell={in_cell}: shown hidden text keeps the paragraphs apart");
}
// A click on the joined text lands in the paragraph it belongs to.
let d = doc(&[("Alpha", true), ("Omega", false), ("Beta", false)], false);
let l = lay(&d);
let omega = l.caret(&Pos::body(1, 2)).unwrap();
let hit = l.hit(omega.page, omega.x + 0.5, omega.top + omega.height / 2.0, StoryRef::Body).unwrap();
assert_eq!(hit.path, Path::top(1));
}
#[test]
fn text_going_on_from_a_larger_heading_sits_on_its_baseline() {
// A heading with a hidden mark followed by body text (a style separator in Word, #3986): the
// body text's first line goes on beside the heading, on the heading's baseline; its next lines
// start at the margin, below both.
let body = "Body text that is long enough to wrap onto a second line in this column. ".repeat(3);
let mut d = Document::from_text(&format!("Heading\n{body}"));
d.format_range(&Pos::body(0, 0), &Pos::body(0, 7), &|c| c.size = Some(18.0)).unwrap();
d.para_mut(StoryRef::Body, &Path::top(0)).unwrap().mark.hidden = Some(true);
let l = lay(&d);
let lines: Vec<(Path, f32, f32, f32)> = l.pages[0]
.items
.iter()
.filter_map(|it| match it {
Placed::Lines { path, para, l0, l1, x, y, .. } => {
let first = para.lines.get(*l0)?;
let (x, y) = (*x, *y);
Some((*l0..*l1).filter_map(move |li| {
let line = para.lines.get(li)?;
Some((path.clone(), y + line.baseline - first.top, x + para.x_of(li, line.start)?, y + line.top - first.top))
}))
}
_ => None,
})
.flatten()
.collect();
let heading = lines.iter().find(|l| l.0 == Path::top(0)).unwrap();
let body: Vec<_> = lines.iter().filter(|l| l.0 == Path::top(1)).collect();
assert!(body.len() >= 2, "{lines:?}");
assert!((body[0].1 - heading.1).abs() < 0.01, "body baseline {} vs heading {}", body[0].1, heading.1);
assert!(body[0].2 > 100.0, "the body text starts after the heading's, at {}", body[0].2);
assert!((body[1].2 - 72.0).abs() < 0.5, "the next line starts at the margin, not at {}", body[1].2);
assert!(body[1].3 > heading.1, "the next line is below the shared one");
}
#[test]
fn a_text_box_anchored_in_a_paragraph_with_a_hidden_mark_is_not_joined() {
// A text box anchored in the first paragraph lays its own story out, whose first line has
// the same path as that paragraph (#3986). The next paragraph goes on from the paragraph's
// text, not from the box's, which is drawn after it.
let mut d = Document::from_text("Alpha\nOmega");
d.para_mut(StoryRef::Body, &Path::top(0)).unwrap().mark.hidden = Some(true);
let float = wordcraft_doc::para::Float {
wrap: wordcraft_doc::para::Wrap::InFrontOfText,
h_rel: wordcraft_doc::para::Anchor::Column,
v_rel: wordcraft_doc::para::Anchor::Paragraph,
x: 200.0,
y: 100.0,
dist: 0.0,
..Default::default()
};
text_box(&mut d, 0, "Box", 100.0, 40.0, float);
let l = lay(&d);
// The top of a story's line at a block, and the x its text starts and ends at.
let line = |story: StoryRef, block: usize| {
l.pages[0].items.iter().find_map(|it| match it {
Placed::Lines { story: s, path, para, l0, l1, x, y, .. } if *s == story && *path == Path::top(block) => {
Some((*y, x + para.x_of(*l0, 0)?, x + para.x_of(l1.checked_sub(1)?, para.text_len)?))
}
_ => None,
})
};
let (alpha, omega) = (line(StoryRef::Body, 0).unwrap(), line(StoryRef::Body, 1).unwrap());
assert!((omega.0 - alpha.0).abs() < 0.01, "Omega at {} not on Alpha's line {}", omega.0, alpha.0);
assert!((omega.1 - alpha.2).abs() < 0.5, "Omega starts at {}, Alpha ends at {}", omega.1, alpha.2);
}
#[test]
fn a_joined_paragraph_moved_to_the_next_page_has_its_own_number() {
// A paragraph going on from one with a hidden mark (#3986) that moves whole to the next page
// (its lines kept together) no longer shares that line: there its number is drawn and its
// text starts at its own indent.
let omega = "Omega ".repeat(60);
let build = |filler: usize| {
let mut text: Vec<String> = (0..filler).map(|i| format!("Filler {i}")).collect();
text.push("Alpha".into());
text.push(omega.clone());
let mut d = Document::from_text(&text.join("\n"));
let id = Arc::make_mut(&mut d.numbering).add_list(wordcraft_doc::ListKind::Numbered);
d.format_paragraphs(&Pos::body(filler, 0), &Pos::body(filler + 1, omega.len()), &|p| {
p.numbering = Some(wordcraft_doc::props::NumRef { num: id, level: 0 });
})
.unwrap();
d.para_mut(StoryRef::Body, &Path::top(filler)).unwrap().mark.hidden = Some(true);
d.para_mut(StoryRef::Body, &Path::top(filler + 1)).unwrap().props.keep_lines = Some(true);
d
};
// The page of a paragraph's first line, with its number there.
let first = |l: &DocLayout, block: usize| {
l.pages.iter().enumerate().find_map(|(pi, page)| {
page.items.iter().find_map(|it| match it {
Placed::Lines { path, para, l0: 0, .. } if *path == Path::top(block) => {
Some((pi, para.label.as_ref().map(|label| label.text.clone())))
}
_ => None,
})
})
};
for filler in 20..80 {
let d = build(filler);
let l = lay(&d);
let (Some((0, alpha)), Some((1, omega_label))) = (first(&l, filler), first(&l, filler + 1)) else { continue };
assert_eq!(alpha.as_deref(), Some("1."));
assert_eq!(omega_label.as_deref(), Some("2."), "the moved paragraph draws its number");
let (a, o) = (l.caret(&Pos::body(filler, 0)).unwrap(), l.caret(&Pos::body(filler + 1, 0)).unwrap());
assert_eq!(o.page, 1);
assert!((o.x - a.x).abs() < 0.5, "the moved paragraph's text starts at its own indent: {} vs {}", o.x, a.x);
return;
}
panic!("no filler put Alpha last on the first page with the joined paragraph moved on");
}
#[test]
fn a_joined_first_word_that_does_not_fit_goes_on_the_next_line_at_the_indent() {
// Word (#3986): when the next paragraph's first word doesn't fit after the first one's text,
// it goes on the next line, still joined (no number drawn), at the indent of the list's text.
let build = |n: usize| {
let alpha = vec!["aa"; n].join(" ");
let omega = "Omegaomegaomega tail";
let mut d = Document::from_text(&format!("{alpha}\n{omega}"));
let id = Arc::make_mut(&mut d.numbering).add_list(wordcraft_doc::ListKind::Numbered);
d.format_paragraphs(&Pos::body(0, 0), &Pos::body(1, omega.len()), &|p| {
p.numbering = Some(wordcraft_doc::props::NumRef { num: id, level: 0 });
})
.unwrap();
d.para_mut(StoryRef::Body, &Path::top(0)).unwrap().mark.hidden = Some(true);
(d, alpha.len())
};
for n in 20..200 {
let (d, alpha_len) = build(n);
let l = lay(&d);
let (end, start) = (l.caret(&Pos::body(0, alpha_len)).unwrap(), l.caret(&Pos::body(1, 0)).unwrap());
if (start.top - end.top).abs() < 0.5 {
continue; // still on the shared line
}
let indent = l.caret(&Pos::body(0, 0)).unwrap().x;
assert!(start.top > end.top, "the first word goes below the shared line");
assert!((start.x - indent).abs() < 0.5, "at the list text's indent {indent}, not {}", start.x);
let label = l.pages.iter().flat_map(|p| &p.items).find_map(|it| match it {
Placed::Lines { path, para, .. } if *path == Path::top(1) => Some(para.label.as_ref().map(|label| label.text.clone())),
_ => None,
});
assert_eq!(label, Some(None), "still joined: no number drawn");
return;
}
panic!("no length of the first paragraph left its last line too full for the next one's first word");
}
#[test]
fn a_shared_line_is_one_line_for_line_numbers_and_vertical_alignment() {
// Word (#3986): the line two paragraphs share through a hidden mark is one line. Line
// numbering gives it one number ("Line one", the shared line, "After": 1, 2, 3), and justified
// vertical alignment keeps the two paragraphs together as one block.
let doc = |valign: wordcraft_doc::section::PageVAlign| {
let mut d = Document::from_text("Line one\nAlpha\nOmega\nAfter");
for b in d.body.iter_mut() {
if let Block::Para(p) = std::sync::Arc::make_mut(b) {
p.props.space_before = Some(0.0);
p.props.space_after = Some(0.0);
}
}
d.para_mut(StoryRef::Body, &Path::top(1)).unwrap().mark.hidden = Some(true);
d.last_section.valign = valign;
d
};
let mut d = doc(wordcraft_doc::section::PageVAlign::Top);
d.last_section.line_numbers = Some(Default::default());
let l = lay(&d);
let numbers: Vec<f32> = l.pages[0]
.items
.iter()
.filter_map(|it| match it {
Placed::Lines { story, y, .. } if *story == DECOR_STORY => Some(*y),
_ => None,
})
.collect();
assert_eq!(numbers.len(), 3, "one number per shown line: {numbers:?}");
assert!(numbers.windows(2).all(|w| w[1] > w[0] + 5.0), "no two numbers on one line: {numbers:?}");
let l = lay(&doc(wordcraft_doc::section::PageVAlign::Justify));
let y = |off: (usize, usize)| l.caret(&Pos::body(off.0, off.1)).unwrap().top;
assert!((y((2, 0)) - y((1, 0))).abs() < 0.01, "Omega stays on Alpha's line: {} vs {}", y((2, 0)), y((1, 0)));
let (g1, g2) = (y((1, 0)) - y((0, 0)), y((3, 0)) - y((1, 0)));
assert!(g1 > 100.0 && (g1 - g2).abs() < 0.05, "equal gaps around the shared line: {g1} {g2}");
}
#[test]
fn a_joined_line_with_a_hanging_indent_still_starts_after_the_text_before() {
// The joined paragraph's first-line indent reaches left of the margin: its text still starts
// after the text of the paragraph before, never left of it (#3986).
let mut d = Document::from_text("Alpha\na b c");
d.para_mut(StoryRef::Body, &Path::top(0)).unwrap().mark.hidden = Some(true);
let q = d.para_mut(StoryRef::Body, &Path::top(1)).unwrap();
q.props.indent_left = Some(0.0);
q.props.indent_first = Some(-36.0);
let l = lay(&d);
let (end, start) = (l.caret(&Pos::body(0, 5)).unwrap(), l.caret(&Pos::body(1, 0)).unwrap());
assert!((start.top - end.top).abs() < 0.01, "on the shared line");
assert!(start.x >= end.x - 0.01, "after Alpha: starts at {}, Alpha ends at {}", start.x, end.x);
}
#[test]
fn a_joined_paragraphs_shading_and_borders_start_below_the_shared_line() {
// Word (synthetic DOCX, 16.0.20625): the line a paragraph shares with the one before, whose
// mark is hidden, shows that one's shading and borders, not its own. Its own start on its next
// line (no top border there), and a paragraph that is all on the shared line shows neither and
// takes no room for its borders; what follows starts below the first one's bottom border.
let yellow = wordcraft_doc::props::Rgb(0xFF, 0xFF, 0);
let boxed = || Some(Borders::all(Border { space: 1.0, ..Border::single(1.5) }));
// "Alpha" (mark hidden) with `first`'s formatting, then `second` with its own, then "After".
let doc = |first: &dyn Fn(&mut ParaProps), second_text: &str, second: &dyn Fn(&mut ParaProps), in_cell: bool| {
let mut d = Document::from_text(&format!("Alpha\n{second_text}\nAfter"));
let a = d.para_mut(StoryRef::Body, &Path::top(0)).unwrap();
a.mark.hidden = Some(true);
first(&mut a.props);
second(&mut d.para_mut(StoryRef::Body, &Path::top(1)).unwrap().props);
if in_cell {
let mut table = Table::new(1, 1, 400.0);
table.props.borders = Some(Borders::all(Border { style: BorderStyle::None, width: 0.0, color: None, space: 0.0 }));
table.rows[0].cells[0].blocks = std::mem::take(&mut d.body);
d.body = vec![std::sync::Arc::new(Block::Table(table))];
}
d
};
let path = |i: u32, in_cell: bool| if in_cell { Path(vec![0, 0, 0, i]) } else { Path::top(i as usize) };
// The shared line (top, bottom), "After"'s top, fills and the paragraphs' horizontal rules.
let laid = |d: &Document, in_cell: bool| {
crate::test_fonts();
let l = lay(d);
let at = |i: u32| l.caret(&Pos { story: StoryRef::Body, path: path(i, in_cell), off: 0 }).unwrap();
let (alpha, after) = (at(0), at(2));
let fills: Vec<Rect> = l.pages[0]
.items
.iter()
.filter_map(|i| if let Placed::Fill { rect, color } = i { (*color == yellow).then_some(*rect) } else { None })
.collect();
let rules: Vec<(f32, f32, f32, f32)> = l.pages[0]
.items
.iter()
.filter_map(
|i| if let Placed::Rule { x0, y0, x1, y1, border } = i { (border.width == 1.5).then_some((*x0, *y0, *x1, *y1)) } else { None },
)
.collect();
(alpha.top, alpha.top + alpha.height, after.top, fills, rules)
};
let none = |_: &mut ParaProps| {};
let long = format!("Omega {}", "zeta ".repeat(30));
for in_cell in [false, true] {
let (top, bottom, after, ..) = laid(&doc(&none, "Omega", &none, in_cell), in_cell);
// The second one shaded, all of it on the shared line: no shading over "Alpha".
let (t, _, a, fills, _) = laid(&doc(&none, "Omega", &|p| p.shading = Some(yellow), in_cell), in_cell);
assert!(fills.is_empty(), "in_cell={in_cell}: {fills:?}");
assert!((t - top).abs() < 0.01 && (a - after).abs() < 0.01, "in_cell={in_cell}");
// Shaded and running on: the shading starts on its own next line.
let (_, b, _, fills, _) = laid(&doc(&none, &long, &|p| p.shading = Some(yellow), in_cell), in_cell);
assert_eq!(fills.len(), 1, "in_cell={in_cell}: {fills:?}");
assert!(fills[0].y >= b - 0.01, "in_cell={in_cell}: shading from {} over the shared line ending at {b}", fills[0].y);
// The first one shaded: the shared line is.
let (t, b, _, fills, _) = laid(&doc(&|p| p.shading = Some(yellow), "Omega", &none, in_cell), in_cell);
assert_eq!(fills.len(), 1, "in_cell={in_cell}: {fills:?}");
assert!(fills[0].y <= t + 0.01 && fills[0].bottom() >= b - 0.01, "in_cell={in_cell}: {fills:?}");
// The second one boxed, all of it on the shared line: no borders, no room for them.
let (t, _, a, _, rules) = laid(&doc(&none, "Omega", &|p| p.borders = boxed(), in_cell), in_cell);
assert!(rules.is_empty(), "in_cell={in_cell}: {rules:?}");
assert!((t - top).abs() < 0.01 && (a - after).abs() < 0.01, "in_cell={in_cell}: {t} {a}");
// Boxed and running on: its box is around its own lines, open at the top, with its bottom
// border's room under it; the shared line stays where it is.
let (t, b, _, _, rules) = laid(&doc(&none, &long, &|p| p.borders = boxed(), in_cell), in_cell);
assert!((t - top).abs() < 0.01, "in_cell={in_cell}: shared line moved to {t}");
assert_eq!(rules.iter().filter(|r| r.1 == r.3).count(), 1, "in_cell={in_cell}: only the bottom border: {rules:?}");
assert!(rules.iter().all(|r| r.1.min(r.3) >= b - 0.01), "in_cell={in_cell}: a border over the shared line: {rules:?}");
// The first one boxed: what follows starts below its bottom border.
let (_, _, a, _, rules) = laid(&doc(&|p| p.borders = boxed(), "Omega", &none, in_cell), in_cell);
let bottom_rule = rules.iter().filter(|r| r.1 == r.3).map(|r| r.1).fold(f32::MIN, f32::max);
assert!(bottom_rule > bottom, "in_cell={in_cell}: {rules:?}");
assert!(a >= bottom_rule + 0.75 - 0.01, "in_cell={in_cell}: After at {a}, over the border at {bottom_rule}");
}
}
#[test]
fn a_joined_paragraph_keeps_its_revision_for_the_cache_and_the_word_being_typed() {
// The joined paragraph is laid out as a copy without its space before (#3986). The copy keeps
// the document's revision: the word being typed in it gets no squiggle, and laying the
// document out again reuses its layouts.
crate::test_fonts();
let mut d = Document::from_text("Alpha\nhelo wrld\nAfter");
d.para_mut(StoryRef::Body, &Path::top(0)).unwrap().mark.hidden = Some(true);
let rev = d.para(StoryRef::Body, &Path::top(1)).unwrap().rev;
let marks = |l: &DocLayout| -> Vec<String> {
l.pages[0]
.items
.iter()
.filter_map(|i| match i {
Placed::Lines { para, path, .. } if *path == Path::top(1) => {
Some(para.issues.iter().filter(|i| !i.2).map(|i| "helo wrld"[i.0..i.1].to_string()).collect::<Vec<_>>())
}
_ => None,
})
.flatten()
.collect()
};
let mut c = LayoutCache::new();
let opts = LayoutOptions { proofing: true, ..LayoutOptions::default() };
let both = layout(&d, &mut c, &opts);
assert_eq!(marks(&both), ["helo", "wrld"]);
let (a, b) = (both.caret(&Pos::body(0, 5)).unwrap(), both.caret(&Pos::body(1, 0)).unwrap());
assert!((a.top - b.top).abs() < 0.01, "joined");
let misses = c.misses;
let again = layout(&d, &mut c, &opts);
assert_eq!(marks(&again), ["helo", "wrld"]);
assert_eq!(c.misses, misses, "nothing laid out again");
let typing = layout(&d, &mut c, &LayoutOptions { typing_word: Some(TypingWord { rev, start: 5, end: 9 }), ..opts.clone() });
assert_eq!(marks(&typing), ["helo"], "the word being typed is left alone");
}
#[test]
fn a_numbered_heading_opening_with_a_page_break_takes_its_number_along() {
crate::test_fonts();
+165
View File
@@ -0,0 +1,165 @@
//! A paragraph going on from the line of one whose mark is hidden (#3986): what changes when it
//! moves off that line or is placed apart from it.
use super::lay;
use crate::{Arc, DocLayout, Placed, StoryRef, hit};
use wordcraft_doc::para::{Anchor, Float, Wrap};
use wordcraft_doc::props::{Border, Borders, LineSpacing, NumRef, TextFrame};
use wordcraft_doc::{Block, Document, Path, Pos, Table};
/// A table around the document's paragraphs (the cell paths are `[0, 0, 0, i]`).
fn in_cell(d: &mut Document) {
let mut table = Table::new(1, 1, 400.0);
table.rows[0].cells[0].blocks = std::mem::take(&mut d.body);
d.body = vec![Arc::new(Block::Table(table))];
}
/// The top of the lines of the body block or cell paragraph at `path`.
fn top_of(l: &DocLayout, path: &Path) -> f32 {
l.pages[0]
.items
.iter()
.find_map(|it| match it {
Placed::Lines { story: StoryRef::Body, path: p, y, .. } if p == path => Some(*y),
_ => None,
})
.unwrap_or_else(|| panic!("no lines at {path:?}"))
}
#[test]
fn a_joined_paragraph_moved_to_the_next_page_gets_its_top_border() {
// Sharing the line it takes no room for a top border; moved whole to the next page it is
// laid out on its own and draws one above its first line.
let omega = "Omega ".repeat(60);
let boxed = Some(Borders::all(Border { space: 1.0, ..Border::single(1.5) }));
for filler in 20..80 {
let mut text: Vec<String> = (0..filler).map(|i| format!("Filler {i}")).collect();
text.push("Alpha".into());
text.push(omega.clone());
let mut d = Document::from_text(&text.join("\n"));
d.para_mut(StoryRef::Body, &Path::top(filler)).unwrap().mark.hidden = Some(true);
let o = d.para_mut(StoryRef::Body, &Path::top(filler + 1)).unwrap();
(o.props.keep_lines, o.props.borders) = (Some(true), boxed);
let l = lay(&d);
let o = l.caret(&Pos::body(filler + 1, 0)).unwrap();
if l.caret(&Pos::body(filler, 0)).unwrap().page != 0 || o.page != 1 {
continue;
}
let tops = l.pages[1].items.iter().filter(|i| matches!(i, Placed::Rule { y0, y1, border, .. } if y0 == y1 && border.width == 1.5));
let above = tops.filter(|i| matches!(i, Placed::Rule { y0, .. } if *y0 < o.top)).count();
assert_eq!(above, 1, "the moved paragraph draws its top border above its first line");
return;
}
panic!("no filler moved the joined paragraph to the next page");
}
#[test]
fn a_joined_first_line_below_the_shared_line_does_not_cut_the_line_above() {
// "Omega"'s first word does not fit after "Alpha", so its first line goes below; its indent
// (inside "Alpha"'s text) must not cut "Alpha"'s hit extent.
let mut d = Document::from_text(&format!("Alpha\n{} tail", "W".repeat(48)));
d.para_mut(StoryRef::Body, &Path::top(0)).unwrap().mark.hidden = Some(true);
d.para_mut(StoryRef::Body, &Path::top(1)).unwrap().props.indent_left = Some(20.0);
let l = lay(&d);
let lines = hit::page_lines(&l.pages[0], StoryRef::Body);
let alpha = lines.iter().find(|h| h.path == &Path::top(0)).unwrap();
let omega = lines.iter().find(|h| h.path == &Path::top(1) && h.li == 0).unwrap();
assert!(omega.top > alpha.top + 1.0, "setup: the first word moved below the shared line");
let text_end = l.caret(&Pos::body(0, 5)).unwrap().x;
assert!(alpha.right >= text_end - 0.5, "Alpha's line reaches {} but its text ends at {text_end}", alpha.right);
}
#[test]
fn a_joined_paragraphs_drawings_are_relative_to_the_shared_line() {
// A drawing anchored to the paragraph, at its top: the paragraph's top is the shared line's,
// not the end of the paragraph before.
let mut d = Document::from_text("Alpha\nOmega\nAfter");
d.para_mut(StoryRef::Body, &Path::top(0)).unwrap().mark.hidden = Some(true);
let float =
Float { wrap: Wrap::InFrontOfText, h_rel: Anchor::Column, v_rel: Anchor::Paragraph, x: 200.0, y: 0.0, dist: 0.0, ..Default::default() };
super::text_box_at(&mut d, &Pos::body(1, 0), "Box", 100.0, 40.0, float);
in_cell(&mut d);
let l = lay(&d);
let alpha = top_of(&l, &Path(vec![0, 0, 0, 0]));
let boxed = l.pages[0].items.iter().find_map(|it| match it {
Placed::Lines { story: StoryRef::Part(_), y, .. } => Some(*y),
_ => None,
});
let boxed = boxed.expect("the box's text is laid out");
assert!(boxed < alpha + 12.0, "the box's text at {boxed} is below the shared line at {alpha}");
}
#[test]
fn a_text_frame_after_a_hidden_mark_is_not_joined() {
// A framed paragraph is placed apart, so it shares no line with the one before: its number is
// drawn (it is counted either way). The frame is its own, or given by the table's style.
let frame =
TextFrame { x_align: Some("right".into()), h_anchor: "text".into(), v_anchor: "text".into(), wrap: "around".into(), ..Default::default() };
for from_style in [false, true] {
let mut d = Document::from_text("Alpha\n7");
let id = Arc::make_mut(&mut d.numbering).add_list(wordcraft_doc::ListKind::Numbered);
d.format_paragraphs(&Pos::body(0, 0), &Pos::body(1, 1), &|p| p.numbering = Some(NumRef { num: id, level: 0 })).unwrap();
d.para_mut(StoryRef::Body, &Path::top(0)).unwrap().mark.hidden = Some(true);
// From the table's style, the frame is given to "Alpha" too: zero dimensions cancel it there.
let (at, own) = if from_style { (0, TextFrame { w: Some(0.0), h: Some(0.0), ..frame.clone() }) } else { (1, frame.clone()) };
d.para_mut(StoryRef::Body, &Path::top(at)).unwrap().props.frame = Some(own);
in_cell(&mut d);
if from_style {
Arc::make_mut(&mut d.styles).get_mut("TableGrid").expect("Table Grid").para.frame = Some(frame.clone());
if let Some(Block::Table(t)) = d.body.first_mut().map(Arc::make_mut) {
t.props.style = Some("TableGrid".into());
}
}
let l = lay(&d);
let label = l.pages[0].items.iter().find_map(|it| match it {
Placed::Lines { path, para, .. } if path.0 == [0, 0, 0, 1] => Some(para.label.is_some()),
_ => None,
});
assert_eq!(label, Some(true), "the framed paragraph keeps its number (frame from the table style: {from_style})");
}
}
#[test]
fn a_joined_paragraphs_later_lines_start_below_a_taller_shared_line() {
// A heading whose mark is hidden, then body text going on from it: the text's first line
// shares the heading's line; its later lines start below that line and the heading's bottom
// border, not inside it (Word), whatever the text's line spacing.
let spacings = [None, Some(LineSpacing::Exactly(12.0)), Some(LineSpacing::AtLeast(12.0)), Some(LineSpacing::Multiple(2.0))];
// A large word that fits the first line of the text laid out alone but wraps off the
// narrower shared line onto the second (`big`), so the two first lines differ in height.
let cases = [false, true].into_iter().flat_map(|c| spacings.into_iter().flat_map(move |s| [(c, s, false, None), (c, s, true, None)]));
let big = [60, 70, 80].into_iter().flat_map(|at| [(false, None, false, Some(at)), (true, None, false, Some(at))]);
for (cell, spacing, bordered, large) in cases.chain(big) {
let case = format!("cell {cell}, {spacing:?}, border {bordered}, large word at {large:?}");
let mut d = Document::from_text(&format!("Heading\n{}", "body text ".repeat(40)));
d.format_range(&Pos::body(0, 0), &Pos::body(0, 7), &|c| c.size = Some(40.0)).unwrap();
if let Some(at) = large {
d.format_range(&Pos::body(1, at), &Pos::body(1, at + 4), &|c| c.size = Some(30.0)).unwrap();
}
let heading = d.para_mut(StoryRef::Body, &Path::top(0)).unwrap();
heading.mark.hidden = Some(true);
if bordered {
heading.props.borders = Some(Borders { bottom: Some(Border { space: 4.0, ..Border::single(1.5) }), ..Default::default() });
}
d.para_mut(StoryRef::Body, &Path::top(1)).unwrap().props.line_spacing = spacing;
if cell {
in_cell(&mut d);
}
let l = lay(&d);
let lines = hit::page_lines(&l.pages[0], StoryRef::Body);
let heading = lines.iter().find(|h| h.path.0.last() == Some(&0)).unwrap();
// The shared line's bottom, with the heading's bottom border under it.
let rule = l.pages[0].items.iter().filter_map(|it| match it {
Placed::Rule { y0, y1, border, .. } if y0 == y1 && border.width == 1.5 => Some(*y0),
_ => None,
});
let floor = rule.fold(heading.bottom, f32::max);
assert!(!bordered || floor > heading.bottom, "setup: the border is drawn below the shared line ({case})");
let body: Vec<_> = lines.iter().filter(|h| h.path.0.last() == Some(&1)).collect();
assert!(body.len() > 2, "setup: the body text runs to several lines ({case})");
assert!(body[0].top < heading.bottom - 1.0, "the first line at {} shares the heading's line ({case})", body[0].top);
for line in &body[1..] {
assert!(line.top >= floor - 0.01, "line {} at {} starts inside the shared line, ending {floor} ({case})", line.li, line.top);
}
}
}
+2 -2
View File
@@ -16,7 +16,7 @@ craft = { workspace = true, features = [
"color", "color-ui", "control", "draw", "font-manager", "gpu", "menu", "pages", "print", "review", "table", "text",
"text-find", "web-api", "web-host", "window",
] }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "b436ae992591173ce53fdb1314421ba2d8897e49" }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541" }
wordcraft-geom = { workspace = true, features = ["image"] }
wordcraft-doc = { workspace = true }
wordcraft-fonts = { workspace = true }
@@ -76,7 +76,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 = "b436ae992591173ce53fdb1314421ba2d8897e49", features = ["subset"] }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", features = ["subset"] }
serde_json = { workspace = true }
toml = "1"
+9 -7
View File
@@ -1,5 +1,5 @@
use craft::host::{PickId, Picked};
use craft::platform::open::{DropTarget, DroppedFile, Intake};
use craft::platform::open::{DroppedFile, Intake};
use craft::quit::{CloseAnswer, CloseGuard, CloseScope, GuardStep};
use craft::ui::dialog::{DialogId, DialogResult, UnsavedChangesDialog};
use craft::ui::shell::embed::CloseDecision;
@@ -333,7 +333,7 @@ impl WordApp {
// A save that never reached its destination leaves no stamp of it, when the document is as
// the save left it (an edit since keeps its own marks and stays unsaved).
let mut undone = false;
if !matches!(picked, Picked::Paths(_) | Picked::Downloaded(_))
if !matches!(picked, Picked::Paths(_) | Picked::Saved { .. } | Picked::Downloaded(_))
&& save.document == current
&& save.rev == self.session.rev()
&& let Some(undo) = save.undo_stamp.take()
@@ -342,7 +342,7 @@ impl WordApp {
undone = true;
}
// A download the browser accepted is a finished save too: the page holds no file of it.
if matches!(picked, Picked::Paths(_) | Picked::Downloaded(_)) {
if matches!(picked, Picked::Paths(_) | Picked::Saved { .. } | Picked::Downloaded(_)) {
log::info!("saved {} through the save picker", save.name);
// The page now holds the document as that file (a hosted Save As or first Save, S-L159):
// the next Save goes back to it. A download names nothing the app could reopen.
@@ -385,12 +385,14 @@ impl WordApp {
}
let result = match picked {
// Only when nothing changed since and no later save of it is still unconfirmed.
Picked::Paths(_) | Picked::Downloaded(_) if !self.session.dirty && self.session.rev() == save.rev && !self.save_unconfirmed() => {
Picked::Paths(_) | Picked::Saved { .. } | Picked::Downloaded(_)
if !self.session.dirty && self.session.rev() == save.rev && !self.save_unconfirmed() =>
{
let step = self.with_guard(|g| g.saved());
self.drive_guard(step, None)
}
// Edited while the picker was open (those edits may not be written yet): ask again.
Picked::Paths(_) | Picked::Downloaded(_) => {
Picked::Paths(_) | Picked::Saved { .. } | Picked::Downloaded(_) => {
let step = self.with_guard(|g| g.retry_after_failure());
self.drive_guard(step, None)
}
@@ -636,7 +638,7 @@ impl WordApp {
let Some(intake) = self.services.intake.as_ref() else { return };
for item in intake.take() {
match item {
Intake::Dropped { files, target } => self.open_dropped(&files, target),
Intake::Dropped { files } => self.open_dropped(&files),
Intake::Open(paths) | Intake::OpenFor { paths, .. } => {
for p in paths {
// A path that is not Unicode cannot be passed on as text: skipped.
@@ -668,7 +670,7 @@ impl WordApp {
/// Route files dropped on the window, in drop order: the one place the drop rules live. A drop
/// behind a modal dialog does nothing, since it would insert a picture or open a document
/// under it. Every drop target routes by file kind, so `_target` does not change the routing.
pub(crate) fn open_dropped(&mut self, files: &[DroppedFile], _target: DropTarget) {
pub(crate) fn open_dropped(&mut self, files: &[DroppedFile]) {
if self.modal_open() {
return;
}
+6 -3
View File
@@ -4,9 +4,9 @@ use craft::behavior::IconId;
use craft::keymap::CommandRef;
use craft::ui::buttons::IconButton;
use craft::ui::contract::{Bind, Props as _, Show as _, TooltipSpec};
use craft::ui::menu::HelpEntry;
use craft::ui::menu::search::{HelpEntry, SearchIndex, SearchWords, Synonyms};
use craft::ui::patterns::panels::{CommandPalette, PaletteFace};
use craft::ui::runtime::env::{Label, WordTemplate};
use craft::ui::runtime::env::{Env, Label, WordTemplate};
use craft::ui::runtime::inspect;
use egui::Ui;
use serde_json::json;
@@ -64,7 +64,10 @@ pub(super) fn show(app: &mut WordApp, ui: &mut Ui, compact: bool) -> egui::Rect
}
rect = Some(button.response.rect);
}
let out = CommandPalette::new(name.clone(), &entries, Bind::bound(&mut open))
let env = Env::of(ui);
let view = env.view();
let index = SearchIndex::new(&view, &entries, &Synonyms::of(&view.words::<SearchWords>()));
let out = CommandPalette::new(name.clone(), &entries, &index, Bind::bound(&mut open))
.face(if compact { PaletteFace::Dialog } else { PaletteFace::InPlace })
.placeholder(Label::from(name.clone()))
.suggested((Label::from(tl!("Suggested").to_string()), suggested))
+3 -3
View File
@@ -13,7 +13,7 @@ use craft::color_ui::ui::{ColorPickerDialog, ColorPickerDialogLayout, ColorPicke
use craft::keymap::CommandRef;
use craft::theme::Srgba;
use craft::ui::buttons::{SplitButton, SplitMenu};
use craft::ui::choice::SwatchTable;
use craft::ui::choice::{CellMarks, SwatchTable};
use craft::ui::contract::{BodyCx, Hover, NoValue, Props as _, Show as _, clicked};
use craft::ui::dialog::{DialogId, DialogResult};
use craft::ui::menu::{MenuItem, MenuItemOutput};
@@ -307,7 +307,7 @@ fn swatch_table(
let out = SwatchTable::new(name.to_string(), &swatches)
.per_row(per_row)
.tips(true)
.marked(|i: &usize| colors.get(*i).copied() == current && current.is_some())
.marks(|i: &usize| CellMarks::default().edge(colors.get(*i).copied() == current && current.is_some()))
.show_all(ui);
let picked = out.selected.and_then(|i| colors.get(i).copied());
let preview = match out.preview {
@@ -490,7 +490,7 @@ fn highlight_body(ui: &mut Ui, app: &mut WordApp, cx: &mut BodyCx<'_>) -> ColorP
let out = SwatchTable::new("Highlight Colors".to_string(), &swatches)
.per_row(5)
.tips(true)
.marked(|i: &usize| shown.get(*i).is_some_and(|(h, _)| h.ooxml() == in_effect))
.marks(|i: &usize| CellMarks::default().edge(shown.get(*i).is_some_and(|(h, _)| h.ooxml() == in_effect)))
.show_all(ui);
let mut picked = None;
if let Some((h, c)) = out.selected.and_then(|i| shown.get(i)) {
+2 -2
View File
@@ -291,12 +291,12 @@ fn chart_grid(ui: &mut Ui, colors: [Color32; 3], form: &mut ChartTypeForm) -> bo
let mut activated = false;
for event in out.response.events {
match event {
CollectionEvent::Selection(SelectionChange::Set(keys)) => {
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => {
if let Some(kind) = keys.last().and_then(|k| kinds.get(*k)) {
form.kind = *kind;
}
}
CollectionEvent::Selection(SelectionChange::Toggle(key)) => {
CollectionEvent::Selection { change: SelectionChange::Toggle(key), .. } => {
if let Some(kind) = kinds.get(key) {
form.kind = *kind;
}
+1 -1
View File
@@ -107,7 +107,7 @@ pub(super) fn list_index(ui: &mut Ui, label: &Label, rows: &[String], current: O
let mut picked = Picked { selected: None, activated: None };
for event in events {
match event {
CollectionEvent::Selection(SelectionChange::Set(set)) => picked.selected = set.last().copied(),
CollectionEvent::Selection { change: SelectionChange::Set(set), .. } => picked.selected = set.last().copied(),
CollectionEvent::Activate(row) => {
picked.selected = Some(row);
picked.activated = Some(row);
@@ -501,7 +501,7 @@ fn symbol_body(
&mut |t, _| Tab::new(word(if *t == 0 { "Symbols" } else { "Special Characters" })),
);
for event in out.response.events {
if let CollectionEvent::Selection(SelectionChange::Set(keys)) = event
if let CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } = event
&& let Some(t) = keys.last()
{
form.tab = *t;
@@ -570,7 +570,7 @@ fn special_table(ui: &mut Ui, form: &mut SymbolForm) -> bool {
let mut activated = false;
for event in events {
match event {
CollectionEvent::Selection(SelectionChange::Set(set)) => {
CollectionEvent::Selection { change: SelectionChange::Set(set), .. } => {
if let Some(at) = set.last() {
form.special = *at;
}
@@ -655,7 +655,7 @@ fn recent_row(ui: &mut Ui, form: &mut SymbolForm, dark: bool) {
.events
};
for event in events {
if let CollectionEvent::Selection(SelectionChange::Set(rows)) = event
if let CollectionEvent::Selection { change: SelectionChange::Set(rows), .. } = event
&& let Some(r) = rows.last().and_then(|i| form.recent.get(*i)).cloned()
&& let Some(c) = r.ch.chars().next()
{
@@ -702,7 +702,7 @@ fn glyph_grid(ui: &mut Ui, form: &mut SymbolForm, dark: bool) -> bool {
let (mut picked, mut activated) = (None, false);
for event in events {
match event {
CollectionEvent::Selection(SelectionChange::Set(rows)) => picked = rows.last().copied().or(picked),
CollectionEvent::Selection { change: SelectionChange::Set(rows), .. } => picked = rows.last().copied().or(picked),
CollectionEvent::Activate(row) => {
picked = Some(row);
activated = true;
@@ -452,8 +452,8 @@ impl WordForm for LanguageForm {
.show_items(ui, &source, &mut |i, _| ListRow::new(Label::from(list.get(*i).map(|(_, n)| n.clone()).unwrap_or_default())));
// A language is always chosen: a Clear leaves it, and a Toggle of the chosen row picks it again.
let picked = shown.events.into_iter().find_map(|event| match event {
CollectionEvent::Selection(SelectionChange::Set(keys)) => keys.last().copied(),
CollectionEvent::Selection(SelectionChange::Toggle(key)) => Some(key),
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => keys.last().copied(),
CollectionEvent::Selection { change: SelectionChange::Toggle(key), .. } => Some(key),
_ => None,
});
if let Some((tag, _)) = picked.and_then(|i| list.get(i)) {
+1 -1
View File
@@ -272,7 +272,7 @@ impl ListForm {
.show_items(ui, &source, &mut |at, _| ListRow::new((*at + 1).to_string()))
.events;
for event in events {
if let CollectionEvent::Selection(SelectionChange::Set(keys)) = event
if let CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } = event
&& let Some(chosen) = keys.last()
{
self.level = *chosen;
+1 -1
View File
@@ -446,7 +446,7 @@ impl BordersForm {
let out = strip
.show_items(ui, &source, &mut |key, _| Tab::new(tabs.iter().find(|tab| tab.0 == *key).map_or_else(String::new, |tab| tab.1.clone())));
for event in out.response.events {
if let CollectionEvent::Selection(SelectionChange::Set(keys)) = event
if let CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } = event
&& let Some(chosen) = keys.last()
{
self.tab = *chosen;
@@ -313,11 +313,11 @@ impl WordForm for SourceManagerForm {
.show_items(ui, &source, &mut |i, _| ListRow::new(Label::from(rows.get(*i).cloned().unwrap_or_default())));
for event in shown.events {
match event {
CollectionEvent::Selection(SelectionChange::Set(keys)) => self.selected = keys.last().copied(),
CollectionEvent::Selection(SelectionChange::Toggle(key)) => {
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => self.selected = keys.last().copied(),
CollectionEvent::Selection { change: SelectionChange::Toggle(key), .. } => {
self.selected = if self.selected == Some(key) { None } else { Some(key) };
}
CollectionEvent::Selection(SelectionChange::Clear) => self.selected = None,
CollectionEvent::Selection { change: SelectionChange::Clear, .. } => self.selected = None,
_ => {}
}
}
@@ -322,8 +322,8 @@ impl WordForm for TocStylesForm {
// A level is always picked: Clear and a Toggle off keep the current one.
for event in shown.events {
let picked = match event {
CollectionEvent::Selection(SelectionChange::Set(keys)) => keys.last().copied(),
CollectionEvent::Selection(SelectionChange::Toggle(key)) => Some(key),
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => keys.last().copied(),
CollectionEvent::Selection { change: SelectionChange::Toggle(key), .. } => Some(key),
_ => None,
};
if let Some(at) = picked {
+2 -2
View File
@@ -401,7 +401,7 @@ fn list_table(ui: &mut Ui, name: &str, rows: &[(String, String)], second: bool,
});
let mut picked = None;
for event in out.events {
if let CollectionEvent::Selection(SelectionChange::Set(keys)) = event
if let CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } = event
&& let Some(key) = keys.into_iter().last()
{
picked = Some(key);
@@ -560,7 +560,7 @@ impl WordForm for AutoCorrectForm {
.natural_height(true)
.show_items(ui, &source, &mut |key, _| Tab::new(tab_name(*key)));
for event in strip.response.events {
if let CollectionEvent::Selection(SelectionChange::Set(keys)) = event
if let CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } = event
&& let Some(key) = keys.into_iter().last()
{
self.tab = key.min(2);
+1 -1
View File
@@ -190,7 +190,7 @@ impl RibbonDialog {
&mut |page, _| Tab::new(tabs.iter().find(|tab| tab.0 == *page).map_or_else(String::new, |tab| tab.1.clone())),
);
for event in out.response.events {
if let CollectionEvent::Selection(SelectionChange::Set(pages)) = event
if let CollectionEvent::Selection { change: SelectionChange::Set(pages), .. } = event
&& let Some(page) = pages.last()
&& *page != self.page
{
@@ -300,8 +300,8 @@ fn category_list(ui: &mut Ui, form: &mut SmartArtForm) {
.show_items(ui, &keyed(&positions, |i| *i), &mut |key, _| ListRow::new(tl!(CATEGORIES.get(*key).copied().unwrap_or("All")).to_string()));
for event in out.events {
let picked = match event {
CollectionEvent::Selection(SelectionChange::Set(keys)) => keys.last().copied(),
CollectionEvent::Selection(SelectionChange::Toggle(key)) => Some(key),
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => keys.last().copied(),
CollectionEvent::Selection { change: SelectionChange::Toggle(key), .. } => Some(key),
_ => None,
};
if let Some(category) = picked.and_then(|k| CATEGORIES.get(k)) {
@@ -333,12 +333,12 @@ fn layout_tiles(ui: &mut Ui, theme: &[Rgb], form: &mut SmartArtForm) -> bool {
let mut activated = false;
for event in out.response.events {
match event {
CollectionEvent::Selection(SelectionChange::Set(keys)) => {
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => {
if let Some(layout) = keys.last().and_then(|k| shown.get(*k)) {
form.layout = *layout;
}
}
CollectionEvent::Selection(SelectionChange::Toggle(key)) => {
CollectionEvent::Selection { change: SelectionChange::Toggle(key), .. } => {
if let Some(layout) = shown.get(key) {
form.layout = *layout;
}
@@ -429,7 +429,7 @@ pub fn frame_button(app: &mut WordApp, ui: &mut Ui, pages: &[PlacedPage], layout
];
let area = ui.max_rect();
let shown = TaskBar::selection(tl!("Text Pane").to_string(), &corners)
.side(Side::Start)
.side(Side::Start, craft::behavior::overlay::Align::Center)
.dismiss(TaskBarDismiss::Keep)
.show(ui, area, |ui, _| IconButton::new(IconId::new("textPane")).label(tl!("Text Pane").to_string()).show(ui).clicked());
if shown.inner == Some(true) {
@@ -254,7 +254,7 @@ impl OrganizerDialog {
});
for event in out.events {
match event {
CollectionEvent::Selection(SelectionChange::Set(keys)) => {
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => {
if let Some(key) = keys.last() {
self.left = key.clone();
}
@@ -285,7 +285,7 @@ impl OrganizerDialog {
ListRow::new(label(n)).lead_text(label(glyph(ty)), label(""))
});
for event in out.events {
if let CollectionEvent::Selection(SelectionChange::Set(keys)) = event
if let CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } = event
&& let Some(key) = keys.last()
{
self.right = key.clone();
+2 -2
View File
@@ -62,12 +62,12 @@ fn pick_name(ui: &mut egui::Ui, label: &str, names: &[String], current: &str) ->
let mut activated = false;
for e in response.events {
match e {
CollectionEvent::Selection(SelectionChange::Set(keys)) => {
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => {
if let Some(n) = keys.first().and_then(|k| names.get(*k)) {
picked = Some(n.clone());
}
}
CollectionEvent::Selection(SelectionChange::Toggle(k)) => {
CollectionEvent::Selection { change: SelectionChange::Toggle(k), .. } => {
if let Some(n) = names.get(k) {
picked = Some(n.clone());
}
@@ -4,9 +4,9 @@
use craft::keymap::CommandRef;
use craft::ui::contract::Bind;
use craft::ui::dialog::{DialogId, DialogResult, DialogStack, StackDialog, dialog_id};
use craft::ui::menu::HelpEntry;
use craft::ui::menu::search::{HelpEntry, SearchIndex, SearchWords, Synonyms};
use craft::ui::patterns::panels::CommandPalette;
use craft::ui::runtime::env::{Label, WordTemplate};
use craft::ui::runtime::env::{Env, Label, WordTemplate};
use serde_json::Value;
use super::find::{SEARCH_SUGGESTIONS, find_in_navigation_pane};
@@ -46,7 +46,10 @@ impl StackDialog for SearchCommandsDialog {
}
fn show(&mut self, ui: &mut egui::Ui, _: &DialogStack) -> Option<DialogResult<Option<String>>> {
let out = CommandPalette::new(tl!("Search Commands"), &self.entries, Bind::bound(&mut self.open))
let env = Env::of(ui);
let view = env.view();
let index = SearchIndex::new(&view, &self.entries, &Synonyms::of(&view.words::<SearchWords>()));
let out = CommandPalette::new(tl!("Search Commands"), &self.entries, &index, Bind::bound(&mut self.open))
.suggested((Label::from(tl!("Suggested")), self.suggested.clone()))
.fallback(self.fallback.clone())
.show(ui);
+1 -1
View File
@@ -161,7 +161,7 @@ impl ManageStylesDialog {
});
for event in out.events {
match event {
CollectionEvent::Selection(SelectionChange::Set(keys)) => {
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => {
if let Some(key) = keys.last() {
self.selected = key.clone();
}
+2 -2
View File
@@ -898,8 +898,8 @@ fn replace_all_with_regex_groups_from_the_dialog() {
h.run_steps(2);
h.state_mut().run("ui.dialog", json!({"name": "replace"})).unwrap();
h.run_steps(2);
set_field(&mut h, "find", "query", json!(r"(?<last>\w+), (\w+)")); // PLAN: assumed key `find` for the Find and Replace dialog
set_field(&mut h, "find", "with", json!(with));
set_field(&mut h, "find", "find", json!(r"(?<last>\w+), (\w+)")); // PLAN: assumed key `find` for the Find and Replace dialog
set_field(&mut h, "find", "replace", json!(with));
set_field(&mut h, "find", "regex", json!(true));
h.get_by_label("Replace All").click();
h.run_steps(2);
+3 -2
View File
@@ -162,6 +162,7 @@ impl WordApp {
let paths = paths.iter().map(|p| p.to_string_lossy().into_owned()).collect();
Some(self.finish_picks(d.after, paths))
}
Picked::Saved { path, .. } => Some(self.finish_picks(d.after, vec![path.to_string_lossy().into_owned()])),
Picked::Contents(files) => Some(self.finish_contents(d.after, files)),
// The page handed the save over as a download: the save finishes under that name, which
// the engine answers with `downloaded`, and the document keeps the file it had.
@@ -537,7 +538,7 @@ mod picture_dispatch_tests {
use std::sync::Arc;
use craft::host::{AppInfo, Host, Picked, ScriptedFiles};
use craft::platform::open::{DropTarget, DroppedFile, FileIntake};
use craft::platform::open::{DroppedFile, FileIntake};
use super::*;
@@ -568,7 +569,7 @@ mod picture_dispatch_tests {
let services = crate::Services { intake: Some(intake), ..Default::default() };
let mut dropped = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::new()), services);
let document = dropped.session.document_id();
sender.dropped(vec![DroppedFile { path: None, name, bytes: Some(bytes.into()) }], DropTarget::Elsewhere);
sender.dropped(vec![DroppedFile { path: None, name, bytes: Some(bytes.into()) }]);
dropped.drain_inbox();
assert_eq!(dropped.session.document_id(), document, "drop inserts into the current document: {ext}");
let pictures = dropped.session.run("arrange.selectionPane", &json!({})).unwrap();
+2 -2
View File
@@ -455,7 +455,7 @@ fn failed_web_saves_restore_the_save_stamps() {
assert_eq!(a.session.path, path_before, "{id}: {name}");
}
// The browser takes the download: the scripted host files its bytes under the name it answers with.
let files = Arc::new(ScriptedFiles::answering([Picked::Paths(vec![PathBuf::from("draft.docx")])]).in_browser());
let files = Arc::new(ScriptedFiles::answering([Picked::Saved { path: PathBuf::from("draft.docx"), file_type: None }]).in_browser());
let mut a = app_over(&files, wordcraft_doc::Document::from_text(UNSAVED));
a.session.dirty = true;
let revision_before = a.session.doc.core.revision;
@@ -488,7 +488,7 @@ fn web_pdf_export_keeps_an_existing_suffix_in_any_case() {
("Report", "Report.pdf"),
] {
// The browser takes the download: the scripted host files its bytes under the name it answers with.
files.queue(Picked::Paths(vec![PathBuf::from(expected)]));
files.queue(Picked::Saved { path: PathBuf::from(expected), file_type: None });
let result = a.execute("file.exportPdf", json!({"path": name})).unwrap();
assert_eq!(result["downloaded"], expected, "{name}");
assert!(files.file(std::path::Path::new(expected)).is_some_and(|b| b.starts_with(b"%PDF")), "{name}");
+4 -4
View File
@@ -88,7 +88,7 @@ pub fn page_input(app: &mut WordApp, inputs: &[EditorInput], pass: &ToolPass, ct
// Enter and Escape leave crop mode keeping the crop (`crop` docs). The canvas takes the page's
// keys as editor input before the crop overlay's own pass reads its Submit and Cancel, so they
// end it here, and neither types a paragraph over the selected picture.
if matches!(e, EditorInput::Newline | EditorInput::Cancel) && crate::crop::active(app).is_some() {
if matches!(e, EditorInput::Newline { .. } | EditorInput::Cancel) && crate::crop::active(app).is_some() {
crate::crop::leave(app);
continue;
}
@@ -112,7 +112,7 @@ fn is_key_input(e: &EditorInput) -> bool {
EditorInput::Move(..)
| EditorInput::Delete { .. }
| EditorInput::Edit(_)
| EditorInput::Newline
| EditorInput::Newline { .. }
| EditorInput::Tab
| EditorInput::BackTab
| EditorInput::Cancel
@@ -306,7 +306,7 @@ fn equation_input(app: &mut WordApp, ctx: &egui::Context, pass: &ToolPass, e: &E
let _ = app.run(if *forward { "equation.delete" } else { "equation.backspace" }, json!({}));
true
}
EditorInput::Newline => {
EditorInput::Newline { .. } => {
let _ = app.run("equation.enter", json!({}));
true
}
@@ -518,7 +518,7 @@ fn handle_input(app: &mut WordApp, ctx: &egui::Context, pass: &ToolPass, e: &Edi
};
let _ = app.run(id, json!({}));
}
EditorInput::Newline => {
EditorInput::Newline { .. } => {
if !crate::objects::key(app, Key::Enter, Modifiers::NONE) {
let _ = app.run("text.newParagraph", json!({}));
}
+1 -1
View File
@@ -292,7 +292,7 @@ fn the_ignored_paste_uses_up_its_paste_modifiers() {
let mut h = app_harness(copied_bold_app());
let chord = Modifiers { shift: true, ..mod_held() };
batch_frame(&mut h, vec![egui::Event::ModifiersChanged(chord), key_event(Key::V, true, chord), egui::Event::Paste("x".into())]);
crate::test_harness::frame(&mut h);
batch_frame(&mut h, vec![key_event(Key::V, false, Modifiers::NONE), egui::Event::ModifiersChanged(Modifiers::NONE)]);
assert_eq!(body(h.state()), "source target");
assert!(is_bold(&mut h));
run(&mut h, "select.text", json!({"text": "target"}));
+19 -3
View File
@@ -352,10 +352,26 @@ fn hovering_a_bar_member_previews_its_command() {
h.get_by_label("20").rect().center()
}
Member::Font => {
// `FontPicker` scans `Catalog::global()` on a background thread; wait until ready so the
// chevron click isn't ignored while the picker is still disabled in a fresh test process.
let catalog = craft::font_manager::Catalog::global();
catalog.scan_in_background();
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(10);
while !catalog.is_ready() && std::time::Instant::now() < deadline {
std::thread::sleep(std::time::Duration::from_millis(10));
}
assert!(catalog.is_ready(), "font catalog finished scanning");
steps(&mut h);
let b = font_box(&h);
// The font picker's chevron is an adornment inside the field and a click on the name opens the list
// too, so click the field itself (the size box's chevron lies beside it).
click_at(&mut h, b.center());
let c = canvas(&h);
// A click on a Plain picker's name only selects it (craft-libs #3103); the chevron opens the list.
let chevron = h
.query_all_by_label("Fonts")
.map(|n| n.rect())
.filter(|r| c.contains_rect(*r))
.min_by(|a, z| a.center().distance(b.center()).total_cmp(&z.center().distance(b.center())))
.expect("the font box's chevron");
click_at(&mut h, chevron.center());
// The framework's font list is a tree of families (depth rows), so its rows are tree items.
h.query_all_by_role(Role::TreeItem)
.filter(|n| {
+9
View File
@@ -110,6 +110,9 @@ pub(crate) struct ObjectGesture {
/// copy's axis lock). Alt is not part of it: letting Alt go just before the release must not snap an
/// object that was placed freely while Alt was held.
last_mods: (bool, bool),
/// The pointer position and Alt state at the last move: releasing Alt with the pointer still
/// must not re-snap the object when a modifier change stirs the pass.
last_at: (Pos2, bool),
/// Moving an In Line with Text object: where it lands.
drop_at: Option<Drop>,
preview: Option<Preview>,
@@ -472,6 +475,7 @@ impl ObjectGesture {
pending_behind: false,
copy: false,
last_mods: (false, false),
last_at: (Pos2::ZERO, false),
drop_at: None,
preview: None,
}
@@ -605,6 +609,11 @@ impl ObjectGesture {
app.canvas.cancel_text_drag();
self.pending_behind = false;
}
let alt_released = self.moved && self.last_at == (p.pos, true) && !p.mods.alt && self.last_mods == (p.mods.shift, p.mods.cmd);
self.last_at = (p.pos, p.mods.alt);
if alt_released {
return;
}
self.moved = true;
self.last_mods = (p.mods.shift, p.mods.cmd);
self.copy = p.mods.cmd && object.member.is_none();
+1 -1
View File
@@ -94,7 +94,7 @@ fn tabs(app: &mut WordApp, ui: &mut Ui) {
/// The key a selection event picked, if it picked one row.
fn picked_row(event: &CollectionEvent<usize, RowEvent>) -> Option<usize> {
match event {
CollectionEvent::Selection(SelectionChange::Set(keys)) => keys.first().copied(),
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => keys.first().copied(),
CollectionEvent::Activate(key) => Some(*key),
_ => None,
}
+1 -1
View File
@@ -125,7 +125,7 @@ pub(super) fn styles(app: &mut WordApp, ui: &mut Ui) {
let mut asked = None;
for event in &out.events {
match event {
CollectionEvent::Selection(SelectionChange::Set(keys)) => {
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => {
if let Some((id, ..)) = keys.first().and_then(|k| list.get(*k)) {
let _ = app.run("para.style", json!({"style": id}));
app.canvas.focus_page(&ctx);
+10 -3
View File
@@ -6,6 +6,7 @@ use craft::ui::contract::{Gap, Props as _, Show as _, ShowContainer as _};
use craft::ui::layout_components::Stack;
use craft::ui::list::ThumbAspect;
use craft::ui::menu::MenuItem;
use craft::ui::primitives::FacePaint;
use craft::ui::tile_grid::{CaptionPlace, Tile};
use super::common::{menu_button, size_field};
@@ -77,18 +78,24 @@ pub(super) fn smart_art_design(row: &mut RibbonRow<'_>, app: &mut WordApp) {
let face = Button::new(tl!("Change\nColors").to_string()).icon(IconId::new("smartArtColors")).arrangement(Arrangement::Stacked);
let _ = menu_button(ui, face, tl!("Change\nColors").to_string(), None, |ui, _| {
let custom = g.has_custom_colors();
for colors in SmartArtColors::ALL {
for (idx, colors) in SmartArtColors::ALL.into_iter().enumerate() {
let theme = theme.clone();
MenuItem::command(CommandRef::with_params("smartArt.colors", json!({"variant": colors.id()})))
.label(crate::dialogs_smart_art::colors_label(colors))
.radio_mark(g.colors == colors && !custom)
.sample(move |cx, r| crate::dialogs_smart_art::swatches(cx, r, colors, theme))
.sample(
ThumbAspect::new(2, 1),
FacePaint::new(idx as u64, move |cx, r| crate::dialogs_smart_art::swatches(cx, r, colors, &theme)),
)
.show(ui);
}
// Active while items carry their own colours; set in the Text Pane.
let theme = theme.clone();
let g = g.clone();
let mut row = MenuItem::new(tl!("Custom").to_string())
.enabled(custom)
.radio_mark(custom)
.sample(move |cx, r| crate::dialogs_smart_art::custom_swatches(cx, r, g, theme));
.sample(ThumbAspect::new(2, 1), FacePaint::new(0x100, move |cx, r| crate::dialogs_smart_art::custom_swatches(cx, r, &g, &theme)));
if !custom {
row = row.tooltip(tl!("Set the colors in the Text Pane to use custom colors.").to_string());
}
+9 -5
View File
@@ -7,8 +7,9 @@ use craft::ui::contract::{Bind, BodyCx, Gap, Props as _, Show as _, ShowContaine
use craft::ui::controls::disclosure::DisclosureGlyph;
use craft::ui::display::Divider;
use craft::ui::layout_components::{Row, Stack};
use craft::ui::list::ThumbAspect;
use craft::ui::menu::{Menu, MenuItem, MenuOutput};
use craft::ui::primitives::IconSpec;
use craft::ui::primitives::{FacePaint, IconSpec};
use craft::ui::runtime::env::Label;
use craft::ui::text::NumberField;
@@ -133,10 +134,13 @@ pub(crate) fn weight_menu(ui: &mut Ui, _app: &mut WordApp, id: &str, current: Op
MenuItem::command(CommandRef::with_params(id, params(w)))
.label(label)
.check(checked)
.sample(move |cx, rect| {
let y = rect.center().y;
cx.painter.line_segment([egui::pos2(rect.left(), y), egui::pos2(rect.right(), y)], egui::Stroke::new(w.max(pixel), cx.ink()));
})
.sample(
ThumbAspect::new(3, 1),
FacePaint::new(u64::from(w.to_bits()), move |cx, rect| {
let y = rect.center().y;
cx.painter.line_segment([egui::pos2(rect.left(), y), egui::pos2(rect.right(), y)], egui::Stroke::new(w.max(pixel), cx.ink()));
}),
)
.show(ui);
}
}
+4 -2
View File
@@ -1,7 +1,9 @@
use craft::menu::CommandRef;
use craft::ui::contract::{Props as _, Show as _};
use craft::ui::display::Divider;
use craft::ui::list::ThumbAspect;
use craft::ui::menu::{Menu, MenuItem};
use craft::ui::primitives::FacePaint;
use egui::{Rect, Stroke, pos2};
@@ -23,12 +25,12 @@ pub(super) const UNDERLINE_STYLES: [(&str, &str); 8] = [
/// Home › Font › Underline's drop-down (#2738): a sample of each line, Words only, None, More
/// Underlines… (the Font dialog) and Underline Color.
pub(super) fn underline_menu(ui: &mut Ui, app: &mut WordApp) {
for (style, name) in UNDERLINE_STYLES {
for (idx, (style, name)) in UNDERLINE_STYLES.into_iter().enumerate() {
// The sample stands for the label; the name is the tooltip and what assistive technology reads.
MenuItem::command(CommandRef::with_params("format.underline", json!({"style": style})))
.label(tl!(name).to_string())
.tooltip(tl!(name).to_string())
.sample(move |cx, r| paint_underline(&cx.painter, r, style, cx.ink()))
.sample(ThumbAspect::new(4, 1), FacePaint::new(idx as u64, move |cx, r| paint_underline(&cx.painter, r, style, cx.ink())))
.sample_only()
.hide_shortcut()
.show(ui);
+14 -12
View File
@@ -5,7 +5,7 @@ use craft::automation::control::{ControlRequest, Reply};
use craft::host::{PickId, PickKind, PickRequest, Picked, ScriptedFiles};
use craft::platform::clock::monotonic_ms;
use craft::platform::default_app::{DefaultApp, DefaultAppError};
use craft::platform::open::{DropTarget, DroppedFile, FileIntake};
use craft::platform::open::{DroppedFile, FileIntake};
use craft::ui::shell::ScreenMode;
use std::sync::Arc;
@@ -102,6 +102,7 @@ type Rig = egui_kittest::Harness<'static, WordApp>;
/// runs it before the second (`raw_input_hook`), as on the desktop.
fn press(h: &mut Rig, key: egui::Key, modifiers: egui::Modifiers) {
h.event(egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers });
h.event(egui::Event::Key { key, physical_key: None, pressed: false, repeat: false, modifiers });
h.step();
h.step();
}
@@ -283,10 +284,12 @@ fn row_mod_shift_0_resets_the_interface_size_unless_bound() {
h.event(egui::Event::Key { key: egui::Key::Num0, physical_key: None, pressed: true, repeat: false, modifiers: altgr });
h.event(egui::Event::ModifiersChanged(altgr));
h.event(egui::Event::Text("}".into()));
h.event(egui::Event::Key { key: egui::Key::Num0, physical_key: None, pressed: false, repeat: false, modifiers: altgr });
h.step();
assert_eq!(h.state().ui.interface_size.percent(), Some(300), "AltGr+0 doesn't reset");
assert_eq!(body_text(h.state()), "}", "AltGr+0 types the character");
h.event(egui::Event::Key { key: egui::Key::Num0, physical_key: Some(egui::Key::Num0), pressed: true, repeat: false, modifiers: chord });
h.event(egui::Event::Key { key: egui::Key::Num0, physical_key: Some(egui::Key::Num0), pressed: false, repeat: false, modifiers: chord });
h.step();
h.step();
assert!(h.state().ui.interface_size.is_auto(), "Ctrl+Shift+0 returns to Auto");
@@ -295,6 +298,7 @@ fn row_mod_shift_0_resets_the_interface_size_unless_bound() {
// PLAN(shell-w7): sh.A11 `Session::keymap_mut` over `Overrides::insert`.
h.state_mut().session.keymap_mut().insert("view.focus", vec!["Mod+Shift+0".into()]);
h.event(egui::Event::Key { key: egui::Key::Num0, physical_key: Some(egui::Key::Num0), pressed: true, repeat: false, modifiers: chord });
h.event(egui::Event::Key { key: egui::Key::Num0, physical_key: Some(egui::Key::Num0), pressed: false, repeat: false, modifiers: chord });
h.step();
h.step();
assert_eq!(h.state().ui.interface_size.percent(), Some(300), "the size stays");
@@ -612,7 +616,7 @@ impl craft::platform::clipboard::ClipboardBackend for LatePaste {
fn drop_files(a: &mut WordApp, files: Vec<DroppedFile>) {
let (intake, sender) = FileIntake::new(craft::host::Wake::none());
a.services.intake = Some(intake);
sender.dropped(files, DropTarget::Elsewhere);
sender.dropped(files);
}
/// An in-memory dropped file.
@@ -2574,7 +2578,7 @@ impl WebSaves {
let answered = self.0.answer_to(
id,
match ended {
Ended::Saved => Picked::Paths(vec![std::path::PathBuf::from("novel.docx")]),
Ended::Saved => Picked::Saved { path: std::path::PathBuf::from("novel.docx"), file_type: None },
Ended::Cancelled => Picked::Cancelled,
Ended::Failed(why) => Picked::Failed(why),
},
@@ -3381,7 +3385,6 @@ fn f11_and_escape_toggle_full_screen() {
for _ in 0..6 {
h.step();
}
let key = |key| egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE };
// Run frames and return the full-screen requests the window got.
let sent = |h: &mut egui_kittest::Harness<WordApp>| {
let mut out = Vec::new();
@@ -3392,25 +3395,25 @@ fn f11_and_escape_toggle_full_screen() {
out
};
assert_eq!(sent(&mut h), vec![], "a normal window to start with");
h.event(key(egui::Key::F11));
h.key_press(egui::Key::F11);
assert_eq!(sent(&mut h), vec![Fullscreen(true)], "F11");
assert!(h.state().session.view.full_screen);
h.event(key(egui::Key::F11));
h.key_press(egui::Key::F11);
assert_eq!(sent(&mut h), vec![Fullscreen(false)], "F11 again");
assert!(!h.state().session.view.full_screen);
// The command (ribbon, command search, agents), then Escape.
assert_eq!(h.state_mut().run("view.fullScreen", json!({})).unwrap(), json!({"value": true}));
assert_eq!(sent(&mut h), vec![Fullscreen(true)], "the command");
h.event(key(egui::Key::Escape));
h.key_press(egui::Key::Escape);
assert_eq!(sent(&mut h), vec![Fullscreen(false)], "Escape");
// Escape in a normal window doesn't touch the window.
h.event(key(egui::Key::Escape));
h.key_press(egui::Key::Escape);
assert_eq!(sent(&mut h), vec![]);
// Escape closing a dialog leaves full screen alone.
h.state_mut().run("view.fullScreen", json!({"value": true})).unwrap();
h.state_mut().run("ui.dialog", json!({"name": "zoom"})).unwrap();
assert_eq!(sent(&mut h), vec![Fullscreen(true)]);
h.event(key(egui::Key::Escape));
h.key_press(egui::Key::Escape);
assert_eq!(sent(&mut h), vec![]);
assert!(open_dialog(h.state()).is_none(), "Escape closed the dialog");
assert!(h.state().session.view.full_screen, "and only that");
@@ -3481,7 +3484,6 @@ fn escape_collapses_a_selection_before_leaving_full_screen() {
for _ in 0..6 {
h.step();
}
let esc = egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE };
let sent = |h: &mut egui_kittest::Harness<WordApp>| {
let mut out = Vec::new();
for _ in 0..2 {
@@ -3497,11 +3499,11 @@ fn escape_collapses_a_selection_before_leaving_full_screen() {
h.state_mut().run("view.fullScreen", json!({"value": true})).unwrap();
assert_eq!(sent(&mut h), vec![Fullscreen(true)]);
assert!(!h.state().session.sel.is_collapsed());
h.event(esc.clone());
h.key_press(egui::Key::Escape);
assert_eq!(sent(&mut h), vec![], "Escape with a selection stays in full screen");
assert!(h.state().session.sel.is_collapsed(), "and collapses the selection");
assert!(h.state().session.view.full_screen);
h.event(esc);
h.key_press(egui::Key::Escape);
assert_eq!(sent(&mut h), vec![Fullscreen(false)], "Escape with nothing selected leaves");
assert!(!h.state().session.view.full_screen);
}
+15 -2
View File
@@ -793,8 +793,16 @@ fn alt_q_opens_search_and_typing_goes_there() {
let Some(open) = chord_event(&chord) else {
panic!("the chord {chord} names a key egui knows");
};
let release = |key, modifiers| egui::Event::Key { key, physical_key: None, pressed: false, repeat: false, modifiers };
let open_release = chord_event(&chord).map(|e| match e {
egui::Event::Key { key, physical_key, modifiers, .. } => egui::Event::Key { key, physical_key, pressed: false, repeat: false, modifiers },
other => other,
});
// Both in one frame's input, as the platform sends them: kittest's `event` runs a frame for each queued event.
h.input_mut().events.extend([open.clone(), egui::Event::Text("q".into())]);
if let Some(rel) = open_release.clone() {
h.input_mut().events.push(rel);
}
h.step();
// The chord fires the command in that pass; the app runs it before the next pass (`raw_input_hook`).
h.step();
@@ -808,25 +816,30 @@ fn alt_q_opens_search_and_typing_goes_there() {
h.step();
assert_eq!(search_text(&h).as_deref(), Some("bold"), "typing goes into the search box");
assert_eq!(h.state().session.doc.plain_text(wordcraft_doc::StoryRef::Body), "Kilns");
h.event(key(egui::Key::Escape, egui::Modifiers::NONE));
h.key_press(egui::Key::Escape);
h.step();
h.step();
// The framework gives Escape to a field holding a draft first (`overlay/dismissal.rs`): the typed "bold" takes the
// first one, and the second closes Search. The old app closed on one.
h.event(key(egui::Key::Escape, egui::Modifiers::NONE));
h.key_press(egui::Key::Escape);
h.step();
h.step();
assert!(!crate::chrome::search::is_open(h.state()), "Escape closes Search");
assert!(!h.state().session.view.full_screen_view);
// Words that name no command: Enter finds them in the document, in the Navigation pane.
h.event(open);
if let Some(rel) = open_release {
h.event(rel);
}
h.step();
h.step();
// Typing sends each key's press before its text.
h.event(key(egui::Key::K, egui::Modifiers::SHIFT));
h.event(egui::Event::Text("Kilns".into()));
h.event(release(egui::Key::K, egui::Modifiers::SHIFT));
h.step();
h.event(key(egui::Key::Enter, egui::Modifiers::NONE));
h.event(release(egui::Key::Enter, egui::Modifiers::NONE));
h.step();
h.step();
assert!(!crate::chrome::search::is_open(h.state()), "Enter ran the search");
+4
View File
@@ -430,14 +430,17 @@ fn find_replace_and_go_to_keys_like_word() {
h.event(egui::Event::Text("Kilns fire clay. Kilns cool.".into()));
h.step();
let nav_query = |h: &egui_kittest::Harness<WordApp>| h.ctx.data(|d| d.get_temp::<String>(h.state().window_id("nav_query"))).unwrap_or_default();
let release = |key, modifiers| egui::Event::Key { key, physical_key: None, pressed: false, repeat: false, modifiers };
// Ctrl+F: the pane, and typing goes into its search box.
h.event(key(egui::Key::F, egui::Modifiers::COMMAND));
h.event(release(egui::Key::F, egui::Modifiers::COMMAND));
h.step();
h.step();
assert!(h.state().session.view.nav_pane, "the Navigation pane opened");
assert_eq!(h.state().ui.nav_tab, "results", "Find exposes its results (#2096)");
assert!(h.state().dialog_host.open_dialogs().is_empty(), "no dialog: {:?}", open_key(h.state()));
h.event(key(egui::Key::C, egui::Modifiers::NONE));
h.event(release(egui::Key::C, egui::Modifiers::NONE));
h.event(egui::Event::Text("cool".into()));
h.step();
h.step();
@@ -460,6 +463,7 @@ fn find_replace_and_go_to_keys_like_word() {
h.state_mut().canvas.focus_page(&ctx);
h.step();
h.event(key(egui::Key::F, egui::Modifiers::COMMAND));
h.event(release(egui::Key::F, egui::Modifiers::COMMAND));
h.step();
h.step();
assert_eq!(nav_query(&h), "Kilns");
+6
View File
@@ -783,6 +783,12 @@ mod tests {
},
false,
);
// Give the craft runtime the test's mode (#3589 keeps the curve `super::apply` set on that mode's style).
let mode = if dark { craft::theme::ModeChoice::Dark } else { craft::theme::ModeChoice::Light };
craft::ui::shell::embed::before_input(&h.ctx, |_| {
craft::ui::runtime::frame::FrameInput::new(craft::ui::runtime::env::RootEnv::new().mode(mode))
});
h.step();
h.run();
let img = h.render().unwrap();
// Ink: how far each pixel, laid over the background (the window outside the frame is
File diff suppressed because one or more lines are too long