Compare commits

..
Author SHA1 Message Date
skylar taylor f2e6403b9c Merge pull request #8914 from storytold/release-0.20.1-hotfix
Release 0.20.1: maximize and full screen on Windows again (#8838)
2026-12-04 12:45:16 -06:00
skylartaylor 1f1d8a05f7 Release 0.20.1: maximize and full-screen fix for Windows (#8838)
Pins craft-libs ad10c35a (wordcraft#8871's pin; one commit on the shipped 5299d8d9) and bumps to 0.20.1.
2026-12-04 18:39:29 +01:00
Martin BallandClaude Opus 5.5 72798d3db1 packaging(linux): riscv64 smoke test sets MALLOC_TRIM_THRESHOLD_ so the CLI doesn't restart under QEMU (#8786)
Since #7914 the CLI restarts itself to set MALLOC_TRIM_THRESHOLD_. Under user-mode
qemu-riscv64 with no binfmt handler the restart can't run the riscv64 binary, glibc's
execvp hands it to /bin/sh, and the release job fails with 'Syntax error: word
unexpected'. Setting the variable skips the restart. Real riscv64 hosts are unaffected.


Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-12-04 02:27:41 +00:00
Martin Ball f1665031b3 Merge remote-tracking branch 'origin/main' into release
; Conflicts:
;	Cargo.lock
;	Cargo.toml
2026-12-04 00:45:48 +00:00
skylartaylor 5d658dc033 Release: WordCraft v0.19.1 (main 09faec42ec, pre-UI-port) 2026-11-25 19:28:58 +01:00
skylartaylor 6b7788d8e0 Release: bump WordCraft to v0.19.1 (on 09faec42, the pre-UI-port candidate) 2026-11-25 19:27:28 +01:00
FredApps 2cde91a869 Release: WordCraft v0.19.0 (main 323cf78232) 2026-11-14 21:48:03 +01:00
FredApps 76e5732355 Release: WordCraft v0.19.0 2026-11-14 21:48:00 +01:00
Dylan M. Taylor 079f478bd8 Merge tested main for v0.18.1 2026-11-11 18:38:09 -05:00
FredApps 7296cf64de Merge main into release for WordCraft v0.18.0 2026-11-11 19:36:24 +01:00
Dylan M. Taylor 5574b32600 Release 0.17.0 2026-11-09 06:34:22 -05:00
61 changed files with 550 additions and 1923 deletions
Generated
+115 -117
View File
@@ -1173,7 +1173,7 @@ dependencies = [
[[package]]
name = "craft"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-automation",
"craft-behavior",
@@ -1214,7 +1214,7 @@ dependencies = [
[[package]]
name = "craft-appkit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"block2 0.6.2",
"objc2 0.6.5",
@@ -1226,7 +1226,7 @@ dependencies = [
[[package]]
name = "craft-atomic"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"rustix 1.1.6",
]
@@ -1234,7 +1234,7 @@ dependencies = [
[[package]]
name = "craft-automation"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -1259,7 +1259,7 @@ dependencies = [
[[package]]
name = "craft-behavior"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"accesskit",
"bitflags 2.13.2",
@@ -1277,7 +1277,7 @@ dependencies = [
[[package]]
name = "craft-browse"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-docpath",
@@ -1295,12 +1295,12 @@ dependencies = [
[[package]]
name = "craft-cfb"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
[[package]]
name = "craft-cloud-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"egui",
]
@@ -1308,7 +1308,7 @@ dependencies = [
[[package]]
name = "craft-cms"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"md-5",
"rayon",
@@ -1317,12 +1317,12 @@ dependencies = [
[[package]]
name = "craft-codepage"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
[[package]]
name = "craft-color"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"serde",
]
@@ -1330,7 +1330,7 @@ dependencies = [
[[package]]
name = "craft-color-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-cms",
@@ -1350,7 +1350,7 @@ dependencies = [
[[package]]
name = "craft-control"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-control-protocol",
"craft-platform",
@@ -1361,7 +1361,7 @@ dependencies = [
[[package]]
name = "craft-control-protocol"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"getrandom 0.3.4",
"serde_json",
@@ -1371,7 +1371,7 @@ dependencies = [
[[package]]
name = "craft-dds"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"rayon",
]
@@ -1379,7 +1379,7 @@ dependencies = [
[[package]]
name = "craft-dialogs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"block2 0.6.2",
"craft-appkit",
@@ -1405,7 +1405,7 @@ dependencies = [
[[package]]
name = "craft-doc-binary"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"chrono",
"craft-cfb",
@@ -1422,7 +1422,7 @@ dependencies = [
[[package]]
name = "craft-docpath"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"serde",
]
@@ -1430,7 +1430,7 @@ dependencies = [
[[package]]
name = "craft-docx"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"base64 0.23.1",
"chrono",
@@ -1450,7 +1450,7 @@ dependencies = [
[[package]]
name = "craft-draw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1469,7 +1469,7 @@ dependencies = [
[[package]]
name = "craft-drawingml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"chrono",
"craft-xml",
@@ -1481,7 +1481,7 @@ dependencies = [
[[package]]
name = "craft-flow"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-wordmodel",
"image",
@@ -1491,7 +1491,7 @@ dependencies = [
[[package]]
name = "craft-font-catalog"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"fontique",
"harfrust 0.13.3",
@@ -1506,7 +1506,7 @@ dependencies = [
[[package]]
name = "craft-font-manager"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-font-catalog",
@@ -1525,7 +1525,7 @@ dependencies = [
[[package]]
name = "craft-font-os-windows"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"windows-registry",
"windows-sys 0.61.2",
@@ -1534,7 +1534,7 @@ dependencies = [
[[package]]
name = "craft-font-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"cap-primitives",
"craft-atomic",
@@ -1557,7 +1557,7 @@ dependencies = [
[[package]]
name = "craft-font-subset"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"brotli 9.1.3",
"harfbuzz-subset-sys",
@@ -1570,7 +1570,7 @@ dependencies = [
[[package]]
name = "craft-fonts-build"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-font-subset",
]
@@ -1578,7 +1578,7 @@ dependencies = [
[[package]]
name = "craft-gpu"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"egui-wgpu",
"log",
@@ -1590,7 +1590,7 @@ dependencies = [
[[package]]
name = "craft-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"bitflags 2.13.2",
"craft-i18n",
@@ -1603,7 +1603,7 @@ dependencies = [
[[package]]
name = "craft-html"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-codepage",
"craft-flow",
@@ -1616,7 +1616,7 @@ dependencies = [
[[package]]
name = "craft-i18n"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"brotli 9.1.3",
"brotli-decompressor 6.3.1",
@@ -1646,7 +1646,7 @@ dependencies = [
[[package]]
name = "craft-image-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-dds",
"craft-jpeg",
@@ -1673,7 +1673,7 @@ dependencies = [
[[package]]
name = "craft-imaging"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1691,7 +1691,7 @@ dependencies = [
[[package]]
name = "craft-jpeg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"thiserror 2.0.21",
]
@@ -1699,7 +1699,7 @@ dependencies = [
[[package]]
name = "craft-keymap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-host",
"craft-i18n",
@@ -1714,7 +1714,7 @@ dependencies = [
[[package]]
name = "craft-latex"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-flow",
"craft-math",
@@ -1725,7 +1725,7 @@ dependencies = [
[[package]]
name = "craft-markdown"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-flow",
"craft-html",
@@ -1735,7 +1735,7 @@ dependencies = [
[[package]]
name = "craft-math"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-xml",
"roxmltree",
@@ -1745,7 +1745,7 @@ dependencies = [
[[package]]
name = "craft-mcp-server"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"serde_json",
]
@@ -1753,7 +1753,7 @@ dependencies = [
[[package]]
name = "craft-menu"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1771,7 +1771,7 @@ dependencies = [
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"brotli-decompressor 6.3.1",
"chrono",
@@ -1783,7 +1783,7 @@ dependencies = [
[[package]]
name = "craft-metafile"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"encoding_rs",
"image",
@@ -1794,7 +1794,7 @@ dependencies = [
[[package]]
name = "craft-mime"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"chardetng",
"chrono",
@@ -1805,7 +1805,7 @@ dependencies = [
[[package]]
name = "craft-nightly"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"uds_windows",
"winsafe",
@@ -1814,7 +1814,7 @@ dependencies = [
[[package]]
name = "craft-odf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"aes",
"base64 0.23.1",
@@ -1840,7 +1840,7 @@ dependencies = [
[[package]]
name = "craft-ods"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-odf",
"craft-sheet",
@@ -1851,7 +1851,7 @@ dependencies = [
[[package]]
name = "craft-offcrypto"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"aes",
"base64 0.23.1",
@@ -1868,7 +1868,7 @@ dependencies = [
[[package]]
name = "craft-opc"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-xml",
"craft-zip",
@@ -1879,7 +1879,7 @@ dependencies = [
[[package]]
name = "craft-pages"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -1895,7 +1895,7 @@ dependencies = [
[[package]]
name = "craft-pdf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"krilla",
"serde",
@@ -1905,7 +1905,7 @@ dependencies = [
[[package]]
name = "craft-platform"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"arboard",
"async-channel",
@@ -1943,7 +1943,7 @@ dependencies = [
[[package]]
name = "craft-print"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1967,7 +1967,7 @@ dependencies = [
[[package]]
name = "craft-proof"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"log",
"miniz_oxide 0.9.1",
@@ -1978,7 +1978,7 @@ dependencies = [
[[package]]
name = "craft-quit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"dispatch2",
"egui",
@@ -1991,7 +1991,7 @@ dependencies = [
[[package]]
name = "craft-review"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -2010,7 +2010,7 @@ dependencies = [
[[package]]
name = "craft-rtf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-codepage",
"craft-flow",
@@ -2023,7 +2023,7 @@ dependencies = [
[[package]]
name = "craft-settings"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-atomic",
"craft-host",
@@ -2040,17 +2040,17 @@ dependencies = [
[[package]]
name = "craft-sheet"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
[[package]]
name = "craft-ssip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
[[package]]
name = "craft-svg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-xml",
"flate2",
@@ -2067,7 +2067,7 @@ dependencies = [
[[package]]
name = "craft-table"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2079,7 +2079,7 @@ dependencies = [
[[package]]
name = "craft-text"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2103,7 +2103,7 @@ dependencies = [
[[package]]
name = "craft-theme"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"bitflags 2.13.2",
"craft-tracked",
@@ -2118,7 +2118,7 @@ dependencies = [
[[package]]
name = "craft-theme-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-atomic",
"craft-behavior",
@@ -2133,7 +2133,7 @@ dependencies = [
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2143,7 +2143,7 @@ dependencies = [
[[package]]
name = "craft-time"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2152,7 +2152,7 @@ dependencies = [
[[package]]
name = "craft-timeline"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2167,12 +2167,12 @@ dependencies = [
[[package]]
name = "craft-tracked"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
[[package]]
name = "craft-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-cloud-ui",
"craft-ui-canvas",
@@ -2186,7 +2186,7 @@ dependencies = [
[[package]]
name = "craft-ui-canvas"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-font-catalog",
@@ -2203,7 +2203,7 @@ dependencies = [
[[package]]
name = "craft-ui-contract"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"accesskit",
"craft-behavior",
@@ -2241,7 +2241,7 @@ dependencies = [
[[package]]
name = "craft-ui-macros"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -2252,7 +2252,7 @@ dependencies = [
[[package]]
name = "craft-ui-panels"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2270,7 +2270,7 @@ dependencies = [
[[package]]
name = "craft-ui-patterns"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2291,7 +2291,7 @@ dependencies = [
[[package]]
name = "craft-ui-shell"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2312,7 +2312,7 @@ dependencies = [
[[package]]
name = "craft-ui-test-kit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2323,7 +2323,7 @@ dependencies = [
[[package]]
name = "craft-ui-widgets"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2342,7 +2342,7 @@ dependencies = [
[[package]]
name = "craft-update"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -2374,7 +2374,7 @@ dependencies = [
[[package]]
name = "craft-web-api"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"js-sys",
"serde_json",
@@ -2385,7 +2385,7 @@ dependencies = [
[[package]]
name = "craft-web-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-host",
"craft-platform",
@@ -2397,7 +2397,7 @@ dependencies = [
[[package]]
name = "craft-win32"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"winsafe",
]
@@ -2405,7 +2405,7 @@ dependencies = [
[[package]]
name = "craft-window"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-appkit",
"craft-atomic",
@@ -2437,7 +2437,7 @@ dependencies = [
[[package]]
name = "craft-wordmodel"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"base64 0.23.1",
"craft-math",
@@ -2451,7 +2451,7 @@ dependencies = [
[[package]]
name = "craft-xls"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-cfb",
"craft-sheet",
@@ -2464,7 +2464,7 @@ dependencies = [
[[package]]
name = "craft-xlsx"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"craft-drawingml",
"craft-opc",
@@ -2476,7 +2476,7 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"quick-xml 0.41.0",
"serde",
@@ -2486,7 +2486,7 @@ dependencies = [
[[package]]
name = "craft-zip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"flate2",
"thiserror 2.0.21",
@@ -3866,7 +3866,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"
[[package]]
name = "hayro-cmap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"brotli 8.0.4",
"hayro-postscript",
@@ -3875,7 +3875,7 @@ dependencies = [
[[package]]
name = "hayro-interpret"
version = "0.7.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"bitflags 2.13.2",
"hayro-cmap",
@@ -3893,7 +3893,7 @@ dependencies = [
[[package]]
name = "hayro-jbig2"
version = "0.3.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"fearless_simd",
"hayro-ccitt",
@@ -3911,12 +3911,12 @@ dependencies = [
[[package]]
name = "hayro-postscript"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
[[package]]
name = "hayro-syntax"
version = "0.7.2"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"flate2",
"hayro-ccitt",
@@ -4645,7 +4645,7 @@ dependencies = [
[[package]]
name = "krilla"
version = "0.8.2"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"base64 0.22.1",
"bumpalo",
@@ -4784,7 +4784,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
[[package]]
name = "linesweeper"
version = "0.5.0"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
dependencies = [
"arrayvec",
"kurbo",
@@ -9118,7 +9118,7 @@ dependencies = [
[[package]]
name = "wordcraft"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"craft",
"craft-nightly",
@@ -9145,7 +9145,7 @@ dependencies = [
[[package]]
name = "wordcraft-cli"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"craft-zip",
"image",
@@ -9163,11 +9163,11 @@ dependencies = [
[[package]]
name = "wordcraft-control-key"
version = "0.20.0"
version = "0.20.1"
[[package]]
name = "wordcraft-doc"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"base64 0.23.1",
"craft-codepage",
@@ -9183,7 +9183,7 @@ dependencies = [
[[package]]
name = "wordcraft-docbin"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"cfb",
"craft-doc-binary",
@@ -9195,7 +9195,7 @@ dependencies = [
[[package]]
name = "wordcraft-docx"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"base64 0.23.1",
"cfb",
@@ -9214,7 +9214,7 @@ dependencies = [
[[package]]
name = "wordcraft-engine"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"cfb",
"chrono",
@@ -9252,7 +9252,7 @@ dependencies = [
[[package]]
name = "wordcraft-fonts"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"brotli-decompressor 5.0.3",
"harfrust 0.13.3",
@@ -9267,7 +9267,7 @@ dependencies = [
[[package]]
name = "wordcraft-formats"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"chardetng",
"chrono",
@@ -9297,7 +9297,7 @@ dependencies = [
[[package]]
name = "wordcraft-geom"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"craft-image-codecs",
"craft-tiff",
@@ -9307,11 +9307,10 @@ dependencies = [
[[package]]
name = "wordcraft-layout"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"craft-metafile",
"craft-proof",
"craft-xml",
"image",
"js-sys",
"kurbo",
@@ -9328,7 +9327,7 @@ dependencies = [
[[package]]
name = "wordcraft-mcp"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"craft",
"craft-mcp-server",
@@ -9342,7 +9341,7 @@ dependencies = [
[[package]]
name = "wordcraft-pdf"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"chrono",
"craft-metafile",
@@ -9363,7 +9362,7 @@ dependencies = [
[[package]]
name = "wordcraft-render"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"craft-metafile",
"image",
@@ -9377,13 +9376,12 @@ dependencies = [
[[package]]
name = "wordcraft-ui-egui"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"cfb",
"chrono",
"craft",
"craft-fonts-build",
"craft-html",
"craft-ui-test-kit",
"craft-zip",
"eframe",
@@ -9411,7 +9409,7 @@ dependencies = [
[[package]]
name = "wordcraft-validate"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"craft-image-codecs",
"craft-tiff",
@@ -9426,7 +9424,7 @@ dependencies = [
[[package]]
name = "wordcraft-web"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"craft",
"eframe",
@@ -9446,7 +9444,7 @@ dependencies = [
[[package]]
name = "wordcraft-zotero"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"log",
"proptest",
@@ -9664,7 +9662,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee"
[[package]]
name = "xtask"
version = "0.20.0"
version = "0.20.1"
dependencies = [
"serde",
"serde_json",
@@ -10054,4 +10052,4 @@ source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f
[[patch.unused]]
name = "hayro"
version = "0.7.1"
source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35"
source = "git+https://github.com/storytold/craft-libs?rev=ad10c35ae545f0fb816364381a1a8154012b2359#ad10c35ae545f0fb816364381a1a8154012b2359"
+40 -40
View File
@@ -13,7 +13,7 @@ run_slots = 3
test_threads = 4
[workspace.package]
version = "0.20.0"
version = "0.20.1"
edition = "2024"
license = "MIT OR Apache-2.0"
rust-version = "1.95"
@@ -37,22 +37,22 @@ wordcraft-pdf = { path = "crates/pdf" }
# reads the ca-valencia pack), #589 (French elision suggestions first), #497 (flag-based
# compounding), #496 (review follow-ups, en-AU) and the merged #482–#490/#495 stack; the font
# store's `language-pack` kind is #486 (CP4.1).
wordcraft-proof = { package = "craft-proof", git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-ssip = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
wordcraft-proof = { package = "craft-proof", git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-ssip = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
wordcraft-engine = { path = "crates/engine" }
wordcraft-mcp = { path = "crates/mcp" }
wordcraft-zotero = { path = "crates/zotero" }
wordcraft-control-key = { path = "crates/control-key" }
wordcraft-ui-egui = { path = "crates/ui-egui" }
wordcraft-validate = { path = "crates/validate" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0", default-features = false }
craft-ui-test-kit = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", default-features = false }
craft-ui-test-kit = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
# foundation
kurbo = { version = "0.13", features = ["serde"] }
@@ -85,28 +85,28 @@ wuff = "0.2.9"
brotli-decompressor = "5"
vello_cpu = "0.2"
image = { version = "0.25", default-features = false }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0", default-features = false, features = ["write"] }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", default-features = false, features = ["write"] }
craft-wordmodel = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-docx = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0", features = ["doc"] }
craft-doc-binary = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-flow = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-odf = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0", features = ["text"] }
craft-markdown = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-html = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0", features = ["flow"] }
craft-latex = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-math = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0", features = ["detect"] }
craft-sheet = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", version = "=0.1.0" }
craft-wordmodel = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-docx = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", features = ["doc"] }
craft-doc-binary = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-flow = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-odf = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", features = ["text"] }
craft-markdown = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-html = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", features = ["flow"] }
craft-latex = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-math = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0", features = ["detect"] }
craft-sheet = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", version = "=0.1.0" }
# zlib streams (compressed metafile pictures in `.doc` drawings); already in the lock as a dependency of other crates.
miniz_oxide = "0.9"
cfb = "0.15"
@@ -174,14 +174,14 @@ debug = 0
# The framework's patches, which Cargo does not carry over to dependents: its vendored crates from craft-libs,
# and the egui and winit forks it builds with.
[patch.crates-io]
krilla = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35" }
hayro = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
emath = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
-1
View File
@@ -27,7 +27,6 @@ const POLL_MS: i32 = 16;
pub fn install(ctx: egui::Context) -> Receiver<ControlRequest> {
let (queue, requests) = channel::<ControlRequest>();
let request: Request = Rc::new(move |method, params| {
let params = super::page_params::control_params(&method, params);
let (control, reply) = ControlRequest::new(method, params);
if queue.send(control).is_err() {
return Box::pin(async { json!({"ok": false, "error": "the app is not running"}) });
-2
View File
@@ -23,8 +23,6 @@ mod prefs;
mod api;
#[cfg(target_arch = "wasm32")]
mod host;
#[cfg(any(target_arch = "wasm32", test))]
mod page_params;
#[cfg(target_arch = "wasm32")]
mod web;
-55
View File
@@ -1,55 +0,0 @@
use serde_json::Value;
pub(super) fn control_params(method: &str, mut params: Value) -> Value {
// The page helper asks for inline data. A screenshot without a path already returns it.
if method == "ui.screenshot"
&& let Some(fields) = params.as_object_mut()
&& !fields.contains_key("path")
&& fields.get("data") == Some(&Value::Bool(true))
{
fields.remove("data");
}
params
}
#[cfg(test)]
mod tests {
use craft::automation::screenshot::ScreenshotParams;
use serde_json::json;
use super::control_params;
#[test]
fn page_helper_requests_the_same_capture_as_a_direct_request() {
for (helper, direct) in
[(json!({"data": true}), json!({})), (json!({"data": true, "region": [10, 20, 100, 200]}), json!({"region": [10, 20, 100, 200]}))]
{
let params = control_params("ui.screenshot", helper);
assert_eq!(params, direct);
assert!(ScreenshotParams::from_params(&params).is_ok());
}
}
#[test]
fn page_helper_keeps_screenshot_validation() {
for (input, expected) in [
(json!({"data": true, "region": [100, 200, 10, 20]}), json!({"region": [100, 200, 10, 20]})),
(json!({"data": true, "viewport": "other"}), json!({"viewport": "other"})),
(json!({"data": true, "path": "capture.png"}), json!({"data": true, "path": "capture.png"})),
(json!({"data": true, "path": null}), json!({"data": true, "path": null})),
(json!({"data": false}), json!({"data": false})),
(json!({"data": "true"}), json!({"data": "true"})),
] {
let params = control_params("ui.screenshot", input);
assert_eq!(params, expected);
assert!(ScreenshotParams::from_params(&params).is_err());
}
}
#[test]
fn direct_requests_keep_their_parameters() {
for (method, params) in [("ui.screenshot", json!({"path": "capture.png"})), ("file.new", json!({"data": true}))] {
assert_eq!(control_params(method, params.clone()), params);
}
}
}
+19 -37
View File
@@ -3,7 +3,7 @@
use serde_json::Value;
use wordcraft_doc::math_edit::MathPos;
use wordcraft_doc::para::OBJ;
use wordcraft_doc::{InlineObject, Paragraph, Path, Pos, StoryRef};
use wordcraft_doc::{InlineObject, Paragraph, Pos, StoryRef};
use wordcraft_layout::ViewMode;
use super::{parse_pos, sel_result};
@@ -124,11 +124,10 @@ fn lr(s: &mut Session, v: &Value, is_left: bool) -> CmdResult {
}
let from = s.sel.focus.clone();
// Equation entry and the grapheme step start at the same visible edge.
let hidden = s.layout_hides_deleted(from.story);
let edge = logical_edge(s, &from, is_left, hidden);
let edge = logical_edge(s, &from, is_left);
if !ext
&& !s.math_left
&& let Some(r) = into_equation(s, &from, edge, is_left, hidden)
&& let Some(r) = into_equation(s, &from, edge, is_left)
{
return r;
}
@@ -142,10 +141,10 @@ fn lr(s: &mut Session, v: &Value, is_left: bool) -> CmdResult {
/// left, as in Word (#4138). Leaving it puts the caret on the far side, so the same arrow then
/// moves on instead of going back in. A caret.left/right that itself left an equation (sent
/// while editing one) moves on too.
fn into_equation(s: &mut Session, from: &Pos, edge: usize, is_left: bool, hidden: wordcraft_layout::HideDeleted) -> Option<CmdResult> {
fn into_equation(s: &mut Session, from: &Pos, edge: usize, is_left: bool) -> Option<CmdResult> {
let off = if is_left { edge.checked_sub(OBJ.len_utf8())? } else { edge };
let para = s.doc.para_at(from)?;
if !matches!(para.object_at(off), Some(InlineObject::Equation { .. })) || (hidden.any() && hidden.hides(&s.doc, para.props_of_char(off).del)) {
if !matches!(para.object_at(off), Some(InlineObject::Equation { .. })) || (!s.view.show_markup && para.props_of_char(off).del.is_some()) {
return None;
}
s.sel = Selection::caret(Pos { off, ..from.clone() });
@@ -183,7 +182,7 @@ fn visual_lr(s: &mut Session, v: &Value, is_left: bool) -> CmdResult {
/// The two ends of a hidden deletion share a caret position. Cross the hidden
/// span before taking the normal grapheme step, including adjacent deletions.
fn hidden_deletion_edge(para: &Paragraph, off: usize, is_left: bool, hides: impl Fn(Option<u32>) -> bool) -> usize {
fn hidden_deletion_edge(para: &Paragraph, off: usize, is_left: bool) -> usize {
// At a run boundary, inspect the byte on the side the caret is moving toward.
let Some(byte) = off.checked_sub(usize::from(is_left)).filter(|&byte| byte < para.len()) else { return off };
// Runs store lengths, so find the containing run from the nearer end of the paragraph.
@@ -198,28 +197,27 @@ fn hidden_deletion_edge(para: &Paragraph, off: usize, is_left: bool, hides: impl
})
};
let Some((i, range)) = found else { return off };
if !hides(para.runs[i].props.del) {
if para.runs[i].props.del.is_none() {
return off;
}
if is_left {
range.start - para.runs[..i].iter().rev().take_while(|run| hides(run.props.del)).map(|run| run.len).sum::<usize>()
range.start - para.runs[..i].iter().rev().take_while(|run| run.props.del.is_some()).map(|run| run.len).sum::<usize>()
} else {
range.end + para.runs[i + 1..].iter().take_while(|run| hides(run.props.del)).map(|run| run.len).sum::<usize>()
range.end + para.runs[i + 1..].iter().take_while(|run| run.props.del.is_some()).map(|run| run.len).sum::<usize>()
}
}
fn logical_edge(s: &Session, from: &Pos, is_left: bool, hidden: wordcraft_layout::HideDeleted) -> usize {
if hidden.any()
fn logical_edge(s: &Session, from: &Pos, is_left: bool) -> usize {
if !s.view.show_markup
&& let Some(para) = s.doc.para_at(from)
{
return hidden_deletion_edge(para, from.off, is_left, |del| hidden.hides(&s.doc, del));
return hidden_deletion_edge(para, from.off, is_left);
}
from.off
}
fn logical_step(s: &Session, from: &Pos, is_left: bool) -> Pos {
let edge = logical_edge(s, from, is_left, s.layout_hides_deleted(from.story));
step_from_edge(s, from, edge, is_left)
step_from_edge(s, from, logical_edge(s, from, is_left), is_left)
}
fn step_from_edge(s: &Session, from: &Pos, edge: usize, is_left: bool) -> Pos {
@@ -231,39 +229,23 @@ fn step_from_edge(s: &Session, from: &Pos, edge: usize, is_left: bool) -> Pos {
return Pos { off: para.next_boundary(edge), ..from.clone() };
}
}
step_to_neighbor(s, from, is_left, !s.view.show_markup)
}
fn step_to_neighbor(s: &Session, from: &Pos, is_left: bool, skip_deleted: bool) -> Pos {
let story = from.story;
let neighbor = if is_left { s.doc.prev_para(story, &from.path) } else { s.doc.next_para(story, &from.path) };
let Some(mut path) = neighbor else { return from.clone() };
// Layout collapses a wholly deleted paragraph in No Markup. A surviving mark still gives
// even a paragraph without visible text a caret stop.
let deleted = |path: &Path| s.doc.para(story, path).is_some_and(|p| p.mark.del.is_some() && p.runs.iter().all(|r| r.props.del.is_some()));
if skip_deleted && deleted(&path) {
// Get the story's paths once for the rest of the walk, even across many deleted paragraphs.
let paths = s.doc.para_paths(story);
let Ok(i) = paths.binary_search(&path) else { return from.clone() };
let stop = if is_left { paths[..i].iter().rev().find(|p| !deleted(p)) } else { paths[i + 1..].iter().find(|p| !deleted(p)) };
let Some(stop) = stop else { return from.clone() };
path = stop.clone();
}
let off = if is_left { s.doc.para(story, &path).map_or(0, Paragraph::len) } else { 0 };
Pos { story, path, off }
let neighbor = if is_left { s.doc.prev_para(from.story, &from.path) } else { s.doc.next_para(from.story, &from.path) };
let Some(path) = neighbor else { return from.clone() };
let off = if is_left { s.doc.para(from.story, &path).map_or(0, Paragraph::len) } else { 0 };
Pos { story: from.story, path, off }
}
fn word_left(s: &mut Session, p: &Pos) -> Pos {
match s.doc.para_at(p) {
Some(para) if p.off > 0 => Pos { off: para.word_start(p.off), ..p.clone() },
_ => step_to_neighbor(s, p, true, false),
_ => logical_step(s, p, true),
}
}
fn word_right(s: &mut Session, p: &Pos) -> Pos {
match s.doc.para_at(p) {
Some(para) if p.off < para.len() => Pos { off: para.word_end(p.off), ..p.clone() },
_ => step_to_neighbor(s, p, false, false),
_ => logical_step(s, p, false),
}
}
-7
View File
@@ -521,13 +521,6 @@ fn place(s: &mut Session, layout: &DocLayout, obj: InlineObject, page: usize, (x
float.y = y - origin.y;
}
para.touch();
if !on_page && let Some(offset) = super::objects::shifted_float_offset(s, &at, page, y, origin.y) {
super::objects::edit_obj(s, &at, |o| {
if let Some(float) = o.float_mut() {
float.y = offset;
}
})?;
}
Ok(at)
}
+1 -1
View File
@@ -21,7 +21,7 @@ mod shape;
mod specs;
pub use arrange::moves_with_text;
pub(crate) use arrange::{anchor_paragraph, nearest_line, shifted_float_offset};
pub(crate) use arrange::{anchor_paragraph, nearest_line};
#[cfg(test)]
use group::ungroup;
pub use picture::{OriginalSize, PictureLook, cropped_original_size, fit_size, original_size};
+1 -30
View File
@@ -212,29 +212,9 @@ fn move_object_once(s: &mut Session, pos: &Pos, page: usize, x: f32, y: f32, (w,
f.x = (x - origin.x).clamp(-MAX_OFFSET, MAX_OFFSET);
f.y = (y - origin.y).clamp(-MAX_OFFSET, MAX_OFFSET);
})?;
if let Some(offset) = shifted_float_offset(s, &at, page, y, origin.y) {
edit_float(s, &at, |f| f.y = offset.clamp(-MAX_OFFSET, MAX_OFFSET))?;
}
Ok(at)
}
/// A page-to-paragraph conversion can make a float move from the unpushed paragraph top to
/// the pushed first line. Once layout has resolved that choice, offset from the origin it used.
/// Leave other layout effects, such as wrapping settlement or a change of page, to the caller.
pub(crate) fn shifted_float_offset(s: &mut Session, at: &Pos, page: usize, y: f32, old_origin: f32) -> Option<f32> {
let offset = y - old_origin;
if offset >= 0.0
|| at.story != StoryRef::Body
|| at.path.depth() != 0
|| (!s.view.read_mode && !matches!(s.view.mode, wordcraft_layout::ViewMode::Print | wordcraft_layout::ViewMode::Read))
{
return None;
}
s.touch();
let hit = s.layout().object(at, page)?;
(hit.page == page && hit.origin.y > old_origin + 0.01 && (hit.rect.y - hit.origin.y - offset).abs() < 0.01).then_some(y - hit.origin.y)
}
/// Turn the selected floating object's alignment (left, centred, …) into an offset from its
/// column / paragraph that keeps it where it is, so it can be moved by an offset.
pub(super) fn unalign(s: &mut Session) -> Result<(), CmdError> {
@@ -265,12 +245,6 @@ pub(super) fn unalign(s: &mut Session) -> Result<(), CmdError> {
f.y = oy.clamp(-MAX_OFFSET, MAX_OFFSET);
}
})?;
if float.v_align.is_some()
&& float.v_rel != Anchor::Page
&& let Some(offset) = shifted_float_offset(s, &pos, hit.page, hit.rect.y, hit.origin.y)
{
edit_float(s, &pos, |f| f.y = offset.clamp(-MAX_OFFSET, MAX_OFFSET))?;
}
Ok(())
}
@@ -294,14 +268,11 @@ pub(super) fn move_with_text(s: &mut Session, with_text: bool) -> CmdResult {
let hit = s.layout().object(&pos, s.page_hint).ok_or_else(|| CmdError::Failed("the object isn't laid out".into()))?;
// Paragraph offsets start at the paragraph's top (the hit's origin), page offsets at the page's.
let y = if with_text { hit.rect.y - hit.origin.y } else { hit.rect.y };
let mut o = edit_float(s, &pos, |f| {
let o = edit_float(s, &pos, |f| {
f.v_rel = if with_text { Anchor::Paragraph } else { Anchor::Page };
f.v_align = None;
f.y = y.clamp(-MAX_OFFSET, MAX_OFFSET);
})?;
if with_text && let Some(offset) = shifted_float_offset(s, &pos, hit.page, hit.rect.y, hit.origin.y) {
o = edit_float(s, &pos, |f| f.y = offset.clamp(-MAX_OFFSET, MAX_OFFSET))?;
}
Ok(json!({"object": serde_json::to_value(o).unwrap_or(Value::Null)}))
}
+1 -1
View File
@@ -337,7 +337,7 @@ fn clipboard_content(s: &mut Session, v: &Value) -> Result<Pasted, CmdError> {
let text = p::str(v, "text").map(|t| t.replace("\r\n", "\n"));
match text {
Some(t) if !t.is_empty() => Ok(Pasted::Text(t)),
_ => Err(CmdError::ClipboardEmpty),
_ => Err(CmdError::Failed("the clipboard is empty".into())),
}
}
-75
View File
@@ -491,81 +491,6 @@ fn deletions_outside_the_body_stay_inline_when_revisions_go_in_balloons() {
assert_eq!(deletion_balloons(&s), vec![DeletionBalloon { at: Pos::body(0, at), author: "Ana".into(), text: "zeta".into() }]);
}
fn assert_revision_arrow_stops(s: &mut Session, story: wordcraft_doc::StoryRef, from: [usize; 2], to: [usize; 2]) {
use wordcraft_doc::{Path, Pos};
let pos = |off| Pos::new(story, Path::top(0), off);
for (key, start, end) in [("Right", from[0], to[0]), ("Left", from[1], to[1])] {
let cmd = s.registry.by_shortcut(key).unwrap().id;
for extend in [false, true] {
s.run("caret.set", &json!({"pos": pos(start)})).unwrap();
s.run(cmd, &json!({"extend": extend})).unwrap();
assert_eq!(s.sel.focus, pos(end), "{key}, Shift {extend}, from {start}");
assert_eq!(s.sel.anchor, pos(if extend { start } else { end }));
}
}
}
#[test]
fn horizontal_arrows_follow_revision_balloon_visibility_by_story() {
use wordcraft_doc::{Path, Pos, StoryRef};
let mut s = Session::new(Document::from_text("AQRSZ"));
let id = s.run("insert.header", &json!({"text": "ABCDZ"})).unwrap()["story"].as_u64().unwrap() as u32;
let header = StoryRef::Part(id);
s.run("insert.closeHeader", &json!({})).unwrap();
s.run("review.trackChanges", &json!({"value": true})).unwrap();
for story in [StoryRef::Body, header] {
let at = |off| Pos::new(story, Path::top(0), off);
s.run("select.range", &json!({"anchor": at(1), "focus": at(4)})).unwrap();
s.run("text.delete", &json!({})).unwrap();
assert!(s.doc.para_at(&at(1)).unwrap().props_of_char(1).del.is_some());
}
s.run("review.trackingOptions", &json!({"balloons": "revisions"})).unwrap();
assert!(s.revisions_in_balloons());
assert_revision_arrow_stops(&mut s, StoryRef::Body, [1, 4], [5, 0]);
assert_revision_arrow_stops(&mut s, header, [1, 4], [2, 3]);
s.run("view.commentsPane", &json!({"value": true})).unwrap();
assert!(!s.revisions_in_balloons());
assert_revision_arrow_stops(&mut s, StoryRef::Body, [1, 4], [2, 3]);
s.run("review.trackingOptions", &json!({"balloons": "inline"})).unwrap();
s.run("view.commentsPane", &json!({"value": false})).unwrap();
assert_revision_arrow_stops(&mut s, StoryRef::Body, [1, 4], [2, 3]);
s.run("review.markup", &json!({"value": "noMarkup"})).unwrap();
for story in [StoryRef::Body, header] {
assert_revision_arrow_stops(&mut s, story, [1, 4], [5, 0]);
}
}
#[test]
fn horizontal_arrows_distinguish_hidden_deletions_from_hidden_move_sources() {
use wordcraft_doc::{Pos, Revision, RevisionKind, StoryRef};
let mut doc = Document::from_text("AxyuvZuv");
let deletion = Revision::new(RevisionKind::Delete, "Author", "");
let source = Revision { move_name: Some("Move1".into()), ..deletion.clone() };
let destination = Revision { kind: RevisionKind::Insert, ..source.clone() };
doc.revisions.extend([deletion, source, destination]);
doc.format_range(&Pos::body(0, 1), &Pos::body(0, 3), &|c| c.del = Some(0)).unwrap();
doc.format_range(&Pos::body(0, 3), &Pos::body(0, 5), &|c| c.del = Some(1)).unwrap();
doc.format_range(&Pos::body(0, 6), &Pos::body(0, 8), &|c| c.ins = Some(2)).unwrap();
let mut s = Session::new(doc);
for (delete_mark, move_from_mark, expected) in [
("strikethrough", "strikethrough", [2, 4]),
("hidden", "strikethrough", [4, 4]),
("strikethrough", "hidden", [2, 2]),
("hidden", "hidden", [6, 0]),
] {
s.run("review.trackingOptions", &json!({"balloons": "inline", "deleteMark": delete_mark, "moveFromMark": move_from_mark})).unwrap();
assert_revision_arrow_stops(&mut s, StoryRef::Body, [1, 5], expected);
}
}
fn body_para(s: &Session) -> &wordcraft_doc::Paragraph {
s.doc.para(wordcraft_doc::StoryRef::Body, &wordcraft_doc::Path::top(0)).unwrap()
}
-2
View File
@@ -84,8 +84,6 @@ pub enum CmdError {
Params(String),
#[error("not available: {0}")]
Disabled(String),
#[error("the clipboard is empty")]
ClipboardEmpty,
#[error("{0}")]
Failed(String),
}
+5 -19
View File
@@ -1,5 +1,3 @@
use wordcraft_layout::HideDeleted;
use super::doc_state::{Selection, TypedWord, typed_range};
use super::locale::SYSTEM_LOCALE;
use super::snapshot_types::LayoutEntry;
@@ -13,20 +11,6 @@ impl Session {
self.layout_with(typing)
}
fn revision_layout_options(&self) -> LayoutOptions {
LayoutOptions {
hide_deleted: !self.view.show_markup,
hide_marked: self.prefs.markup.hidden_deletions(),
deletions_in_balloons: self.revisions_in_balloons(),
..LayoutOptions::default()
}
}
/// Which tracked deletions the editor leaves out of this story.
pub(crate) fn layout_hides_deleted(&self, story: StoryRef) -> HideDeleted {
self.revision_layout_options().hides_deleted(story)
}
/// [`Session::layout`] with `typing` as the word being typed.
fn layout_with(&mut self, typing: Option<wordcraft_layout::TypingWord>) -> Arc<DocLayout> {
let mode = if self.view.read_mode { ViewMode::Read } else { self.view.mode };
@@ -39,8 +23,8 @@ impl Session {
let spacing = if self.view.read_mode { self.view.read_line_spacing.map(f32::to_bits) } else { None };
// Deletions in balloons depend on the view (the Comments pane, Read Mode, side by side), so
// a view change that moves them in or out of the text lays it out again.
let revisions = self.revision_layout_options();
let deleted = (revisions.hide_deleted, revisions.hide_marked, revisions.deletions_in_balloons);
let hide_deleted = !self.view.show_markup;
let deleted = (hide_deleted, self.prefs.markup.hidden_deletions(), self.revisions_in_balloons());
let outline = (mode == ViewMode::Outline).then(|| self.view.outline.view());
let shown = (self.view.marks || self.prefs.marks.hidden, self.view.field_codes);
// A dictionary or Language pack installed, removed or edited (in this document's window or
@@ -78,6 +62,9 @@ impl Session {
read_height: height,
read_line_spacing: spacing.map(f32::from_bits),
show_hidden: shown.0,
hide_deleted,
hide_marked: deleted.1,
deletions_in_balloons: deleted.2,
proofing: self.view.proofing,
numeral: self.view.numeral.resolve(SYSTEM_LOCALE.get().map(String::as_str)),
comment_balloons: false,
@@ -90,7 +77,6 @@ impl Session {
// The editor shows a body page reference as stored until fields are updated.
output_page_refs: false,
bookmark_error: None,
..revisions
};
let l = Arc::new(wordcraft_layout::layout(&self.doc, &mut self.cache, &opts));
let [newest, _] = std::mem::take(&mut self.layout);
+71 -50
View File
@@ -7169,56 +7169,6 @@ fn select_box(s: &mut Session) {
run(s, "select.range", json!({"anchor": o.pos(), "focus": end}));
}
#[test]
fn dragging_above_a_pushed_first_line_keeps_the_drop_position() {
use wordcraft_doc::para::{Anchor, Float, InlineObject, OBJ, ShapeKind, Wrap};
let shape = |w, h, float| InlineObject::Shape {
kind: ShapeKind::Rectangle,
w,
h,
fill: None,
stroke: None,
stroke_width: 1.0,
float,
story: None,
freeform: None,
effects: Default::default(),
extra: Default::default(),
};
for frame_wrap in [Wrap::TopAndBottom, Wrap::BehindText] {
// Original synthetic version of #6587's first-line push. Only the frame wraps text.
let mut doc = wordcraft_doc::Document::from_text("A line under a frame.");
let old_top = doc.last_section.margin_top;
let (x, y) = (120.0, old_top - 22.0);
let object = Float { wrap: Wrap::InFrontOfText, h_rel: Anchor::Page, v_rel: Anchor::Page, x, y: old_top + 12.0, ..Default::default() };
let frame = Float { wrap: frame_wrap, v_rel: Anchor::Paragraph, y: -20.0, ..Default::default() };
let at = Pos::body(0, 0);
let end = Pos::body(0, OBJ.len_utf8());
doc.insert_object(&at, shape(40.0, 18.0, object), &Default::default()).unwrap();
doc.insert_object(&end, shape(300.0, 250.0, frame), &Default::default()).unwrap();
let mut s = Session::new(doc);
run(&mut s, "select.range", json!({"anchor": at, "focus": end}));
run(&mut s, "arrange.bounds", json!({"page": 0, "x": x, "y": y}));
let hit = s.layout().object(&at, 0).unwrap();
assert!((hit.rect.y - y).abs() < 0.01 && (hit.rect.x - x).abs() < 0.01, "{frame_wrap:?}: {hit:?}");
assert_eq!(hit.origin.y > old_top + 1.0, frame_wrap == Wrap::TopAndBottom);
for (with_text, anchor) in [(false, Anchor::Page), (true, Anchor::Paragraph)] {
run(&mut s, "arrange.moveWithText", json!({"value": with_text}));
let hit = s.layout().object(&at, 0).unwrap();
let (_, _, float) = s.doc.para_at(&at).unwrap().object_at(at.off).unwrap().frame().unwrap();
assert_eq!(float.v_rel, anchor);
assert!((hit.rect.y - y).abs() < 0.01, "{frame_wrap:?}, {anchor:?}: {hit:?}");
let origin = if with_text { hit.origin.y } else { 0.0 };
assert!((hit.rect.y - origin - float.y).abs() < 0.01, "{frame_wrap:?}, {anchor:?}: {hit:?}");
}
run(&mut s, "draw.stroke", json!({"page": 0, "points": [[x, y], [x + 10.0, y]], "width": 2.0}));
let ink = s.layout().object(&at, 0).unwrap();
assert!((ink.rect.y - (y - 1.0)).abs() < 0.01, "{frame_wrap:?}: {ink:?}");
}
}
#[test]
fn arrange_bounds_resizes_and_moves_objects() {
use wordcraft_doc::para::{Anchor, Wrap};
@@ -10161,6 +10111,77 @@ fn change_case_keeps_each_runs_formatting_when_lengths_change() {
assert_eq!(text(&s), "Q");
}
/// #3479: Change Case follows language-aware mapping for Turkish, Azerbaijani, and Crimean Tatar (i↔İ, ı↔I).
#[test]
fn change_case_follows_turkic_language_mapping() {
// 1. Turkish (tr-TR): all 5 modes
// Capitalize Each Word (title)
let mut s = s();
run(&mut s, "review.language", json!({"lang": "tr-TR", "default": true}));
run(&mut s, "text.insert", json!({"text": "istanbul ışık", "raw": true}));
run(&mut s, "select.all", json!({}));
run(&mut s, "format.changeCase", json!({"mode": "title"}));
assert_eq!(text(&s), "İstanbul Işık");
// UPPERCASE
run(&mut s, "format.changeCase", json!({"mode": "upper"}));
assert_eq!(text(&s), "İSTANBUL IŞIK");
// lowercase
run(&mut s, "format.changeCase", json!({"mode": "lower"}));
assert_eq!(text(&s), "istanbul ışık");
// sentence case
let mut s = self::s();
run(&mut s, "review.language", json!({"lang": "tr-TR", "default": true}));
run(&mut s, "text.insert", json!({"text": "istanbul. ışık.", "raw": true}));
run(&mut s, "select.all", json!({}));
run(&mut s, "format.changeCase", json!({"mode": "sentence"}));
assert_eq!(text(&s), "İstanbul. Işık.");
// toggle case
let mut s = self::s();
run(&mut s, "review.language", json!({"lang": "tr-TR", "default": true}));
run(&mut s, "text.insert", json!({"text": "İstanbul Işık", "raw": true}));
run(&mut s, "select.all", json!({}));
run(&mut s, "format.changeCase", json!({"mode": "toggle"}));
assert_eq!(text(&s), "iSTANBUL ıŞIK");
// 2. Azerbaijani (az-AZ)
let mut s = self::s();
run(&mut s, "review.language", json!({"lang": "az-AZ", "default": true}));
run(&mut s, "text.insert", json!({"text": "istanbul", "raw": true}));
run(&mut s, "select.all", json!({}));
run(&mut s, "format.changeCase", json!({"mode": "title"}));
assert_eq!(text(&s), "İstanbul");
// 3. Crimean Tatar (crh)
let mut s = self::s();
run(&mut s, "review.language", json!({"lang": "crh", "default": true}));
run(&mut s, "text.insert", json!({"text": "istanbul", "raw": true}));
run(&mut s, "select.all", json!({}));
run(&mut s, "format.changeCase", json!({"mode": "title"}));
assert_eq!(text(&s), "İstanbul");
// 4. English control (en-US): unchanged Unicode default
let mut s = self::s();
run(&mut s, "review.language", json!({"lang": "en-US", "default": true}));
run(&mut s, "text.insert", json!({"text": "istanbul", "raw": true}));
run(&mut s, "select.all", json!({}));
run(&mut s, "format.changeCase", json!({"mode": "title"}));
assert_eq!(text(&s), "Istanbul");
// 5. Mixed-language selection: Turkish run followed by English run
let mut s = self::s();
run(&mut s, "review.language", json!({"lang": "tr-TR"}));
run(&mut s, "text.insert", json!({"text": "istanbul ", "raw": true}));
run(&mut s, "review.language", json!({"lang": "en-US"}));
run(&mut s, "text.insert", json!({"text": "istanbul", "raw": true}));
run(&mut s, "select.all", json!({}));
run(&mut s, "format.changeCase", json!({"mode": "title"}));
assert_eq!(text(&s), "İstanbul Istanbul");
}
#[test]
fn change_case_sentence_ignores_decimal_points() {
// #3485: Sentence case should not capitalize after decimal points.
+36 -95
View File
@@ -2407,57 +2407,6 @@ fn arrow(s: &mut Session, key: &str) {
run(s, id, if extend { json!({"extend": true}) } else { json!({}) });
}
#[test]
fn arrow_keys_skip_wholly_deleted_paragraphs_in_no_markup() {
for (text, last) in [("AB\nCD\nEF", 2), ("AB\nCD\nDE\nEF", 3)] {
let mut s = typed(text);
let after_a = Pos::body(0, 1);
let before_f = Pos::body(last, 1);
run(&mut s, "review.trackChanges", json!({"value": true}));
run(&mut s, "select.range", json!({"anchor": after_a, "focus": before_f}));
run(&mut s, "text.delete", json!({}));
for i in 1..last {
let middle = s.doc.para_at(&Pos::body(i, 0)).unwrap();
assert!(middle.mark.del.is_some() && middle.runs.iter().all(|r| r.props.del.is_some()));
}
run(&mut s, "review.markup", json!({"value": "noMarkup"}));
for (from, key, shift, across, next) in [
(after_a.clone(), "Right", "Shift+Right", Pos::body(last, 0), Pos::body(last, 2)),
(before_f.clone(), "Left", "Shift+Left", Pos::body(0, 2), Pos::body(0, 0)),
] {
run(&mut s, "caret.set", json!({"pos": from}));
arrow(&mut s, shift);
assert_eq!((&s.sel.anchor, &s.sel.focus), (&from, &across));
run(&mut s, "caret.set", json!({"pos": from}));
arrow(&mut s, key);
assert!(s.sel.is_collapsed());
assert_eq!(s.sel.focus, across);
arrow(&mut s, key);
assert_eq!(s.sel.focus, next);
}
run(&mut s, "review.markup", json!({"value": "allMarkup"}));
run(&mut s, "review.trackingOptions", json!({"balloons": "inline"}));
for (from, key, expected) in [(Pos::body(0, 2), "Right", Pos::body(1, 0)), (Pos::body(last, 0), "Left", Pos::body(last - 1, 2))] {
run(&mut s, "caret.set", json!({"pos": from}));
arrow(&mut s, key);
assert_eq!(s.sel.focus, expected);
}
}
}
#[test]
fn arrow_keys_stop_in_a_visible_empty_paragraph_in_no_markup() {
let mut s = typed("AB\n\nEF");
run(&mut s, "review.markup", json!({"value": "noMarkup"}));
for (from, key) in [(Pos::body(0, 2), "Right"), (Pos::body(2, 0), "Left")] {
run(&mut s, "caret.set", json!({"pos": from}));
arrow(&mut s, key);
assert_eq!(s.sel.focus, Pos::body(1, 0));
}
}
/// The equation being edited and the caret in it.
fn editing(s: &Session) -> Option<(Pos, wordcraft_doc::math_edit::MathPos)> {
s.math.as_ref().map(|m| (m.at.clone(), m.pos.clone()))
@@ -2549,33 +2498,28 @@ fn arrow_keys_enter_a_visible_equation_across_a_hidden_deletion() {
let before = "a".len();
let after = "aé".len();
let end = MathPos::new(Vec::new(), units(&wordcraft_doc::math::parse_linear("x+y")));
for markup in ["noMarkup", "allMarkup"] {
for (key, shift_key, equation, from, across, math_pos) in [
("Right", "Shift+Right", after, before, after + equation_width, MathPos::default()),
("Left", "Shift+Left", before, after + equation_width, before, end.clone()),
] {
let mut s = typed("aéb");
let from = Pos::body(0, from);
let equation = Pos::body(0, equation);
run(&mut s, "caret.set", json!({"pos": equation}));
run(&mut s, "insert.equation", json!({"linear": "x+y", "edit": false}));
run(&mut s, "review.trackChanges", json!({"value": true}));
run(&mut s, "select.text", json!({"text": "é"}));
run(&mut s, "text.delete", json!({}));
run(&mut s, "review.markup", json!({"value": markup}));
if markup == "allMarkup" {
run(&mut s, "review.trackingOptions", json!({"balloons": "inline", "deleteMark": "hidden"}));
}
for (key, shift_key, equation, from, across, math_pos) in [
("Right", "Shift+Right", after, before, after + equation_width, MathPos::default()),
("Left", "Shift+Left", before, after + equation_width, before, end),
] {
let mut s = typed("aéb");
let from = Pos::body(0, from);
let equation = Pos::body(0, equation);
run(&mut s, "caret.set", json!({"pos": equation}));
run(&mut s, "insert.equation", json!({"linear": "x+y", "edit": false}));
run(&mut s, "review.trackChanges", json!({"value": true}));
run(&mut s, "select.text", json!({"text": "é"}));
run(&mut s, "text.delete", json!({}));
run(&mut s, "review.markup", json!({"value": "noMarkup"}));
run(&mut s, "caret.set", json!({"pos": from}));
arrow(&mut s, shift_key);
assert!(editing(&s).is_none(), "{shift_key} extends the selection");
assert_eq!((s.sel.anchor.clone(), s.sel.focus.clone()), (from.clone(), Pos::body(0, across)));
run(&mut s, "caret.set", json!({"pos": from}));
arrow(&mut s, shift_key);
assert!(editing(&s).is_none(), "{shift_key} extends the selection");
assert_eq!((s.sel.anchor.clone(), s.sel.focus.clone()), (from.clone(), Pos::body(0, across)));
run(&mut s, "caret.set", json!({"pos": from}));
arrow(&mut s, key);
assert_eq!(editing(&s), Some((equation, math_pos)), "{key} with {markup}");
}
run(&mut s, "caret.set", json!({"pos": from}));
arrow(&mut s, key);
assert_eq!(editing(&s), Some((equation, math_pos)));
}
}
@@ -3573,11 +3517,11 @@ fn autocorrect_capitalisation_follows_turkic_case_mapping() {
fn change_case_follows_turkic_case_mapping() {
for tag in ["tr-TR", "az-AZ", "crh"] {
for (mode, input, want) in [
("upper", "istanbul ışık", "İSTANBUL IŞIK"),
("lower", "İSTANBUL IŞIK", "istanbul ışık"),
("title", "istanbul ışık", "İstanbul Işık"),
("sentence", "istanbul. izmir. ışık.", "İstanbul. İzmir. Işık."),
("toggle", "iIİı", "İıiI"),
("upper", "istanbul", "İSTANBUL"),
("lower", "IŞIK", "ışık"),
("title", "istanbul güzel", "İstanbul Güzel"),
("sentence", "istanbul. izmir", "İstanbul. İzmir"),
("toggle", "iI", "İı"),
] {
let mut s = s();
run(&mut s, "review.language", json!({"lang": tag, "default": true}));
@@ -3594,20 +3538,17 @@ fn change_case_follows_turkic_case_mapping() {
run(&mut s, "format.changeCase", json!({"mode": "title"}));
assert_eq!(s.doc.plain_text(StoryRef::Body), "Istanbul", "en-US");
// Mixed runs: each run's own language decides.
for (mode, first, second, want) in [
("lower", "IŞIK ", "IŞIK", "ışık işik"),
("title", "istanbul ", "istanbul", "İstanbul Istanbul"),
("upper", "istanbul ", "istanbul", "İSTANBUL ISTANBUL"),
] {
let mut s = self::s();
run(&mut s, "review.language", json!({"lang": "tr-TR"}));
run(&mut s, "text.insert", json!({"text": first, "raw": true}));
run(&mut s, "review.language", json!({"lang": "en-US"}));
run(&mut s, "text.insert", json!({"text": second, "raw": true}));
run(&mut s, "select.all", json!({}));
run(&mut s, "format.changeCase", json!({"mode": mode}));
assert_eq!(s.doc.plain_text(StoryRef::Body), want, "mixed runs {mode}");
}
let mut s = self::s();
run(&mut s, "text.insert", json!({"text": "IŞIK IŞIK", "raw": true}));
run(&mut s, "caret.set", json!({"pos": Pos::body(0, 0)}));
run(&mut s, "caret.set", json!({"pos": Pos::body(0, 5), "extend": true}));
run(&mut s, "review.language", json!({"lang": "tr-TR"}));
run(&mut s, "caret.set", json!({"pos": Pos::body(0, 6)}));
run(&mut s, "caret.set", json!({"pos": Pos::body(0, 11), "extend": true}));
run(&mut s, "review.language", json!({"lang": "en-US"}));
run(&mut s, "select.all", json!({}));
run(&mut s, "format.changeCase", json!({"mode": "lower"}));
assert_eq!(s.doc.plain_text(StoryRef::Body), "ışık işik", "mixed runs");
}
// Spelling as you type (#1552): the word being typed gets no red squiggle until the caret leaves
+2 -4
View File
@@ -9,10 +9,8 @@ description = "WordCraft import/export: plain text, Markdown, HTML, RTF, OpenDoc
workspace = true
[features]
# Test helpers shared with other crates: `sheet::xls_fixture` (binary workbook builder via
# `craft-xls/test-support`) and `with_shared_conversion_error` / `with_shared_conversion_error_after`,
# which wire thread-local forced-failure hooks into `to_shared` and `from_shared`. Never enable
# outside dev-dependencies, so those hooks are never built into the app.
# `sheet::xls_fixture`, the binary workbook builder other crates' tests share; turned on only as a
# dev-dependency, so never built into the app.
test-support = ["craft-xls/test-support"]
[dependencies]
-1
View File
@@ -14,7 +14,6 @@ wordcraft-doc = { workspace = true }
wordcraft-fonts = { workspace = true }
wordcraft-proof = { workspace = true }
craft-metafile = { workspace = true }
craft-xml = { workspace = true }
kurbo = { workspace = true }
unicode-bidi = { workspace = true }
unicode-linebreak = { workspace = true }
+9 -5
View File
@@ -1,9 +1,9 @@
use super::ctx::{Ctx, Joining, page_anchored};
use super::floats::{
AnchoredFloat, ObjFrame, ObjectPlacement, WrapArea, align_in, float_rect, floating, left_out_objects, place_objects, rel_exclusions, wrap_area,
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, margin_y};
use super::page::PageFrame;
use super::placed::Placed;
use super::table_flow::below;
use super::{
@@ -335,7 +335,7 @@ pub(crate) fn layout_box(ctx: &mut Ctx, input: BoxInput<'_>) -> BoxLayout {
let h = ctx.float_height(o, w, h);
if let Some(pin) = ctx.pin.as_ref().filter(|pin| in_cell && pin.story == story && float.outside_cell && page_anchored(float)) {
let page =
PageFrame { sect: &pin.sect, margin_area: pin.margin_area, origin: (0.0, 0.0), number: pin.number, mirror: pin.mirror };
PageFrame { sect: &pin.sect, margin_top: pin.margin_top, origin: (0.0, 0.0), number: pin.number, mirror: pin.mirror };
pinned.insert(oi, float_rect(Some(page), (0.0, width), para_top, w, h, float));
continue;
}
@@ -361,7 +361,7 @@ pub(crate) fn layout_box(ctx: &mut Ctx, input: BoxInput<'_>) -> BoxLayout {
let outline = ctx.wrap_outline(o);
excl.extend(wrap_area(r, float, outline.as_deref().map(Vec::as_slice)));
}
floats.insert(oi, AnchoredFloat::new(r));
floats.insert(oi, r);
}
let rel = rel_exclusions(&excl, 0.0, y, applied);
if !rel.is_empty() {
@@ -561,7 +561,11 @@ fn box_float_table_rect(
let s = fr.sect;
match f.v_rel {
Anchor::Page => Some((0.0, s.page_h)),
Anchor::Margin => Some(margin_y(fr)),
Anchor::Margin => {
let mut reference = s.clone();
reference.margin_top = fr.margin_top.unwrap_or(s.margin_top);
Some((reference.margin_top, reference.text_height()))
}
_ => None,
}
};
-1
View File
@@ -156,7 +156,6 @@ pub(crate) fn env_hash(doc: &Document, cache: &mut LayoutCache, opts: &LayoutOpt
doc.settings.major_font.hash(&mut h);
doc.settings.minor_font.hash(&mut h);
doc.passthrough.get("wordcraft:theme.fonts").hash(&mut h);
doc.passthrough.get("wordcraft:settings.orig").hash(&mut h);
// The compatibility mode changes paragraph layout too (widow control in table cells).
doc.settings.compat_mode.hash(&mut h);
opts.show_hidden.hash(&mut h);
+4 -4
View File
@@ -136,8 +136,8 @@ struct WrapAreas<'a> {
pub(crate) struct Pin {
pub(crate) story: StoryRef,
pub(crate) sect: SectionProps,
/// Rendered body top and bottom for header Margin anchors; absent in footers and height probes.
pub(crate) margin_area: Option<(f32, f32)>,
/// Rendered header Margin boundary; absent in footers and height probes.
pub(crate) margin_top: Option<f32>,
pub(crate) number: u32,
pub(crate) mirror: bool,
pub(crate) behind: Vec<Placed>,
@@ -162,7 +162,7 @@ pub(crate) fn with_pin<T>(
id: u32,
sect: &SectionProps,
number: u32,
margin_area: Option<(f32, f32)>,
margin_top: Option<f32>,
f: impl FnOnce(&mut Ctx) -> T,
) -> (T, Vec<Placed>, Vec<Placed>) {
let tables = ctx.doc.parts.get(&id).is_some_and(|p| p.blocks.iter().any(|b| matches!(**b, Block::Table(_))));
@@ -172,7 +172,7 @@ pub(crate) fn with_pin<T>(
let pin = Pin {
story: StoryRef::Part(id),
sect: sect.clone(),
margin_area,
margin_top,
number,
mirror: ctx.mirror,
behind: Vec::new(),
+23 -37
View File
@@ -1,5 +1,5 @@
use super::ctx::Ctx;
use super::page::{PageBuilder, PageFrame, margin_y};
use super::page::{PageBuilder, PageFrame};
use super::placed::Placed;
use super::table_flow::footer_table_wraps;
use super::{
@@ -82,9 +82,14 @@ pub(crate) fn float_rect(frame: Option<PageFrame>, col: (f32, f32), y0: f32, w:
};
let page_y = |f: &PageFrame| {
let s = f.sect;
let top = f.margin_top.unwrap_or(s.margin_top);
match float.v_rel {
Anchor::Page => Some((0.0, s.page_h)),
Anchor::Margin => Some(margin_y(f)),
Anchor::Margin => {
let mut reference = s.clone();
reference.margin_top = top;
Some((top, reference.text_height()))
}
Anchor::TopMargin | Anchor::InsideMargin => Some((0.0, s.margin_top)),
Anchor::BottomMargin | Anchor::OutsideMargin => Some((s.page_h - s.margin_bottom, s.margin_bottom)),
_ => None,
@@ -344,7 +349,7 @@ pub(crate) fn anchor_floats(
pb: &mut PageBuilder,
anchor: FloatAnchor,
force: &[usize],
) -> (HashMap<usize, AnchoredFloat>, Arc<ParaLayout>, Vec<para::Exclusion>, Vec<usize>) {
) -> (HashMap<usize, Rect>, Arc<ParaLayout>, Vec<para::Exclusion>, Vec<usize>) {
let FloatAnchor { p, block, y0, place, .. } = anchor;
ctx.fields.page = pb.number;
// Each layout of it here counts its automatic equation numbers from the same place.
@@ -424,7 +429,7 @@ pub(crate) fn place_late(ctx: &mut Ctx, pb: &mut PageBuilder, p: &Paragraph, oi:
let Some(o) = p.objects.get(oi) else { return };
let Some((w, h, float)) = floating(o) else { return };
let h = ctx.float_height(o, w, h);
let frame = PageFrame { sect: pb.sect, margin_area: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror };
let frame = PageFrame { sect: pb.sect, margin_top: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror };
let rect = float_rect(Some(frame), (pb.col_x(), pb.col_w()), top, w, h, float);
let outline = ctx.wrap_outline(o);
let area = wrap_area(rect, float, outline.as_deref().map(Vec::as_slice)).map(|a| {
@@ -466,26 +471,13 @@ pub(crate) fn anchor_lines(p: &Paragraph, pl: &ParaLayout) -> Vec<Option<usize>>
out
}
/// A float placed before its paragraph's objects are drawn.
pub(crate) struct AnchoredFloat {
rect: Rect,
/// The origin used when the float was placed again from the pushed first line.
pushed_origin: Option<f32>,
}
impl AnchoredFloat {
pub(crate) fn new(rect: Rect) -> Self {
Self { rect, pushed_origin: None }
}
}
/// [`anchor_floats`], leaving out the floats in `late` (in order).
fn anchor_floats_but(
ctx: &mut Ctx,
pb: &mut PageBuilder,
anchor: FloatAnchor,
late: &[usize],
) -> (HashMap<usize, AnchoredFloat>, Arc<ParaLayout>, Vec<para::Exclusion>) {
) -> (HashMap<usize, Rect>, Arc<ParaLayout>, Vec<para::Exclusion>) {
let FloatAnchor { p, block, y0, before, excl_mark, label, place } = anchor;
ctx.fields.page = pb.number;
ctx.fields.page_format = pb.page_format;
@@ -500,7 +492,7 @@ fn anchor_floats_but(
// The paragraph's top, and whether text was placed before it on the page.
let top = y0 - before;
let text_before = top > pb.top + 0.5 || pb.col > 0;
let frame = PageFrame { sect: pb.sect, margin_area: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror };
let frame = PageFrame { sect: pb.sect, margin_top: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror };
// An object left out of the layout (hidden, or deleted in the final text) is not placed, so
// it takes no room either.
let left_out = left_out_objects(ctx.doc, p, None, ctx.opts.show_hidden, ctx.hide_deleted);
@@ -523,7 +515,7 @@ fn anchor_floats_but(
let seed = early.and_then(|v| v.iter().find(|(b, k, _)| (*b, *k) == (block, oi))).map(|(_, _, a)| a);
(r, area) = settle_early(r, area, seed, top, |r| wrap_area(r, float, outline));
}
rects.insert(oi, AnchoredFloat::new(r));
rects.insert(oi, r);
// Above the paragraph, beside text laid out before it: the page is laid out again
// with it known from the start (#2048).
let above = area.as_ref().filter(|a| text_before && a.0.y < top - 0.5).map(|a| (page, a.clone()));
@@ -557,12 +549,11 @@ fn anchor_floats_but(
let page = pb.pages.len().saturating_sub(1);
let top = y0 - before;
let text_before = top > pb.top + 0.5 || pb.col > 0;
let frame = PageFrame { sect: pb.sect, margin_area: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror };
let frame = PageFrame { sect: pb.sect, margin_top: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror };
for (oi, o) in p.objects.iter().enumerate() {
let Some((_, _, float)) = floating(o) else { continue };
let Some(&area) = areas.get(&oi) else { continue };
let Some(placed) = rects.get_mut(&oi) else { continue };
let r = placed.rect;
let Some(&r) = rects.get(&oi) else { continue };
if float.y < 0.0 && area.map_or(r.bottom(), |(_, b)| b) < y0 + lead - 0.5 {
// Only down: across it stays where it was placed (`settle_early` may have moved it).
let moved = Rect { y: float_rect(Some(frame), (col_x, width), top + lead, r.w, r.h, float).y, ..r };
@@ -570,11 +561,7 @@ fn anchor_floats_but(
if area.is_some_and(|(_, b)| b + (moved.y - r.y) > y0 + lead - 0.5) {
continue;
}
placed.rect = moved;
placed.pushed_origin = match float.v_rel {
Anchor::Page | Anchor::Margin | Anchor::TopMargin | Anchor::BottomMargin | Anchor::InsideMargin | Anchor::OutsideMargin => None,
_ => Some(top + lead),
};
rects.insert(oi, moved);
if let Some((k, _)) = area
&& let Some(slot) = pb.excl.get_mut(k)
{
@@ -751,7 +738,7 @@ pub(crate) struct ObjectPlacement<'a> {
pub lines: (usize, usize),
pub origin: (f32, f32),
pub at: &'a ObjFrame<'a>,
pub floats: &'a HashMap<usize, AnchoredFloat>,
pub floats: &'a HashMap<usize, Rect>,
pub depth: usize,
}
@@ -811,23 +798,22 @@ pub(crate) fn place_objects(ctx: &mut Ctx, req: &ObjectPlacement) -> (Vec<Placed
continue;
}
let pinned = at.pinned.and_then(|m| m.get(&oi)).copied().filter(|_| floating);
let (rect, origin_y) = if let Some(r) = pinned {
(r, at.para_y)
let rect = if let Some(r) = pinned {
r
} else if let Some(l) = late_here {
(l.rect, l.top)
l.rect
} else if floating {
match floats.get(&oi) {
Some(placed) => (placed.rect, placed.pushed_origin.unwrap_or(at.para_y)),
Some(r) => *r,
None => {
let h = ctx.float_height(obj, w, h);
(float_rect(at.page, at.col, at.para_y, w, h, float), at.para_y)
float_rect(at.page, at.col, at.para_y, w, h, float)
}
}
} else {
let cx = x + line.cl_left(k).unwrap_or(0.0);
let modern = ctx.doc.settings.compat_mode >= wordcraft_doc::COMPAT_MODE_CURRENT;
let r = display::inline_rect(Some(obj), cx, y + (line.baseline - fl.top), c.adv, (c.obj_h, c.obj_d), pl.rule_room(line, k), modern);
(r, at.para_y)
display::inline_rect(Some(obj), cx, y + (line.baseline - fl.top), c.adv, (c.obj_h, c.obj_d), pl.rule_room(line, k), modern)
};
let (mut behind, mut front) = (Vec::new(), Vec::new());
let layer = if float.wrap == Wrap::BehindText { &mut behind } else { &mut front };
@@ -874,7 +860,7 @@ pub(crate) fn place_objects(ctx: &mut Ctx, req: &ObjectPlacement) -> (Vec<Placed
off: c.start,
text_box: shown,
wrap: float.wrap,
origin: Point::new(at.col.0, origin_y),
origin: Point::new(at.col.0, late_here.map_or(at.para_y, |l| l.top)),
group_boxes,
});
for (id, rect) in boxes {
+8 -9
View File
@@ -2,16 +2,16 @@ use super::boxes::{BoxInput, BoxLayout, Edges, Joint, frame_float, joined, layou
use super::cache::has_page_number_fields;
use super::ctx::{Ctx, Joining};
use super::floats::{
AnchoredFloat, FloatAnchor, LateFloats, ObjFrame, ObjectPlacement, anchor_floats, body_wraps, continued_exclusions, fitting, float_rect,
late_floats, place_late, place_objects, wrap_area,
FloatAnchor, LateFloats, ObjFrame, ObjectPlacement, anchor_floats, body_wraps, continued_exclusions, fitting, float_rect, late_floats,
place_late, place_objects, wrap_area,
};
use super::notes::{DECOR_STORY, NoteBox, para_notes};
use super::page::{PageBuilder, PageFrame, item_bottom};
use super::placed::Placed;
use super::table_flow::table_start_need;
use super::{
Arc, Block, Counters, Document, HashMap, InlineObject, Level, LineEnd, Page, ParaLayout, Paragraph, Path, StoryRef, TextDirection, ViewMode,
outline, para,
Arc, Block, Counters, Document, HashMap, InlineObject, Level, LineEnd, Page, ParaLayout, Paragraph, Path, Rect, StoryRef, TextDirection,
ViewMode, outline, para,
};
#[cfg(test)]
use crate::WRAP_RELAYS;
@@ -118,7 +118,7 @@ fn place_page_text_frame(ctx: &mut Ctx, pb: &mut PageBuilder, p: &Paragraph, blo
add_notes(pb, new_notes, &notes, pl.lines.last().map_or(0, |line| line.c1));
let height = fr.h.map_or(pl.height, |h| if fr.h_exact { h } else { h.max(pl.height) });
let float = frame_float(&fr);
let page = PageFrame { sect: pb.sect, margin_area: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror };
let page = PageFrame { sect: pb.sect, margin_top: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror };
let rect = float_rect(Some(page), (pb.col_x(), pb.col_w()), pb.y, width, height, &float);
let path = [block as u32];
if let Some(page) = pb.page() {
@@ -279,7 +279,7 @@ struct Flow<'a> {
excl_mark: usize,
/// Where its automatic equation numbers start: each layout of it again counts from here.
eq_start: u32,
float_rects: HashMap<usize, AnchoredFloat>,
float_rects: HashMap<usize, Rect>,
pl: Arc<ParaLayout>,
rel: Vec<para::Exclusion>,
/// The page its fields were laid out for, and the width.
@@ -753,7 +753,7 @@ impl<'a> Flow<'a> {
self.space_here = 0.0;
// Pictures, shapes and text boxes in these lines (web view: floats placed by this piece).
let at = ObjFrame {
page: Some(PageFrame { sect: pb.sect, margin_area: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror }),
page: Some(PageFrame { sect: pb.sect, margin_top: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror }),
col: (x, self.width),
para_y: if pb.web { y } else { self.anchor_y },
table_chr: None,
@@ -1156,7 +1156,7 @@ pub(crate) fn place_outline_para(ctx: &mut Ctx, pb: &mut PageBuilder, p: &Paragr
let mut items = Vec::new();
push_para(&mut items, (StoryRef::Body, &[block as u32]), &pl, (0, l1), (x, y), width, edges);
let at = ObjFrame {
page: Some(PageFrame { sect: pb.sect, margin_area: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror }),
page: Some(PageFrame { sect: pb.sect, margin_top: None, origin: (0.0, 0.0), number: pb.number, mirror: ctx.mirror }),
col: (x, width),
para_y: y,
table_chr: None,
@@ -1312,7 +1312,6 @@ mod tests {
use wordcraft_doc::Pos;
use wordcraft_doc::para::{Anchor, Float, LINE_BREAK, Wrap, WrapText};
use wordcraft_doc::props::LineSpacing;
use wordcraft_geom::Rect;
#[test]
fn strict_balancing_remeasures_kept_lines_in_the_next_column() {
+7 -34
View File
@@ -218,8 +218,7 @@ pub(crate) fn header_table_areas(ctx: &mut Ctx, pb: &PageBuilder) -> Vec<Rect> {
let Some(part) = ctx.doc.parts.get(&id) else { return Vec::new() };
let blocks = part.blocks.clone();
let x = sect.margin_left + sect.gutter;
let frame =
PageFrame { sect, margin_area: Some((page.body.y, page.body.bottom())), origin: (x, sect.header), number: page.number, mirror: ctx.mirror };
let frame = PageFrame { sect, margin_top: Some(page.body.y), origin: (x, sect.header), number: page.number, mirror: ctx.mirror };
let base = hf.defining_width(false, page.section, Some(id));
let counters = std::mem::take(&mut ctx.counters);
let boxes = std::mem::take(&mut ctx.boxes);
@@ -472,37 +471,11 @@ pub(crate) fn headers_footers(ctx: &mut Ctx, pages: &mut [Page], sections: &[(us
&& let Some(part) = ctx.doc.parts.get(&id)
{
let blocks = part.blocks.clone();
let frame = PageFrame {
sect,
margin_area: Some((page.body.y, page.body.bottom())),
origin: (x, sect.header),
number: page.number,
mirror: ctx.mirror,
};
let frame = PageFrame { sect, margin_top: Some(page.body.y), origin: (x, sect.header), number: page.number, mirror: ctx.mirror };
let base = hf.defining_width(false, page.section, hid);
let lay_header = |ctx: &mut Ctx, frame: PageFrame| {
with_pin(ctx, id, sect, page.number, frame.margin_area, |ctx| {
with_pct_base(ctx, base, |c| layout_box(c, BoxInput::other(StoryRef::Part(id), &blocks, w, 0, Some(frame))))
})
};
// List counters and equation numbers before the header, so a second layout counts
// from the same place and only the layout kept advances them.
let before = (ctx.counters.clone(), ctx.eq_count);
let (mut laid, mut behind, mut front) = lay_header(ctx, frame);
// The body top was measured with the declared margins (`body_top_for`). If the rendered
// area moves a wrapping Margin-anchored object into the header's text and the header
// grows past that body top, keep the measured layout: its text can't run into the body.
if sect.header + laid.height > page.body.y + 0.01 {
let rendered = (std::mem::replace(&mut ctx.counters, before.0), ctx.eq_count);
ctx.eq_count = before.1;
let measured = lay_header(ctx, PageFrame { margin_area: None, ..frame });
if measured.0.height < laid.height - 0.01 {
(laid, behind, front) = measured;
} else {
(ctx.counters, ctx.eq_count) = rendered;
}
}
let mut items = laid.items;
let (mut items, behind, front) = with_pin(ctx, id, sect, page.number, frame.margin_top, |ctx| {
with_pct_base(ctx, base, |c| layout_box(c, BoxInput::other(StoryRef::Part(id), &blocks, w, 0, Some(frame))).items)
});
for it in &mut items {
it.translate(x, sect.header);
}
@@ -518,8 +491,8 @@ pub(crate) fn headers_footers(ctx: &mut Ctx, pages: &mut [Page], sections: &[(us
let (h, ..) = with_pin(ctx, id, sect, page.number, None, |ctx| {
with_pct_base(ctx, base, |c| layout_box(c, BoxInput::other(StoryRef::Part(id), &blocks, w, 0, None)).height)
});
let frame = PageFrame { sect, margin_area: None, origin: (x, sect.page_h - sect.footer - h), number: page.number, mirror: ctx.mirror };
let (mut items, behind, front) = with_pin(ctx, id, sect, page.number, frame.margin_area, |ctx| {
let frame = PageFrame { sect, margin_top: None, origin: (x, sect.page_h - sect.footer - h), number: page.number, mirror: ctx.mirror };
let (mut items, behind, front) = with_pin(ctx, id, sect, page.number, frame.margin_top, |ctx| {
with_pct_base(ctx, base, |c| layout_box(c, BoxInput::other(StoryRef::Part(id), &blocks, w, 0, Some(frame))).items)
});
for it in &mut items {
+4 -18
View File
@@ -575,7 +575,7 @@ pub(crate) fn body_top_for(ctx: &mut Ctx, sect: &SectionProps, header: Option<u3
let Some(part) = ctx.doc.parts.get(&id) else { return sect.margin_top };
let blocks = part.blocks.clone();
// Placed as `headers_footers` draws it, so page-relative floats wrap the same way.
let frame = PageFrame { sect, margin_area: None, origin: (sect.margin_left + sect.gutter, sect.header), number: 1, mirror: ctx.mirror };
let frame = PageFrame { sect, margin_top: None, origin: (sect.margin_left + sect.gutter, sect.header), number: 1, mirror: ctx.mirror };
let track = std::mem::replace(&mut ctx.track_totals, false);
let (h, ..) = with_pin(ctx, id, sect, 1, None, |ctx| {
layout_box(ctx, BoxInput::other(StoryRef::Part(id), &blocks, sect.text_width(), 0, Some(frame))).height
@@ -637,10 +637,8 @@ pub(crate) fn foot_top_for(ctx: &mut Ctx, sect: &SectionProps, footer: Option<u3
#[derive(Clone, Copy)]
pub(crate) struct PageFrame<'a> {
pub(crate) sect: &'a SectionProps,
/// Override the Margin anchor area (its top and bottom) with the rendered body's, without
/// changing the declared margin bands: a header or footer that reaches past its margin moves
/// the area Word measures from (#2485).
pub(crate) margin_area: Option<(f32, f32)>,
/// Override the Margin anchor area without changing the declared margin bands.
pub(crate) margin_top: Option<f32>,
/// Page position of the box's (0, 0); (0, 0) for body text.
pub(crate) origin: (f32, f32),
/// The page's number: inside and outside are left and right on odd pages, the other way
@@ -673,19 +671,7 @@ impl PageFrame<'_> {
}
}
/// The Margin anchor area down the page, start and extent: the rendered body when `f` has one
/// (both edges: Word centres a header picture between the body's top and the footer's top, not
/// down to the declared bottom margin), else the declared margins; at least 18 pt, as
/// [`SectionProps::text_height`].
pub(crate) fn margin_y(f: &PageFrame) -> (f32, f32) {
let s = f.sect;
match f.margin_area {
Some((top, bottom)) => (top, (bottom - top).max(18.0)),
None => (s.margin_top, s.text_height()),
}
}
/// The page `pb` is filling, for placing floating objects on it (`mirror`: [`Ctx::mirror`]).
pub(crate) fn page_frame<'a>(pb: &PageBuilder<'a>, mirror: bool) -> PageFrame<'a> {
PageFrame { sect: pb.sect, margin_area: None, origin: (0.0, 0.0), number: pb.number, mirror }
PageFrame { sect: pb.sect, margin_top: None, origin: (0.0, 0.0), number: pb.number, mirror }
}
+2 -3
View File
@@ -155,9 +155,8 @@ impl<'a> Builder<'a> {
_ => wordcraft_fonts::FontDb::global().fallback_styled(dc, primary.id(), bold, italic).map(|f| FaceRef::of(&f)),
};
// A mark is set like the character it belongs to, as for `complex`: in small capitals at
// that character's size, even when the run's font already draws the mark, so the two
// stay in one shaping run, can compose or position together, and match their cluster
// whole (#7865, #8571).
// that character's size, so the two stay in one shaping run and its cluster is matched
// whole.
let small = match cur {
Some(k) if mark => k.small,
_ => rc.small_caps && !rc.caps && c.is_lowercase(),
+7 -34
View File
@@ -215,48 +215,21 @@ pub fn substitute_face(doc: &Document, font: &str) -> Option<FaceRef> {
const THEME_FONTS_PASSTHROUGH: &str = "wordcraft:theme.fonts";
/// The theme's East Asian face, falling back to its per-script font for the settings'
/// East Asian theme language when the main `a:ea` face is empty.
/// The East Asian font (`a:ea`) stored for the theme's major or minor font scheme, when the
/// document's theme names a non-empty one (`craft-docx` keeps them in `wordcraft:theme.fonts`).
fn theme_ea_face(doc: &Document, major: bool) -> Option<&str> {
let text = std::str::from_utf8(doc.passthrough.get(THEME_FONTS_PASSTHROUGH)?).ok()?;
let key = if major { "major" } else { "minor" };
let find = |kind: &str, which: &str| {
text.lines().find_map(|line| {
let mut parts = line.splitn(4, '\t');
let (k, t, w, face) = (parts.next()?, parts.next()?, parts.next()?, parts.next()?);
(k == key && t == kind && w == which && !face.trim().is_empty()).then_some(face)
})
};
find("face", "ea").or_else(|| {
let settings = craft_xml::parse(doc.passthrough.get("wordcraft:settings.orig")?).ok()?;
let lang = settings.child(craft_xml::Local("themeFontLang"))?.attr_local("eastAsia")?;
find("script", theme_ea_script(lang)?)
text.lines().find_map(|line| {
let mut parts = line.splitn(4, '\t');
let (k, kind, which, face) = (parts.next()?, parts.next()?, parts.next()?, parts.next()?);
(k == key && kind == "face" && which == "ea" && !face.trim().is_empty()).then_some(face)
})
}
/// The East Asian scripts used by theme font entries. An explicit script takes precedence
/// over the language's usual script, including Traditional Chinese outside Taiwan/Hong Kong.
fn theme_ea_script(lang: &str) -> Option<&'static str> {
let mut parts = lang.trim().split(['-', '_']);
let language = parts.next()?;
let rest: Vec<_> = parts.collect();
if let Some(script) = rest.iter().find_map(|p| ["Hans", "Hant", "Jpan", "Hang"].into_iter().find(|s| s.eq_ignore_ascii_case(p))) {
return Some(script);
}
if language.eq_ignore_ascii_case("ja") {
Some("Jpan")
} else if language.eq_ignore_ascii_case("ko") {
Some("Hang")
} else if language.eq_ignore_ascii_case("zh") {
Some(if rest.iter().any(|p| ["TW", "HK", "MO"].iter().any(|r| r.eq_ignore_ascii_case(p))) { "Hant" } else { "Hans" })
} else {
None
}
}
/// The East Asian font effective for a run (`w:eastAsiaTheme` takes precedence over `w:eastAsia`,
/// including an inherited `w:eastAsia`). Returns `None` when none is named or the theme slot
/// points to an East Asian theme font with neither a main face nor a matching per-script face.
/// points to an East Asian theme font with no single named `a:ea` face.
pub(super) fn east_asian_font<'a>(doc: &'a Document, rc: &'a ResolvedChar) -> Option<&'a str> {
use wordcraft_doc::props::ThemeFont;
match rc.font_ea_theme {
+7 -17
View File
@@ -61,9 +61,6 @@ struct Breaker<'e> {
i: usize,
top: f32,
first: bool,
/// Whether `[top - space_before, top]` holds laid-out space before (initially and after a
/// Top-and-Bottom push), rather than a span cleared past a side-wrapping object (#8614, #8687).
space_band: bool,
/// The rest of the current row: spans on the far side of floating objects, left to right.
row_rest: VecDeque<(f32, f32)>,
row_first: usize,
@@ -235,7 +232,6 @@ impl<'e> Breaker<'e> {
i: 0,
top: 0.0,
first: true,
space_band: true,
row_rest: VecDeque::new(),
row_first: 0,
skipped: 0,
@@ -272,13 +268,13 @@ impl<'e> Breaker<'e> {
let lo = self.row_left(pl);
// A Top-and-Bottom object ending in the paragraph's space before (or reaching into
// its first line) is a block the first line must start below, with that space before
// laid out again under it (#7143). Look `space_before` above `self.top` initially and
// after a Top-and-Bottom push so stacked Top-and-Bottom objects re-apply `space_before`
// too (#8687), but not after a side-wrapping push (`row_spans` or `skip_row`), where
// the span above `self.top` was cleared past a side-wrapping object (#8614).
if self.first && self.space_band && self.space_before > 0.0 {
// laid out again under it (#7143). Exclusions are relative to the first line's
// original top (0), so keep the band anchored there (`[-before, est_h]`) even after
// `row_spans` or `skip_row` moves `self.top` down past a side-wrapping object (#8614):
// only the space the flow actually laid out above 0 holds a space-before obstruction.
if self.first && self.space_before > 0.0 {
let before = self.space_before;
let row = (self.top - before, self.est_h + before, self.table_h + before);
let row = (-before, self.est_h + before, self.table_h);
if let Some(below) = self
.exclusions
.iter()
@@ -286,12 +282,8 @@ impl<'e> Breaker<'e> {
.filter(|e| e.intersects_row(row.0, row.1, row.2, lo, self.base_right))
.map(|e| e.bottom)
.reduce(f32::max)
&& below + before > self.top
&& guard < 50
{
self.top = below + before;
guard += 1;
continue;
self.top = self.top.max(below + before);
}
}
let row = (self.top, self.est_h, self.table_h);
@@ -306,7 +298,6 @@ impl<'e> Breaker<'e> {
}
Err(below) if below > self.top && guard < 50 => {
self.top = below;
self.space_band = false;
guard += 1;
}
Ok((None, _)) | Err(_) => {
@@ -388,7 +379,6 @@ impl<'e> Breaker<'e> {
self.top + even_row(self.lines.get_mut(self.row_first..).unwrap_or_default())
} else {
// Nothing on this row: go below the first object that ends, as when no span is wide enough.
self.space_band = false;
self.exclusions
.iter()
.filter(|e| e.intersects_row(self.top, self.est_h, self.table_h, sc.row_lo, self.base_right))
+1 -1
View File
@@ -51,7 +51,7 @@ pub(crate) fn footer_table_wraps(ctx: &mut Ctx, pb: &PageBuilder) -> Vec<WrapAre
let story = StoryRef::Part(id);
let h = layout_box(ctx, BoxInput::other(story, &blocks, sect.text_width(), 0, None)).height;
let y = sect.page_h - sect.footer - h;
let frame = PageFrame { sect, margin_area: None, origin: (x, y), number: page.number, mirror: ctx.mirror };
let frame = PageFrame { sect, margin_top: None, origin: (x, y), number: page.number, mirror: ctx.mirror };
let mut areas = layout_box(ctx, BoxInput::other(story, &blocks, sect.text_width(), 0, Some(frame))).page_table_wraps;
for (rect, ..) in &mut areas {
rect.x += x;
+6 -246
View File
@@ -3894,9 +3894,9 @@ fn a_text_box_skips_the_min_height_probe_for_turned_text() {
assert!(b.h > 80.0, "and so it runs on past the minimum height: {b:?}");
}
/// A single word longer than an at-least row's minimum height (0.3 cm / ~8.5 pt) breaks across
/// multiple lines instead of growing the row, and letters wider than that minimum overhang the
/// row along its length, as long as the wrapped lines fit across the column.
/// A single word longer than an at-least row's minimum height (0.3 cm / ~8.5 pt) runs past
/// the row along its length instead of growing the row, as long as the wrapped pieces fit across
/// the column.
#[test]
fn a_word_longer_than_min_height_does_not_grow_an_at_least_row() {
use wordcraft_doc::props::HeightRule;
@@ -3922,20 +3922,17 @@ fn a_word_longer_than_min_height_does_not_grow_an_at_least_row() {
.unwrap();
assert!((rect.h - min_h).abs() < 0.01, "{turn:?}: cell grew past min height {min_h}: {rect:?}");
assert!(!clip, "{turn:?}: an at-least row does not clip overflowing text");
let (lines, extent) = l.pages[0]
let extent = l.pages[0]
.items
.iter()
.find_map(|it| match it {
Placed::Lines { para, l0, l1, path, .. } if path.0 == [0, 0, 0, 0] => {
let lines = l1 - l0;
let extent = para.lines.get(*l0..*l1).unwrap_or(&[]).iter().filter_map(|line| line.xs.last().copied()).fold(0.0f32, f32::max);
Some((lines, extent))
Some(para.lines.get(*l0..*l1).unwrap_or(&[]).iter().filter_map(|line| line.xs.last().copied()).fold(0.0f32, f32::max))
}
_ => None,
})
.unwrap();
assert!(lines > 1, "{turn:?}: word should break across multiple lines, got {lines}");
assert!(extent > min_h, "{turn:?}: letters should overhang the min height {min_h}, got {extent}");
assert!(extent > min_h, "{turn:?}: word should run past the min height {min_h}, got {extent}");
}
}
@@ -9031,121 +9028,6 @@ fn side_wrapping_push_does_not_shift_space_before_band_into_para_area() {
);
}
/// #8687: when a Top-and-Bottom object pushes the first line down into a second Top-and-Bottom
/// object, the paragraph's space before is laid out again below the second object too.
#[test]
fn stacked_top_and_bottom_objects_reapply_space_before() {
crate::test_fonts();
use wordcraft_doc::para::{Anchor, Float, Wrap};
use wordcraft_doc::props::LineSpacing;
const BEFORE: f32 = 12.0;
let mut d = Document::from_text("Anchor line.\nProbe line with several words in it.");
for block in &mut d.body {
if let wordcraft_doc::Block::Para(p) = Arc::make_mut(block) {
p.props.space_before = Some(0.0);
p.props.space_after = Some(0.0);
p.props.line_spacing = Some(LineSpacing::Exactly(14.0));
}
}
if let Some(wordcraft_doc::Block::Para(p)) = d.body.get_mut(1).map(Arc::make_mut) {
p.props.space_before = Some(BEFORE);
}
let plain = lay(&d);
let top_of = |l: &DocLayout, block: u32| {
l.pages[0]
.items
.iter()
.find_map(|i| match i {
Placed::Lines { story: StoryRef::Body, path, y, .. } if path.0 == [block] => Some(*y),
_ => None,
})
.unwrap()
};
let anchor_y = top_of(&plain, 0);
let probe_y = top_of(&plain, 1);
// First Top-and-Bottom object ending 5 pt above the probe's original first line (inside its
// 12 pt space before), pushing the line down to -5 + 12 = 7..21 pt below probe_y.
let first =
Float { wrap: Wrap::TopAndBottom, h_rel: Anchor::Column, v_rel: Anchor::Paragraph, y: probe_y - 10.0 - anchor_y, ..Default::default() };
d.insert_object(&Pos::body(0, 0), rect_shape(144.0, 5.0, first), &Default::default()).unwrap();
// Second Top-and-Bottom object from 17 to 27 pt below the probe's original first line,
// below the unpushed first line's `est_h` (~15 pt) but reaching into the moved line [7, 21+].
let second =
Float { wrap: Wrap::TopAndBottom, h_rel: Anchor::Column, v_rel: Anchor::Paragraph, y: probe_y + 17.0 - anchor_y, ..Default::default() };
d.insert_object(&Pos::body(0, 0), rect_shape(144.0, 10.0, second), &Default::default()).unwrap();
let l = lay(&d);
let top = top_of(&l, 1);
let second_bottom = shapes(&l.pages[0].items).iter().map(|r| r.bottom()).fold(f32::NEG_INFINITY, f32::max);
assert!(
(top - (second_bottom + BEFORE)).abs() < 0.01,
"probe first line {top} must start at second object bottom {second_bottom} + {BEFORE} space before"
);
}
/// #8614 / #8687: when a side-wrapping object pushes the first line down into a Top-and-Bottom
/// object (via either `row_spans` or `skip_row`), the line moves below it without re-applying
/// `space_before`.
#[test]
fn side_wrapping_push_into_top_and_bottom_does_not_reapply_space_before() {
crate::test_fonts();
use wordcraft_doc::para::{Anchor, Float, Wrap};
use wordcraft_doc::props::LineSpacing;
const BEFORE: f32 = 12.0;
// 500 pt leaves no span (`row_spans` Err); 445 pt leaves a ~23 pt strip that `skip_row` skips.
for side_width in [500.0, 445.0] {
let mut d = Document::from_text("Anchor line.\nProbe line with several words in it.");
for block in &mut d.body {
if let wordcraft_doc::Block::Para(p) = Arc::make_mut(block) {
p.props.space_before = Some(0.0);
p.props.space_after = Some(0.0);
p.props.line_spacing = Some(LineSpacing::Exactly(14.0));
}
}
if let Some(wordcraft_doc::Block::Para(p)) = d.body.get_mut(1).map(Arc::make_mut) {
p.props.space_before = Some(BEFORE);
}
let plain = lay(&d);
let top_of = |l: &DocLayout, block: u32| {
l.pages[0]
.items
.iter()
.find_map(|i| match i {
Placed::Lines { story: StoryRef::Body, path, y, .. } if path.0 == [block] => Some(*y),
_ => None,
})
.unwrap()
};
let anchor_y = top_of(&plain, 0);
let probe_y = top_of(&plain, 1);
// Side-wrapping object from 0 to 30 pt below the probe's original first line, pushing the
// first line down to [30, 44] below probe_y.
let side = Float { wrap: Wrap::Square, h_rel: Anchor::Column, v_rel: Anchor::Paragraph, y: probe_y - anchor_y, ..Default::default() };
d.insert_object(&Pos::body(0, 0), rect_shape(side_width, 30.0, side), &Default::default()).unwrap();
// Top-and-Bottom object from 32 to 36 pt below probe_y: below the original first line
// [0, 14] and reaching into the side-wrapped line [30, 44].
let tb =
Float { wrap: Wrap::TopAndBottom, h_rel: Anchor::Column, v_rel: Anchor::Paragraph, y: probe_y + 32.0 - anchor_y, ..Default::default() };
d.insert_object(&Pos::body(0, 0), rect_shape(144.0, 4.0, tb), &Default::default()).unwrap();
let l = lay(&d);
let top = top_of(&l, 1);
let tb_bottom = shapes(&l.pages[0].items).iter().map(|r| r.bottom()).fold(f32::NEG_INFINITY, f32::max);
assert!(
(top - tb_bottom).abs() < 0.01,
"side_width={side_width}: probe first line {top} must start at Top-and-Bottom bottom {tb_bottom} without re-applying {BEFORE} space before"
);
}
}
#[test]
fn float_follows_its_paragraph_to_the_next_page() {
crate::test_fonts();
@@ -19031,124 +18913,6 @@ fn header_boundary_pinned() {
}
}
/// A header picture aligned in the Margin area when both the header and the footer reach past
/// their margins: Word centres (or bottom-aligns) it in the rendered body, between the body's
/// top and the footer's top, not down to the declared bottom margin.
#[test]
fn header_margin_tracks_body_bottom() {
use wordcraft_doc::para::{Anchor, Float, FloatAlign, Wrap};
for footer_tall in [false, true] {
for align in [FloatAlign::Center, FloatAlign::End] {
let mut doc = Document::from_text("Body");
doc.last_section.margin_top = 20.0;
doc.last_section.margin_bottom = 20.0;
doc.last_section.header = 36.0;
doc.last_section.footer = if footer_tall { 36.0 } else { 0.0 };
let mut hp = boundary_header_para();
let float =
Float { wrap: Wrap::BehindText, h_rel: Anchor::Page, v_rel: Anchor::Margin, v_align: Some(align), x: 300.0, ..Default::default() };
hp.insert_object(0, rect_shape(40.0, 10.0, float), &Default::default()).unwrap();
let header = doc.add_part(wordcraft_doc::PartKind::Header, vec![wordcraft_doc::para_block(hp)]);
doc.last_section.headers.default = Some(header);
if footer_tall {
let footer = doc.add_part(wordcraft_doc::PartKind::Footer, vec![wordcraft_doc::para_block(boundary_header_para())]);
doc.last_section.footers.default = Some(footer);
}
let laid = lay(&doc);
let page = &laid.pages[0];
let s = &doc.last_section;
assert!(page.body.y > s.margin_top, "the header reaches past the top margin");
let bottom = page.body.bottom();
assert_eq!(bottom < s.page_h - s.margin_bottom - 1.0, footer_tall, "footer_tall={footer_tall}: body {:?}", page.body);
let expected = match align {
FloatAlign::End => bottom - 10.0,
_ => page.body.y + (bottom - page.body.y - 10.0) / 2.0,
};
let rects = shapes(&page.header);
assert_eq!(rects.len(), 1);
assert!(
(rects[0].y - expected).abs() < 0.01,
"footer_tall={footer_tall} {align:?}: {:?}, expected {expected}, body {:?}",
rects[0],
page.body
);
}
}
}
/// A tall picture bottom-aligned on the Margin in the header: the rendered body bottom (a footer
/// taller than its margin) lifts it into the header's lines. The body top was measured with the
/// declared margins, where it stays clear of them, so a picture that wraps text keeps that
/// placement and the header's lines stay above the body; one behind the text follows the body.
#[test]
fn header_margin_wrap_keeps_measured_header_height() {
use wordcraft_doc::para::{Anchor, Float, FloatAlign, Wrap};
for wrap in [Wrap::BehindText, Wrap::Square] {
let mut doc = Document::from_text("Body");
let s = &mut doc.last_section;
s.margin_top = 20.0;
s.margin_bottom = 20.0;
s.header = 36.0;
s.footer = 36.0;
let (pw, ph) = (s.page_w, s.page_h);
// Five 10 pt header lines from 36 to 86; the footer's five lines top at ph - 86. Bottom
// on the declared margin the picture's top is 116, below the lines; on the footer's top
// it is 50, across them.
let h = ph - 136.0;
let mut hp = boundary_header_para();
let float = Float { wrap, h_rel: Anchor::Page, v_rel: Anchor::Margin, v_align: Some(FloatAlign::End), ..Default::default() };
hp.insert_object(0, rect_shape(pw, h, float), &Default::default()).unwrap();
let header = doc.add_part(wordcraft_doc::PartKind::Header, vec![wordcraft_doc::para_block(hp)]);
doc.last_section.headers.default = Some(header);
let footer = doc.add_part(wordcraft_doc::PartKind::Footer, vec![wordcraft_doc::para_block(boundary_header_para())]);
doc.last_section.footers.default = Some(footer);
let laid = lay(&doc);
let page = &laid.pages[0];
assert_eq!((page.body.y, page.body.bottom()), (86.0, ph - 86.0), "{wrap:?}: body {:?}", page.body);
let tops: Vec<f32> = page.header.iter().filter_map(|i| if let Placed::Lines { y, .. } = i { Some(*y) } else { None }).collect();
assert_eq!(tops, [36.0], "{wrap:?}: the header's lines stay where the body top was measured");
let expected = if wrap == Wrap::Square { ph - 20.0 - h } else { page.body.bottom() - h };
let rects = shapes(&page.header);
assert_eq!(rects.len(), 1);
assert!((rects[0].y - expected).abs() < 0.01, "{wrap:?}: {:?}, expected {expected}", rects[0]);
}
}
/// The header laid out again with the declared margins (above) counts its list labels from the
/// same place as the layout it replaces: each page's header shows the next number, once.
#[test]
fn header_margin_wrap_retry_counts_labels_once() {
use wordcraft_doc::para::{Anchor, Float, FloatAlign, Wrap};
let labels = |wrap: Wrap| {
let mut doc = Document::from_text(&"Body\n".repeat(120));
let num = Arc::make_mut(&mut doc.numbering).add_list(wordcraft_doc::ListKind::Numbered);
let s = &mut doc.last_section;
s.margin_top = 20.0;
s.margin_bottom = 20.0;
s.header = 36.0;
s.footer = 36.0;
let (pw, ph) = (s.page_w, s.page_h);
let mut hp = boundary_header_para();
hp.props.numbering = Some(wordcraft_doc::props::NumRef { num, level: 0 });
let float = Float { wrap, h_rel: Anchor::Page, v_rel: Anchor::Margin, v_align: Some(FloatAlign::End), ..Default::default() };
hp.insert_object(0, rect_shape(pw, ph - 136.0, float), &Default::default()).unwrap();
let header = doc.add_part(wordcraft_doc::PartKind::Header, vec![wordcraft_doc::para_block(hp)]);
doc.last_section.headers.default = Some(header);
let footer = doc.add_part(wordcraft_doc::PartKind::Footer, vec![wordcraft_doc::para_block(boundary_header_para())]);
doc.last_section.footers.default = Some(footer);
let laid = lay(&doc);
assert!(laid.pages.len() >= 2, "{wrap:?}: {} pages", laid.pages.len());
laid.pages
.iter()
.map(|p| {
p.header.iter().find_map(|it| if let Placed::Lines { para, .. } = it { para.label.as_ref().map(|l| l.text.clone()) } else { None })
})
.collect::<Vec<_>>()
};
let retried = labels(Wrap::Square);
assert_eq!(retried, labels(Wrap::BehindText), "the retried header counts like the one laid out once");
}
#[test]
fn header_boundary_obstacle() {
use wordcraft_doc::para::Anchor;
@@ -19445,10 +19209,6 @@ fn negative_offset_floats_in_a_paragraph_pushed_down_by_a_wrapping_float_stay_on
assert!((title_rect.y - (line_top - 652.55)).abs() < 0.5, "title measured from displaced line {line_top}: {title_rect:?}");
assert!((row_rect.y - (line_top - 460.75)).abs() < 0.5, "row measured from displaced line {line_top}: {row_rect:?}");
assert!(title_rect.y > frame_rect.y && row_rect.bottom() < frame_rect.bottom(), "{placed:?}");
let frame = l.object(&Pos::body(0, 2 * wordcraft_doc::para::OBJ.len_utf8()), 0).unwrap();
let title = l.object(&Pos::body(0, 0), 0).unwrap();
assert!((title.origin.y - line_top).abs() < 0.5, "moved float's offset starts at the pushed line: {title:?}");
assert!((frame.rect.y - frame.origin.y + 43.11).abs() < 0.5, "unmoved wrapping float keeps its origin: {frame:?}");
}
/// #6567 review: a wrapping float above its paragraph that would land on the first line when
-34
View File
@@ -199,40 +199,6 @@ fn east_asian_theme_slot_overrides_inherited_named_font() {
assert!(gaps(&overridden).iter().all(|g| *g == 0.0), "named font_ea overrides inherited theme slot: {:?}", gaps(&overridden));
}
#[test]
fn east_asian_theme_script_fonts_follow_the_theme_language() {
crate::test_fonts();
use wordcraft_doc::props::ThemeFont;
for (lang, script) in [("zh-CN", "Hans"), ("zh-TW", "Hant"), ("zh-Hant-CN", "Hant"), ("ja-JP", "Jpan"), ("ko-KR", "Hang")] {
for (scheme, slot) in [("major", ThemeFont::MajorEastAsia), ("minor", ThemeFont::MinorEastAsia)] {
let mut d = Document::from_text("漢A漢");
Arc::make_mut(&mut d.styles).default_chr.font_ea = Some("宋体".into());
para0(&mut d).format(0, 7, &|c: &mut CharProps| c.font_ea_theme = Some(slot)).unwrap();
let settings = format!(
r#"<w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:themeFontLang w:eastAsia="{lang}"/></w:settings>"#
);
d.passthrough.insert("wordcraft:settings.orig".into(), Arc::new(settings.into_bytes()));
d.passthrough.insert("wordcraft:theme.fonts".into(), Arc::new(format!("{scheme}\tface\tea\tSource Serif 4\n").into_bytes()));
let main = gaps(&d);
assert!(main.iter().all(|g| *g == 0.0));
// The same installed face without ideographs suppresses spacing when selected by script.
d.passthrough.insert(
"wordcraft:theme.fonts".into(),
Arc::new(format!("{scheme}\tface\tea\t\n{scheme}\tscript\t{script}\tSource Serif 4\n").into_bytes()),
);
assert_eq!(gaps(&d), main, "{scheme}: {lang}/{script}");
// A nonempty main face takes precedence over the script entry.
d.passthrough.insert(
"wordcraft:theme.fonts".into(),
Arc::new(format!("{scheme}\tscript\t{script}\tSource Serif 4\n{scheme}\tface\tea\tMissing CJK Face 8749\n").into_bytes()),
);
assert!(gaps(&d).iter().any(|g| *g > 0.0), "{scheme}: main face wins");
}
}
}
#[test]
fn a_field_result_is_classed_by_the_text_it_shows() {
crate::test_fonts();
@@ -101,34 +101,6 @@ fn in_small_capitals_a_letter_and_its_marks_go_together_to_a_face_that_has_them_
}
}
/// In small capitals a mark after a lower-case letter shares the letter's 0.8-size shaping run
/// even when the run's font already draws every mark, so it composes and positions with the
/// drawn capital instead of splitting into a separate full-size run (#8571).
#[test]
fn in_small_capitals_a_mark_the_run_font_draws_shares_its_letters_size_and_run() {
let serif = serif();
let (lower, upper, mark) = ('e', 'E', '\u{301}');
assert!(serif.covers(lower) && serif.covers(upper) && serif.covers(mark), "{SERIF} has e, E and U+0301");
let text = format!("{lower}{mark} {upper}{mark}");
let chr = CharProps { font: Some(SERIF.into()), size: Some(12.0), small_caps: Some(true), ..Default::default() };
let mut d = Document::new();
d.body = vec![para_block(Paragraph::with_text(&text, chr))];
let (para, missing) = laid_doc(&d);
assert!(missing.is_empty(), "nothing is drawn as a missing glyph, but {missing:?} were");
let style_at = |at: usize| para.clusters.iter().find(|c| c.start <= at && at < c.end).expect("a cluster holds the character").style;
let lower_mark = lower.len_utf8();
let upper_at = text.find(upper).expect("upper-case letter is in the text");
let upper_mark = upper_at + upper.len_utf8();
assert_eq!(face_at(&para, 0).id(), serif.id(), "lower-case letter stays in the run's font");
assert_eq!(face_at(&para, lower_mark).id(), serif.id(), "mark stays in the run's font");
assert_eq!(style_at(lower_mark), style_at(0), "mark after lower-case letter shares its small-caps run");
assert_eq!(style_at(upper_mark), style_at(upper_at), "mark after upper-case letter shares its full-size run");
assert!(
para.styles[style_at(lower_mark) as usize].size < para.styles[style_at(upper_at) as usize].size,
"mark after lower-case letter is drawn smaller than the upper-case run"
);
}
#[test]
fn a_mark_the_font_composes_with_its_letter_stays_in_the_run_font() {
let serif = serif();
+1 -4
View File
@@ -304,9 +304,6 @@ impl Exporter<'_> {
/// Draws the content of a single page (background, watermark, headers, footers, body items, and comments) onto the surface.
pub(crate) fn page(&mut self, s: &mut Surface, page: &Page, w: f32, h: f32) {
self.at = (self.at.0.saturating_add(1), 0);
// A paragraph's continuation gets its own entry so this page's header links and the
// previous page's footer links are read before the continued text.
self.tag_index.clear();
if let Some(c) = self.doc.settings.page_color
&& let Some(p) = rect_path(&Rect::new(0.0, 0.0, w, h))
{
@@ -412,7 +409,7 @@ impl Exporter<'_> {
p.text_without(&dropped)
}
/// The structure entry for a paragraph on this page (created on first sight, in reading order).
/// The structure entry for a paragraph (created on first sight, in reading order).
fn entry(&mut self, story: StoryRef, path: &DocPath, pl: &wordcraft_layout::para::ParaLayout) -> usize {
if let Some(i) = self.tag_index.get(&(story, path.clone())) {
return *i;
-47
View File
@@ -4004,50 +4004,3 @@ fn header_and_footer_link_annotations_are_tagged_on_every_page() {
let top_roles: Vec<String> = tops.iter().map(|d| d.get::<Name>(b"S").map(|s| s.as_str().to_string()).unwrap_or_default()).collect();
assert_eq!(top_roles, vec!["Div", "P", "Div", "Div", "P", "Div"], "header link before body, footer link after body");
}
/// A paragraph's continuation must follow the footer and header between its pages.
#[test]
fn spanning_paragraph_links_follow_page_reading_order() {
use hayro_syntax::object::{Array, Dict, Name, Object};
let mut d = Document::new();
let linked = |text: &str, target: &str| {
Paragraph::with_text(text, CharProps { link: Some(format!("https://{target}.example.com")), ..Default::default() })
};
let header = d.add_part(wordcraft_doc::PartKind::Header, vec![para_block(linked("Header", "header"))]);
let footer = d.add_part(wordcraft_doc::PartKind::Footer, vec![para_block(linked("Footer", "footer"))]);
d.last_section.headers.default = Some(header);
d.last_section.footers.default = Some(footer);
d.body = vec![para_block(linked("First page\u{c}Second page", "body"))];
let bytes = export(&d, &PdfOptions { compress: false, tagged: true, ..Default::default() }).unwrap();
let pdf = hayro_syntax::Pdf::new(bytes).unwrap();
assert_eq!(pdf.pages().len(), 2);
let mut expected = Vec::new();
for page in pdf.pages().iter() {
let annots: Vec<Dict> = page.raw().get::<Array>(b"Annots").unwrap().iter::<Dict>().collect();
assert_eq!(annots.len(), 3, "each page has header, body and footer links");
// Header and footer are drawn before the body, but read around it.
for i in [0, 2, 1] {
expected.push(format!("{:?}", annots[i].obj_id().unwrap()));
}
}
fn collect(o: Object<'_>, out: &mut Vec<String>) {
match o {
Object::Array(a) => a.iter::<Object>().for_each(|o| collect(o, out)),
Object::Dict(d) => {
if d.get::<Name>(b"Type").is_some_and(|t| t.as_ref() == b"OBJR") {
out.push(format!("{:?}", d.get::<Dict>(b"Obj").unwrap().obj_id().unwrap()));
} else if let Some(k) = d.get::<Object>(b"K") {
collect(k, out);
}
}
_ => {}
}
}
let root = pdf.xref().get::<Dict>(pdf.xref().root_id()).unwrap();
let tree = root.get::<Dict>(b"StructTreeRoot").unwrap();
let mut actual = Vec::new();
collect(tree.get::<Object>(b"K").unwrap(), &mut actual);
assert_eq!(actual, expected, "links must follow page reading order across a split paragraph");
}
+2 -3
View File
@@ -16,8 +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-html = { workspace = true }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "5299d8d97dc04648dff735d1bd6f60bd18f10b35" }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359" }
wordcraft-geom = { workspace = true, features = ["image"] }
wordcraft-doc = { workspace = true }
wordcraft-fonts = { workspace = true }
@@ -77,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 = "5299d8d97dc04648dff735d1bd6f60bd18f10b35", features = ["subset"] }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "ad10c35ae545f0fb816364381a1a8154012b2359", features = ["subset"] }
serde_json = { workspace = true }
toml = "1"
+2 -4
View File
@@ -2,8 +2,8 @@ use super::services::Services;
use super::state::{AutoSaveBlock, PromptSave, keeps_everything};
use super::{
DEFAULT_TAB, MAX_DICTIONARY, MAX_RECENT, SaveInFlight, Session, Status, Value, WordApp, applied_font, canvas, chrome, crop, dialogs, documents,
file_dialogs, i18n, json, panes, printing, push_recent_font, read_aloud, recent_fonts_from, ribbon, system_clipboard, table_pen, theme,
updates_ui, window_ui, windows, zotero,
file_dialogs, i18n, json, panes, paste_picture, printing, push_recent_font, read_aloud, recent_fonts_from, ribbon, system_clipboard, table_pen,
theme, updates_ui, window_ui, windows, zotero,
};
use craft::platform::clock::monotonic_ms;
use craft::theme::ComponentSet;
@@ -138,8 +138,6 @@ impl WordApp {
saves_in_flight: Vec::new(),
fallback_chooser: false,
font_generation: wordcraft_fonts::FontDb::global().generation(),
#[cfg(test)]
font_catalog: None,
recovery_seen: false,
no_document: None,
parked: Default::default(),
+9 -11
View File
@@ -54,19 +54,17 @@ const GATED_UI_COMMANDS: &[(&str, &str)] = &[
];
/// Word feature catalog entries whose command is not yet registered in `registry`: each gets a
/// catalog entry with its ribbon path and no default chord, plus a disabled state until an engine
/// command takes its id.
fn unimplemented_catalog_commands(
registry: &wordcraft_engine::Registry,
) -> impl Iterator<Item = (&'static str, &'static str, [&'static str; 2])> + '_ {
/// catalog entry without a chord (preventing unregistered-command warnings) and a disabled state
/// until an engine command takes its id.
fn unimplemented_catalog_commands(registry: &wordcraft_engine::Registry) -> impl Iterator<Item = (&'static str, &'static str)> + '_ {
let mut seen = HashSet::new();
wordcraft_engine::catalog::CATALOG.lines().filter_map(move |line| {
let mut parts = line.split('|');
let tab = parts.next()?;
let group = parts.next()?;
let _tab = parts.next()?;
let _group = parts.next()?;
let feature = parts.next()?;
let id = parts.next()?;
(registry.get(id).is_none() && seen.insert(id)).then_some((id, feature, [tab, group]))
(registry.get(id).is_none() && seen.insert(id)).then_some((id, feature))
})
}
@@ -118,7 +116,7 @@ impl CommandStatesCache {
.chain(GATED_UI_COMMANDS.iter().map(|(id, _)| *id))
.map(|id| (id, CommandRef::new(id), None))
.collect();
let unimplemented = unimplemented_catalog_commands(&registry).map(|(id, ..)| (id, CommandRef::new(id), None)).collect();
let unimplemented = unimplemented_catalog_commands(&registry).map(|(id, _)| (id, CommandRef::new(id), None)).collect();
let commands_dialog = (CommandRef::with_params("ui.dialog", json!({"name": "commands"})), None);
let unavailable_hint = crate::widgets::command_hint("", "", Some("")).map(Arc::from);
CommandStatesCache { registry, lang, registered, ui_commands, unimplemented, commands_dialog, unavailable_hint, hints: HashMap::new() }
@@ -219,9 +217,9 @@ impl WordApp {
for (id, label) in GATED_UI_COMMANDS {
defs.push(CommandDef::new(CommandRef::new(*id), tl!(*label), Scope::app()));
}
for (id, feature, path) in unimplemented_catalog_commands(&registry) {
for (id, feature) in unimplemented_catalog_commands(&registry) {
if seen.insert(id) {
defs.push(CommandDef::new(CommandRef::new(id), tl!(feature), Scope::app()).with_path(path.map(str::to_owned).into()));
defs.push(CommandDef::new(CommandRef::new(id), tl!(feature), Scope::app()));
}
}
// Word's Alt chords (Alt+Q, Alt+F7, Ctrl+Alt+1…) fire while the person types in the page:
+23 -25
View File
@@ -5,10 +5,10 @@ use craft::quit::{CloseAnswer, CloseScope};
use super::command_board::command_enabled;
use super::{
MAX_RECENT, SaveInFlight, Value, WordApp, applied_font, chrome, crop, dialogs, file_dialogs, i18n, json, keeps_everything, panes, printing,
push_recent_font, system_clipboard, table_pen, theme, zotero,
MAX_RECENT, SaveInFlight, Value, WordApp, applied_font, chrome, crop, dialogs, file_dialogs, i18n, json, keeps_everything, panes, paste_picture,
printing, push_recent_font, system_clipboard, table_pen, theme, zotero,
};
use crate::{colors, paste_picture};
use crate::colors;
/// The document's own save stamps: zoom, last-modified-by, created, modified and revision.
type SaveStamps = (Option<wordcraft_doc::Zoom>, String, String, String, u32);
@@ -71,16 +71,24 @@ impl WordApp {
// PLAN: assumed shell-w8's `begin_closing(scope, documents, then, params) -> Result<Value, String>` opens the prompt.
return self.begin_closing(CloseScope::Close, vec![self.session.document_id()], id.to_string(), params);
}
// All ordinary Paste controls use the same system clipboard formats.
// The ribbon and context-menu Paste commands send no text: read the system clipboard's, as
// Ctrl+V's paste event carries it (#584), and its HTML and RTF, which egui's paste event
// doesn't carry (#687).
let mut params = params;
let bitmap_if_empty = match system_clipboard::fill(self, id, &mut params) {
system_clipboard::PasteFill::Continue => false,
system_clipboard::PasteFill::BitmapIfEmpty => true,
system_clipboard::PasteFill::Handled(result) => return result,
};
if let Some(r) = system_clipboard::fill(self, id, &mut params) {
return r;
}
// Paste without system clipboard text: a picture there is newer than our own copy (copying
// here replaces it with text), so it wins (#45).
if id == "edit.paste"
&& params.get("text").is_none()
&& let Some(r) = paste_picture::paste(self)
{
return r;
}
let applied = applied_font(id, &params);
let previous = std::mem::replace(&mut self.user_origin, true);
let r = if bitmap_if_empty { self.execute_command(id, params, true) } else { self.execute_user(id, params) };
let r = self.execute_user(id, params);
self.user_origin = previous;
// A save error already on the status line is the reason to see; the refusal shows otherwise.
if let (Some(e), true) = (refused, r.is_ok()) {
@@ -150,10 +158,6 @@ impl WordApp {
/// Run a command for a script or an agent (control channel, MCP bridge): never asks first.
/// UI-level commands (`ui.*`) are handled here, the rest by the engine.
pub fn execute(&mut self, id: &str, params: Value) -> Result<Value, String> {
self.execute_command(id, params, false)
}
fn execute_command(&mut self, id: &str, params: Value, bitmap_if_empty: bool) -> Result<Value, String> {
self.clear_command_targets(id);
if let Some(error) = self.document_required_error(id) {
return Err(error);
@@ -283,17 +287,11 @@ impl WordApp {
let math_session = self.session.math.as_ref().map(|m| m.session);
let composing_before = !self.canvas.ime_preedit.is_empty();
let old_path = self.session.path.clone();
let r = if self.ime_origin { self.session.run_ime(id, &params) } else { self.session.run(id, &params) };
// Only the engine's no-content result can fall back. Protection and insertion failures
// still report their own error, and the empty paste did not create an undo step.
if bitmap_if_empty
&& matches!(&r, Err(wordcraft_engine::CmdError::ClipboardEmpty))
&& let Some(clip) = system_clipboard::handle(self)
&& let Some(png) = paste_picture::bitmap_png(&clip).inspect_err(|e| self.status(e.clone()))?
{
return paste_picture::insert_bitmap(self, &png);
}
let r = r.map_err(|e| e.to_string());
let r = if self.ime_origin {
self.session.run_ime(id, &params).map_err(|e| e.to_string())
} else {
self.session.run(id, &params).map_err(|e| e.to_string())
};
if self.session.ime_body_epoch() != body_epoch {
self.canvas.ime_interrupted_preedit |= composing_before;
// The body (or the whole document) was replaced under the same id — setText, a
-1
View File
@@ -46,7 +46,6 @@ mod navigation;
mod pages;
mod reading;
mod reading_metrics;
mod revision_tip;
pub(crate) mod rulers;
mod source;
mod story;
+2 -15
View File
@@ -9,7 +9,6 @@ use craft::ui::canvas::{CanvasTool, ToolAction, ToolContext, ToolPath, ToolPoint
use craft::ui::primitives::Draw;
use super::links::{field_showing_code, follow_link, is_generated_bookmark_link, link_under};
use super::revision_tip::revision_under;
use super::story::{enters_header_footer, in_text_box, part_kind, text_box_host};
use super::{CanvasState, DocLayout, PartKind, Pos, Pos2, StoryRef, WordApp, json};
use crate::objects::ObjectGesture;
@@ -164,23 +163,12 @@ impl<'a> PageTextTool<'a> {
let (page, x, y) = page_of(self.body.pages, pos)?;
let layout = &*self.layout;
// A linked picture or shape under the pointer comes first: it lies over the text (#5267).
// The text is the story under the pointer, as for the tracked change tip that follows.
let story = pointer_story(app, layout, page, x, y, app.session.sel.focus.story);
let story = app.session.sel.focus.story;
let link = crate::objects::link_at(app, layout, self.body, pos)
.or_else(|| layout.hit(page, x, y, story).and_then(|at| link_under(app, layout, page, x, y, &at)))?;
let target = if is_generated_bookmark_link(&link) { tl!("Current Document").to_string() } else { link };
Some(format!("{target}\n{}", crate::i18n::fmt(tl!("{key}+Click to follow link"), &[("key", self.link_key)])))
}
/// The tip for the tracked change under `pos`: its kind, author and time (#7887).
fn revision_tip(&self, pos: Pos2) -> Option<String> {
let (page, x, y) = page_of(self.body.pages, pos)?;
let layout = &*self.layout;
// The story under the pointer, as a click there takes it: a note or text box over the body.
let story = pointer_story(&*self.app, layout, page, x, y, self.app.session.sel.focus.story);
let at = layout.hit(page, x, y, story)?;
revision_under(&*self.app, layout, page, x, y, &at)
}
}
impl CanvasTool for PageTextTool<'_> {
@@ -261,8 +249,7 @@ impl CanvasTool for PageTextTool<'_> {
fn hover(&mut self, pointer: &ToolPointer, cx: &mut ToolContext<'_>) {
// PLAN: assumed `ToolContext::tip(&mut self, tip: impl Into<Tooltip>)` (canvas-w1, S-L238).
// A link's tip comes first: following the link is what a click there can do.
if let Some(tip) = self.link_tip(pointer.pos).or_else(|| self.revision_tip(pointer.pos)) {
if let Some(tip) = self.link_tip(pointer.pos) {
cx.tip(tip);
}
}
-90
View File
@@ -1,90 +0,0 @@
//! The hover tip on a tracked change (#7887): what kind of change it is, who made it and when.
use super::{DocLayout, Pos, WordApp};
use wordcraft_doc::props::CharProps;
use wordcraft_layout::display::MarkupOptions;
/// The tip for the tracked change under the pointer at (x, y) on `page`, where `pos` is the caret
/// position the point hits: its kind, its author and its time, a line each. Only changes the page
/// marks count: none with markup hidden, insertions, deletions and moves while Show Markup shows
/// them, formatting changes while it shows formatting. As with a link, the point must be on a
/// character, not beside, above or below it: on the changed character itself, or anywhere in the
/// text of a paragraph whose own formatting changed (its alignment, indents…) when the character
/// has no change of its own.
pub(super) fn revision_under(app: &WordApp, layout: &DocLayout, page: usize, x: f32, y: f32, pos: &Pos) -> Option<String> {
let session = &app.session;
if !session.view.show_markup {
return None;
}
let markup = &session.prefs.markup;
let doc = &session.doc;
let para = doc.para_at(pos)?;
let para_change = para.props.fmt_change.as_ref().filter(|_| markup.formatting).map(|c| (c.rev, tl!("Formatted")));
let at = wordcraft_geom::Point::new(x, y);
// The caret falls between characters: the one under the point is on either side of it.
[(pos.off, para.next_boundary(pos.off)), (para.prev_boundary(pos.off), pos.off)].into_iter().filter(|(a, b)| a < b).find_map(|(a, b)| {
let (rev, kind) = change_of(para.props_of_char(a), markup, |i| doc.move_name(Some(i)).is_some()).or(para_change)?;
let rev = doc.revisions.get(usize::try_from(rev).ok()?)?;
let (from, to) = (Pos { off: a, ..pos.clone() }, Pos { off: b, ..pos.clone() });
let hit = layout.selection_rects(doc, &from, &to, page).into_iter().any(|(pi, r)| pi == page && r.contains(at));
hit.then(|| tip(kind, &rev.author, &crate::local_time::revision_time(rev)))
})
}
/// The revision a character's marks point to and what to call it, when the markup shown marks it.
/// A deletion lies over an insertion it removes (inserted, then deleted by someone else): the
/// deletion is the change the page shows.
fn change_of(props: &CharProps, markup: &MarkupOptions, is_move: impl Fn(u32) -> bool) -> Option<(u32, &'static str)> {
if markup.insertions_deletions {
if let Some(i) = props.del {
return Some((i, if is_move(i) { tl!("Moved from") } else { tl!("Deleted") }));
}
if let Some(i) = props.ins {
return Some((i, if is_move(i) { tl!("Moved to") } else { tl!("Inserted") }));
}
}
props.fmt_change.as_ref().filter(|_| markup.formatting).map(|c| (c.rev, tl!("Formatted")))
}
/// The tip's lines: the change's kind, its author (or "Author" when the file names none, as the
/// balloons do) and its time, left out when the file gives none.
fn tip(kind: &str, author: &str, when: &str) -> String {
let author = if author.trim().is_empty() { tl!("Author") } else { author };
let mut lines = vec![kind, author];
if !when.is_empty() {
lines.push(when);
}
lines.join("\n")
}
#[cfg(test)]
mod tests {
use super::*;
use wordcraft_doc::props::PropChange;
/// A deletion over an insertion is the change shown; formatting counts only while the markup
/// shows formatting, and insertions and deletions only while it shows them.
#[test]
fn the_shown_markup_picks_the_change() {
let all = MarkupOptions { insertions_deletions: true, formatting: true, ..Default::default() };
let no_move = |_| false;
let both = CharProps { ins: Some(0), del: Some(1), ..Default::default() };
assert_eq!(change_of(&both, &all, no_move), Some((1, "Deleted")));
assert_eq!(change_of(&both, &all, |i| i == 1), Some((1, "Moved from")));
let inserted = CharProps { ins: Some(2), ..Default::default() };
assert_eq!(change_of(&inserted, &all, no_move), Some((2, "Inserted")));
assert_eq!(change_of(&inserted, &all, |_| true), Some((2, "Moved to")));
let formatted = CharProps { fmt_change: PropChange::boxed(3, CharProps::default()), ..Default::default() };
assert_eq!(change_of(&formatted, &all, no_move), Some((3, "Formatted")));
assert_eq!(change_of(&formatted, &MarkupOptions { formatting: false, ..all.clone() }, no_move), None);
assert_eq!(change_of(&inserted, &MarkupOptions { insertions_deletions: false, ..all.clone() }, no_move), None);
assert_eq!(change_of(&CharProps::default(), &all, no_move), None);
}
/// The tip's lines; an unnamed author reads "Author", and a missing time is left out.
#[test]
fn the_tip_names_kind_author_and_time() {
assert_eq!(tip("Inserted", "Ada", "2026-11-20 14:05"), "Inserted\nAda\n2026-11-20 14:05");
assert_eq!(tip("Deleted", " ", ""), "Deleted\nAuthor");
}
}
-88
View File
@@ -889,91 +889,3 @@ fn a_right_click_keeps_selected_cells_only_on_them() {
assert_menu(&h, &["Split Cells"], true);
assert_menu(&h, &["Merge Cells"], false);
}
// ---------------------------------------------------------------------------------------
// Tracked change tips
// ---------------------------------------------------------------------------------------
/// #7887: resting the pointer on a tracked insertion shows a tip with the change's kind, its
/// author and its time; beside the change, or with markup hidden, there is none.
#[test]
fn hovering_a_tracked_change_shows_its_author_and_time() {
let mut a = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::from_text("Plain words here")), Default::default());
a.session.author = "Ada Reviewer".into();
a.run("caret.docStart", json!({})).unwrap();
a.run("review.trackChanges", json!({"value": true})).unwrap();
a.run("text.insert", json!({"text": "Inserted "})).unwrap();
assert_eq!(a.session.doc.revisions.len(), 1, "one tracked insertion");
// A fixed time with no UTC time beside it, as a file's change has, so it shows as written
// whatever the machine's zone (`local_time` covers the changes made here).
a.session.doc.revisions[0].date = "2026-11-20T14:05:00Z".into();
a.session.doc.revisions[0].date_utc = None;
let mut h = window(a);
let point_at = |h: &mut H, off: usize| {
let c = h.state_mut().session.layout().caret(&Pos { story: StoryRef::Body, path: wordcraft_doc::Path::top(0), off }).unwrap();
let at = screen(h, c.x, c.top + c.height / 2.0);
h.event(egui::Event::PointerMoved(at));
super::rest_for_tip(h);
};
let tips = |h: &H| h.query_all_by_label_contains("Inserted Ada Reviewer 2026-11-20 14:05").count();
// Between "Inserted" and its "e", then on "words", which was there before tracking began.
point_at(&mut h, 2);
assert!(tips(&h) > 0, "the inserted text's tip says it was inserted, by whom and when");
point_at(&mut h, "Inserted Plain w".len());
assert_eq!(tips(&h), 0, "text that wasn't changed has no tip");
h.state_mut().session.view.show_markup = false;
point_at(&mut h, 2);
assert_eq!(tips(&h), 0, "with markup hidden the change isn't marked, so it has no tip");
}
/// #7887: a paragraph whose own formatting changed while tracking (here its alignment) shows a
/// Formatted tip on its text, while the markup shows formatting.
#[test]
fn hovering_a_paragraph_with_tracked_formatting_shows_formatted() {
let mut a = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::from_text("A centred line")), Default::default());
a.session.author = "Ada Reviewer".into();
a.run("review.trackChanges", json!({"value": true})).unwrap();
a.run("para.alignCenter", json!({})).unwrap();
assert!(a.session.doc.body[0].as_para().is_some_and(|p| p.props.fmt_change.is_some()), "the alignment is a tracked change");
let mut h = window(a);
let point_at = |h: &mut H| {
let c = h.state_mut().session.layout().caret(&Pos { story: StoryRef::Body, path: wordcraft_doc::Path::top(0), off: 4 }).unwrap();
let at = screen(h, c.x, c.top + c.height / 2.0);
h.event(egui::Event::PointerMoved(at));
super::rest_for_tip(h);
};
let tips = |h: &H| h.query_all_by_label_contains("Formatted Ada Reviewer").count();
point_at(&mut h);
assert!(tips(&h) > 0, "the paragraph's text shows its formatting change");
h.state_mut().session.prefs.markup.formatting = false;
// The canvas asks for a tip again only when the pointer moves: away to the toggle and back.
h.event(egui::Event::PointerGone);
point_at(&mut h);
assert_eq!(tips(&h), 0, "with formatting markup off the change isn't marked, so it has no tip");
}
/// #7887 review: a link in a footnote shows its tip while the caret is in the body. The hover
/// looks in the story under the pointer, so the link's tip still comes before the tracked
/// change tip there.
#[test]
fn a_footnote_link_shows_its_tip_with_the_caret_in_the_body() {
let mut a = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::from_text("Body text")), Default::default());
a.run("caret.docEnd", json!({})).unwrap();
a.run("review.trackChanges", json!({"value": true})).unwrap();
a.run("references.footnote", json!({"text": "Note link"})).unwrap();
let note = a.session.sel.focus.story;
let pos = |off: usize| json!({"story": note, "path": [0], "off": off});
a.run("select.range", json!({"anchor": pos(5), "focus": pos(9)})).unwrap();
a.run("insert.link", json!({"url": "https://example.com/note"})).unwrap();
a.run("caret.set", json!({"pos": {"block": 0, "off": 2}})).unwrap();
assert_eq!(a.session.sel.focus.story, StoryRef::Body);
// The whole page in the window, footnote area and all.
a.run("view.zoom", json!({"value": 40})).unwrap();
let mut h = window(a);
let c = h.state_mut().session.layout().caret(&Pos { story: note, path: wordcraft_doc::Path::top(0), off: 7 }).unwrap();
let at = screen(&mut h, c.x, c.top + c.height / 2.0);
h.event(egui::Event::PointerMoved(at));
super::rest_for_tip(&mut h);
assert!(h.query_all_by_label_contains("https://example.com/note").count() > 0, "the footnote's link shows its tip (pointer at {at:?})");
assert_eq!(h.query_all_by_label_contains("Inserted ").count(), 0, "not the tracked insertion's tip");
}
+2 -2
View File
@@ -367,8 +367,8 @@ fn a_script_opens_the_dialog_a_launcher_command_asks_for() {
}
/// Every method the Methods table of `docs/control-protocol.md` lists is one the control channel answers: none falls
/// through to the commands as an unknown id. When input methods moved to the framework's names in #7101, the old table
/// kept names that no longer existed; `ui.drag` is now a real one-request `{from, to}` method the channel answers.
/// through to the commands as an unknown id. The input methods moved to the framework's names in #7101, and the table
/// kept `ui.press` and `ui.text` (while `ui.drag` moved to `{from, to}`).
#[test]
fn every_method_the_protocol_doc_lists_is_answered() {
let doc = include_str!("../../../../docs/control-protocol.md");
@@ -339,26 +339,6 @@ mod tests {
assert!(under(smart.id, "Contextual Tabs") && !under(smart.id, "Other"), "{} is under the contextual tabs", smart.id);
}
#[test]
fn unimplemented_commands_keep_their_catalog_categories_and_disabled_state() {
let mut a = app();
let _ = a.command_input();
let catalog = a.catalog().expect("catalog");
let areas = super::areas();
for (id, tab, group) in [("insert.video", "Insert", "Media"), ("draw.inkToMath", "Draw", "Convert")] {
let command = CommandRef::new(id);
assert!(a.session.registry.get(id).is_none(), "{id} is still unimplemented");
let def = catalog.defs().iter().find(|def| def.command == command).unwrap_or_else(|| panic!("{id} in catalog"));
assert_eq!(def.paths, [vec![tab.to_owned(), group.to_owned()]], "{id} keeps its full ribbon path");
let categories: Vec<_> = areas.iter().filter(|area| (area.rows)(def)).map(|area| area.id).collect();
assert_eq!(categories, [tab, "All Commands"], "{id} is filed under its ribbon tab");
assert!(def.defaults.is_empty(), "{id} has no default chord");
let state = a.command_states.get(&command);
assert!(state.is_some_and(|state| !state.is_enabled()), "{id} publishes an explicit disabled state");
}
}
/// #7971: the board's catalog files each engine command under its ribbon tab.
#[test]
fn catalog_paths_follow_the_ribbon_location() {
@@ -55,16 +55,7 @@ pub(super) fn body_field(app: &WordApp, name: &str) -> Option<FieldCode> {
impl IndexForm {
/// The index in the document, or Word's defaults for a new one (two columns).
pub fn read(app: &WordApp) -> IndexForm {
// Insert Index updates an inline index first. Otherwise it rebuilds the range field
// before writing the settings, so the dialog needs to read those switches too.
let index = body_field(app, "INDEX").or_else(|| {
app.session.doc.body.iter().filter_map(|b| b.as_para()).flat_map(|p| p.objects.iter()).find_map(|o| {
let wordcraft_doc::InlineObject::FieldStart { instr, .. } = o else { return None };
let field = FieldCode::parse(instr);
(field.name == "INDEX").then_some(field)
})
});
match index {
match body_field(app, "INDEX") {
Some(f) => IndexForm {
kind: if f.has('r') { "runIn" } else { "indented" }.into(),
columns: f.arg('c').and_then(|c| c.trim().parse().ok()).unwrap_or(1).clamp(1, 4),
@@ -238,50 +238,6 @@ fn index_and_mark_entry_dialogs_write_switches() {
assert_eq!(IndexForm::read(&a), f, "the dialog shows the index's settings");
}
#[test]
fn index_dialog_keeps_range_field_settings_when_confirmed_without_edits() {
use egui::accesskit::{Role, Toggled};
use egui_kittest::kittest::{NodeT, Queryable};
use wordcraft_doc::{Block, Paragraph, Path};
let mut a = app("Kilns are hot.");
a.run("select.text", json!({"text": "Kilns"})).unwrap();
a.session.run("references.markEntry", &json!({})).unwrap();
// Original synthetic range field with non-default type, columns, alignment and headings.
let instr = "INDEX \\c \"3\" \\e \"\t\" \\r";
let mut para = Paragraph::new();
para.insert_object(0, InlineObject::FieldEnd, &Default::default()).unwrap();
para.insert_object(0, InlineObject::FieldStart { instr: instr.into(), locked: false, dirty: false }, &Default::default()).unwrap();
let last = a.session.doc.body.len();
a.session.doc.insert_block(StoryRef::Body, &Path::top(last), Block::Para(para)).unwrap();
a.session.touch();
assert_eq!(a.run("references.index", json!({})).unwrap(), json!({"pending": "index"}));
let mut h = crate::test_harness::builder().with_size(vec2(1440.0, 900.0)).build_ui_state(
|ui, app: &mut WordApp| {
let ctx = ui.ctx().clone();
app.logic(&ctx);
app.ui(ui);
},
a,
);
h.run_steps(4);
h.get_by_role_and_label(Role::Dialog, "Index");
let opened = form::<IndexForm>(h.state());
assert_eq!((opened.kind.as_str(), opened.columns, opened.right_align, opened.headings), ("runIn", 3, true, false));
assert_eq!(h.state().session.doc.field_ranges(StoryRef::Body)[0].instr, instr, "opening leaves the range field intact");
let right_aligned = h.get_by_role_and_label(Role::CheckBox, "Page numbers at the right margin").accesskit_node().toggled();
assert_eq!(right_aligned, Some(Toggled::True));
assert_eq!(h.get_by_role_and_label(Role::CheckBox, "Letter headings").accesskit_node().toggled(), Some(Toggled::False));
h.get_by_role_and_label(Role::Button, "OK").click();
h.run_steps(3);
assert!(!is_open::<IndexForm>(h.state()), "OK closes the dialog");
let indexes: Vec<_> = instrs(h.state()).into_iter().filter(|i| i.starts_with("INDEX")).collect();
assert_eq!(indexes, [instr.to_string()], "the rebuilt index keeps the same switches");
assert!(h.state().session.doc.field_ranges(StoryRef::Body).is_empty(), "the range was replaced in place");
}
/// #402: Custom Table of Contents and its Options make the TOC switches, and the dialog
/// opens again with them.
#[test]
+19 -3
View File
@@ -1,6 +1,7 @@
// PLAN: the Insert key has no editor input, so the overtype switch is the shortcut layer's (shell-w6).
use craft::behavior::editor::{EditorInput, SurroundingUnit};
use craft::behavior::intent::{EditCommand, Granularity, MoveMods, NavMove};
use craft::platform::clipboard::{HTML, RGBA8, RTF, URI_LIST};
use craft::ui::canvas::ToolPass;
use craft::ui::runtime::commands::{ClipItem, ClipboardHandle};
@@ -632,9 +633,7 @@ fn edit_command(app: &mut WordApp, ctx: &egui::Context, cmd: EditCommand) {
let _ = app.run("edit.copy", json!({}));
}
}
EditCommand::Paste => {
let _ = app.run("edit.paste", json!({}));
}
EditCommand::Paste => paste(app, ctx),
EditCommand::SelectAll => {
let _ = app.run("select.all", json!({}));
}
@@ -651,6 +650,23 @@ fn edit_command(app: &mut WordApp, ctx: &egui::Context, cmd: EditCommand) {
}
}
/// Paste from the clipboard: copied picture files insert as pictures (#45), text, rich text
/// (HTML/RTF) and a clipboard picture go through `edit.paste`.
fn paste(app: &mut WordApp, ctx: &egui::Context) {
let clip = ClipboardHandle::of(ctx);
let text = clip.read_text().ok().flatten();
if text.is_none() && !clip.has(&[RGBA8, URI_LIST, HTML, RTF]) {
return;
}
if let Some(t) = &text
&& crate::paste_picture::paste_named_files(app, t)
{
return;
}
let params = text.map_or_else(|| json!({}), |t| json!({"text": t}));
let _ = app.run("edit.paste", params);
}
/// Escape: the nearest thing that takes it first (a painter, a pen, a table pen, an object, a text
/// box, a header), then Focus or Full Screen.
fn cancel(app: &mut WordApp, ctx: &egui::Context) {
+12 -31
View File
@@ -452,33 +452,19 @@ fn mod_v_released_mod_first_pastes_the_clipboard_picture() {
assert_eq!(body(h.state()), "external");
assert!(is_bold(&mut h), "Mod+V keeps the HTML's formatting");
let mut h = alt_frame_app();
let before = h.state().session.doc.clone();
let url = "https://example.test/picture.png";
offer(
&h,
vec![
ClipItem::Image(std::sync::Arc::new(egui::ColorImage::from_rgba_unmultiplied([4, 4], &[200u8; 4 * 4 * 4]))),
ClipItem::Html(format!(r#"<img src="{url}">"#).into()),
ClipItem::Text(url.into()),
],
);
let mut h = picture_app();
mods_frame(&mut h, ctrl, vec![key_event(Key::ControlLeft, true, ctrl), key_event(Key::V, true, ctrl)]);
mods_frame(&mut h, Modifiers::NONE, vec![key_event(Key::ControlLeft, false, Modifiers::NONE)]);
mods_frame(&mut h, Modifiers::NONE, vec![key_event(Key::V, false, Modifiers::NONE)]);
assert_eq!(pictures(h.state_mut()), 1);
run(&mut h, "edit.undo", json!({}));
assert!(before.same_content(&h.state().session.doc), "one Undo restores the document before paste");
assert_eq!(pictures(h.state_mut()), 0);
// A plain V afterwards is not a paste.
mods_frame(&mut h, Modifiers::NONE, vec![key_event(Key::V, true, Modifiers::NONE)]);
mods_frame(&mut h, Modifiers::NONE, vec![key_event(Key::V, false, Modifiers::NONE)]);
assert_eq!(pictures(h.state_mut()), 0);
assert_eq!(pictures(h.state_mut()), 1);
}
/// #5859: Mod+V admits a rich-only clipboard (HTML or RTF with no plain-text or picture flavor).
/// With no plain text, a single-image HTML offer pastes its bitmap, while a formatted selection
/// offered beside a bitmap keeps its formatting.
/// #5859: Mod+V admits a rich-only clipboard (HTML or RTF with no plain-text or picture flavor)
/// and still routes an image+HTML clipboard with no plain-text flavor to picture paste.
#[test]
fn mod_v_pastes_rich_only_clipboard_and_preserves_picture_routing() {
let ctrl = mod_held();
@@ -497,24 +483,19 @@ fn mod_v_pastes_rich_only_clipboard_and_preserves_picture_routing() {
assert_eq!(body(h.state()), "rtf-only", "Mod+V pastes RTF-only clipboard");
assert!(is_bold(&mut h), "RTF-only paste keeps formatting");
let image = || ClipItem::Image(std::sync::Arc::new(egui::ColorImage::from_rgba_unmultiplied([4, 4], &[200u8; 4 * 4 * 4])));
let img = r#"<img src="https://example.test/picture.png">"#;
let mut h = alt_frame_app();
offer(&h, vec![image(), ClipItem::Html(img.into())]);
offer(
&h,
vec![
ClipItem::Image(std::sync::Arc::new(egui::ColorImage::from_rgba_unmultiplied([4, 4], &[200u8; 4 * 4 * 4]))),
ClipItem::Html("<p><b>fallback</b></p>".into()),
],
);
mods_frame(&mut h, ctrl, vec![key_event(Key::V, true, ctrl)]);
mods_frame(&mut h, Modifiers::NONE, vec![key_event(Key::V, false, Modifiers::NONE)]);
assert_eq!(pictures(h.state_mut()), 1, "a single-image HTML offer with no plain text pastes its bitmap");
assert_eq!(pictures(h.state_mut()), 1, "image+HTML with no plain text routes to picture paste");
assert_eq!(body(h.state()), "", "picture paste does not fall back to HTML text");
let mut h = alt_frame_app();
offer(&h, vec![image(), ClipItem::Html(format!("<p><b>fallback</b>{img}</p>").into())]);
mods_frame(&mut h, ctrl, vec![key_event(Key::V, true, ctrl)]);
mods_frame(&mut h, Modifiers::NONE, vec![key_event(Key::V, false, Modifiers::NONE)]);
assert_eq!(pictures(h.state_mut()), 0, "a formatted selection with no plain text is not replaced by its bitmap");
assert_eq!(body(h.state()), "fallback");
assert!(is_bold(&mut h), "the formatted selection keeps its bold");
let dir = std::env::temp_dir().join(format!("wc-mod-v-uri-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let png = dir.join("clip.png");
-96
View File
@@ -1652,102 +1652,6 @@ mod tests {
assert!(backend.network.load(Ordering::Relaxed), "the person's click in the picker is the consent");
}
/// The bounds of the first node whose label starts with `label`.
fn bounds_of(tree: &egui::accesskit::TreeUpdate, label: &str) -> Option<egui::accesskit::Rect> {
tree.nodes.iter().find(|(_, n)| n.label().is_some_and(|l| l.starts_with(label))).and_then(|(_, n)| n.bounds())
}
/// In the Add a language picker, the reason an agent's Install was refused shows in that row with its license,
/// whatever the license's length (Dutch's is one short line, Catalan's wraps).
#[test]
fn a_refused_install_says_why_in_its_own_row() {
let _g = BACKEND_LOCK.lock().unwrap_or_else(std::sync::PoisonError::into_inner);
let _reset = ResetBackend;
let (mut a, ctx, backend) = options_app("language", false);
// The fetch the click starts runs on a thread and reports its end here.
let (done, ended) = std::sync::mpsc::channel();
packs::set_background(Some(std::sync::Arc::new(move || {
let _ = done.send(());
})));
let add = spot(&settled(&mut a, &ctx), "Add a language").expect("the button");
user_click(&mut a, &ctx, add);
assert!(a.dialog_host.is_open::<super::AddLanguage>(), "the picker opens");
while packs::fetching() {
ended.recv().expect("the fetch reports its end");
}
backend.network.store(false, Ordering::Relaxed);
for (row, locale) in [("Dutch", "nl"), ("Catalan", "ca")] {
let tree = settled(&mut a, &ctx);
let shown = bounds_of(&tree, row).unwrap_or_else(|| panic!("{row} is listed: {:?}", labels(&tree)));
let install = tree
.nodes
.iter()
.filter(|(_, n)| n.label().is_some_and(|l| l.starts_with("Install")))
.filter_map(|(_, n)| n.bounds())
.find(|b| (b.y0 + b.y1) / 2.0 > shown.y0 && (b.y0 + b.y1) / 2.0 < shown.y1)
.unwrap_or_else(|| panic!("{row} offers Install"));
as_agent(&mut a, &ctx, "ui.click", json!({"x": (install.x0 + install.x1) / 2.0, "y": (install.y0 + install.y1) / 2.0}));
assert!(a.packs_rt.errors.get(locale).is_some_and(|e| e.contains("Only you")), "{row}: {:?}", a.packs_rt.errors);
let tree = settled(&mut a, &ctx);
let shown = bounds_of(&tree, row).expect("the row stays listed");
// The row's bounds stop at the list's visible edge, and the reason may run past it, so the reason starts
// inside the row. It is at least as wide as the row's Install, so it has room to be read.
let reason = tree.nodes.iter().find(|(_, n)| {
n.label().is_some_and(|l| l.contains("Only you"))
&& n.bounds()
.is_some_and(|b| b.width() >= install.width() && b.x0 >= shown.x0 && b.x1 <= shown.x1 && b.y0 >= shown.y0 && b.y0 < shown.y1)
});
let why: Vec<_> = tree.nodes.iter().filter(|(_, n)| n.label().is_some_and(|l| l.contains("Only you"))).map(|(_, n)| n.bounds()).collect();
let reason =
reason.map(|(id, _)| *id).unwrap_or_else(|| panic!("{row}'s row ({shown:?}) says why, as wide as Install ({install:?}): {why:?}"));
// Scrolled into view, the whole reason fits inside the list's visible area: the list's bounds cut to the
// picker's, below the Search field and above the Close footer (the list's own bounds run on past the
// picker when it scrolls, and the picker's bounds take in its footer).
let visible = |tree: &egui::accesskit::TreeUpdate| {
let find = |role: egui::accesskit::Role, label: &str| {
tree.nodes.iter().find(|(_, n)| n.role() == role && n.label() == Some(label)).and_then(|(_, n)| n.bounds())
};
let list = find(egui::accesskit::Role::List, "Languages").expect("the list");
let picker = find(egui::accesskit::Role::Dialog, "Add a language").expect("the picker");
let in_picker = |label: &str| {
tree.nodes
.iter()
.filter(|(_, n)| n.label() == Some(label))
.filter_map(|(_, n)| n.bounds())
.find(|b| b.x0 >= picker.x0 && b.x1 <= picker.x1 && b.y0 >= picker.y0 && b.y1 <= picker.y1)
};
let search = in_picker("Search").expect("the picker's Search field");
let close = in_picker("Close").expect("the picker's Close button");
(list.y0.max(picker.y0).max(search.y1), list.y1.min(picker.y1).min(close.y0), list)
};
let mut tree = tree;
let mut seen = None;
for _ in 0..20 {
let (top, bottom, list) = visible(&tree);
let b = tree.nodes.iter().find(|(id, _)| *id == reason).and_then(|(_, n)| n.bounds()).expect("the reason stays shown");
seen = Some((b, top, bottom));
if b.y0 >= top && b.y1 <= bottom {
break;
}
let delta = if b.y1 > bottom { bottom - b.y1 } else { top - b.y0 };
let center = egui::pos2(((list.x0 + list.x1) / 2.0) as f32, ((top + bottom) / 2.0) as f32);
let wheel = egui::Event::MouseWheel {
unit: egui::MouseWheelUnit::Point,
delta: egui::vec2(0.0, delta as f32),
phase: egui::TouchPhase::Move,
source: egui::MouseWheelSource::Unknown,
modifiers: Default::default(),
};
frame(&mut a, &ctx, vec![egui::Event::PointerMoved(center), wheel]);
tree = settled(&mut a, &ctx);
}
assert!(
seen.is_some_and(|(b, top, bottom)| b.y0 >= top && b.y1 <= bottom),
"{row}'s reason fits inside the list's visible area (reason, top, bottom): {seen:?}"
);
}
}
/// Set as default sets only the saved default proofing language (`review.language.preferred`); the
/// document, its undo history, the redo stack and the modified flag are untouched.
#[test]
-4
View File
@@ -437,10 +437,6 @@ pub struct WordApp {
/// The font database's [`generation`](wordcraft_fonts::FontDb::generation) last seen: when
/// fonts are added or removed (by any route) the font lists and the layout are refreshed.
font_generation: u64,
/// Test-only catalog override so UI tests list only fixed `assets/fonts/` without scanning
/// the host's system fonts.
#[cfg(test)]
pub(crate) font_catalog: Option<std::sync::Arc<craft::font_manager::Catalog>>,
/// Focus (#1678): the ribbon is dropped down from the Focus bar, over the page. The shell
/// owns the flag while it draws; the app reads it back after each pass.
pub(crate) ribbon_dropped: bool,
-35
View File
@@ -29,19 +29,6 @@ pub(crate) fn comment_time(c: &wordcraft_doc::Comment) -> String {
stamp(&c.date, c.date_utc.as_deref(), offset_minutes)
}
/// A tracked change's time for its hover tip, read as [`comment_time`] reads a comment: the UTC
/// time (`date_utc`, Word's `w16du:dateUtc`, which WordCraft keeps for the changes it makes) wins
/// and shows in local time. Without it (`w:date` only), Word writes local time there with a `Z`
/// it doesn't mean and shows it as written, so it shows as written here too; a time with an
/// offset (`±HH:MM`) is converted. Empty when it isn't a date.
pub(crate) fn revision_time(r: &wordcraft_doc::Revision) -> String {
revision_stamp(r, offset_minutes)
}
fn revision_stamp(r: &wordcraft_doc::Revision, offset: impl Fn(i64) -> i32) -> String {
stamp(&r.date, r.date_utc.as_deref(), offset)
}
fn stamp(date: &str, date_utc: Option<&str>, offset: impl Fn(i64) -> i32) -> String {
let utc = date_utc.and_then(parse).filter(|t| t.timed).map(|t| Time { zone: Some(t.zone.unwrap_or(0)), ..t });
let local_date = || parse(date).map(|t| if date.trim_end().ends_with(['Z', 'z']) { Time { zone: None, ..t } } else { t });
@@ -198,28 +185,6 @@ mod tests {
assert_eq!(stamp("2026-10-12Z", Some("2026-10-12"), |_| -4 * 60), "2026-10-12");
}
/// A change WordCraft makes keeps its UTC time, so its tip shows the user's local time, here
/// two hours east of UTC; a change from a file with only a `Z` date still shows as written
/// (#7887).
#[test]
fn changes_made_here_show_in_local_time() {
let utc_plus_2 = |_: i64| 2 * 60;
let made = wordcraft_engine::cmd::made_revision(wordcraft_doc::RevisionKind::Insert, "Ada".into(), "2026-11-20T12:05:00Z".into());
assert_eq!(revision_stamp(&made, utc_plus_2), "2026-11-20 14:05");
let imported = wordcraft_doc::Revision::new(wordcraft_doc::RevisionKind::Insert, "Ada", "2026-11-20T12:05:00Z");
assert_eq!(revision_stamp(&imported, utc_plus_2), "2026-11-20 12:05");
}
/// A tracked change from a file with only its `w:date` (#7887): shown as written, `Z` or not,
/// as Word shows it.
#[test]
fn revision_times_show_as_written() {
let at = |date: &str| revision_time(&wordcraft_doc::Revision::new(wordcraft_doc::RevisionKind::Insert, "Ada", date));
assert_eq!(at("2026-11-20T14:05:00Z"), "2026-11-20 14:05");
assert_eq!(at("2026-11-20"), "2026-11-20");
assert_eq!(at("not a date"), "");
}
/// Whatever a file holds, a stamp is a date or nothing, never a panic.
#[test]
fn hostile_times_show_nothing() {
+23 -163
View File
@@ -10,7 +10,6 @@ use std::path::{Path, PathBuf};
// PLAN(app-hub): the `craft` facade dependency of ui-egui (`craft::platform` = craft-platform), as in system_clipboard.rs
use craft::platform::clipboard::ClipboardError;
use craft::ui::runtime::commands::ClipboardHandle;
use serde_json::{Value, json};
use crate::{WordApp, system_clipboard};
@@ -78,16 +77,27 @@ fn paste_files(app: &mut WordApp, files: Vec<PathBuf>) -> Option<Result<Value, S
Some(r)
}
/// Paste copied picture files, or the bitmap if allowed and there are no copied files.
pub(crate) fn paste(app: &mut WordApp, allow_bitmap: bool) -> Option<Result<Value, String>> {
/// Paste the picture on the system clipboard: copied picture files, else its bitmap. `None` when
/// there is none (or no clipboard): the caller pastes as usual.
pub(crate) fn paste(app: &mut WordApp) -> Option<Result<Value, String>> {
let clip = system_clipboard::handle(app)?;
let r = match clip.read_files().ok().flatten().filter(|f| !f.is_empty()) {
Some(files) => paste_files(app, files)?,
None if !allow_bitmap => return None,
None => match bitmap_png(&clip) {
Ok(Some(png)) => return Some(insert_bitmap(app, &png)),
None => match clip.read_image() {
Ok(None) => return None,
Ok(Some(image)) => match png_from_rgba(image.width as usize, image.height as usize, image.rgba) {
Ok(png) => app.execute("insert.picture", json!({"data": wordcraft_engine::cmd::insert::base64_encode(&png)})),
Err(e) => {
log::warn!("clipboard picture: {e}");
app.status(e.clone());
Err(e)
}
},
Err(e) => {
let e = match e {
ClipboardError::TooLarge { .. } => "the clipboard picture is too large to paste".to_string(),
e => crate::i18n::fmt(tl!("The picture on the clipboard couldn't be read: {error}"), &[("error", &e.to_string())]),
};
log::warn!("clipboard picture: {e}");
app.status(e.clone());
Err(e)
@@ -99,21 +109,6 @@ pub(crate) fn paste(app: &mut WordApp, allow_bitmap: bool) -> Option<Result<Valu
Some(r)
}
/// Encode the bounded native bitmap through the same path for ordinary and mixed clipboard pastes.
pub(crate) fn bitmap_png(clip: &ClipboardHandle) -> Result<Option<Vec<u8>>, String> {
let image = clip.read_image().map_err(|e| match e {
ClipboardError::TooLarge { .. } => "the clipboard picture is too large to paste".to_string(),
e => crate::i18n::fmt(tl!("The picture on the clipboard couldn't be read: {error}"), &[("error", &e.to_string())]),
})?;
image.map(|image| png_from_rgba(image.width as usize, image.height as usize, image.rgba)).transpose()
}
pub(crate) fn insert_bitmap(app: &mut WordApp, png: &[u8]) -> Result<Value, String> {
let r = app.execute("insert.picture", json!({"data": wordcraft_engine::cmd::insert::base64_encode(png)}));
app.select_inserted_picture(&r);
r
}
/// The picture on the system clipboard as PNG (or the first copied picture file's bytes), for
/// Paste Special to offer. `None` when there is none, or it is too large or unreadable.
pub(crate) fn clipboard_png(app: &WordApp) -> Option<Vec<u8>> {
@@ -132,10 +127,16 @@ fn read_picture_file(path: &Path, limit: u64) -> Option<Vec<u8>> {
wordcraft_engine::io::read_regular_file_within(path, limit)
}
/// Paste text naming copied picture files: insert the pictures when the clipboard holds those
/// files. False leaves the text to the usual paste.
pub(crate) fn paste_named_files(app: &mut WordApp, text: &str) -> bool {
names_picture_files(text) && paste(app).is_some()
}
#[cfg(test)]
mod tests {
use super::*;
use crate::system_clipboard::testing::{app_holding, app_holding_with_image_error, rgba8};
use crate::system_clipboard::testing::{app_holding, rgba8};
use craft::platform::clipboard::{Flavor, RGBA8, URI_LIST};
fn pictures(a: &mut WordApp) -> usize {
@@ -188,16 +189,6 @@ mod tests {
assert!(!names_picture_files("see /tmp/b.png") && !names_picture_files("notes.txt") && !names_picture_files(""));
}
#[test]
fn bitmap_only_paste_inserts_a_picture_during_equation_editing() {
let mut app = app_holding(&[rgba8(4, 4, 200)]);
app.run("insert.equation", json!({"linear": "abc"})).unwrap();
assert!(app.session.math.is_some());
app.run("edit.paste", json!({})).unwrap();
let objects = app.session.run("arrange.selectionPane", &json!({})).unwrap();
assert!(objects.as_array().is_some_and(|objects| objects.iter().any(|object| object["kind"] == "picture")));
}
/// Text on the clipboard wins over a picture beside it (#584).
#[test]
fn paste_without_text_reads_the_system_clipboard() {
@@ -212,137 +203,6 @@ mod tests {
assert!(r["formats"].as_array().is_some_and(|f| f.iter().any(|x| x["id"] == "text")), "{r}");
}
#[test]
fn ordinary_paste_prefers_pixels_for_a_single_image_offer() {
use craft::platform::clipboard::HTML;
let url = "https://example.test/picture.png";
let html = format!(r#"<meta http-equiv="content-type" content="text/html; charset=utf-8"><img src="{url}" alt="A &amp; B">"#);
let url_and_alt = format!("{url}\r\nA & B");
for text in [url, "A & B", &url_and_alt] {
let mut app = app_holding(&[Flavor::text(text), Flavor::new(HTML, html.as_bytes().to_vec()), rgba8(4, 4, 200)]);
app.run("edit.paste", json!({})).unwrap();
assert_eq!(pictures(&mut app), 1);
assert!(!app.session.doc.plain_text(wordcraft_doc::StoryRef::Body).contains(text));
app.run("edit.undo", json!({})).unwrap();
assert_eq!(pictures(&mut app), 0);
}
}
#[test]
fn single_image_offer_with_rtf_prefers_readable_pixels() {
use craft::platform::clipboard::{HTML, RGBA8, RTF};
let url = "https://example.test/picture.png";
let html = Flavor::new(HTML, format!(r#"<img src="{url}">"#).into_bytes());
let rtf = Flavor::new(RTF, br"{\rtf1\ansi Image fallback}".to_vec());
let malformed = Flavor::new(RGBA8, vec![1, 0, 0, 0, 1, 0, 0, 0]);
let paste = |bitmap| {
let mut app = app_holding(&[Flavor::text(url), html.clone(), rtf.clone(), bitmap]);
app.run("edit.paste", json!({})).unwrap();
app
};
assert_eq!(pictures(&mut paste(rgba8(4, 4, 200))), 1);
let mut app = paste(malformed);
assert_eq!(pictures(&mut app), 0);
assert_eq!(app.session.doc.plain_text(wordcraft_doc::StoryRef::Body), "Image fallback");
}
#[test]
fn ordinary_paste_falls_back_to_pixels_when_rich_formats_have_no_content() {
use craft::platform::clipboard::{HTML, RTF};
let linked_image = br#"<a href="https://example.test/"><img src="https://example.test/picture.png"></a>"#;
for markup in [Flavor::new(HTML, linked_image.to_vec()), Flavor::new(RTF, br"{\rtf1\ansi}".to_vec())] {
let mut app = app_holding(&[rgba8(4, 4, 200), markup]);
let before = app.session.undo_depth();
app.run("edit.paste", json!({})).unwrap();
assert_eq!(pictures(&mut app), 1);
assert_eq!(wordcraft_render::image_size(app.session.doc.media.values().next().unwrap()), Some((4, 4)));
assert_eq!(app.session.undo_depth(), before + 1);
app.run("edit.undo", json!({})).unwrap();
assert_eq!(pictures(&mut app), 0);
assert_eq!(app.session.undo_depth(), before);
}
}
#[test]
fn empty_rich_paste_distinguishes_unreadable_and_absent_bitmaps() {
use craft::platform::clipboard::RTF;
use wordcraft_doc::StoryRef;
let empty_rtf = Flavor::new(RTF, br"{\rtf1\ansi}".to_vec());
let malformed = Flavor::new(RGBA8, vec![1, 0, 0, 0, 1, 0, 0, 0]);
let mut absent = app_holding(std::slice::from_ref(&empty_rtf));
let before = absent.session.undo_depth();
let nothing = system_clipboard::nothing_to_paste(&absent);
assert_eq!(absent.run("edit.paste", json!({})).unwrap_err(), nothing);
assert_eq!(absent.session.undo_depth(), before);
let mut unreadable = app_holding_with_image_error(&[empty_rtf.clone(), malformed.clone()], Some("malformed bitmap"));
let before = unreadable.session.undo_depth();
let error = unreadable.run("edit.paste", json!({})).unwrap_err();
assert!(error.contains("malformed bitmap"), "{error}");
assert_eq!(unreadable.status_message().unwrap().text.as_str(), error);
assert_eq!(unreadable.session.undo_depth(), before);
assert_eq!(pictures(&mut unreadable), 0);
let mut with_text = app_holding_with_image_error(&[empty_rtf, malformed, Flavor::text("usable text")], Some("malformed bitmap"));
with_text.run("edit.paste", json!({})).unwrap();
assert_eq!(with_text.session.doc.plain_text(StoryRef::Body), "usable text");
assert_eq!(pictures(&mut with_text), 0);
}
#[test]
fn fallback_pixels_do_not_override_rich_content_or_a_refused_paste() {
use craft::platform::clipboard::{HTML, RTF};
use wordcraft_doc::StoryRef;
let empty_rtf = Flavor::new(RTF, br"{\rtf1\ansi}".to_vec());
let rich_html = Flavor::new(HTML, b"<p><strong>Rich content</strong></p>".to_vec());
let mut app = app_holding(&[rgba8(4, 4, 200), rich_html]);
app.run("edit.paste", json!({})).unwrap();
assert_eq!(app.session.doc.plain_text(StoryRef::Body), "Rich content");
assert_eq!(pictures(&mut app), 0);
let mut app = app_holding(&[rgba8(4, 4, 200), empty_rtf.clone()]);
app.session.doc.settings.protection = Some("readOnly".into());
let err = app.run("edit.paste", json!({})).unwrap_err();
assert!(err.contains("edit.paste:") && err.contains("read only"), "{err}");
assert_eq!(pictures(&mut app), 0);
let mut app = app_holding(&[rgba8(4, 4, 200), empty_rtf]);
app.run("insert.equation", json!({"linear": "abc"})).unwrap();
assert!(app.session.math.is_some());
assert!(app.run("edit.paste", json!({})).is_err());
assert_eq!(pictures(&mut app), 0);
}
#[test]
fn ordinary_paste_preserves_urls_rich_selections_and_unreadable_images() {
use craft::platform::clipboard::{HTML, RGBA8};
let url = "https://example.test/picture.png";
let img = format!(r#"<img src="{url}">"#);
let rich = format!("<p><strong>Caption</strong>{img}</p>");
let good = rgba8(4, 4, 200);
let bad = Flavor::new(RGBA8, vec![1, 0, 0, 0, 1, 0, 0, 0]);
for (markup, bitmap, text, expected) in
[(None, good.clone(), url, url), (Some(rich.as_str()), good, "Caption", "Caption"), (Some(img.as_str()), bad, url, url)]
{
let mut flavors = vec![Flavor::text(text), bitmap];
if let Some(markup) = markup {
flavors.push(Flavor::new(HTML, markup.as_bytes().to_vec()));
}
let mut app = app_holding(&flavors);
app.run("edit.paste", json!({})).unwrap();
assert_eq!(pictures(&mut app), 0);
assert_eq!(app.session.doc.plain_text(wordcraft_doc::StoryRef::Body), expected);
}
}
/// Copied picture files insert as pictures, not as their paths; a folder entry and a
/// non-picture file are skipped, and files that aren't pictures leave Paste to the usual path.
#[test]
+17 -100
View File
@@ -47,83 +47,39 @@ fn read_markup(clip: &ClipboardHandle, mime: &str) -> Option<String> {
Some(String::from_utf8_lossy(&flavor.data).into_owned()).filter(|t| !t.trim().is_empty())
}
/// A browser image copy can carry a source address or the image's alt text alongside the bitmap.
fn single_image_offer(html: &str, text: Option<&str>) -> bool {
use craft_html::{Lexer, Token, unescape};
use wordcraft_engine::cmd::paste::html_fragment;
let fragment = html_fragment(html);
if fragment.len() > 64 << 10 {
return false;
}
let mut image = None;
let wrapper = |name: &str| matches!(name, "html" | "body" | "head" | "div" | "span" | "p");
for token in Lexer::new(fragment) {
match token {
Token::Start(tag) if tag.name == "img" && image.is_none() => {
image = Some((tag.attr("src").unwrap_or_default(), tag.attr("alt").unwrap_or_default()));
}
Token::Start(tag) if wrapper(&tag.name) && tag.attrs.is_empty() => {}
Token::Start(tag) if tag.name == "meta" && tag.attrs.len() == 1 && tag.has("charset") => {}
Token::Start(tag)
if tag.name == "meta"
&& tag.attrs.len() == 2
&& tag.raw_attr("http-equiv").is_some_and(|value| value.eq_ignore_ascii_case("content-type"))
&& tag.has("content") => {}
Token::End(name) if wrapper(&name) => {}
Token::Text(text) if unescape(text).trim().is_empty() => {}
_ => return false,
}
}
let Some((src, alt)) = image else { return false };
let text = text.unwrap_or_default().trim();
let alt = alt.trim();
let src = src.trim();
text.is_empty()
|| text == alt
|| text == src
|| text.split_once('\n').is_some_and(|(address, description)| address.trim() == src && description.trim() == alt)
}
pub(crate) enum PasteFill {
Continue,
BitmapIfEmpty,
Handled(Result<Value, String>),
}
/// Add what the system clipboard holds to a paste command's params: its text (the ribbon and
/// context-menu Paste send none), its HTML and RTF, and for Paste Special its picture. Params a
/// caller already gave are kept. For ordinary desktop Paste, unusable rich formats may leave
/// a bitmap to try after the engine checks the content.
pub(crate) fn fill(app: &mut WordApp, id: &str, params: &mut Value) -> PasteFill {
/// caller already gave are kept. `Some` when the paste was done here instead (copied picture
/// files, which reach us as their paths).
pub(crate) fn fill(app: &mut WordApp, id: &str, params: &mut Value) -> Option<Result<Value, String>> {
if !is_paste(id) {
return PasteFill::Continue;
return None;
}
let (Some(clip), Some(o)) = (handle(app), params.as_object_mut()) else { return PasteFill::Continue };
let explicit = ["text", "html", "rtf", "picture"].iter().any(|k| o.contains_key(*k));
let clip = handle(app)?;
let o = params.as_object_mut()?;
// A caller that captured ownership already (Paste Special's dialog) keeps that value.
if !o.contains_key("privateClipboard") {
let own = app.clipboard_published && clip.holds_ours();
o.insert("privateClipboard".into(), Value::Bool(own));
}
let owned = app.session.clipboard.is_some() && o.get("privateClipboard").and_then(Value::as_bool) == Some(true);
let ordinary = id == "edit.paste" && !explicit && !owned;
if !o.contains_key("text")
&& let Some(text) = clip.read_text().ok().flatten().filter(|t| !t.is_empty())
{
if ordinary
// Picture files copied in a file manager reach us as their paths: paste the pictures,
// as Ctrl+V does.
if id == "edit.paste"
&& app.session.math.is_none()
&& paste_picture::names_picture_files(&text)
&& let Some(r) = paste_picture::paste(app, true)
&& let Some(r) = paste_picture::paste(app)
{
return PasteFill::Handled(r);
return Some(r);
}
o.insert("text".into(), Value::String(text));
}
// Keep Text Only needs nothing more; a caller that passed formats of its own (an agent, Paste
// Special's OK) has them already.
if id == "edit.pasteText" || ["html", "rtf", "picture"].iter().any(|k| o.contains_key(*k)) {
return PasteFill::Continue;
return None;
}
if let Some(html) = read_markup(&clip, HTML) {
o.insert("html".into(), Value::String(html));
@@ -131,32 +87,9 @@ pub(crate) fn fill(app: &mut WordApp, id: &str, params: &mut Value) -> PasteFill
if let Some(rtf) = read_markup(&clip, RTF) {
o.insert("rtf".into(), Value::String(rtf));
}
if ordinary {
let text = o.get("text").and_then(Value::as_str);
let html = o.get("html").and_then(Value::as_str);
if text.is_none() && html.is_none() && !o.contains_key("rtf") {
return paste_picture::paste(app, true).map_or(PasteFill::Continue, PasteFill::Handled);
}
if text.is_none()
&& app.session.math.is_none()
&& let Some(r) = paste_picture::paste(app, false)
{
return PasteFill::Handled(r);
}
if app.session.math.is_none()
&& !cfg!(target_arch = "wasm32")
&& html.is_some_and(|html| single_image_offer(html, text))
&& let Ok(Some(png)) = paste_picture::bitmap_png(&clip)
{
return PasteFill::Handled(paste_picture::insert_bitmap(app, &png));
}
if text.is_none() && app.session.math.is_none() && !cfg!(target_arch = "wasm32") {
return PasteFill::BitmapIfEmpty;
}
}
// Native bitmap/image formats are for other programs. Our own paste keeps the original
// fragment (size, cropping and floating-picture properties), while its owner mark lasts.
if owned {
if app.session.clipboard.is_some() && o.get("privateClipboard").and_then(Value::as_bool) == Some(true) {
o.insert("text".into(), Value::String(app.session.clipboard_text.clone()));
}
if id == "edit.pasteSpecial"
@@ -167,7 +100,7 @@ pub(crate) fn fill(app: &mut WordApp, id: &str, params: &mut Value) -> PasteFill
o.insert("picture".into(), Value::String(data));
}
}
PasteFill::Continue
None
}
/// Return whether the command result `r` contains any copied payload (text, HTML, RTF, or MathML).
@@ -322,7 +255,8 @@ pub(crate) mod testing {
/// [`MemoryClipboard`] that also answers `read_files` from a held `text/uri-list`, as the system and event
/// clipboards do (the framework's memory clipboard answers none, so a test of copied files would find the
/// clipboard holding only the list's text).
struct FilesClipboard(MemoryClipboard, Option<&'static str>);
#[derive(Default)]
struct FilesClipboard(MemoryClipboard);
impl ClipboardBackend for FilesClipboard {
fn write(&mut self, flavors: &[Flavor]) -> Result<usize, ClipboardError> {
@@ -334,9 +268,6 @@ pub(crate) mod testing {
}
fn read_image(&mut self, limit: u64) -> Result<Option<ClipboardImage>, ClipboardError> {
if let Some(error) = self.1 {
return Err(ClipboardError::Other(error.into()));
}
self.0.read_image(limit)
}
@@ -361,12 +292,7 @@ pub(crate) mod testing {
/// An empty document whose window's clipboard holds `flavors`.
pub(crate) fn app_holding(flavors: &[Flavor]) -> WordApp {
app_holding_with_image_error(flavors, None)
}
/// Supply a backend read error for bitmap offers the memory clipboard would treat as absent.
pub(crate) fn app_holding_with_image_error(flavors: &[Flavor], image_error: Option<&'static str>) -> WordApp {
let mut clipboard = Clipboard::new(FilesClipboard(MemoryClipboard::default(), image_error));
let mut clipboard = Clipboard::new(FilesClipboard::default());
if !flavors.is_empty() {
let _ = clipboard.write(flavors).unwrap();
}
@@ -431,15 +357,6 @@ mod tests {
}
}
#[test]
fn explicit_html_takes_precedence_over_the_system_bitmap() {
let mut a = app_holding(&[rgba8(4, 4, 200)]);
a.run("edit.paste", json!({"html": "<b>explicit</b>"})).unwrap();
assert_eq!(first_para(&a), "explicit");
assert!(bold_at(&a, 0));
assert!(a.session.doc.media.is_empty());
}
/// Paste Special lists a picture on the system clipboard and pastes it.
#[test]
fn paste_special_offers_the_clipboard_picture() {
+3 -8
View File
@@ -91,9 +91,9 @@ pub fn font_picker<'a>(
pub fn font_box(ui: &mut Ui, app: &mut WordApp, label: impl Into<Label>, family: &mut String) -> FontPickerOutput {
let warning = app.font_box_warning(family);
let rows = actions();
let catalog = app.font_catalog();
let catalog = Catalog::global();
// PLAN: assumed `UiState::font_picker: FontPickerSettings`, replacing `recent_fonts` (app-hub).
let out = font_picker(label, Bind::bound(family), &catalog, Bind::bound(&mut app.ui.font_picker), &rows, warning.as_deref()).show(ui);
let out = font_picker(label, Bind::bound(family), catalog, Bind::bound(&mut app.ui.font_picker), &rows, warning.as_deref()).show(ui);
if let Some(command) = out.action.and_then(action_command) {
let _ = app.run(command, json!({}));
}
@@ -101,13 +101,8 @@ pub fn font_box(ui: &mut Ui, app: &mut WordApp, label: impl Into<Label>, family:
}
impl WordApp {
/// The font catalog every font box lists: the process's one catalog (or an isolated test
/// catalog when set).
/// The font catalog every font box lists: the process's one catalog.
pub(crate) fn font_catalog(&self) -> Arc<Catalog> {
#[cfg(test)]
if let Some(catalog) = &self.font_catalog {
return Arc::clone(catalog);
}
Arc::clone(Catalog::global())
}
+45 -27
View File
@@ -1,8 +1,5 @@
use std::path::Path;
use std::sync::Arc;
use craft::font_manager::Catalog;
use craft::font_manager::craft_font_catalog::{FontEnv, Os};
use craft::font_manager::craft_font_catalog::{Limits, Source};
use craft::ui::buttons::IconButton;
use craft::ui::contract::{Props as _, Show as _};
use egui::accesskit::Role;
@@ -13,14 +10,25 @@ use wordcraft_engine::Session;
use crate::{Services, WordApp};
fn fixed_catalog() -> Arc<Catalog> {
let env = FontEnv { os: Os::None, ..Default::default() };
let catalog = Arc::new(Catalog::new(env).with_font_service(false));
catalog.set_app_dirs(vec![Path::new(env!("CARGO_MANIFEST_DIR")).join("../../assets/fonts")]);
catalog.rescan();
assert!(catalog.is_ready(), "fixed font catalog scanned synchronously");
assert!(catalog.families().iter().any(|f| f == "Inter"), "fixed catalog loaded assets/fonts");
catalog
fn ensure_catalog_ready() {
let catalog = 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");
let families = catalog.families();
for (family, bytes) in [
("Inter", include_bytes!("../../../../assets/fonts/Inter-Regular.ttf").as_slice()),
("JetBrains Mono", include_bytes!("../../../../assets/fonts/JetBrainsMono-Regular.ttf").as_slice()),
("Source Serif 4", include_bytes!("../../../../assets/fonts/SourceSerif4-Regular.ttf").as_slice()),
] {
if !families.iter().any(|f| f == family) {
let _ = catalog.add_bytes(bytes.to_vec(), Source::Bundled, &Limits::default());
}
}
}
fn open_ribbon_font_box(h: &mut egui_kittest::Harness<'static, WordApp>) {
@@ -51,11 +59,10 @@ fn current_font(h: &mut egui_kittest::Harness<'static, WordApp>) -> Option<Strin
/// when recent fonts exist, and Arrow-Down skips section headings rather than landing on them.
#[test]
fn font_list_sections_skip_their_headings() {
let catalog = fixed_catalog();
ensure_catalog_ready();
let mut app = WordApp::new(Session::new(wordcraft_doc::Document::from_text("Sample")), Services::default());
app.ui.language = "en".into();
app.font_catalog = Some(Arc::clone(&catalog));
let mut h = crate::test_harness::builder().with_size(egui::vec2(1440.0, 900.0)).build_eframe(|_| app);
h.run_steps(4);
@@ -82,7 +89,6 @@ fn font_list_sections_skip_their_headings() {
// heading and land on `first_all`, so Enter switches the document font to `first_all`.
let mut app = WordApp::new(Session::new(wordcraft_doc::Document::from_text("Sample")), Services::default());
app.ui.language = "en".into();
app.font_catalog = Some(catalog);
app.run("format.font", json!({"name": chosen_recent})).unwrap();
assert_eq!(app.ui.font_picker.recent, [chosen_recent.as_str()]);
assert_eq!(app.session.run("format.state", &json!({})).unwrap().get("font").and_then(Value::as_str), Some(chosen_recent.as_str()));
@@ -231,10 +237,10 @@ fn drawn_buttons_fade_in_on_hover_and_darken_while_pressed() {
#[test]
fn the_typed_list_shows_on_the_frame_of_the_keystroke() {
const RECENT: &str = "Source Serif 4";
ensure_catalog_ready();
let mut app = WordApp::new(Session::new(wordcraft_doc::Document::from_text("Sample")), Services::default());
app.ui.language = "en".into();
app.font_catalog = Some(fixed_catalog());
app.ui.font_picker.recent = vec![RECENT.to_string()];
let mut family = String::new();
@@ -262,12 +268,12 @@ fn the_typed_list_shows_on_the_frame_of_the_keystroke() {
let frames: [(Vec<egui::Event>, &[&str], &[&str], bool); 7] = [
// Typing an unmatched query clears the list; one Backspace restores recents + all fonts on that frame.
(vec![egui::Event::Text("!".into())], &[], &[RECENT, "Inter", "JetBrains Mono"], false),
(erase(), &[RECENT, "Inter", "JetBrains Mono"], &[], true),
(erase(), &[RECENT], &[], true),
// Typing narrows immediately on the keystroke frame and excludes non-matching families.
(vec![egui::Event::Text("jet".into())], &["JetBrains Mono"], &["Inter", RECENT], false),
(erase(), &["JetBrains Mono"], &["Inter"], false),
(erase(), &["JetBrains Mono"], &["Inter"], false),
(erase(), &[RECENT, "Inter", "JetBrains Mono"], &[], true),
(erase(), &[RECENT], &[], true),
(vec![egui::Event::Text("int".into())], &["Inter"], &["JetBrains Mono"], false),
];
@@ -296,15 +302,27 @@ fn the_typed_list_shows_on_the_frame_of_the_keystroke() {
assert!(texts.iter().all(|t| t != label), "keystroke {n}: expected {label:?} to be filtered out on the frame, got texts: {texts:?}");
}
if restores_recents {
let recent_y = h.get_by_label("Recently Used Fonts").rect().min.y;
let all_y = h.get_by_label("All Fonts").rect().min.y;
assert!(
h.query_all_by_role_and_label(Role::TreeItem, RECENT).any(|row| {
let y = row.rect().min.y;
recent_y < y && y < all_y
}),
"keystroke {n}: expected {RECENT:?} between Recently Used Fonts and All Fonts on the clearing frame"
);
let jetbrains_y = h.query_all_by_role_and_label(Role::TreeItem, "JetBrains Mono").map(|row| row.rect().min.y).next();
if let (Some(recent_heading), Some(all_heading)) = (h.query_by_label("Recently Used Fonts"), h.query_by_label("All Fonts")) {
let recent_y = recent_heading.rect().min.y;
let all_y = all_heading.rect().min.y;
assert!(
h.query_all_by_role_and_label(Role::TreeItem, RECENT).any(|row| {
let y = row.rect().min.y;
recent_y < y && y < all_y
}),
"keystroke {n}: expected {RECENT:?} between Recently Used Fonts and All Fonts on the clearing frame"
);
} else if let Some(jb_y) = jetbrains_y {
// When system fonts push `JetBrains Mono` down the catalog and `List` keeps that
// prior lead in view on clear, the restored recent row still sits above `All Fonts`.
assert!(
h.query_all_by_role_and_label(Role::TreeItem, RECENT).any(|row| row.rect().min.y < jb_y),
"keystroke {n}: expected restored recent {RECENT:?} above JetBrains Mono on the clearing frame"
);
} else {
panic!("keystroke {n}: expected Recently Used Fonts and All Fonts headings on the clearing frame");
}
}
}
-2
View File
@@ -156,8 +156,6 @@ impl WordApp {
print_feedback_seen: _,
print_gen: _,
font_generation: _,
#[cfg(test)]
font_catalog: _,
updates_rt: _,
font_notice_seen: _,
font_notices: _,
+6 -9
View File
@@ -543,17 +543,14 @@ impl WordApp {
}
}
/// Cascade from the last window with reported outer bounds and a usable client size.
/// The outer rect anchors the cascade and the builder sizes the client area.
/// Where a window opening now cascades from: the outer rect of the window focused before it
/// that has reported one, moved one step. `None` where no window reports its place (the web,
/// an embedded shell); the overlay places the window then.
fn cascade_from(&self, ui: &egui::Ui, new: WindowId, step: f32) -> Option<egui::Rect> {
let host = WindowHost::of(ui.ctx());
let (outer, inner_size) = self.windows.list.recent().filter(|&id| id != new).find_map(|id| {
let facts = host.facts(self.windows.viewport_of(ui.ctx(), id)?)?;
let outer = facts.outer.filter(|rect| rect.is_finite() && rect.is_positive())?;
let inner_size = facts.inner.size();
(facts.inner.is_positive() && inner_size.is_finite()).then_some((outer, inner_size))
})?;
Some(DocumentWindow::cascaded(ui, outer, inner_size, step))
let previous =
self.windows.list.recent().filter(|&id| id != new).find_map(|id| host.facts(self.windows.viewport_of(ui.ctx(), id)?)?.outer)?;
Some(DocumentWindow::cascaded(ui, previous, previous.size(), step))
}
/// Draw every window (see the module documentation): the root entry in the root viewport,
-44
View File
@@ -67,10 +67,6 @@ impl Rig {
/// One frame of every window with explicit root and child input events.
fn frame_events(&mut self, a: &mut WordApp, root: Vec<egui::Event>, child: Vec<egui::Event>) {
self.kit.root_info(self.info(false));
self.frame_after_root_report(a, root, child);
}
fn frame_after_root_report(&mut self, a: &mut WordApp, root: Vec<egui::Event>, child: Vec<egui::Event>) {
self.kit.child_info(self.info(true));
if let Some(focused) = self.focused {
self.kit.focus(focused);
@@ -1029,46 +1025,6 @@ fn every_open_replaces_an_untouched_blank_document_in_its_window() {
std::fs::remove_dir_all(second.parent().unwrap()).ok();
}
/// Open a new document after the focused root reports its geometry. Return the actual opening
/// request recorded by the simulated native viewport and the configured cascade step.
fn new_document_builder(inner_rect: Option<egui::Rect>, outer_rect: Option<egui::Rect>) -> (egui::ViewportBuilder, f32) {
let mut rig = Rig::new();
let mut a = app("First draft");
rig.kit.root_info(ViewportInfo { inner_rect, outer_rect, focused: Some(true), ..Default::default() });
for _ in 0..3 {
rig.frame_after_root_report(&mut a, Vec::new(), Vec::new());
}
let step = super::StyleCx::with_root(&rig.ctx(), |cx| cx.tokens.size.window.cascade);
a.run("file.new", json!({})).unwrap();
assert_eq!(a.window_count(), 2);
let title = a.window_title();
rig.frame_after_root_report(&mut a, Vec::new(), Vec::new());
let builder = rig.builders.into_iter().find(|b| b.title.as_ref() == Some(&title)).expect("the new document opened a native window");
(builder, step)
}
#[test]
fn new_document_cascade_keeps_the_predecessors_client_size_and_outer_origin() {
let origin = egui::pos2(50.0, 70.0);
let client = egui::vec2(800.0, 600.0);
for (inset, frame) in [(egui::Vec2::ZERO, egui::Vec2::ZERO), (egui::vec2(8.0, 30.0), egui::vec2(16.0, 38.0))] {
let outer = egui::Rect::from_min_size(origin, client + frame);
let inner = egui::Rect::from_min_size(origin + inset, client);
let (builder, step) = new_document_builder(Some(inner), Some(outer));
assert_eq!(builder.inner_size, Some(client), "client size with frame {frame:?}");
assert_eq!(builder.position, Some(origin + egui::Vec2::splat(step)), "cascade uses the outer origin");
}
}
#[test]
fn new_document_cascade_without_predecessor_geometry_uses_default_placement() {
let rect = egui::Rect::from_min_size(egui::pos2(50.0, 70.0), egui::vec2(800.0, 600.0));
for (inner, outer) in [(Some(rect), None), (None, Some(rect))] {
let (builder, _) = new_document_builder(inner, outer);
assert_eq!(builder.position, None, "the platform picks the initial position without a usable predecessor");
}
}
/// #3634: a NUL in the document title never reaches an OS window title (X11 and Wayland panic on
/// it): not a native window's builder, not a `Title` command, not the window menu. Checks what the
/// frames send, so a new title source that skips `display_title` fails here.
+10 -16
View File
@@ -96,12 +96,12 @@ let apps move windows, so there Arrange All and Side by Side only resize.
| `engine.commands` | `search?` | every command: id, label, location, shortcut, params, enabled |
| `document.inspect` | `text?`, `doc?` | blocks (text, style, runs, lists, tables), parts, sections, selection, pages |
| `ui.inspect` | — | UI state, view, window size, page rects on screen, caret, the selected comment balloon (`balloon`), perf; `dialogs`: the open dialogs (`id`, `parent`, `key`, `fields`), the top one last; `windows`: the other windows as the drawn window sees them (`available`, `current`, `others`, `sideBySide`, `syncScroll`); `document`: the active document's id; `documents`: the open documents (`id`, `title`, `path`, `dirty`, `active`) |
| `ui.click` | `x?`, `y?`, `coordinates?`, `page?`, `control?`, `button?` (`left`, `right`, `secondary`, `middle`), `count?`, `hold?`, modifiers; or the `id` or `label` of a `ui.accessTree` node (with optional `button?`: `left`, `right`, `secondary`) | real pointer input at the target point (`x`, `y` default to `0`, i.e. window top-left `(0, 0)` without `control`) or node; `hold: true` keeps the button down until `ui.release` |
| `ui.click` | `x?`, `y?`, `coordinates?`, `page?`, `control?`, `button?` (`left`, `right`, `secondary`, `middle`), `count?`, `hold?`, modifiers; or the `id` or `label` of a `ui.accessTree` node (with optional `button?`: `left`, `right`, `secondary`) | real pointer input at the target point or node; `hold: true` keeps the button down until `ui.release` |
| `ui.clickText` | `page` (0-based), `x`, `y` (points from the page's top-left), `count?` | click inside a page; replies at once with `screen`, the window point it clicks (`[x, y]`), before the click is processed |
| `ui.move` | `x`, `y`, `coordinates?`, `page?`, `rest?` (0–10 s), modifiers; or the `id` or `label` of a `ui.accessTree` node, `rest?`, modifiers | pointer move (to the point, or to the centre of the node's rect); `rest` waits that many seconds before replying; with a button held (`ui.click` with `hold`), a drag you can screenshot halfway |
| `ui.drag` | `from`, `to` (each `{x?, y?, coordinates?, page?, control?}`), `button?` (`left`, `right`, `middle`), `steps?` (1–200, default 12), modifiers | one-request drag: presses at `from`, moves in even `steps` to `to`, and releases (`x`, `y` default to `0` in each point) |
| `ui.release` | `button?` or `key?`, `x?`, `y?`, `coordinates?`, `page?`, `control?` | lets go of what `hold` keeps down (where the pointer is when `x`, `y` and `control` are omitted; with neither `button` nor `key`, everything, modifiers too). A drag you can pause or screenshot halfway is `ui.click` with `"hold": true`, then `ui.move`, then `ui.release` |
| `ui.wheel` | `x?`, `y?`, `coordinates?`, `page?`, `control?`, `dy?`, `dx?`, `unit?` (`points`, the default, or `lines`), modifiers | mouse-wheel or trackpad scroll at the target point (`x`, `y` default to `0`, i.e. window top-left `(0, 0)` without `control`; `dy` < 0 scrolls down) |
| `ui.drag` | `from`, `to` (each `{x?, y?, coordinates?, page?, control?}`), `button?` (`left`, `right`, `middle`), `steps?` (1–200, default 12), modifiers | one-request drag: presses at `from`, moves in even `steps` to `to`, and releases |
| `ui.release` | `button?` or `key?`, `x?`, `y?`, `coordinates?`, `page?`, `control?` | lets go of what `hold` keeps down (with neither `button` nor `key`, everything, modifiers too). A drag you can pause or screenshot halfway is `ui.click` with `"hold": true`, then `ui.move`, then `ui.release` |
| `ui.wheel` | `x?`, `y?`, `coordinates?`, `page?`, `control?`, `dy?`, `dx?`, `unit?` (`points`, the default, or `lines`), modifiers | mouse-wheel or trackpad scroll at the target point (`dy` < 0 scrolls down) |
| `ui.key` | `key` (`B`, `Enter`, `Left`…), `hold?`, modifiers | key press through egui (shortcuts apply); `hold: true` keeps the key down until `ui.release` |
| `ui.type` | `text` | typed text through egui |
| `ui.ime` | `preedit` with `cursor?` (`[start, end]` in its characters), or `commit` | input-method composition: the text being composed, or the text it commits |
@@ -121,18 +121,12 @@ let apps move windows, so there Arrange All and Side by Side only resize.
| `ui.replayAt` | `at` (0–1) | holds Ink Replay at that fraction of its length, while Ink Replay is on |
| `app.quit` | `force?` | quits (see [Closing the document](#closing-the-document)) |
Pointer positions default to window points (`coordinates: "screen"`), with `x` and `y` each
defaulting to `0` — so without `control` (or `id` / `label` on `ui.click`), omitting `x` and `y` on
`ui.click`, `ui.wheel` or `ui.drag` (`from` / `to`) acts at `(0, 0)`, the window's top-left corner
(or page `page`'s top-left under `coordinates: "document"`), rather than the current pointer
position. By contrast, `ui.release` and `ui.drop` use the current pointer position when `x`, `y`
and `control` are all omitted, and default a missing `x` or `y` to `0` when any of those fields is
given. `coordinates: "document"` maps page points through the canvas with `page?` (0-based, default
`0`). `control` (`{name, role?, within?, index?}`) places the pointer at the centre of the
matching `ui.accessTree` control plus an optional `x`, `y` offset (default `0`), and excludes
`coordinates`; `ui.click`, `ui.drag` (`from`/`to`), `ui.release`, `ui.wheel` and `ui.drop` resolve
`control`, whereas `ui.move` requires `x` and `y` when no `id` or `label` is given (it allows
`control` as a field name, though `x` and `y` still set the point).
Pointer positions default to window points (`coordinates: "screen"`). `coordinates: "document"` maps
page points through the canvas with `page?` (0-based, default `0`). `control` (`{name, role?,
within?, index?}`) places the pointer at the centre of the matching `ui.accessTree` control plus an
optional `x`, `y` offset (default `0`), and excludes `coordinates`; `ui.click`, `ui.release`,
`ui.wheel` and `ui.drop` resolve `control`, whereas `ui.move` requires `x` and `y` when no `id` or
`label` is given (it allows `control` as a field name, though `x` and `y` still set the point).
Modifiers are `shift`, `alt`, `command` (⌘ on macOS, Ctrl elsewhere) and `ctrl` (the Control key on macOS), each `true` or `false`.
File diff suppressed because one or more lines are too long
-6
View File
@@ -159,11 +159,6 @@ formatting of the text before the cursor. Not yet compared side by side in Word.
Word's documented keyboard behaviour (Microsoft's shortcut list, feature names only); the
Windows/Linux keys are given first, macOS second.
Within a paragraph, WordCraft's Left and Right keys skip deleted text the editor leaves out
of the line (#8746). This includes body deletions shown in balloons and revisions suppressed
by the Hidden deletion or moved-from mark. Deletions still shown inline keep their caret stops,
including in headers and notes when the body uses balloons. Shift extends across the same stops.
| Keys | Word's result | Test |
|---|---|---|
| Backspace, then type | the typed text takes the formatting of the character Backspace deleted, not of the one now left of the caret: in `Abc abc` with `Abc` bold, Backspace after the space then `X` gives a plain X; Backspace after a bold letter that follows a plain space gives a bold X. The Bold button shows it before typing, also with the caret inside a word (where it otherwise shows the word). Several Backspaces: the last deleted character's formatting. A Backspace that changes nothing (at the start of the document) keeps it, and keeps formatting set at the caret too. Typing goes on with it (in `ab Cd` with `C` bold, Backspace after the C then `YX` gives a bold YX), and undoing that typing brings it back. Moving the caret any way drops it, not only with the caret keys: a click elsewhere (also one that comes back to the same place), Go To, Find (typing over the found word takes that word's formatting; a Find with no match keeps it) and a paste, whose text never takes it (formatted or plain; a paste with nothing on the clipboard keeps it); typing then takes the formatting where the caret is. A command that is refused (a Backspace into a content control locked against editing) keeps it, and formatting set at the caret too. Forward Delete, a deleted selection, a paragraph join, an object or a break carry nothing. With Track Changes on Backspace carries it too: the character stays, marked deleted (or goes, when it is the author's own tracked insertion), and the typed text is a tracked insertion with that formatting, never marked deleted; moving the caret away and back drops it. Ctrl+Backspace that deletes a word or joins paragraphs drops formatting carried by an earlier Backspace (one that deletes nothing, at the start of the document, keeps it, like Backspace). Undo takes the carried formatting back with the Backspace. Observed in Word for Windows (#6518) | `typing_after_backspace_takes_the_deleted_characters_formatting`, `backspace_formatting_is_dropped_by_a_caret_move_and_delete_does_not_carry`, `backspace_at_the_document_start_keeps_waiting_formatting`, `ctrl_backspace_at_the_document_start_keeps_waiting_formatting`, `backspace_formatting_is_not_kept_past_a_paste`, `backspace_formatting_is_not_kept_past_find_or_go_to`, `backspace_formatting_survives_a_paste_of_an_empty_clipboard`, `backspace_formatting_is_not_kept_past_a_direct_caret_move_and_back`, `a_refused_backspace_keeps_the_formatting_waiting_at_the_caret`, `backspace_formatting_follows_typing_and_comes_back_with_undo`, `tracked_backspace_carries_the_deleted_characters_formatting` |
@@ -182,7 +177,6 @@ including in headers and notes when the body uses balloons. Shift extends across
| Shift+Right (⇧→) at the end of a cell's text | the whole cell is selected first (its end-of-cell mark); the next Shift+Right selects the next cell with it. In an empty cell the first press selects the cell | `shift_right_at_the_end_of_a_cell_selects_the_cell_first` |
| Left / Right (← / →) next to an equation | the arrow steps into the equation instead of over it: Right from just before it opens it at its start, Left from just after it opens it at its end. The arrows then move inside it; past its far end the caret leaves on that side, so the same arrow goes on to the text (or, with two equations side by side, steps into the next one: not yet compared with Word). With text selected, the arrow only collapses the selection, as elsewhere; Shift+Left / Right still selects over the equation as one character. **Differs:** not in right-to-left or mixed-direction paragraphs yet (see Known gaps) (#4138) | `left_and_right_keys_step_into_and_out_of_an_equation`, `right_out_of_an_equation_steps_into_the_one_beside_it`; `cmd::equation::tests::left_and_right_step_into_an_equation_next_to_the_caret` |
| Left / Right across a tracked deletion (#8268) | WordCraft skips hidden deleted text and equations within a paragraph in No Markup. In a paragraph that supports entering equations with the arrow keys, the same press can enter a visible equation immediately beyond the deletion. Shift+Left / Right extends the selection across it. When deleted text is visible inline, it keeps its ordinary caret stops. | `tests::horizontal_caret_skips_hidden_tracked_deletions`, `tests::bidi::arrow_keys_skip_hidden_deletions_in_rtl_text`, `arrow_keys_skip_a_deleted_equation_in_no_markup`, `arrow_keys_enter_a_visible_equation_across_a_hidden_deletion` |
| Left / Right across a wholly deleted paragraph (#8743) | In No Markup, Left and Right skip paragraphs whose text and paragraph mark are both deleted. Shift+Left / Right crosses the same gap without moving the selection anchor. A visible empty paragraph and deletions shown inline still have caret stops. | `arrow_keys_skip_wholly_deleted_paragraphs_in_no_markup`, `arrow_keys_stop_in_a_visible_empty_paragraph_in_no_markup` |
## AutoCorrect and AutoFormat as you type
+1 -2
View File
File diff suppressed because one or more lines are too long