diff --git a/.gitattributes b/.gitattributes index fa2799226b..7a6470f885 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,4 +2,15 @@ # (#6537) and `cargo fmt --check` still passed, so the gate could not see it. Normalise on add. * text=auto -craft-i18n.rev text eol=lf \ No newline at end of file +craft-i18n.rev text eol=lf + +# These model sources and generated tables have byte hashes recorded in model/README.md. +# Keep checkout bytes stable even when core.autocrlf=true. +crates/validate/model/extract_content_model.py text eol=lf +crates/validate/model/generate_model.py text eol=lf +crates/validate/model/content_model_v2.json text eol=lf +crates/validate/model/content_model_v2_transitional.json text eol=lf +crates/validate/model/content_model_dml_v2.json text eol=lf +crates/validate/model/content_model_dml_v2_transitional.json text eol=lf +crates/validate/src/model.rs text eol=lf +crates/validate/model/extract_model_lf.py text eol=lf diff --git a/.github/nightly-linux-signing-key.asc b/.github/nightly-linux-signing-key.asc new file mode 100644 index 0000000000..a1c1f31e8d --- /dev/null +++ b/.github/nightly-linux-signing-key.asc @@ -0,0 +1,16 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mDMEaulK1xYJKwYBBAHaRw8BAQdAqHJeDCjY6Hx5FTn/hW+aqu6V394ubLk0Zj3C +bftDwFm0IkFydENyYWZ0IExpbnV4IFJlbGVhc2UgU2lnbmluZyBLZXmIkwQTFgoA +OxYhBCt2dBtBSq1s0z5jEhOgBcC518PtBQJq6UrXAhsBBQsJCAcCAiICBhUKCQgL +AgQWAgMBAh4HAheAAAoJEBOgBcC518PtGeUA/RjvULBTLlccc+2wtJkfjSnCV+cf +PUMEGmW7XkZWkk51AP9w2A/WLv+79nREWEpZzI8LGK5EjrNazP+sY0l7j5rFCLgz +BGrpStcWCSsGAQQB2kcPAQEHQPl7XkQ1gWsvSPf/T9b4m/UHcjJjBpSOtpYlWR56 +er5RiO8EGBYKACAWIQQrdnQbQUqtbNM+YxIToAXAudfD7QUCaulK1wIbAgCBCRAT +oAXAudfD7XYgBBkWCgAdFiEEVo3B9o+Prsx5fzx7AG2va7DvM04FAmrpStcACgkQ +AG2va7DvM07taQEA4d2VFkKRIP0g9TrE86KpnuXPap+LKqe0tfIxpdf9YxIA/0Wo +9H/iG8nH++nxC087p3HE0S+0UovxqkhXJLSr8B4JDOoA/iLRpqTdYmk6fVXMyPJo +SkOVuwZIGS6VgBdSQP0e2P2YAP41L5OoSvwdQIG3/uNrM+ieqpYeM597/hCLFs5A +ga/qCA== +=3wGQ +-----END PGP PUBLIC KEY BLOCK----- diff --git a/.github/nightly-signing-policy.json b/.github/nightly-signing-policy.json new file mode 100644 index 0000000000..1c715b2536 --- /dev/null +++ b/.github/nightly-signing-policy.json @@ -0,0 +1,117 @@ +{ + "schema": "craft-nightly-release-policy/v3", + "repository": "storytold/wordcraft", + "repository_id": 1408489772, + "producer_workflow_id": 429734489, + "producer_workflow_path": ".github/workflows/nightly.yml", + "producer_tooling_revision": "main", + "producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@main", + "signer_workflow_path": ".github/workflows/nightly-sign.yml", + "signer_tooling_revision": "main", + "release_branch": "nightly-signer", + "manual_actors": [ + "bflatastic", + "dylanmtaylor", + "echelon", + "FredApps", + "skylartaylor" + ], + "max_age_seconds": 86400, + "candidate_policy": { + "schema": "craft-nightly-candidate-policy/v3", + "epoch": "wordcraft-nightly-20261124", + "repository": "storytold/wordcraft", + "branch": "main", + "required_workflows": [ + { + "workflow_id": 380135788, + "workflow_path": ".github/workflows/ci.yml", + "jobs": [ + { + "name": "gate / gate (ubuntu-24.04)", + "app_id": 15368, + "applicability": "required" + } + ] + } + ], + "sonar": { + "organization": "storytold", + "project": "storytold_wordcraft", + "app_id": 12526, + "check_name": "SonarCloud Code Analysis", + "details_url": "https://sonarcloud.io/dashboard?id=storytold_wordcraft&branch=main", + "issue_types": [ + "VULNERABILITY" + ], + "accepted_conditions": [ + { + "metric": "new_security_rating", + "comparator": "GT", + "error_threshold": "1", + "maximum": "5" + } + ], + "required_conditions": [ + { + "metric": "new_reliability_rating", + "comparator": "GT", + "error_threshold": "1" + }, + { + "metric": "new_maintainability_rating", + "comparator": "GT", + "error_threshold": "1" + }, + { + "metric": "new_coverage", + "comparator": "LT", + "error_threshold": "80" + }, + { + "metric": "new_duplicated_lines_density", + "comparator": "GT", + "error_threshold": "3" + }, + { + "metric": "new_security_hotspots_reviewed", + "comparator": "LT", + "error_threshold": "100" + } + ], + "debt": [] + } + }, + "max_artifact_bytes": 2147483648, + "automatic_signer_actors": [ + "github-actions[bot]" + ], + "platforms": { + "windows-x86_64": { + "unsigned_artifact_name": "nightly-unsigned-windows-x86_64", + "trust": { + "publisher_subject": "CN=Learning Machines Inc, O=Learning Machines Inc, L=Atlanta, S=Georgia, C=US" + } + }, + "linux-x86_64": { + "unsigned_artifact_name": "nightly-unsigned-linux-x86_64", + "trust": { + "fingerprint": "2B76741B414AAD6CD33E631213A005C0B9D7C3ED" + }, + "package_formats": [ + "appimage", + "arch", + "deb", + "flatpak", + "oci", + "rpm" + ] + }, + "macos-aarch64": { + "unsigned_artifact_name": "nightly-unsigned-macos-aarch64", + "trust": { + "apple_team_id": "DJ6XS33FX8" + } + } + } +} diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml new file mode 100644 index 0000000000..f438853e75 --- /dev/null +++ b/.github/workflows/nightly-build.yml @@ -0,0 +1,227 @@ +name: Nightly build check + +# Builds the unsigned WordCraft Nightly the way the producer does (packaging/linux/nightly.sh, +# packaging/windows/package.ps1 -Nightly, packaging/macos/nightly.sh) and checks each archive as the +# Launcher unpacks it. No secrets and no environment: the real Nightly is signed by the shared +# release-ref signer (craft-common-actions), which calls packaging/macos/nightly-sign.sh and the +# app's sign.ps1. +on: + # The platform runners are shared with release builds: pull requests run this only with the + # `full-ci` label, never by changed paths. `labeled` so adding it starts a run. + pull_request: + types: [opened, synchronize, reopened, labeled] + workflow_dispatch: + +permissions: + contents: read + +# A newer push to a labelled PR cancels its older run. Any event that will not build (no `full-ci` +# label, or another label added) gets a group of its own, so it never cancels a real build. +concurrency: + group: nightly-build-${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'full-ci') && (github.event.action != 'labeled' || github.event.label.name == 'full-ci') && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + linux: + name: Nightly tar (x86_64, unsigned) + if: >- + github.event_name == 'workflow_dispatch' || + (contains(github.event.pull_request.labels.*.name, 'full-ci') && + (github.event.action != 'labeled' || github.event.label.name == 'full-ci')) + runs-on: ubuntu-latest + timeout-minutes: 120 + env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + steps: + - name: Harden runner + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install the system libraries the GUI links + run: sudo apt-get update && sudo apt-get install -y pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev + - name: Check out craft-fonts + uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main + with: + ref: b076417b5880bd4154bd22f00695b1d28c6bea83 + - uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main + - uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0 + with: + toolchain: stable + - name: Prepare a Nightly identity for this commit + shell: bash + run: | + set -euo pipefail + base="$(python3 -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["workspace"]["package"]["version"].split("-")[0])')" + sha="$(git rev-parse HEAD)" + date="$(date -u +%Y-%m-%d)" + { + echo "WORDCRAFT_BUILD_SHA=$sha" + echo "WORDCRAFT_BUILD_DATE=$date" + echo "WORDCRAFT_VERSION=$base-nightly.${date//-/}.$GITHUB_RUN_NUMBER.$GITHUB_RUN_ATTEMPT.g${sha:0:12}" + echo "WORDCRAFT_BUILD_CHANNEL=nightly-v1" + echo "CARGO_TARGET_DIR=$RUNNER_TEMP/nightly-targets" + echo "DIST=$RUNNER_TEMP/nightly-dist" + echo "CRAFT_FONTS_DIR=$GITHUB_WORKSPACE/craft-fonts" + echo "CRAFT_FONTS_REQUIRED=1" + } >>"$GITHUB_ENV" + - name: Build the unsigned Nightly tar + run: bash packaging/linux/nightly.sh --arch x86_64 + - name: Check the tar as the Launcher unpacks it, and ask its version + shell: bash + run: | + set -euo pipefail + work="$RUNNER_TEMP/nightly-check" + mkdir -p "$work" + archive="$DIST/wordcraft-$WORDCRAFT_VERSION-linux-x86_64-nightly.tar.gz" + # The launcher and the GUI it starts, the icon and the notices; the embedded fonts' + # OFL-*.txt licences appear when the build has CRAFT_FONTS_DIR. + core="$(tar -tzf "$archive" | sort | grep -Ev '^OFL-[A-Za-z0-9_.-]+\.txt$' | tr '\n' ' ')" + [ "$core" = "ATTRIBUTION.md LICENSE-APACHE LICENSE-MIT NOTICE README.md wordcraft wordcraft-bin wordcraft-nightly.png " ] \ + || { echo "unexpected members: $core"; exit 1; } + tar -xzf "$archive" -C "$work" + [ -x "$work/wordcraft" ] && [ ! -L "$work/wordcraft" ] + [ "$(stat -c %a "$work/wordcraft")" = 755 ] + [ -x "$work/wordcraft-bin" ] && [ ! -L "$work/wordcraft-bin" ] + mkdir -p "$work/home" "$work/profile" + chmod 700 "$work/home" "$work/profile" + out="$(env -i HOME="$work/home" PATH=/usr/bin:/bin "$work/wordcraft" --version 2>"$work/stderr")" \ + || { cat "$work/stderr"; exit 1; } + [ ! -s "$work/stderr" ] + [ "$out" = "WordCraft $WORDCRAFT_VERSION (nightly-v1)" ] + out="$(env -i HOME="$work/home" PATH=/usr/bin:/bin "$work/wordcraft" --launch-profile nightly-v1 --profile-root "$work/profile" --version)" + [ "$out" = "WordCraft $WORDCRAFT_VERSION (nightly-v1)" ] + [ "$(head -c 2 "$work/wordcraft")" = '#!' ] + echo "==> verified (unsigned): $out" + - name: Keep the unsigned archive + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: wordcraft-nightly-linux-x86_64-unsigned + path: ${{ runner.temp }}/nightly-dist/wordcraft-${{ env.WORDCRAFT_VERSION }}-linux-x86_64-nightly.tar.gz + if-no-files-found: error + retention-days: 7 + compression-level: 0 + + windows: + name: Nightly ZIP (x86_64, unsigned) + if: >- + github.event_name == 'workflow_dispatch' || + (contains(github.event.pull_request.labels.*.name, 'full-ci') && + (github.event.action != 'labeled' || github.event.label.name == 'full-ci')) + runs-on: windows-latest + timeout-minutes: 150 + env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + defaults: + run: + shell: pwsh + steps: + - name: Harden runner + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Check out craft-fonts + uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main + with: + ref: b076417b5880bd4154bd22f00695b1d28c6bea83 + - uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main + - uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0 + with: + toolchain: stable + targets: x86_64-pc-windows-msvc + - name: Prepare a Nightly identity for this commit + shell: bash + run: | + set -euo pipefail + base="$(python3 -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["workspace"]["package"]["version"].split("-")[0])')" + sha="$(git rev-parse HEAD)" + date="$(date -u +%Y-%m-%d)" + { + echo "WORDCRAFT_BUILD_SHA=$sha" + echo "WORDCRAFT_BUILD_DATE=$date" + echo "WORDCRAFT_VERSION=$base-nightly.${date//-/}.$GITHUB_RUN_NUMBER.$GITHUB_RUN_ATTEMPT.g${sha:0:12}" + echo "WORDCRAFT_BUILD_CHANNEL=nightly-v1" + echo "CARGO_TARGET_DIR=$RUNNER_TEMP/nightly-targets" + echo "DIST=$RUNNER_TEMP/nightly-dist" + echo "CRAFT_FONTS_DIR=$GITHUB_WORKSPACE/craft-fonts" + echo "CRAFT_FONTS_REQUIRED=1" + } >>"$GITHUB_ENV" + - name: Build the unsigned Nightly intermediate + run: ./packaging/windows/package.ps1 -Arch x64 -Nightly -BuildOnly -Target x86_64-pc-windows-msvc -TargetDir $env:CARGO_TARGET_DIR -Dist $env:DIST + - name: Run the packaging contracts (no signing material) + run: ./packaging/windows/nightly-package-tests.ps1 -FixtureRoot $env:RUNNER_TEMP + - name: Run the signing contracts (dummy keys, no signing) + run: ./packaging/windows/nightly-signing-tests.ps1 -FixtureRoot $env:RUNNER_TEMP + - name: Keep the unsigned intermediate + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: wordcraft-nightly-windows-x86_64-unsigned + path: ${{ runner.temp }}/nightly-dist/wordcraft-${{ env.WORDCRAFT_VERSION }}-windows-x86_64-nightly.unsigned.zip + if-no-files-found: error + retention-days: 7 + compression-level: 0 + + macos: + name: Nightly .app (aarch64, unsigned) + if: >- + github.event_name == 'workflow_dispatch' || + (contains(github.event.pull_request.labels.*.name, 'full-ci') && + (github.event.action != 'labeled' || github.event.label.name == 'full-ci')) + runs-on: macos-15 + timeout-minutes: 120 + env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + steps: + - name: Harden runner + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Check out craft-fonts + uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main + with: + ref: b076417b5880bd4154bd22f00695b1d28c6bea83 + - uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main + - uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0 + with: + toolchain: stable + targets: aarch64-apple-darwin + - name: Prepare a Nightly identity for this commit + shell: bash + run: | + set -euo pipefail + base="$(python3 -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["workspace"]["package"]["version"].split("-")[0])')" + sha="$(git rev-parse HEAD)" + date="$(date -u +%Y-%m-%d)" + { + echo "WORDCRAFT_BUILD_SHA=$sha" + echo "WORDCRAFT_BUILD_DATE=$date" + echo "WORDCRAFT_VERSION=$base-nightly.${date//-/}.$GITHUB_RUN_NUMBER.$GITHUB_RUN_ATTEMPT.g${sha:0:12}" + echo "WORDCRAFT_BUILD_CHANNEL=nightly-v1" + echo "CARGO_TARGET_DIR=$RUNNER_TEMP/nightly-targets" + echo "DIST=$RUNNER_TEMP/nightly-dist" + echo "CRAFT_FONTS_DIR=$GITHUB_WORKSPACE/craft-fonts" + echo "CRAFT_FONTS_REQUIRED=1" + } >>"$GITHUB_ENV" + - name: Build the unsigned Nightly bundle + run: bash packaging/macos/nightly.sh --arch aarch64 + - name: Check the archive and the bundle version + run: bash packaging/macos/nightly-verify.sh --expect unsigned --input "$DIST/wordcraft-$WORDCRAFT_VERSION-macos-aarch64-nightly.zip" + - name: Keep the unsigned archive + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: wordcraft-nightly-macos-aarch64-unsigned + path: ${{ runner.temp }}/nightly-dist/wordcraft-${{ env.WORDCRAFT_VERSION }}-macos-aarch64-nightly.zip + if-no-files-found: error + retention-days: 7 + compression-level: 0 diff --git a/.github/workflows/nightly-dispatch.yml b/.github/workflows/nightly-dispatch.yml new file mode 100644 index 0000000000..b234b9d934 --- /dev/null +++ b/.github/workflows/nightly-dispatch.yml @@ -0,0 +1,72 @@ +name: Dispatch release-ref nightly + +# Transport only, never authorization. No checkout, payload parsing or release environment. +on: + workflow_run: + workflows: [WordCraft unsigned nightly] + types: [completed] + branches: [main] + +permissions: {} + +jobs: + dispatch: + # Automatic Stage 2 signer dispatch for completed scheduled nightly producer runs. + if: >- + github.repository == 'storytold/wordcraft' && + github.event_name == 'workflow_run' + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + actions: write + steps: + - name: Dispatch only the exact completed producer run and attempt + shell: python + env: + GH_TOKEN: ${{ github.token }} + run: | + import json + import os + import urllib.request + + def require(value, message): + if not value: + raise RuntimeError(message) + + # These filters reduce noise; the protected signer-branch validator repeats admission + # against authenticated API metadata and required attestation/quality evidence. + require(os.environ.get('GITHUB_REPOSITORY') == 'storytold/wordcraft', 'wrong repository') + require(os.environ.get('GITHUB_EVENT_NAME') == 'workflow_run', 'wrong event') + with open(os.environ['GITHUB_EVENT_PATH'], encoding='utf-8') as stream: + event = json.load(stream) + require(event.get('action') == 'completed', 'producer is not complete') + require(event.get('repository', {}).get('full_name') == 'storytold/wordcraft', 'wrong event repository') + producer = event.get('workflow_run', {}) + require(producer.get('head_repository', {}).get('full_name') == 'storytold/wordcraft', 'foreign producer') + require(producer.get('path') == '.github/workflows/nightly.yml', 'wrong producer path') + require(producer.get('head_branch') == 'main', 'wrong producer branch') + require(producer.get('status') == 'completed' and producer.get('conclusion') == 'success', 'producer did not succeed') + # First scheduled attempt only; reviewed manual/re-run authority belongs to release policy. + require(producer.get('event') == 'schedule', 'not an automatic scheduled producer') + run_id, attempt = producer.get('id'), producer.get('run_attempt') + require(type(run_id) is int and run_id > 0, 'invalid producer run id') + require(type(attempt) is int and attempt == 1, 'invalid automatic producer attempt') + body = json.dumps({'ref': 'refs/heads/nightly-signer', 'inputs': { + 'producer_run_id': str(run_id), 'producer_run_attempt': str(attempt) + }}).encode('utf-8') + request = urllib.request.Request( + 'https://api.github.com/repos/storytold/wordcraft/actions/workflows/nightly-sign.yml/dispatches', + data=body, method='POST', headers={ + 'Authorization': 'Bearer ' + os.environ['GH_TOKEN'], + 'Accept': 'application/vnd.github+json', + 'Content-Type': 'application/json', + 'X-GitHub-Api-Version': '2022-11-28', + 'User-Agent': 'wordcraft-nightly-dispatch' + }) + class NoRedirect(urllib.request.HTTPRedirectHandler): + def redirect_request(self, req, fp, code, msg, headers, newurl): + raise RuntimeError('dispatch redirects are forbidden') + # One bounded request, no retry: duplicate transport is not publication authority. + with urllib.request.build_opener(NoRedirect()).open(request, timeout=20) as response: + require(response.status == 204, 'dispatch was not accepted') + print('Dispatched producer run/attempt to the release-ref validator; not a signing result.') diff --git a/.github/workflows/nightly-sign.yml b/.github/workflows/nightly-sign.yml new file mode 100644 index 0000000000..d8f9258429 --- /dev/null +++ b/.github/workflows/nightly-sign.yml @@ -0,0 +1,59 @@ +name: WordCraft release-ref nightly signer + +# Enabled for supervised manual dispatch on the dedicated nightly-signer branch, which only ever +# fast-forwards to reviewed main commits (never the stable release branch). +# A reusable callee does not change context; this must be a real top-level signer-branch dispatch. +on: + workflow_dispatch: + inputs: + producer_run_id: + description: Exact untrusted producer Actions run ID + required: true + type: string + producer_run_attempt: + description: Exact untrusted producer Actions run attempt + required: true + type: string + +permissions: {} + +concurrency: + group: wordcraft-nightly-release + cancel-in-progress: false + +jobs: + release: + # Actual context guards: official repository, manual dispatch, real nightly-signer branch. + if: >- + github.repository == 'storytold/wordcraft' && + github.event_name == 'workflow_dispatch' && + github.ref == 'refs/heads/nightly-signer' && github.ref_type == 'branch' + permissions: + contents: write + actions: read + checks: read + attestations: write + id-token: write + uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@main + with: + tooling-revision: main + app-name: wordcraft + producer_run_id: ${{ inputs.producer_run_id }} + producer_run_attempt: ${{ inputs.producer_run_attempt }} + secrets: + APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} + AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} + AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} + AZURE_SIGNING_ENDPOINT: ${{ secrets.AZURE_SIGNING_ENDPOINT }} + AZURE_SIGNING_ACCOUNT: ${{ secrets.AZURE_SIGNING_ACCOUNT }} + AZURE_CERT_PROFILE: ${{ secrets.AZURE_CERT_PROFILE }} + LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }} + # No secrets: inherit or raw platform values in this caller. Only the isolated native + # callee job may bind the existing release environment (which trusts release and + # nightly-signer) and export keys in its signing step. diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000000..4800cc87d8 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,36 @@ +name: WordCraft unsigned nightly + +# Automated daily unsigned nightly build at 07:00 UTC plus supervised manual runs. +on: + schedule: + - cron: '0 7 * * *' + workflow_dispatch: + +permissions: + contents: read + +jobs: + unsigned: + # Actual context guards only; no inherited/platform secrets. + if: >- + github.repository == 'storytold/wordcraft' && + github.ref == 'refs/heads/main' && github.ref_type == 'branch' && + (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') + # Maximum for the reusable workflow. Its compiler narrows to contents/actions read; + # no OIDC, attestation write, release environment or platform secrets in compilation. + permissions: + contents: read + actions: read + attestations: write + id-token: write + uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@main + with: + tooling-revision: main + app-name: wordcraft + manual-actors: '["bflatastic","dylanmtaylor","echelon","FredApps","skylartaylor"]' + craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 + # One producer run builds every listed platform for one all-or-nothing release. The pin is the + # craft-common-actions main commit that merged the exact-analysis admission (#371, after #370, + # #369 and #364). + platforms: '["windows-x86_64","linux-x86_64","macos-aarch64"]' + linux-package-formats: '["deb","rpm","appimage","flatpak","oci","arch"]' diff --git a/.github/workflows/notify-services.yml b/.github/workflows/notify-services.yml new file mode 100644 index 0000000000..3dc8eaf4ac --- /dev/null +++ b/.github/workflows/notify-services.yml @@ -0,0 +1,20 @@ +name: Notify Services on Release Change + +on: + release: + types: + - published + - unpublished + - created + - edited + - deleted + - prereleased + - released + +permissions: {} + +jobs: + notify: + uses: storytold/craft-common-actions/.github/workflows/notify-services.yml@main + secrets: + ARTCRAFT_SERVICES_DISPATCH_TOKEN: ${{ secrets.ARTCRAFT_SERVICES_DISPATCH_TOKEN }} diff --git a/.github/workflows/packaging-lint.yml b/.github/workflows/packaging-lint.yml index 1771a35fea..a48faf6f9c 100644 --- a/.github/workflows/packaging-lint.yml +++ b/.github/workflows/packaging-lint.yml @@ -5,9 +5,9 @@ name: Packaging lint on: push: branches: [main, release] - paths: [".github/workflows/**", "packaging/**", "assets/app-icon/**"] + paths: [".github/workflows/**", "packaging/**", "assets/app-icon/**", ".github/nightly-signing-policy.json", ".github/nightly-linux-signing-key.asc", "sonar-project.properties"] pull_request: - paths: [".github/workflows/**", "packaging/**", "assets/app-icon/**"] + paths: [".github/workflows/**", "packaging/**", "assets/app-icon/**", ".github/nightly-signing-policy.json", ".github/nightly-linux-signing-key.asc", "sonar-project.properties"] workflow_dispatch: permissions: @@ -49,3 +49,26 @@ jobs: - name: Build and check non-executable installer fixtures shell: pwsh run: ./packaging/windows/test-install-policy.ps1 -OutputDirectory (Join-Path $env:RUNNER_TEMP 'craft-install-policy-tests') + + nightly-source-contract: + name: Nightly source contracts (no build or signing) + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Harden runner + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Enforce nightly serialization and synthetic packaging contracts + run: python3 packaging/nightly-tests.py + - name: Check the Arch Nightly handoff launcher (no build) + run: bash packaging/linux/nightly-arch-tar-test.sh + - name: Render and run the Nightly tar launcher (no build) + run: bash packaging/linux/nightly-package-test.sh + - name: Check the flat Nightly tar's shared template launcher (no build) + run: bash packaging/linux/nightly-tar-launch-test.sh diff --git a/.github/workflows/printing.yml b/.github/workflows/printing.yml index 865807c7e6..b5c494bac7 100644 --- a/.github/workflows/printing.yml +++ b/.github/workflows/printing.yml @@ -1,4 +1,4 @@ -# Exercise the native print host and all UI tests on PRs; the broad FreeBSD/ARM64 gates +# Exercise the native print host and all UI tests on Windows and macOS on PRs; the broad FreeBSD/ARM64 gates # stay on their existing nightly/release schedule. name: Printing @@ -30,31 +30,32 @@ concurrency: cancel-in-progress: true jobs: - # The print host and UI tests on Linux, Windows and macOS, through the suite's shared gate: it - # checks out craft-i18n (craft-i18n.rev) and craft-fonts, and installs the Ubuntu packages through - # install-apt-packages, which falls back to mirrors outside ubuntu.com (as on 11 Nov 2026). + # The print host and UI tests on Windows and macOS, through the suite's shared gate: it checks out + # craft-i18n (craft-i18n.rev) and craft-fonts. Linux is not repeated here: ci.yml's gate runs + # `cargo xtask ci` there, which already covers fmt, workspace clippy, every test and the wasm build. native: name: Print # Tracks @main so suite-wide CI fixes reach every app without a PR in each repository. uses: storytold/craft-common-actions/.github/workflows/gate.yml@main with: - os: '["ubuntu-24.04","windows-latest","macos-latest"]' + os: '["windows-latest","macos-latest"]' timeout-minutes: 90 # The catalogs include CJK interface languages, so the UI tests need the suite's fonts, as in # the gate (same commit as ci.yml and release.yml). craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 - packages: >- - pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev - libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev libvulkan1 mesa-vulkan-drivers # No nextest: the tests run with cargo test, as before. tools: "" # Its own cache, apart from ci.yml's gate, which builds the whole workspace. cache-version: v1-printing - command: | - cargo fmt --all -- --check + # Test binaries without debug info: they link faster and shrink to about a third, and panics + # keep their file:line. + dev-strip: true + # Clippy on its own leg beside the tests, off their critical path. fmt is platform-independent + # and runs in ci.yml. The web app's wasm build, once: ci.yml's `cargo xtask wasm` checks the + # library crates and ui-egui, not apps/wordcraft-web. + lint-command: | cargo clippy -p wordcraft -p wordcraft-ui-egui --all-targets --locked -- -D warnings - cargo test -p wordcraft -p wordcraft-ui-egui --locked - # Browser compatibility, once. - if [ "$RUNNER_OS" = Linux ]; then + if [ "$RUNNER_OS" = macOS ]; then cargo check -p wordcraft-web --target wasm32-unknown-unknown --locked fi + command: cargo test -p wordcraft -p wordcraft-ui-egui --locked diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ebfaae45c..0d0d22664b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,3 +60,4 @@ jobs: AZURE_SIGNING_ACCOUNT: ${{ secrets.AZURE_SIGNING_ACCOUNT }} AZURE_CERT_PROFILE: ${{ secrets.AZURE_CERT_PROFILE }} LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }} + ARTCRAFT_SERVICES_DISPATCH_TOKEN: ${{ secrets.ARTCRAFT_SERVICES_DISPATCH_TOKEN }} diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 983bdf8ad5..353f4d9d91 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -10,7 +10,7 @@ permissions: contents: read concurrency: - group: sonarcloud-${{ github.ref }} + group: ${{ github.ref == 'refs/heads/main' && format('sonarcloud-main-{0}', github.sha) || format('sonarcloud-{0}', github.ref) }} # A push to main is the run that publishes coverage; superseded runs there would never finish. cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} diff --git a/.gitignore b/.gitignore index ab3202793a..d719a143a6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,16 @@ plan/ /target /dist -/corpus +/corpus/* +!/corpus/docx/ +/corpus/docx/* +!/corpus/docx/README.md /log .DS_Store /.claude/ /target-*/ /craft-fonts/ +/.nightly-tools +/.nightly-input +/craft-i18n +__pycache__/ diff --git a/AGENTS.md b/AGENTS.md index 3ec9719e4c..fc547dbc33 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -74,5 +74,6 @@ WordCraft is a Rust word processor targeting Microsoft Word parity, for macOS, W - Attribution: `ATTRIBUTION.md`, a row per asset file, checked by `cargo xtask assets`. Icons are our own SVG set in `crates/ui-egui/icons/` (draw new icons there); sample content is in `crates/engine/src/sample.rs` and `cmd/design.rs`. - Fonts and language data come from other repositories as optional build inputs: craft-fonts through `CRAFT_FONTS_DIR`, and craft-i18n's `language-data/` through `CRAFT_I18N_DIR` (pinned by `craft-i18n.rev`; CI checks it out). Without craft-i18n the app builds with fallback spelling and no pattern hyphenation, so proofing tests need it. Proprietary font requests use installed fonts or the open substitutes in `crates/fonts/src/word.rs`. Layout tests use the fixed fonts in `assets/fonts/` ([docs/testing.md](docs/testing.md)). - Run: `cargo run --release -p wordcraft -- --sample --control 7981` starts the app with a sample document and the control channel. It takes JSON lines on `127.0.0.1:7981`: authenticate once per connection with the token from `~/.config/wordcraft/control-key.local-7981` (macOS: `~/Library/Application Support/WordCraft/`), `{"id":1,"method":"auth","params":{"token":"…"}}`, then send requests without a token; methods are in `crates/ui-egui/src/control.rs`, docs in `docs/control-protocol.md` (Token). Headless screenshots: `cargo run --release -p wordcraft-ui-egui --example ui_shot -- script.jsonl`. CLI: `wordcraft-cli convert|run|commands|parity`. MCP: `wordcraft-cli mcp --automation-read-root DIR --automation-write-root DIR` (both required; `--connect` is refused until the app confines its control channel, #3695), see `docs/mcp.md`. +- Headless column ([RFC-0052](https://github.com/storytold/craft-contrib/blob/main/rfcs/0052-headless-reach.md)): `cargo xtask parity` marks a catalog feature `headless: yes` only when its command is in the engine registry that `wordcraft-cli` and the MCP server load (never a `ui.*` id). A missing feature takes its `no`/`partial` value and `reach:` (`window`, `os` or `engine-gap`) from `HEADLESS` in `crates/engine/src/catalog.rs`, or reads `unknown`. When a command lands, delete its mark; `headless_marks_are_current` fails on a stale one. - Notes and progress: `plan/` is an optional gitignored notebook. Committed: `ROADMAP.md` (progress log), `docs/gaps.md`, `docs/roadmap.md`, `docs/target-app-parity.md`, `docs/architecture.md` and the parity checklists. - Contributor credits: `docs/contributors.md`. diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 02d8f8646a..0602c7733e 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -26,6 +26,12 @@ The UI icons are SVG files in `crates/ui-egui/icons/`, one row each below. Gener | `assets/app-icon/hicolor/scalable/apps/ai.storyteller.wordcraft.svg` | WordCraft contributors | original artwork drawn in SVG (`assets/app-icon/wordcraft.svg`), rendered by `packaging/icons.sh` | MIT OR Apache-2.0 | Placeholder app icon until the WordCraft mascot drawing lands | | `assets/app-icon/hicolor/48x48/apps/ai.storyteller.wordcraft.png` | WordCraft contributors | original artwork drawn in SVG (`assets/app-icon/wordcraft.svg`), rendered by `packaging/icons.sh` | MIT OR Apache-2.0 | Placeholder app icon until the WordCraft mascot drawing lands | | `assets/app-icon/hicolor/512x512/apps/ai.storyteller.wordcraft.png` | WordCraft contributors | original artwork drawn in SVG (`assets/app-icon/wordcraft.svg`), rendered by `packaging/icons.sh` | MIT OR Apache-2.0 | Placeholder app icon until the WordCraft mascot drawing lands | +| `assets/app-icon/wordcraft-nightly.png` | WordCraft contributors | derived from `assets/app-icon/hicolor/256x256/apps/ai.storyteller.wordcraft.png` by `packaging/nightly-icons.py` (nightly field `#232c67`); input hashes and the recipe are in `assets/app-icon/nightly-provenance.json` | MIT OR Apache-2.0 | Nightly 256 px render; the icon the Linux Nightly tar ships | +| `assets/app-icon/wordcraft-nightly-1024.png` | WordCraft contributors | derived from `assets/app-icon/wordcraft-1024.png` by `packaging/nightly-icons.py` | MIT OR Apache-2.0 | 1024 px master the Nightly `.icns` is generated from | +| `assets/app-icon/wordcraft-nightly.ico` | WordCraft contributors | derived from `assets/app-icon/wordcraft.ico` by `packaging/nightly-icons.py` | MIT OR Apache-2.0 | Windows Nightly icon (16-256 px), embedded by `apps/wordcraft/build.rs` into the Nightly executable only | +| `assets/app-icon/wordcraft-nightly.icns` | WordCraft contributors | derived from `assets/app-icon/wordcraft.icns` by `packaging/nightly-icons.py` | MIT OR Apache-2.0 | macOS Nightly bundle icon (`CFBundleIconFile wordcraft-nightly`) | +| `assets/app-icon/nightly-provenance.json` | WordCraft contributors | original work for this repository | MIT OR Apache-2.0 | The exact inputs, palette and transform that produced the Nightly icon set | +| `assets/app-icon/README.md` | WordCraft contributors | original description of this repository's own icon artwork | MIT OR Apache-2.0 | Names the master, the sizes and the regeneration steps | | `assets/fonts/Inter-Medium.ttf` | Rasmus Andersson / The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | Open-source typeface (Latin UI/document font, carried over from DesignCraft) | | `assets/fonts/Inter-Regular.ttf` | Rasmus Andersson / The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | Open-source typeface (Latin UI/document font, carried over from DesignCraft) | | `assets/fonts/Inter-SemiBold.ttf` | Rasmus Andersson / The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | Open-source typeface (Latin UI/document font, carried over from DesignCraft) | @@ -135,6 +141,7 @@ The UI icons are SVG files in `crates/ui-egui/icons/`, one row each below. Gener | `crates/ui-egui/icons/designMode.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/dictate.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/discord.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | +| `crates/ui-egui/icons/discordPill.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/distributeCols.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/distributeRows.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/docPrefs.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | @@ -195,7 +202,7 @@ The UI icons are SVG files in `crates/ui-egui/icons/`, one row each below. Gener | `crates/ui-egui/icons/insertLeft.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/insertRight.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/interfaceTheme.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | -| `crates/ui-egui/icons/italic.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | +| `crates/ui-egui/icons/italic.svg` | WordCraft contributors | original: redrawn for #7694 | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/justify.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/labels.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/language.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | @@ -251,6 +258,7 @@ The UI icons are SVG files in `crates/ui-egui/icons/`, one row each below. Gener | `crates/ui-egui/icons/pageNumber.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/pageWidth.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/painter.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | +| `crates/ui-egui/icons/painter-fill.svg` | WordCraft contributors | original: the Format Painter's yellow bar, split out as the fill drawn under `painter.svg` | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/paraSpacing.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/pastCitation.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/paste.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | @@ -332,6 +340,7 @@ The UI icons are SVG files in `crates/ui-egui/icons/`, one row each below. Gener | `crates/ui-egui/icons/size.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/smartArt.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/smartArtColors.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | +| `crates/ui-egui/icons/smartArtLayouts.svg` | WordCraft contributors | original: drawn for WordCraft in the style of the code-drawn icon set (#7149) | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/sort.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/sources.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/spaceAfter.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | @@ -351,6 +360,8 @@ The UI icons are SVG files in `crates/ui-egui/icons/`, one row each below. Gener | `crates/ui-egui/icons/table.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/tableOfAuthorities.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/tableOfFigures.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | +| `crates/ui-egui/icons/tableStyleOptions.svg` | WordCraft contributors | original: drawn for WordCraft in the style of the code-drawn icon set (#7149) | MIT OR Apache-2.0 | UI icon | +| `crates/ui-egui/icons/tableStyles.svg` | WordCraft contributors | original: drawn for WordCraft in the style of the code-drawn icon set (#7149) | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/textBox.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/textBoxLink.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/textBoxUnlink.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | @@ -368,7 +379,7 @@ The UI icons are SVG files in `crates/ui-egui/icons/`, one row each below. Gener | `crates/ui-egui/icons/trackChanges.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/transform.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/translate.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | -| `crates/ui-egui/icons/underline.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | +| `crates/ui-egui/icons/underline.svg` | WordCraft contributors | original: redrawn for #7694 | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/undo.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/unlinkCitations.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | | `crates/ui-egui/icons/update.svg` | WordCraft contributors | original: exported from WordCraft's own code-drawn icons (`crates/ui-egui/src/icons.rs` before the craft port), text glyphs redrawn as paths | MIT OR Apache-2.0 | UI icon | @@ -388,3 +399,35 @@ The UI icons are SVG files in `crates/ui-egui/icons/`, one row each below. Gener | craft-fonts (optional build input, not files in this repo): BIZ UDPGothic, BIZ UDMincho, Shippori Mincho, Noto Sans CJK SC, Noto Sans Arabic | see https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md | embedded only when built with `CRAFT_FONTS_DIR` (all official releases) | OFL-1.1 | Japanese and Chinese UI, Japanese document fallback | | craft-i18n (optional build input, not files in this repo): the interface translations | see https://github.com/storytold/craft-i18n/blob/main/ATTRIBUTION.md, which credits every translator of WordCraft's former in-repo catalogs (`crates/ui-egui/src/i18n/*.tsv`, migrated at `wordcraft@806a945`) | embedded only when built with `CRAFT_I18N_DIR`, at the commit in `craft-i18n.rev` (all official releases) | MIT OR Apache-2.0 | Interface languages other than English; clean-room translations from the English interface labels | | craft-i18n Language data (optional build input, not files in this repo): the spelling word lists and hyphenation patterns (`language-data/`: the Moby Hyphenator II list and our patterns for English, `en-extra.txt`, `en-variants.txt`, `ru-extra.txt`, and the hyph-utf8 German, Polish, Portuguese and Italian patterns) | see the Language data section of https://github.com/storytold/craft-i18n/blob/main/ATTRIBUTION.md (authors, upstream sources with SHA-256, licences); moved there from `assets/hyphenation/` and `assets/spelling/` byte for byte | embedded by craft-proof (storytold/craft-libs) only when built with `CRAFT_I18N_DIR`, at the commit in `craft-i18n.rev` (all official releases) | Public Domain / CC0-1.0, MIT, BSD-3-Clause, MIT OR Apache-2.0 (per file; see NOTICE) | Spelling and hyphenation; without it English spelling falls back to an installed Hunspell English or craft-proof's built-in Moby list, and pattern hyphenation is off | +| `crates/validate/corpus/calibration/00-control.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: valid control | +| `crates/validate/corpus/calibration/01-not-zip.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; contains no picture; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: PKG-NOT-ZIP defect fixture | +| `crates/validate/corpus/calibration/02-dup-entry.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: PKG-DUP-ENTRY defect fixture | +| `crates/validate/corpus/calibration/03-case-collision.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: PKG-CASE-COLLISION defect fixture | +| `crates/validate/corpus/calibration/04-no-content-types.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: PKG-NO-CONTENT-TYPES defect fixture | +| `crates/validate/corpus/calibration/05-no-main.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: PKG-NO-MAIN defect fixture | +| `crates/validate/corpus/calibration/06-ct-undeclared.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: CT-UNDECLARED defect fixture | +| `crates/validate/corpus/calibration/07-ct-main-type.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: CT-MAIN-TYPE defect fixture | +| `crates/validate/corpus/calibration/08-xml-malformed-main.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: XML-MALFORMED (main part) defect fixture | +| `crates/validate/corpus/calibration/09-xml-malformed-unused.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: XML-MALFORMED (unreferenced part) defect fixture | +| `crates/validate/corpus/calibration/10-xml-undeclared-prefix.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: XML-UNDECLARED-PREFIX defect fixture | +| `crates/validate/corpus/calibration/11-rel-dup-id.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: REL-DUP-ID defect fixture | +| `crates/validate/corpus/calibration/12-rel-dangling.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: REL-DANGLING defect fixture | +| `crates/validate/corpus/calibration/13-rel-typed.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: REL-TYPED defect fixture | +| `crates/validate/corpus/calibration/14-comment-dup.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: ID-COMMENT-DUP defect fixture | +| `crates/validate/corpus/calibration/15-comment-ref.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: REF-COMMENT defect fixture | +| `crates/validate/corpus/calibration/16-docpr-dup.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: ID-DOCPR-DUP defect fixture | +| `crates/validate/corpus/calibration/17-bookmark-dup.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: ID-BOOKMARK-DUP defect fixture | +| `crates/validate/corpus/calibration/18-revision-dup.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: ID-REVISION-DUP defect fixture | +| `crates/validate/corpus/calibration/19-note-ref.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: REF-NOTE defect fixture | +| `crates/validate/corpus/calibration/20-header-ref.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: REF-HEADER defect fixture | +| `crates/validate/corpus/calibration/21-style-ref.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: REF-STYLE defect fixture | +| `crates/validate/corpus/calibration/22-fld-unbalanced.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: FLD-UNBALANCED defect fixture | +| `crates/validate/corpus/calibration/23-tc-no-p.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: STRUCT-TC-NO-P defect fixture | +| `crates/validate/corpus/calibration/24-deltext.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: STRUCT-DELTEXT defect fixture | +| `crates/validate/corpus/calibration/25-move-unpaired.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is the fixed 1×1 PNG constant defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: STRUCT-MOVE-UNPAIRED defect fixture | +| `crates/validate/corpus/calibration/26-media-magic.docx` | WordCraft contributors | generated by `crates/validate/corpus/make_calibration.py` (original synthetic document; embedded picture is a fixed JPEG-header stub defined in the script; no third-party content) | MIT OR Apache-2.0, like the code | wordcraft-validate calibration corpus: MEDIA-MAGIC defect fixture | +| `crates/validate/model/content_model_v2.json` | WordCraft contributors | generated by `crates/validate/model/extract_content_model.py` from the ECMA-376 Part 1 (5th ed.) Strict schemas (public specification; archive URL and SHA-256 in `crates/validate/model/README.md`); the schemas themselves are not copied | MIT OR Apache-2.0, like the code (element/type content models extracted from a public specification) | wordcraft-validate grammar tables: WML, Strict | +| `crates/validate/model/content_model_v2_transitional.json` | WordCraft contributors | generated by `crates/validate/model/extract_content_model.py` from the ECMA-376 Part 4 (5th ed.) Transitional schemas (public specification; archive URL and SHA-256 in `crates/validate/model/README.md`); the schemas themselves are not copied | MIT OR Apache-2.0, like the code (element/type content models extracted from a public specification) | wordcraft-validate grammar tables: WML, Transitional | +| `crates/validate/model/content_model_dml_v2.json` | WordCraft contributors | generated by `crates/validate/model/extract_content_model.py --profile dml` from the ECMA-376 Part 1 (5th ed.) Strict schemas (public specification; archive URL and SHA-256 in `crates/validate/model/README.md`); the schemas themselves are not copied | MIT OR Apache-2.0, like the code (element/type content models extracted from a public specification) | wordcraft-validate grammar tables: DrawingML, Strict | +| `crates/validate/model/content_model_dml_v2_transitional.json` | WordCraft contributors | generated by `crates/validate/model/extract_content_model.py --profile dml` from the ECMA-376 Part 4 (5th ed.) Transitional schemas (public specification; archive URL and SHA-256 in `crates/validate/model/README.md`); the schemas themselves are not copied | MIT OR Apache-2.0, like the code (element/type content models extracted from a public specification) | wordcraft-validate grammar tables: DrawingML, Transitional | +| `crates/validate/src/model.rs` | WordCraft contributors | generated by `crates/validate/model/generate_model.py` from the four `crates/validate/model/content_model_*.json` tables above and the `ST_NumberFormat` enumeration of the ECMA-376 Part 1 Strict `wml.xsd` | MIT OR Apache-2.0, like the code (data extracted from a public specification) | wordcraft-validate grammar tables compiled into the crate | diff --git a/Cargo.lock b/Cargo.lock index a0fdc00db2..ef2bbae6e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -235,62 +235,27 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "anstream" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - [[package]] name = "anstyle" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" -[[package]] -name = "anstyle-parse" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" -dependencies = [ - "anstyle", - "once_cell_polyfill", - "windows-sys 0.61.2", -] - [[package]] name = "anyhow" version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" +[[package]] +name = "arbitrary" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "arboard" version = "3.7.0" @@ -393,7 +358,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix 1.1.5", + "rustix 1.1.6", "slab", "windows-sys 0.61.2", ] @@ -424,7 +389,7 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix 1.1.5", + "rustix 1.1.6", ] [[package]] @@ -450,7 +415,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 1.1.5", + "rustix 1.1.6", "signal-hook-registry", "slab", "windows-sys 0.61.2", @@ -635,12 +600,6 @@ version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - [[package]] name = "block-buffer" version = "0.10.4" @@ -826,7 +785,7 @@ checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" dependencies = [ "bitflags 2.13.2", "polling", - "rustix 1.1.5", + "rustix 1.1.6", "tracing", ] @@ -849,7 +808,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" dependencies = [ "calloop 0.14.5", - "rustix 1.1.5", + "rustix 1.1.6", "wayland-backend", "wayland-client", ] @@ -866,7 +825,7 @@ dependencies = [ "io-lifetimes 3.0.1", "ipnet", "maybe-owned", - "rustix 1.1.5", + "rustix 1.1.6", "rustix-linux-procfs", "windows-sys 0.61.2", "winx", @@ -992,46 +951,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "clap" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "clap_lex" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79" - [[package]] name = "clipboard-win" version = "5.4.3" @@ -1115,12 +1034,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" -[[package]] -name = "colorchoice" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" - [[package]] name = "colored" version = "2.2.0" @@ -1218,19 +1131,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core-graphics2" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b65858d95344d2711161cd92196732f67d6c5fea238cf12f994584828731a5c" -dependencies = [ - "bitflags 2.13.2", - "block", - "cfg-if", - "core-foundation 0.10.1", - "libc", -] - [[package]] name = "core_detect" version = "1.0.0" @@ -1273,7 +1173,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-automation", "craft-behavior", @@ -1311,22 +1211,35 @@ dependencies = [ "toml", ] +[[package]] +name = "craft-appkit" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" +dependencies = [ + "block2 0.6.2", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-graphics", + "objc2-foundation 0.3.2", +] + [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ - "rustix 1.1.5", + "rustix 1.1.6", ] [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "craft-behavior", "craft-control", + "craft-host", "craft-keymap", "craft-platform", "craft-theme", @@ -1346,13 +1259,15 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "accesskit", "bitflags 2.13.2", "craft-host", "craft-keymap", "craft-theme", + "craft-tracked", + "craft-ui-macros", "emath", "kurbo", "serde", @@ -1362,7 +1277,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-docpath", @@ -1380,12 +1295,12 @@ dependencies = [ [[package]] name = "craft-cfb" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "egui", ] @@ -1393,7 +1308,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "md-5", "rayon", @@ -1402,12 +1317,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" [[package]] name = "craft-color" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "serde", ] @@ -1415,7 +1330,7 @@ dependencies = [ [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-cms", @@ -1435,17 +1350,28 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ - "getrandom 0.3.4", + "craft-control-protocol", + "craft-platform", "serde", "serde_json", ] +[[package]] +name = "craft-control-protocol" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" +dependencies = [ + "getrandom 0.3.4", + "serde_json", + "subtle", +] + [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "rayon", ] @@ -1453,9 +1379,10 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "block2 0.6.2", + "craft-appkit", "craft-atomic", "craft-behavior", "craft-browse", @@ -1478,24 +1405,24 @@ dependencies = [ [[package]] name = "craft-doc-binary" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "chrono", "craft-cfb", "craft-codepage", + "craft-offcrypto", "craft-wordmodel", "image", "log", "md4", "miniz_oxide 0.9.1", - "sha1 0.11.0", "thiserror 2.0.21", ] [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "serde", ] @@ -1503,7 +1430,7 @@ dependencies = [ [[package]] name = "craft-docx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "base64 0.23.1", "chrono", @@ -1523,7 +1450,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1542,8 +1469,9 @@ dependencies = [ [[package]] name = "craft-drawingml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ + "chrono", "craft-xml", "kurbo", "log", @@ -1553,7 +1481,7 @@ dependencies = [ [[package]] name = "craft-flow" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-wordmodel", "image", @@ -1563,7 +1491,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1578,11 +1506,12 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-font-catalog", "craft-font-store", + "craft-fonts-build", "craft-host", "craft-i18n", "craft-theme", @@ -1590,17 +1519,27 @@ dependencies = [ "egui", "log", "serde", - "skrifa 0.44.0", + "skrifa 0.47.0", +] + +[[package]] +name = "craft-font-os-windows" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" +dependencies = [ + "windows-registry", + "windows-sys 0.61.2", ] [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "cap-primitives", "craft-atomic", "craft-font-catalog", + "craft-font-os-windows", "flate2", "log", "ruzstd", @@ -1612,12 +1551,13 @@ dependencies = [ "thiserror 2.0.21", "toml", "ureq", + "wuff", ] [[package]] name = "craft-font-subset" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "brotli 9.1.3", "harfbuzz-subset-sys", @@ -1630,7 +1570,7 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-font-subset", ] @@ -1638,7 +1578,7 @@ dependencies = [ [[package]] name = "craft-gpu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "egui-wgpu", "log", @@ -1650,7 +1590,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1663,7 +1603,7 @@ dependencies = [ [[package]] name = "craft-html" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-codepage", "craft-flow", @@ -1676,8 +1616,10 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ + "brotli 9.1.3", + "brotli-decompressor 6.3.1", "chrono", "fixed_decimal", "icu_calendar", @@ -1704,7 +1646,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-dds", "craft-jpeg", @@ -1731,7 +1673,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1749,7 +1691,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "thiserror 2.0.21", ] @@ -1757,10 +1699,12 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-host", "craft-i18n", + "craft-tracked", + "craft-ui-macros", "craft-xml", "egui", "serde", @@ -1770,7 +1714,7 @@ dependencies = [ [[package]] name = "craft-latex" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-flow", "craft-math", @@ -1781,7 +1725,7 @@ dependencies = [ [[package]] name = "craft-markdown" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-flow", "craft-html", @@ -1791,16 +1735,17 @@ dependencies = [ [[package]] name = "craft-math" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-xml", + "roxmltree", "serde", ] [[package]] name = "craft-mcp-server" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "serde_json", ] @@ -1808,7 +1753,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-host", @@ -1826,7 +1771,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "brotli-decompressor 6.3.1", "chrono", @@ -1838,7 +1783,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "encoding_rs", "image", @@ -1849,7 +1794,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "chardetng", "chrono", @@ -1857,10 +1802,19 @@ dependencies = [ "encoding_rs", ] +[[package]] +name = "craft-nightly" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" +dependencies = [ + "uds_windows", + "winsafe", +] + [[package]] name = "craft-odf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "aes", "base64 0.23.1", @@ -1886,7 +1840,7 @@ dependencies = [ [[package]] name = "craft-ods" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-odf", "craft-sheet", @@ -1897,7 +1851,7 @@ dependencies = [ [[package]] name = "craft-offcrypto" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "aes", "base64 0.23.1", @@ -1914,7 +1868,7 @@ dependencies = [ [[package]] name = "craft-opc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-xml", "craft-zip", @@ -1925,7 +1879,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-keymap", @@ -1935,12 +1889,13 @@ dependencies = [ "egui", "kurbo", "serde", + "serde_json", ] [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "krilla", "serde", @@ -1950,23 +1905,26 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "arboard", "async-channel", "async-io", "async-process", "clipboard-win", - "core-graphics2", + "craft-appkit", "craft-atomic", "craft-docpath", "craft-host", + "craft-i18n", "craft-theme", "fmv-macos-events", "futures-lite", "js-sys", "log", "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", "objc2-foundation 0.3.2", "rfd", "serde", @@ -1985,10 +1943,11 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-host", + "craft-theme", "craft-ui", "craft-winprint-gdi", "egui", @@ -2008,7 +1967,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -2019,19 +1978,22 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "dispatch2", "egui", "objc2 0.6.5", "objc2-app-kit 0.3.2", + "wasm-bindgen", + "web-sys", ] [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ + "base64 0.23.1", "craft-behavior", "craft-host", "craft-i18n", @@ -2048,7 +2010,7 @@ dependencies = [ [[package]] name = "craft-rtf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-codepage", "craft-flow", @@ -2061,7 +2023,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-atomic", "craft-host", @@ -2078,17 +2040,17 @@ dependencies = [ [[package]] name = "craft-sheet" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" [[package]] name = "craft-ssip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-xml", "flate2", @@ -2105,7 +2067,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-keymap", @@ -2117,7 +2079,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-host", @@ -2141,9 +2103,11 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "bitflags 2.13.2", + "craft-tracked", + "craft-ui-macros", "ecolor", "log", "serde", @@ -2154,7 +2118,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-atomic", "craft-behavior", @@ -2169,16 +2133,17 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "serde", "thiserror 2.0.21", + "tiff", ] [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "serde", "thiserror 2.0.21", @@ -2187,7 +2152,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-keymap", @@ -2202,12 +2167,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2221,9 +2186,10 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", + "craft-font-catalog", "craft-i18n", "craft-keymap", "craft-theme", @@ -2237,7 +2203,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "accesskit", "craft-behavior", @@ -2256,12 +2222,9 @@ dependencies = [ "craft-ui-macros", "craft-window", "egui", - "egui_kittest", "epaint_default_fonts", "flate2", - "image", "inventory", - "libtest-mimic", "log", "scoped-tls", "serde", @@ -2270,13 +2233,15 @@ dependencies = [ "skrifa 0.44.0", "smallvec", "toml", + "typeid", + "wasm-bindgen-futures", "web-time", ] [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2287,7 +2252,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-host", @@ -2305,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-host", @@ -2326,7 +2291,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-host", @@ -2339,6 +2304,7 @@ dependencies = [ "craft-window", "eframe", "egui", + "raw-window-handle", "serde", "web-time", ] @@ -2346,7 +2312,7 @@ dependencies = [ [[package]] name = "craft-ui-test-kit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-host", @@ -2357,16 +2323,18 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-behavior", "craft-host", "craft-i18n", "craft-keymap", + "craft-svg", "craft-theme", "craft-ui-contract", "craft-ui-macros", "egui", + "log", "serde", "smallvec", ] @@ -2374,36 +2342,39 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ + "base64 0.22.1", "chrono", "craft-host", "craft-theme", "craft-ui", "dunce", + "ed25519-dalek", "egui", "flate2", "image", "log", "plist", - "rustix 1.1.5", + "rustix 1.1.6", "semver", "serde", "serde_json", "sha2 0.10.9", "tar", "tempfile", + "toml", "ureq", "verifysign", "winreg", "winsafe", - "zip", + "zip 9.1.0", ] [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "js-sys", "serde_json", @@ -2414,16 +2385,19 @@ dependencies = [ [[package]] name = "craft-web-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ + "craft-host", + "craft-platform", "wasm-bindgen", + "wasm-bindgen-futures", "web-sys", ] [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "winsafe", ] @@ -2431,8 +2405,9 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ + "craft-appkit", "craft-atomic", "craft-behavior", "craft-host", @@ -2448,6 +2423,7 @@ dependencies = [ "serde_json", "wayland-client", "winsafe", + "x11rb", ] [[package]] @@ -2461,7 +2437,7 @@ dependencies = [ [[package]] name = "craft-wordmodel" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "base64 0.23.1", "craft-math", @@ -2475,7 +2451,7 @@ dependencies = [ [[package]] name = "craft-xls" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-cfb", "craft-sheet", @@ -2488,7 +2464,7 @@ dependencies = [ [[package]] name = "craft-xlsx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "craft-drawingml", "craft-opc", @@ -2500,7 +2476,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "quick-xml 0.41.0", "serde", @@ -2510,11 +2486,11 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "flate2", "thiserror 2.0.21", - "zip", + "zip 9.1.0", ] [[package]] @@ -2612,6 +2588,33 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "data-url" version = "0.3.2" @@ -2648,6 +2651,17 @@ version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" +[[package]] +name = "derive_arbitrary" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b034bd7d5f032402a2479444dcc6f74e36a03f31854d41680fb240ef682a1ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + [[package]] name = "dify" version = "0.8.0" @@ -2790,7 +2804,7 @@ dependencies = [ "drm-ffi", "drm-fourcc", "libc", - "rustix 1.1.5", + "rustix 1.1.6", ] [[package]] @@ -2800,7 +2814,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51a91c9b32ac4e8105dec255e849e0d66e27d7c34d184364fb93e469db08f690" dependencies = [ "drm-sys", - "rustix 1.1.5", + "rustix 1.1.6", ] [[package]] @@ -2828,16 +2842,40 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "ecolor" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" dependencies = [ "bytemuck", "emath", ] +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2 0.10.9", + "subtle", + "zeroize", +] + [[package]] name = "eframe" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" dependencies = [ "ahash", "bytemuck", @@ -2872,7 +2910,7 @@ dependencies = [ [[package]] name = "egui" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" dependencies = [ "accesskit", "ahash", @@ -2891,7 +2929,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" dependencies = [ "ahash", "bytemuck", @@ -2910,7 +2948,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" dependencies = [ "accesskit_winit", "arboard", @@ -2936,7 +2974,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" dependencies = [ "ahash", "egui", @@ -2949,7 +2987,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" dependencies = [ "bytemuck", "egui", @@ -2962,7 +3000,7 @@ dependencies = [ [[package]] name = "egui_kittest" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" dependencies = [ "dify", "eframe", @@ -2988,7 +3026,7 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "emath" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" dependencies = [ "bytemuck", ] @@ -3069,7 +3107,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" dependencies = [ "ahash", "bytemuck", @@ -3095,7 +3133,11 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" +dependencies = [ + "brotli 9.1.3", + "brotli-decompressor 6.3.1", +] [[package]] name = "equivalent" @@ -3119,12 +3161,6 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" -[[package]] -name = "escape8259" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f1f0d310082fd5de539d4f41601182241147498444a7695c520288a0cdbead6" - [[package]] name = "euclid" version = "0.22.14" @@ -3197,6 +3233,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "filetime" version = "0.2.29" @@ -3390,7 +3432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" dependencies = [ "io-lifetimes 2.0.4", - "rustix 1.1.5", + "rustix 1.1.6", "windows-sys 0.59.0", ] @@ -3514,7 +3556,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" dependencies = [ - "rustix 1.1.5", + "rustix 1.1.6", "windows-link", ] @@ -3824,7 +3866,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3833,7 +3875,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3851,7 +3893,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3869,12 +3911,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "flate2", "hayro-ccitt", @@ -4454,12 +4496,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "is_terminal_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" - [[package]] name = "itertools" version = "0.13.0" @@ -4554,9 +4590,9 @@ dependencies = [ [[package]] name = "jpeg-encoder" -version = "0.6.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b454d911ac55068f53495488d8ccd0646eaa540c033a28ee15b07838afafb01f" +checksum = "a0370574b86f7eca156b9f298392b5e69a23f8c86f3f865add60bbc2e79467a6" [[package]] name = "js-sys" @@ -4609,7 +4645,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4626,7 +4662,7 @@ dependencies = [ "skrifa 0.42.1", "smallvec", "subsetter", - "tiny-skia-path", + "tiny-skia-path 0.12.0", "xmp-writer", "yoke", "zune-jpeg", @@ -4703,7 +4739,7 @@ dependencies = [ "libc", "libspa-sys", "nom 8.0.0", - "rustix 1.1.5", + "rustix 1.1.6", "system-deps", ] @@ -4718,18 +4754,6 @@ dependencies = [ "system-deps", ] -[[package]] -name = "libtest-mimic" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ba06f0ade6e504aff834d7c34298e5155c6baca353cc6a4aaff2f9fd7f33" -dependencies = [ - "anstream", - "anstyle", - "clap", - "escape8259", -] - [[package]] name = "libwayshot-xcap" version = "0.3.3" @@ -4742,7 +4766,7 @@ dependencies = [ "image", "khronos-egl", "memmap2", - "rustix 1.1.5", + "rustix 1.1.6", "thiserror 2.0.21", "tracing", "wayland-backend", @@ -4760,7 +4784,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" dependencies = [ "arrayvec", "kurbo", @@ -5596,12 +5620,6 @@ version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" -[[package]] -name = "once_cell_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" - [[package]] name = "open" version = "5.4.5" @@ -5907,7 +5925,7 @@ dependencies = [ "libspa", "libspa-sys", "pipewire-sys", - "rustix 1.1.5", + "rustix 1.1.6", ] [[package]] @@ -5921,6 +5939,16 @@ dependencies = [ "system-deps", ] +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.34" @@ -5982,7 +6010,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix 1.1.5", + "rustix 1.1.6", "windows-sys 0.61.2", ] @@ -6264,6 +6292,9 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] [[package]] name = "rand_core" @@ -6516,7 +6547,7 @@ dependencies = [ "pico-args", "rgb", "svgtypes", - "tiny-skia", + "tiny-skia 0.12.0", "usvg", ] @@ -6540,6 +6571,9 @@ dependencies = [ "raw-window-handle", "wasm-bindgen", "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", "web-sys", "windows-sys 0.61.2", ] @@ -6612,9 +6646,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags 2.13.2", "errno", @@ -6630,7 +6664,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056" dependencies = [ "once_cell", - "rustix 1.1.5", + "rustix 1.1.6", ] [[package]] @@ -6776,6 +6810,17 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sctk-adwaita" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +dependencies = [ + "log", + "smithay-client-toolkit 0.19.2", + "tiny-skia 0.11.4", +] + [[package]] name = "security-framework" version = "3.7.0" @@ -6888,9 +6933,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.1.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782" dependencies = [ "serde_core", ] @@ -7284,7 +7329,7 @@ dependencies = [ "libc", "log", "memmap2", - "rustix 1.1.5", + "rustix 1.1.6", "thiserror 2.0.21", "wayland-backend", "wayland-client", @@ -7379,12 +7424,6 @@ dependencies = [ "unicode-properties", ] -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - [[package]] name = "strum" version = "0.28.0" @@ -7564,7 +7603,7 @@ dependencies = [ "fastrand", "getrandom 0.4.3", "once_cell", - "rustix 1.1.5", + "rustix 1.1.6", "windows-sys 0.61.2", ] @@ -7670,6 +7709,20 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path 0.11.4", +] + [[package]] name = "tiny-skia" version = "0.12.0" @@ -7682,7 +7735,18 @@ dependencies = [ "cfg-if", "log", "png 0.18.1", - "tiny-skia-path", + "tiny-skia-path 0.12.0", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", ] [[package]] @@ -7774,9 +7838,9 @@ dependencies = [ [[package]] name = "toml" -version = "1.1.6+spec-1.1.0" +version = "1.1.8+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a" +checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d" dependencies = [ "indexmap", "serde_core", @@ -7789,9 +7853,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "1.1.1+spec-1.1.0" +version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" dependencies = [ "serde_core", ] @@ -7813,18 +7877,18 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.1.3+spec-1.1.0" +version = "1.1.7+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" +checksum = "0bb28d6e049a9766c3bd91a8326e6179f5b132dec87906bb97018ef7a2f3431a" dependencies = [ "winnow", ] [[package]] name = "toml_writer" -version = "1.1.2+spec-1.1.0" +version = "1.2.0+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" +checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a" [[package]] name = "tower" @@ -7935,6 +7999,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + [[package]] name = "typenum" version = "1.20.1" @@ -8091,7 +8161,7 @@ dependencies = [ "siphasher", "strict-num", "svgtypes", - "tiny-skia-path", + "tiny-skia-path 0.12.0", ] [[package]] @@ -8112,12 +8182,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - [[package]] name = "uuid" version = "1.27.0" @@ -8312,7 +8376,7 @@ checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" dependencies = [ "cc", "downcast-rs", - "rustix 1.1.5", + "rustix 1.1.6", "scoped-tls", "smallvec", "wayland-sys", @@ -8325,7 +8389,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" dependencies = [ "bitflags 2.13.2", - "rustix 1.1.5", + "rustix 1.1.6", "wayland-backend", "wayland-scanner", ] @@ -8347,7 +8411,7 @@ version = "0.31.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" dependencies = [ - "rustix 1.1.5", + "rustix 1.1.6", "wayland-client", "xcursor", ] @@ -8390,19 +8454,6 @@ dependencies = [ "wayland-scanner", ] -[[package]] -name = "wayland-protocols-plasma" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - [[package]] name = "wayland-protocols-wlr" version = "0.3.12" @@ -8435,7 +8486,7 @@ checksum = "0dde9c29be0f723a573977de51ee455bf3dfa03652730a74f9dd3b337e374d75" dependencies = [ "bitflags 2.13.2", "downcast-rs", - "rustix 1.1.5", + "rustix 1.1.6", "wayland-backend", "wayland-scanner", ] @@ -8476,9 +8527,9 @@ dependencies = [ [[package]] name = "webbrowser" -version = "1.2.4" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62c35be770821a214dbc362fc26908c853e776c0004294d0b10b8a6bad582f94" +checksum = "fe8d20d0214027baf11b8b0cc307c1da7657d8f4db9aa956f7de27a6fb1acbd5" dependencies = [ "jni", "log", @@ -8927,7 +8978,7 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winit" version = "0.30.13" -source = "git+https://github.com/storytold/winit.git?rev=a517b3846ee8457d84ee4975110bfda6797c44dc#a517b3846ee8457d84ee4975110bfda6797c44dc" +source = "git+https://github.com/storytold/winit.git?rev=3fd7ae64762f82a73b78bd24f453f82c4291067d#3fd7ae64762f82a73b78bd24f453f82c4291067d" dependencies = [ "ahash", "android-activity", @@ -8956,6 +9007,7 @@ dependencies = [ "raw-window-handle", "redox_syscall 0.4.1", "rustix 0.38.44", + "sctk-adwaita", "smithay-client-toolkit 0.19.2", "smol_str", "tracing", @@ -8965,7 +9017,6 @@ dependencies = [ "wayland-backend", "wayland-client", "wayland-protocols", - "wayland-protocols-plasma", "web-sys", "web-time", "windows-sys 0.52.0", @@ -9056,7 +9107,7 @@ dependencies = [ "libc", "log", "os_pipe", - "rustix 1.1.5", + "rustix 1.1.6", "thiserror 2.0.21", "tree_magic_mini", "wayland-backend", @@ -9067,17 +9118,21 @@ dependencies = [ [[package]] name = "wordcraft" -version = "0.18.1" +version = "0.20.0" dependencies = [ "craft", + "craft-nightly", "craft-proof", "eframe", "egui", "log", + "rfd", "serde_json", "tempfile", + "thiserror 2.0.21", "winit", "winresource", + "winsafe", "wordcraft-control-key", "wordcraft-doc", "wordcraft-engine", @@ -9090,7 +9145,7 @@ dependencies = [ [[package]] name = "wordcraft-cli" -version = "0.18.1" +version = "0.20.0" dependencies = [ "craft-zip", "image", @@ -9102,16 +9157,17 @@ dependencies = [ "wordcraft-geom", "wordcraft-mcp", "wordcraft-render", + "wordcraft-validate", "wordcraft-zotero", ] [[package]] name = "wordcraft-control-key" -version = "0.18.1" +version = "0.20.0" [[package]] name = "wordcraft-doc" -version = "0.18.1" +version = "0.20.0" dependencies = [ "base64 0.23.1", "craft-codepage", @@ -9127,7 +9183,7 @@ dependencies = [ [[package]] name = "wordcraft-docbin" -version = "0.18.1" +version = "0.20.0" dependencies = [ "cfb", "craft-doc-binary", @@ -9139,7 +9195,7 @@ dependencies = [ [[package]] name = "wordcraft-docx" -version = "0.18.1" +version = "0.20.0" dependencies = [ "base64 0.23.1", "cfb", @@ -9158,7 +9214,7 @@ dependencies = [ [[package]] name = "wordcraft-engine" -version = "0.18.1" +version = "0.20.0" dependencies = [ "cfb", "chrono", @@ -9178,7 +9234,7 @@ dependencies = [ "log", "regex", "regex-automata", - "rustix 1.1.5", + "rustix 1.1.6", "serde", "serde_json", "thiserror 2.0.21", @@ -9196,7 +9252,7 @@ dependencies = [ [[package]] name = "wordcraft-fonts" -version = "0.18.1" +version = "0.20.0" dependencies = [ "brotli-decompressor 5.0.3", "harfrust 0.13.3", @@ -9211,7 +9267,7 @@ dependencies = [ [[package]] name = "wordcraft-formats" -version = "0.18.1" +version = "0.20.0" dependencies = [ "chardetng", "chrono", @@ -9241,7 +9297,7 @@ dependencies = [ [[package]] name = "wordcraft-geom" -version = "0.18.1" +version = "0.20.0" dependencies = [ "craft-image-codecs", "craft-tiff", @@ -9251,7 +9307,7 @@ dependencies = [ [[package]] name = "wordcraft-layout" -version = "0.18.1" +version = "0.20.0" dependencies = [ "craft-metafile", "craft-proof", @@ -9271,7 +9327,7 @@ dependencies = [ [[package]] name = "wordcraft-mcp" -version = "0.18.1" +version = "0.20.0" dependencies = [ "craft", "craft-mcp-server", @@ -9285,7 +9341,7 @@ dependencies = [ [[package]] name = "wordcraft-pdf" -version = "0.18.1" +version = "0.20.0" dependencies = [ "chrono", "craft-metafile", @@ -9306,7 +9362,7 @@ dependencies = [ [[package]] name = "wordcraft-render" -version = "0.18.1" +version = "0.20.0" dependencies = [ "craft-metafile", "image", @@ -9320,14 +9376,16 @@ dependencies = [ [[package]] name = "wordcraft-ui-egui" -version = "0.18.1" +version = "0.20.0" dependencies = [ "cfb", "chrono", "craft", "craft-fonts-build", + "craft-html", "craft-ui-test-kit", "craft-zip", + "eframe", "egui", "egui_extras", "egui_kittest", @@ -9350,9 +9408,24 @@ dependencies = [ "zbus", ] +[[package]] +name = "wordcraft-validate" +version = "0.20.0" +dependencies = [ + "craft-image-codecs", + "craft-tiff", + "craft-xml", + "png 0.18.1", + "quick-xml 0.41.0", + "rayon", + "serde", + "serde_json", + "zip 3.0.0", +] + [[package]] name = "wordcraft-web" -version = "0.18.1" +version = "0.20.0" dependencies = [ "craft", "eframe", @@ -9372,7 +9445,7 @@ dependencies = [ [[package]] name = "wordcraft-zotero" -version = "0.18.1" +version = "0.20.0" dependencies = [ "log", "proptest", @@ -9458,7 +9531,7 @@ dependencies = [ "libc", "libloading", "once_cell", - "rustix 1.1.5", + "rustix 1.1.6", "x11rb-protocol", ] @@ -9500,7 +9573,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" dependencies = [ "libc", - "rustix 1.1.5", + "rustix 1.1.6", ] [[package]] @@ -9590,8 +9663,9 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee" [[package]] name = "xtask" -version = "0.18.1" +version = "0.20.0" dependencies = [ + "serde", "serde_json", ] @@ -9651,7 +9725,7 @@ dependencies = [ "hex", "libc", "ordered-stream", - "rustix 1.1.5", + "rustix 1.1.6", "serde", "serde_repr", "tracing", @@ -9833,6 +9907,20 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "zip" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12598812502ed0105f607f941c386f43d441e00148fce9dec3ca5ffb0bde9308" +dependencies = [ + "arbitrary", + "crc32fast", + "flate2", + "indexmap", + "memchr", + "zopfli", +] + [[package]] name = "zip" version = "9.1.0" @@ -9861,6 +9949,18 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" +[[package]] +name = "zopfli" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf7fc5d30c28483d93805c4a5e12b05bbb52407fa67c5f8bd552374cd01fb11" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] + [[package]] name = "zune-core" version = "0.5.3" @@ -9938,19 +10038,19 @@ dependencies = [ [[patch.unused]] name = "egui_demo_lib" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" [[patch.unused]] name = "egui_inspection" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" [[patch.unused]] name = "egui_system_font_provider" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=7e1c30d142bc7879d043e74b5ceb3ecfe7f51329#7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" +source = "git+https://github.com/storytold/egui.git?rev=399fc6e0ea65059e37de680f11ebbd177bf7d4ff#399fc6e0ea65059e37de680f11ebbd177bf7d4ff" [[patch.unused]] name = "hayro" version = "0.7.1" -source = "git+https://github.com/storytold/craft-libs?rev=243d68e12d05e89122db6d154924bf1992e10d38#243d68e12d05e89122db6d154924bf1992e10d38" +source = "git+https://github.com/storytold/craft-libs?rev=5299d8d97dc04648dff735d1bd6f60bd18f10b35#5299d8d97dc04648dff735d1bd6f60bd18f10b35" diff --git a/Cargo.toml b/Cargo.toml index e577259ef2..908f20bbb1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ run_slots = 3 test_threads = 4 [workspace.package] -version = "0.18.1" +version = "0.20.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" @@ -37,26 +37,30 @@ 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 = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-ssip = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } +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-engine = { path = "crates/engine" } wordcraft-mcp = { path = "crates/mcp" } wordcraft-zotero = { path = "crates/zotero" } wordcraft-control-key = { path = "crates/control-key" } wordcraft-ui-egui = { path = "crates/ui-egui" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0", default-features = false } -craft-ui-test-kit = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } +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" } # foundation kurbo = { version = "0.13", features = ["serde"] } thiserror = "2" serde = { version = "1", features = ["derive", "rc"] } serde_json = { version = "1", features = ["float_roundtrip"] } +quick-xml = "0.41" +zip = { version = "3", default-features = false, features = ["deflate"] } log = "0.4" # All date/time conversion goes through chrono (no hand-rolled calendar code beyond the 400-year range extension; AGENTS.md). chrono = { version = "0.4.45", default-features = false, features = ["std"] } @@ -81,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 = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0", default-features = false, features = ["write"] } +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-wordmodel = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-docx = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0", features = ["doc"] } -craft-doc-binary = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-flow = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-odf = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0", features = ["text"] } -craft-markdown = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-html = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0", features = ["flow"] } -craft-latex = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-math = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0", features = ["detect"] } -craft-sheet = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } -craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38", version = "=0.1.0" } +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" } # zlib streams (compressed metafile pictures in `.doc` drawings); already in the lock as a dependency of other crates. miniz_oxide = "0.9" cfb = "0.15" @@ -170,27 +174,27 @@ debug = 0 # The framework's patches, which Cargo does not carry over to dependents: its vendored crates from craft-libs, # and the egui and winit forks it builds with. [patch.crates-io] -krilla = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38" } -hayro = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38" } -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "243d68e12d05e89122db6d154924bf1992e10d38" } -ecolor = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -emath = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -epaint = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -egui = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "7e1c30d142bc7879d043e74b5ceb3ecfe7f51329" } -winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } +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" } +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" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +egui = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } +winit = { git = "https://github.com/storytold/winit.git", rev = "3fd7ae64762f82a73b78bd24f453f82c4291067d" } diff --git a/GLOSSARY.md b/GLOSSARY.md index 9d1ec531ed..75607f0737 100644 --- a/GLOSSARY.md +++ b/GLOSSARY.md @@ -66,3 +66,16 @@ _Avoid_: Tofu, box, notdef character A picture the document refers to that the output cannot include: its part is absent, its data cannot be decoded, its format is unsupported, or it is linked from outside the file. _Avoid_: Broken image, dropped image + +## Windows + +**Document window**: +A top-level window showing one open document. A document can be shown in several document windows +at once (View › New Window); each window shows exactly one. +_Avoid_: Viewport (that is the framework's surface), root window, tab + +**Save prompt**: +The question "Save changes?" asked when the last document window showing a document with unsaved +changes is about to close. It belongs to that window and appears there; while it is up, the other +windows wait. +_Avoid_: Close guard, save dialog, unsaved-changes dialog diff --git a/NOTICE b/NOTICE index a4d01fdc21..b246537bd5 100644 --- a/NOTICE +++ b/NOTICE @@ -188,3 +188,34 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Linux Wayland window decorations +------------------------------- +sctk-adwaita 0.10.1 (https://github.com/PolyMeilex/sctk-adwaita, +commit d5f343c45c04d4a026db57f76760819b7325db00) is used by winit on Linux +for vector window controls. Its title-font features are disabled: no Cantarell +font is embedded by this dependency and no font file is added to this repo. + +sctk-adwaita's MIT licence: + +MIT License + +Copyright (c) 2022 Bartłomiej Maryńczak + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 04e64218dc..3934a4a56b 100644 --- a/README.md +++ b/README.md @@ -282,7 +282,8 @@ into `%LOCALAPPDATA%\Programs\ArtCraft\WordCraft`, and needs no administrator ri and asks for an administrator. Install only one copy: a copy for another scope is refused, so uninstall first to change who WordCraft is installed for. Installers and executables are code-signed. -**If the app doesn't open on Windows:** the desktop app initializes only DirectX 12 by default. +**If the app doesn't open on Windows:** on 64-bit builds with a usable DirectX 12 GPU, the +desktop app initializes only DirectX 12 by default. Letting wgpu also create an OpenGL instance can crash some graphics drivers (AMD's `atio6axx.dll`) before the window appears, so the app would flash in Task Manager and quit. `WGPU_BACKEND` overrides the default for troubleshooting (for example `dx12` or `vulkan`). In diff --git a/ROADMAP.md b/ROADMAP.md index 64b2540868..300fb991fa 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,23 +1,25 @@ # WordCraft roadmap > **Last reviewed:** 2026-10-31 · **Last updated:** 2026-11-21 · **Change:** trivial (table rows split across pages: a cell's first paragraph on the page can split even when only one line fits, if the row starts at the top, with or without its own headers, or continues from the previous page (#6823)); previously trivial (release wrap areas when strict column balancing moves the anchor line, #6821); previously trivial (balanced columns keep lines together from Word 2013's layout, #6821); previously trivial (progress log: TIFF picture chooser, drop and pasted-path routing, #6704); previously minor (added layout.fitOnePage and its Layout › Page Setup ribbon button to condense a multi-page document by one page while preserving typography hierarchy); previously minor (#3398: persistent screen paper colors; parity estimates unchanged); previously minor (#3693: additional Delete Previous Sentence command and shortcut; Word-parity estimates unchanged) -> **CLI path update:** 2026-11-04 · Options before a non-Unicode input filename no longer make the CLI reject that filename; text option values still require Unicode; `run --file` and `run --script` retain native paths. No ranked gap or readiness estimate changes. +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-28 · **Change:** trivial (progress log: DOCX tracked changes dated in local time, as Word reads `w:date`, with their UTC time in `w16du:dateUtc`, #6851); previously trivial (progress log: Review › Delete › Delete All Comments in Document and Delete All Resolved Comments, #7818); previously trivial (legacy header lines stay in place around narrow Square, Tight and Through logos, #6805); previously trivial (progress log: `wordcraft-cli mcp` needs both automation roots and refuses `--connect`, #7124); previously trivial (progress log: File › Print’s preview pages as the print job prints and marks tracked changes with Track Changes Options, #5232, #6267); previously trivial (formatting shortcuts say what they did to screen readers); previously trivial (dialogs are dialogs to screen readers, their tabs are tabs, and colour fields and swatches say their colour); previously trivial (the Paste button is named "Paste" for screen readers, without macOS's key on other platforms; the status bar's Go To hint shows the platform's key); previously trivial (progress log: border boxes close their corners; previously trivial: progress log: file formats, codecs and protocols from craft-libs, #778); previously trivial (progress log: Get the Missing Fonts); previously trivial (progress log: a deleted list item's number is drawn as deleted text under Track Changes (#4828)); previously trivial (progress log: Save As and Export offer Browse in WordCraft… on Linux/BSD, #3535); previously trivial (progress log: Review › Language can set the whole document's proofing language, #3518); previously trivial (progress log: Auto interface size capped to the screen, #4030); previously trivial (progress log: DOCX section line numbering stays off without a positive `w:countBy`, #6209); previously trivial (progress log: Save As on Linux: the desktop portal's Save dialog reports the file type picked, updating the extension so saving as PDF writes a .pdf, #6180); previously trivial (Vertical scrollbar track: clicking above the elevator moves one screen up and clicking below it moves one screen down, as in Word (#5853)); previously trivial (progress log: #4501 refactor regressions restored: per-section header grid, ODT default font, link tooltip, #4683); previously trivial (progress log: the window moves by its title bar behind a modal dialog, #5124); previously trivial (progress log: `convert --strict` and `render --strict` refuse a silently incomplete PDF or PNG (#6005, #6008)); ; trivial (progress log: ODT columns stating only their shares); previously trivial (progress log: ODT font size for every script); previously trivial (progress log: ODT text turning off what its style turns on); previously trivial (progress log: edited ODT paragraphs keep custom styles with an outline level); previously trivial (progress log: ODT pictures keep the size their file gives); previously trivial (progress log: ODT frames keep the page they are anchored to); previously trivial (pointer zoom stretches page rasters until it stops); previously trivial (dark-theme interface text on Linux no longer looks semi-bold); previously trivial (Control/MCP #2596 review: partial-write outcomes, path-bearing image exports, accept-thread startup cleanup and malformed UTF-8 handling); previously trivial (progress log: a turned inline picture whose file keeps no room for the turn keeps its line to its frame); previously trivial (progress log: the Arabic interface's Styles gallery reads from the right (#5566)); previously trivial (progress log: ODT pictures offered in several formats); previously trivial (progress log: ODT heading text of another size); previously trivial (Protected typing boundary lookup counts preceding objects once and indexes editable permission IDs (#3614); caret movement and enforcement policy are unchanged; previously trivial: progress log: Custom document properties dialog, #2982; previously trivial: progress log: View › New Window; previously trivial: progress log: interface translations come from storytold/craft-i18n through the `craft-i18n` crate; previously trivial: progress log: disabled-control reasons translated in every interface language, #2678; previously trivial: progress log: mail merge record navigation and record ranges for printing, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: group connector rerouting preserves rotated and flipped free or unresolved endpoints under nonuniform group scaling; readiness estimates unchanged; previously trivial: progress log: a word with no break opportunity in it no longer makes the layout quadratic, #3412; previously trivial: progress log: a relationship the markup names without the prefix is read as it wrote, and an ordinary `id` names no part; previously trivial: progress log: a document with many relationships opens in the time its part takes, and an id the text only mentions is not a reference, #3411; previously trivial: progress log: read only and comments-only protection grey out edits; previously trivial: progress log: an empty paragraph with a hidden mark shows nothing, not even its list number, #3982; previously trivial: progress log: "NaN" in the Font dialog's Size box no longer closes the app, #3663; previously trivial: progress log: a table cell span from a `.json` file no longer overflows, #3637; previously trivial: progress log: a click in the footer while editing the header moves there; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Slovenian interface catalog, 2,614 entries; previously trivial: Insert Table of Figures dialog for any caption label, #3013; previously trivial: progress log: Home › Underline drop-down, #2738; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: progress log: the scrollbar page tip stays on one line, #3341; previously trivial: progress log: forms protection greys out the control buttons; previously trivial: progress log: a document with many content controls saves in the time the controls take, #13; previously trivial: progress log: Word signature lines kept on save; previously trivial: a Thai run with Latin finds one installed font covering it all on Linux too, #1549; previously trivial: progress log: closing the header returns to the body selection, #3331; previously trivial: progress log: saving to a NAS share mounted by GVFS, #3003; previously trivial: progress log: a picture dragged near the bottom of a page lands there, #3169; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: progress log: inline pictures drag to an insertion cursor and stay inline, #2233, #2234; previously trivial: progress log: a text file saved over itself closes without asking, #2376; previously trivial: progress log: a text frame in the paragraph defaults frames nothing, #2360; previously trivial: fixed font inputs in four layout controls; previously trivial: typing no longer starts render threads on every repaint, #3027; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: progress log: banded rows shade as in Word, #3415; previously trivial: progress log: the table handles show while the caret is in the table, #2428; previously trivial: progress log: a click below a floating table reaches the text after it, #2038; previously trivial: progress log: Delete on selected table cells leaves one empty paragraph in each, #2802; previously trivial: progress log: lam-alef in exported PDFs extracts whole with fonts that draw it as two glyphs, #2310; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial (progress log: a shape dropped just after a page break inside a paragraph stays on the new page, #4262); previously trivial (progress log: a float anchored on a later page of a long paragraph is drawn there, #4250); previously minor (progress log: `file.closeDocument` over the control channel and MCP bridge is refused while the document it names has unsaved changes; previously trivial (progress log: ODT element audit, ODT checked against 220 files from other applications, ODT display styles); previously trivial (progress log: Shape Format › Size in the interface unit, #4196); previously trivial (progress log: typed n-ary operators such as ∫ and ∑ wait for their limits, observed in Word for Windows on #4938 (#4917)); previously trivial (progress log: a paragraph naming an undefined style is formatted as Normal, #5077); previously trivial (progress log: justified and distributed lines keep the width of the spaces before their first character); previously trivial (print helpers erase loaded plaintext inputs before driver work, #5710); previously trivial (Windows print submissions use isolated helpers so a cancelled driver cannot block a retry, #5710); previously trivial (print cancellation remains available without a document; sending-boundary limitation clarified, #5710); previously trivial (progress log: a print job waiting on its driver can be cancelled, and quitting doesn't wait for it, #5710); previously trivial (progress log: the Print panel's printer list no longer waits on printer drivers, #5710); previously trivial (Page drawing indexes text-box warp lookups per paragraph (#3614)); previously trivial (built-in citation source lookups, #4888; current-main progress records retained); previously trivial (progress log: Times and Courier take their Windows counterparts' line spacing; previously trivial (progress log: the status bar's count can be words, characters or characters without spaces, #2797); previously trivial (Linux display server setting in File › Options › Advanced, #2184); previously trivial (progress log: Linux Read Aloud through Speech Dispatcher, #4576); previously trivial (progress log: a click just outside a floating table by turned cell text, #4181; previously minor: progress log: Spanish proofing, #3360, #3553; previously trivial: progress log: Insert › Table's grid previews the hovered table on the page, #3931; previously trivial (progress log: MHT quoted MIME parameters); previously trivial (progress log: CLI convert format options); previously trivial (MATH construction reuse, #3630); previously trivial (DOCX `w:adjustRightInd` is preserved through style resolution and ordered DOCX saves); previously trivial (per-page ink object lookups, #3614); previously trivial (progress log: ODT display settings removed); previously trivial (progress log: dialogs are modal except the five Word keeps modeless, and a press beside one shakes it, #3859); previously trivial (progress log: picture brightness, contrast and transparency, ODT element audit, ODT checked against 220 files from other applications, ODT display styles); previously trivial (progress log: the dialogs of the mirrored Arabic interface read right to left: label-and-field rows, tables (list columns, the Models table), tile galleries and the Add/Remove arrows follow the reading direction, through one `rtl::Table` helper that draws exactly as before in English; no ranked gap closed, readiness estimates unchanged); previously trivial (progress log: fonts that aren't installed are flagged in the font box and status bar); previously trivial (progress log: ODT sections inside text boxes); previously trivial (progress log: ODT definitions sharing a name, sections around tables, stacking order); previously trivial (progress log: ODT forms and indexes written as read); previously trivial (progress log: ODT table styles saved, WordCraft-origin documents checked in LibreOffice); previously trivial (progress log: ODT interpretation profile); previously trivial (progress log: ODT controls, custom shapes, in-line placement); previously trivial (progress log: ODT charts kept, frame outlines, header height); previously trivial (progress log: ODT header rows); previously trivial (progress log: ODT layout setting, padding, columns); previously trivial (progress log: ODT tables, header spacing, picture paragraphs); previously trivial (progress log: ODT round trips keep their page count); previously trivial (progress log: emphasis marks, SET fields, ODT page backgrounds and tables); previously trivial (progress log: ODT checked against LibreOffice's templates); previously trivial (progress log: ODT at ~90%); previously trivial (progress log: ODT read and written nearly whole); previously trivial (progress log: ODT text boxes); previously trivial (progress log: ODT layout settings); previously trivial (progress log: ODT character styles); previously trivial (progress log: ODT custom styles); previously trivial (progress log: ODT equations saved); previously trivial (progress log: ODT floating pictures); previously trivial (progress log: ODT paragraph borders); previously trivial (progress log: ODT heading numbering); previously trivial (progress log: ODT table borders); previously trivial (progress log: ODT heading styles); previously trivial (progress log: ODT tab stops); previously trivial (progress log: ODT character formatting); previously trivial (progress log: ODT lists); previously trivial (progress log: ODT comments); previously trivial (progress log: ODT footnotes and endnotes); previously trivial (progress log: ODT headers, footers and fields); previously trivial (progress log: ODT paragraph spacing); previously trivial (progress log: Options › Language redesign, CP4.3); previously trivial (progress log: the missing-pack bar on a fresh install, the caret's typing language, and the spelling menu heading in the interface language, CP4.3); previously trivial (progress log: Language pack languages in every language list, CP4.3); previously trivial (progress log: craft-proof pin, French elision and Valencian, CP4.3); previously trivial (progress log: a long comment's card and balloon stop at ten lines, #3382); previously trivial (progress log: a pasted text box story is charged for the formatting it copies); previously trivial (progress log: a .doc table row keeps one override per cell); previously trivial (progress log: a .doc file's sections find their paragraphs by index); previously minor (Arabic interface language with mirrored UI, #1195); previously trivial (progress log: Replace and Remove Table of Contents with Word's title above a section break, #4041); previously trivial (progress log: a password-protected file named on the command line asks for its password after the startup document is replaced, #5299); previously trivial (progress log: language-packs-2 published and pinned, 75 Language packs); previously trivial (progress log: language-packs-1 published and pinned, CP4.4); previously trivial (progress log: Language packs, CP4);; previously trivial (DOCX table rows and cells inside selected alternate-content branches survive open and repeated saves (#5219); broader corpus qualification and readiness estimates unchanged); previously trivial (progress log: a list inside a Markdown block quote stays quoted); previously trivial (progress log: arrowheads keep their kind, width and length and are drawn at Word's sizes); previously trivial (progress log: the line between columns for selected text, #5178); previously trivial (progress log: .doc standard font, #5066); previously trivial (progress log: a table row doesn't split off a picture that doesn't fit, #4272); previously trivial (progress log: a middle or bottom cell of a row split across pages lines up on the first page); previously trivial (progress log: tab leader dots spaced and placed as in Word); previously trivial (progress log: a list level above counts its first number at the first deeper item); previously trivial (progress log: paragraph side borders lie outside the text, #5036); previously trivial (progress log: TOC page numbers as PAGEREF fields, #5097); previously trivial (progress log: Backstage keytips, #4960); previously trivial (Progress log: only the printer's PDF leaves out links; Save these pages as PDF keeps them, #4734); previously trivial (progress log: Chinese and Japanese text counts a word per character, #4547; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (progress log: corporate authors in bibliographies, #4848); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (progress log: Table Properties follows the selection, #4857); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion walks reference offsets and formatting runs together, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (progress log: RTF pictures stored as Windows or Enhanced Metafiles are imported, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (progress log: Insert › Shapes icon grid, #4349); previously trivial (progress log: AutoCorrect Options with no document open, #4585); previously trivial (progress log: window fallback geometry and equation symbol tooltips); previously trivial (progress log: window titles omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (progress log: Custom document properties dialog, #2982; previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: progress log: a text box that keeps the keyboard no longer resets the input method every frame, #2986; previously trivial: progress log: recovery copies and .json files store pictures as base64, #586 follow-up; previously trivial: progress log: legacy menu keys, #1697; previously trivial: progress log: shape gradients and transparency, #1500; previously trivial: progress log: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: progress log: text above a float's anchor wraps around it, #2048; previously trivial: progress log: File › Recover follows the app theme, #3243; previously trivial: progress log: formatting toolbar with the text context menu, #2959; previously trivial: progress log: caret inside ligatures, #1974; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: a word after a slash wraps whole, like Word, #2963; previously trivial: progress log: a header-cell picture watermark sits behind the text, #1775; previously trivial: symbols keep their font when the text font changes, #2036; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: Add Font imports every selected font file, #1789); previously trivial (RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: Read Aloud speaks each sentence in its own language, #1843; previously trivial: hint-reliant CJK outlines; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: progress log: Turkish case mapping in AutoCorrect, #1923; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: progress log: Hebrew field results and smart quotes, #1670; previously trivial: Backspace removes a selected table, rows or columns, #1844; previously trivial: progress log: mixed Hebrew/Latin text keeps its order in Word, #1543; previously trivial: progress log: web typing in non-Latin text no longer repeats, #1480; previously trivial: progress log: font family caches bounded and math font lookups follow font changes, #1354; previously trivial: `-->` AutoCorrect replacement, #2223; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: progress log: Columns on selected text, #2024; previously trivial: progress log: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: progress log: Indonesian proofing, #498; previously trivial: progress log: DOCX glossary documents (building blocks); previously trivial: progress log: Read Mode keeps the keyboard and shows whole, unobscured columns, #1772); previously trivial: progress log: font list entries of tall-ascent fonts no longer cut off, #2570); previously trivial: progress log: Split Cells and Convert Text to Table dialogs follow the Word check, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout fills the window width, #1876; previously trivial: progress log: Different First Page headers reachable from page 1, #2826; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: progress log: web preferences kept between visits, #2132; previously trivial: progress log: undrawable private-use list bullets show the level's default bullet, #1683; previously trivial: progress log: `w:eastAsianLayout` kept on save; previously trivial: table style editor formats every part, #714); previously trivial: VML freeforms read and kept on save; previously trivial: progress log: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: progress log: grouped `flowChartOr` shapes draw their circle and crossing spokes; previously trivial: progress log: copies keep their formatting in other programs, #1523; previously trivial: progress log: privacy options on save, #1062; previously trivial: progress log: equation pictures in theme colours on Windows, #1002; previously trivial: symbol fonts, #776; previously trivial: the save prompt answers from the keyboard, #861; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw tab ink, #307, and Draw Table and Eraser, #303, landed: catalog 402/434; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; progress docs restructured); previously trivial (progress log: ODT documents keep their language); previously trivial (progress log: ODT table and row backgrounds) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 +> **Validation status:** 2026-11-18 · trivial · DOCX validation warns once per duplicated folded font name, including case variants. Independent endpoint review remains open. +> **Last reviewed:** 2026-10-31 · **Last updated:** 2026-11-18 · **Change:** trivial (progress log: TIFF picture chooser, drop and pasted-path routing, #6704); previously minor (added layout.fitOnePage and its Layout › Page Setup ribbon button to condense a multi-page document by one page while preserving typography hierarchy); previously minor (#3398: persistent screen paper colors; parity estimates unchanged); previously minor (#3693: additional Delete Previous Sentence command and shortcut; Word-parity estimates unchanged) > **Floating anchor row segments:** 2026-11-07 · A floating anchor after a manual page/column break counts visible content on the far side of the same wrapped row. Marker-only cover anchors retain their previous-page rule. Synthetic picture spacing, placement and history controls; no new native Word measurement. Readiness estimates unchanged. -> **Highlight update:** 2026-10-25 · Highlight shortcut toggles the last chosen colour off when the whole selection has it; explicit colour commands remain setters (#4085). Readiness estimates unchanged. +> **Page Setup update:** 2026-11-07 · Page Setup number boxes keep long input inside the field, including accepted margin values after focus leaves (#5650); accepted ranges and readiness estimates are unchanged. **Stage: alpha** · next: beta, ~15 points (60% → 75% ready for real work) and ~150–230 h away -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-20 · **Change:** trivial (legacy header lines stay in place around narrow Square, Tight and Through logos, #6805); previously trivial (progress log: `wordcraft-cli mcp` needs both automation roots and refuses `--connect`, #7124); previously trivial (progress log: File › Print’s preview pages as the print job prints and marks tracked changes with Track Changes Options, #5232, #6267); previously trivial (formatting shortcuts say what they did to screen readers); previously trivial (dialogs are dialogs to screen readers, their tabs are tabs, and colour fields and swatches say their colour); previously trivial (the Paste button is named "Paste" for screen readers, without macOS's key on other platforms; the status bar's Go To hint shows the platform's key); previously trivial (progress log: border boxes close their corners; previously trivial: progress log: file formats, codecs and protocols from craft-libs, #778); previously trivial (progress log: Get the Missing Fonts); previously trivial (progress log: a deleted list item's number is drawn as deleted text under Track Changes (#4828)); previously trivial (progress log: Save As and Export offer Browse in WordCraft… on Linux/BSD, #3535); previously trivial (progress log: Review › Language can set the whole document's proofing language, #3518); previously trivial (progress log: Auto interface size capped to the screen, #4030); previously trivial (progress log: DOCX section line numbering stays off without a positive `w:countBy`, #6209); previously trivial (progress log: Save As on Linux: the desktop portal's Save dialog reports the file type picked, updating the extension so saving as PDF writes a .pdf, #6180); previously trivial (Vertical scrollbar track: clicking above the elevator moves one screen up and clicking below it moves one screen down, as in Word (#5853)); previously trivial (progress log: #4501 refactor regressions restored: per-section header grid, ODT default font, link tooltip, #4683); previously trivial (progress log: the window moves by its title bar behind a modal dialog, #5124); previously trivial (progress log: `convert --strict` and `render --strict` refuse a silently incomplete PDF or PNG (#6005, #6008)); ; trivial (progress log: ODT columns stating only their shares); previously trivial (progress log: ODT font size for every script); previously trivial (progress log: ODT text turning off what its style turns on); previously trivial (progress log: edited ODT paragraphs keep custom styles with an outline level); previously trivial (progress log: ODT pictures keep the size their file gives); previously trivial (progress log: ODT frames keep the page they are anchored to); previously trivial (pointer zoom stretches page rasters until it stops); previously trivial (dark-theme interface text on Linux no longer looks semi-bold); previously trivial (Control/MCP #2596 review: partial-write outcomes, path-bearing image exports, accept-thread startup cleanup and malformed UTF-8 handling); previously trivial (progress log: a turned inline picture whose file keeps no room for the turn keeps its line to its frame); previously trivial (progress log: the Arabic interface's Styles gallery reads from the right (#5566)); previously trivial (progress log: ODT pictures offered in several formats); previously trivial (progress log: ODT heading text of another size); previously trivial (Protected typing boundary lookup counts preceding objects once and indexes editable permission IDs (#3614); caret movement and enforcement policy are unchanged; previously trivial: progress log: Custom document properties dialog, #2982; previously trivial: progress log: View › New Window; previously trivial: progress log: interface translations come from storytold/craft-i18n through the `craft-i18n` crate; previously trivial: progress log: disabled-control reasons translated in every interface language, #2678; previously trivial: progress log: mail merge record navigation and record ranges for printing, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: group connector rerouting preserves rotated and flipped free or unresolved endpoints under nonuniform group scaling; readiness estimates unchanged; previously trivial: progress log: a word with no break opportunity in it no longer makes the layout quadratic, #3412; previously trivial: progress log: a relationship the markup names without the prefix is read as it wrote, and an ordinary `id` names no part; previously trivial: progress log: a document with many relationships opens in the time its part takes, and an id the text only mentions is not a reference, #3411; previously trivial: progress log: read only and comments-only protection grey out edits; previously trivial: progress log: an empty paragraph with a hidden mark shows nothing, not even its list number, #3982; previously trivial: progress log: "NaN" in the Font dialog's Size box no longer closes the app, #3663; previously trivial: progress log: a table cell span from a `.json` file no longer overflows, #3637; previously trivial: progress log: a click in the footer while editing the header moves there; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Slovenian interface catalog, 2,614 entries; previously trivial: Insert Table of Figures dialog for any caption label, #3013; previously trivial: progress log: Home › Underline drop-down, #2738; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: progress log: the scrollbar page tip stays on one line, #3341; previously trivial: progress log: forms protection greys out the control buttons; previously trivial: progress log: a document with many content controls saves in the time the controls take, #13; previously trivial: progress log: Word signature lines kept on save; previously trivial: a Thai run with Latin finds one installed font covering it all on Linux too, #1549; previously trivial: progress log: closing the header returns to the body selection, #3331; previously trivial: progress log: saving to a NAS share mounted by GVFS, #3003; previously trivial: progress log: a picture dragged near the bottom of a page lands there, #3169; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: progress log: inline pictures drag to an insertion cursor and stay inline, #2233, #2234; previously trivial: progress log: a text file saved over itself closes without asking, #2376; previously trivial: progress log: a text frame in the paragraph defaults frames nothing, #2360; previously trivial: fixed font inputs in four layout controls; previously trivial: typing no longer starts render threads on every repaint, #3027; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: progress log: banded rows shade as in Word, #3415; previously trivial: progress log: the table handles show while the caret is in the table, #2428; previously trivial: progress log: a click below a floating table reaches the text after it, #2038; previously trivial: progress log: Delete on selected table cells leaves one empty paragraph in each, #2802; previously trivial: progress log: lam-alef in exported PDFs extracts whole with fonts that draw it as two glyphs, #2310; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial (progress log: a shape dropped just after a page break inside a paragraph stays on the new page, #4262); previously trivial (progress log: a float anchored on a later page of a long paragraph is drawn there, #4250); previously minor (progress log: `file.closeDocument` over the control channel and MCP bridge is refused while the document it names has unsaved changes; previously trivial (progress log: ODT element audit, ODT checked against 220 files from other applications, ODT display styles); previously trivial (progress log: Shape Format › Size in the interface unit, #4196); previously trivial (progress log: typed n-ary operators such as ∫ and ∑ wait for their limits, observed in Word for Windows on #4938 (#4917)); previously trivial (progress log: a paragraph naming an undefined style is formatted as Normal, #5077); previously trivial (progress log: justified and distributed lines keep the width of the spaces before their first character); previously trivial (print helpers erase loaded plaintext inputs before driver work, #5710); previously trivial (Windows print submissions use isolated helpers so a cancelled driver cannot block a retry, #5710); previously trivial (print cancellation remains available without a document; sending-boundary limitation clarified, #5710); previously trivial (progress log: a print job waiting on its driver can be cancelled, and quitting doesn't wait for it, #5710); previously trivial (progress log: the Print panel's printer list no longer waits on printer drivers, #5710); previously trivial (Page drawing indexes text-box warp lookups per paragraph (#3614)); previously trivial (built-in citation source lookups, #4888; current-main progress records retained); previously trivial (progress log: Times and Courier take their Windows counterparts' line spacing; previously trivial (progress log: the status bar's count can be words, characters or characters without spaces, #2797); previously trivial (Linux display server setting in File › Options › Advanced, #2184); previously trivial (progress log: Linux Read Aloud through Speech Dispatcher, #4576); previously trivial (progress log: a click just outside a floating table by turned cell text, #4181; previously minor: progress log: Spanish proofing, #3360, #3553; previously trivial: progress log: Insert › Table's grid previews the hovered table on the page, #3931; previously trivial (progress log: MHT quoted MIME parameters); previously trivial (progress log: CLI convert format options); previously trivial (MATH construction reuse, #3630); previously trivial (DOCX `w:adjustRightInd` is preserved through style resolution and ordered DOCX saves); previously trivial (per-page ink object lookups, #3614); previously trivial (progress log: ODT display settings removed); previously trivial (progress log: dialogs are modal except the five Word keeps modeless, and a press beside one shakes it, #3859); previously trivial (progress log: picture brightness, contrast and transparency, ODT element audit, ODT checked against 220 files from other applications, ODT display styles); previously trivial (progress log: the dialogs of the mirrored Arabic interface read right to left: label-and-field rows, tables (list columns, the Models table), tile galleries and the Add/Remove arrows follow the reading direction, through one `rtl::Table` helper that draws exactly as before in English; no ranked gap closed, readiness estimates unchanged); previously trivial (progress log: fonts that aren't installed are flagged in the font box and status bar); previously trivial (progress log: ODT sections inside text boxes); previously trivial (progress log: ODT definitions sharing a name, sections around tables, stacking order); previously trivial (progress log: ODT forms and indexes written as read); previously trivial (progress log: ODT table styles saved, WordCraft-origin documents checked in LibreOffice); previously trivial (progress log: ODT interpretation profile); previously trivial (progress log: ODT controls, custom shapes, in-line placement); previously trivial (progress log: ODT charts kept, frame outlines, header height); previously trivial (progress log: ODT header rows); previously trivial (progress log: ODT layout setting, padding, columns); previously trivial (progress log: ODT tables, header spacing, picture paragraphs); previously trivial (progress log: ODT round trips keep their page count); previously trivial (progress log: emphasis marks, SET fields, ODT page backgrounds and tables); previously trivial (progress log: ODT checked against LibreOffice's templates); previously trivial (progress log: ODT at ~90%); previously trivial (progress log: ODT read and written nearly whole); previously trivial (progress log: ODT text boxes); previously trivial (progress log: ODT layout settings); previously trivial (progress log: ODT character styles); previously trivial (progress log: ODT custom styles); previously trivial (progress log: ODT equations saved); previously trivial (progress log: ODT floating pictures); previously trivial (progress log: ODT paragraph borders); previously trivial (progress log: ODT heading numbering); previously trivial (progress log: ODT table borders); previously trivial (progress log: ODT heading styles); previously trivial (progress log: ODT tab stops); previously trivial (progress log: ODT character formatting); previously trivial (progress log: ODT lists); previously trivial (progress log: ODT comments); previously trivial (progress log: ODT footnotes and endnotes); previously trivial (progress log: ODT headers, footers and fields); previously trivial (progress log: ODT paragraph spacing); previously trivial (progress log: Options › Language redesign, CP4.3); previously trivial (progress log: the missing-pack bar on a fresh install, the caret's typing language, and the spelling menu heading in the interface language, CP4.3); previously trivial (progress log: Language pack languages in every language list, CP4.3); previously trivial (progress log: craft-proof pin, French elision and Valencian, CP4.3); previously trivial (progress log: a long comment's card and balloon stop at ten lines, #3382); previously trivial (progress log: a pasted text box story is charged for the formatting it copies); previously trivial (progress log: a .doc table row keeps one override per cell); previously trivial (progress log: a .doc file's sections find their paragraphs by index); previously minor (Arabic interface language with mirrored UI, #1195); previously trivial (progress log: Replace and Remove Table of Contents with Word's title above a section break, #4041); previously trivial (progress log: a password-protected file named on the command line asks for its password after the startup document is replaced, #5299); previously trivial (progress log: language-packs-2 published and pinned, 75 Language packs); previously trivial (progress log: language-packs-1 published and pinned, CP4.4); previously trivial (progress log: Language packs, CP4);; previously trivial (DOCX table rows and cells inside selected alternate-content branches survive open and repeated saves (#5219); broader corpus qualification and readiness estimates unchanged); previously trivial (progress log: a list inside a Markdown block quote stays quoted); previously trivial (progress log: arrowheads keep their kind, width and length and are drawn at Word's sizes); previously trivial (progress log: the line between columns for selected text, #5178); previously trivial (progress log: .doc standard font, #5066); previously trivial (progress log: a table row doesn't split off a picture that doesn't fit, #4272); previously trivial (progress log: a middle or bottom cell of a row split across pages lines up on the first page); previously trivial (progress log: tab leader dots spaced and placed as in Word); previously trivial (progress log: a list level above counts its first number at the first deeper item); previously trivial (progress log: paragraph side borders lie outside the text, #5036); previously trivial (progress log: TOC page numbers as PAGEREF fields, #5097); previously trivial (progress log: Backstage keytips, #4960); previously trivial (Progress log: only the printer's PDF leaves out links; Save these pages as PDF keeps them, #4734); previously trivial (progress log: Chinese and Japanese text counts a word per character, #4547; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (progress log: corporate authors in bibliographies, #4848); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (progress log: Table Properties follows the selection, #4857); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion walks reference offsets and formatting runs together, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (progress log: RTF pictures stored as Windows or Enhanced Metafiles are imported, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (progress log: Insert › Shapes icon grid, #4349); previously trivial (progress log: AutoCorrect Options with no document open, #4585); previously trivial (progress log: window fallback geometry and equation symbol tooltips); previously trivial (progress log: window titles omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (progress log: Custom document properties dialog, #2982; previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: progress log: a text box that keeps the keyboard no longer resets the input method every frame, #2986; previously trivial: progress log: recovery copies and .json files store pictures as base64, #586 follow-up; previously trivial: progress log: legacy menu keys, #1697; previously trivial: progress log: shape gradients and transparency, #1500; previously trivial: progress log: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: progress log: text above a float's anchor wraps around it, #2048; previously trivial: progress log: File › Recover follows the app theme, #3243; previously trivial: progress log: formatting toolbar with the text context menu, #2959; previously trivial: progress log: caret inside ligatures, #1974; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: a word after a slash wraps whole, like Word, #2963; previously trivial: progress log: a header-cell picture watermark sits behind the text, #1775; previously trivial: symbols keep their font when the text font changes, #2036; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: Add Font imports every selected font file, #1789); previously trivial (RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: Read Aloud speaks each sentence in its own language, #1843; previously trivial: hint-reliant CJK outlines; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: progress log: Turkish case mapping in AutoCorrect, #1923; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: progress log: Hebrew field results and smart quotes, #1670; previously trivial: Backspace removes a selected table, rows or columns, #1844; previously trivial: progress log: mixed Hebrew/Latin text keeps its order in Word, #1543; previously trivial: progress log: web typing in non-Latin text no longer repeats, #1480; previously trivial: progress log: font family caches bounded and math font lookups follow font changes, #1354; previously trivial: `-->` AutoCorrect replacement, #2223; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: progress log: Columns on selected text, #2024; previously trivial: progress log: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: progress log: Indonesian proofing, #498; previously trivial: progress log: DOCX glossary documents (building blocks); previously trivial: progress log: Read Mode keeps the keyboard and shows whole, unobscured columns, #1772); previously trivial: progress log: font list entries of tall-ascent fonts no longer cut off, #2570); previously trivial: progress log: Split Cells and Convert Text to Table dialogs follow the Word check, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout fills the window width, #1876; previously trivial: progress log: Different First Page headers reachable from page 1, #2826; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: progress log: web preferences kept between visits, #2132; previously trivial: progress log: undrawable private-use list bullets show the level's default bullet, #1683; previously trivial: progress log: `w:eastAsianLayout` kept on save; previously trivial: table style editor formats every part, #714); previously trivial: VML freeforms read and kept on save; previously trivial: progress log: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: progress log: grouped `flowChartOr` shapes draw their circle and crossing spokes; previously trivial: progress log: copies keep their formatting in other programs, #1523; previously trivial: progress log: privacy options on save, #1062; previously trivial: progress log: equation pictures in theme colours on Windows, #1002; previously trivial: symbol fonts, #776; previously trivial: the save prompt answers from the keyboard, #861; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw tab ink, #307, and Draw Table and Eraser, #303, landed: catalog 402/434; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; progress docs restructured); previously trivial (progress log: ODT documents keep their language); previously trivial (progress log: ODT table and row backgrounds) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 +> **CLI path update:** 2026-11-04 · Options before a non-Unicode input filename no longer make the CLI reject that filename; text option values still require Unicode; `run --file` and `run --script` retain native paths. No ranked gap or readiness estimate changes. -> -> **Recipient CSV update:** 2026-10-27 · Complete quoted header records choose the delimiter (#4249); detection and regressions follow the current mailings module split. Recipient limits and readiness estimates are unchanged. > > **Headered CSV prefix update:** 2026-10-31 · Unquoted whitespace-only prefix lines are skipped before choosing recipient headers (#4249); quoted whitespace headers, headerless records, the shared CSV reader and recipient limits remain unchanged. +> +> **Recipient CSV update:** 2026-10-27 · Complete quoted header records choose the delimiter (#4249); detection and regressions follow the current mailings module split. Recipient limits and readiness estimates are unchanged. -> **Page Setup update:** 2026-11-07 · Page Setup number boxes keep long input inside the field, including accepted margin values after focus leaves (#5650); accepted ranges and readiness estimates are unchanged. -> **Printing update:** 2026-10-12 · direct desktop printing through craft-print; details below. +> **Highlight update:** 2026-10-25 · Highlight shortcut toggles the last chosen colour off when the whole selection has it; explicit colour commands remain setters (#4085). Readiness estimates unchanged. > **Legacy form update:** 2026-10-22 · trivial: numeric XML references decode in field names and labels; readiness estimates unchanged. +> **Comment command update:** 2026-10-14 · malformed explicit IDs rejected; synthetic refusal, undo/redo and DOCX save/reopen checks (#1690 finding 3). Readiness estimates unchanged. WordCraft aims for complete parity with Microsoft Word, then goes further on speed, openness and agent control. This page is the summary; the assessment is @@ -25,7 +27,7 @@ agent control. This page is the summary; the assessment is [`docs/gaps.md`](docs/gaps.md), and milestones and the current focus are in [`docs/roadmap.md`](docs/roadmap.md). -> **Comment command update:** 2026-10-14 · malformed explicit IDs rejected; synthetic refusal, undo/redo and DOCX save/reopen checks (#1690 finding 3). Readiness estimates unchanged. +> **Printing update:** 2026-10-12 · direct desktop printing through craft-print; details below. ## Headline numbers (2026-10-10) @@ -58,7 +60,9 @@ discounts and the user evidence (120 issues from outside users, 4 praise, 0 "swi **Why alpha:** the core workflows (write, format, styles, lists, tables, references, review, mail merge, open and save .docx) work end to end and ship as signed builds on every desktop platform -and the web. **Why not beta:** DOCX has never been tested on real-world files; charts, SmartArt and +and the web. **Why not beta:** DOCX has not been tested on a real-world corpus yet (the opt-in +`cargo xtask docx-corpus` harness can now run one locally, but no corpus or Word comparison is +checked in); charts, SmartArt and OLE objects are dropped silently; pagination differs from Word (no Aptos-metric font, no column balancing or footnote continuation); content controls are lost; there is open field evidence of a startup crash and several hangs; no native printing. Gaps #1–#7 in [`docs/gaps.md`](docs/gaps.md) @@ -119,7 +123,7 @@ Weights and evidence per area: [docs/target-app-parity.md](docs/target-app-parit | English | en | full | 100% | | Simplified Chinese | zh-hans | partial | ~95% | | Spanish | es | partial | ~95% | -| Hindi | hi | none | 0% | +| Hindi | hi | partial (interface catalog, native-speaker reviewed; no proofing) | ~75% (2,800 entries; `cargo xtask i18n-report` lists 801 strings without Hindi) | | Arabic | ar | partial (catalog + mirrored UI; no kashida; no proofing; native review open) | ~95% | | French | fr | partial (interface complete, native-speaker reviewed; spelling from the French Language pack, no grammar marks) | 100% (2,615 entries) | | Portuguese | pt-br (pt-PT none) | partial | ~95% | @@ -151,88 +155,107 @@ Ranked, to beta (detail and remaining milestones in [docs/roadmap.md](docs/roadm ## Progress log +- 2026-12-01: Hindi interface language (`hi`): File › Options › Interface language offers हिन्दी, and `hi`, `hi-IN` and `hi_IN.UTF-8` system locales pick it. The catalog is craft-i18n's `locales/hi/wordcraft.tsv` (`craft-i18n.rev` at 217f413); interface text is drawn by the embedded Noto Sans Devanagari face. No Hindi proofing, so the Hindi interface doesn't set the language of new documents. Readiness estimates unchanged. +- 2026-11-28: Layout indexes numbering definitions for each list and STYLEREF walk. List labels still follow the document's literal labels, start overrides and nested restart rules (#3615). + +- 2026-11-27: Home › Paragraph › Borders with whole table cells selected (the table, rows, columns or a block of cells) borders the cells as one block, as Word does, instead of drawing a box around each paragraph in them: All Borders gives a continuous grid, Outside and Inside follow the block's edges, a single side toggles, and No Border clears the cells (#7874). +- 2026-11-25: Review › Comments › Delete is a split button whose menu has Delete, Delete All Comments in Document and Delete All Resolved Comments, which deletes each resolved comment with its replies and keeps the open ones (`review.deleteComment {"resolved": true}`, #7818). Readiness estimates unchanged. + +- 2026-11-24: Pasting a plain table over selected cells overwrites from the selection's top-left, even when the copy is wider than the selection (#6742). - 2026-11-21: Layout: strict column balancing measures a kept paragraph again in each candidate column, so a float in one column does not make the paragraph skip another where it fits (#6821). Readiness estimates unchanged. - 2026-11-20: `wordcraft-cli mcp` starts only with both `--automation-read-root` and `--automation-write-root` (shared rule 18, #7124); without them it stops with an error naming the two flags, where it used to serve with access to every file the user can reach. `mcp --connect` is refused until the desktop app confines its control channel to the same roots (#3695, #5819). The help, `docs/mcp.md`, the README and `AGENTS.md` pass both roots in every example. - 2026-11-19: Layout: when strict column balancing moves an anchor line to the next column, it releases the floating object's wrap area from the abandoned column (#6821). Readiness estimates unchanged. +- 2026-11-18: DOCX validation reports undeclared binary tombstones in coverage notes when relationship discovery establishes that no relationship targets the part. +- 2026-11-18: DOCX validation excludes the content-type manifest from main-part cardinality and reports untargeted ordinary document parts in coverage when one ordinary main is established. +- 2026-11-18: DOCX validation warns on an image signature mismatch when the image is unused or can be decoded in another raster format. Used, unusable images retain their error. +- 2026-11-18: DOCX validation warns once per duplicated folded font name, including case variants. +- 2026-11-18: DOCX validation reports unattached custom XML schemas in coverage notes because desktop Word opens packages with those references cleanly. Inline custom XML inside revision or move wrappers still fails under `CUSTOMXML-SCHEMA`. +- 2026-11-17: File formats, codecs and protocols now come from the shared libraries (storytold/craft-libs#778): legacy code pages (craft-codepage, #6785), plain-text encoding detection (craft-mime, #6950), the ZIP entry-count guard (craft-zip, #6948), Read Aloud's Speech Dispatcher wire format (craft-ssip, #6951), picture probes for clipboard DIBs, JPEG memory, PNG and WebP (craft-image-codecs, #6949, #6955) and the MCP stdio server (craft-mcp-server, #6956), all with craft-libs pinned at main `93dac78c` (#6954, #6960). Opening documents and pictures behaves as before, except that large non-interleaved JPEGs are refused sooner (a 4:4:4 picture from about 60 Mpx, was 67 Mpx), invalid PNGs are refused more strictly, a lossless WebP's transparency is now seen, and MCP clients get tool errors for unknown or mistyped arguments and a 1,000-message batch cap (docs/mcp.md). The old code stays as test-only references the shared code is checked against. +- 2026-11-17: DOCX charts keep each series' fill, line, markers, smooth lines, data labels and number format, and each axis's title, bounds, number format, gridlines, labels and line, through an open and a save; a vertical axis title is drawn turned. Change Chart Type between a pie or doughnut chart and another type gives the value axis the new type's gridlines and axis line unless it was changed. Picture frame shapes open as rectangles, and a gutter set at the top (`w:gutterAtTop`) is kept on save; layout does not move the gutter to the top. Readiness unchanged. - 2026-11-16: Layout: a row of hyphens after a gap wraps at any hyphen, as in Word (it fills the line and its rest goes on the next), where the whole row moved to the next line. - 2026-11-15: Native, built-in and web Insert/Change Picture choosers offer both TIFF extensions (`.tif`, `.tiff`) alongside other supported pictures; native drops, picked-file inbox dispatch and pasted picture paths recognize the same suffixes (#6704). TIFF decoding remains limited to supported compression. -- 2026-10-31: Screen readers hear what the dialogs and their drawn controls are: a dialog is a dialog, where it was only a window, so NVDA says so and reads the text in it (Word Count's figures); a dialog's tabs (Paragraph, Find and Replace, About) are tabs, the one shown selected, as in Word, where they were buttons read as pressed toggles; a colour field says its label and colour ("Font color: #104861"), where its text alone was the colour's hex digits; and each swatch of the colour grid says its colour, where it had no name. Readiness estimates unchanged. -- 2026-11-01: Screen readers: the formatting shortcuts say what they did, as Word does (Bold On, Bold Off, Center On, Font 14 pt), through a polite live region (checked with NVDA); before, Ctrl+B said nothing. -- 2026-10-30: Home › Paste is named "Paste" for screen readers: its hint adds the key as the platform writes it ("Paste (Ctrl+V)" on Windows and Linux), where the name carried macOS's "⌘V" on every platform. The status bar's page count hints Go To with the platform's key too. Readiness estimates unchanged. - -- 2026-11-17: File formats, codecs and protocols now come from the shared libraries (storytold/craft-libs#778): legacy code pages (craft-codepage, #6785), plain-text encoding detection (craft-mime, #6950), the ZIP entry-count guard (craft-zip, #6948), Read Aloud's Speech Dispatcher wire format (craft-ssip, #6951), picture probes for clipboard DIBs, JPEG memory, PNG and WebP (craft-image-codecs, #6949, #6955) and the MCP stdio server (craft-mcp-server, #6956), all with craft-libs pinned at main `93dac78c` (#6954, #6960). Opening documents and pictures behaves as before, except that large non-interleaved JPEGs are refused sooner (a 4:4:4 picture from about 60 Mpx, was 67 Mpx), invalid PNGs are refused more strictly, a lossless WebP's transparency is now seen, and MCP clients get tool errors for unknown or mistyped arguments and a 1,000-message batch cap (docs/mcp.md). The old code stays as test-only references the shared code is checked against. +- 2026-11-27: Replace with curls a quote typed there when smart quotes are on, as typing does: finding `^034` and replacing with a typed `"` curls stray straight quotes in bulk; `^034` and `^039` stay straight, and a curly quote a typed `'` also finds is left and not counted (#7307). - 2026-11-15: Get the Missing Fonts. A document opened from a file that is missing fonts their publisher gives away (Microsoft's Aptos family, the default in recent Word documents; Cascadia Code and Mono) brings up a box naming each font, the font drawn instead, the publisher's download page and how to install the download, with Don't show this again. `font.missing` reports the same page, so agents get it without the box. WordCraft links to the page only; it downloads and bundles nothing. - 2026-10-30: Track Changes: a list item deleted whole, text and paragraph mark, shows its number as deleted text, in the deletion's colour and with its mark (struck through by default, or caret, #, bold, italic, underline), and hides it with No Markup or when Track Changes Options hide deletions (#4828). Readiness unchanged. - fix/6146-touchpad-scroll-speed +- 2026-11-03: A picture inserted or pasted in a table cell fits the cell, as in Word, instead of running out of it; in text columns it fits the column, in a section with other margins that section's width (#5428). - 2026-11-09: Touchpad and mouse-wheel scroll speed settings (#6146): scales Wayland touchpad point input by default (4×) so two-finger scrolling matches desktop speed rather than crawling 1:1, and scales mouse wheel line distance; File › Options › Advanced › Scrolling; commands ui.scrollSpeed and ui.touchpadScrollSpeed. +- 2026-11-28: Tracked changes made in WordCraft and saved as DOCX or Word XML are dated (`w:date`) in local wall-clock time with a `Z`, as Word writes and reads it, with their UTC time beside it in `w16du:dateUtc` (craft-libs#3220); they were saved in UTC, so Word showed them shifted by the author's offset from UTC (#6851). A change keeps its UTC time and is grouped by it, so two edits an hour apart in the repeated hour as daylight saving time ends stay separate changes, also after a save and reopen. A change read from a file is written as read: open doesn't guess the zone of a `w:date` without `dateUtc`. No ranked gap closed; readiness estimates unchanged. - 2026-11-15: Layout: from Word 2013's layout (compatibility mode 15), balancing the columns before a continuous break keeps the last two, three or five lines of a paragraph that began on the page before together, keeps a two- or three-line paragraph that begins the last page whole, and holds a paragraph with keep lines together (or keep with next) whole in the first column when the strict rules fit. Synthetic tests also cover a footnote and a float (#6821); mode 14 splits them as before. Readiness estimates unchanged. +- 2026-11-15: Layout: the first paragraph of a table cell on a page can split even when only one line fits, if the row starts at the top (possibly below its own headers) or continues from the previous page, and a non-exact row marked Can't Split that is taller than a page splits at the page's end, as in Word, instead of the row running off the bottom of the page (#6823). Readiness estimates unchanged. - 2026-11-14: Save As and Export (also the formats on the Print page) offer Browse in WordCraft… on Linux and the BSDs, as File › Open does, for when the system file dialog doesn't appear (#3535, from VoiceLessQ's #3801). Exporting in the built-in browser lists Export's formats as the types; the chosen type is the format and its extension, which replaces a known document extension on a typed name (`notes.docx` as plain text is `notes.txt`). An export the system dialog's name makes impossible (Word XML over an existing `.xml`) is refused on the Export page itself, not only the hidden status bar. Readiness estimates unchanged. + - 2026-11-14: Review › Language: "Apply to the whole document" sets the proofing language or Do not check spelling for every story (body, headers, footers, notes, comments, text boxes, table cells, glossary) in one undo step, selection unchanged; `review.language` takes `scope: "document"`, default `selection` (#3518). Readiness estimates unchanged. + +- 2026-11-12: #5875 round 18: package entry and availability lookups carry explicit absence/unknown states; the observation gate resolves bounded helper/accessor aliases and pins completeness predicates and reader derives. Qualified standard macros and four inert attributes are supported; named-field bindings and trait bodies remain closed grammar. Synthetic controls only; independent endpoint review remains required and readiness estimates are unchanged. + +- 2026-11-12: #5875 round 15: gate every owner root, report unresolved custom-property checks, suppress unused-comment absence on incomplete memberships, count unowned exclusions as out of scope, and harden the lexical contract gate; synthetic controls only, readiness estimates unchanged. +- 2026-11-12 · #5875 W2: main/glossary/profile and supporting-part selections distinguish one, absent, ambiguous and unknown; fallback has no first-by-ZIP selection. W3–W6 remain outstanding. +- 2026-11-12: #5875 W6 declares bounded observation consumers, generates and gates the register, and carries auxiliary collection loss with per-part facts. The named package-registry exception and intentional global counts remain explicit; synthetic evidence only, independent endpoint review required. +- 2026-11-12: #5875 W5 activates comment-threading checks symmetrically and unifies duplicate relationship-ID binding; synthetic controls and existing optional-part policy preserved. +- 2026-11-12: #5875 W3/W4 attach collection completeness to per-part facts and separate glossary owners; remove unreached-to-main joins. The declared package-registry scope preserves custom-XML declarations and informational comment coverage. Synthetic controls only; estimates unchanged. +- 2026-11-12: Representation lane introduces decimal/hex identity keys and lexical relationship/style types; seven existing ownership expectations exceed the lane's change limit, so ownership migration awaits owner disposition (#5875). +- 2026-11-12: Selected glossary traversal retains nested glossary descendants; main and no-owner fallback exclude transitive glossary subtrees. Direct main reachability still establishes main ownership (#5875). Synthetic controls only; readiness estimates unchanged. +- 2026-11-12: Glossary-typed parts stay outside main ownership; multiple content-type fallback candidates produce glossary ambiguity with no chosen anchor (#5875). Synthetic controls cover both ZIP orders and no-main discovery; readiness estimates unchanged. +- 2026-11-12: Mixed Transitional/Strict package entry points to the same target leave the validator profile uncertain (#5875). Both orders skip document checks with coverage. Distinct competing roots retain ambiguity treatment and independent per-part checks without evaluating the profile gate. Synthetic controls only; readiness estimates unchanged. + fix/6146-touchpad-scroll-speed +- 2026-11-12: Competing distinct official relationship targets leave validator role selection ambiguous (#5875); coverage explains skipped dependent joins in either relationship order. Repeated targets remain unique. Synthetic checks only; readiness and format-fidelity estimates unchanged. + - 2026-11-12: DOCX: `w:lnNumType` without a positive `w:countBy` leaves line numbering off, as Word does, instead of numbering every line on screen, in PDF export and on re-save (#6209). Readiness estimates unchanged. - 2026-11-12: PDF exports and print jobs mark tracked changes in the Track Changes Options colours and marks (insertions blue, deletions red in the reporter's setup), and deletions marked Hidden take no space; without Print Markup the print job lays out the final text, so its page count matches the export. The print preview pages as the job prints, and the preview and downloaded PNGs draw headers and footers at full strength (#5232, #6267). MCP and control-screenshot rendering (#6266), STYLEREF of hidden deletions (#6263) and the preview cache's numeral key (#6265) remain. -- 2026-11-04: Three behaviours lost in the #4501 refactor are back (#4683). From the second section on, headers, footers and note separators are measured with their own section's document grid and SECTION/SECTIONPAGES values, not the previous section's. An ODT paragraph default style that names no font no longer clears the document's default font. A press the canvas handles itself (Ctrl+click on a link, switching into a header or footer, equation entry) no longer also shows the link tooltip in that frame. Readiness unchanged. +- 2026-11-09: Touchpad and mouse-wheel scroll speed settings (#6146): scales Wayland touchpad point input by default (4×) so two-finger scrolling matches desktop speed rather than crawling 1:1, and scales mouse wheel line distance; File › Options › Advanced › Scrolling; commands ui.scrollSpeed and ui.touchpadScrollSpeed. - 2026-11-08: `wordcraft-cli convert --strict` (#6005) and `render --strict` (#6008): a PDF or PNG export (render: the page it writes) refuses, exit 3 and nothing written, when it would draw a character no font has or leave out a picture (missing part, external target, link only, undecodable or unsupported format); the report is on stderr with one JSON line. Engine: `strict: true` on `file.save`, `file.saveAs`, `file.exportPdf` and `file.exportPng`, and the pure `file.strictReport`. External picture targets are never fetched. The result depends on the host's installed fonts (#5624); readiness estimates unchanged. -- 2026-11-05: ODT tables with a usable width keep their column proportions when the file gives only shares (gap 19): LibreOffice's CV template opened and saved with equal columns. -- 2026-11-05: ODT font sizes reach Asian and complex-script text (gap 19): Chinese text set to 24 pt stayed at the default size in LibreOffice. -- 2026-11-05: ODT text can turn off what its style turns on (gap 19): a word not bold in a bold heading showed bold, and came back bold in LibreOffice after a save. -- 2026-11-06: An edited ODT paragraph keeps its custom paragraph style when that style has an outline level, or is based on a heading, Title, Quotations or Preformatted Text (gap 19). It was saved under the built-in style instead, such as WordCraft's blue Heading 1, and looked wrong in LibreOffice; a style with an outline level also drew that way in WordCraft. The style's outline level and numbering still work in WordCraft. -- 2026-11-05: ODT pictures keep the size their file gives (gap 19): opening a file shrank ones wider than the text, so a save with no edit to them changed how LibreOffice laid them out. -- 2026-11-05: ODT frames keep the page they are anchored to (gap 19): written without its number, a frame on page 3 came back on page 1 in LibreOffice after a save. -- 2026-11-05: ODT documents keep their language (gap 19). It was lost on save after numbering or a new style, and LibreOffice then showed the document in its own default language; a document in another language was also proofed as English. -- 2026-11-05: ODT table and row backgrounds are kept (gap 19): they were dropped, and gone in LibreOffice after a save. - 2026-11-08: Proofing: support freestanding custom.dic dictionary files in File › Options › Proofing (#5840). Plain UTF-8 and Word CUSTOM.DIC UTF-16LE with BOM are recognized, merged with disk additions on save, and bounded by byte and word caps. Readiness unchanged. - 2026-11-08: Layout: a turned inline picture whose file keeps no room for the turn (no or a zero `wp:effectExtent`, as other tools write) keeps its line to its frame and overhangs it, cut at the line's top and bottom, as Word does: the frame as it is in Word 2007 layout, with width and height exchanged from 45° to 135° and 225° to 315° in Word 2013+ layout. Such a file saves the same way. Pictures with the room recorded (Word's own files) still take their rotated bounds. Readiness unchanged. - 2026-11-08: XML text and CDATA read with their line ends normalised (XML 1.0 §2.11): CR LF and a lone CR are one line feed, ` ` stays a CR, so a line break inside `w:t` in a file saved with Windows line ends is one space, not two (#5897); readiness estimates unchanged. - 2026-11-08: Layout: contextual spacing drops the space after a table cell's last paragraph when that paragraph is in the Normal style, the end-of-cell mark counting as a Normal paragraph next to it; a last paragraph in another style keeps its space after. The rule is inferred from docxide-pdf's notes and its `cell-end-*` fixtures (`cell-end-text-context`, `cell-end-empty-context`); a Word comparison that tells it apart from the neighbouring paragraph's style is still open. Readiness unchanged. -- 2026-11-06: Arabic interface: the Home tab's Styles gallery reads from the right, as the rest of the mirrored ribbon does (#5566). Normal is the rightmost tile, the next styles follow leftwards and the scroll arrows and More sit at the gallery's left end; left to right is unchanged. Readiness unchanged. -- 2026-11-05: ODT heading text of another size keeps it (gap 19): a smaller word in a heading came back at the heading's size in LibreOffice after a save. -- 2026-11-05: ODT table rows kept from breaking across pages stay so (gap 19): they came back from a save free to break. -- 2026-11-05: ODT: a watermark added, changed or removed, and Different Odd & Even Pages turned on or off, in a file read from ODT are saved. -- 2026-11-05: ODT font declarations are kept (gap 19): replacing them made LibreOffice pick other substitutes for fonts not installed, reflowing a document from 83 pages to 70 on a save with no edits. -- 2026-11-05: ODT pictures offered in several formats show and survive a save (gap 19): LibreOffice's letter templates lost theirs. +- 2026-11-07: Justified paragraphs that start with a tab or contain tabs shrink the spaces after their last tab in Word 2013+ compatibility mode (mode 15), matching Word (#5847). Spaces before the line's last tab remain at their natural width. - 2026-11-07: An in-line picture lowered past its own height (`w:position`) lowers its line as far, as in Word; all 156 synthetic lines measured for #3984 match Word (#5796). Exact spacing keeps the line's baseline. -- 2026-11-03: Search types in place: a click on the title bar's Search box, or Alt+Q, takes the typing in that box, with the results under it, as in Word, instead of a second box in a dialog (#5398). -- 2026-10-31: List labels: a numbering level with format `none` and literal text, such as `RESPONSE:` with a one-inch hanging indent, shows that text as its label, as Word does; it used to show nothing. As in Word, a `none` level still counts and restarts the levels below it, its own number is empty (in legal numbering too), and an empty label still tabs the text to the indent (#4985). Readiness unchanged. -- 2026-10-31: Font menus draw their entries from a few shared textures written in place, as the Equation tab's pictures are (#1002), instead of a texture per font: on Windows (DirectX 12) browsing the list showed the names on black strips in light mode and white or red ones in dark mode (#5105). Readiness unchanged. -- 2026-11-02: A picture linked from its context menu shows its address on hover and opens it with Ctrl/⌘+click, in line or floating, as linked text does; DOCX files keep the link where Word does, on the drawing (`a:hlinkClick`), so links on pictures from Word open too (#5267). Readiness unchanged. -- 2026-11-01: DOCX tables keep rows and cells wrapped in `mc:AlternateContent`, selecting one supported Choice or Fallback with the existing reader policy (#5219). Original synthetic checks cover namespace aliases, unsupported requirements, nested row/cell content controls and two save/reopen cycles; broader corpus and native Word qualification remain open. - -- 2026-11-01: Shapes: a line's arrowheads are as long and as wide as Word draws them: 2, 3 or 5 times the line's width for small, medium and large (a line under 2 points as a 2-point one). Their kind, width and length are read from DOCX (DrawingML and VML) and saved back; before, every arrowhead was one size and saved as a medium triangle. - 2026-11-07: DOCX: a VML text box keeps its text direction: `mso-layout-flow-alt:bottom-to-top` reads as Rotate all text 270° whatever `layout-flow` says, and otherwise `layout-flow:vertical` (or `vertical-ideographic`) as 90°, so the turned text box in a compatibility-mode document's header is drawn turned, as in Word. (#5193) -- 2026-11-06: Change Picture keeps the picture's width and takes the new picture's aspect ratio, dropping the old crop, instead of stretching the new picture into the old frame (a revised figure came out about 2% taller in a real manuscript) (#5761). Readiness estimates unchanged. -- 2026-11-06: Superscript and subscript text is set at 0.65 of its size rounded to the half point, as Word does (8 pt → 5, 11 → 7, 12 → 8, 24 → 15.5; measured in Word for Mac from digit advances with `cargo xtask word-compare`), not 0.65 exactly: lines with citation numbers and footnote references break where Word's do (the Arial superscript and author-line probes now match Word line for line). Readiness estimates unchanged. -- 2026-11-06: Line numbers take the document's "Line Number" style over its defaults, as in Word (Aptos 12 pt black in a manuscript whose defaults are Aptos 12 pt, measured in Word for Mac), instead of a fixed 10 pt grey. Readiness estimates unchanged. - 2026-11-07: Newly opened secondary windows constrain their initial viewport dimensions to the monitor's usable area with margins for system panels, preventing new windows from exceeding screen width on high-DPI scaled displays (#5871). - 2026-11-07: A floating anchor after a page break stays with text on the far side of the same wrapped row (Leaf #107); marker-only cover anchors retain their rule. Picture spacing, drop position, Undo/Redo and DOCX regressions. - 2026-11-07: Vertical scrollbar track: clicking above the elevator advances one screen up and clicking below it advances one screen down, matching Word's behavior, instead of jumping to the clicked document position (#5853). Readiness estimates unchanged. +- 2026-11-06: An edited ODT paragraph keeps its custom paragraph style when that style has an outline level, or is based on a heading, Title, Quotations or Preformatted Text (gap 19). It was saved under the built-in style instead, such as WordCraft's blue Heading 1, and looked wrong in LibreOffice; a style with an outline level also drew that way in WordCraft. The style's outline level and numbering still work in WordCraft. +- 2026-11-06: Arabic interface: the Home tab's Styles gallery reads from the right, as the rest of the mirrored ribbon does (#5566). Normal is the rightmost tile, the next styles follow leftwards and the scroll arrows and More sit at the gallery's left end; left to right is unchanged. Readiness unchanged. +- 2026-11-06: Change Picture keeps the picture's width and takes the new picture's aspect ratio, dropping the old crop, instead of stretching the new picture into the old frame (a revised figure came out about 2% taller in a real manuscript) (#5761). Readiness estimates unchanged. +- 2026-11-06: Superscript and subscript text is set at 0.65 of its size rounded to the half point, as Word does (8 pt → 5, 11 → 7, 12 → 8, 24 → 15.5; measured in Word for Mac from digit advances with `cargo xtask word-compare`), not 0.65 exactly: lines with citation numbers and footnote references break where Word's do (the Arial superscript and author-line probes now match Word line for line). Readiness estimates unchanged. +- 2026-11-06: Line numbers take the document's "Line Number" style over its defaults, as in Word (Aptos 12 pt black in a manuscript whose defaults are Aptos 12 pt, measured in Word for Mac), instead of a fixed 10 pt grey. Readiness estimates unchanged. - 2026-11-06: Windows print submissions run in separate helper processes (#5710). A helper acknowledges cancellation before it stops, so a driver stalled in a cancelled job cannot hold another job’s provider lock. A private temporary PDF and bounded settings messages cross the process boundary; normal shutdown reaps helpers and removes their inputs. The helper erases its plaintext inputs before driver work; a hard app crash during startup can still leave private temporary files. Jobs already sending still complete. Readiness estimates unchanged. - 2026-11-06: File › Print: before sending starts, Cancel printing stops a waiting job, frees the Print page and keeps the settings; a successfully cancelled job is never sent. Cancellation remains available after the last document closes. Quitting cancels waiting jobs and joins jobs already sending (#5710). On Windows, winprint repeats the DEVMODE conversion after sending starts. A stall during that repeat prevents cancellation and can keep shutdown waiting, even before a native job exists. Readiness estimates unchanged. - 2026-11-06: File › Print on Windows no longer waits on printer drivers to list printers (#5710). The list used to wait until each printer's driver said whether it prints on both sides, and a networked printer asleep in power save could keep it empty with Refresh unavailable; now discovery asks no driver (the Windows spooler still supplies the list), and printing still checks the job's options with the driver. The reporter's sleeping printer has not been retested yet. Readiness estimates unchanged. -- 2026-11-04: CLI `convert` rejects a missing or repeated `--format` value before opening the input or writing output, matching the existing page/scale option checks. Readiness estimates unchanged. -- 2026-11-04: MHT import keeps semicolons and escaped quotes inside quoted MIME parameters, so an unrelated parameter cannot supply a false multipart boundary and hide the document text. Readiness estimates unchanged. -- 2026-11-04: Ctrl/Cmd+Shift+V pastes the clipboard as Keep Text Only when no formatting has been picked up (by Ctrl/Cmd+Shift+C or the Format Painter), as in Word for Windows; after either it pastes the formatting, as often as asked until the next Ctrl/Cmd+Shift+C or Format Painter pick replaces it, as in Word, and Ctrl/Cmd+Shift+C no longer arms the Format Painter brush (#1537, #4943; takes over #1562). -- 2026-10-30: Equations: `\int`, `\sum` and the other n-ary operators typed with AutoCorrect wait for their limits. `\int` + Space, then `_0^1` and Space, gives ∫ with its limits and the caret in its operand, and `\int_0^1` typed in one go does the same, since any character that can't continue `\name` corrects it; this is observed in Word for Windows on #4938. Enter or an arrow key builds it without going into the operand, and `∫∫` puts the operand in the inner operator; those two are not observed in Word (#4917). Readiness unchanged. +- 2026-11-05: ODT tables with a usable width keep their column proportions when the file gives only shares (gap 19): LibreOffice's CV template opened and saved with equal columns. +- 2026-11-05: ODT font sizes reach Asian and complex-script text (gap 19): Chinese text set to 24 pt stayed at the default size in LibreOffice. +- 2026-11-05: ODT text can turn off what its style turns on (gap 19): a word not bold in a bold heading showed bold, and came back bold in LibreOffice after a save. +- 2026-11-05: ODT pictures keep the size their file gives (gap 19): opening a file shrank ones wider than the text, so a save with no edit to them changed how LibreOffice laid them out. +- 2026-11-05: ODT frames keep the page they are anchored to (gap 19): written without its number, a frame on page 3 came back on page 1 in LibreOffice after a save. +- 2026-11-05: ODT documents keep their language (gap 19). It was lost on save after numbering or a new style, and LibreOffice then showed the document in its own default language; a document in another language was also proofed as English. +- 2026-11-05: ODT table and row backgrounds are kept (gap 19): they were dropped, and gone in LibreOffice after a save. +- 2026-11-05: ODT heading text of another size keeps it (gap 19): a smaller word in a heading came back at the heading's size in LibreOffice after a save. +- 2026-11-05: ODT table rows kept from breaking across pages stay so (gap 19): they came back from a save free to break. +- 2026-11-05: ODT: a watermark added, changed or removed, and Different Odd & Even Pages turned on or off, in a file read from ODT are saved. -- 2026-11-04: RTF import skips the declared Unicode fallback count even when it exceeds eight fallback units, so longer ANSI alternatives do not leak into the document text. Skipping stays bounded by the available input and ends at a group boundary. Readiness estimates unchanged. +- 2026-11-05: ODT font declarations are kept (gap 19): replacing them made LibreOffice pick other substitutes for fonts not installed, reflowing a document from 83 pages to 70 on a save with no edits. +- 2026-11-05: ODT pictures offered in several formats show and survive a save (gap 19): LibreOffice's letter templates lost theirs. - 2026-11-05: Linux: a WordCraft started by an AppImage app no longer takes that app's file for its own (#5653). The AppImage runtime's `APPIMAGE`, `APPDIR`, `ARGV0` and `OWD` pass to whatever the app starts, so an installed WordCraft opened through `xdg-open` saw another program's `APPIMAGE`, and its self-update replaced that program's file. The app now starts over without those variables unless its executable is under `APPDIR`, so the update goes through the package or plain file it really is. Should starting over fail, the self-update is off in that window and Help › Check for Updates says why. Readiness estimates unchanged. - 2026-11-05: A Word template (`.dotx`, `.dotm`, `.dot`) opened from the file manager, the command line or the Finder starts a new, untitled document based on it, as Word's default verb for a template does (#3433). It opened the template itself, so Save (and AutoSave) wrote over it. The new document is attached to the template and Save asks where to write; a protected template asks for its password and still starts a new document. File › Open and a file dropped on the window still open a template itself, to edit it. - 2026-11-05: Arabic letters join across a change of formatting (gap 16, #4093). Each run was shaped on its own, so a letter at a run's edge took the form of a word's start or end: a coloured letter stood apart, and a word edited with Track Changes on read with a space in it (ال ذكاء). Each run is now shaped knowing the text shown on either side, past hidden or deleted text left out of the view, as for Syriac, Mongolian and the other joining scripts. Readiness estimates unchanged. - 2026-11-05: Shapes, text boxes, groups and drawing canvases in Strict Open XML documents open (#3548). Strict puts them in its one drawing namespace, where Transitional documents use Word 2010's `wps`, `wpg` and `wpc`, and Word writes a Strict text box's text in `wne:txbxContent`; the reader knew neither, so a Strict file opened with its text and no shapes at all. They now read like their Transitional twins and are saved as Transitional. Charts and SmartArt in Strict namespaces are not mapped yet. -- 2026-10-31: Behind a modal dialog the window still moves by its title bar, as in Word for Mac; on macOS WordCraft draws that title bar itself, so the dialog's backdrop had blocked it. The press shakes the dialog, as Word beeps; a drag on the dialog itself, where it reaches over the title bar, moves only the dialog (#5124). -- 2026-10-28: Ink replay, eraser picking, lasso selection and arrow-candidate discovery reuse the paragraph prefixes they have already scanned (#3614). Page item order, stroke geometry and saved data retain their behavior. This narrows the stability work; ink import fidelity, native pen input and broader corpus qualification remain open. -- 2026-10-29: Page drawing finds text-box warps without rescanning the paragraph for every box (#3614). Only requested offsets are indexed, and each paragraph walk stops after its last requested character. Original Linux discovery, complete display-output and CLI/MCP save/reopen controls; native Word comparison untested. Readiness estimates unchanged. -- 2026-10-28: Protected typing boundary lookup counts preceding objects once and indexes editable permission IDs (#3614); caret movement and enforcement policy are unchanged. Existing mutation and protection checks retain their costs; this does not close the broader performance gap. - +- 2026-11-04: Three behaviours lost in the #4501 refactor are back (#4683). From the second section on, headers, footers and note separators are measured with their own section's document grid and SECTION/SECTIONPAGES values, not the previous section's. An ODT paragraph default style that names no font no longer clears the document's default font. A press the canvas handles itself (Ctrl+click on a link, switching into a header or footer, equation entry) no longer also shows the link tooltip in that frame. Readiness unchanged. +- 2026-11-04: CLI `convert` rejects a missing or repeated `--format` value before opening the input or writing output, matching the existing page/scale option checks. Readiness estimates unchanged. +- 2026-11-04: MHT import keeps semicolons and escaped quotes inside quoted MIME parameters, so an unrelated parameter cannot supply a false multipart boundary and hide the document text. Readiness estimates unchanged. +- 2026-11-04: Ctrl/Cmd+Shift+V pastes the clipboard as Keep Text Only when no formatting has been picked up (by Ctrl/Cmd+Shift+C or the Format Painter), as in Word for Windows; after either it pastes the formatting, as often as asked until the next Ctrl/Cmd+Shift+C or Format Painter pick replaces it, as in Word, and Ctrl/Cmd+Shift+C no longer arms the Format Painter brush (#1537, #4943; takes over #1562). +- 2026-11-04: RTF import skips the declared Unicode fallback count even when it exceeds eight fallback units, so longer ANSI alternatives do not leak into the document text. Skipping stays bounded by the available input and ends at a group boundary. Readiness estimates unchanged. - 2026-11-04: OpenDocument files have no display settings any more (gap 19): File › Options › Advanced › OpenDocument files, `file.options` `odf`, `WORDCRAFT_ODF`, the LibreOffice style and custom values are gone. WordCraft makes one choice for each case the standard leaves open, the one the default made, and still follows what a file states ([docs/odf-interpretation.md](docs/odf-interpretation.md)). -- 2026-10-31: Dialogs are modal, as in Word (#3859): while one is open, the ribbon, File, the page and the panes of its document window take no clicks, and typing and shortcuts (Ctrl+O…) do nothing until it closes; WordCraft's own Open/Save As window is modal too. A press beside a modal dialog shakes it a little, so it is clear why nothing behind it reacts (Word beeps); with animation effects off, its border flashes instead. Find and Replace, Symbol, Mark Index Entry, Cross-reference and Insert Merge Field stay modeless, as in Word for Mac 16.114.1 (checked on a newer build than the 16.113.4 the parity target names). - 2026-11-04: OpenDocument files are shown in one of two styles (gap 19): Microsoft Word style, the default, or LibreOffice style (File › Options › Advanced › OpenDocument files; `file.options` `{"odf": {"preset": "word"}}` or `"libreoffice"`; `WORDCRAFT_ODF=word` or `WORDCRAFT_ODF=libreoffice`). Custom stays for one's own value per case; `wordcraft`, the earlier id of Word's style, is still taken. - 2026-11-04: ODT element audit (gap 19, [docs/odt-element-audit.md](docs/odt-element-audit.md)): every element of the ODF 1.3 schema checked against 365 files and a document of our own for each one no file held that a text document can hold (the `presentation:`, `anim:` and `db:` elements only presentations and databases hold stay unseen); all open and save, and a save without edits keeps them (password, number, time and grid form controls included). Over the 220 files from other applications, 177 round-trip pixel-identical, 201 with the same text and 218 with the same page count (the latest measurement, after the groups and form-control work). - 2026-11-04: ODT checked against 220 files from other applications (Microsoft Office, OpenOffice.org, StarOffice, Calligra, Lotus Symphony; local only): every file LibreOffice opens opens again after a WordCraft save (a manifest entry was missing), 166 round-trip pixel-identical and 194 with the same text at the time (an earlier measurement; the element-audit entry above has the current figures); hidden sections stay hidden and unedited lists are written as read (gap 19). + +- 2026-11-04: Table Sort refuses malformed and nonexistent explicit columns before reordering rows (#5531). Omitted column 0, valid columns, header/order/language behavior and Undo/Redo are retained. Original Linux CLI/MCP controls and repeated native/DOCX reopens cover the command; native Word and desktop comparison remain untested. Readiness estimates unchanged. +- 2026-11-03: Search types in place: a click on the title bar's Search box, or Alt+Q, takes the typing in that box, with the results under it, as in Word, instead of a second box in a dialog (#5398). - 2026-11-03: ODT paragraphs holding bookmarks, notes, formulas and objects, and the page-anchored frames before a paragraph, are written as read while unchanged (gap 19); styles of different families sharing a name are kept apart. Over the corpus 123 of 133 files round-trip pixel-identical (118), 132 with the same text, and the attributes and values a save loses fall from 539 to under 315. - 2026-11-03: ODT paragraphs showing text boxes and shapes holding text are written as read while that text is unchanged (gap 19). Over the corpus 111 of 133 files now round-trip pixel-identical (103), the round-trip difference falls from 44k to 39k pixels, and the element kinds a save loses fall from 16 to 8. - 2026-11-03: ODT paragraphs holding comments or tracked changes are written as read while those are unchanged (gap 19): a comment edited, resolved or answered, or a change accepted, sends its paragraph to the model; the file's change regions are kept beside WordCraft's own. Over the corpus the words a save loses fall from 29 to 4. @@ -240,43 +263,10 @@ Ranked, to beta (detail and remaining milestones in [docs/roadmap.md](docs/roadm - 2026-11-03: ODT sections inside text boxes are written as read (gap 19), as LibreOffice's letter and fax templates hold the sender's address; seven of those templates now round-trip pixel-identical; over the corpus 103 of 133 files do (95), the round-trip difference falls from 51k to 44k pixels, and the losses a save makes fall from 59 to 35. - 2026-11-03: ODT saves lose less (gap 19): list styles sharing a paragraph style's name are kept apart (§16.2), named sections around tables (nested too) are written as read, unchanged charts keep their replacement picture, note citations follow the document's numbering, and frames keep their stacking order. Over the 133-file corpus the losses a save makes, file by file, fall from 242 to 59 (19 kinds), with the pages unchanged. - 2026-11-03: ODT form definitions and indexes are written back as read (gap 19): a file's forms keep their settings, properties and event listeners, and an index nobody edited keeps its source settings and entry templates. Over the 133-file corpus the element kinds a save loses fall from 38 to 22 (losses per file 354 → 242), with the pages unchanged (95 pixel-identical, 130 with identical text). + - 2026-11-03: ODT saves without edits lose (almost) nothing (gap 19): tables, page layouts and master pages, named sections, document properties and declarations WordCraft doesn't model are written back as read, and a test saves seven samples of our own and finds nothing missing. Over the 133-file corpus 95 files come back pixel-identical (62 before) and the round-trip difference falls to 51k pixels (191k) - 2026-11-03: ODT saves what WordCraft doesn't model (gap 19): a paragraph nobody edited is written back with its own markup, and while no style changed, the file's own style definitions are written, so unknown elements, attributes, unused list styles and note settings survive a save that doesn't touch them. Over the 133-file corpus (LibreOffice, Google Docs and ONLYOFFICE files) the round-trip difference falls by 64% and 62 files come back pixel-identical (46 before) - 2026-11-03: ODT checked the other way round too (gap 19): 42 documents made in WordCraft (its templates, themes, and one per feature) are saved as ODT and opened in LibreOffice; every one opens with the same page count and passes the ODF 1.3 schema. Found and fixed: table styles were left out of the saved file (now written into each cell), ODT tables were given Word's Table Grid style on opening (which changed their spacing), section columns now say whether they end balanced, and SmartArt diagrams are saved as a group of their shapes and text. The LibreOffice round-trip corpus is at its best yet (40k differing pixels over 125 documents, 42 identical). -- 2026-11-02: ODT files follow their standard wherever it says something, and a setting wherever it doesn't (gap 19). File › Options › Advanced › OpenDocument files (and `file.options` `odf`) chooses between two display styles, Microsoft Word style (the default) and LibreOffice style, or custom values for each of twelve cases the standard leaves open: header heights and spacing, column gaps, shape colours and hairlines, where tab stops are measured from, frame relations the standard doesn't define, and lines of only pictures. A page layout that states no margins follows the setting too: 0 in Microsoft Word style (XSL's initial value), 2 cm for LibreOffice. Every case is listed in docs/odf-interpretation.md; Google Docs and ONLYOFFICE files checked, and neither needs a preset of its own yet. -- 2026-11-02: ODT form controls keep their place on the line and multi-line text fields their lines; custom shapes keep their own geometry (LibreOffice draws its own shape after a save). In-line pictures placed against the text are raised from its size, and saved standing on the baseline. The corpus round-trip difference falls to 41k pixels, 90% below this morning's 408k; 42 of 125 documents round-trip pixel-identical (gap 19). Readiness unchanged. -- 2026-11-02: ODT charts keep their whole look through a save: the chart object as read is written back while the chart is unchanged (edited, it's written from WordCraft's chart). Frames outlined by a drawn stroke keep it, and a header with no stated height is LibreOffice's 0.5 cm. The corpus round-trip difference falls to 47k pixels (408k this morning); 41 of 125 documents round-trip pixel-identical (gap 19). Readiness unchanged. -- 2026-11-17: DOCX charts keep each series' fill, line, markers, smooth lines, data labels and number format, and each axis's title, bounds, number format, gridlines, labels and line, through an open and a save; a vertical axis title is drawn turned. Change Chart Type between a pie or doughnut chart and another type gives the value axis the new type's gridlines and axis line unless it was changed. Picture frame shapes open as rectangles, and a gutter set at the top (`w:gutterAtTop`) is kept on save; layout does not move the gutter to the top. Readiness unchanged. -- 2026-11-02: ODT: saving no longer makes a table's first row repeat on every page (a table style's header row had been taken for Repeat as header row), so LibreOffice's 16 agenda templates round-trip with their text the same; 91 of the 125 corpus documents now do, and the round-trip difference falls to 60k pixels (408k this morning) (gap 19). Readiness unchanged. -- 2026-11-02: ODT documents open with LibreOffice's layout where it differs from Word (new `Settings::odf_layout`): a line of only pictures is as tall as they are, and a paragraph's padding without a border takes room. Unequal columns and column breaks are kept. The corpus round-trip difference falls to 82k pixels, 80% below this morning's 408k; LibreOffice's report templates and one-page résumé now round-trip almost pixel-identical (gap 19). Readiness unchanged. -- 2026-11-02: ODT, from LibreOffice's report templates and agenda: tables filling the margins fit them, and a table's own space above and below is kept and laid out (new `TableProps::space_before`/`space_after`); a header's spacing stays below one taller than its band (new `SectionProps::header_gap`/`footer_gap`); a picture alone in a paragraph keeps the paragraph's size and its raise. The corpus round-trip difference falls from 241k to 155k pixels, 62% below this morning's 408k (gap 19). Readiness unchanged. -- 2026-11-02: ODT: none of the 125 test documents (LibreOffice's 78 templates among them) changes its page count through a WordCraft save any more, and their round-trip difference falls by 40%: the default font size, page-anchored frames, styles used only in text boxes, empty paragraphs' size (a new paragraph-mark field in the flow model) and frames anchored by their style (gap 19). Readiness unchanged. -- 2026-11-02: Emphasis marks (Font › Emphasis mark: a dot, comma or circle over each character, or a dot under it) are new: drawn with room made in the line, set by `format.emphasisMark`, kept in DOCX (`w:em`) and ODT. SET fields now give REF their value, so ODT variables open and update as fields. A page break before a table's first row moves the table, as in Word. ODT: page background pictures, fixed-width tables, tables starting a page, the document's default font size and dates in the locale's order (gap 19). Readiness unchanged. -- 2026-11-02: ODT checked against LibreOffice's own 78 bundled templates (letters, faxes, agendas, reports, CVs), all of which now open and round-trip (gap 19): placeholders ("") open as content controls you click and type over; a "First Page" style followed by another is a different first page; pages without a size take the regional default and LibreOffice's 2 cm margins; WMF and EMF logos are kept; template dates show the day; USERNAME shows your name; hidden form controls and `.ott` templates (open and save, with a password too) are kept. Readiness unchanged. -- 2026-11-01: ODT at ~90% (gap 19): custom shapes LibreOffice draws from formulas (hexagons, smileys, cans, block arcs…) are drawn from their own geometry instead of as rectangles; table cell formulas open as formula fields that Update Field recalculates, and are saved as formulas LibreOffice calculates; macros and other package parts WordCraft doesn't read are kept on save; text turned down or up in table cells and text boxes stays turned; form controls keep their size, and buttons survive as buttons. Every change checked against LibreOffice by round trips compared page by page and against the ODF 1.3 schema. Readiness unchanged. -- 2026-11-01: ODT read and written nearly whole (gap 19, ~82%): drawing shapes, groups, rotation, arrowheads, dashes, gradients, polygons and paths; tables of contents and indexes (with their marks, so Update Index rebuilds them); bookmarks over text; dates in their formats, sequences, captions, chapters and references; page settings (page colour, borders, note numbering, line numbering); flat `.fodt`; drop caps; tracked formatting changes; charts, opened as editable charts and saved as LibreOffice charts; embedded spreadsheets and OLE objects kept whole (they were lost); form controls as content controls; password-protected files (LibreOffice's AES encryption) opened and saved; ruby; page breaks after paragraphs, kept lines, widow control, hyphenation, table alignment and row heights. Layout: in-line pictures move with their run's raise or lowering, and text in a turned text box turns with it. Every change checked against LibreOffice by round trips compared page by page and against the ODF 1.3 schema. Readiness unchanged. -- 2026-11-01: ODT: text boxes keep their text on open (it was dropped) and save as text boxes (gap 19). Readiness unchanged. -- 2026-11-01: ODT: saved files carry LibreOffice's layout settings (the file's own, or Word-compatible ones), so LibreOffice lays them out as WordCraft does; list items keep their contextual spacing (gap 19). Readiness unchanged. -- 2026-11-01: ODT: custom character styles stay styles on open and save (gap 19). Readiness unchanged. -- 2026-11-01: ODT: custom paragraph styles (LibreOffice's Text body, your own) stay styles on open and save; their formatting used to become direct formatting (gap 19). Readiness unchanged. -- 2026-11-01: ODT: equations are saved as LibreOffice formula objects (MathML), so they stay equations in LibreOffice; they were saved as plain text (gap 19). Readiness unchanged. -- 2026-11-01: ODT: floating pictures keep their position and text wrapping on open and save; they used to drop into the text line (gap 19). Readiness unchanged. -- 2026-11-01: ODT: paragraph borders and background colours open and save (gap 19). Readiness unchanged. -- 2026-11-01: ODT: numbered headings (1., 1.1.) keep their numbers on open and save (gap 19). Readiness unchanged. -- 2026-11-01: ODT: table cell borders and padding open and save; saved tables no longer draw doubled lines or a grid on borderless tables (gap 19). Readiness unchanged. -- 2026-11-01: ODT: headings, titles and quotations look as the file defines them on open, and as WordCraft defines them after a save (gap 19). Readiness unchanged. -- 2026-11-01: ODT: tab stops and their leaders open and save, at the positions LibreOffice shows (gap 19). Readiness unchanged. -- 2026-11-01: ODT: underline styles, double strike, caps, small caps, hidden text, letter spacing, scale, raised text, outline, shadow, relief and language open and save; monospaced fonts keep their names, and LibreOffice's default kerning is kept so lines break as they did (gap 19). Readiness unchanged. -- 2026-10-31: ODT: lists keep their numbering (i., A., (1), bullets) and stay separate lists as in LibreOffice; consecutive lists used to merge into one decimal list (gap 19). Readiness unchanged. -- 2026-10-31: ODT: comments open and save with their ranges, replies and resolved state, as LibreOffice keeps them (gap 19; they were dropped on open). Readiness unchanged. -- 2026-10-31: ODT: footnotes and endnotes open and save (they were dropped on open), as Word-style note stories with their custom marks (gap 19). Readiness unchanged. -- 2026-10-31: ODT: headers and footers are saved (they were dropped on every save), each page's header sits where LibreOffice puts it on open, and page numbers, page counts, dates and other text fields open as fields that update and are saved as ODF fields (gap 19). Readiness unchanged. -- 2026-10-31: ODT: paragraph spacing, indents and line spacing are read and written, and an ODT's own default spacing (none, single lines) replaces Word's 8 pt after and 1.15 lines, so LibreOffice documents keep their vertical rhythm on open and save (gap 19). Readiness unchanged. -- 2026-11-01: PDF export, printing and page images show the body's SEQ, STYLEREF and REF fields with their current results, as Word fills them in when it prints or exports even with Update fields before printing off: a caption numbered 7 when it is the first shows 1 on paper, and a REF to a bookmark the document lacks prints Word's "Error! Reference source not found.". NUMWORDS, FILENAME, the document properties, formulas and locked fields keep their stored results there, as in Word; the editor and the saved document keep every stored result. -- 2026-10-31: PDFs, prints and page images show each `PAGEREF` in the body with the page its bookmark is on, as Word fills them in when it prints or exports, so a table of contents saved with stale page numbers prints the pages its headings are on; on screen they keep their stored result until fields are updated, as in Word, and a locked one keeps it everywhere. A reference to a bookmark the document lacks prints Word's "Error! Bookmark not defined." Readiness unchanged. -- 2026-10-28: Print Markup HTML, Markdown and text copies discover comment anchors in one paragraph walk, so unrelated bookmark markers no longer cause repeated prefix scans (#3614). Existing quotes, replies, order and export limits are unchanged; original synthetic semantic and scaling regressions cover the traversal. -- 2026-11-04: Table Sort refuses malformed and nonexistent explicit columns before reordering rows (#5531). Omitted column 0, valid columns, header/order/language behavior and Undo/Redo are retained. Original Linux CLI/MCP controls and repeated native/DOCX reopens cover the command; native Word and desktop comparison remain untested. Readiness estimates unchanged. -- 2026-10-30: Layout resource caps (#3867, #4385) and linear-time passes (#3866, #4392): repeated table-header rows are capped by item counts, a clipped group counting every nested member, the wrap cache by decoded pixels and the widths a linked text box chain lays out by their lines and items; PDF export, hit testing, tracked-change and clipped-table costs, and long endnote selections no longer grow quadratically. Synthetic regression tests only; no new Word comparison. - 2026-11-03: Proofing (CP4.3): craft-proof moves to craft-libs main with #589 and #590. French spelling suggestions offer the elided form first (`Jadore` → `J'adore`, before `J adore`), and Valencian text (`ca-ES-valencia`) is proofed with the `ca-valencia` pack instead of plain Catalan. Readiness unchanged. - 2026-11-03: Security: PDF export leaves the document's author out of the PDF's properties when "Remove personal information from file properties on save" is on, as DOCX saving already does. Readiness unchanged. - 2026-11-03: A long comment no longer grows its card or balloon without limit (#3382). Its field in the Comments pane and in a selected balloon stops at ten lines and scrolls, keeping the caret in view; a balloon that isn't selected shows the first ten lines of the comment and of each reply, and clicking it opens the scrolling field. The buttons and the next comment stay in view. @@ -308,294 +298,344 @@ Ranked, to beta (detail and remaining milestones in [docs/roadmap.md](docs/roadm - 2026-11-03: Language lists (CP4.3): a language installed from a Language pack (Bulgarian, say) can now be chosen. Set Proofing Language lists every built-in language and every installed or available pack's, each once and sorted by name; Review › Language and the status bar's menu add the installed packs' languages to the short list, with one way of working out the check mark, by tag. A pack's language is stored as a tag that finds the pack again (`sr-Latn-RS` is proofed by the Latin `sr-latn` pack, not the Cyrillic one; Valencian is Word's `ca-ES-valencia`). Every pack in language-packs-2 now has an English name (Belarusian used to show its own name, Беларуская). Readiness unchanged. - 2026-11-03: Language packs (CP4.3): on a fresh install (or after an upgrade, with the list cached for an older pin) the missing-pack bar still offers a document language that has no dictionary, "Turkish proofing isn't installed. Install": the person's click turns on downloading, fetches the list and installs the pack if it lists one (if not, the bar goes). With downloading already on, a missing or stale list is fetched once in the background. Choosing a language with only the caret counts before anything is typed, and the spelling context menu's heading (Possible spelling mistake) is in the interface language, not the text's. Closing the bar is remembered per document, per pack and, before the list is known, per language tag. Readiness unchanged. - 2026-11-03: Options › Language (CP4.3): **Your languages** lists English, every installed Language pack and the languages of the open document, each with where its proofing comes from (Built in, Installed, Your own dictionary, System dictionary, Grammar built in, Not available yet) and Install, Remove and Set as default; **Add a language…** opens a picker with search (dutch, nederlands, nl), sorted by name, and its first click is the consent to download. The Dictionaries folder moved here from Options › Proofing, with a Dictionary files list of the file each language found (#1063). Gap 8. +- 2026-11-02: A picture linked from its context menu shows its address on hover and opens it with Ctrl/⌘+click, in line or floating, as linked text does; DOCX files keep the link where Word does, on the drawing (`a:hlinkClick`), so links on pictures from Word open too (#5267). Readiness unchanged. +- 2026-11-02: ODT files follow their standard wherever it says something, and a setting wherever it doesn't (gap 19). File › Options › Advanced › OpenDocument files (and `file.options` `odf`) chooses between two display styles, Microsoft Word style (the default) and LibreOffice style, or custom values for each of twelve cases the standard leaves open: header heights and spacing, column gaps, shape colours and hairlines, where tab stops are measured from, frame relations the standard doesn't define, and lines of only pictures. A page layout that states no margins follows the setting too: 0 in Microsoft Word style (XSL's initial value), 2 cm for LibreOffice. Every case is listed in docs/odf-interpretation.md; Google Docs and ONLYOFFICE files checked, and neither needs a preset of its own yet. +- 2026-11-02: ODT form controls keep their place on the line and multi-line text fields their lines; custom shapes keep their own geometry (LibreOffice draws its own shape after a save). In-line pictures placed against the text are raised from its size, and saved standing on the baseline. The corpus round-trip difference falls to 41k pixels, 90% below this morning's 408k; 42 of 125 documents round-trip pixel-identical (gap 19). Readiness unchanged. +- 2026-11-02: ODT charts keep their whole look through a save: the chart object as read is written back while the chart is unchanged (edited, it's written from WordCraft's chart). Frames outlined by a drawn stroke keep it, and a header with no stated height is LibreOffice's 0.5 cm. The corpus round-trip difference falls to 47k pixels (408k this morning); 41 of 125 documents round-trip pixel-identical (gap 19). Readiness unchanged. +- 2026-11-02: ODT: saving no longer makes a table's first row repeat on every page (a table style's header row had been taken for Repeat as header row), so LibreOffice's 16 agenda templates round-trip with their text the same; 91 of the 125 corpus documents now do, and the round-trip difference falls to 60k pixels (408k this morning) (gap 19). Readiness unchanged. +- 2026-11-02: ODT documents open with LibreOffice's layout where it differs from Word (new `Settings::odf_layout`): a line of only pictures is as tall as they are, and a paragraph's padding without a border takes room. Unequal columns and column breaks are kept. The corpus round-trip difference falls to 82k pixels, 80% below this morning's 408k; LibreOffice's report templates and one-page résumé now round-trip almost pixel-identical (gap 19). Readiness unchanged. +- 2026-11-02: ODT, from LibreOffice's report templates and agenda: tables filling the margins fit them, and a table's own space above and below is kept and laid out (new `TableProps::space_before`/`space_after`); a header's spacing stays below one taller than its band (new `SectionProps::header_gap`/`footer_gap`); a picture alone in a paragraph keeps the paragraph's size and its raise. The corpus round-trip difference falls from 241k to 155k pixels, 62% below this morning's 408k (gap 19). Readiness unchanged. +- 2026-11-02: ODT: none of the 125 test documents (LibreOffice's 78 templates among them) changes its page count through a WordCraft save any more, and their round-trip difference falls by 40%: the default font size, page-anchored frames, styles used only in text boxes, empty paragraphs' size (a new paragraph-mark field in the flow model) and frames anchored by their style (gap 19). Readiness unchanged. +- 2026-11-02: Emphasis marks (Font › Emphasis mark: a dot, comma or circle over each character, or a dot under it) are new: drawn with room made in the line, set by `format.emphasisMark`, kept in DOCX (`w:em`) and ODT. SET fields now give REF their value, so ODT variables open and update as fields. A page break before a table's first row moves the table, as in Word. ODT: page background pictures, fixed-width tables, tables starting a page, the document's default font size and dates in the locale's order (gap 19). Readiness unchanged. +- 2026-11-02: ODT checked against LibreOffice's own 78 bundled templates (letters, faxes, agendas, reports, CVs), all of which now open and round-trip (gap 19): placeholders ("") open as content controls you click and type over; a "First Page" style followed by another is a different first page; pages without a size take the regional default and LibreOffice's 2 cm margins; WMF and EMF logos are kept; template dates show the day; USERNAME shows your name; hidden form controls and `.ott` templates (open and save, with a password too) are kept. Readiness unchanged. - 2026-11-02: Language packs (CP4.4): craft-i18n's first pack release, language-packs-1, is published and WordCraft pins its index (sha256): 61 languages install from File › Options › Language, among them Lithuanian (#4707), Romanian (#3438), Catalan (#2895, #4947), French (#1325), Greek (#2561), Slovak (#3806), Serbian (#4968) and Latvian (#4438). Dutch (#4145, #2505), German and the other compounding languages wait on craft-proof engine support. Readiness unchanged. +- 2026-11-02: Page break before applies to a paragraph opening a continuous section mid-page in paginated layout (#5287). The original Word for Mac 16.113 probe puts each heading on a new page. At the top of a later column in such a section, the break also starts a new page; that case remains unmeasured in Word. Readiness unchanged. +- 2026-11-01: Screen readers: the formatting shortcuts say what they did, as Word does (Bold On, Bold Off, Center On, Font 14 pt), through a polite live region (checked with NVDA); before, Ctrl+B said nothing. +- 2026-11-01: DOCX tables keep rows and cells wrapped in `mc:AlternateContent`, selecting one supported Choice or Fallback with the existing reader policy (#5219). Original synthetic checks cover namespace aliases, unsupported requirements, nested row/cell content controls and two save/reopen cycles; broader corpus and native Word qualification remain open. +- 2026-11-01: Shapes: a line's arrowheads are as long and as wide as Word draws them: 2, 3 or 5 times the line's width for small, medium and large (a line under 2 points as a 2-point one). Their kind, width and length are read from DOCX (DrawingML and VML) and saved back; before, every arrowhead was one size and saved as a medium triangle. +- 2026-11-01: ODT at ~90% (gap 19): custom shapes LibreOffice draws from formulas (hexagons, smileys, cans, block arcs…) are drawn from their own geometry instead of as rectangles; table cell formulas open as formula fields that Update Field recalculates, and are saved as formulas LibreOffice calculates; macros and other package parts WordCraft doesn't read are kept on save; text turned down or up in table cells and text boxes stays turned; form controls keep their size, and buttons survive as buttons. Every change checked against LibreOffice by round trips compared page by page and against the ODF 1.3 schema. Readiness unchanged. +- 2026-11-01: ODT read and written nearly whole (gap 19, ~82%): drawing shapes, groups, rotation, arrowheads, dashes, gradients, polygons and paths; tables of contents and indexes (with their marks, so Update Index rebuilds them); bookmarks over text; dates in their formats, sequences, captions, chapters and references; page settings (page colour, borders, note numbering, line numbering); flat `.fodt`; drop caps; tracked formatting changes; charts, opened as editable charts and saved as LibreOffice charts; embedded spreadsheets and OLE objects kept whole (they were lost); form controls as content controls; password-protected files (LibreOffice's AES encryption) opened and saved; ruby; page breaks after paragraphs, kept lines, widow control, hyphenation, table alignment and row heights. Layout: in-line pictures move with their run's raise or lowering, and text in a turned text box turns with it. Every change checked against LibreOffice by round trips compared page by page and against the ODF 1.3 schema. Readiness unchanged. +- 2026-11-01: ODT: text boxes keep their text on open (it was dropped) and save as text boxes (gap 19). Readiness unchanged. +- 2026-11-01: ODT: saved files carry LibreOffice's layout settings (the file's own, or Word-compatible ones), so LibreOffice lays them out as WordCraft does; list items keep their contextual spacing (gap 19). Readiness unchanged. +- 2026-11-01: ODT: custom character styles stay styles on open and save (gap 19). Readiness unchanged. +- 2026-11-01: ODT: custom paragraph styles (LibreOffice's Text body, your own) stay styles on open and save; their formatting used to become direct formatting (gap 19). Readiness unchanged. +- 2026-11-01: ODT: equations are saved as LibreOffice formula objects (MathML), so they stay equations in LibreOffice; they were saved as plain text (gap 19). Readiness unchanged. +- 2026-11-01: ODT: floating pictures keep their position and text wrapping on open and save; they used to drop into the text line (gap 19). Readiness unchanged. +- 2026-11-01: ODT: paragraph borders and background colours open and save (gap 19). Readiness unchanged. +- 2026-11-01: ODT: numbered headings (1., 1.1.) keep their numbers on open and save (gap 19). Readiness unchanged. +- 2026-11-01: ODT: table cell borders and padding open and save; saved tables no longer draw doubled lines or a grid on borderless tables (gap 19). Readiness unchanged. +- 2026-11-01: ODT: headings, titles and quotations look as the file defines them on open, and as WordCraft defines them after a save (gap 19). Readiness unchanged. +- 2026-11-01: ODT: tab stops and their leaders open and save, at the positions LibreOffice shows (gap 19). Readiness unchanged. +- 2026-11-01: ODT: underline styles, double strike, caps, small caps, hidden text, letter spacing, scale, raised text, outline, shadow, relief and language open and save; monospaced fonts keep their names, and LibreOffice's default kerning is kept so lines break as they did (gap 19). Readiness unchanged. +- 2026-11-01: PDF export, printing and page images show the body's SEQ, STYLEREF and REF fields with their current results, as Word fills them in when it prints or exports even with Update fields before printing off: a caption numbered 7 when it is the first shows 1 on paper, and a REF to a bookmark the document lacks prints Word's "Error! Reference source not found.". NUMWORDS, FILENAME, the document properties, formulas and locked fields keep their stored results there, as in Word; the editor and the saved document keep every stored result. - 2026-11-01: Language packs (CP4.3–CP4.5): languages beyond English install their spelling dictionary and hyphenation as a pack from File › Options › Language, or from a bar a document in that language shows ("Polish proofing isn't installed. Install (4.6 MB)"), through the font store and its single download setting; About › Language data shows every licence; `proof.packs`, `proof.installPack` and `proof.removePack` for agents. Install works once language-packs-1 is published (until then with a test index); the default build then embeds English data only, and keeps today's carry-over data embedded until then (`cargo xtask language`). Lithuanian (#4707) and Romanian (#3438) are available as a Language pack once language-packs-1 is published; the Dutch, Catalan, French, Greek, Slovak, Serbian and Latvian packs (#4145, #2505, #2895, #4947, #1325, #2561, #3806, #4968, #4438) are defined and wait on craft-proof engine support (FLAG long/num, OCONV, ISO 8859-7, CIRCUMFIX, FULLSTRIP). Readiness unchanged. - 2026-11-01: DOCX tables keep rows and cells wrapped in `mc:AlternateContent`, selecting one supported Choice or Fallback with the existing reader policy (#5219). Original synthetic checks cover namespace aliases, unsupported requirements, nested row/cell content controls and two save/reopen cycles; broader corpus and native Word qualification remain open.- 2026-11-01: Shapes: a line's arrowheads are as long and as wide as Word draws them: 2, 3 or 5 times the line's width for small, medium and large (a line under 2 points as a 2-point one). Their kind, width and length are read from DOCX (DrawingML and VML) and saved back; before, every arrowhead was one size and saved as a medium triangle. - 2026-11-01: Auto interface size is capped so a window of at least 900x460 points fits the smallest screen of the open windows, so a system that reports a huge display scale (an 11-inch 1366x768 panel) no longer pushes the ribbon and File › Options off screen; Ctrl+Shift+0 (Cmd+Shift+0) returns to Auto when no dialog is open and the key isn't bound to a command in Customize Keyboard. Where Shift+0 types another character (`=` on German, Swiss and Nordic layouts) the chord is Ctrl+Shift+=, Superscript, and on Windows Ctrl+Shift+0 is often the input-language hotkey; there File › Options › General › Interface size returns to Auto (#4030). A size chosen in Options is not capped. Where a screen's size is unknown Auto is not capped, and on a screen under 900x460 pixels the cap stops at 100 %, so the window may not fit. -- 2026-11-02: Page break before applies to a paragraph opening a continuous section mid-page in paginated layout (#5287). The original Word for Mac 16.113 probe puts each heading on a new page. At the top of a later column in such a section, the break also starts a new page; that case remains unmeasured in Word. Readiness unchanged. - 2026-11-01: Columns with Line between, made for selected text (a section in the middle of a page), draw their line; the line runs as tall as the section's text on the page, not the whole page (#5178). Readiness unchanged. -- 2026-10-31: `.doc` import: text that names no font takes the stylesheet's standard font, so a Word 365 `.doc` in Aptos opens in Aptos (or its substitute) instead of Times New Roman, the font table's first entry (#5066). Readiness unchanged. -- 2026-10-31: Tables: a row that doesn't fit at the bottom of a page no longer splits off its picture. When a cell's inline picture (one line, which is never split) or first line runs past the room left on a page that already holds something, the row moves to the next page whole instead of leaving the other cells' text beside an empty cell, so a photo row at least 193 pt tall grown to 207 pt by its picture goes on in one piece (#4272). At the top of a page such a row still splits. The reporter's 4-page file is still 5 pages: there the row has less room than its minimum and already moves on whole (#1742); the extra page now comes from the pages above taking more room than in Word. - 2026-11-01: A cell aligned to the middle or bottom of a table row that breaks across pages is aligned within the part of the row left on the page when its text fits there, as in Word, instead of moving to the top of the next page and leaving the cell empty. - 2026-11-01: Tab leaders are drawn as Word draws them: the dots are spaced by their advance in whole 600-dpi pixels (2.64 pt for TH SarabunPSK at 16 pt, not 2.59), from the first place on that grid after the text before the tab to the last one that ends before the text after it. -- 2026-10-31: List numbers count as Word counts them when a deeper item comes first: a list that opens with 10.1–10.4 goes on with 11, not a second 10, and 1.1, 1.2 are followed by 2. A level above that hasn't counted yet takes its first number at the first deeper item. - 2026-11-01: Paragraph side borders lie outside the text, so a thick border no longer covers the first letter (#5036). +- 2026-10-31: Screen readers hear what the dialogs and their drawn controls are: a dialog is a dialog, where it was only a window, so NVDA says so and reads the text in it (Word Count's figures); a dialog's tabs (Paragraph, Find and Replace, About) are tabs, the one shown selected, as in Word, where they were buttons read as pressed toggles; a colour field says its label and colour ("Font color: #104861"), where its text alone was the colour's hex digits; and each swatch of the colour grid says its colour, where it had no name. Readiness estimates unchanged. +- 2026-10-31: List labels: a numbering level with format `none` and literal text, such as `RESPONSE:` with a one-inch hanging indent, shows that text as its label, as Word does; it used to show nothing. As in Word, a `none` level still counts and restarts the levels below it, its own number is empty (in legal numbering too), and an empty label still tabs the text to the indent (#4985). Readiness unchanged. +- 2026-10-31: Font menus draw their entries from a few shared textures written in place, as the Equation tab's pictures are (#1002), instead of a texture per font: on Windows (DirectX 12) browsing the list showed the names on black strips in light mode and white or red ones in dark mode (#5105). Readiness unchanged. +- 2026-10-31: Behind a modal dialog the window still moves by its title bar, as in Word for Mac; on macOS WordCraft draws that title bar itself, so the dialog's backdrop had blocked it. The press shakes the dialog, as Word beeps; a drag on the dialog itself, where it reaches over the title bar, moves only the dialog (#5124). +- 2026-10-31: Dialogs are modal, as in Word (#3859): while one is open, the ribbon, File, the page and the panes of its document window take no clicks, and typing and shortcuts (Ctrl+O…) do nothing until it closes; WordCraft's own Open/Save As window is modal too. A press beside a modal dialog shakes it a little, so it is clear why nothing behind it reacts (Word beeps); with animation effects off, its border flashes instead. Find and Replace, Symbol, Mark Index Entry, Cross-reference and Insert Merge Field stay modeless, as in Word for Mac 16.114.1 (checked on a newer build than the 16.113.4 the parity target names). +- 2026-10-31: ODT: lists keep their numbering (i., A., (1), bullets) and stay separate lists as in LibreOffice; consecutive lists used to merge into one decimal list (gap 19). Readiness unchanged. +- 2026-10-31: ODT: comments open and save with their ranges, replies and resolved state, as LibreOffice keeps them (gap 19; they were dropped on open). Readiness unchanged. +- 2026-10-31: ODT: footnotes and endnotes open and save (they were dropped on open), as Word-style note stories with their custom marks (gap 19). Readiness unchanged. +- 2026-10-31: ODT: headers and footers are saved (they were dropped on every save), each page's header sits where LibreOffice puts it on open, and page numbers, page counts, dates and other text fields open as fields that update and are saved as ODF fields (gap 19). Readiness unchanged. +- 2026-10-31: ODT: paragraph spacing, indents and line spacing are read and written, and an ODT's own default spacing (none, single lines) replaces Word's 8 pt after and 1.15 lines, so LibreOffice documents keep their vertical rhythm on open and save (gap 19). Readiness unchanged. +- 2026-10-31: PDFs, prints and page images show each `PAGEREF` in the body with the page its bookmark is on, as Word fills them in when it prints or exports, so a table of contents saved with stale page numbers prints the pages its headings are on; on screen they keep their stored result until fields are updated, as in Word, and a locked one keeps it everywhere. A reference to a bookmark the document lacks prints Word's "Error! Bookmark not defined." Readiness unchanged. +- 2026-10-31: `.doc` import: text that names no font takes the stylesheet's standard font, so a Word 365 `.doc` in Aptos opens in Aptos (or its substitute) instead of Times New Roman, the font table's first entry (#5066). Readiness unchanged. +- 2026-10-31: Tables: a row that doesn't fit at the bottom of a page no longer splits off its picture. When a cell's inline picture (one line, which is never split) or first line runs past the room left on a page that already holds something, the row moves to the next page whole instead of leaving the other cells' text beside an empty cell, so a photo row at least 193 pt tall grown to 207 pt by its picture goes on in one piece (#4272). At the top of a page such a row still splits. The reporter's 4-page file is still 5 pages: there the row has less room than its minimum and already moves on whole (#1742); the extra page now comes from the pages above taking more room than in Word. +- 2026-10-31: List numbers count as Word counts them when a deeper item comes first: a list that opens with 10.1–10.4 goes on with 11, not a second 10, and 1.1, 1.2 are followed by 2. A level above that hasn't counted yet takes its first number at the first deeper item. - 2026-10-31: Percentage cell widths size table columns as in Word, whichever rows give them: where rows disagree a column takes the largest, a merged cell's percentage is shared by the columns under it, a header row of percentages over rows without cell widths now sets the columns, in autofit and fixed tables, scaled to the table's width or, without one, the text width (a fixed table's grid width); past 100% the columns take their shares left to right until the width runs out, and the ones after it get their longest words, or 2 pt each with their text clipped in a fixed table. Conflicting percentages, unsized columns, spans and absolute widths keep the grid. - 2026-10-31: DOCX: a paragraph naming a style the file doesn't define is formatted as Normal, as in Word, not with the document defaults alone, so a Pandoc footer naming an undefined `Footer` style is as tall as Word's and no longer pushes the last paragraph to the next page (#5077). Readiness unchanged. - 2026-10-31: Table of contents: with Word's table over entries in columns, where the title sits in a one-column section above a continuous break, Insert Table of Contents with new settings keeps the title above the break and the entries in their columns (the new title went under the break, into the columns), and Remove Table of Contents takes the title, the blank paragraph and its break with the entries, as Word does (observed in Word for Mac); a paragraph of another style above the break stays (#4041). - 2026-10-31: A table of contents writes its page numbers as `PAGEREF` fields to the headings' bookmarks, as Word does, so updating the fields in Word moves the numbers with the headings; they were plain text (#5097). - 2026-10-31: Keytips reach the Backstage: Alt, F badges its pages with Word's letters, and Alt, F, P (or V) opens Print (#4960). +- 2026-10-30: Home › Paste is named "Paste" for screen readers: its hint adds the key as the platform writes it ("Paste (Ctrl+V)" on Windows and Linux), where the name carried macOS's "⌘V" on every platform. The status bar's page count hints Go To with the platform's key too. Readiness estimates unchanged. +- 2026-10-30: Track Changes: a list item deleted whole, text and paragraph mark, shows its number as deleted text, in the deletion's colour and with its mark (struck through by default, or caret, #, bold, italic, underline), and hides it with No Markup or when Track Changes Options hide deletions (#4828). Readiness unchanged. +- 2026-10-30: Equations: `\int`, `\sum` and the other n-ary operators typed with AutoCorrect wait for their limits. `\int` + Space, then `_0^1` and Space, gives ∫ with its limits and the caret in its operand, and `\int_0^1` typed in one go does the same, since any character that can't continue `\name` corrects it; this is observed in Word for Windows on #4938. Enter or an arrow key builds it without going into the operand, and `∫∫` puts the operand in the inner operator; those two are not observed in Word (#4917). Readiness unchanged. +- 2026-10-30: Layout resource caps (#3867, #4385) and linear-time passes (#3866, #4392): repeated table-header rows are capped by item counts, a clipped group counting every nested member, the wrap cache by decoded pixels and the widths a linked text box chain lays out by their lines and items; PDF export, hit testing, tracked-change and clipped-table costs, and long endnote selections no longer grow quadratically. Synthetic regression tests only; no new Word comparison. +- 2026-10-29: Page drawing finds text-box warps without rescanning the paragraph for every box (#3614). Only requested offsets are indexed, and each paragraph walk stops after its last requested character. Original Linux discovery, complete display-output and CLI/MCP save/reopen controls; native Word comparison untested. Readiness estimates unchanged. +- 2026-10-29: Documents with hyperlinks or a table of contents print again on the desktop (#4734). The print job scales each page to the paper, and the spooler refused a page with link annotations ("flatten page annotations before using shrink-to-fit"); the PDF sent to the printer now omits link annotations, which print nothing; the link and table-of-contents text stays on the page. Exported PDFs and Save these pages as PDF (`file.printPdf`) keep the annotations. +- 2026-10-29: Increase/Decrease Font Size and the one-point shortcuts change each selected run from its own resolved size, retaining mixed-size formatting, inherited styles and one-step Undo (#4903). Existing size steps and limits stay unchanged. - **2026-10-31 (#3398):** General Options offers persistent Document background / Soft green / Warm cream / Soft gray screen paper. The view.paperColor command reaches the same setting headlessly. Document page colors and pictures, saves, printing and exports retain their own styling; the screen raster/tile cache and page backing share the selected color. Read Mode None uses the preset; explicit Sepia/Inverse keep priority. Parity counts and readiness estimates unchanged. - **2026-10-31 (#3693, editing extension):** Delete Previous Sentence is a headless registry command and Mod+Shift+Backspace shortcut, using existing sentence boundaries and deletion/undo/protection paths. Paragraph and cell boundaries are preserved. Additional WordCraft behavior; Word-parity counts and estimates unchanged. -- 2026-10-29: Documents with hyperlinks or a table of contents print again on the desktop (#4734). The print job scales each page to the paper, and the spooler refused a page with link annotations ("flatten page annotations before using shrink-to-fit"); the PDF sent to the printer now omits link annotations, which print nothing; the link and table-of-contents text stays on the page. Exported PDFs and Save these pages as PDF (`file.printPdf`) keep the annotations. +- 2026-10-29: Saving a DOCX with many comments no longer searches all comment paragraph IDs and all reserved durable IDs for each comment. Paragraph IDs use their existing sorted order; durable-ID reservations are indexed once. Parent links, resolved flags, authored text and existing ID rules are unchanged. +- 2026-10-29: Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880). Labels → New Document with one label per recipient includes every selected address, with unused labels blank on the final sheet. Fixed-text and single-label output remain one sheet. Finish & Merge template expansion is separate. +- 2026-10-29: HTML import keeps preformatted lines with CR, CRLF or LF input newlines (#4810); numeric character references retain their separate meaning; readiness estimates unchanged. + +- 2026-10-29: Built-in citation refresh indexes source tags and bibliography numbers for each operation (#4888). Existing ordering, duplicate-tag first matches and saved sources remain unchanged. + +- 2026-10-28: Ink replay, eraser picking, lasso selection and arrow-candidate discovery reuse the paragraph prefixes they have already scanned (#3614). Page item order, stroke geometry and saved data retain their behavior. This narrows the stability work; ink import fidelity, native pen input and broader corpus qualification remain open. +- 2026-10-28: Protected typing boundary lookup counts preceding objects once and indexes editable permission IDs (#3614); caret movement and enforcement policy are unchanged. Existing mutation and protection checks retain their costs; this does not close the broader performance gap. + +- 2026-10-28: Print Markup HTML, Markdown and text copies discover comment anchors in one paragraph walk, so unrelated bookmark markers no longer cause repeated prefix scans (#3614). Existing quotes, replies, order and export limits are unchanged; original synthetic semantic and scaling regressions cover the traversal. + - 2026-10-28: Word count counts each Chinese and Japanese character as a word, as Word does, in the status bar, the Word Count dialog and NUMWORDS fields. Unspaced Chinese text used to count as one word per run of text; Korean, which is written with spaces, still counts by words. (#4547) + - 2026-10-28: Aligned-copy review fixes keep the document axis locked through middle-button scrolling and let Ctrl/Command+Shift start on a secondary selected object. Plain Ctrl and Shift clicks keep their existing behavior (#4764). - 2026-10-28: Ctrl/Command+Shift copies a selected floating picture, shape or text box along its dominant axis (#4764); inline copies keep the text cursor. Guides on the free axis, original/clipboard/selection, cancel, protection and history are covered by synthetic Linux tests. Native desktop and Word untested; readiness unchanged. - - 2026-10-28: Charts and SmartArt draw text their font lacks in a fallback face, as body text does: Chinese titles, axis labels and legends no longer show boxes (#4720). A run of such characters takes one face that covers it all, so a label doesn't mix serif and sans glyphs; bold labels stay bold. - 2026-10-28: Custom document properties retain their bookmark link targets through DOCX saves, native JSON reopens, value edits and dialog renames (#4767). Linked values are not evaluated; the existing dialog and field-update behavior are unchanged. Original fixtures cover ordinary and raw property values; broader corpus qualification and readiness estimates remain unchanged. - -- 2026-10-29: Increase/Decrease Font Size and the one-point shortcuts change each selected run from its own resolved size, retaining mixed-size formatting, inherited styles and one-step Undo (#4903). Existing size steps and limits stay unchanged. - - 2026-10-28: Convert Notes walks reference offsets and formatting runs together instead of rescanning all references for every run (#4750). Note text, IDs, custom marks, styles, history and saved content retain their behavior. Synthetic scaling, CLI/MCP and native/DOCX reopen coverage; readiness estimates unchanged. - -- 2026-10-29: Saving a DOCX with many comments no longer searches all comment paragraph IDs and all reserved durable IDs for each comment. Paragraph IDs use their existing sorted order; durable-ID reservations are indexed once. Parent links, resolved flags, authored text and existing ID rules are unchanged. - - 2026-10-28: RTF import keeps pictures stored as Windows Metafiles (`\wmetafile8`, as Word writes a pasted or floating picture) and Enhanced Metafiles (`\emfblip`); they were dropped, so such a document opened without its pictures. They are drawn by the metafile renderer, saved to .docx as `.wmf`/`.emf` media, and saved to .rtf as metafiles again (RTF export dropped them too). (#4259) -- 2026-10-26: Thirteen dialogs group related settings in theme-aware panels with indented contents; tall dialogs scroll only when needed (#4035, #4038). -- 2026-10-27: File › Options › Proofing › AutoCorrect Options opens with no document open (#4585). On the Start screen, or after closing the last document, the button did nothing: AutoCorrect wasn't among the commands allowed without a document. Its options are user preferences, so changes made there are kept for the next document. -- 2026-10-29: Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880). Labels → New Document with one label per recipient includes every selected address, with unused labels blank on the final sheet. Fixed-text and single-label output remain one sheet. Finish & Merge template expansion is separate. -- 2026-10-29: HTML import keeps preformatted lines with CR, CRLF or LF input newlines (#4810); numeric character references retain their separate meaning; readiness estimates unchanged. -- 2026-10-27: File › Print: Return prints, as in Word, where ⌘P opens on Print as the default button; a field or list on the page keeps Return while it has the keyboard. - 2026-10-28: A window restored to a place no monitor covers now opens centred on the primary monitor. Before, a monitor replaced by one of the same size left the window off screen, and the app seemed to close as soon as it started. -- 2026-10-29: Built-in citation refresh indexes source tags and bibliography numbers for each operation (#4888). Existing ordering, duplicate-tag first matches and saved sources remain unchanged. +- 2026-10-27: File › Options › Proofing › AutoCorrect Options opens with no document open (#4585). On the Start screen, or after closing the last document, the button did nothing: AutoCorrect wasn't among the commands allowed without a document. Its options are user preferences, so changes made there are kept for the next document. +- 2026-10-27: File › Print: Return prints, as in Word, where ⌘P opens on Print as the default button; a field or list on the page keeps Return while it has the keyboard. +- 2026-10-26: Thirteen dialogs group related settings in theme-aware panels with indented contents; tall dialogs scroll only when needed (#4035, #4038). +- 2026-10-26: Lines on the page: a selected floating line shows a handle at each end, as a connector does and as in Word, and dragging one moves that end (lines don't glue to shapes); pressing anywhere else on it moves it. A level line (0 high, as Word files store a rule) used to show the frame's top and bottom handles on itself, so pressing it in the middle resized it into a slant; and moving any object no longer re-applies the minimum size to a size the move doesn't change, which gave a level line a 4 pt height. A turned line's or connector's ends are where they are drawn. + - 2026-10-25: Select Recipients detects comma, semicolon and tab separators across quoted multiline headers. Quoted punctuation and doubled quotes stay in their cells; detection stops at the first unquoted record boundary. Existing tie preferences and parsing behavior remain unchanged. - 2026-10-25: Built-in styles and table styles write `w:bCs` beside `w:b` and `w:iCs` beside `w:i` in `word/styles.xml`, and `styles.modify` sets complex-script bold and italic alongside Latin when not given separately, so Arabic and Hebrew table headers and styled emphasis open bold or italic in Word and LibreOffice (#4198). +- 2026-10-25: Interface catalogs are still the shared storytold/craft-i18n ones embedded from `craft-i18n.rev` (`9205108c…`): 27 WordCraft languages with English fallback for missing strings, and the equation “Delete Around Caret in Equation” translation preserved. Native-speaker review remains human. +- 2026-10-25: Input methods (egui 0.37): character- and byte-counted surrounding deletions, a fresh composition after body/equation replacement, rejection of queued stale replacements before mutation, transactional equation deletes and one undo group, with tracked and placeholder length mapping. Synthetic regressions document these paths; managed CI passed, and native IME acceptance (#155–#164) plus browser IME behavior remain open. +- 2026-10-25: Justified and distributed lines keep the width of the spaces before their first character, as Word does: Thai official letters indent paragraphs with a run of spaces, and their first line no longer moves right by the line's slack (86 pt in a measured case). A distributed line's text reaches the margin even when the line ends with the space it wrapped at. +- 2026-10-25: Text Highlight Color shows the last colour as the button's bar in the ribbon and mini toolbar; after No Color it shows the pen without a misleading yellow bar, and the button removes highlighting (#4087). +- 2026-10-25: Track Changes: when the heading AutoFormat removes tabs the same author typed, or the border-line AutoFormat puts a border on the first paragraph of a story, the formatting change is recorded under the author making it. Another author's earlier formatting change on that paragraph is replaced, so the change is no longer credited to that author and Reject All brings back the paragraph as that author left it. +- 2026-10-24: Parity catalog: Read Mode's View menu has its own rows. Column Width (`view.readColumnWidth`) and Page Color (`view.readPageColor`) count as live; Layout (`view.readLayout`) is listed as missing. Catalog 504/520 (96.9%). +- 2026-10-24: Find and Replace: with Regular expressions on, Replace with expands capture groups instead of inserting them as typed. `(\w+), (\w+)` replaced with `$2 $1` or `\2 \1` swaps the words, and `(?\d{4})-` with `${y}/` names a group; `$0` is the whole match, `$$` a dollar sign, `\t` a tab and `\n` a paragraph mark that splits the paragraph, as `^p` does. Missing or out-of-range groups expand to nothing, and the `^` codes still work (#4177). +- 2026-10-24: A click just outside a floating table, within 2pt of a cell whose text is turned (Text Direction, or a section whose text runs down or up the page), goes to the text beside or after the table, as it already did by upright cell text, instead of putting the caret in that cell (#4181). +- 2026-10-24: Exact line spacing fixes the floating-table contact boundary independently of paragraph-mark metrics (#3977). Both row selection and word skipping use it; original regressions cover oversized and undersized marks, contact and one-twip offsets in modes 11/12/14/15. Shape behavior is unchanged. +- 2026-10-24: A line touching a floating table at its bottom edge keeps clear of the table (#3977), in both row-span selection and word skipping. Shapes keep their strict overlap rule. Original Source Sans 3 boundary and narrow-strip controls cover modes 11/12/14/15; the expected Word distinction is cyril265's Word for Mac 16.114.1 observation. +- 2026-10-24: AutoFormat As You Type has "Built-in Heading styles" (off by default): pressing Enter twice after a line of five or fewer words that ends in a letter or digit makes it Heading 1, or Heading 2 or 3 when the line starts with one or two tabs. +- 2026-10-24: AutoFormat: a paragraph numbered through its style (a heading in a heading-linked Multilevel List) keeps `---` and `+---+` as text on Enter, as a paragraph numbered directly does. At the top of the document the border-line AutoFormat removed the characters and switched off the heading's number, and left no border. +- 2026-10-24: Spelling: with Ignore web and file addresses on, a web or e-mail address after a no-break space or an ideographic space is skipped, as it is after a plain space. Its words were marked as misspelled. +- 2026-10-24: AutoFormat As You Type has "Set left- and first-indent with tabs and backspaces" (off by default): Tab at the start of a paragraph with text indents its first line, Tab at the start of a later line indents the whole paragraph, and Backspace at the start takes the indents back. +- 2026-10-24: AutoCorrect: a word typed after a no-break space or an ideographic space is corrected as after a plain space (replacements, sentence capitals, ordinals and links). AutoCorrect left such a word as typed. +- 2026-10-24: MCP `type_text` with `paragraphs: true` is one command (#3973): it was a `text.newParagraph` and a `text.insert` per line, each snapshotting the whole document for Undo, so 10,000 lines took 2.8 s (doubling the lines cost 2.4–3.2×) and left an Undo step per line; now they take ~10 ms (linear) and one Undo takes them all back. A CRLF is one break, not two, and the breaks no longer run AutoCorrect (the per-line way capitalised every line but the last). Typed line breaks are the Enter key, so in a one-line content control, where Enter does nothing, they no longer split it into paragraphs. +- 2026-10-24: Track Changes: the border-line (`---` and the others) and `+---+` table AutoFormats mark the typed characters deleted instead of removing them, so Reject All brings them back. Characters the same author typed with tracking on are removed, as a tracked Backspace removes them. A border at the top of a story is a tracked formatting change too, as the border on the paragraph above already was. The table is inserted untracked, as Insert › Table inserts one. A line that holds a tracked deletion no longer triggers either AutoFormat. +- 2026-10-23: Headers and footers: with the caret in a later section's header or footer, Link to Previous, Header/Footer Position, Insert › Header/Footer and Page Borders change that section. They counted the header's paragraphs as body paragraphs, so section 2's header changed section 1 (#3639). +- 2026-10-23: cu20we: DrawingML flat, square and round line caps are imported, saved, displayed and exported to PDF; absent or unknown caps default to flat. VML end caps (including shapetype inheritance) are preserved through DOCX save. Ink and metafile stroke handling remain separate. Synthetic DOCX, raster and PDF regressions cover the change; no new native Word comparison. +- 2026-10-23: cu20we: paragraph-relative box floats start above effective space before; header, footer, cell and text-box layout regressions pass. Framed paragraph positioning is unchanged; no new native Word comparison. +- 2026-10-23: AutoFormat As You Type: `*Bold* and _italic_ as real formatting`. With the option on, `*word*` typed and finished becomes bold and `_word_` italic, without the marks. It is off by default (`tools.autocorrect {"boldItalic"}`). +- 2026-10-23: DOCX: a document whose default font size is unset keeps its size when saved and reopened. The size was left out of the file, and the reader read the missing size as 10 pt while the document resolved it as 11 pt; the file now says 11 pt (`DEFAULT_FONT_SIZE`). Files from other programs without a size are read as before. +- 2026-10-23: Insert › Table: hovering the grid shows the table on the page where it would go, as Word's Live Preview does, and the preview follows the pointer from square to square. It is laid out on a copy of the document, so nothing changes, and Undo has nothing new, until a square is clicked (#3931). +- 2026-10-23: Lists: an empty paragraph whose mark is hidden takes no room and draws no list number, in the body and in table cells, as in Word; the number is still counted, so the next item keeps its place (#3982). +- 2026-10-23: Justified paragraphs: a line ending in a manual line break (Shift+Enter) is stretched to the right margin like a wrapped line, as Word does; it stayed short like the paragraph's last line. A document with Word's `w:doNotExpandShiftReturn` compatibility option keeps such lines short, and the option is read and written back (#3924). +- 2026-10-23: Font dialog: "NaN" or "inf" typed in the Size box previews the text at 12 pt. "NaN" reads as a number, and a font size that is not a number stopped the app while drawing the preview (#3663). +- 2026-10-23: Tables: a cell span read from a `.json` document (any 32-bit number) no longer overflows when a column is inserted through the cell or the cell is merged: the span is counted from its clamped value and stays within 63 columns. It panicked in debug builds and wrapped to a small span in release (#3637). +- 2026-10-23: Table of contents: Update Table on a TOC set in columns (here Word's own two-column TOC, written by Word in Portuguese) keeps it in its columns (#3889). The page numbers stand at the column's right edge rather than the page's, so entries no longer run over the next column and push its page numbers off the page; the TOC styles Word stores under translated ids (`Sumrio1` for `toc 1`) are read as the TOC styles, so the entries keep their font, indents and spacing; and no blank line tops the first column. Update, save and reopen keep it so. The same keeps a Portuguese Word's TOC formatted as its TOC styles say through Update Table (#3891). +- 2026-10-23: Layout: paragraphs that each start a continuous section now go onto new pages. A run of them ran off the bottom of the first page, because each new section counted as the top of a page. Empty section-break paragraphs after the first in a row take a line each until the page is full and then stay at its bottom, so the text after them starts the next page, as measured in Word (#3907). +- 2026-10-23: A relationship the markup names without the prefix is read as it wrote (#3411 follow-up): a producer that left the prefix out writes the relationship id as a plain `id`, and the reader resolves it the way it resolves the namespaced one, so the part it names is kept with the object that names it and the writer rewrites the attribute with the id the new package gives the part. An ordinary `id` — a VML shape's, a drawing's `wp:docPr`, a picture's `pic:cNvPr` — is the element's own and names no part. - 2026-10-22: View › Window › New Window opens a second window on the document (desktop). The windows are titled `Name:1` and `Name:2` and each keeps its own caret, scroll position, zoom and view; edits and Undo are the document's and show in both. Closing one of them asks nothing; the last one asks about unsaved changes, and quitting asks once per document. - 2026-10-22: One native window per open document on the desktop. File › New and Open (from the ribbon, File, shortcuts, the file manager, the command line or the control channel) open the document in a window of its own, focused and placed a step below and right of the last one; opening a file replaces a blank document nobody has used in its own window, and a file that is already open brings its window to the front. Each window keeps its own ribbon tab, File page, dialogs, panes, scroll position and composition. View › Window › Switch Windows lists the windows and brings the chosen one forward. File › Close and a window's close button close that window, asking about unsaved changes first; the last window stays open with no document. Quitting asks about each document with unsaved changes in its own window, and Cancel keeps everything open. The control channel's input and screenshots go to the window focused last. The web app keeps one window. - 2026-10-22: Recovery covers every open document. Each dirty document keeps its own copy, written on the same ten-second cadence whether it is shown or not; closing a document without saving deletes its copy, as saving does, and a clean exit deletes the copies of every document saved or closed since its last copy. File › Recover lists only copies no open document keeps, and Restore opens a copy as another document (or in place of an untouched blank one), so it never replaces work. After a crash with several unsaved documents, the next start lists all of them. - 2026-10-22: The desktop window works with several open documents (one window per document comes next). View › Window › Switch Windows lists them and shows the one chosen, back where it was left; New, Open and the mailings open beside unsaved work instead of asking about it; File › Close shows the next document; quitting asks about every document with unsaved changes, one at a time, and Cancel keeps the app open. - 2026-10-22: Several open documents in one session (engine part of one window per document). File › New opens a new document beside the open ones; File › Open opens beside them too, replaces a blank document nobody has used, and shows a file that is already open instead of opening it twice. Each document keeps its own text, selection, undo history, find state, view and recovery copy. View › Window › Switch Windows (`view.switchWindows`) lists the open documents and switches between them; `file.closeDocument` closes one where no window asks about unsaved changes (agents, headless sessions). Envelopes, Labels, Finish & Merge and New from Template open their result as a new document and leave the main document open as it was. Document ids are unique in the process. The desktop app still shows one document per window; the windows come next. - 2026-10-22: Legacy form names and selected drop-down labels decode numeric XML references, including saved whitespace, without decoding escaped reference text twice. -- 2026-10-26: Lines on the page: a selected floating line shows a handle at each end, as a connector does and as in Word, and dragging one moves that end (lines don't glue to shapes); pressing anywhere else on it moves it. A level line (0 high, as Word files store a rule) used to show the frame's top and bottom handles on itself, so pressing it in the middle resized it into a slant; and moving any object no longer re-applies the minimum size to a size the move doesn't change, which gave a level line a 4 pt height. A turned line's or connector's ends are where they are drawn. -- 2026-10-25: Interface catalogs are still the shared storytold/craft-i18n ones embedded from `craft-i18n.rev` (`9205108c…`): 27 WordCraft languages with English fallback for missing strings, and the equation “Delete Around Caret in Equation” translation preserved. Native-speaker review remains human. -- 2026-10-25: Input methods (egui 0.37): character- and byte-counted surrounding deletions, a fresh composition after body/equation replacement, rejection of queued stale replacements before mutation, transactional equation deletes and one undo group, with tracked and placeholder length mapping. Synthetic regressions document these paths; managed CI passed, and native IME acceptance (#155–#164) plus browser IME behavior remain open. -- 2026-10-25: Justified and distributed lines keep the width of the spaces before their first character, as Word does: Thai official letters indent paragraphs with a run of spaces, and their first line no longer moves right by the line's slack (86 pt in a measured case). A distributed line's text reaches the margin even when the line ends with the space it wrapped at. -- 2026-10-25: Text Highlight Color shows the last colour as the button's bar in the ribbon and mini toolbar; after No Color it shows the pen without a misleading yellow bar, and the button removes highlighting (#4087). -- 2026-10-23: cu20we: DrawingML flat, square and round line caps are imported, saved, displayed and exported to PDF; absent or unknown caps default to flat. VML end caps (including shapetype inheritance) are preserved through DOCX save. Ink and metafile stroke handling remain separate. Synthetic DOCX, raster and PDF regressions cover the change; no new native Word comparison. -- 2026-10-23: cu20we: paragraph-relative box floats start above effective space before; header, footer, cell and text-box layout regressions pass. Framed paragraph positioning is unchanged; no new native Word comparison. -- 2026-10-23: AutoFormat As You Type: `*Bold* and _italic_ as real formatting`. With the option on, `*word*` typed and finished becomes bold and `_word_` italic, without the marks. It is off by default (`tools.autocorrect {"boldItalic"}`). - -- 2026-10-24: Parity catalog: Read Mode's View menu has its own rows. Column Width (`view.readColumnWidth`) and Page Color (`view.readPageColor`) count as live; Layout (`view.readLayout`) is listed as missing. Catalog 504/520 (96.9%). -- 2026-10-24: Find and Replace: with Regular expressions on, Replace with expands capture groups instead of inserting them as typed. `(\w+), (\w+)` replaced with `$2 $1` or `\2 \1` swaps the words, and `(?\d{4})-` with `${y}/` names a group; `$0` is the whole match, `$$` a dollar sign, `\t` a tab and `\n` a paragraph mark that splits the paragraph, as `^p` does. Missing or out-of-range groups expand to nothing, and the `^` codes still work (#4177). -- 2026-10-24: A click just outside a floating table, within 2pt of a cell whose text is turned (Text Direction, or a section whose text runs down or up the page), goes to the text beside or after the table, as it already did by upright cell text, instead of putting the caret in that cell (#4181). -- 2026-10-23: DOCX: a document whose default font size is unset keeps its size when saved and reopened. The size was left out of the file, and the reader read the missing size as 10 pt while the document resolved it as 11 pt; the file now says 11 pt (`DEFAULT_FONT_SIZE`). Files from other programs without a size are read as before. -- 2026-10-23: Insert › Table: hovering the grid shows the table on the page where it would go, as Word's Live Preview does, and the preview follows the pointer from square to square. It is laid out on a copy of the document, so nothing changes, and Undo has nothing new, until a square is clicked (#3931). -- 2026-10-24: Exact line spacing fixes the floating-table contact boundary independently of paragraph-mark metrics (#3977). Both row selection and word skipping use it; original regressions cover oversized and undersized marks, contact and one-twip offsets in modes 11/12/14/15. Shape behavior is unchanged. -- 2026-10-24: A line touching a floating table at its bottom edge keeps clear of the table (#3977), in both row-span selection and word skipping. Shapes keep their strict overlap rule. Original Source Sans 3 boundary and narrow-strip controls cover modes 11/12/14/15; the expected Word distinction is cyril265's Word for Mac 16.114.1 observation. - 2026-10-22: Mail merge (#3028): Preview Results has First Record and Last Record buttons and a box with the previewed record number; type a number and press Enter to go there (past either end stops at the first or last record). Finish & Merge is now a menu. Edit Individual Documents… and Print Documents… ask for all records, the current record, or a From and To range by record number, and Print Documents opens Print for the merged document. Scripts get `mailings.first`, `mailings.last`, `mailings.goToRecord`, `mailings.printDocuments` and a `records` choice on `mailings.finish`; a range with no records in it is refused instead of leaving an empty document. -- 2026-10-24: AutoFormat As You Type has "Built-in Heading styles" (off by default): pressing Enter twice after a line of five or fewer words that ends in a letter or digit makes it Heading 1, or Heading 2 or 3 when the line starts with one or two tabs. -- 2026-10-25: Track Changes: when the heading AutoFormat removes tabs the same author typed, or the border-line AutoFormat puts a border on the first paragraph of a story, the formatting change is recorded under the author making it. Another author's earlier formatting change on that paragraph is replaced, so the change is no longer credited to that author and Reject All brings back the paragraph as that author left it. - 2026-10-22: Re-routing a group connector keeps its free end at its displayed rotated and flipped position, including after nonuniform group resizing, while the glued end follows its existing connection-site path. Missing target shapes and invalid connection sites keep their transformed endpoints too. Fallback routes that cannot fit the renderer's 4000 pt child-size cap leave the original connector unchanged. Model and engine regressions cover starts, ends, unit/uniform/nonuniform scale, settled reroutes and safe handling of degenerate dimensions and display-size limits; no new native Word comparison. -- 2026-10-24: AutoFormat: a paragraph numbered through its style (a heading in a heading-linked Multilevel List) keeps `---` and `+---+` as text on Enter, as a paragraph numbered directly does. At the top of the document the border-line AutoFormat removed the characters and switched off the heading's number, and left no border. -- 2026-10-23: Lists: an empty paragraph whose mark is hidden takes no room and draws no list number, in the body and in table cells, as in Word; the number is still counted, so the next item keeps its place (#3982). -- 2026-10-24: Spelling: with Ignore web and file addresses on, a web or e-mail address after a no-break space or an ideographic space is skipped, as it is after a plain space. Its words were marked as misspelled. -- 2026-10-23: Justified paragraphs: a line ending in a manual line break (Shift+Enter) is stretched to the right margin like a wrapped line, as Word does; it stayed short like the paragraph's last line. A document with Word's `w:doNotExpandShiftReturn` compatibility option keeps such lines short, and the option is read and written back (#3924). -- 2026-10-23: Font dialog: "NaN" or "inf" typed in the Size box previews the text at 12 pt. "NaN" reads as a number, and a font size that is not a number stopped the app while drawing the preview (#3663). -- 2026-10-24: AutoFormat As You Type has "Set left- and first-indent with tabs and backspaces" (off by default): Tab at the start of a paragraph with text indents its first line, Tab at the start of a later line indents the whole paragraph, and Backspace at the start takes the indents back. -- 2026-10-23: Tables: a cell span read from a `.json` document (any 32-bit number) no longer overflows when a column is inserted through the cell or the cell is merged: the span is counted from its clamped value and stays within 63 columns. It panicked in debug builds and wrapped to a small span in release (#3637). - 2026-10-22: Spanish proofing (#3360, #3553): text in Spanish was never checked (it fell through to the languages without tools). Now Spain (`es-ES`), Mexico (`es-MX`), Latin America (`es-419` and the other countries of the Americas) and Uruguay (`es-UY`) each read their own installed dictionary, with fallbacks; suggestions restore accents first (`prueva` → `prueba`, `tambien` → `también`); Uruguayan Spanish accepts the `vos` forms, imperatives included (`vení`, `decime`, `decímelo`); repeated-word, spacing and missing `¿`/`¡` checks explain in Spanish; Review › Language, the status bar and File › Options › Proofing list the four varieties, and a Spanish interface writes new documents in the region's Spanish. No dictionary data bundled; parity estimates unchanged -- 2026-10-24: AutoCorrect: a word typed after a no-break space or an ideographic space is corrected as after a plain space (replacements, sentence capitals, ordinals and links). AutoCorrect left such a word as typed. -- 2026-10-23: Table of contents: Update Table on a TOC set in columns (here Word's own two-column TOC, written by Word in Portuguese) keeps it in its columns (#3889). The page numbers stand at the column's right edge rather than the page's, so entries no longer run over the next column and push its page numbers off the page; the TOC styles Word stores under translated ids (`Sumrio1` for `toc 1`) are read as the TOC styles, so the entries keep their font, indents and spacing; and no blank line tops the first column. Update, save and reopen keep it so. The same keeps a Portuguese Word's TOC formatted as its TOC styles say through Update Table (#3891). - 2026-10-22: Markdown inline code replaces each line ending with a space before export, including code in lists and table cells. A following heading, list marker or HTML tag stays literal code (#3738). -- 2026-10-23: Layout: paragraphs that each start a continuous section now go onto new pages. A run of them ran off the bottom of the first page, because each new section counted as the top of a page. Empty section-break paragraphs after the first in a row take a line each until the page is full and then stay at its bottom, so the text after them starts the next page, as measured in Word (#3907). -- 2026-10-22: Headers and footers: while editing the header, a single click in the footer edits the footer with the caret where clicked (and the reverse, and another page's own header or footer). The click went to the header being edited and the view scrolled back up to it, so a double-click on the footer rarely landed unless both were on screen. -- 2026-10-24: MCP `type_text` with `paragraphs: true` is one command (#3973): it was a `text.newParagraph` and a `text.insert` per line, each snapshotting the whole document for Undo, so 10,000 lines took 2.8 s (doubling the lines cost 2.4–3.2×) and left an Undo step per line; now they take ~10 ms (linear) and one Undo takes them all back. A CRLF is one break, not two, and the breaks no longer run AutoCorrect (the per-line way capitalised every line but the last). Typed line breaks are the Enter key, so in a one-line content control, where Enter does nothing, they no longer split it into paragraphs. -- 2026-10-21: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459). -- 2026-10-24: Track Changes: the border-line (`---` and the others) and `+---+` table AutoFormats mark the typed characters deleted instead of removing them, so Reject All brings them back. Characters the same author typed with tracking on are removed, as a tracked Backspace removes them. A border at the top of a story is a tracked formatting change too, as the border on the paragraph above already was. The table is inserted untracked, as Insert › Table inserts one. A line that holds a tracked deletion no longer triggers either AutoFormat. Four geometry-dependent layout controls request Source Sans 3 explicitly. Installed substitute fonts no longer choose their line breaks. Assertions and renderer font fallback policy are unchanged. Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target on interactive Save (#2445). Save before Close waits for that write; cancel or failure keeps the draft and original file. This does not add binary Word output. Late Save As answers are rejected before writing if automation has replaced the document. +- 2026-10-22: Headers and footers: while editing the header, a single click in the footer edits the footer with the caret where clicked (and the reverse, and another page's own header or footer). The click went to the header being edited and the view scrolled back up to it, so a double-click on the footer rarely landed unless both were on screen. +- 2026-10-21: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459). - 2026-10-21: A word with no break opportunity in it no longer makes the layout quadratic (#3412): measuring it beside a floating object walked the whole paragraph for every line it takes, so a 1 MiB word took 30 s to lay out. The layout is linear now. -- 2026-10-23: A relationship the markup names without the prefix is read as it wrote (#3411 follow-up): a producer that left the prefix out writes the relationship id as a plain `id`, and the reader resolves it the way it resolves the namespaced one, so the part it names is kept with the object that names it and the writer rewrites the attribute with the id the new package gives the part. An ordinary `id` — a VML shape's, a drawing's `wp:docPr`, a picture's `pic:cNvPr` — is the element's own and names no part. - 2026-10-21: A document with many relationships opens in the time its part takes (#3411): the reader looked for each relationship's id in the main document's part, once per relationship, so a 70 KB file with 1024 relationships and a 64 MiB part took 224 s to open. The ids are now the ones the markup names in a relationship attribute, taken from the main document the reader has already parsed, so an id the text only mentions is no longer a reference and the part it belongs to is no longer dropped on save. The open is linear now. - 2026-10-21: File › Recover follows the app theme (#3243, part of #2348): no black page or forced white text on the light theme - 2026-10-21: Table styles shade the same banded rows in Word and WordCraft: our banded styles (Grid Table 4…) and new table styles write their band sizes (`w:tblStyleRowBandSize`, `w:tblStyleColBandSize`), which Word otherwise reads as zero and leaves unbanded, and a file's style without them is unbanded here too (#3415). - 2026-10-21: Screen readers: the ribbon's font name and size boxes, and the dropdown arrows beside them, say what they are (#3172). The boxes announced themselves only as "edit" and the arrows beside them only as "button". +- 2026-10-21: A document with many content controls saves in the time the controls take (#13): the writer looked for each paragraph's markers in the whole set of markers, once per paragraph, and compared every control with every other one to find the ones that clash, so a document with 32,000 controls took four seconds to save. Both are a lookup and a sweep now, and what is written does not change. - 2026-10-20: A click below a floating table (one dragged by its move handle, or from a .docx) goes to the paragraph beside or after it, as in Word, instead of a cell of its last row, so the text after a moved table can be reached with the mouse again (#2038). - 2026-10-20: A picture cropped to a sliver of its source (under 5% of an axis) is drawn at the size the file gives, on screen and in PDF: a header bar cropped to 2.7% of a page-sized WMF is no longer half as tall, so the name in the text box over it shows (#1899). - 2026-10-20: Headers and footers: closing them with Esc or Close Header and Footer puts the caret back where it was in the body, as Word does, instead of on page 1 (the view no longer jumps to the top of the document, #3331). -- 2026-10-21: A document with many content controls saves in the time the controls take (#13): the writer looked for each paragraph's markers in the whole set of markers, once per paragraph, and compared every control with every other one to find the ones that clash, so a document with 32,000 controls took four seconds to save. Both are a lookup and a sweep now, and what is written does not change. - 2026-10-20: Restrict Editing: read only and comments-only protection grey out every edit in the ribbon when no exception lets the author edit, and tracked-changes protection greys out Accept and Reject, instead of buttons that look live and refuse when clicked. - 2026-10-20: Restrict Editing: with Filling in forms enforced, the Developer tab's content-control buttons and Properties grey out in the ribbon, their tooltips saying why, as in Word; before, they looked live and only refused when clicked. - 2026-10-20: The page tip shown while dragging the vertical scrollbar stays on one line; it broke into two or three lines ("Page 10 of" / "40") as the page number grew during the drag (#3341). - 2026-10-20: Layout: text in Apple's Times and Courier takes Times New Roman's and Courier New's single-line spacing, as in Word for Mac; in a corpus of 180 real manuscripts, the five set in Times no longer gain a page. +- 2026-10-19: The empty window (no document, as after Esc on the Start screen or File › Close) says no document is open in the page area and offers Blank document, Browse… and Home; Home returns to the Start screen without making a document (#3126). - 2026-10-19: Restrict Editing: with Filling in forms enforced, inserting content controls, their Properties and Remove Content Control are refused, as in Word (it greys them out), so a form's fields stay as they are and only their content is filled in. - 2026-10-19: Content controls: text typed over a placeholder takes the control's own run properties (`w:sdtPr/w:rPr`, ECMA-376 §17.5.2.27), as in Word, and the placeholder style is recognised by its built-in name "Placeholder Text" whatever its localized id (German Word: `Platzhaltertext`), so entries in forms from localized Word no longer stay grey. -- 2026-10-15: Find opens Navigation on Results; editing the query restores Results after manual Headings/Pages navigation. Typed and selected-text searches retain document contents (#2096). | Date | What landed | | 2026-11-20 | trivial | Progress log: `wordcraft-cli mcp` needs both automation roots; `--connect` refused (#7124) | | 2026-11-17 | trivial | Progress log: file formats, codecs and protocols come from craft-libs (#778) | | 2026-11-15 | trivial | Progress log: Get the Missing Fonts (download pages for missing fonts their publisher gives away) | | 2026-11-07 | Narrow windows (#5886): the window can be made 600 pt wide (was 760 pt), enabling split-window layout and edge tiling on Wayland/GNOME and 1280 pt screens; the title bar's search box and Discord button condense, and status-bar texts (page, word count, language, Track Changes, Overtype) stop before the right controls or shorten ("…" for language) instead of overlapping Focus, views and zoom | +| 2026-11-07 | Deleting a preceding empty paragraph keeps the following paragraph's style, outline and mark formatting rather than promoting body text to a heading (Leaf #152). Non-empty merges and section absorption retain their existing rules; synthetic model, command, DOCX and Undo/Redo coverage. | +| 2026-11-07 | A brace or bracket shape in a `.doc` file is drawn without a fill unless the file gives it one, as in Word, instead of as a white box that hides the text behind it (#5943) | +| 2026-11-06 | Accept All and Reject All no longer restyle the paragraph after an empty one carrying a section break (#5667): a Compare that added a section, then Reject All, left `Body` in the removed paragraph's Normal style and indents. The empty paragraph now goes whole and its section joins the following one, as deleting the break does. | | 2026-11-05 | trivial | Progress log: ODT documents keep their language (gap 19) | | 2026-11-04 | The CLI opens a non-Unicode input filename even after options such as `--page 2` or `--format flatopc`; text option values still require Unicode; `run --file` and `run --script` retain native paths. | -| 2026-11-06 | Accept All and Reject All no longer restyle the paragraph after an empty one carrying a section break (#5667): a Compare that added a section, then Reject All, left `Body` in the removed paragraph's Normal style and indents. The empty paragraph now goes whole and its section joins the following one, as deleting the break does. | -| 2026-11-07 | Deleting a preceding empty paragraph keeps the following paragraph's style, outline and mark formatting rather than promoting body text to a heading (Leaf #152). Non-empty merges and section absorption retain their existing rules; synthetic model, command, DOCX and Undo/Redo coverage. | | 2026-11-04 | Pictures keep the brightness, contrast and transparency their file gives them (#1711, #1766): a "Washout" picture watermark (VML `gain`/`blacklevel`) and a washed-out letterhead picture behind the text (`a:lum`) are drawn faded on screen and in PDF instead of at full colour, with the pixel curve measured on Word's own PDF export; `a:alphaModFix` transparency too. Saved back as DrawingML (and as VML `gain`/`blacklevel` in Word 2003 XML, without the transparency). Picture Format › Corrections, Transparency and Color › Washout replace the file's values (other Color modes leave them alone), and Reset Picture discards them all, as in Word; the PDF embeds the corrected pixels once per picture | -| 2026-10-17 | Copies keep their formatting in programs that read RTF rather than HTML: Copy and Cut put RTF beside the text and HTML on the system clipboard on Windows, macOS and Wayland (an X11 copy stays text and HTML, since arboard owns the selection there; a copy of only pictures or shapes carries no HTML or RTF, so pasting it back keeps every detail), and Paste reads another program's RTF on macOS and X11 too, not only on Windows and Wayland | +| 2026-11-04 | Quitting over the control channel and MCP bridge is refused while any open document has unsaved changes — a programmatic call never prompts — and `{"force": true}` quits without saving. The Save Changes prompt and the refusal now share one predicate, so they cannot drift apart (#3274). | | 2026-11-03 | **Arabic interface (#1195):** `ar` selectable (and every `ar-*` system locale); craft-i18n catalog; mirrored ribbon, panes, File page, dialogs and menus; Arabic UI font fallback; document direction stays independent. No kashida or Arabic proofing yet; Hebrew UI still open. | +| 2026-11-03 | A password-protected file named on the command line (double-clicked in the file manager) asks for its password when the first blank document was replaced because File › Options chose a region; the window now follows that replacement at once, so the first frame no longer takes it for a document switch and drops the Password box (#5299) | | 2026-11-01 | **English spelling reads SCOWL 2026 (CP2, #40, #520, #1281, #1045):** en-US, en-GB (also en-AU, en-NZ, en-IE, en-IN…) and en-CA each check against their own SCOWL `rel-2026.02.25` Hunspell dictionary from craft-i18n, embedded and read by craft-proof's affix engine (which now understands `COMPOUNDRULE`, so ordinals like `21st` are words). Suggestions come from the dialect's own dictionary; our American/British policy (`en-variants.txt`) still decides the other dialect's spellings, because Word accepts more than SCOWL's one spelling per dialect (`organize` and `organise` in en-GB). Rare words the 1990s Moby list accepted (`aposiopesis`) are now flagged. The Moby list stays for hyphenation and as a fallback. The build carries 1.5 MB more Language data. | | 2026-11-01 | Proofing moved to the shared libraries, with nothing users see changing: the code is `craft-proof` in storytold/craft-libs (with its history) and the spelling and hyphenation data (the Moby list, our English patterns and word lists, the German, Polish, Portuguese and Italian patterns, `ru-extra`) is craft-i18n's `language-data/`, embedded from `CRAFT_I18N_DIR` at the commit in `craft-i18n.rev`. Before/after `wordcraft-cli` runs on a proofing document give the same issues, suggestions and hyphenated PDF (CP1). | -| 2026-10-28 | Fonts a document uses that aren't installed are no longer silent: the font box shows a warning mark (hover names the font drawn instead) and the status bar says how many are missing, listing them (the first 20, then how many more) with the faces drawn instead and Add Font…. The list is what layout actually drew, so hidden text, unused styles and orphaned stories don't count; substitutes that measure the same (Carlito for Calibri, Liberation for Arial) and Symbol/Wingdings bullets aren't flagged | -| 2026-10-21 | Read Aloud on Linux speaks through Speech Dispatcher when neither `espeak-ng` nor `espeak` is installed (#4576). It talks to the server over its own socket (SSIP), so the text is never taken for a command and stopping cancels only WordCraft's own speech, not a screen reader's; each sentence goes in its language, region included, and a sentence a screen reader's announcement cuts off is said again after a short pause; if another program keeps stopping it, reading pauses on it with a message. With no speech program at all, Read Aloud names the package to install, and the `.deb` and `.rpm` packages recommend one. | -| 2026-10-31 | trivial | Preserve recipient columns after an unquoted whitespace-only prefix in a headered CSV (#4249); keep quoted headers, headerless whitespace records and shared CSV parsing. | -| 2026-10-31 | trivial | Integrate complete-record recipient CSV delimiter detection (#4249) with current main; preserve leading blank-line detection (#5042), original regressions and readiness estimates. | -| 2026-10-28 | **Arabic diacritic editing (#4757):** Backspace removes the last stored Arabic combining mark, so its base letter can stay while the mark is replaced. Caret movement and forward Delete keep their cluster rules. Synthetic command, history, protection and native/DOCX fresh-reopen checks; no native Word comparison or readiness change. | -| 2026-10-29 | Insert › Shapes shows the basic shapes as a grid of code-drawn icon tiles, each with an accessible name and tooltip, instead of a text list (#4349) | -| 2026-11-03 | A password-protected file named on the command line (double-clicked in the file manager) asks for its password when the first blank document was replaced because File › Options chose a region; the window now follows that replacement at once, so the first frame no longer takes it for a document switch and drops the Password box (#5299) | | 2026-11-01 | Markdown export: a list inside a block quote stays in the quote (`> - item`), its continuation lines included; it was read as quoted list paragraphs but written without `>`, so the list moved out of the quote on every save | | 2026-11-01 | Rulers: in a section of several text columns the horizontal ruler shades the space between each two columns like the margins (Print Layout, in the main text outside tables, with the selection in one section); dragging an edge of a space changes the spacing (equal columns stay equal, as in Word for Mac), one undo step per drag (#5197) | -| 2026-10-29 | Window sizing falls back to the screen rectangle when the reported inner size is invalid, and an Equation symbol tooltip no longer repeats a missing glyph's name or code point | -| 2026-10-29 | A NUL in a document title no longer reaches the native window title, which panicked on X11 (#3634): displayed titles and suggested file names drop NUL characters and fall back to the untitled name when empty; the stored title is unchanged | -| 2026-10-30 | Paragraph dialog: Word's Special box (none, First line, Hanging) and By replace the signed First line box, so a hanging indent is set as Hanging by a positive length instead of a negative first-line indent. Picking a kind from (none) starts at 0.5", as Word does, and switching between First line and Hanging keeps By. A By typed in counts once committed, so the 0 of 0.25 doesn't turn Special to (none) mid-typing. | -| 2026-10-28 | The Traditional Chinese interface draws hanzi to the Taiwan standard: on the desktop an installed Traditional Chinese font (PingFang TC on macOS, Microsoft JhengHei on Windows, Noto Sans CJK TC on Linux) comes before the embedded Noto Sans CJK SC, which drew 說, 這, 為, 戶 in mainland shapes; without one, and on the web, nothing changes. | -| 2026-10-17 | macOS launch arguments (`-psn_*`, `-NS*`, `-Apple*`) are no longer opened as files, and a file that fails to open names the file and the real cause on the status bar and in the log (#1103). The reported "corrupt" error could not be reproduced. | -| 2026-10-19 | Linux: File › Options › Advanced › Linux display server picks Automatic (the default: XWayland where there's an X server, for file drag-and-drop), Wayland or X11 (XWayland), so people who don't start WordCraft from a terminal can switch without an environment variable (#2184). It's kept in `ui.json` and applies at the next launch; `WORDCRAFT_WAYLAND` still overrides it, and `WORDCRAFT_WAYLAND=0` now asks for X11. A choice that isn't available falls back to the other instead of failing to start, and the log's `display:` line says which ran and why. Hidden on Windows, macOS and the web; `ui.displayServer` for agents. | -| 2026-10-19 | The status bar's count is selectable (#2797): words (default), characters (with spaces) or characters (no spaces), from a right-click menu on the count itself or File › Options › Display › Status bar (`ui.statusCount`), kept in `ui.json` between runs; a selection shows "selected of total" in the chosen unit, counted exactly as the Word Count dialog counts them, whose numbers and meaning are unchanged. | -| 2026-10-14 | Insert › Date & Time and DATE, TIME and other date fields show the computer's local date, time and weekday, daylight saving included, as Word does (#1707); they showed UTC, so a user in New Zealand at noon on 31 October got 30 October 23:00. Timestamps saved in files (revisions, comments, document properties) stay UTC. Backstage's greeting follows the local hour too | -| 2026-10-23 | File > Print: N-up physical sheets and left/right-bound booklets, shared preview/PDF geometry and padded copies (#641); printer jobs keep upstream’s link-annotation fix. | -| 2026-10-17 | Password-protected Word files from Word 2007 (Standard encryption: AES-128/192/256, SHA-1) open with their password, also when named `.doc` or `.dot`; a wrong or missing password is reported as for newer files. Word 97-2003 files with an AES header, which the public spec doesn't define, are refused with a clear message (gap 9) | -| 2026-11-04 | Quitting over the control channel and MCP bridge is refused while any open document has unsaved changes — a programmatic call never prompts — and `{"force": true}` quits without saving. The Save Changes prompt and the refusal now share one predicate, so they cannot drift apart (#3274). | +| 2026-11-01 | trivial | N-up and booklet print imposition (#641): integrate current print-job link handling (#4734), preserve markup preview and sheet/copy planning; readiness estimates unchanged. | +| 2026-11-01 | trivial | Printing (#641): pin booklet page order and blank left/right slots for every count from five through nine pages and both bindings; integrate current main. Readiness estimates unchanged. | +| 2026-10-31 | trivial | Preserve recipient columns after an unquoted whitespace-only prefix in a headered CSV (#4249); keep quoted headers, headerless whitespace records and shared CSV parsing. | +| 2026-10-31 | trivial | Integrate complete-record recipient CSV delimiter detection (#4249) with current main; preserve leading blank-line detection (#5042), original regressions and readiness estimates. | | 2026-10-31 | A picture or shape anchored in a line of a long paragraph on a later page is drawn on that page, as in Word, instead of the page the paragraph starts on; one dropped on such a page stays where it was dropped (#4250) | | 2026-10-31 | A picture or shape anchored in a line of a long paragraph on a later page is drawn on that page, as in Word, instead of the page the paragraph starts on; one dropped on such a page stays where it was dropped (#4250) | | 2026-10-31 | A picture or shape dropped beside the first line after a page break inside a paragraph stays on the new page, as in Word, instead of going back to the page before the break (#4262) | -| 2026-11-07 | A brace or bracket shape in a `.doc` file is drawn without a fill unless the file gives it one, as in Word, instead of as a white box that hides the text behind it (#5943) | -| 2026-10-27 | Connector rerouting indexes laid-out object positions once per batch, preserving page hints, first-match order and same-page glue; synthetic equivalence, geometry and scaling regressions (#3631); routing policy and readiness estimates unchanged | +| 2026-10-31 | Control/MCP #2596 review: write/flush failures after sending begins are outcome-unknown; image exports to a path are not replayed; accept-thread startup failures disable the server and remove the key; invalid UTF-8 is rejected per line without ending stdio. Synthetic regressions cover partial JSON delivery at EOF, flush failure, export vs in-memory retry and failed startup. | +| 2026-10-30 | Paragraph dialog: Word's Special box (none, First line, Hanging) and By replace the signed First line box, so a hanging indent is set as Hanging by a positive length instead of a negative first-line indent. Picking a kind from (none) starts at 0.5", as Word does, and switching between First line and Hanging keeps By. A By typed in counts once committed, so the 0 of 0.25 doesn't turn Special to (none) mid-typing. | +| 2026-10-29 | Insert › Shapes shows the basic shapes as a grid of code-drawn icon tiles, each with an accessible name and tooltip, instead of a text list (#4349) | +| 2026-10-29 | Window sizing falls back to the screen rectangle when the reported inner size is invalid, and an Equation symbol tooltip no longer repeats a missing glyph's name or code point | +| 2026-10-29 | A NUL in a document title no longer reaches the native window title, which panicked on X11 (#3634): displayed titles and suggested file names drop NUL characters and fall back to the untitled name when empty; the stored title is unchanged | +| 2026-10-28 | Fonts a document uses that aren't installed are no longer silent: the font box shows a warning mark (hover names the font drawn instead) and the status bar says how many are missing, listing them (the first 20, then how many more) with the faces drawn instead and Add Font…. The list is what layout actually drew, so hidden text, unused styles and orphaned stories don't count; substitutes that measure the same (Carlito for Calibri, Liberation for Arial) and Symbol/Wingdings bullets aren't flagged | +| 2026-10-28 | **Arabic diacritic editing (#4757):** Backspace removes the last stored Arabic combining mark, so its base letter can stay while the mark is replaced. Caret movement and forward Delete keep their cluster rules. Synthetic command, history, protection and native/DOCX fresh-reopen checks; no native Word comparison or readiness change. | +| 2026-10-28 | The Traditional Chinese interface draws hanzi to the Taiwan standard: on the desktop an installed Traditional Chinese font (PingFang TC on macOS, Microsoft JhengHei on Windows, Noto Sans CJK TC on Linux) comes before the embedded Noto Sans CJK SC, which drew 說, 這, 為, 戶 in mainland shapes; without one, and on the web, nothing changes. | | 2026-10-28 | Markdown import bounds nested undefined reference-label work within the existing link allowance; literal source and normal reference matching are preserved (#4658). | -| 2026-10-23 | A command that changes nothing is not an edit: it adds no undo step, marks no unsaved changes and forces no relayout, so the redo stack survives it and five hundred of them can no longer push the user's own edits out of the undo history. | -| 2026-10-23 | Interface translations come from storytold/craft-i18n, shared with the other Crafting Apps: the catalogs are embedded at build time from the commit in `craft-i18n.rev` and looked up through craft-libs' `craft-i18n` crate; `crates/ui-egui/src/i18n/*.tsv` are gone (translations now go to craft-i18n). Strings other apps already translate show translated; a build without `CRAFT_I18N_DIR` is English only | +| 2026-10-27 | Connector rerouting indexes laid-out object positions once per batch, preserving page hints, first-match order and same-page glue; synthetic equivalence, geometry and scaling regressions (#3631); routing policy and readiness estimates unchanged | | 2026-10-25 | #4085 mark review: whole-cell and ordinary highlight targets include their selected paragraph marks; empty, inherited and partial-column controls added. | | 2026-10-25 | #4085 review: highlight toggling checks the full target with constant resolved-run storage; a different colour after 10,000 runs prevents clearing. | +| 2026-10-25 | Custom document properties (#2982, split from #1798): File › Info › Properties › Advanced Properties… opens a Custom Document Properties dialog that lists the document's custom properties and adds, modifies and deletes them through the name/value form (text properties only; Word's number/date/yes-no types not offered). OK is one undoable `file.properties` step and marks the document changed; Cancel discards everything; names and values are validated against the engine's limits with the error shown in the dialog. Saved properties survive a DOCX round trip. | | 2026-10-24 | #4085: Ctrl+Alt+H toggles the last chosen highlight colour; explicit colour setters remain idempotent. Mixed, inherited and pending formatting and Undo/Redo covered by command/key regressions. | +| 2026-10-23 | File > Print: N-up physical sheets and left/right-bound booklets, shared preview/PDF geometry and padded copies (#641); printer jobs keep upstream’s link-annotation fix. | +| 2026-10-23 | Header and footer commands change the section of the header the caret is in (#3639) | +| 2026-10-23 | A command that changes nothing is not an edit: it adds no undo step, marks no unsaved changes and forces no relayout, so the redo stack survives it and five hundred of them can no longer push the user's own edits out of the undo history. | +| 2026-10-23 | Interface translations come from storytold/craft-i18n, shared with the other Crafting Apps: the catalogs are embedded at build time from the commit in `craft-i18n.rev` and looked up through craft-libs' `craft-i18n` crate; `crates/ui-egui/src/i18n/*.tsv` are gone (translations now go to craft-i18n). Strings other apps already translate show translated; a build without `CRAFT_I18N_DIR` is English only | | 2026-10-23 | Comment times show in the user's own time zone, as in Word: the Comments pane converts them (it showed the file's UTC time) and the balloons show them under each author (they showed none). The file's UTC time (Word's `w16cex:dateUtc`) wins over `w:date`, a time naming its zone is converted, and one without a zone shows as written (#2322, #2337) | -| 2026-11-01 | trivial | N-up and booklet print imposition (#641): integrate current print-job link handling (#4734), preserve markup preview and sheet/copy planning; readiness estimates unchanged. | -| 2026-11-01 | trivial | Printing (#641): pin booklet page order and blank left/right slots for every count from five through nine pages and both bindings; integrate current main. Readiness estimates unchanged. | | 2026-10-22 | Compare results opened as new or revised untitled documents start without the previous document's version snapshots. A comparison or mailing result rejected by protection keeps the snapshots and save target with the original document. | +| 2026-10-22 | Restrict Editing: the CLI's `--author` uses the same protection check as `file.setAuthor`, and File › Options disables the User name field while the document is protected. | +| 2026-10-21 | Read Aloud on Linux speaks through Speech Dispatcher when neither `espeak-ng` nor `espeak` is installed (#4576). It talks to the server over its own socket (SSIP), so the text is never taken for a command and stopping cancels only WordCraft's own speech, not a screen reader's; each sentence goes in its language, region included, and a sentence a screen reader's announcement cuts off is said again after a short pause; if another program keeps stopping it, reading pauses on it with a message. With no speech program at all, Read Aloud names the package to install, and the `.deb` and `.rpm` packages recommend one. | | 2026-10-20 | The Document Inspector's removals are refused while the document tracks changes: they delete straight from the document, so the text would go with no revision to show for it and the revision trail would be broken behind the user's back | | 2026-10-20 | A version snapshot belongs to the document it was taken from: the snapshots went with the document, so a restore can only ever bring back a version of the document that is open | -| 2026-10-22 | Restrict Editing: the CLI's `--author` uses the same protection check as `file.setAuthor`, and File › Options disables the User name field while the document is protected. | | 2026-10-20 | Restrict Editing, three more gaps closed: the protection of a protected document only changes through the explicit stop (`review.restrict {"stop": true}`; the "none" mode is the shorthand and doesn't stop it), the session author used for new tracked changes and comments can't change through `file.setAuthor` while the document is protected (the CLI's `--author` uses the same protection check), and the post-check compares the document's settings, metadata, custom properties, list definitions, bibliography sources and the comments' resolved flags as well as its text and formatting | | 2026-10-20 | Restrict Editing holds for the file commands too: the privacy options, the properties and the inspector's removals are refused on a protected document, and restoring a stored version keeps the protection and its password instead of the snapshot's stale ones | -| 2026-10-17 | Ribbon hints' reasons for a greyed-out control are translated in every interface language; a test fails if a reason it finds in the command sources, or the "Open a document first" hint, has no translation (#2678). | -| 2026-10-17 | Ribbon hover hints: a disabled control says why (the command's own reason), split-button arrows, menu buttons and the font, size and outline boxes have hints, and hints show on keyboard focus (#1086). | -| 2026-10-16 | Windows per-user installer (#39): each release also ships `wordcraft--windows-user-.msi`, built from the same WiX source as a dual-purpose package, so it installs into `%LOCALAPPDATA%\Programs` for the current user with no administrator rights; registry keys moved to HKMU so both installers share one set of components | -| 2026-10-14 | DOCX row table border exceptions render and survive saving. Explicit cell borders win; a row exception does not change other rows. | -| 2026-10-14 | Tab stops edited on the ruler: the corner selector picks Left/Center/Right/Decimal/Bar, a click sets a stop (Alt skips the snap), dragging moves it with a guide line and position tooltip, dragging off the ruler clears it; markers draw per kind and mirror for RTL; one `para.tabs` call and one undo step per gesture | -| 2026-10-12 | Fields keep `w:dirty` through DOCX saves (#877): a begin marker flagged by a generator that couldn't compute a result (pandoc-style TOC placeholders) keeps the flag on open/save — as a buffered field or a range field — so Word still refreshes it on open; computing a result (Update Field, Update Table) clears it, like Word's F9 | +| 2026-10-20 | The move and resize handles of a table show while the caret is in it, not only under the pointer, as in Word (#2428) | +| 2026-10-20 | Table sorting and formulas read and write decimal points for Cuban and Peruvian Spanish (`es-CU`, `es-PE`), so `1.234` is a decimal instead of 1234; grouped-number and result-formatting regressions retain Spain's decimal comma. | +| 2026-10-20 | Set Proofing Language › Set As Default persists for future blank documents and plain-text files, independently of the interface language; existing DOCX and templates keep their languages, and rejected commands retain the previous saved default (#2882). | +| 2026-10-20 | Pinned layout test fonts also initialize before the new caret-height and ligature fixtures, keeping isolated test runs independent of system fonts (#2729). | +| 2026-10-20 | Russian sorting keeps ё with е and recognises decomposed ё/й: case-insensitive words and index headings share the corrected collation, with regressions and no new dependencies. | +| 2026-10-19 | Linux: File › Options › Advanced › Linux display server picks Automatic (the default: XWayland where there's an X server, for file drag-and-drop), Wayland or X11 (XWayland), so people who don't start WordCraft from a terminal can switch without an environment variable (#2184). It's kept in `ui.json` and applies at the next launch; `WORDCRAFT_WAYLAND` still overrides it, and `WORDCRAFT_WAYLAND=0` now asks for X11. A choice that isn't available falls back to the other instead of failing to start, and the log's `display:` line says which ran and why. Hidden on Windows, macOS and the web; `ui.displayServer` for agents. | +| 2026-10-19 | The status bar's count is selectable (#2797): words (default), characters (with spaces) or characters (no spaces), from a right-click menu on the count itself or File › Options › Display › Status bar (`ui.statusCount`), kept in `ui.json` between runs; a selection shows "selected of total" in the chosen unit, counted exactly as the Word Count dialog counts them, whose numbers and meaning are unchanged. | | 2026-10-19 | Insert Table of Figures opens its dialog (#3013): pick the caption label (Figure, Table, Equation or your own), with or without label and number, page numbers and leader, so a document can have a list of figures and a list of tables. The list is a `TOC \c`/`\a` field (ECMA-376 §17.16.5.68); a Word table of figures with its switches in any order updates too, and Update Table keeps each list's label and leader. | | 2026-10-19 | Right-clicking text or pressing Shift+F10 offers the existing two-row formatting mini toolbar above the context-menu commands. Formatting keeps the selection and popup; menu commands, Escape and outside clicks dismiss it. This is the mini-toolbar portion of #2959; paste choices are in PR #2599. | -| 2026-10-20 | The move and resize handles of a table show while the caret is in it, not only under the pointer, as in Word (#2428) | | 2026-10-19 | Personal templates (#2852): File › New lists the `.dotx` and `.dotm` files in your templates folder under Personal (a subfolder per category; the search box covers them), and one opens as a new untitled document attached to it, as in Word. Save As › Save as Word Template starts in that folder, made on first use in the settings folder; File › Options › Advanced › File locations › User templates points it elsewhere. Agents list them with `file.listTemplates`. | | 2026-10-19 | Delete with whole table cells selected (rows, columns, the table or one cell) empties each cell to one paragraph, as in Word: no blank paragraphs are left behind, the paragraph keeps the formatting of the cell's last one, and tables nested in the cells go too. One undo brings everything back (#2802). | | 2026-10-19 | A table-of-contents entry whose text just fits no longer leaves its page number alone at the start of the next line: the tab goes there with it, leader and all (#1840). | | 2026-10-19 | A Thai run with Latin letters and digits in a missing Thai font is drawn in one face on Linux too (#1549): the fallback no longer stops at Noto Sans Thai, which has no Latin letters, but finds an installed font covering the whole run (IBM Plex Sans Thai, say) and loads its whole family, so regular text gets the Regular face. Concurrent lookups no longer cache a miss. | | 2026-10-19 | Word signature lines (Insert › Signature Line) survive a save: a .docx saved by WordCraft keeps each one as a signature line, still signable in Word, with its suggested signer, instead of turning it into a plain picture. | -| 2026-10-25 | Custom document properties (#2982, split from #1798): File › Info › Properties › Advanced Properties… opens a Custom Document Properties dialog that lists the document's custom properties and adds, modifies and deletes them through the name/value form (text properties only; Word's number/date/yes-no types not offered). OK is one undoable `file.properties` step and marks the document changed; Cancel discards everything; names and values are validated against the engine's limits with the error shown in the dialog. Saved properties survive a DOCX round trip. | -| 2026-10-15 | A picture anchored further down a page but placed higher up it (fixed on the page, or moved up from its paragraph) has the paragraphs above its anchor wrap around it too, instead of running behind it, also when that wrap pushes the anchor onto the next page (#2048) | -| 2026-10-20 | Table sorting and formulas read and write decimal points for Cuban and Peruvian Spanish (`es-CU`, `es-PE`), so `1.234` is a decimal instead of 1234; grouped-number and result-formatting regressions retain Spain's decimal comma. | -| 2026-10-20 | Set Proofing Language › Set As Default persists for future blank documents and plain-text files, independently of the interface language; existing DOCX and templates keep their languages, and rejected commands retain the previous saved default (#2882). | | 2026-10-19 | Typing on Linux no longer stops after clicking Search (#2986): Search, Go To's page box, the Icons search and a new caption label asked for the keyboard on every frame, and each request reset the input method; they now ask only while they lack it. | | 2026-10-19 | An equation from LibreOffice in an `.odt` file no longer shows blank (#3099): it's embedded as a `draw:object` formula sub-document holding MathML, with a `draw:image` replacement preview in LibreOffice's own metafile format WordCraft can't decode as a picture; the formula's own MathML is read instead, through the same reader as HTML equations. | | 2026-10-19 | Format Page Numbers (Insert › Header & Footer › Page Number ▸ Format Page Numbers…, #1113): the dialog sets the number format (1, 2, 3 / I, II, III / i, ii, iii / A, B, C / a, b, c) and whether the pages number on from the section before or start at a number; the ribbon item was a plain command call that did nothing and cleared the section's start | | 2026-10-19 | A picture, shape or text box dragged near the bottom of a page lands where it is dropped. It used to jump far below the page, cut off at its edge with only its selection box showing over the next page (#3169) | | 2026-10-19 | Insert Caption picks the label used last, as Word does, and keeps it between runs (#3120). | -| 2026-10-20 | Pinned layout test fonts also initialize before the new caret-height and ligature fixtures, keeping isolated test runs independent of system fonts (#2729). | | 2026-10-19 | Ctrl/⌘+wheel and pinch zoom feel lighter: while the zoom moves, each page's last raster is stretched to the new size instead of rendered at every in-between size; it is rendered once the zoom stops, or again whenever stretching would pass 1.5x. On a 4K screen at 145 % the frames of a zoom went from 11–15 ms to 0–1 ms, one notch from 12 page renders to 1. Wheel steps with animation effects off still land finished in their own frame. | | 2026-10-19 | Dark-theme interface text on Linux and the BSDs no longer looks semi-bold: egui thickened light-on-dark glyph edges by default (about 21 % more ink than Firefox draws the same text); it now adds a light 7 %, chosen side by side on a 145 % desktop (Firefox's plain weight looked soft on the dark tab row). Light-theme interface text was measured against headless Firefox and already matches it (Inter's ttfautohint hints draw as FreeType's light autohinting does). Headless screenshots take a scale (`{"ppp": 1.45}` in `ui_shot`) to see text as a fractional desktop scale draws it. | | 2026-10-19 | Page text on Linux and the BSDs is no longer soft: it is hinted the way FreeType's `hintslight` draws text in Firefox and other apps there, its autohinter putting baselines, x-heights and cap heights on whole pixels without moving anything sideways, so lines break as before. Measured against headless Firefox on Arial at 21.27 px: the same rows of pixels and the same weight. Re-rendering costs the same; the first render at a new zoom about 1.5 ms more per page. macOS, Windows and exports are unchanged. | | 2026-10-19 | Save As, Export and Open no longer do nothing on Linux desktops whose file chooser portal fails to show its dialog (#2999): a "cancel" quicker than anyone could make one asks again without the parent window, then opens the built-in file browser. | -| 2026-10-20 | Russian sorting keeps ё with е and recognises decomposed ё/й: case-insensitive words and index headings share the corrected collation, with regressions and no new dependencies. | -| 2026-10-18 | Long navigation headings wrap onto further lines inside the resizable pane instead of ending in an ellipsis: the row grows with the text and the pane keeps its width (#759, #3015). | -| 2026-10-17 | Layout unit tests use the pinned bundled fonts without system/user fonts or optional craft-fonts inputs (#2729); every test initializes the fixture before font lookup, and pagination fixtures are measured against that fixed set | -| 2026-10-18 | Clearing a font query with no matches keeps Recently Used Fonts visible at the top of a scrollable list. The initial scroll position no longer skips its heading; measured keyboard scrolling is unchanged (#2068). | | 2026-10-19 | Centred numbered headings after a leading page break keep their number before the text (#2964). The label uses the alignment of the line it is drawn on; heading text positions and page count stay the same. | +| 2026-10-19 | Typing no longer starts render threads on every repaint (#3027): page, area and icon renders share one kept vello_cpu context, reset to each size, instead of building a multi-threaded one (and its thread pool) per render. Typing about 150 characters in 15 s created 295–388 threads before and none now; CPU time while typing fell by about a third (Windows, debug build). | +| 2026-10-18 | Long navigation headings wrap onto further lines inside the resizable pane instead of ending in an ellipsis: the row grows with the text and the pane keeps its width (#759, #3015). | +| 2026-10-18 | Clearing a font query with no matches keeps Recently Used Fonts visible at the top of a scrollable list. The initial scroll position no longer skips its heading; measured keyboard scrolling is unchanged (#2068). | +| 2026-10-18 | Symbols keep their font (#2036): a `w:sym` or Insert › Symbol character in Wingdings, Symbol or Webdings remembers its symbol font apart from the text's font, so selecting all and changing the font (or Clear Formatting) no longer turns the symbols into boxes; saved back to DOCX as `w:sym`, so Word shows them too. Typed text and the Format Painter don't pick up the symbol font. | +| 2026-10-18 | Dragging a single selected cell's border (Select Cell, left-edge arrow, triple-click on its last paragraph) moves it in its row only; the neighbour takes up the difference. Checked against Word for Mac 16.113.4. | +| 2026-10-18 | Manage Sources › Import… (#2640) reads a Word bibliography file (`b:Sources`: Word's own `Sources.xml` master list) into the document: the tags, names, kinds and fields Word saves are read by the same code that reads the bibliography custom XML part of a `.docx`, a tag already in the document is left alone (an import never overwrites an edited source), an untagged source gets a tag the way a new one does, the whole import is one undo step, and a file that isn't `b:Sources` is refused. | +| 2026-10-17 | Copies keep their formatting in programs that read RTF rather than HTML: Copy and Cut put RTF beside the text and HTML on the system clipboard on Windows, macOS and Wayland (an X11 copy stays text and HTML, since arboard owns the selection there; a copy of only pictures or shapes carries no HTML or RTF, so pasting it back keeps every detail), and Paste reads another program's RTF on macOS and X11 too, not only on Windows and Wayland | +| 2026-10-17 | macOS launch arguments (`-psn_*`, `-NS*`, `-Apple*`) are no longer opened as files, and a file that fails to open names the file and the real cause on the status bar and in the log (#1103). The reported "corrupt" error could not be reproduced. | +| 2026-10-17 | Password-protected Word files from Word 2007 (Standard encryption: AES-128/192/256, SHA-1) open with their password, also when named `.doc` or `.dot`; a wrong or missing password is reported as for newer files. Word 97-2003 files with an AES header, which the public spec doesn't define, are refused with a clear message (gap 9) | +| 2026-10-17 | Ribbon hints' reasons for a greyed-out control are translated in every interface language; a test fails if a reason it finds in the command sources, or the "Open a document first" hint, has no translation (#2678). | +| 2026-10-17 | Ribbon hover hints: a disabled control says why (the command's own reason), split-button arrows, menu buttons and the font, size and outline boxes have hints, and hints show on keyboard focus (#1086). | +| 2026-10-17 | Layout unit tests use the pinned bundled fonts without system/user fonts or optional craft-fonts inputs (#2729); every test initializes the fixture before font lookup, and pagination fixtures are measured against that fixed set | | 2026-10-17 | Edit Recipient List finds records (#1576): a Find in list box hides rows with no cell containing the text (any case) and counts the matches, and "Show only records that will be merged" hides the rows the filter leaves out; both only change the view. Rows are striped, and edits and removes go to the right record however the grid is narrowed | | 2026-10-17 | Tracked style-property changes (#2697): Modify Style and Update Style to Match Selection record the paragraph/run properties as they were while Track Changes is on (`w:pPrChange` / `w:rPrChange` inside the style), the Reviewing Pane lists them at the start of the document, accepting keeps the new properties and rejecting restores the old ones; the change and revision round-trip through DOCX | | 2026-10-17 | Recent documents can be taken off the list (#2716): hovering a row in File › Home/Open ▸ Recent shows a × that removes that document, a Clear all button under the list empties it, and the change is written to the preferences right away, so it survives a crash. `ui.recentRemove {"path"}` and `ui.recentClear` do the same for CLI, control and MCP | -| 2026-10-31 | Control/MCP #2596 review: write/flush failures after sending begins are outcome-unknown; image exports to a path are not replayed; accept-thread startup failures disable the server and remove the key; invalid UTF-8 is rejected per line without ending stdio. Synthetic regressions cover partial JSON delivery at EOF, flush failure, export vs in-memory retry and failed startup. | -| 2026-10-16 | Control/MCP delivery (#1326, #1331): the MCP bridge never re-sends a mutation whose outcome is unknown (explicit "outcome unknown" error; reads and not-sent requests still retry); a control request whose caller timed out while queued never runs, and a timeout before execution is told apart from an unknown outcome; bounded MCP and reply line reads; capped unauthenticated control connections with fallible thread creation | -| 2026-10-16 | MCP `insert_table` tool (#2242): a filled table in one call from `values`, with `header` (repeating first row) and `style`; `insert.spreadsheet` takes the same `values`/`header`/`style` and rejects ragged, oversized or non-array input | | 2026-10-17 | AccessKit focus guard (#2726): every tree update egui sends carries its focused node, so a frame that drops it falls back to the root instead of panicking in `accesskit_consumer` and closing the window on Windows | | 2026-10-17 | Equation arrays centre a row that has no `&` among rows that do, as Word does, so case equations like Word's "First Property of Radicals" no longer push the aligned row right (#2617). | | 2026-10-17 | Formatting revisions: a table, row, cell or section property change made while tracking now records as `w:tblPrChange`/`w:trPrChange`/`w:tcPrChange`/`w:sectPrChange` (structure stays out), so Reject All restores and Accept All keeps it; test tracked_table_changes_are_kept_as_formatting_changes | +| 2026-10-17 | The document's right-click menu offers the ribbon's Paste menu, item for item (#2583): Paste (the clipboard's formatting kept, Word's Keep Source Formatting), Keep Text Only, Merge Formatting and Paste Special…, where it had a single Paste. Same commands and shortcuts, with the system clipboard | +| 2026-10-17 | SmartArt Text Pane: Tab demotes and Shift+Tab promotes the focused item, as Word's pane does (#2701). The row keeps its focus, so a second Tab acts on the same item; an item that can't go down a level is left alone | +| 2026-10-17 | Restrict Editing holds for structure too (#1327): an exception inside a table cell no longer lets table, row or cell formatting change the protected rest of the table; formatting limited to styles refuses Paste Formatting, table shading, borders, cell alignment, cell margins, text direction, table-style edits and locked table styles; loading, filtering or sorting recipients no longer rewrites merge-field results in a protected document. | +| 2026-10-17 | Home › Underline's drop-down shows each underline as a sample of its line, adds Dot-dot-dash, None and More Underlines…, and an Underline Color submenu backed by the new `format.underlineColor` command (catalog 490/505) (#2738) | +| 2026-10-17 | Ribbon hover hints: a disabled control says why (the command's own reason), split-button arrows, menu buttons and the font, size and outline boxes have hints, and hints show on keyboard focus (#1086). | +| 2026-10-17 | Insert › Drop Cap is a menu (None, Dropped, In margin, Drop Cap Options…); the dialog sets position, font, lines to drop and distance; letters in the margin; DOCX keeps them (#2601). | +| 2026-10-17 | SECTIONPAGES includes shared continuous-section pages. A native original control confirms a section starting on page 1 and continuing on page 2 reports 2. | +| 2026-10-17 | File › Print's Scale to paper size (#2108): pick Letter, Legal, A4 or any Layout › Size paper and every page is scaled to it and centred, the paper turned to each page's orientation, in the preview, the print job (with the spooler's media) and Save these pages as PDF; the document keeps its page size. `paper` param on `ui.print`/`file.printPdf` | +| 2026-10-17 | Non-overlapping body floating tables clear header tables. Original native controls distinguish never-overlap from allowed overlap. | +| 2026-10-16 | Windows per-user installer (#39): each release also ships `wordcraft--windows-user-.msi`, built from the same WiX source as a dual-purpose package, so it installs into `%LOCALAPPDATA%\Programs` for the current user with no administrator rights; registry keys moved to HKMU so both installers share one set of components | +| 2026-10-16 | Control/MCP delivery (#1326, #1331): the MCP bridge never re-sends a mutation whose outcome is unknown (explicit "outcome unknown" error; reads and not-sent requests still retry); a control request whose caller timed out while queued never runs, and a timeout before execution is told apart from an unknown outcome; bounded MCP and reply line reads; capped unauthenticated control connections with fallible thread creation | +| 2026-10-16 | MCP `insert_table` tool (#2242): a filled table in one call from `values`, with `header` (repeating first row) and `style`; `insert.spreadsheet` takes the same `values`/`header`/`style` and rejects ragged, oversized or non-array input | | 2026-10-16 | English dialects (#1281, #1045): English (UK), (Australia), (Canada) and the other Englishes are proofed in their own spelling — *colour* is flagged in a US document and *color* in a British one, with the right form suggested first — from our own list of American/British spellings, so nothing to install. Review › Language lists them, the .docx `w:lang` keeps them, and an English interface on a British (or Canadian, Australian…) system starts new documents in that English | -| 2026-10-15 | Triple borders (tables, paragraphs, the `###` AutoFormat line) draw as three lines on screen and in PDF, across the line for vertical borders too; they used to draw as double lines (#1740) | | 2026-10-16 | Pictures and shapes without text stories turn visibly while dragging the rotation handle (#2277), with Shift snapping to 15° steps; the document changes only on release through one `arrange.rotation` command, and Escape cancels the preview | | 2026-10-16 | DOCX: a text frame (`w:framePr`) in the document's paragraph defaults frames no paragraph, as in Word (#2360). Files from Apple Pages carry a sizeless one at the top left, which put every paragraph in the corner of the page: a header's title over the first table, the footer's page number out of sight, table rows of the wrong height | | 2026-10-16 | A plain-text or Markdown file opened and saved is saved: closing it no longer asks to save again, and Save in that prompt closes the window (#2376). Saving over the document's own file used to count as a copy, like Save As to plain text elsewhere, so the prompt came back after every save and only Don't Save closed the app | | 2026-10-16 | Dragging an In Line with Text picture, shape or text box moves it within the text, as in Word: a dashed insertion cursor follows the pointer through the text, and the drop puts the object there, still inline and selected, in one undo step (Ctrl+drag drops a copy there). Before, the drop floated it with Square wrapping where it was let go. Scripts and MCP use `arrange.bounds {"to": Pos}` / `arrange.copyTo {"to": Pos}` (#2233, #2234) | | 2026-10-16 | DOCX: a `HYPERLINK` field (complex or simple) reads as a link, as a `w:hyperlink` does: its result stays ordinary text carrying the link (`url`, `url#bookmark` or `#bookmark`), so a tab in it reaches its tab stop and a `PAGEREF` in it stays a field (#2174). A table of contents from Word for the web, whose entries are such fields, showed a box for each tab and no dot leaders; the entries now open as in Word and their links work | -| 2026-10-17 | The document's right-click menu offers the ribbon's Paste menu, item for item (#2583): Paste (the clipboard's formatting kept, Word's Keep Source Formatting), Keep Text Only, Merge Formatting and Paste Special…, where it had a single Paste. Same commands and shortcuts, with the system clipboard | -| 2026-10-17 | SmartArt Text Pane: Tab demotes and Shift+Tab promotes the focused item, as Word's pane does (#2701). The row keeps its focus, so a second Tab acts on the same item; an item that can't go down a level is left alone | -| 2026-10-15 | Selected table rows and cells copy as a table (#1744): Copy of whole rows, of cells in a row, or of a block of cells over several rows, then Paste outside the table, inserts a table of just those cells; Cut of rows or cells clears their text and leaves the rows and cells in place (the clipboard still gets the table), as Word does. Copy used to take only the cells' paragraphs | -| 2026-10-14 | Tables can be copied and cut (#1744): with the whole table selected (Select Table, or a drag over all of it), Copy puts the table itself on the clipboard, so Paste outside it inserts a copy of the table with its formatting (the plain text is tab and newline separated); Cut removes the table in one undo step, as in Word. Copy used to keep only the cells' paragraphs and Cut left the table in place | -| 2026-10-14 | DOCX row table border exceptions render and survive saving. Explicit cell borders win; a row exception does not change other rows. | -| 2026-10-19 | Typing no longer starts render threads on every repaint (#3027): page, area and icon renders share one kept vello_cpu context, reset to each size, instead of building a multi-threaded one (and its thread pool) per render. Typing about 150 characters in 15 s created 295–388 threads before and none now; CPU time while typing fell by about a third (Windows, debug build). | -| 2026-10-14 | Tab stops edited on the ruler: the corner selector picks Left/Center/Right/Decimal/Bar, a click sets a stop (Alt skips the snap), dragging moves it with a guide line and position tooltip, dragging off the ruler clears it; markers draw per kind and mirror for RTL; one `para.tabs` call and one undo step per gesture | -| 2026-10-12 | Fields keep `w:dirty` through DOCX saves (#877): a begin marker flagged by a generator that couldn't compute a result (pandoc-style TOC placeholders) keeps the flag on open/save — as a buffered field or a range field — so Word still refreshes it on open; computing a result (Update Field, Update Table) clears it, like Word's F9 | -| 2026-10-18 | Symbols keep their font (#2036): a `w:sym` or Insert › Symbol character in Wingdings, Symbol or Webdings remembers its symbol font apart from the text's font, so selecting all and changing the font (or Clear Formatting) no longer turns the symbols into boxes; saved back to DOCX as `w:sym`, so Word shows them too. Typed text and the Format Painter don't pick up the symbol font. | -| 2026-10-18 | Dragging a single selected cell's border (Select Cell, left-edge arrow, triple-click on its last paragraph) moves it in its row only; the neighbour takes up the difference. Checked against Word for Mac 16.113.4. | | 2026-10-16 | `wordcraft-cli run --script FILE.json` (`-` for stdin) runs a JSON list of commands, then saves to one or more outputs (docx and pdf in one run); errors name the command number and id and nothing is saved, #1963 | -| 2026-10-17 | Restrict Editing holds for structure too (#1327): an exception inside a table cell no longer lets table, row or cell formatting change the protected rest of the table; formatting limited to styles refuses Paste Formatting, table shading, borders, cell alignment, cell margins, text direction, table-style edits and locked table styles; loading, filtering or sorting recipients no longer rewrites merge-field results in a protected document. | -| 2026-10-18 | Manage Sources › Import… (#2640) reads a Word bibliography file (`b:Sources`: Word's own `Sources.xml` master list) into the document: the tags, names, kinds and fields Word saves are read by the same code that reads the bibliography custom XML part of a `.docx`, a tag already in the document is left alone (an import never overwrites an edited source), an untagged source gets a tag the way a new one does, the whole import is one undo step, and a file that isn't `b:Sources` is refused. | -| 2026-10-14 | RTF export writes every section (gap 19): `\sect` ends each section and `\sectd` carries its break type, page size and orientation, margins, columns, page numbering and title page, so multi-section documents survive an RTF round trip | -| 2026-10-14 | `ASK` and `SET` fields no longer show their stored result on the page or in PDFs (#1765): like Word, they only assign text to a bookmark and draw nothing; the stored result is kept and saved | -| 2026-10-15 | Table rows with an at-least height start the next page whole when less than their minimum is left on a page that already holds something, so one-row-per-page booklets keep their pages; rows taller than a page split from the top of the next page and repeated header rows go with the row (#1742) | | 2026-10-16 | Strict OOXML line heights render as Word renders them (#2329): `w:line="13.90pt"` under `lineRule="auto"` is a height read through twips (13.90 × 20 = 278; the 1.1583 multiple Word shows), not the 13.9 multiple the bare transitional number counts, so a Word 2024 file with 13.9 lines of line spacing opens at Word's 1 page with matching baselines instead of 10 | -| 2026-10-15 | RTF keeps more tracked changes (gap 19): tracked paragraph marks (a `\par` inside a `\revised`/`\deleted` group) and character and paragraph formatting changes (`\crauth`/`\crdate` with `\oldcprops`, `\prauth`/`\prdate` with `\oldpprops`) are read and written, so their balloons and Accept/Reject survive an RTF round trip | -| 2026-10-14 | ODT export writes sections (gap 19): every new-page section gets its own page layout and master page (the first stays "Standard"), named by its first paragraph or table with the page-numbering restart; a continuous section with columns is written as a columned `text:section`, so a landscape, two-column or restarted part survives a save as .odt | -| 2026-10-14 | A bulleted or numbered list item that starts with a lower-case word no longer gets the grammar squiggle for a missing sentence capital (#1741): list items are often fragments, so the sentence-capital rule (every proofed language) skips the first word of a list paragraph (own or style numbering); later sentences in the item are still checked | -| 2026-10-15 | The caret, clicks and selection edges fall between the letters of a ligature (fi, ffi, lam-alef), as in Word: the glyph's advance is shared evenly among its letters, mirrored in right-to-left text (#1974) | | 2026-10-16 | The Spike, as in Word: Ctrl+F3 (⌘F3 on macOS) cuts the selection and adds it to the end of the Spike, each piece followed by a paragraph mark; Ctrl+Shift+F3 (⌘⇧F3) inserts everything collected, in order and with its formatting, and empties the Spike. The clipboard is left alone; each is one undo step. The Spike is the AutoText entry "Spike", so Insert › Quick Parts inserts it without emptying it. It lasts for the session (Word keeps it in Normal.dotm) | -| 2026-10-17 | Home › Underline's drop-down shows each underline as a sample of its line, adds Dot-dot-dash, None and More Underlines…, and an Underline Color submenu backed by the new `format.underlineColor` command (catalog 490/505) (#2738) | | 2026-10-16 | Update Field is offered on a table of contents after a save and reopen, and repeated save and update adds no blank line (#2182; the flow in that report already worked since #1197) | | 2026-10-16 | DOCX two lines in one and horizontal in vertical (`w:eastAsianLayout`: id, combine, brackets, vert, vertCompress) are read and kept on save, in runs and character styles, instead of being dropped. Layout doesn't apply them yet. | | 2026-10-16 | Read Aloud speaks Russian, Ukrainian, Greek, Arabic, Hebrew, CJK and Thai text with a voice for its language instead of spelling out letters (#1843): the sentence's language comes from its run's tag (`w:bidi` for right-to-left text) or, when that disagrees with the script, from its letters, even when English letters outnumber them; Windows reads the text as UTF-8 and picks an installed voice of that language, macOS `say -v` and Linux `espeak -v` get the same language. The user's own voice stays whenever it already speaks the language (English documents read exactly as before), and a voice espeak lacks falls back to the default voice instead of silence. Not run on Windows or macOS here. | | 2026-10-16 | Hint-reliant CJK fonts execute TrueType contour assembly; Windows DFKai-SB no longer loses strokes. Synthetic local-font regression; no font binaries bundled. | | 2026-10-16 | Ctrl/⌘+wheel only zooms: a coast or wheel notch still gliding no longer scrolls the page on top of the zoom, which keeps the page point under the pointer (#1743). | -| 2026-10-15 | AutoCorrect follows Turkish and Azerbaijani case mapping: `istanbul` → `İstanbul`, `ılık` → `Ilık`, `İNgilizce` → `İngilizce` with no combining dot (#1923) | | 2026-10-16 | Releasing a table drag with the mouse (column or row border, move handle, selection areas) leaves the view where it is instead of scrolling back to the caret (#1738) | | 2026-10-16 | Hebrew in fields and quotes (#1670): a STYLEREF (or any field) showing right-to-left text such as "פרק א" reads right to left in headers and the body instead of reversed; smart quotes in Hebrew pinned to Word's logical-order result (“ before, ” after, ” in acronyms like צה"ל) | +| 2026-10-16 | Drawing dispatch uses the direct graphic-data child so nested pictures keep their text boxes. | +| 2026-10-16 | Zero-extent drawing anchors contribute no inline font height. | +| 2026-10-16 | Control-channel keyboard and text input reaches the focused widget while the native window is inactive, without activating it; normal widget targets, dialogs and document protection remain in force (#2420) | +| 2026-10-16 | Footnote and endnote editing keeps the body and active note text at normal opacity (#2545), without changing document colours or print/PDF output. | +| 2026-10-16 | A picture watermark in a header that starts with a table is drawn centred on the page behind the body text, on every page, instead of in the header's cell at the top of the page (#1775); `layoutInCell="0"` and VML `o:allowincell="f"` survive save and reopen | +| 2026-10-16 | An otherwise empty section starting a new page retains its paragraph line before a continuous section, matching an original native Word control. | +| 2026-10-16 | Equations from Word files keep all their content (#1273): math straight in the body or a table cell, math behind `mc:AlternateContent Requires="m"`, runs inside hyperlinks, simple fields and markup-compatibility blocks within an equation, and `w:sym`/Symbol-font characters in math; operators, delimiters and accents the math font lacks come from a fallback font. Every ECMA-376 §22.1 element is pinned by a coverage test. | +| 2026-10-16 | Captions and title pages (#1230): Insert Caption… on the right-click menu of pictures, shapes, text boxes and charts, the caption going under (or over) the object in its own cell or text box; Page Setup's Different First Page and Different Odd & Even Pages check boxes, so a title page can go without its page number | +| 2026-10-15 | A picture anchored further down a page but placed higher up it (fixed on the page, or moved up from its paragraph) has the paragraphs above its anchor wrap around it too, instead of running behind it, also when that wrap pushes the anchor onto the next page (#2048) | +| 2026-10-15 | Triple borders (tables, paragraphs, the `###` AutoFormat line) draw as three lines on screen and in PDF, across the line for vertical borders too; they used to draw as double lines (#1740) | +| 2026-10-15 | Selected table rows and cells copy as a table (#1744): Copy of whole rows, of cells in a row, or of a block of cells over several rows, then Paste outside the table, inserts a table of just those cells; Cut of rows or cells clears their text and leaves the rows and cells in place (the clipboard still gets the table), as Word does. Copy used to take only the cells' paragraphs | +| 2026-10-15 | Table rows with an at-least height start the next page whole when less than their minimum is left on a page that already holds something, so one-row-per-page booklets keep their pages; rows taller than a page split from the top of the next page and repeated header rows go with the row (#1742) | +| 2026-10-15 | RTF keeps more tracked changes (gap 19): tracked paragraph marks (a `\par` inside a `\revised`/`\deleted` group) and character and paragraph formatting changes (`\crauth`/`\crdate` with `\oldcprops`, `\prauth`/`\prdate` with `\oldpprops`) are read and written, so their balloons and Accept/Reject survive an RTF round trip | +| 2026-10-15 | The caret, clicks and selection edges fall between the letters of a ligature (fi, ffi, lam-alef), as in Word: the glyph's advance is shared evenly among its letters, mirrored in right-to-left text (#1974) | +| 2026-10-15 | AutoCorrect follows Turkish and Azerbaijani case mapping: `istanbul` → `İstanbul`, `ılık` → `Ilık`, `İNgilizce` → `İngilizce` with no combining dot (#1923) | | 2026-10-15 | Backspace with a whole table selected removes it, as in Word, and selected whole rows or columns go the same way; Delete clears them and keeps the table. A selection that covers a table and the paragraph before or after it removes the table, also when it starts inside the table or the table is nested (#1844) | | 2026-10-15 | Image size limits are checked before allocating (#1321): a picture whose header declares more RGBA bytes than the 512 MiB budget is refused before decoding (render and PDF share one helper in `wordcraft-geom`), and page rasters are capped at 100 million pixels in total, scaled down rather than only per side. | | 2026-10-15 | Saved DOCX files keep the order of mixed right-to-left and left-to-right text in Word: Hebrew around a Latin name, numbers, brackets or an e-mail address no longer changes places, and Word reports the Hebrew as Hebrew rather than Arabic (#1543). | | 2026-10-15 | Web: typing in Cyrillic or another non-Latin script no longer repeats text. WordCraft now honours the input method's request to erase around the caret before retyping (#1480). Chrome can still move the hidden text field's caret, so later letters may still land out of order. That cause is still open | -| 2026-10-16 | Drawing dispatch uses the direct graphic-data child so nested pictures keep their text boxes. | | 2026-10-15 | Equations: typing `V_dd` or `x^ab` and pressing Space keeps `dd` and `ab` whole in the subscript or superscript, like `V_(dd)`, as Word for Mac does; Linear format shows the bare form | | 2026-10-15 | Plain text pasted from another program keeps the formatting of the paragraph it lands in: Paste inserts it as Keep Text Only does, so every pasted line, empty lines too, becomes a paragraph with that paragraph's direction, style, alignment, indents and list, and the text after the caret keeps them. The lines after the first had default formatting, so pasting several lines into a right-to-left paragraph turned all but the first left-to-right | -| 2026-10-14 | Add Font… imports every file selected in the file chooser (#1789), not just the first: the desktop dialog and the web picker are multi-select, each file is added, a bad file is reported ("Added 11 fonts; 1 couldn't be read: X.ttf") without stopping the rest, and one pick adds at most 2,000 (the status line counts the skipped). On the web each font is added and reported on its own, with no single summary line. The built-in file browser still picks one file. | | 2026-10-15 | Additive paragraph spacing retains the full before-space after a section page break; ordinary overlapping spacing is unchanged. | -| 2026-10-14 | DOCX row table border exceptions render and survive saving. Explicit cell borders win; a row exception does not change other rows. | -| 2026-10-14 | Tab stops edited on the ruler: the corner selector picks Left/Center/Right/Decimal/Bar, a click sets a stop (Alt skips the snap), dragging moves it with a guide line and position tooltip, dragging off the ruler clears it; markers draw per kind and mirror for RTL; one `para.tabs` call and one undo step per gesture | -| 2026-10-12 | Fields keep `w:dirty` through DOCX saves (#877): a begin marker flagged by a generator that couldn't compute a result (pandoc-style TOC placeholders) keeps the flag on open/save — as a buffered field or a range field — so Word still refreshes it on open; computing a result (Update Field, Update Table) clears it, like Word's F9 | | 2026-10-15 | Exact line spacing keeps the run font baseline around tall equations; automatic and minimum spacing still grow for math. | -| 2026-10-16 | Zero-extent drawing anchors contribute no inline font height. | -| 2026-10-16 | Control-channel keyboard and text input reaches the focused widget while the native window is inactive, without activating it; normal widget targets, dialogs and document protection remain in force (#2420) | | 2026-10-15 | Hide Quick Access Toolbar (#1945): the toolbar's menu ends with Hide Quick Access Toolbar, as Word's does; the ribbon's right-click menu and Customize Ribbon › Quick Access Toolbar offer Show Quick Access Toolbar; kept between runs; `ui.quickAccessToolbar {"value"?}` for scripts and MCP | | 2026-10-15 | Rulers: the numbers thin out as the page shrinks on screen (every 1, 2, 4… units, at least 30 px apart, the small ticks at least 4 px apart), give way to the indent, tab and column markers, and the margins get ticks only; both rulers span the caret's page at its own scale in One Page and Multiple Pages and follow the caret to another page (#1878) | | 2026-10-15 | Spelling as you type no longer flags the word being typed; the squiggle comes when the word ends or the caret leaves it, as in Word (#1552) | | 2026-10-15 | Text Highlight Color: No Color becomes the Highlight button's choice, as in Word, so the next click on the button removes highlighting instead of applying the colour picked before; the ribbon and the mini toolbar share one menu (#2105) | -| 2026-10-16 | Footnote and endnote editing keeps the body and active note text at normal opacity (#2545), without changing document colours or print/PDF output. | -| 2026-10-16 | A picture watermark in a header that starts with a table is drawn centred on the page behind the body text, on every page, instead of in the header's cell at the top of the page (#1775); `layoutInCell="0"` and VML `o:allowincell="f"` survive save and reopen | -| 2026-10-17 | Ribbon hover hints: a disabled control says why (the command's own reason), split-button arrows, menu buttons and the font, size and outline boxes have hints, and hints show on keyboard focus (#1086). | -| 2026-10-17 | Insert › Drop Cap is a menu (None, Dropped, In margin, Drop Cap Options…); the dialog sets position, font, lines to drop and distance; letters in the margin; DOCX keeps them (#2601). | -| 2026-10-16 | An otherwise empty section starting a new page retains its paragraph line before a continuous section, matching an original native Word control. | -| 2026-10-16 | Equations from Word files keep all their content (#1273): math straight in the body or a table cell, math behind `mc:AlternateContent Requires="m"`, runs inside hyperlinks, simple fields and markup-compatibility blocks within an equation, and `w:sym`/Symbol-font characters in math; operators, delimiters and accents the math font lacks come from a fallback font. Every ECMA-376 §22.1 element is pinned by a coverage test. | -| 2026-10-16 | Captions and title pages (#1230): Insert Caption… on the right-click menu of pictures, shapes, text boxes and charts, the caption going under (or over) the object in its own cell or text box; Page Setup's Different First Page and Different Odd & Even Pages check boxes, so a title page can go without its page number | -| 2026-10-17 | SECTIONPAGES includes shared continuous-section pages. A native original control confirms a section starting on page 1 and continuing on page 2 reports 2. | -| 2026-10-17 | File › Print's Scale to paper size (#2108): pick Letter, Legal, A4 or any Layout › Size paper and every page is scaled to it and centred, the paper turned to each page's orientation, in the preview, the print job (with the spooler's media) and Save these pages as PDF; the document keeps its page size. `paper` param on `ui.print`/`file.printPdf` | -| 2026-10-17 | Non-overlapping body floating tables clear header tables. Original native controls distinguish never-overlap from allowed overlap. | +| 2026-10-15 | Design › Paragraph Spacing presets update built-in paragraph styles, so existing styled paragraphs follow the preset; custom paragraph styles keep their own spacing (#1913) | +| 2026-10-14 | Insert › Date & Time and DATE, TIME and other date fields show the computer's local date, time and weekday, daylight saving included, as Word does (#1707); they showed UTC, so a user in New Zealand at noon on 31 October got 30 October 23:00. Timestamps saved in files (revisions, comments, document properties) stay UTC. Backstage's greeting follows the local hour too | +| 2026-10-14 | DOCX row table border exceptions render and survive saving. Explicit cell borders win; a row exception does not change other rows. | +| 2026-10-14 | Tab stops edited on the ruler: the corner selector picks Left/Center/Right/Decimal/Bar, a click sets a stop (Alt skips the snap), dragging moves it with a guide line and position tooltip, dragging off the ruler clears it; markers draw per kind and mirror for RTL; one `para.tabs` call and one undo step per gesture | +| 2026-10-14 | Tables can be copied and cut (#1744): with the whole table selected (Select Table, or a drag over all of it), Copy puts the table itself on the clipboard, so Paste outside it inserts a copy of the table with its formatting (the plain text is tab and newline separated); Cut removes the table in one undo step, as in Word. Copy used to keep only the cells' paragraphs and Cut left the table in place | +| 2026-10-14 | DOCX row table border exceptions render and survive saving. Explicit cell borders win; a row exception does not change other rows. | +| 2026-10-14 | Tab stops edited on the ruler: the corner selector picks Left/Center/Right/Decimal/Bar, a click sets a stop (Alt skips the snap), dragging moves it with a guide line and position tooltip, dragging off the ruler clears it; markers draw per kind and mirror for RTL; one `para.tabs` call and one undo step per gesture | +| 2026-10-14 | RTF export writes every section (gap 19): `\sect` ends each section and `\sectd` carries its break type, page size and orientation, margins, columns, page numbering and title page, so multi-section documents survive an RTF round trip | +| 2026-10-14 | `ASK` and `SET` fields no longer show their stored result on the page or in PDFs (#1765): like Word, they only assign text to a bookmark and draw nothing; the stored result is kept and saved | +| 2026-10-14 | ODT export writes sections (gap 19): every new-page section gets its own page layout and master page (the first stays "Standard"), named by its first paragraph or table with the page-numbering restart; a continuous section with columns is written as a columned `text:section`, so a landscape, two-column or restarted part survives a save as .odt | +| 2026-10-14 | A bulleted or numbered list item that starts with a lower-case word no longer gets the grammar squiggle for a missing sentence capital (#1741): list items are often fragments, so the sentence-capital rule (every proofed language) skips the first word of a list paragraph (own or style numbering); later sentences in the item are still checked | +| 2026-10-14 | Add Font… imports every file selected in the file chooser (#1789), not just the first: the desktop dialog and the web picker are multi-select, each file is added, a bad file is reported ("Added 11 fonts; 1 couldn't be read: X.ttf") without stopping the rest, and one pick adds at most 2,000 (the status line counts the skipped). On the web each font is added and reported on its own, with no single summary line. The built-in file browser still picks one file. | +| 2026-10-14 | DOCX row table border exceptions render and survive saving. Explicit cell borders win; a row exception does not change other rows. | +| 2026-10-14 | Tab stops edited on the ruler: the corner selector picks Left/Center/Right/Decimal/Bar, a click sets a stop (Alt skips the snap), dragging moves it with a guide line and position tooltip, dragging off the ruler clears it; markers draw per kind and mirror for RTL; one `para.tabs` call and one undo step per gesture | | 2026-10-14 | Comment text being typed is no longer lost or misplaced (#1348): an edit or reply the document refuses (for example read-only protection) keeps the typed text in its field and says why on the status line; drafts belong to their document, so after New or Open a comment with the same number shows its own text; Save, Export, Print, Close, New and Open write pending comment text first; if the document refuses it, Save, Export and Print carry on with the stored comments and show why on the status line (a refused draft is dropped when Save is the only change), while Close, New and Open show the Save Changes prompt (Don't Save drops text the document refuses); Escape discards what was typed; in a document protected as read only or for forms the comment fields can't be typed in | +| 2026-10-12 | Fields keep `w:dirty` through DOCX saves (#877): a begin marker flagged by a generator that couldn't compute a result (pandoc-style TOC placeholders) keeps the flag on open/save — as a buffered field or a range field — so Word still refreshes it on open; computing a result (Update Field, Update Table) clears it, like Word's F9 | +| 2026-10-12 | Fields keep `w:dirty` through DOCX saves (#877): a begin marker flagged by a generator that couldn't compute a result (pandoc-style TOC placeholders) keeps the flag on open/save — as a buffered field or a range field — so Word still refreshes it on open; computing a result (Update Field, Update Table) clears it, like Word's F9 | +| 2026-10-12 | Fields keep `w:dirty` through DOCX saves (#877): a begin marker flagged by a generator that couldn't compute a result (pandoc-style TOC placeholders) keeps the flag on open/save — as a buffered field or a range field — so Word still refreshes it on open; computing a result (Update Field, Update Table) clears it, like Word's F9 | |---|---| -| 2026-10-12 | RTF reads and writes footnotes, endnotes and comments (author, initials, date, commented range), so they survive a round trip through RTF (#1053) | | 2026-11-07 | Page Setup also bounds the unfocused margin display after a long numeric paste; the accepted value is retained (#5650). | | 2026-11-05 | Page Setup's margin, paper-size and document-grid number boxes scroll long text inside the field instead of enlarging the dialog (#5650). Readiness estimates unchanged. | | 2026-10-29 | Print Markup discovers comment balloon anchors in one forward paragraph-object walk; anchor positions, filtering and the existing cap stay unchanged (#3614) | +| 2026-10-29 | PDF figure tagging reuses requested paragraph prefixes within each export (#3614); alternative text, decorative roles and drawing/page order stay unchanged. Synthetic export scaling and tag/persistence controls; readiness estimates unchanged. | | 2026-10-26 | Spelling & Grammar opens a right-side Proofing task pane observed in Word for Windows: sentence context, directly clickable suggestion cards and ignore/dictionary actions. Current-story traversal and stale-target checks are retained. Right-click keeps its compact menu. | +| 2026-10-26 | View › Window across the native windows (#322): Arrange All, View Side by Side, Synchronous Scrolling | | 2026-10-22 | Documents that keep content in another format (`w:altChunk`: a web page, RTF, text or another Word document, as generators and mail-merge tools write them) show it where it stands, as Word does, instead of leaving it out; one such file in the docxide-pdf corpus opened as an empty page and now matches Word's 8 pages. `.mht` web archives open, and web pages open the way Word opens them (style sheets, paragraph margins, Times New Roman, single lines, automatic spacing). Insert › Text from File keeps the inserted file's pictures | | 2026-10-18 | Explicit New/Open keeps the requested document visible when startup recovery discovery finishes; older copies stay available. Recover uses the regular theme. See docs/recovery.md. | -| 2026-10-15 | A floating picture or shape in a table cell set to align centre or bottom no longer lands half its height above its line (#1887); it starts at the anchor line | -| 2026-10-26 | View › Window across the native windows (#322): Arrange All, View Side by Side, Synchronous Scrolling | | 2026-10-18 | Picture Format › Size (#2573): width and height in the interface unit, and a size typed in any unit works, pixels too (`300 px` keeps the picture's proportions, #1901), applied once typed (Enter, Tab or a click elsewhere; Esc cancels) in one undo step. The group's launcher opens a Size dialog: height and width, scale of the original size (or of the size it opened with), Lock aspect ratio, the original size with its pixels, and Reset. `picture.size {"original": true, "scale"?}` sizes from the original; sizes past 4000 pt that keep the proportions shrink as a whole. | -| 2026-10-16 | Save Changes gives assistive technology a named alert dialog with the loss warning and any save failure; visual layout and save policy unchanged (#1015). Native screen-reader verification remains pending. | | 2026-10-17 | `design.scaleFontSizes` (Design › Document Formatting): grow or shrink every style's font size at once, by points (`delta`) or percent, rounded to half points and clamped to 1–1638 pt; inherited sizes follow, runs are untouched, one undo step (#1475) | +| 2026-10-16 | Save Changes gives assistive technology a named alert dialog with the loss warning and any save failure; visual layout and save policy unchanged (#1015). Native screen-reader verification remains pending. | +| 2026-10-15 | A floating picture or shape in a table cell set to align centre or bottom no longer lands half its height above its line (#1887); it starts at the anchor line | | 2026-10-15 | The font family caches are bounded (4096 families for text, 1024 for math, names over 256 bytes aren't remembered), so a document naming thousands of missing fonts can't grow memory; equation fonts are looked up again after a font is added or removed instead of keeping the old choice (#1354) | | 2026-10-15 | AutoCorrect recognizes `-->` as `→` (#2223), respecting replacement settings and undo without changing paragraph-start arrow bullets. | | 2026-10-15 | Numbered headings (#1793): the Multilevel List gallery offers four lists linked to Heading 1–9 (1 / 1.1 / 1.1.1, Article I. / Section 1.01 / (a), I. / A. / 1., Chapter 1; `list.multilevelPreset`). The heading styles carry the numbers, so paragraphs already in a Heading style keep their style and level, any other selected paragraph (Normal, Quote, Title) becomes Heading 1 (checked in Word), a new Heading 2 is numbered 2.1 by itself and body text stays unnumbered; Numbering or typing `1. ` keeps a heading a heading | @@ -603,171 +643,196 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target | 2026-10-15 | Dialog close control: a Windows-style box at the title bar's right end, the whole box clickable, red on hover, in both themes (#1885) | | 2026-10-15 | Font box: a Recently Used Fonts section at the top of the list (the fonts applied lately, most recent first, ten at most, kept between runs), then All Fonts, as in Word (#2068) | | 2026-10-15 | A missing Thai document font (TH Sarabun New, Angsana New, Cordia New, the UPC families…) is substituted by one Thai face for the whole run, Latin letters and digits included, as Word substitutes Cordia New; Thai no longer sits in one font next to larger Latin in another (#1549) | +| 2026-10-12 | RTF reads and writes footnotes, endnotes and comments (author, initials, date, commented range), so they survive a round trip through RTF (#1053) | |---|---| +| 2026-11-19 | Legacy header floats (#6805): three short header lines stay in place around a narrow Square, Tight or Through logo in mode 14 and flow beside it in mode 15. Measured in Word for Windows with a synthetic document. Overall readiness unchanged | +| 2026-11-15 | Headers in Word 2010 layout or older (#6805): Outside header table cells, legacy layout keeps header lines beside narrow Square, Tight and Through floats. A Top and Bottom float reaching below the text can make the header taller. In mode 15, text moves below Top and Bottom floats and can still flow beside narrow Square, Tight and Through floats. These cases were measured in Word for Windows with synthetic documents. Footer and header table-cell coverage remains open. Overall readiness unchanged | +| 2026-10-31 | Field dialog capitalization: AUTHOR, COMMENTS, FILENAME, KEYWORDS, LASTSAVEDBY, SUBJECT, TITLE, REF, STYLEREF and MERGEFIELD have a Format list with Uppercase, Lowercase, First capital and Title case, which writes `\* Upper`, `\* Lower`, `\* FirstCap` or `\* Caps` before `\* MERGEFORMAT`; Hide Codes sets the list from the typed code's last such switch and keeps every capitalization switch the code had, in order, until another Format is chosen; Preview Results and Finish & Merge apply a MERGEFIELD's capitalization switch to the record's value, and IF, NEXTIF and SKIPIF rules apply the tested MERGEFIELD's capitalization switch before comparing | +| 2026-10-29 | Corporate authors in bibliographies (#4848): a source whose author is an organisation (Word's Corporate Author, `b:Corporate`) keeps it when a Word document opens, instead of losing the author. Citations and bibliography entries write the name as it is in every style ("(World Health Organization, 2021)", never "Organization, W. H."); it gives the source's tag and its place in an author-sorted list, and it saves back as `b:Corporate`. Create Source has a Corporate Author box under Author. | +| 2026-10-29 | Table Properties follows the selection (#4857): with the whole table (or several rows, columns or cells) selected, the Row, Column and Cell settings apply to every selected row, column and cell, as in Word. Before, they changed the caret's row alone, so unticking Allow row to break across pages with the table selected left the other rows breaking. Allow row to break and Repeat as header row show as mixed when the selected rows differ and change nothing unless clicked. | +| 2026-10-24 | Table Layout › Convert to Text opens its dialog: Separate text with Paragraph marks, Tabs (the default), Commas or Other. With rows selected only those rows become text, and the rows above and below stay tables; the caret alone converts the whole table. The text keeps its formatting and objects, and a table nested in a cell stays a table; `table.toText` gains `other` + `char`. | +| 2026-10-24 | Document information fields: SUBJECT, KEYWORDS, COMMENTS, LASTSAVEDBY, REVNUM and NUMCHARS update with the other fields and are listed in the Field dialog; a quoted text after TITLE, SUBJECT, AUTHOR, KEYWORDS or COMMENTS replaces that document property (at most 255 characters), and NUMWORDS, NUMCHARS and REVNUM take a `\*` number format | +| 2026-10-24 | Field capitalization switches: `\* Upper`, `\* Lower`, `\* Caps` and `\* FirstCap` apply to the document information, DOCPROPERTY, FILENAME, date, REF, PAGEREF, SEQ, STYLEREF and table formula results that Update Field computes and to the page-number fields, and `\* CardText` and `\* OrdText` results are lowercase unless one of them follows (`\* CardText \* Caps` shows "Seven Hundred Ninety"); a table formula takes a `\*` number format (`=SUM(A1:B2) \* CardText`), and other `\*` switches such as `\* MERGEFORMAT` no longer make it a syntax error | +| 2026-10-24 | Field `\* DollarText` and `\* Hex` switches: `{ = 9.20 + 5.35 \* DollarText \* Upper }` shows "FOURTEEN AND 55/100" and `\* Hex` writes uppercase hexadecimal digits (458 shows "1CA"), in table formulas and in the page-number, SEQ, PAGEREF and count fields; `{ PAGE \* ArabicDash }` shows "- 31 -"; cardinal, ordinal and dollar text past 999,999 keep their digits | +| 2026-10-20 | Saving to a NAS share mounted by GVFS (`smb://` in the Linux file manager, #3003) works: the share refuses every Unix mode change with "Operation not supported", which used to fail the whole save, so the close prompt's Save never closed. The save now goes on without copying a mode the folder doesn't keep; any other failure still keeps the original. Unit tests; not yet confirmed on a real share | +| 2026-10-19 | Border boxes close their corners, as in Word: paragraph, page and character border boxes had a notch at each corner now that lines end flat; top and bottom lines now run on over the side lines, and lines without a neighbour end half their width past the edge | +| 2026-10-18 | Shape fills keep and draw gradients and transparency (#1500): Word 365 cover pages show their theme gradient panel and translucent wave; DrawingML and VML shapes, text boxes, group members (`a:grpFill`) and canvases are read, drawn (screen, PNG, PDF) and saved with their gradient stops, angles, focus and transparency; theme fill styles (`a:fillRef`) resolve to the fill they name. `.json` documents keep opaque fills as `[r,g,b]`. Edited as in Word: Shape Fill › Gradient (Light and Dark Variations) and the Format Shape pane (solid colour and transparency; gradient presets, type, direction, angle and stops) | +| 2026-10-18 | Split Cells and Convert Text to Table dialogs (#2592), matched to Word: Split Cells starts from the selection (twice its columns, its rows; Merge cells before split offered for several cells or one cell merged across columns); `table.split` gains `rows` and `mergeFirst`, a merged cell splits into 1 to its height rows (its height cuts it into rows, 1 × 1 changes nothing, a number that doesn't divide the height or more than it is refused with Word's messages) and column splits make equal parts without moving other rows' grid lines. Convert Text to Table guesses columns live, shows the row count, and offers Initial column width (Auto or up to 22 in, kept as each column's preferred width), AutoFit to contents/window and Paragraphs/Commas/Tabs/Other separators; `table.fromText` gains `paragraph`/`other` + `char`, `columns`, `autofit` and `width`. | +| 2026-10-18 | Different First Page works from page 1 (#2826): Insert › Header and Edit Header with the caret on page 1, and a double-click there while another header is being edited, go into page 1's own header instead of the default one page 1 no longer shows. | +| 2026-10-18 | Legacy menu keys (#1697; not on macOS): Alt, V, U turns on Full Screen View, as in Word for Windows, along with 17 other Word 2003 menu sequences observed there (views, ruler, zoom, Select All, Find/Replace/Go To, Symbol, Picture, Font, Paragraph, Word Count, Insert Table). Hidden as in Word, with a hint under the tab row while a sequence waits | +| 2026-10-18 | View › Focus now fills the screen (#1678): the document on black with a slim bar whose "⋯" drops the ribbon over the page. Full Screen View (`view.fullScreenView`) shows the pages alone with Search at the top and can be bound to any key in Customize Keyboard; the two turn each other off. F11's Full Screen (#980) still fills the screen with the whole window. Esc leaves either; Ctrl+F1 (⌘⌥R on macOS) collapses or expands the ribbon, and a shortcut of your own on Ctrl+F1 wins. Immersive Reader no longer switches Focus on | | 2026-10-17 | Paste from LibreOffice: a paragraph indented on both sides (HTML `
` on the clipboard) pastes as an indented Normal paragraph with LibreOffice's margins, not centred and italic in the Quote style (#1270). | | 2026-10-17 | DrawingML shape outlines retain explicit preset/custom dashes on screen and in PDF, including zero-width path strokes. | | 2026-10-17 | Missing Arial Unicode MS tries Arial and its proportional substitutes before code-font heuristics. | +| 2026-10-17 | DOCX glossary documents (building blocks) open into the model: Insert › Quick Parts and AutoText list and insert the document's own entries, and saving an entry with `"in": "document"` keeps it in the file (undoable). An untouched glossary is saved back byte for byte; an edited one is written from the model | +| 2026-10-17 | A table inserted in a right-to-left paragraph is a right-to-left table, like Word, so Tab moves right to left through its cells (#2634) | +| 2026-10-17 | Language dialog keeps inherited proofing language and no-proof choices (#2717). Opening and accepting unchanged no longer replaces style-derived values with English US and proofing enabled. | +| 2026-10-17 | Recovery: a snapshot that fails on its own size, the folder or disk budget, or a value the format cannot keep is not rewritten every 10 s while nothing changes; it waits for the next edit (#2625). Transient failures still retry. | +| 2026-10-17 | Saving into a folder that refuses a temporary file (macOS privacy protection, read-only folders, #2138) never overwrites an existing document in place: it is left untouched and the error says to use Save As to another folder or allow WordCraft access to the folder (System Settings › Privacy & Security › Files and Folders on macOS). A new file is created directly. Unit tests on Linux; not yet confirmed on a Mac | | 2026-10-16 | Web Layout text fills the window width and re-wraps once a resize settles, or at once on a zoom, instead of a fixed 800 pt column; Draft and Outline keep their 800 pt column (#1876). | | 2026-10-16 | Create Source: the automatic Tag is three letters of the first author and the last two digits of the year (`Smi20`), with 1, 2… added when taken, as Word for Mac 16.113.4 does (user-checked). Editing Author or Year keeps the Tag, as in Word, and the citations in the text show the new author and year (#2094; the reporter expected the Tag to follow). | -| 2026-10-18 | Shape fills keep and draw gradients and transparency (#1500): Word 365 cover pages show their theme gradient panel and translucent wave; DrawingML and VML shapes, text boxes, group members (`a:grpFill`) and canvases are read, drawn (screen, PNG, PDF) and saved with their gradient stops, angles, focus and transparency; theme fill styles (`a:fillRef`) resolve to the fill they name. `.json` documents keep opaque fills as `[r,g,b]`. Edited as in Word: Shape Fill › Gradient (Light and Dark Variations) and the Format Shape pane (solid colour and transparency; gradient presets, type, direction, angle and stops) | -| 2026-10-18 | Split Cells and Convert Text to Table dialogs (#2592), matched to Word: Split Cells starts from the selection (twice its columns, its rows; Merge cells before split offered for several cells or one cell merged across columns); `table.split` gains `rows` and `mergeFirst`, a merged cell splits into 1 to its height rows (its height cuts it into rows, 1 × 1 changes nothing, a number that doesn't divide the height or more than it is refused with Word's messages) and column splits make equal parts without moving other rows' grid lines. Convert Text to Table guesses columns live, shows the row count, and offers Initial column width (Auto or up to 22 in, kept as each column's preferred width), AutoFit to contents/window and Paragraphs/Commas/Tabs/Other separators; `table.fromText` gains `paragraph`/`other` + `char`, `columns`, `autofit` and `width`. | -| 2026-10-24 | Table Layout › Convert to Text opens its dialog: Separate text with Paragraph marks, Tabs (the default), Commas or Other. With rows selected only those rows become text, and the rows above and below stay tables; the caret alone converts the whole table. The text keeps its formatting and objects, and a table nested in a cell stays a table; `table.toText` gains `other` + `char`. | | 2026-10-16 | Font list entries of fonts with a very tall ascent (Amiri, Amiri Quran) sit in their row like the others instead of low or cut in half (#2570) | | 2026-10-16 | Read Mode draws documents cleanly (#1772): the arrows, Page Up/Down and Escape work as soon as it opens (the canvas kept a stable widget id, so it no longer lost the keyboard), only whole columns show, centred, at any column width, text size or window size, and the columns end above the page-turn bar instead of under it. | | 2026-10-16 | Comment and revision balloons are readable in the dark theme (#2045): they were drawn on a fixed white card under light text; the card, markup area and author colours are now theme tokens with a contrast test. | -| 2026-10-17 | DOCX glossary documents (building blocks) open into the model: Insert › Quick Parts and AutoText list and insert the document's own entries, and saving an entry with `"in": "document"` keeps it in the file (undoable). An untouched glossary is saved back byte for byte; an edited one is written from the model | | 2026-10-16 | Indonesian proofing (#498): id-ID spelling reads the installed Hunspell `id_ID` dictionary (`hunspell-id` on Debian/Ubuntu, LibreOffice's `dict-id`, or the Dictionaries folder), suggestions use its MAP/REP/TRY/KEY tables, generic repeated-word (offering `anak-anak`) and spacing checks explain in Indonesian; Review › Language, Set Proofing Language and File › Options › Proofing offer Indonesian. No dictionary data bundled; hyphenation keeps the English fallback; parity estimates unchanged | -| 2026-10-17 | A table inserted in a right-to-left paragraph is a right-to-left table, like Word, so Tab moves right to left through its cells (#2634) | | 2026-10-16 | French interface catalog completed: 402 entries added (equation gallery, built-in style and table-style names, citation styles, paper sizes, watermarks, Bookmark / Go To / Print dialogs), 2,615 in all, with a native-speaker review of the terminology; no French proofing yet | -| 2026-10-14 | DOCX row table border exceptions render and survive saving. Explicit cell borders win; a row exception does not change other rows. | -| 2026-10-15 | Layout › Columns with text selected puts only that text in columns, as in Word (#2024): a continuous section break goes where the selection starts and one where it ends (splitting a paragraph there; none at the document's start or end, or where a section already begins or ends), and the columns go on the section between, one undo step; More Columns… offers "Selected text" and picks it. Before, the whole section took the columns | -| 2026-10-14 | Tab stops edited on the ruler: the corner selector picks Left/Center/Right/Decimal/Bar, a click sets a stop (Alt skips the snap), dragging moves it with a guide line and position tooltip, dragging off the ruler clears it; markers draw per kind and mirror for RTL; one `para.tabs` call and one undo step per gesture | -| 2026-10-15 | The Three columns header/footer preset inserts a borderless one-row, three-cell table spanning the section text width, with left/center/right alignment (#2197). Tab moves between the cells. Cell guides show while editing the story and disappear when it is closed, unless View Gridlines is enabled. | -| 2026-10-12 | Table formulas: cell references and ranges (`=B2+B3`, `=SUM(B2:C3)`), arithmetic and comparisons, IF, AND, OR, NOT, TRUE, FALSE, DEFINED and the `\#` number format; ABOVE and LEFT sum the run of numbers next to the cell as Word does; an unknown function or a syntax error is an error instead of a sum; Update Field (F9) recalculates formula fields | -| 2026-10-12 | Fields keep `w:dirty` through DOCX saves (#877): a begin marker flagged by a generator that couldn't compute a result (pandoc-style TOC placeholders) keeps the flag on open/save — as a buffered field or a range field — so Word still refreshes it on open; computing a result (Update Field, Update Table) clears it, like Word's F9 | -| 2026-10-18 | Different First Page works from page 1 (#2826): Insert › Header and Edit Header with the caret on page 1, and a double-click there while another header is being edited, go into page 1's own header instead of the default one page 1 no longer shows. | -| 2026-10-15 | Track Changes Options › Moves (gap #5): Moved from and Moved to each have a mark and a colour (by default green double strikethrough and double underline, as before and as in Word for Mac), saved per user; `review.trackingOptions` takes `moveFromMark`, `moveFromColor`, `moveToMark`, `moveToColor`, and `trackMoves`, the document's Track moves setting: off, a tracked cut and paste is an ordinary deletion and insertion. DOCX `w:doNotTrackMoves` round-trips | -| 2026-10-18 | Legacy menu keys (#1697; not on macOS): Alt, V, U turns on Full Screen View, as in Word for Windows, along with 17 other Word 2003 menu sequences observed there (views, ruler, zoom, Select All, Find/Replace/Go To, Symbol, Picture, Font, Paragraph, Word Count, Insert Table). Hidden as in Word, with a hint under the tab row while a sequence waits | -| 2026-10-18 | View › Focus now fills the screen (#1678): the document on black with a slim bar whose "⋯" drops the ribbon over the page. Full Screen View (`view.fullScreenView`) shows the pages alone with Search at the top and can be bound to any key in Customize Keyboard; the two turn each other off. F11's Full Screen (#980) still fills the screen with the whole window. Esc leaves either; Ctrl+F1 (⌘⌥R on macOS) collapses or expands the ribbon, and a shortcut of your own on Ctrl+F1 wins. Immersive Reader no longer switches Focus on | -| 2026-10-15 | Selection bar mirrors for right-to-left paragraphs (the right margin) and works beside table rows: a click in the page margin beside a row selects the row, a drag selects rows, Shift+click extends by rows (a right-to-left table's bar is on the right); `table.selectAt {"extend"}`. Word's right-pointing arrow still missing | -| 2026-10-17 | Language dialog keeps inherited proofing language and no-proof choices (#2717). Opening and accepting unchanged no longer replaces style-derived values with English US and proofing enabled. | | 2026-10-16 | Text with the legacy Outline, Shadow, Emboss or Engrave font effects (`w:outline`, `w:shadow`, `w:emboss`, `w:imprint`) is drawn with them on screen and in PDFs, no longer as plain text: hollow outlined letters, or a grey copy behind the letters; the PDF keeps the text (#2534) | +| 2026-10-16 | Opening a DOCX no longer copies its pictures: each picture, and each embedded object or macro part kept for saving, was copied out of the unzipped package, so a document with pictures held them twice while it opened and left the package's copies behind as freed memory. The document now shares the package's bytes: a 92 MB document with 20 pictures opens in about 90 MB less (866 → 772 MB in the app on macOS; the command line's peak, 319 → 231 MB) | +| 2026-10-16 | Copying one equation on its own also puts it in the clipboard's MathML formats, which Microsoft documents Word reading first when it pastes math. Whether it pastes into Word as an editable equation hasn't been confirmed yet; testers welcome (#1297) | +| 2026-10-16 | Arabic words with lam-alef copy and search whole in exported PDFs with fonts that draw لا as a lam and a zero-width alef at one spot, such as the static Noto Naskh Arabic builds (#2310): السلام no longer reads back as السالم. Clusters drawn at the same place now go in reverse text order, so viewers reverse the run as a whole again. The page looks the same | +| 2026-10-15 | Layout › Columns with text selected puts only that text in columns, as in Word (#2024): a continuous section break goes where the selection starts and one where it ends (splitting a paragraph there; none at the document's start or end, or where a section already begins or ends), and the columns go on the section between, one undo step; More Columns… offers "Selected text" and picks it. Before, the whole section took the columns | +| 2026-10-15 | The Three columns header/footer preset inserts a borderless one-row, three-cell table spanning the section text width, with left/center/right alignment (#2197). Tab moves between the cells. Cell guides show while editing the story and disappear when it is closed, unless View Gridlines is enabled. | +| 2026-10-15 | Track Changes Options › Moves (gap #5): Moved from and Moved to each have a mark and a colour (by default green double strikethrough and double underline, as before and as in Word for Mac), saved per user; `review.trackingOptions` takes `moveFromMark`, `moveFromColor`, `moveToMark`, `moveToColor`, and `trackMoves`, the document's Track moves setting: off, a tracked cut and paste is an ordinary deletion and insertion. DOCX `w:doNotTrackMoves` round-trips | +| 2026-10-15 | Selection bar mirrors for right-to-left paragraphs (the right margin) and works beside table rows: a click in the page margin beside a row selects the row, a drag selects rows, Shift+click extends by rows (a right-to-left table's bar is on the right); `table.selectAt {"extend"}`. Word's right-pointing arrow still missing | | 2026-10-15 | Table Layout › Cell Margins opens an editable dialog initialized from the table defaults; confirming an unchanged dialog preserves imported margins, and changing one side retains the others (#1960) | | 2026-10-15 | Word's native ink inside groups and drawing canvases survives DOCX saves (gap 2): the ink member keeps its InkML part, relationship, content type and picture fallback, stays in its place among the members, moves with the group and is drawn from its fallback picture; deleting the group drops its part | | 2026-10-15 | Crash recovery copies and native .json files store pictures and kept parts as base64 text instead of arrays of numbers (#586 follow-up, #518): with a 27 MiB picture a recovery copy is 36 MiB instead of 96 MiB and a .json file 36 MiB instead of 286 MiB, written and read about five times faster. Copies and files written before still open | +| 2026-10-15 | Comments in headers, footers, notes and text boxes are listed with their place in the document, get a balloon beside their text, and Next, Previous and Go to reach them in reading order: the body with its notes and text boxes, then headers and footers. A comment in a story nothing shows (a removed header, a deleted note's text, a first-page or even-page header whose option is off, a linked text box's own text) isn't navigated to (#2289) | +| 2026-10-15 | Draw: Ink to Shape makes two-stroke arrows and arrows with a closed triangle head. A line plus a separate head stroke (an open V or a small closed triangle, drawn after the line or before it) whose apex sits at one of the line's ends becomes one straight arrow connector, and the head stroke goes, in one undo step; this works while drawing with Ink to Shape on and on lasso-selected strokes with Convert to Shapes. A shaft with a small triangle drawn round its tip in the same stroke is an arrow too; a triangle without a shaft stays a triangle. Our own design (Word for Mac has no Ink to Shape). | +| 2026-10-15 | Double-clicking the page number in a later page's footer opens the footer on that page (#2103): the double-click's first click moved the caret to the body text above and scrolled the view up to it; a click in the header/footer band from the body now leaves the caret and the view alone, as in Word | +| 2026-10-15 | The text pointer shows on white paper on Windows (#1746, #1417, #1126): Windows' inverting I-beam stayed white over the page, so WordCraft hides it there and draws its own, black on light paper and white on dark, edged in the other colour | +| 2026-10-15 | Slovenian (`sl`) interface: 2,614 catalog entries (every key of every other catalog, including native print settings), `sl-SI` system locales and a saved language choice; locale, catalog and bundled-font tests; no Slovenian proofing resources | +| 2026-10-15 | Lists (#1683): a bullet stored as a private-use character its font can't draw (the font isn't installed) shows the level's default bullet (• ○ ▪); it used to be whatever an installed icon font has at that code, such as Font Awesome's Twitter logo | +| 2026-10-15 | The web app keeps its preferences between visits (#2132): theme (dark mode), interface size, editing options and the rest of what the desktop app saves in `ui.json` are kept in the browser's `localStorage`, written as soon as they change | +| 2026-10-14 | DOCX row table border exceptions render and survive saving. Explicit cell borders win; a row exception does not change other rows. | +| 2026-10-14 | Tab stops edited on the ruler: the corner selector picks Left/Center/Right/Decimal/Bar, a click sets a stop (Alt skips the snap), dragging moves it with a guide line and position tooltip, dragging off the ruler clears it; markers draw per kind and mirror for RTL; one `para.tabs` call and one undo step per gesture | | 2026-10-14 | Consistent preferred cell widths override a stale table grid when both totals agree, for fixed and AutoFit tables. Conflicting widths, spans and percentages remain unchanged. | | 2026-10-14 | Legacy VML freeforms (`v:shape` with its own `path`), such as the rule lines in many older headers, are read as freeform shapes: they show on screen and in PDFs and are saved back as DrawingML custom geometry instead of vanishing | | 2026-10-14 | Field instructions spanning paragraphs no longer add blank lines during pagination; empty result paragraphs still take a line. | -| 2026-10-16 | Opening a DOCX no longer copies its pictures: each picture, and each embedded object or macro part kept for saving, was copied out of the unzipped package, so a document with pictures held them twice while it opened and left the package's copies behind as freed memory. The document now shares the package's bytes: a 92 MB document with 20 pictures opens in about 90 MB less (866 → 772 MB in the app on macOS; the command line's peak, 319 → 231 MB) | | 2026-10-14 | Page-break-only list paragraphs no longer print stray bullets or numbers. The next item keeps its number, matching the reference export. | -| 2026-10-12 | Backspace at the start of the paragraph after a table nested in a cell moves into the nested table's last cell, no longer into the last cell of the table around it | | 2026-10-14 | Grouped `flowChartOr` shapes draw their circle and crossing spokes, as in Word | -| 2026-10-15 | Comments in headers, footers, notes and text boxes are listed with their place in the document, get a balloon beside their text, and Next, Previous and Go to reach them in reading order: the body with its notes and text boxes, then headers and footers. A comment in a story nothing shows (a removed header, a deleted note's text, a first-page or even-page header whose option is off, a linked text box's own text) isn't navigated to (#2289) | | 2026-10-14 | Deleting a comment removes its anchors from headers, footers, notes and text boxes too, not just the body, and deletes the whole thread below it, replies to replies included; no anchor or reply is left pointing at a deleted comment (#1345) | | 2026-10-14 | Legacy DOC DIB conversion checks the BMP header and copy before allocation, uses the caller's decode allowance, and caps PNG output while encoding; a BMP fallback is kept when it fits. A generated 1-pixel regression covers 57/58/512-byte limits. Resource-exhaustion consequences remain unmeasured. Related: #1334 and #1554 | -| 2026-10-15 | Draw: Ink to Shape makes two-stroke arrows and arrows with a closed triangle head. A line plus a separate head stroke (an open V or a small closed triangle, drawn after the line or before it) whose apex sits at one of the line's ends becomes one straight arrow connector, and the head stroke goes, in one undo step; this works while drawing with Ink to Shape on and on lasso-selected strokes with Convert to Shapes. A shaft with a small triangle drawn round its tip in the same stroke is an arrow too; a triangle without a shaft stays a triangle. Our own design (Word for Mac has no Ink to Shape). | +| 2026-10-14 | A file name that isn't valid Unicode, such as a Latin-1 `café.docx`, no longer crashes `wordcraft-cli` or the app (#1440). The app and the CLI's `convert`, `info`, `text`, `inspect`, `render`, `zotero` and `run --file` open such a file, and saving it without a new name (`run --file … --cmd file.save`, or Save in the app) writes back to it. Any other such argument is an error naming it, an output name included; the app exits with status 2 on a `--control` port that isn't valid Unicode | +| 2026-10-14 | Update Field works inside headers, footers, notes and text boxes, on the part being edited, as in Word (#1706); with the caret in the body it still leaves them alone, and printing updates every field in the document | +| 2026-10-14 | Comment commands refuse explicit fractional, negative or wrong-type IDs (#1690, finding 3). Malformed IDs no longer truncate floats or fall back to the caret; omitted IDs still use the caret for Delete and Resolve. Refused commands keep the document, selection and undo/redo history; valid operations have synthetic repeated DOCX save/reopen coverage | +| 2026-10-14 | Tables nest 24 deep at most, the depth the .docx reader and writer keep (#1596): pasting a table into its own cell again and again no longer builds a document that crashes when it is saved as JSON, copied, closed or replaced by a new one. A table that would go deeper arrives as its paragraphs, text kept, and Insert › Table in a cell 24 tables deep says why it can't. Word has no limit | +| 2026-10-14 | File › Print translated in all 18 interface languages — printer list, duplex, grayscale, discovery/submission feedback and print commands (18 strings that shipped English-only with the craft-print integration; written from the English meaning, pending native-speaker review like the rest of the catalogs) | +| 2026-10-14 | All Caps and Small Caps draw ß as SS, as Word does (#1581): "Straße" in All Caps reads STRASSE, not STRASE, and other letters whose capital is two characters (ff, ʼn) draw in full. The ß is still one character: the caret never stops between the two S, and a click on them lands before or after it | +| 2026-10-14 | `layout.pageSetup` with a `section` checks its values like Margins, Size and Columns (#1582): non-finite numbers and margins that leave no room for text are refused with nothing changed; page sides, column count and gap, header/footer distances and line-numbering values are clamped to the same ranges | +| 2026-10-14 | Text wrap (#1376): in the narrow strip beside a square-wrapped picture, a word that doesn't fit moves on whole to the next row; it used to be split across the strip ("docu" / "mentazione") | +| 2026-10-14 | DOCX files with legacy VML preset shapes show them (#1377): Word's right arrow (`_x0000_t13`) and the other presets appear with their fill, outline and size, drawn as WordCraft draws the same DrawingML preset (the nearest shape when it has no exact one), and saving keeps them as DrawingML shapes; before, they were dropped | +| 2026-10-14 | Lists numbered with Russian letters (`russianLower`, `russianUpper`) show а), б), в) … я), then аа), бб), as in Word, instead of 1), 2), 3); the 29-letter sequence (no ё, й, ъ or ь) was observed in Word | +| 2026-10-14 | "Do you want to save changes?" answers from the keyboard after typing too (#1597): Save takes focus from the page when the prompt opens, so the arrow keys and Tab move between Save, Don't Save and Cancel instead of the caret behind it, and Enter answers | +| 2026-10-14 | Copied text keeps its formatting in other programs (#1523): Copy and Cut put HTML beside the plain text on the system clipboard for every selection, not only one holding an equation, so a browser, mail client or another word processor pastes bold, italic, fonts and sizes. RTF on the clipboard is not written yet | +| 2026-10-14 | Text copied out of an exported PDF reads as shown (#1473): All Caps and Small Caps text comes out in capitals, as from Word's PDFs, and plain text after it keeps its own case (before, a capital first drawn for a lowercase letter made later capitals extract lowercase) | +| 2026-10-14 | Web: Save in the "save changes?" prompt before New or Open now waits for the browser's save picker: the new or opened document replaces yours only once the file is written and closed. Cancelling the picker, or a write that fails, keeps your document open with its edits and undo, still unsaved, and the prompt comes back with the reason; a save that ends after another document has replaced it no longer runs the New/Open on that one or marks it unsaved, and New/Open while a picker save is still in flight ask first (#1315) | +| 2026-10-14 | File › Info › Inspect Document finds hidden text the way Word does (#1344): hidden by direct formatting, a character style or a paragraph style, in the body, headers, footers, footnotes and endnotes, comments and text boxes, and Remove All deletes all of it (and nothing visible) in one undo step, whole hidden paragraphs and the notes of hidden references included. The result lists anything it couldn't reach (`residual`), so a sanitised file is never reported clean by mistake | +| 2026-10-14 | ODT files keep their tracked changes (gap 19): insertions and deletions made in LibreOffice open as revisions with their author and date, deleted paragraph breaks and text inserted then deleted included, so Accept All and Reject All give the right text; saving to ODT writes them back, and the Track Changes setting goes both ways | +| 2026-10-14 | RTF keeps tracked changes (gap 19): insertions and deletions open as tracked changes with their authors and dates (`\revtbl`, `\revised`, `\deleted`, `\revdttm`) instead of plain text, so deleted text no longer reappears as normal text; saving to RTF writes them back, and Accept All / Reject All work after reopening | +| 2026-10-14 | Alignment guides: moving a picture, shape or text box snaps its edges or centre to the page's edges and centre, the margins and the other floating objects on the page, with a thin line across the page for each guide while dragging; Alt moves freely; File › Options › Advanced › Editing turns them off (`ui.alignmentGuides`). Our own design: Word for Mac shows no guides | +| 2026-10-14 | ODT files open with their sections (#1379): a paragraph that switches to another page style starts a new section on a new page, with that page's size, orientation, margins and columns and, when the file asks, page numbering restarting; a two-column `text:section` becomes a continuous two-column section. Before, the whole document was one portrait section, so landscape pages, columns and restarts were lost on open and on save to DOCX | +| 2026-10-14 | Hebrew and Arabic in exported PDFs copy and search as whole words (#1383): right-to-left glyphs are written left to right as they appear, the order Chrome and Edge (PDFium) and poppler read text back from (checked by hand), instead of in reading order, which they reversed (`שלום` came back as `םולש`, Arabic in pieces). Lam-alef stays whole and vowel marks follow their letters, though Chrome and poppler can still break a fully vowelled word with spaces. The page looks the same. Readers that take glyphs strictly in file order get only plain Hebrew runs right, through `/ReversedChars`; screen readers are unverified | +| 2026-10-14 | HTML import (#1381): header cells (``) are bold unless their own CSS says otherwise, and `text-align` on a cell, its row, row group or table aligns the cell's paragraphs (a paragraph's own alignment wins), so `wordcraft-cli convert page.html out.docx` writes the bold header and `w:jc` right-aligned cells. HTML, Markdown and plain text, which give no page size, open on the region's paper (A4 in Italy, Letter in the US) like a new blank document, in the app and in `wordcraft-cli`; documents with their own page size keep it | +| 2026-10-14 | Custom page sizes (#1433): Layout › Size ends with More Paper Sizes…, which opens Page Setup's new Paper group — a Paper size list (the named sizes, or Custom size) and Width and Height in the measurement unit; OK sets the size only when it changed, and a wider-than-tall size comes out landscape. `layout.size` now clamps each side to Word's 0.1"–22" and refuses a page the margins don't fit (the margins rule: 36 pt of text room), and Page Setup checks the size and margins together before applying either | +| 2026-10-14 | Bold text in Arial Black and other Black or Heavy fonts looks as in Word: older copies of these fonts (Arial Black in the core fonts) call themselves regular weight, so bold was drawn with an extra synthetic bold; a family named Black/Heavy now counts as that heavy | +| 2026-10-14 | German text hyphenates by German rules: runs in German (`de`, `de-DE`, `de-AT`, `de-CH`) use hyph-utf8's German patterns for the reformed spelling (MIT), so automatic hyphenation gives `un-ter-lie-gen-de` and `öf-fent-lich-recht-li-cher` instead of English-pattern breaks like `unterlieg-ende` and `rechtli-cher`; Swiss `ss` splits like any double consonant (`Stras-se`). German still has no spelling or grammar marks (#1564) | +| 2026-10-14 | A paragraph that runs on into the next column or onto the next page wraps around the shapes there (#1374): its continued lines are broken again for that column's wrap areas instead of running through a shape there (or around one left on the page before); the lines before, and the paragraph's own floating objects, stay where they were. Paragraphs with nothing new to wrap around are not laid out again | +| 2026-10-14 | RTF import keeps sections (#1378): a file with portrait and landscape parts, a two-column stretch or a page-numbering restart opens with one section each, as in Word, instead of one landscape section for the whole document. Each keeps its page size and orientation, margins, header/footer distance, columns, break type (continuous, next page, odd/even, column), page-number restart, start and format, title page and its own headers and footers; a section without its own links to the previous one's | +| 2026-10-14 | The system Save As dialog's file-type list names every format (Word Document, PDF, OpenDocument Text, Rich Text Format…) instead of one "Documents" entry, with the document's own format first (#1399) | +| 2026-10-14 | Colour emoji show on the page (#1269): 🧠, ✅ and other emoji were blank on screen and in `render_page` (only PDF export had them). Glyphs from colour fonts are now drawn in the font's own colours: bitmap emoji (Apple Color Emoji, Noto Color Emoji) and COLR fonts (Segoe UI Emoji, newer Noto builds, with gradients). A dark page doesn't invert them, the same as pictures | +| 2026-10-14 | `.doc` tables keep their cell shading (#1380), from Word 97 through Word 365, so a dark header row with white text is readable again, and lose the extra empty column at the right of every row; a table no longer takes the previous table's columns, borders or alignment. Rows merged across the table (a legend) come with #1123 | +| 2026-10-14 | Table deletes, Change Case and Unlink Fields respect Track Changes and locked content controls (#1329): with tracking on, Delete Table, Rows, Columns and Cells mark the cells' text deleted and keep the table (like Word), and Change Case is a tracked deletion and insertion, so Reject All restores the original; all of them refuse to delete a control locked against deletion or change content locked against editing | +| 2026-10-14 | Draw: Ink to Shape recognises arrows. A line and a V-shaped head drawn in one stroke (shaft first or head first, any direction) becomes a straight arrow connector with the head at the tip, in the stroke's colour and width; a lone V, a line with one barb and scribbles stay as they are. Our own recogniser: Word for Mac has no Ink to Shape to compare. Two-stroke arrows and arrows with a closed triangle head not yet. | +| 2026-10-14 | A picture or icon inserted by a command (`wordcraft-cli run`, MCP, control channel) leaves the caret after it, so the next `text.newParagraph` or `text.insert` no longer deletes it, and two inserted in a row are both kept; Picture Format commands still act on it, and a picture the user inserts or pastes in the app is still selected (#965) | +| 2026-10-14 | `.doc` notes, headers and text boxes read their text once (#1319): a story table that steps back no longer has many footnotes, endnotes, headers or text boxes copy the same text into a part each; a story starting inside an earlier one is dropped (a header or footer left empty is linked to the previous section's), so the stories together never hold more than the file's text | +| 2026-10-14 | ODT and `.doc` pictures stay within their byte budget (#1334): an ODT picture entry is inflated once however many frames point at it, and only when the size it declares fits in what is left (one inflating past that uses the budget up); a `.doc` inline picture that can't be read or doesn't fit is no longer decoded and copied again for every anchor on it, and is decoded only within what is left | +| 2026-10-14 | Open DrawingML freeform paths draw `a:tailEnd` at the final path segment | +| 2026-10-14 | Word XML Document (Flat OPC) reading is bounded everywhere in the file (#1353): nesting and elements are capped as the XML tree reader caps a part's, every child of the package and every part's data count against the part count and size limits (a repeated part name too), and data is checked before it's copied; base64 written as CDATA or with character references reads as the same bytes, and an entity in it is an error instead of bytes gone missing | +| 2026-10-14 | Text boxes in tables nested deeper than 16 survive edits (#1339): the paragraph walk behind text box pruning, copy and paste, reading order, drawing ids and note conversion goes through tables however deep they nest instead of stopping 16 tables down, so an unrelated edit no longer drops the text of a box shown only from deeper, and a copied deep table takes its boxes along | | 2026-10-13 | Justified vertical page alignment (#1320): a section set to Justified spreads each page's paragraphs and tables from the top margin to the bottom one, as Word does, including the last page and pages ending in a manual page break. DOCX `w:vAlign="both"` opens as Justified (it showed centred) and saves back; `layout.verticalAlign` takes `justify`, and Page Setup has a Vertical alignment box | | 2026-10-13 | macOS shortcuts as in Word for Mac: ⌘⇧S Save As, ⌘⌥E Insert Endnote, ⌘⌥A New Comment, ⌃H Replace, ⌘⌥R collapse the ribbon | | 2026-10-13 | The status bar flags a proofing language whose Hunspell dictionary isn't installed (Polish, Portuguese): "Polish (no dictionary)", with a tooltip naming the dictionary and where it is looked up (#1167) | -| 2026-10-14 | A file name that isn't valid Unicode, such as a Latin-1 `café.docx`, no longer crashes `wordcraft-cli` or the app (#1440). The app and the CLI's `convert`, `info`, `text`, `inspect`, `render`, `zotero` and `run --file` open such a file, and saving it without a new name (`run --file … --cmd file.save`, or Save in the app) writes back to it. Any other such argument is an error naming it, an output name included; the app exits with status 2 on a `--control` port that isn't valid Unicode | | 2026-10-13 | A picture (or shape) set to Behind Text can be dragged over the text it overlaps, whether or not it was selected first, in the body and in a header/footer. The press becomes an object drag only after the pointer moves, so an ordinary click still places the text caret in the overlapping text. The UI regression tests cover In Front of Text too | | 2026-10-13 | Saving to DOCX keeps the watermark: it is written as Word's own text-watermark shape in every header, and a document without headers gains one to hold it (#1290) | | 2026-10-13 | DOCX files with Word's text watermark (Design › Watermark, a VML text shape in the headers) show it on every page on screen and in the PDF (#1290) | | 2026-10-13 | Insert › Link has Word's Place in This Document: a link to a bookmark, a heading (through a hidden _Toc bookmark) or the top of the document, from the dialog's Link to: choice or `insert.link` with `bookmark`, `heading` or `top`; `link.targets` lists the places and Go To follows `_top` (#1234) | | 2026-10-13 | Cut copies to the system clipboard however it is run (#1265): the ribbon, the context menu and the native menu cut deleted the words without copying them (only the Cmd+X event wrote the clipboard, so Paste re-inserted the previous copy); Copy/Cut publication is centralised in one sink and every entry point is tested | | 2026-10-13 | Insert › Bookmark deletes bookmarks (#1236): the dialog is laid out as Word's, with Add, Delete and Go To beside the list, Sort by Name or Location and Hidden bookmarks; it opens on the bookmark around the caret, Delete and Go To keep it open, and Go To selects the bookmark's text. `insert.deleteBookmark {name}` removes both ends of a bookmark, also one across paragraphs (adding a bookmark under a name in use left such a one's end behind) | -| 2026-10-12 | Password-protected Word 97-2003 `.doc` files open after a password prompt (XOR obfuscation, RC4, RC4 CryptoAPI; wrong passwords are rejected by the stored verifier, #1079); written from the public specs and tested on synthetic files only, AES-encrypted `.doc` files are still refused | -| 2026-10-14 | Update Field works inside headers, footers, notes and text boxes, on the part being edited, as in Word (#1706); with the caret in the body it still leaves them alone, and printing updates every field in the document | -| 2026-10-12 | Comments can show only for the selected text (#1055): Track Changes Options › Comments › "Only for the selected text" drops the margin column, and the comment under the caret, or the clicked one, floats beside the page (over its edge in a narrow window). The default stays "In the margin", as in Word; `review.trackingOptions {"commentDisplay"}` for agents | -| 2026-10-12 | Clicking inside a selected comment's balloon moves the caret in its text (#1013); the click used to leave the balloon, so the caret could only be moved with the arrow keys. A press on any balloon now belongs to the balloon, not the page behind it | -| 2026-10-14 | Comment commands refuse explicit fractional, negative or wrong-type IDs (#1690, finding 3). Malformed IDs no longer truncate floats or fall back to the caret; omitted IDs still use the caret for Delete and Resolve. Refused commands keep the document, selection and undo/redo history; valid operations have synthetic repeated DOCX save/reopen coverage | -| 2026-10-12 | Page background pictures and textures (Design › Page Color › Fill Effects) are drawn (tiled or stretched) and kept on save instead of being dropped from the package (#999); PDF export paints them too | -| 2026-10-12 | Holding a click on the ribbon or toolbar no longer scrolls the document up (#1019): a double-click in the header or footer area left a text drag running, so the next press anywhere drove the edge auto-scroll; a drag now ends with the button, wherever it's released | -| 2026-10-12 | Tracked insertions and deletions inside a field result (a `=SUM(ABOVE)` subtotal) are kept as revisions: Accept All and Reject All act on them and a save writes the `w:del` back (#1037) | -| 2026-10-12 | Document title opens Rename Document; the account badge opens Options › General for user name and initials. `file.rename {name}` preserves file extensions and refuses an existing destination; unsaved names become the suggested save name without changing the Title property. | -| 2026-10-14 | Tables nest 24 deep at most, the depth the .docx reader and writer keep (#1596): pasting a table into its own cell again and again no longer builds a document that crashes when it is saved as JSON, copied, closed or replaced by a new one. A table that would go deeper arrives as its paragraphs, text kept, and Insert › Table in a cell 24 tables deep says why it can't. Word has no limit | | 2026-10-13 | Rounded rectangles (#1476): a `roundRect` keeps the corner radius its file gives it (`adj`), on screen, in PDF and when saved; all were drawn with a 16% corner | | 2026-10-13 | PAGEREF in headers and footers (#1477): "Page X of Y" with Y a page reference to a bookmark at each letter's end shows each letter's own total instead of the result stored in the file | | 2026-10-13 | Replace All respects locked content controls with Track Changes on or off; it refuses the entire batch before editing when any match would change locked content or remove a control locked against deletion | -| 2026-10-14 | File › Print translated in all 18 interface languages — printer list, duplex, grayscale, discovery/submission feedback and print commands (18 strings that shipped English-only with the craft-print integration; written from the English meaning, pending native-speaker review like the rest of the catalogs) | -| 2026-10-14 | All Caps and Small Caps draw ß as SS, as Word does (#1581): "Straße" in All Caps reads STRASSE, not STRASE, and other letters whose capital is two characters (ff, ʼn) draw in full. The ß is still one character: the caret never stops between the two S, and a click on them lands before or after it | | 2026-10-13 | Windows Magnifier follows the caret onto a new line: after Enter or Shift+Enter the view moves to the empty line at once, instead of staying on the line above until two more letters are typed (#1119) | | 2026-10-13 | A window too big for its screen shrinks to fit when it opens (#1215): on a laptop screen the first window reached under the taskbar or past the screen edge, with the end of the scroll bar, so dragging the scroll bar stopped where the pointer met the edge. A window saved that size is fitted on its next launch too | -| 2026-10-14 | `layout.pageSetup` with a `section` checks its values like Margins, Size and Columns (#1582): non-finite numbers and margins that leave no room for text are refused with nothing changed; page sides, column count and gap, header/footer distances and line-numbering values are clamped to the same ranges | | 2026-10-13 | `wordcraft --control` checks its port (#1426): a missing port, one outside 1–65535 or one that isn't a number prints an error naming it and exits with status 2, instead of starting without the control channel (and dropping `WORDCRAFT_CONTROL_PORT`); a flag right after it, such as `--sample` or `--version`, is read as a flag rather than as the port | -| 2026-10-14 | Text wrap (#1376): in the narrow strip beside a square-wrapped picture, a word that doesn't fit moves on whole to the next row; it used to be split across the strip ("docu" / "mentazione") | -| 2026-10-14 | DOCX files with legacy VML preset shapes show them (#1377): Word's right arrow (`_x0000_t13`) and the other presets appear with their fill, outline and size, drawn as WordCraft draws the same DrawingML preset (the nearest shape when it has no exact one), and saving keeps them as DrawingML shapes; before, they were dropped | -| 2026-10-14 | Lists numbered with Russian letters (`russianLower`, `russianUpper`) show а), б), в) … я), then аа), бб), as in Word, instead of 1), 2), 3); the 29-letter sequence (no ё, й, ъ or ь) was observed in Word | -| 2026-10-14 | "Do you want to save changes?" answers from the keyboard after typing too (#1597): Save takes focus from the page when the prompt opens, so the arrow keys and Tab move between Save, Don't Save and Cancel instead of the caret behind it, and Enter answers | -| 2026-10-12 | Text boxes from older Word files (VML) keep their internal margins, Resize shape to fit text and vertical alignment, so letterhead address blocks and form headers sit where Word puts them instead of 7 pt in and 4 pt down. Hidden drawings stay hidden (they were drawn as empty boxes) and are kept on save | | 2026-10-13 | Word's privacy options are kept and honoured when saving .docx (#1062): with Remove personal information, comments and tracked changes are saved by "Author" and the file has no creator or last-modified-by; with Remove date and time, they are saved without dates. The open document keeps the real names and dates; `file.privacyOptions` sets both | | 2026-10-13 | A selected comment balloon's Delete, Reply and Resolve buttons work again (#1085): pressing them no longer counts as a click on the page that closes the balloon first, so a new empty comment, or any other, can be deleted from its balloon | -| 2026-10-12 | Sample-text formulas on Enter (#1067): `=rand()` and `=lorem()`, optional paragraph/sentence counts, 5/3 defaults, original English and one-step undo | -| 2026-10-12 | File › Export › Word 2003 XML Document (#1081): documents save as WordprocessingML 2003 (`format: "wordml2003"` on the save commands, `wordcraft-cli convert --format wordml2003`); shapes, text boxes, charts and SmartArt don't survive, and it hasn't been opened in Word yet | -| 2026-10-12 | Direct run-level native InkML (`w:contentPart`) now survives DOCX edits and repeated saves with its relationship, content type and bytes intact. Native InkML rendering/editing and ink nested in groups or canvases remain missing | | 2026-10-13 | The caret is black or white, whichever shows against what lies under it — the paper, a page colour, a dark page, shading or a highlight — whatever the UI theme, as Word's inverted caret does; before, it stayed black on dark page colours and highlights and could vanish (#299) | | 2026-10-13 | Clicking the ribbon's tab names, empty space, gallery tiles or View check boxes, or the status bar's view buttons and language menu, no longer makes the caret vanish: typing goes on in the document as in Word, without another click on the page (#1093) | | 2026-10-13 | Dragging a Square-wrapped shape or picture on a multi-column page wraps the text of the column it lands in around it, and its old place closes up (#884) | | 2026-10-13 | Pagination with footnotes follows Word (#1116): a paragraph ending on a page with footnotes keeps its space after above the separator, otherwise its last lines move to the next page with the note; pages without notes are unchanged | | 2026-10-13 | Interface size means what it says (#822): a chosen size is absolute, as in PhotoCraft and PdfCraft, so "100%" is one screen pixel per point even where the system reports 200 % (a bare window manager on X11, where winit guesses the scale from the monitor's DPI). The new default, Auto, keeps the system's display scale and its menu entry shows the size it draws at; sizes run 75–300 %. A saved size from before stays the same if it was the default (now Auto) and becomes absolute otherwise | -| 2026-10-14 | Copied text keeps its formatting in other programs (#1523): Copy and Cut put HTML beside the plain text on the system clipboard for every selection, not only one holding an equation, so a browser, mail client or another word processor pastes bold, italic, fonts and sizes. RTF on the clipboard is not written yet | | 2026-10-13 | Copying an equation also puts MathML in HTML on the clipboard beside the linear text like `y=2x_s` (#816; Word/LibreOffice paste not yet verified; OMML is #1297). HTML export writes equations as MathML too, and opening or pasting HTML with MathML gives equations back | -| 2026-10-16 | Copying one equation on its own also puts it in the clipboard's MathML formats, which Microsoft documents Word reading first when it pastes math. Whether it pastes into Word as an editable equation hasn't been confirmed yet; testers welcome (#1297) | | 2026-10-13 | The Equation tab's galleries, structure buttons and symbols keep the theme's colours on Windows: their pictures share a few textures written in place (no wipe of pictures already on screen, room for the built-ins at high display scales), instead of hundreds of small textures freed in bulk, which on DirectX 12 showed inverted, red or teal tiles (#1002) | | 2026-10-13 | `file.close` over the control channel or MCP bridge no longer quits and discards unsaved changes (#1268): it returns an error unless the document is saved or `{"force": true}` is passed; the user's Save / Don't Save / Cancel prompt is unchanged | -| 2026-10-14 | Text copied out of an exported PDF reads as shown (#1473): All Caps and Small Caps text comes out in capitals, as from Word's PDFs, and plain text after it keeps its own case (before, a capital first drawn for a lowercase letter made later capitals extract lowercase) | -| 2026-10-14 | Web: Save in the "save changes?" prompt before New or Open now waits for the browser's save picker: the new or opened document replaces yours only once the file is written and closed. Cancelling the picker, or a write that fails, keeps your document open with its edits and undo, still unsaved, and the prompt comes back with the reason; a save that ends after another document has replaced it no longer runs the New/Open on that one or marks it unsaved, and New/Open while a picker save is still in flight ask first (#1315) | | 2026-10-13 | Closing with unsaved changes → Save that can't write the file (no permission, locked by another app, folder gone) now says so plainly instead of looking like Cancel: the prompt comes back with the reason in it ("Couldn't save … so it is still open and nothing was lost") for Save again, Don't Save or Cancel, the status bar says it too, and `ui.saveChanges` returns that error; the same for a Save As from the prompt; the document stays open with its edits (#1445) | -| 2026-10-14 | File › Info › Inspect Document finds hidden text the way Word does (#1344): hidden by direct formatting, a character style or a paragraph style, in the body, headers, footers, footnotes and endnotes, comments and text boxes, and Remove All deletes all of it (and nothing visible) in one undo step, whole hidden paragraphs and the notes of hidden references included. The result lists anything it couldn't reach (`residual`), so a sanitised file is never reported clean by mistake | -| 2026-10-14 | ODT files keep their tracked changes (gap 19): insertions and deletions made in LibreOffice open as revisions with their author and date, deleted paragraph breaks and text inserted then deleted included, so Accept All and Reject All give the right text; saving to ODT writes them back, and the Track Changes setting goes both ways | -| 2026-10-14 | RTF keeps tracked changes (gap 19): insertions and deletions open as tracked changes with their authors and dates (`\revtbl`, `\revised`, `\deleted`, `\revdttm`) instead of plain text, so deleted text no longer reappears as normal text; saving to RTF writes them back, and Accept All / Reject All work after reopening | -| 2026-10-14 | Alignment guides: moving a picture, shape or text box snaps its edges or centre to the page's edges and centre, the margins and the other floating objects on the page, with a thin line across the page for each guide while dragging; Alt moves freely; File › Options › Advanced › Editing turns them off (`ui.alignmentGuides`). Our own design: Word for Mac shows no guides | -| 2026-10-14 | ODT files open with their sections (#1379): a paragraph that switches to another page style starts a new section on a new page, with that page's size, orientation, margins and columns and, when the file asks, page numbering restarting; a two-column `text:section` becomes a continuous two-column section. Before, the whole document was one portrait section, so landscape pages, columns and restarts were lost on open and on save to DOCX | -| 2026-10-16 | Arabic words with lam-alef copy and search whole in exported PDFs with fonts that draw لا as a lam and a zero-width alef at one spot, such as the static Noto Naskh Arabic builds (#2310): السلام no longer reads back as السالم. Clusters drawn at the same place now go in reverse text order, so viewers reverse the run as a whole again. The page looks the same | -| 2026-10-14 | Hebrew and Arabic in exported PDFs copy and search as whole words (#1383): right-to-left glyphs are written left to right as they appear, the order Chrome and Edge (PDFium) and poppler read text back from (checked by hand), instead of in reading order, which they reversed (`שלום` came back as `םולש`, Arabic in pieces). Lam-alef stays whole and vowel marks follow their letters, though Chrome and poppler can still break a fully vowelled word with spaces. The page looks the same. Readers that take glyphs strictly in file order get only plain Hebrew runs right, through `/ReversedChars`; screen readers are unverified | -| 2026-10-14 | HTML import (#1381): header cells (``) are bold unless their own CSS says otherwise, and `text-align` on a cell, its row, row group or table aligns the cell's paragraphs (a paragraph's own alignment wins), so `wordcraft-cli convert page.html out.docx` writes the bold header and `w:jc` right-aligned cells. HTML, Markdown and plain text, which give no page size, open on the region's paper (A4 in Italy, Letter in the US) like a new blank document, in the app and in `wordcraft-cli`; documents with their own page size keep it | -| 2026-10-14 | Custom page sizes (#1433): Layout › Size ends with More Paper Sizes…, which opens Page Setup's new Paper group — a Paper size list (the named sizes, or Custom size) and Width and Height in the measurement unit; OK sets the size only when it changed, and a wider-than-tall size comes out landscape. `layout.size` now clamps each side to Word's 0.1"–22" and refuses a page the margins don't fit (the margins rule: 36 pt of text room), and Page Setup checks the size and margins together before applying either | -| 2026-10-19 | Border boxes close their corners, as in Word: paragraph, page and character border boxes had a notch at each corner now that lines end flat; top and bottom lines now run on over the side lines, and lines without a neighbour end half their width past the edge | -| 2026-10-14 | Bold text in Arial Black and other Black or Heavy fonts looks as in Word: older copies of these fonts (Arial Black in the core fonts) call themselves regular weight, so bold was drawn with an extra synthetic bold; a family named Black/Heavy now counts as that heavy | -| 2026-10-14 | German text hyphenates by German rules: runs in German (`de`, `de-DE`, `de-AT`, `de-CH`) use hyph-utf8's German patterns for the reformed spelling (MIT), so automatic hyphenation gives `un-ter-lie-gen-de` and `öf-fent-lich-recht-li-cher` instead of English-pattern breaks like `unterlieg-ende` and `rechtli-cher`; Swiss `ss` splits like any double consonant (`Stras-se`). German still has no spelling or grammar marks (#1564) | | 2026-10-13 | Highlighted text reads on a dark page (View › Switch Modes, #1252): highlights and character shading are dimmed, keeping their hue (yellow turns a dim olive, as in Word), and the text on them is drawn light (coloured text below 4.5:1 is drawn white, and underlines and strikethroughs follow the same rule), instead of white text on bright yellow; light page, print and exports unchanged | | 2026-10-13 | Full screen (#980): F11, or View › Window › Full Screen, fills the screen with the window (⌃⌘F on macOS); F11 again or Escape gives back the window as it was. Next Field, which Word puts on F11, keeps Word's Alt+F1 and Alt+Shift+F1 (and Shift+F11). The web app leaves full screen to the browser's own F11 | | 2026-10-13 | Double-clicking the top or bottom margin of a page creates its header or footer when it has none and puts the caret in it, as in Word (#960): the one that page shows (different first page, odd and even pages), only in Print Layout; one left empty is taken away again when you leave it, so nothing empty is saved. `insert.editHeader`/`insert.editFooter` take `{"page"}` for agents | | 2026-10-13 | Alt+numpad character codes, as in Word on Windows (#961): hold Alt, type a decimal code, release Alt — `0233` → é (Windows-1252), `233` → Θ (OEM code page 437; 850 in Western European locales and English outside the US), codes above 255 are Unicode (`8364` → €). Not on macOS; `text.typeCode` for agents | | 2026-10-13 | Review › Language and the status bar's language menu offer Set Proofing Language… again (#860): the Language dialog marks text as French, German or any of 29 languages and Set As Default makes it the document's language; Language Preferences… opens Options › Language. Text in a language outside the short list shows by name in the status bar and checked in the menu. Spelling and grammar remain English, Polish and Portuguese; text in other languages gets no marks | -| 2026-10-12 | A list label moves with its text when the paragraph is centred or aligned to the end (it stayed at the margin), in left-to-right and right-to-left paragraphs (#1159) | | 2026-10-13 | A paragraph that ends with a page break keeps its space after on the page before, as in Word: the next page no longer starts up to a line too low, and a page break before right after it no longer leaves a blank page | | 2026-10-13 | Tables break across pages like Word's: a cell without its own margins lines up with its neighbours, exact row heights include the bottom margin, and a row whose margin doesn't fit at a page bottom is split with widow control instead of moving to the next page whole | | 2026-10-13 | Equation parsers are hardened (#1456): deeply chained input (`x^1^1…`, `a/a/…`, `\sum\sum…`) no longer builds a tree thousands of levels deep that overflows small stacks, `\text{…}` is escaped in LaTeX output so it reads back unchanged, and runs merge inside every structure. | | 2026-10-13 | A WMF with a million object records opens in milliseconds instead of a second, and a large polygon or a small crop of a large bitmap no longer builds a second full-size copy while it is read (#1463) | | 2026-10-13 | PDF export (#1474): a horizontal or vertical line inside a group (a divider in a grouped box) is drawn, as on screen; it was left out because it has no height | -| 2026-10-14 | A paragraph that runs on into the next column or onto the next page wraps around the shapes there (#1374): its continued lines are broken again for that column's wrap areas instead of running through a shape there (or around one left on the page before); the lines before, and the paragraph's own floating objects, stay where they were. Paragraphs with nothing new to wrap around are not laid out again | | 2026-10-13 | A PAGE field in the body shows the number of the page it is actually on (#1352): after a page break inside its paragraph, or when the paragraph runs over onto the next page, it no longer repeats the first page's number; the rest of the paragraph is broken again for the wider number (page 9 to 10). Only paragraphs with PAGE fields are laid out again | -| 2026-10-14 | RTF import keeps sections (#1378): a file with portrait and landscape parts, a two-column stretch or a page-numbering restart opens with one section each, as in Word, instead of one landscape section for the whole document. Each keeps its page size and orientation, margins, header/footer distance, columns, break type (continuous, next page, odd/even, column), page-number restart, start and format, title page and its own headers and footers; a section without its own links to the previous one's | -| 2026-10-14 | The system Save As dialog's file-type list names every format (Word Document, PDF, OpenDocument Text, Rich Text Format…) instead of one "Documents" entry, with the document's own format first (#1399) | -| 2026-10-14 | Colour emoji show on the page (#1269): 🧠, ✅ and other emoji were blank on screen and in `render_page` (only PDF export had them). Glyphs from colour fonts are now drawn in the font's own colours: bitmap emoji (Apple Color Emoji, Noto Color Emoji) and COLR fonts (Segoe UI Emoji, newer Noto builds, with gradients). A dark page doesn't invert them, the same as pictures | -| 2026-10-14 | `.doc` tables keep their cell shading (#1380), from Word 97 through Word 365, so a dark header row with white text is readable again, and lose the extra empty column at the right of every row; a table no longer takes the previous table's columns, borders or alignment. Rows merged across the table (a legend) come with #1123 | -| 2026-10-12 | On the web, pasting a picture while a comment, the Find box, a dialog field or the Backstage has the keyboard no longer inserts it into the document; it inserts once only when the page is the edit target (#1349) | -| 2026-10-14 | Table deletes, Change Case and Unlink Fields respect Track Changes and locked content controls (#1329): with tracking on, Delete Table, Rows, Columns and Cells mark the cells' text deleted and keep the table (like Word), and Change Case is a tracked deletion and insertion, so Reject All restores the original; all of them refuse to delete a control locked against deletion or change content locked against editing | -| 2026-10-14 | Draw: Ink to Shape recognises arrows. A line and a V-shaped head drawn in one stroke (shaft first or head first, any direction) becomes a straight arrow connector with the head at the tip, in the stroke's colour and width; a lone V, a line with one barb and scribbles stay as they are. Our own recogniser: Word for Mac has no Ink to Shape to compare. Two-stroke arrows and arrows with a closed triangle head not yet. | -| 2026-10-12 | A DOCX hyperlink whose relationship has an empty target (as LibreOffice writes) is no link (#1005): no "Ctrl+Click to follow link" tooltip over the text, which keeps its Hyperlink style | -| 2026-10-12 | Table eraser beside vertically merged cells (#1039): the border between two cells merged down the same rows merges them into one cell that stays merged down those rows; a border whose two sides can't make one rectangle is hidden on both sides along the whole edge instead of refused | | 2026-10-13 | Styles gallery for DOCX files that mark no style `w:qFormat` (LibreOffice) shows Word's usual quick styles: Normal, No Spacing, Headings, Title, Subtitle… (#1238) | | 2026-10-13 | Pictures can be cropped on the page: Picture Format › Crop shows black crop handles; dragging one trims that side (a corner, two) while the picture keeps its scale and the visible part stays put, dragging back out restores it, and the cropped-away part shows under a dark dim. Esc, Enter, a click outside or Crop again keep the crop; each drag is one undo step | | 2026-10-13 | Table Layout › Cell Size: the Height and Width boxes apply to every row and column the selection covers (a selected table changed only its last row and column), and to the caret's row and column without a selection (#1242) | +| 2026-10-13 | Word 365 cover pages (#743): shapes placed relative to the page's height now sit where Word puts them (they were at the top of the column), and a freeform drawn back to its start without being closed is filled, so the cover's coloured panel and its white title show | +| 2026-10-13 | No document behind the Start screen (#1129): Esc or Back from it shows an empty window (no page, ribbon greyed out but for Help) until Blank document, a template or a file is opened, as in Word; closing it asks nothing | +| 2026-10-13 | Keytips reach the table tabs as in Word: Alt, J, T for Table Design and Alt, J, L for Table Layout, then their controls' badges (#1183) | +| 2026-10-13 | A paragraph with more than 65,536 distinct formats keeps each one (#1340): the layout numbered a paragraph's formats with 16 bits, so every run past that drew with the 65,536th format's font, size, link and tracked-change marking | +| 2026-10-13 | New comments, notes, text boxes and lists in a document whose file used the largest ids (#1338): they take a free id instead of overflowing (a crash) or reusing one already taken (a new list could pick up another's definition); `Document::try_add_part` and `Numbering::try_add_list` report ids running out instead | +| 2026-10-13 | An empty file opens (#1384): the zero-byte .docx that File Explorer's New › Microsoft Word Document makes opens as a new blank document (the region's paper, the editing language), and Save writes it back to that file instead of asking for a name | +| 2026-10-13 | Paragraph dialog over differently formatted paragraphs (#1346): a field they differ in shows blank (a check box neither on nor off, no direction picked) and OK leaves it as each paragraph has it; OK sends only the fields that changed, as one undo step, instead of giving every paragraph the caret paragraph's formatting in three undo steps | +| 2026-10-13 | Korean interface catalog completed: all 2,463 entries translated; the ko-KR system locale and saved language choice select the interface. The UI prefers Korean embedded/system font faces so Hangul renders instead of boxes, and print settings and printer feedback are translated. Korean proofing remains unavailable; macOS Korean IME fixes are still pending (#163, #164) | +| 2026-10-13 | Web and Draft Layout now render visible full-resolution raster tiles for exceptionally tall pages rather than downsampling the entire page into one texture; verified with a 440-paragraph headless UI reproduction | +| 2026-10-13 | Markdown import of text full of backtick runs that never close is linear (#1336): every code span and link bracket over them searched the rest of the text for a closing run (2 MB in brackets: 17.8 s → 0.06 s) | +| 2026-10-13 | Markdown import keeps every link in a paragraph (#1452): a `[` nothing closes, bracketed text that is not a link and each link used up the bracket scans' look-ahead budget as if they had read the rest of the paragraph, so later links were plain text; a scan now costs what it reads, and brackets it has passed are looked up | +| 2026-10-13 | Swedish (`sv`) interface: 2,504 catalog entries (every key of the reference catalog, the equation gallery, everything the interface audit finds, and 44 newer strings no catalog had yet, among them the native print settings), `sv-SE`/`sv-FI` system locales and a saved language choice; locale, catalog and bundled-font tests; AI-assisted, terminology and the running app reviewed by a native speaker; no Swedish proofing resources | +| 2026-10-13 | Croatian (`hr`) interface: 2,507 catalog entries (every key of the reference catalog, built-in style names and the equation gallery), `hr-*` system locales and a saved language choice; locale, catalog and bundled-font tests; no Croatian proofing yet | +| 2026-10-13 | The interface-translation audit runs in CI again (#1128): the size labels of Envelopes, Labels and Layout › Size are translated (`4,13 × 9,5 дюйма`) and use the region's decimal separator, and status-bar messages (table split and merge, ink replay, citations, SmartArt, Researcher, Design defaults), the Reading Mode toolbar, Go To and Search's Suggested heading are translated in every interface language, and the Read Aloud player no longer shows a speech error a frame before the status bar does, the race behind the audit's rare failure under load | +| 2026-10-12 | Table formulas: cell references and ranges (`=B2+B3`, `=SUM(B2:C3)`), arithmetic and comparisons, IF, AND, OR, NOT, TRUE, FALSE, DEFINED and the `\#` number format; ABOVE and LEFT sum the run of numbers next to the cell as Word does; an unknown function or a syntax error is an error instead of a sum; Update Field (F9) recalculates formula fields | +| 2026-10-12 | Fields keep `w:dirty` through DOCX saves (#877): a begin marker flagged by a generator that couldn't compute a result (pandoc-style TOC placeholders) keeps the flag on open/save — as a buffered field or a range field — so Word still refreshes it on open; computing a result (Update Field, Update Table) clears it, like Word's F9 | +| 2026-10-12 | Backspace at the start of the paragraph after a table nested in a cell moves into the nested table's last cell, no longer into the last cell of the table around it | +| 2026-10-12 | Password-protected Word 97-2003 `.doc` files open after a password prompt (XOR obfuscation, RC4, RC4 CryptoAPI; wrong passwords are rejected by the stored verifier, #1079); written from the public specs and tested on synthetic files only, AES-encrypted `.doc` files are still refused | +| 2026-10-12 | Comments can show only for the selected text (#1055): Track Changes Options › Comments › "Only for the selected text" drops the margin column, and the comment under the caret, or the clicked one, floats beside the page (over its edge in a narrow window). The default stays "In the margin", as in Word; `review.trackingOptions {"commentDisplay"}` for agents | +| 2026-10-12 | Clicking inside a selected comment's balloon moves the caret in its text (#1013); the click used to leave the balloon, so the caret could only be moved with the arrow keys. A press on any balloon now belongs to the balloon, not the page behind it | +| 2026-10-12 | Page background pictures and textures (Design › Page Color › Fill Effects) are drawn (tiled or stretched) and kept on save instead of being dropped from the package (#999); PDF export paints them too | +| 2026-10-12 | Holding a click on the ribbon or toolbar no longer scrolls the document up (#1019): a double-click in the header or footer area left a text drag running, so the next press anywhere drove the edge auto-scroll; a drag now ends with the button, wherever it's released | +| 2026-10-12 | Tracked insertions and deletions inside a field result (a `=SUM(ABOVE)` subtotal) are kept as revisions: Accept All and Reject All act on them and a save writes the `w:del` back (#1037) | +| 2026-10-12 | Document title opens Rename Document; the account badge opens Options › General for user name and initials. `file.rename {name}` preserves file extensions and refuses an existing destination; unsaved names become the suggested save name without changing the Title property. | +| 2026-10-12 | Text boxes from older Word files (VML) keep their internal margins, Resize shape to fit text and vertical alignment, so letterhead address blocks and form headers sit where Word puts them instead of 7 pt in and 4 pt down. Hidden drawings stay hidden (they were drawn as empty boxes) and are kept on save | +| 2026-10-12 | Sample-text formulas on Enter (#1067): `=rand()` and `=lorem()`, optional paragraph/sentence counts, 5/3 defaults, original English and one-step undo | +| 2026-10-12 | File › Export › Word 2003 XML Document (#1081): documents save as WordprocessingML 2003 (`format: "wordml2003"` on the save commands, `wordcraft-cli convert --format wordml2003`); shapes, text boxes, charts and SmartArt don't survive, and it hasn't been opened in Word yet | +| 2026-10-12 | Direct run-level native InkML (`w:contentPart`) now survives DOCX edits and repeated saves with its relationship, content type and bytes intact. Native InkML rendering/editing and ink nested in groups or canvases remain missing | +| 2026-10-12 | A list label moves with its text when the paragraph is centred or aligned to the end (it stayed at the margin), in left-to-right and right-to-left paragraphs (#1159) | +| 2026-10-12 | On the web, pasting a picture while a comment, the Find box, a dialog field or the Backstage has the keyboard no longer inserts it into the document; it inserts once only when the page is the edit target (#1349) | +| 2026-10-12 | A DOCX hyperlink whose relationship has an empty target (as LibreOffice writes) is no link (#1005): no "Ctrl+Click to follow link" tooltip over the text, which keeps its Hyperlink style | +| 2026-10-12 | Table eraser beside vertically merged cells (#1039): the border between two cells merged down the same rows merges them into one cell that stays merged down those rows; a border whose two sides can't make one rectangle is hidden on both sides along the whole edge instead of refused | | 2026-10-12 | Forms protection: filling content controls under `w:edit="forms"` (#1077) — entries and typing inside fillable controls run, every other edit rolls back ("only the editable regions of this protected document can change"); `review.restrict` reports `formFields`; Find Next Region covers form fields (pane button shows for forms documents); a save/reopen keeps the protection, the filled values and the password guard | | 2026-10-12 | RTF import now uses the RTF spec's defaults where a file names none (#902): no space before or after paragraphs, single line spacing, and the `\deff` default font, instead of WordCraft's Normal style; RTF files that relied on the old defaults open tighter, like in Word | | 2026-10-12 | `--help` and `-h` print the usage and exit (#968): `wordcraft --help` lists the app's options without opening a window (it used to try to open a file named `--help`), and `wordcraft-cli --help` works for every command instead of failing with `unknown option --help` | -| 2026-10-11 | Right-clicking a table cell offers the table's commands, and as in Word they follow the selection: with the caret in a cell Insert, Delete Cells, Split Cells, Text Direction and Table Properties…; with several cells Merge Cells instead of Split; with whole columns or rows Delete Columns or Rows, Merge Cells and Distribute Rows and Columns; with the whole table Delete Table, Distribute, AutoFit and Insert Caption…. A right-click beside selected cells moves the caret there instead of keeping them | -| 2026-10-11 | Drags, Shift+arrows and Shift+click over table cells select whole cells, as in Word: from one cell into another the rectangle between them (bold, alignment and Delete leave the other cells alone), into or out of a table whole rows; extending again goes on from where the selection started | -| 2026-10-11 | More of the table mouse: arrows above a column, left of a row and along a cell's left edge select it (a drag selects more; a selected column is edited cell by cell, numbering it makes one list), "+" buttons beside the borders insert a row or column, the move handle past the top-left corner selects the table or drags it to float where it's dropped, and a double-click on a column border fits the column; Select Column in the ribbon; `table.selectAt`, `table.insertAt`, `table.moveDrag`, `table.fitColumn` and `table.selectColumn` for agents | | 2026-10-12 | Table fixes (#971): a double-click on a nested table's column border fits the column within the cell around the table (it could run out to the page's right margin); a selection from text into or across a table shades the whole cells of the rows it takes, not just their letters; Shift+Right at the end of a cell's text selects that cell first, as in Word, and the next press takes the next cell too | | 2026-10-12 | AutoCorrect keys its built-in English replacement list by language (#835): Polish, Croatian, Bosnian and Serbian `i` ("and") is no longer turned into `I`; English and untagged text unchanged | | 2026-10-12 | Ribbon groups fit above their labels: View › Show splits its four check boxes into two columns (Hide White Space, #645, had pushed the fourth onto the "Show" label), Developer › Controls loses the gaps that ran into its label, and Layout › Paragraph (#654) no longer trips a debug assertion and sits 2.5 pt higher; a test draws every tab in every language and fails on any group taller than the ribbon | | 2026-10-12 | Down and Up from the start of a line beside a table go into it (#1007): the caret, left of the first cell's text there, used to skip the whole table to the paragraph beyond it; it now lands in the cell under it or the nearest one, as in Word | | 2026-10-12 | Window caption: a non-Latin file name is drawn with a document fallback face (or the CJK UI font), instead of `?` | | 2026-10-12 | Comments: Arabic, Hebrew and other non-Latin comment text and author names are drawn with a document fallback face (or the CJK UI font) in the balloons and Comments pane, instead of boxes; read-only balloons show right-to-left text in reading order, set against the right edge | -| 2026-10-15 | Double-clicking the page number in a later page's footer opens the footer on that page (#2103): the double-click's first click moved the caret to the body text above and scrolled the view up to it; a click in the header/footer band from the body now leaves the caret and the view alone, as in Word | -| 2026-10-15 | The text pointer shows on white paper on Windows (#1746, #1417, #1126): Windows' inverting I-beam stayed white over the page, so WordCraft hides it there and draws its own, black on light paper and white on dark, edged in the other colour | -| 2026-10-13 | Word 365 cover pages (#743): shapes placed relative to the page's height now sit where Word puts them (they were at the top of the column), and a freeform drawn back to its start without being closed is filled, so the cover's coloured panel and its white title show | | 2026-10-12 | 32-bit Windows starts on OpenGL. DirectX 12 graphics pipeline creation returns "The parameter is incorrect" and the app exited before the window appeared | | 2026-10-12 | New documents follow the system region (#838): A4 and centimetres outside the US (Letter in the CLDR Letter territories, inches in the US), lengths written with the region's decimal separator (`2,54 cm`) and typed with either; an explicit Measurement units choice wins; `file.options {"region"}` for agents | | 2026-10-12 | Paste from other programs keeps their formatting (#687): Ctrl+V and Home › Paste read the system clipboard's HTML (and RTF on Windows and Wayland); Merge Formatting takes the destination's font and paragraph and keeps bold, italic, underline and strikethrough; Paste Special lists what the system clipboard holds (HTML, RTF, picture, text). Linux: pictures copied in a browser or Spectacle paste on KDE and other Wayland desktops (data-control clipboard), and a paste that finds nothing usable names what the clipboard holds instead of "empty" (#833) | | 2026-10-12 | Table style editor (#714): New/Modify Table Style edits each of the 13 table style parts (header row, total row, first/last column, odd/even bands, corner cells) with font, colour, fill, borders and cell alignment; every table using the style follows; all parts round-trip in DOCX; `table.modifyStyle` takes `part`/`parts` and per-edge borders | | 2026-10-12 | STYLEREF fields (#775): running headers and footers show each page's chapter title (page's first, or `\l` last, paragraph of the style, else the nearest before), style names, ids, heading levels and character styles, number switches; body STYLEREF updates with the other fields; STYLEREF in the Field dialog; PDF export follows the layout | -| 2026-10-24 | Document information fields: SUBJECT, KEYWORDS, COMMENTS, LASTSAVEDBY, REVNUM and NUMCHARS update with the other fields and are listed in the Field dialog; a quoted text after TITLE, SUBJECT, AUTHOR, KEYWORDS or COMMENTS replaces that document property (at most 255 characters), and NUMWORDS, NUMCHARS and REVNUM take a `\*` number format | -| 2026-10-31 | Field dialog capitalization: AUTHOR, COMMENTS, FILENAME, KEYWORDS, LASTSAVEDBY, SUBJECT, TITLE, REF, STYLEREF and MERGEFIELD have a Format list with Uppercase, Lowercase, First capital and Title case, which writes `\* Upper`, `\* Lower`, `\* FirstCap` or `\* Caps` before `\* MERGEFORMAT`; Hide Codes sets the list from the typed code's last such switch and keeps every capitalization switch the code had, in order, until another Format is chosen; Preview Results and Finish & Merge apply a MERGEFIELD's capitalization switch to the record's value, and IF, NEXTIF and SKIPIF rules apply the tested MERGEFIELD's capitalization switch before comparing | -| 2026-10-24 | Field capitalization switches: `\* Upper`, `\* Lower`, `\* Caps` and `\* FirstCap` apply to the document information, DOCPROPERTY, FILENAME, date, REF, PAGEREF, SEQ, STYLEREF and table formula results that Update Field computes and to the page-number fields, and `\* CardText` and `\* OrdText` results are lowercase unless one of them follows (`\* CardText \* Caps` shows "Seven Hundred Ninety"); a table formula takes a `\*` number format (`=SUM(A1:B2) \* CardText`), and other `\*` switches such as `\* MERGEFORMAT` no longer make it a syntax error | -| 2026-10-24 | Field `\* DollarText` and `\* Hex` switches: `{ = 9.20 + 5.35 \* DollarText \* Upper }` shows "FOURTEEN AND 55/100" and `\* Hex` writes uppercase hexadecimal digits (458 shows "1CA"), in table formulas and in the page-number, SEQ, PAGEREF and count fields; `{ PAGE \* ArabicDash }` shows "- 31 -"; cardinal, ordinal and dollar text past 999,999 keep their digits | | 2026-10-12 | Undo history list (#701): a ▾ beside the Quick Access Toolbar's Undo lists recent steps newest first; hovering highlights what a click undoes ("Undo 3 Actions"), and a click undoes them in one go. `edit.undoTo {count}` and `edit.undoHistory` (newest first, up to 100) for CLI and MCP | | 2026-10-12 | Start screen (#766): launched with nothing to open, WordCraft starts on File › Home (Blank document, templates, Recent) like Word, desktop and web; Esc leaves a blank document; File › Options › General › Start-up turns it off | -| 2026-10-13 | No document behind the Start screen (#1129): Esc or Back from it shows an empty window (no page, ribbon greyed out but for Help) until Blank document, a template or a file is opened, as in Word; closing it asks nothing | | 2026-10-12 | Word 365 cover pages (#743): a freeform inside a group keeps its shape (it was drawn as a rectangle); text boxes keep their own internal margins and Resize shape to fit text, so a tight title box no longer loses its second line; both survive saving. The missing fills in the report were theme-coloured shapes, fixed by #611 | | 2026-10-12 | Alt+Q moves to "Tell me" command search, as in Word for Windows (#819); not on macOS, where Option+Q types a character | | 2026-10-12 | PDFW: PDF export uses the shared craft-pdf writer for metadata, font preparation and serialization while retaining WordCraft layout, drawing, tagging, links and font-outline retry. Writer-only builds do not enable PDF import codecs. | | 2026-10-12 | PDF export of long documents with many internal links (a linked table of contents) is linear: NIH's 67-page protocol template 10.6 s → 0.9 s | | 2026-10-12 | Keytips: Word for Windows' tab letters (File F, Design G, References S, Review R, View W, Help Y) | -| 2026-10-13 | Keytips reach the table tabs as in Word: Alt, J, T for Table Design and Alt, J, L for Table Layout, then their controls' badges (#1183) | | 2026-10-12 | Table-of-contents links look like Word's: plain text, not blue and underlined (Word ignores the Hyperlink style on TOC entry links; measured in 9 cases) | | 2026-10-12 | Line heights like Word's: spaces and tabs never make a line taller (13 cases measured in Word for Windows); tables of contents with big tab runs were a third taller | | 2026-10-12 | `.doc` import: tab stops (centred titles, right-aligned dates, leaders) and sections ending at their section marks (continuous breaks, footers); EPA .doc templates now paginate like Word | @@ -775,53 +840,58 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target | 2026-10-12 | A list label makes its line taller above the baseline only, as in Word (6 cases measured in Word for Windows): Symbol bullets no longer add their deeper descent, so bulleted lists keep Word's height and page breaks | | 2026-10-12 | Hidden end-of-cell marks (`w:hideMark`) read, written and laid out like Word (9 cases measured in Word for Windows): a cell's empty last paragraph takes no room, so rows of such empty cells shrink to their borders | | 2026-10-12 | Text frames (`w:framePr`) in headers, footers, cells and text boxes: placed apart with text wrapping around them, and kept on save (a framed footer page number took a line of its own and was lost on save) | -| 2026-10-13 | A paragraph with more than 65,536 distinct formats keeps each one (#1340): the layout numbered a paragraph's formats with 16 bits, so every run past that drew with the 65,536th format's font, size, link and tracked-change marking | | 2026-10-12 | List indents like Word's when a numbered style has indents of its own: the style giving the list (and styles based on it) beat the level's indents, and a paragraph with its list switched off drops the styles' indents (27 cases measured in Word for Windows); NIH's Heading 3s now sit at their 0.9" | | 2026-10-12 | Keep with next like Word (20 cases measured in Word for Windows): a kept paragraph moves to the next page only when it would fit on this one by itself, otherwise it breaks as usual; chains of kept paragraphs move together | | 2026-10-12 | An empty paragraph that only carries a continuous section break takes no room, as in Word (10 cases measured in Word for Windows): text after it follows right on and balanced columns don't count it | | 2026-10-12 | Floating objects positioned relative to their paragraph start above its space before, as in Word (10 cases measured in Word for Windows) | | 2026-10-12 | Unequal columns: text after a column break is broken for the column it lands in (NIH's SARP form had a paragraph a word or two wide) | -| 2026-10-13 | New comments, notes, text boxes and lists in a document whose file used the largest ids (#1338): they take a free id instead of overflowing (a crash) or reusing one already taken (a new list could pick up another's definition); `Document::try_add_part` and `Numbering::try_add_list` report ids running out instead | | 2026-10-12 | Space before at the top of a page like Word after page breaks (32 cases measured): a paragraph ending with a page break keeps its mark with it, the next paragraph gets no space before; page break before drops it in Word 2013 mode | | 2026-10-12 | Automatic paragraph spacing drops between list items, as in Word (16 cases measured in Word for Windows): bulleted items that ask for automatic space before and after now touch, as in NIH's monitoring plan | | 2026-10-12 | Rendering like Word for Windows, found by comparing real .gov documents page by page: text is kerned only where Kerning for fonts asks for it (line breaks now match Word's), and automatic paragraph spacing (`w:beforeAutospacing`/`w:afterAutospacing`, common in pasted web text) is 14 pt, dropped at the document's and cells' edges | | 2026-10-12 | Keyboard context menu (#821): Shift+F10 opens the page's right-click menu below the caret; `ui.contextMenu` | | 2026-10-12 | The Font list no longer keeps every family it previews in memory (#848): the Font box drew each family's name in its own face by loading the whole family for good, so every trip through the list kept tens of megabytes (1.47 GB after 40 changes on macOS); entries are now drawn from a face read for the preview alone and freed (120 families previewed: +17 MB RSS instead of +411 MB); only fonts actually used load | -| 2026-10-13 | An empty file opens (#1384): the zero-byte .docx that File Explorer's New › Microsoft Word Document makes opens as a new blank document (the region's paper, the editing language), and Save writes it back to that file instead of asking for a name | | 2026-10-12 | Scrolling a document with one very large table stays smooth (#811): pages are fingerprinted for the texture cache once per layout and only when shown (not every page every frame), the markup-area check is cached per revision, and textures far from the view are dropped. The issue's 1,096-page table: ~600 ms → ~2.4 ms idle frames, ~590 ms → ~4.5 ms scroll frames | -| 2026-10-13 | Paragraph dialog over differently formatted paragraphs (#1346): a field they differ in shows blank (a check box neither on nor off, no direction picked) and OK leaves it as each paragraph has it; OK sends only the fields that changed, as one undo step, instead of giving every paragraph the caret paragraph's formatting in three undo steps | | 2026-10-12 | Search (#819): Alt+Q, or Alt then Q, opens the Search box from anywhere with nothing typed into it; queries match every word; `tools.search` for agents | | 2026-10-12 | Section breaks (#852): Layout › Breaks with text selected puts the break before the selection and keeps the text, as Word does; it used to delete it, leaving the first section empty | | 2026-10-12 | Find, Replace and Go To like Word (#712): Ctrl+F types into the Navigation pane's search, one tabbed Find and Replace dialog, Go To by page (absolute or relative) and bookmark; `edit.findReplace`, `edit.goto` `pageBy` | | 2026-10-12 | Symbol fonts (#776): text in Wingdings, Wingdings 2, Wingdings 3, Webdings and Symbol (proprietary, never bundled) shows its intended symbols — full code tables from Unicode's published correspondence, both storage forms (`w:sym` private-use codes and plain codes); PDF text, copy and TXT export use the Unicode characters; the saved text is unchanged | -| 2026-10-11 | Hide White Space (#645): `view.hideWhiteSpace` (View › Show checkbox, or double-click the gap between pages) collapses margins, headers and footers between pages to a thin line in Print Layout; screen only, page count unchanged | -| 2026-10-11 | Fonts: Palatino Linotype and Book Antiqua fall back to Palatino (macOS) or TeX Gyre Pagella / P052 / URW Palladio (Linux) before generic serif (#670) | | 2026-10-12 | Czech proofing: cs-CZ spelling reads the installed Hunspell dictionary (`hunspell-cs` on Debian/Ubuntu), suggestions use runtime MAP/REP/TRY/KEY tables, generic repeated-word and spacing checks explain in Czech; Review › Language offers Czech/Čeština; the Czech interface writes new documents and opened TXT/Markdown in cs-CZ. Affix headers accept trailing comments. No system dictionary data or Czech hyphenation patterns bundled; parity estimates unchanged | | 2026-10-12 | Tables: dragging the border of one selected cell (Select Cell, or a click along its left edge) moves it in that cell's row only, as in Word, like the border of cells selected across (#962) | -| 2026-10-13 | Korean interface catalog completed: all 2,463 entries translated; the ko-KR system locale and saved language choice select the interface. The UI prefers Korean embedded/system font faces so Hangul renders instead of boxes, and print settings and printer feedback are translated. Korean proofing remains unavailable; macOS Korean IME fixes are still pending (#163, #164) | | 2026-10-12 | Word default shortcuts expanded (gap #24): 140 commands bound on macOS (169 combinations), 158 on Linux/Windows (188 combinations). Bound Style Inspector (Shift+F1), Macros (Alt+F8), Strikethrough (Mod+Shift+X), Find Next (Shift+F4), Copy/Paste (Mod+Insert, Shift+Insert), Go Back (Mod+Alt+Z), File Open/Save/Save As/Print (Mod+Alt+F2, Alt+Shift+F2, Alt+F2, Mod+Alt+I), Field navigation (Alt+F1, Alt+Shift+F1), Outline show first line (Alt+Shift+L), Next Footnote (Alt+Shift+>), Link to Previous (Alt+Shift+R), AutoText (Alt+F3), Spelling on Mac (Mod+Alt+L) | -| 2026-10-13 | Web and Draft Layout now render visible full-resolution raster tiles for exceptionally tall pages rather than downsampling the entire page into one texture; verified with a 440-paragraph headless UI reproduction | | 2026-10-12 | Track Changes: Accept All after a tracked deletion from the end of one paragraph into a later one no longer joins the paragraph that follows the range, and Reject All after typing into an empty paragraph keeps that paragraph (#864) | | 2026-10-12 | Ctrl+drag copies an object (#1014): holding Ctrl (⌘ on macOS) while dragging a picture, shape or text box leaves the original and drops a copy where you let go (text boxes get their own text); the copy is selected, the clipboard is untouched, one undo step; `arrange.copyTo` | -| 2026-10-11 | Table border drags like Word's (#711): Ctrl shares a column border's change among the columns right of it (the table keeps its width), the table's left edge moves a left-aligned table's indent (a centred or right-aligned table keeps its alignment, as in Word), a border of cells selected across moves only in their rows, and Alt shows the column widths on the ruler | -| 2026-10-11 | Tables on the rulers (#700): with the caret in a table the horizontal ruler marks its row's column borders and the vertical ruler its rows' bottoms; dragging a marker resizes the column (the columns right of it move along; with Shift the neighbour makes up the difference) or the row, one undo step, Escape cancels; in a cell the indents and tabs are measured from the cell | | 2026-10-12 | Save Changes prompt answers from the keyboard: Save has focus when it opens; arrow keys and Tab move between Save, Don't Save and Cancel; Enter answers (#861) | | 2026-10-12 | Builds with craft-fonts draw simplified-Chinese characters in documents from the bundled Noto Sans CJK SC (it was only used by the interface), so a CJK run gets one face covering it; fixes the FreeBSD job's `east_asian_run_uses_one_face_covering_the_whole_run` failure after #567 | | 2026-10-12 | Insert › Picture, drag-and-drop and paste take Windows Metafiles (`.wmf`) and Enhanced Metafiles (`.emf`) at their own frame size (#802) | -| 2026-10-14 | A picture or icon inserted by a command (`wordcraft-cli run`, MCP, control channel) leaves the caret after it, so the next `text.newParagraph` or `text.insert` no longer deletes it, and two inserted in a row are both kept; Picture Format commands still act on it, and a picture the user inserts or pastes in the app is still selected (#965) | | 2026-10-12 | AutoCorrect capitals (#544): Correct TWo INitial CApitals (with exceptions), accidental cAPS LOCK, first letter of table cells; each undoable and switchable | -| 2026-10-11 | Turkish (`tr`) interface completed (#774): 2,325 entries, every key of the Russian catalog (equation gallery, built-in style names, watermarks, paper sizes, preview tiles); the interface audit checks Turkish too | | 2026-10-12 | Navigation headings truncate within the resizable pane, with an ellipsis for long titles and full text on hover (#759) | +| 2026-10-12 | Portuguese proofing: pt-BR spelling against the installed Hunspell `pt_BR` dictionary (VERO; read at runtime, not bundled) — the affix engine grew `FLAG UTF-8`, 128 flag bits, continuation classes and `FORBIDDENWORD` to read it — suggestions tuned for Portuguese (missing accents first), conservative grammar rules with Portuguese messages, TeX Portuguese hyphenation patterns (BSD 3-clause, attributed); Review › Language offers Português (Brasil); a pt-br interface writes new documents in pt-BR | +| 2026-10-12 | Sorting and table numbers follow the text's language (#836, #837): Table › Sort, Home › Sort, the index (with its letter headings), the bibliography and the Table of Authorities use the language's alphabet (Polish `Łódź` between `Kraków` and `Zakopane`, Swedish `å ä ö` after `z`, German `ä` with `a`); table sort and formulas read `1,5` and `1 250,00` as Polish decimals and `=SUM` writes `5,75` | +| 2026-10-12 | File › Print selects a system printer, copies, duplex and grayscale, submits PDF jobs through craft-print on a worker and shows spooler errors; browser printing and PDF export remain available | +| 2026-10-12 | Selection bar (#856): in the left margin beside body text a click selects the line, a double-click the paragraph, a triple-click or Ctrl/⌘+click the document; dragging there selects whole lines and Shift+click extends by lines; the pointer turns to an arrow. Right margin for right-to-left paragraphs not yet | +| 2026-10-12 | Custom XML backing stores preserved as opaque data and related properties through edited DOCX saves; content-control markup is handled by the existing reader/writer and #532 bibliography I/O remains separate; binding evaluation and readiness unchanged | +| 2026-10-12 | Imported TOCs keep actual result boundaries, nested page fields, formatting and locks through DOCX saves without relying on TOC styles; existing engine-managed styled TOCs remain refreshable | +| 2026-10-12 | Native saves use exclusively created sibling temporary files, synchronize before replacement and clean up on failure; existing temporary-name files/links and original files on failed saves are protected. Synthetic CLI and focused tests on macOS; no new Word parity or readiness claim. | +| 2026-10-12 | Bulgarian (`bg`) interface: 2,419 catalog entries (every key of the reference catalog, the equation gallery and everything the interface audit finds), `bg-BG` system locales and a saved language choice; locale, catalog and bundled-font tests; no Bulgarian proofing resources | +| 2026-10-12 | Native drawing-level Word ink preserved through DOCX edits and repeated saves, including its InkML part and optional VML picture fallback; native ink rendering and editing remain missing | +| 2026-10-12 | List-label line height: automatic spacing scales body text before adding label ascent overflow; AtLeast spacing keeps text descent. Original Word for Mac probes and deterministic layout tests cover symbol/decimal labels, wrapped lines, fixed/minimum spacing and inline pictures. Overall readiness unchanged; [evidence](docs/layout-parity.md#list-label-line-spacing) | +| 2026-10-12 | Local desktop recovery: unsaved drafts and edits are snapshotted in the profile; File › Recover restores an unsaved copy or confirms discard. Full model storage includes media and opaque parts. Password sessions skip plaintext snapshots. See [recovery.md](docs/recovery.md); stability estimates remain unchanged. | +| 2026-10-12 | Legacy table paragraph spacing: `allowSpaceOfSameStyleInTable` survives DOCX save; enabled modes 11/12/14 keep contextual same-style spacing in cells. Mode 15 and non-cell controls unchanged; measured against Word for Mac 16.113.3 | +| 2026-10-12 | Mail-merge recipients (#778): legacy Excel .xls workbooks; CSV/TXT lists in GBK, Big5, Shift_JIS, UTF-16 and other encodings read correctly (plain-text import too); Edit Recipient List filters (equal, not equal, less, greater, blank, contains… joined by And/Or) and sorts, and preview, Finish & Merge and labels use only the matching records in that order (`mailings.filterRecipients`, `mailings.sortRecipients`) | +| 2026-10-11 | Right-clicking a table cell offers the table's commands, and as in Word they follow the selection: with the caret in a cell Insert, Delete Cells, Split Cells, Text Direction and Table Properties…; with several cells Merge Cells instead of Split; with whole columns or rows Delete Columns or Rows, Merge Cells and Distribute Rows and Columns; with the whole table Delete Table, Distribute, AutoFit and Insert Caption…. A right-click beside selected cells moves the caret there instead of keeping them | +| 2026-10-11 | Drags, Shift+arrows and Shift+click over table cells select whole cells, as in Word: from one cell into another the rectangle between them (bold, alignment and Delete leave the other cells alone), into or out of a table whole rows; extending again goes on from where the selection started | +| 2026-10-11 | More of the table mouse: arrows above a column, left of a row and along a cell's left edge select it (a drag selects more; a selected column is edited cell by cell, numbering it makes one list), "+" buttons beside the borders insert a row or column, the move handle past the top-left corner selects the table or drags it to float where it's dropped, and a double-click on a column border fits the column; Select Column in the ribbon; `table.selectAt`, `table.insertAt`, `table.moveDrag`, `table.fitColumn` and `table.selectColumn` for agents | +| 2026-10-11 | Hide White Space (#645): `view.hideWhiteSpace` (View › Show checkbox, or double-click the gap between pages) collapses margins, headers and footers between pages to a thin line in Print Layout; screen only, page count unchanged | +| 2026-10-11 | Fonts: Palatino Linotype and Book Antiqua fall back to Palatino (macOS) or TeX Gyre Pagella / P052 / URW Palladio (Linux) before generic serif (#670) | +| 2026-10-11 | Table border drags like Word's (#711): Ctrl shares a column border's change among the columns right of it (the table keeps its width), the table's left edge moves a left-aligned table's indent (a centred or right-aligned table keeps its alignment, as in Word), a border of cells selected across moves only in their rows, and Alt shows the column widths on the ruler | +| 2026-10-11 | Tables on the rulers (#700): with the caret in a table the horizontal ruler marks its row's column borders and the vertical ruler its rows' bottoms; dragging a marker resizes the column (the columns right of it move along; with Shift the neighbour makes up the difference) or the row, one undo step, Escape cancels; in a cell the indents and tabs are measured from the cell | +| 2026-10-11 | Turkish (`tr`) interface completed (#774): 2,325 entries, every key of the Russian catalog (equation gallery, built-in style names, watermarks, paper sizes, preview tiles); the interface audit checks Turkish too | | 2026-10-11 | Reading Mode: existing View ribbon button now opens a read-only, viewport-column layout with animated horizontal paging, transient display controls, heading navigation (Navigation pane) and resize anchoring; document layout and export unchanged | | 2026-10-11 | DOCX open/save keeps inherited complex-script size, bold and italic independent of Latin formatting; explicit values are retained, and font commands still format both scripts. Covered by synthetic round trips and a local GUI save/reopen check. | | 2026-10-11 | Czech (`cs`) interface catalog: 2,021 entries (the full zh-hans key set), Czech locale detection and persisted language choice | -| 2026-10-12 | Portuguese proofing: pt-BR spelling against the installed Hunspell `pt_BR` dictionary (VERO; read at runtime, not bundled) — the affix engine grew `FLAG UTF-8`, 128 flag bits, continuation classes and `FORBIDDENWORD` to read it — suggestions tuned for Portuguese (missing accents first), conservative grammar rules with Portuguese messages, TeX Portuguese hyphenation patterns (BSD 3-clause, attributed); Review › Language offers Português (Brasil); a pt-br interface writes new documents in pt-BR | | 2026-10-11 | Polish: interface (`pl`, the thirteenth language, every catalog key) and proofing — spelling against the installed Hunspell `pl_PL` dictionary (read at runtime, not bundled) through a new Hunspell-style affix engine, suggestions tuned for Polish, Polish grammar rules with Polish messages, TeX Polish hyphenation patterns (MIT option); proofing language per run (`w:lang`) for squiggles, F7, suggestions and hyphenation, languages without tools left unmarked; Review › Language menu and the status bar's language; a Polish interface writes new documents in Polish | | 2026-10-11 | German (`de`) interface (#574): 2,021 translated entries covering the full zh-hans key set, locale and saved-preference tests, bundled-font checks; no German proofing resources | -| 2026-10-12 | Sorting and table numbers follow the text's language (#836, #837): Table › Sort, Home › Sort, the index (with its letter headings), the bibliography and the Table of Authorities use the language's alphabet (Polish `Łódź` between `Kraków` and `Zakopane`, Swedish `å ä ö` after `z`, German `ä` with `a`); table sort and formulas read `1,5` and `1 250,00` as Polish decimals and `=SUM` writes `5,75` | -| 2026-10-14 | `.doc` notes, headers and text boxes read their text once (#1319): a story table that steps back no longer has many footnotes, endnotes, headers or text boxes copy the same text into a part each; a story starting inside an earlier one is dropped (a header or footer left empty is linked to the previous section's), so the stories together never hold more than the file's text | | 2026-10-11 | `.doc` import keeps pictures and drawings (#551): inline and floating pictures (PNG, JPEG, DIB, EMF, WMF), shapes, lines, groups and text boxes with position and wrap, from [MS-ODRAW] | -| 2026-10-14 | ODT and `.doc` pictures stay within their byte budget (#1334): an ODT picture entry is inflated once however many frames point at it, and only when the size it declares fits in what is left (one inflating past that uses the budget up); a `.doc` inline picture that can't be read or doesn't fit is no longer decoded and copied again for every anchor on it, and is decoded only within what is left | | 2026-10-11 | Tables resize with the mouse (#217): drag a column border (the neighbour makes up the difference; Shift moves one column), a row's bottom border, or the handle past the bottom-right corner to scale the table; a dashed guide while dragging, one undo step per drag; `table.resizeDrag` for agents | | 2026-10-11 | Animation effects setting: File › Options › Accessibility › Animation effects (Use system setting, On, Off). With the system's animations off (Windows' Animation effects, macOS' Reduce motion, the Linux/BSD desktop's setting, a browser's reduced motion) the page no longer smooth-scrolls: wheel notches and Ctrl+wheel zoom land at once, in the document and in every list and pane, and menus and buttons don't fade; `ui.animations` for agents | | 2026-10-11 | Linux/BSD: Open, Save As, Export and Insert Picture work without a file chooser portal or zenity (labwc, sway…): WordCraft shows its own file browser and says how to get the system dialog; File › Open › Browse in WordCraft… is always there (#576) | @@ -832,11 +902,7 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target | 2026-10-11 | File › Print: page preview, page range (all, current, selected, custom 1-3,5), odd/even, copies and collate go into the printed PDF (`file.printPdf`, `ui.print` params); printer, duplex and pages per sheet are still the system dialog's (#641, stage 1) | | 2026-10-11 | A vertically merged table cell (eraser on a horizontal border) lays out, shows and clicks as one cell spanning its rows (#640) | | 2026-10-11 | Word XML files (#548): Word XML Document (Flat OPC `.xml`) opens and saves through the DOCX reader and writer; Word 2003 XML opens (styles, lists, tables, sections, notes, comments, pictures, hyperlinks) | -| 2026-10-14 | Open DrawingML freeform paths draw `a:tailEnd` at the final path segment | -| 2026-10-12 | File › Print selects a system printer, copies, duplex and grayscale, submits PDF jobs through craft-print on a worker and shows spooler errors; browser printing and PDF export remain available | | 2026-10-11 | Font fallback indexes which characters each installed font maps, reading each font file once (#605): text in a script no installed font covers no longer re-reads every system font per distinct character (200 such characters: 13 s → 0.2 s) | -| 2026-10-13 | Markdown import of text full of backtick runs that never close is linear (#1336): every code span and link bracket over them searched the rest of the text for a closing run (2 MB in brackets: 17.8 s → 0.06 s) | -| 2026-10-13 | Markdown import keeps every link in a paragraph (#1452): a `[` nothing closes, bracketed text that is not a link and each link used up the bracket scans' look-ahead budget as if they had read the rest of the paragraph, so later links were plain text; a scan now costs what it reads, and brackets it has passed are looked up | | 2026-10-11 | Find and Replace special characters (`^p`, `^t`, `^#`, `^&` …) and Use wildcards (ranges, counts, word anchors, groups with `\1` in Replace); `^p` finds and splits paragraphs; Special ▾ menu and search options in the dialog (#543) | | 2026-10-11 | Typing parity (#546): `+---+` Enter makes a table, `> ` `-> ` `=> ` arrow bullets, smileys inside words (`ok:)`), Undo right after a border line brings the characters back | | 2026-10-11 | Windows: DirectX 12 shaders compile with FXC, built into Windows, so the app no longer quits at launch with "Parent device is lost" when no matching `dxcompiler.dll` + `dxil.dll` pair is around (#603) | @@ -844,9 +910,7 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target | 2026-10-11 | Outline view (#493): Outlining tab, outline symbols and indents, collapse/expand, Show Level, first line only, plain text; catalog 428/450 → 441/463 (95.2%) | | 2026-10-11 | Vertical sections (#491): Layout › Text Direction turns the section (or the cell or text box the caret is in); lines run top to bottom, right to left, ideographs upright; `w:textDirection` in `w:sectPr` read and written | | 2026-10-11 | File › Options in Word's panes (#485): General, Display, Proofing, Save, Language, Accessibility, Advanced, Agents; initials, individual formatting marks, spelling ignore options, custom dictionary, overtype, typing replaces selection, measurement units, recent-documents count, print options; `file.options` reads and sets them headlessly | -| 2026-10-14 | Word XML Document (Flat OPC) reading is bounded everywhere in the file (#1353): nesting and elements are capped as the XML tree reader caps a part's, every child of the package and every part's data count against the part count and size limits (a repeated part name too), and data is checked before it's copied; base64 written as CDATA or with character references reads as the same bytes, and an entity in it is an error instead of bytes gone missing | | 2026-10-11 | Right-click Wrap Text submenu on pictures, shapes and text boxes: wrapping styles, Move with Text / Fix Position on Page (#513) | -| 2026-10-14 | Text boxes in tables nested deeper than 16 survive edits (#1339): the paragraph walk behind text box pruning, copy and paste, reading order, drawing ids and note conversion goes through tables however deep they nest instead of stopping 16 tables down, so an unrelated edit no longer drops the text of a box shown only from deeper, and a copied deep table takes its boxes along | | 2026-10-11 | Caret animation: keys and typing glide the caret to its new place in 100 ms along the curve measured from Word for Windows, and the blink fades; clicks and scripted moves don't glide. File › Options › Advanced › Animation turns it off, kept between runs; `ui.caretAnimation` for agents | | 2026-10-11 | Paragraph dialog options (#512): mirror indents (`w:mirrorIndents`, laid out on even pages), same-style spacing, suppress line numbers, don't hyphenate | | 2026-10-11 | Screen readers can read the document canvas (#488): paragraphs, headings, lists, tables, links, pictures and the caret exposed through AccessKit | @@ -856,7 +920,6 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target | 2026-10-11 | Complex scripts (#604): Myanmar, Khmer and Indic text shaped one script at a time in OpenType fallback fonts (regular weight, not AAT-only fonts), the caret and line breaks never split a syllable, Myanmar wraps between syllables, Backspace removes one sign at a time | | 2026-10-11 | Any text file opens (#569): `.m3u`/`.m3u8` playlists and other unknown extensions open as plain text with encoding detection (UTF-8, BOMs, UTF-16, Windows-1252), misnamed Word/RTF files by their signature; binary files give a clear error | | 2026-10-11 | Select by dragging whole units (#549): after a double-click the drag grows by words, after a triple-click by paragraphs, after Ctrl/⌘+click by sentences, as in Word | -| 2026-10-12 | Selection bar (#856): in the left margin beside body text a click selects the line, a double-click the paragraph, a triple-click or Ctrl/⌘+click the document; dragging there selects whole lines and Shift+click extends by lines; the pointer turns to an arrow. Right margin for right-to-left paragraphs not yet | | 2026-10-11 | Compare / Combine dialog with comparison settings, Restrict Editing pane (exceptions, SHA-512 password, locked styles; DOCX round trip), AutoCorrect Options dialog saved per user (#412) | | 2026-10-11 | DOCX diagrams (#611): lines, connectors and boxes styled by the theme now show (they were invisible); callouts and flowchart boxes drawn as the nearest shape; VML lines, rectangles and ovals | | 2026-10-11 | WordArt (#416): text fill/outline/shadow/glow/reflection, Transform warps, our own styles; straight/elbow/curved connectors glued to shapes that re-route; DOCX round trip | @@ -875,25 +938,13 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target | 2026-10-11 | Insert › Icons (#309): a library of 61 original icons drawn in code, a searchable picker and Icon Color | | 2026-10-11 | Home › Font › Enclose Characters (#297): circle, square, triangle or diamond around a character, saved as Word's `EQ \o\ac` field | | 2026-10-11 | Phonetic Guide (#288): ruby text over base text, `w:ruby` round trip | -| 2026-10-12 | Custom XML backing stores preserved as opaque data and related properties through edited DOCX saves; content-control markup is handled by the existing reader/writer and #532 bibliography I/O remains separate; binding evaluation and readiness unchanged | -| 2026-10-12 | Imported TOCs keep actual result boundaries, nested page fields, formatting and locks through DOCX saves without relying on TOC styles; existing engine-managed styled TOCs remain refreshable | | 2026-10-11 | Customize Ribbon and the Quick Access Toolbar: custom tabs and groups, hide and reorder tabs, add or remove toolbar commands (right-click any button, or the toolbar's … menu); kept between runs (#379, #376) | | 2026-10-11 | Customize Keyboard: assign, remove and reset keyboard shortcuts; custom keys override built-ins and are kept between runs (#368) | -| 2026-10-12 | Native saves use exclusively created sibling temporary files, synchronize before replacement and clean up on failure; existing temporary-name files/links and original files on failed saves are protected. Synthetic CLI and focused tests on macOS; no new Word parity or readiness claim. | | 2026-10-11 | Field codes like Word's field keys (#339): show codes (Alt+F9, Shift+F9), edit, unlink, lock and step through fields | | 2026-10-11 | Word's common keyboard shortcuts (#330): 101 → 125 of ~250 | -| 2026-10-15 | Slovenian (`sl`) interface: 2,614 catalog entries (every key of every other catalog, including native print settings), `sl-SI` system locales and a saved language choice; locale, catalog and bundled-font tests; no Slovenian proofing resources | -| 2026-10-13 | Swedish (`sv`) interface: 2,504 catalog entries (every key of the reference catalog, the equation gallery, everything the interface audit finds, and 44 newer strings no catalog had yet, among them the native print settings), `sv-SE`/`sv-FI` system locales and a saved language choice; locale, catalog and bundled-font tests; AI-assisted, terminology and the running app reviewed by a native speaker; no Swedish proofing resources | -| 2026-10-12 | Bulgarian (`bg`) interface: 2,419 catalog entries (every key of the reference catalog, the equation gallery and everything the interface audit finds), `bg-BG` system locales and a saved language choice; locale, catalog and bundled-font tests; no Bulgarian proofing resources | -| 2026-10-13 | Croatian (`hr`) interface: 2,507 catalog entries (every key of the reference catalog, built-in style names and the equation gallery), `hr-*` system locales and a saved language choice; locale, catalog and bundled-font tests; no Croatian proofing yet | | 2026-10-11 | Hungarian (`hu`) interface: all 2,419 catalog entries, built-in style names translated, `hu-HU` system locales and a saved language choice; locale, catalog and bundled-font tests; no Hungarian proofing resources | | 2026-10-11 | Turkish (`tr`) interface: all 1,307 catalog entries, `tr-TR`/`tr-CY` system locales and a saved language choice; command search keeps Turkish dotted and dotless I apart (`italik` finds İtalik); locale, catalog, search and bundled-font tests; no Turkish proofing resources | | 2026-10-11 | Italian (`it`) interface (#594): 2,399 entries, feature names as Italian Word users know them, locale and saved-preference tests, bundled-font checks; no Italian proofing resources | -| 2026-10-12 | Native drawing-level Word ink preserved through DOCX edits and repeated saves, including its InkML part and optional VML picture fallback; native ink rendering and editing remain missing | -| 2026-10-12 | List-label line height: automatic spacing scales body text before adding label ascent overflow; AtLeast spacing keeps text descent. Original Word for Mac probes and deterministic layout tests cover symbol/decimal labels, wrapped lines, fixed/minimum spacing and inline pictures. Overall readiness unchanged; [evidence](docs/layout-parity.md#list-label-line-spacing) | -| 2026-10-12 | Local desktop recovery: unsaved drafts and edits are snapshotted in the profile; File › Recover restores an unsaved copy or confirms discard. Full model storage includes media and opaque parts. Password sessions skip plaintext snapshots. See [recovery.md](docs/recovery.md); stability estimates remain unchanged. | -| 2026-10-17 | Recovery: a snapshot that fails on its own size, the folder or disk budget, or a value the format cannot keep is not rewritten every 10 s while nothing changes; it waits for the next edit (#2625). Transient failures still retry. | -| 2026-10-12 | Legacy table paragraph spacing: `allowSpaceOfSameStyleInTable` survives DOCX save; enabled modes 11/12/14 keep contextual same-style spacing in cells. Mode 15 and non-cell controls unchanged; measured against Word for Mac 16.113.3 | | 2026-10-11 | Contextual paragraph spacing: same-style first-only 12/8 pt and 10/12 pt gaps corrected to 0 pt and 2 pt in body and header layout, with per-side controls; measured against Word 16.113.3. Ordinary overlap remains #108 | | 2026-10-11 | Citations and bibliography in all 12 of Word's styles: Harvard, ISO 690 (author-date and numerical), Turabian, GB/T 7714, GOST (name and title sort) and SIST02 join APA, MLA, Chicago and IEEE; numbered styles count in order of first citation (#383) | | 2026-10-11 | Interface size setting (#475): File › Options › General scales the interface 80–200 % on top of the system display scale, kept between runs; `ui.interfaceSize` for agents | @@ -910,16 +961,8 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target | 2026-10-07 | v0.1.0 released; contributor credits in About (#6) | | 2026-10-06 | Layout arc: wrap around floats, text boxes, page borders, line numbers, row splitting, drop caps, hyphenation, comment balloons; release pipeline for every platform; first estimate (~62% real feature parity, 120–150 h to 100%) | | 2026-10-05 | M0–M12 first versions: model, layout, render, engine with 200+ commands, Word-style UI, DOCX I/O, PDF and other formats, references, review, mailings, CLI, MCP, web | -| 2026-10-12 | Mail-merge recipients (#778): legacy Excel .xls workbooks; CSV/TXT lists in GBK, Big5, Shift_JIS, UTF-16 and other encodings read correctly (plain-text import too); Edit Recipient List filters (equal, not equal, less, greater, blank, contains… joined by And/Or) and sorts, and preview, Finish & Merge and labels use only the matching records in that order (`mailings.filterRecipients`, `mailings.sortRecipients`) | -| 2026-10-13 | The interface-translation audit runs in CI again (#1128): the size labels of Envelopes, Labels and Layout › Size are translated (`4,13 × 9,5 дюйма`) and use the region's decimal separator, and status-bar messages (table split and merge, ink replay, citations, SmartArt, Researcher, Design defaults), the Reading Mode toolbar, Go To and Search's Suggested heading are translated in every interface language, and the Read Aloud player no longer shows a speech error a frame before the status bar does, the race behind the audit's rare failure under load | -| 2026-10-15 | Lists (#1683): a bullet stored as a private-use character its font can't draw (the font isn't installed) shows the level's default bullet (• ○ ▪); it used to be whatever an installed icon font has at that code, such as Font Awesome's Twitter logo | -| 2026-10-15 | The web app keeps its preferences between visits (#2132): theme (dark mode), interface size, editing options and the rest of what the desktop app saves in `ui.json` are kept in the browser's `localStorage`, written as soon as they change | -| 2026-10-17 | Saving into a folder that refuses a temporary file (macOS privacy protection, read-only folders, #2138) never overwrites an existing document in place: it is left untouched and the error says to use Save As to another folder or allow WordCraft access to the folder (System Settings › Privacy & Security › Files and Folders on macOS). A new file is created directly. Unit tests on Linux; not yet confirmed on a Mac | -| 2026-10-20 | Saving to a NAS share mounted by GVFS (`smb://` in the Linux file manager, #3003) works: the share refuses every Unix mode change with "Operation not supported", which used to fail the whole save, so the close prompt's Save never closed. The save now goes on without copying a mode the folder doesn't keep; any other failure still keeps the original. Unit tests; not yet confirmed on a real share | -| 2026-10-29 | Corporate authors in bibliographies (#4848): a source whose author is an organisation (Word's Corporate Author, `b:Corporate`) keeps it when a Word document opens, instead of losing the author. Citations and bibliography entries write the name as it is in every style ("(World Health Organization, 2021)", never "Organization, W. H."); it gives the source's tag and its place in an author-sorted list, and it saves back as `b:Corporate`. Create Source has a Corporate Author box under Author. | -| 2026-10-29 | Table Properties follows the selection (#4857): with the whole table (or several rows, columns or cells) selected, the Row, Column and Cell settings apply to every selected row, column and cell, as in Word. Before, they changed the caret's row alone, so unticking Allow row to break across pages with the table selected left the other rows breaking. Allow row to break and Repeat as header row show as mixed when the selected rows differ and change nothing unless clicked. | -| 2026-11-15 | Headers in Word 2010 layout or older (#6805): Outside header table cells, legacy layout keeps header lines beside narrow Square, Tight and Through floats. A Top and Bottom float reaching below the text can make the header taller. In mode 15, text moves below Top and Bottom floats and can still flow beside narrow Square, Tight and Through floats. These cases were measured in Word for Windows with synthetic documents. Footer and header table-cell coverage remains open. Overall readiness unchanged | -| 2026-11-19 | Legacy header floats (#6805): three short header lines stay in place around a narrow Square, Tight or Through logo in mode 14 and flow beside it in mode 15. Measured in Word for Windows with a synthetic document. Overall readiness unchanged | +| 2026-10-19 | Mixed-direction lines: Latin text with digits, hyphens, spaces, full stops and commas after a Persian or Arabic word reads as typed ("2-naphthol", "Windows 11"), as in Word, in right-to-left and left-to-right paragraphs; a combining mark at the end of the Persian or Arabic word stays with its letter (#2150). | +| 2026-10-23 | A recipient list over what it keeps is refused while it is read: 1,000 columns, 2 M cells (its records times its widest record) and 64 MiB of cell text, so a hostile file is never built and then cut. | Footer page-table height and body wrapping are corrected. Other pagination gaps remain open. @@ -928,7 +971,8 @@ Quoted field escapes are interpreted like Word, and body `PAGE` fields use their Section page-numbering settings preserve `w:chapStyle` values across the full unsigned-byte range. MATH glyphs that reference the same construction now share its immutable variants and assembly data (#3630). Glyph mappings, values and the existing partial-record fallback stay unchanged. Repeated glyph IDs keep their last valid reference without retaining superseded constructions. Distinct overlapping constructions and assembly-only sharing remain separate. -- 2026-11-15: Layout: the first paragraph of a table cell on a page can split even when only one line fits, if the row starts at the top (possibly below its own headers) or continues from the previous page, and a non-exact row marked Can't Split that is taller than a page splits at the page's end, as in Word, instead of the row running off the bottom of the page (#6823). Readiness estimates unchanged. +- 2026-10-15: Design › Paragraph Spacing presets update built-in paragraph styles, so existing styled paragraphs follow the preset; custom paragraph styles keep their own spacing (#1913). Readiness unchanged. +- 2026-10-15: Find opens Navigation on Results; editing the query restores Results after manual Headings/Pages navigation. Typed and selected-text searches retain document contents (#2096). ## Revision history @@ -936,66 +980,63 @@ MATH glyphs that reference the same construction now share its immutable variant > > 2026-11-08 · Progress log: turned inline pictures without a recorded effect extent keep their line to the frame, as in Word. > +> 2026-11-07 · Progress log: VML text boxes keep their text direction (#5193). > 2026-11-05 · Linux self-update ignores another program's AppImage variables (#5653); recorded in the progress log, readiness unchanged. > 2026-11-05 · A template opened from the file manager starts a new document instead of being edited and saved over (#3433); recorded in the progress log, readiness unchanged. > 2026-11-05 · Arabic letters join across a change of formatting and past hidden or deleted text (#4093); recorded in the progress log, readiness unchanged. > 2026-11-05 · Shapes, text boxes, groups and canvases in Strict Open XML documents open (#3548); recorded in the progress log, readiness unchanged. -> 2026-11-07 · Progress log: VML text boxes keep their text direction (#5193). > > 2026-11-03 · Arabic dialogs read right to left (rtl::Table); recorded in the progress log, readiness unchanged. > 2026-11-03 · Before Word 2013 layout a floating table moved below another keeps its own left edge, also when its first cell has no left margin; readiness unchanged. > > 2026-10-30 · Technical synchronization: retain the Proofing pane and command/selection/undo contracts on main `3b7f7ed`; new-SHA validation pending, readiness unchanged. > +> 2026-10-29 · Port #3915 to split layout modules: ordinary LTR tab groups follow paragraph alignment. Positional tabs, lists, RTL and display math retain their alignment paths. Source port only; no test execution or new native measurements. +> +> 2026-10-29 · Port #2437 to split layout modules: finite border extents and terminal-break keep preflight. Recursive keep lookahead remains outside scope. Source port only; no test execution or new native measurements. +> > 2026-10-28 · Markdown import bounds reference-label scans and normalization within the existing link-work allowance. Nested undefined labels preserve literal text instead of causing quadratic work (#4658). -> -> 2026-10-27 · Technical synchronization: existing Proofing pane hooks and regression tests follow the extracted engine/UI modules on main `436d444`; compact context menus remain upstream. New-SHA validation is pending; readiness unchanged. -> -> 2026-10-23 · cu20we review follow-up: Only paragraph-relative box floats use the pre-spacing origin. Line-relative floats and page/margin fallbacks in cells and text boxes keep the text-top origin. Synthetic controls compare zero and 24 pt space-before across all four box contexts. New cap conversion helpers and regression tests document their contracts; readiness estimates unchanged. | Date | Change | Summary | |---|---|---| -| 2026-11-15 | trivial | Progress log: native, built-in and web picture choosers offer both TIFF extensions (`.tif`, `.tiff`); native drops, picked-file inbox dispatch and pasted picture paths recognize the same suffixes, with supported-compression limits retained (#6704). | -| 2026-10-31 | trivial | dialogs are dialogs to screen readers, their tabs are tabs, the one shown selected, and colour fields and swatches say their colour | -| 2026-11-01 | trivial | formatting shortcuts say what they did to screen readers | -| 2026-10-30 | trivial | the Paste button is named "Paste" for screen readers, without macOS's key on other platforms; the status bar's Go To hint shows the platform's key | +| 2026-11-27 | trivial | Progress log: a quote typed in Replace with goes in curly when smart quotes are on (#7307) | +| 2026-11-18 | trivial | DOCX validation reports undeclared binary tombstones in coverage notes when relationship discovery establishes that no relationship targets the part. | +| 2026-11-18 | trivial | DOCX validation excludes the content-type manifest from main-part cardinality and reports untargeted ordinary document parts in coverage when one ordinary main is established. | +| 2026-11-18 | trivial | DOCX validation warns on an image signature mismatch when the image is unused or can be decoded in another raster format. Used, unusable images retain their error. | +| 2026-11-18 | trivial | DOCX validation warns once per duplicated folded font name, including case variants. | +| 2026-11-18 | trivial | DOCX validation reports unattached custom XML schemas in coverage notes. Inline custom XML inside revision or move wrappers still fails under `CUSTOMXML-SCHEMA`. | | 2026-11-18 | trivial | Progress log: border boxes close their corners | -| 2026-10-30 | trivial | Progress log: under Track Changes a list item deleted whole shows its number as deleted text, in the deletion's colour and mark (#4828); readiness unchanged | +| 2026-11-15 | trivial | Progress log: native, built-in and web picture choosers offer both TIFF extensions (`.tif`, `.tiff`); native drops, picked-file inbox dispatch and pasted picture paths recognize the same suffixes, with supported-compression limits retained (#6704). | +| 2026-11-12 | minor | #5875 round 15: gate every owner root, report unresolved custom-property checks, suppress unused-comment absence on incomplete memberships, count unowned exclusions as out of scope, and harden the lexical contract gate; synthetic controls only, readiness estimates unchanged | +| 2026-11-12 | minor | #5875 W2: roots, profile and supporting sources use explicit resolution states; content-type fallback rejects competing candidates. Remaining redesign work is outstanding; synthetic controls only. | +| 2026-11-12 | minor | Validator representation lane: decimal/hex identity keys and lexical relationship/style types; ownership migration stopped before changing seven conflicting existing test expectations (#5875). Synthetic controls; no readiness estimate changed. | +| 2026-11-12 | trivial | Validator: keep nested glossary descendants in the selected glossary scope; exclude boundary-crossed subtrees from main and no-owner fallback while retaining direct main reachability (#5875). Synthetic controls; readiness estimates unchanged. | +| 2026-11-12 | trivial | Validator: exclude every glossary-typed part from main traversal and fallback assignment; multiple content-type fallback candidates are ambiguous, with no selected anchor (#5875). Synthetic controls; no parity estimate changed. | +| 2026-11-12 | trivial | Validator: mixed Transitional/Strict entry points to the same target skip document checks with coverage in either order (#5875); distinct competing roots retain ambiguity treatment without evaluating the profile gate. No parity estimate changed. | +| 2026-11-12 | trivial | Validator: competing official role targets produce coverage and suppress dependent findings; both-order, repeated-target, malformed-source and owner-isolation controls (#5875). No parity estimate changed. | +| 2026-11-03 | trivial | Progress log: a picture inserted or pasted in a table cell fits the cell (#5428) | | 2026-11-10 | trivial | Save As on Linux: the desktop portal's Save dialog reports the file type picked, updating the extension so saving as PDF writes a .pdf (#6180) | | 2026-11-08 | trivial | Progress log: freestanding custom.dic dictionary file support in File › Options › Proofing (#5840) | -| 2026-11-04 | trivial | Progress log: #4501 refactor regressions restored (#4683) | -| 2026-11-06 | trivial | Progress log: edited ODT paragraphs keep custom styles with an outline level (gap 19) | -| 2026-10-31 | trivial | Control/MCP #2596 review fixes; readiness estimates unchanged | | 2026-11-08 | trivial | Progress log: XML line ends in text normalised (#5897) | | 2026-11-08 | trivial | Progress log: contextual spacing drops the space after a cell's last Normal paragraph (#5450) | -| 2026-10-26 | trivial | Progress log: dialog sections across 13 dialogs; conditional scrolling for tall dialogs (#4035, #4038) | -| 2026-11-06 | trivial | Progress log: the Arabic interface's Styles gallery reads from the right (#5566) | | 2026-11-07 | trivial | Page Setup also bounds the unfocused margin display after a long numeric paste; the accepted value is retained (#5650). | -| 2026-11-05 | trivial | Page Setup's margin, paper-size and document-grid number boxes scroll long text inside the field instead of enlarging the dialog (#5650). Readiness estimates unchanged. | | 2026-11-07 | trivial | Progress log: An in-line picture lowered past its own height (`w:position`) lowers its line as far, as in Word; all 156 synthetic lines measured for #3984 match Word (#5796). | -| 2026-11-03 | trivial | Progress log: the title bar's Search box takes the typing in place (#5398) | -| 2026-10-31 | trivial | Progress log: a numFmt none list level shows its literal text (#4985); readiness unchanged | -| 2026-10-31 | trivial | Progress log: font menu entries are drawn from shared textures (#5105) | -| 2026-11-02 | trivial | Progress log: a linked picture shows and follows its link; DOCX `a:hlinkClick` (#5267) | -| 2026-11-02 | trivial | Progress log: alternative format chunks and MHT open | +| 2026-11-07 | trivial | Charts: a series without its own colour takes the accent its `c:idx` picks, as Word does, not the one its place in the file picks (#5963) | +| 2026-11-07 | trivial | A floating anchor after a manual page/column break counts visible content on the far side of the same wrapped row. Marker-only cover anchors retain their previous-page rule. Synthetic picture spacing, placement and history controls; no new native Word measurement. Estimates unchanged. | +| 2026-11-07 | trivial | Progress log: `.doc` brace and bracket shapes unfilled by default (#5943) | +| 2026-11-06 | trivial | Progress log: edited ODT paragraphs keep custom styles with an outline level (gap 19) | +| 2026-11-06 | trivial | Progress log: the Arabic interface's Styles gallery reads from the right (#5566) | | 2026-11-06 | trivial | Progress log: Change Picture keeps the width and takes the new picture's aspect ratio (#5761) | | 2026-11-06 | trivial | Progress log: superscript and subscript text at 0.65 of its size rounded to the half point (Word for Mac) | | 2026-11-06 | trivial | Progress log: line numbers take the document's "Line Number" style | -| 2026-11-07 | trivial | Charts: a series without its own colour takes the accent its `c:idx` picks, as Word does, not the one its place in the file picks (#5963) | -| 2026-11-07 | trivial | A floating anchor after a manual page/column break counts visible content on the far side of the same wrapped row. Marker-only cover anchors retain their previous-page rule. Synthetic picture spacing, placement and history controls; no new native Word measurement. Estimates unchanged. | | 2026-11-06 | trivial | Print helpers remove loaded PDF/settings files before driver work, tolerate prior removal and report cleanup errors; a held-driver regression checks the files are already absent (#5710) | | 2026-11-06 | trivial | Windows print submissions isolated per helper process; cancelled driver work cannot block a retry (#5710) | | 2026-11-06 | trivial | Progress log: print cancellation before sending, including without a document, and the Windows repeated-conversion limitation (#5710) | | 2026-11-06 | trivial | Progress log: the printer list no longer waits on printer drivers (#5710) | | 2026-11-06 | trivial | Progress log: resolving away an empty paragraph with a section break keeps the next paragraph's properties, #5667; readiness estimates unchanged | +| 2026-11-05 | trivial | Page Setup's margin, paper-size and document-grid number boxes scroll long text inside the field instead of enlarging the dialog (#5650). Readiness estimates unchanged. | | 2026-11-05 | trivial | PR #4545: eligible cell floats retain in-bounds offsets and touch the outer cell edge only on overflow, ignoring wrap distances for object placement. Front-of-text, turned-cell and outside-cell opt-outs remain. Synthetic geometry controls; native front/behind-text parity remains unqualified. | -| 2026-11-04 | trivial | Progress log: CLI convert format options; readiness estimates unchanged | -| 2026-11-04 | trivial | Progress log: MHT quoted MIME parameters; readiness estimates unchanged | -| 2026-10-30 | trivial | Progress log: typed n-ary operators such as ∫ and ∑ wait for their limits, and any character that cannot continue a math name corrects it, as observed in Word for Windows on #4938; Enter, arrow keys and nested operators are WordCraft's own choices (#4917); readiness unchanged | -| 2026-11-04 | trivial | CLI input paths keep their native filename when a value-taking option comes first; regression coverage includes conversion to Flat OPC and rejection of non-Unicode option values. | | 2026-11-05 | trivial | DOCX paragraph `w:adjustRightInd` is preserved with true, false and absent values; OOXML properties follow schema order. Grid layout remains open. | -| 2026-11-04 | trivial | Progress log: RTF Unicode fallback counts; readiness estimates unchanged | -| 2026-10-28 | trivial | Per-page ink object lookups, #3614. Drawing order, geometry and saved data retain their behavior; no readiness estimate change | | 2026-11-05 | trivial | Progress log: ODT columns stating only their shares (gap 19) | | 2026-11-05 | trivial | Progress log: ODT font size for every script (gap 19) | | 2026-11-05 | trivial | Progress log: ODT text turning off what its style turns on (gap 19) | @@ -1007,14 +1048,12 @@ MATH glyphs that reference the same construction now share its immutable variant | 2026-11-05 | trivial | Progress log: a watermark or odd and even headers change to a file is saved | | 2026-11-05 | trivial | Progress log: ODT font declarations kept (gap 19) | | 2026-11-05 | trivial | Progress log: ODT pictures offered in several formats (gap 19) | -| 2026-10-28 | trivial | Shared MATH construction records reuse variants and assembly data without changing glyph mappings or existing limits (#3630); readiness estimates unchanged | -| 2026-10-29 | trivial | Page drawing indexes text-box warp lookups per paragraph (#3614); requested offsets only, bounded prefix traversal, original Linux display and persistence controls; readiness estimates unchanged | -| 2026-10-31 | trivial | Progress log: a shape dropped just after a page break inside a paragraph stays on the new page (#4262) | -| 2026-10-31 | trivial | Progress log: a floating object anchored on a later page of a long paragraph is drawn there (#4250) | -| 2026-10-28 | trivial | Protected typing boundary lookup counts preceding objects once and indexes editable permission IDs (#3614); caret movement and enforcement policy are unchanged. | -| 2026-10-31 | trivial | Progress log: the window moves by its title bar behind a modal dialog (#5124) | +| 2026-11-04 | trivial | Progress log: #4501 refactor regressions restored (#4683) | +| 2026-11-04 | trivial | Progress log: CLI convert format options; readiness estimates unchanged | +| 2026-11-04 | trivial | Progress log: MHT quoted MIME parameters; readiness estimates unchanged | +| 2026-11-04 | trivial | CLI input paths keep their native filename when a value-taking option comes first; regression coverage includes conversion to Flat OPC and rejection of non-Unicode option values. | +| 2026-11-04 | trivial | Progress log: RTF Unicode fallback counts; readiness estimates unchanged | | 2026-11-04 | trivial | Progress log: OpenDocument display settings removed (gap 19) | -| 2026-10-31 | trivial | Progress log: dialogs are modal except the five Word keeps modeless; a press beside one shakes it (#3859) | | 2026-11-04 | trivial | Progress log: picture brightness, contrast and transparency (#1711, #1766) | | 2026-11-04 | minor | `app.quit` over the control channel and MCP bridge is refused while a document has unsaved changes, and `{"force": true}` quits without saving; the prompt and the refusal share one predicate (#3274). | | 2026-11-04 | minor | `file.closeDocument` over the control channel and MCP bridge is refused while the document it names has unsaved changes, a save the browser's picker hasn't finished, or a comment still being typed; `{"force": true}` discards them. The prompt and the refusal share one predicate (#3274). | @@ -1022,18 +1061,12 @@ MATH glyphs that reference the same construction now share its immutable variant | 2026-11-04 | trivial | Progress log: ODT element audit (gap 19) | | 2026-11-04 | trivial | Progress log: ODT checked against 220 files from other applications (gap 19) | | 2026-11-04 | trivial | Progress log: OpenDocument files shown in Microsoft Word style or LibreOffice style (gap 19) | -| 2026-11-07 | trivial | Progress log: `.doc` brace and bracket shapes unfilled by default (#5943) | | 2026-11-04 | trivial | PR #4609: relative REF keeps context already displayed by the own or a needed ancestor label; six synthetic legal-template cases and separate-list context follow the Word for Windows measurements reported by @pakiat in PR discussion. Existing unknown-switch/cache boundaries and readiness estimates unchanged; no new native Word run. | -| 2026-11-01 | trivial | Progress log: SEQ, STYLEREF and REF fields show fresh results in output | -| 2026-10-31 | trivial | Progress log: PDFs and prints show a table of contents' current page numbers | -| 2026-10-29 | trivial | Progress log: Print Markup balloon anchors use one object walk per paragraph (#3614); readiness estimates unchanged | -| 2026-10-28 | trivial | Print Markup text-copy comment discovery walks paragraph objects once (#3614); quotes, order, limits and readiness estimates unchanged | +| 2026-11-03 | trivial | Progress log: the title bar's Search box takes the typing in place (#5398) | | 2026-11-03 | trivial | Progress log: Language pack languages in every language list (CP4.3) | | 2026-11-03 | trivial | Progress log: the missing-pack bar on a fresh install, the caret's typing language, and the spelling menu heading in the interface language (CP4.3) | | 2026-11-03 | trivial | Progress log: Options › Language and Proofing redesign (CP4.3) | | 2026-11-03 | minor | Home › Paragraph Tools (#5043): nine selection- or document-scoped conversion and cleanup commands; one undo step per command, with tracked deletions preserved; readiness estimates unchanged | -| 2026-10-30 | trivial | Progress log: layout resource caps — repeated table headers are bounded by item counts, the wrap cache by decoded pixels and linked text box layout by its lines and items; PDF export, hit testing, tracked changes, clipped tables and long endnote selections cost linear time (#3867, #3866) | -| 2026-10-17 | trivial | Progress log: RTF on the system clipboard | | 2026-11-03 | trivial | Progress log: craft-proof pin, French elision suggestions and Valencian (CP4.3) | | 2026-11-03 | trivial | Progress log: a long comment's card and balloon stop at ten lines (#3382) | | 2026-11-03 | trivial | Progress log: Shape Format › Size in the interface unit (#4196) | @@ -1044,112 +1077,149 @@ MATH glyphs that reference the same construction now share its immutable variant | 2026-11-03 | trivial | Progress log: an empty paragraph after a document's leading floating table takes no space before | | 2026-11-03 | trivial | Progress log: Replace and Remove Table of Contents with Word's title above a section break (#4041) | | 2026-11-03 | trivial | Progress log: language-packs-2 published and pinned, 75 Language packs | +| 2026-11-02 | trivial | Progress log: a linked picture shows and follows its link; DOCX `a:hlinkClick` (#5267) | +| 2026-11-02 | trivial | Progress log: alternative format chunks and MHT open | | 2026-11-02 | trivial | Progress log: language-packs-1 published and pinned, 61 Language packs (CP4.4) | +| 2026-11-02 | trivial | Honor page break before at a continuous section's mid-page top (#5287); its later-column case remains unmeasured in Word. Readiness unchanged. | +| 2026-11-02 | trivial | Progress log: ODT controls, custom shapes, in-line placement (gap 19) | +| 2026-11-02 | trivial | Progress log: ODT charts kept, frame outlines, header height (gap 19) | +| 2026-11-02 | trivial | Progress log: ODT header rows (gap 19) | +| 2026-11-02 | trivial | Progress log: ODT layout setting, padding, columns (gap 19) | +| 2026-11-02 | trivial | Progress log: ODT tables, header spacing, picture paragraphs (gap 19) | +| 2026-11-02 | trivial | Progress log: ODT round trips keep their page count (gap 19) | +| 2026-11-02 | trivial | Progress log: emphasis marks, SET fields, ODT page backgrounds and tables (gap 19) | +| 2026-11-02 | trivial | Progress log: ODT checked against LibreOffice's templates (gap 19) | +| 2026-11-01 | trivial | formatting shortcuts say what they did to screen readers | +| 2026-11-01 | trivial | Progress log: SEQ, STYLEREF and REF fields show fresh results in output | | 2026-11-01 | trivial | Progress log: Language packs install from File › Options › Language and the missing-pack bar once language-packs-1 is published (CP4) | | 2026-11-01 | trivial | Progress log: English spelling reads SCOWL 2026 (CP2) | -| 2026-11-02 | trivial | Honor page break before at a continuous section's mid-page top (#5287); its later-column case remains unmeasured in Word. Readiness unchanged. | | 2026-11-01 | trivial | Progress log: arrowheads keep their kind, width and length and are drawn at Word's sizes | | 2026-11-01 | trivial | Progress log: columns for selected text draw their line between (#5178) | -| 2026-10-31 | trivial | Progress log: a Word 365 .doc in Aptos opens in Aptos (#5066); readiness unchanged | -| 2026-10-31 | trivial | Progress log: a table row doesn't split off a picture that doesn't fit (#4272) | | 2026-11-01 | trivial | Progress log: a middle or bottom cell of a row split across pages lines up on the first page | | 2026-11-01 | trivial | Progress log: tab leader dots spaced and placed as in Word | -| 2026-10-31 | trivial | Progress log: a list level above counts its first number at the first deeper item | | 2026-11-01 | trivial | Progress log: paragraph side borders lie outside the text (#5036) | | 2026-11-01 | trivial | Progress log: proofing moved to craft-proof (craft-libs) and its data to craft-i18n `language-data/` (CP1) | | 2026-11-01 | trivial | #3915: preserve guarded whole-line ordinary-tab alignment with current main. Existing controls retained; source checks only, primary qualification pending. | | 2026-11-01 | trivial | #2437: Preserve finite paragraph-border flow extents and terminal-break keep preflight with current-main changes. Recursive terminal-successor lookahead remains outside scope. Source checks only; primary qualification pending. | +| 2026-11-01 | trivial | Progress log: the ruler shows the spaces between text columns (#5197) | +| 2026-11-01 | trivial | Progress log: ODT at ~90% (gap 19) | +| 2026-11-01 | trivial | Progress log: a list inside a Markdown block quote stays quoted | +| 2026-10-31 | trivial | dialogs are dialogs to screen readers, their tabs are tabs, the one shown selected, and colour fields and swatches say their colour | +| 2026-10-31 | trivial | Control/MCP #2596 review fixes; readiness estimates unchanged | +| 2026-10-31 | trivial | Progress log: a numFmt none list level shows its literal text (#4985); readiness unchanged | +| 2026-10-31 | trivial | Progress log: font menu entries are drawn from shared textures (#5105) | +| 2026-10-31 | trivial | Progress log: a shape dropped just after a page break inside a paragraph stays on the new page (#4262) | +| 2026-10-31 | trivial | Progress log: a floating object anchored on a later page of a long paragraph is drawn there (#4250) | +| 2026-10-31 | trivial | Progress log: the window moves by its title bar behind a modal dialog (#5124) | +| 2026-10-31 | trivial | Progress log: dialogs are modal except the five Word keeps modeless; a press beside one shakes it (#3859) | +| 2026-10-31 | trivial | Progress log: PDFs and prints show a table of contents' current page numbers | +| 2026-10-31 | trivial | Progress log: a Word 365 .doc in Aptos opens in Aptos (#5066); readiness unchanged | +| 2026-10-31 | trivial | Progress log: a table row doesn't split off a picture that doesn't fit (#4272) | +| 2026-10-31 | trivial | Progress log: a list level above counts its first number at the first deeper item | | 2026-10-31 | trivial | Progress log: percentage cell widths size table columns whichever rows give them | | 2026-10-31 | trivial | Progress log: a paragraph naming an undefined DOCX style is formatted as Normal (#5077) | | 2026-10-31 | minor | #3398: persistent screen-only green, cream and gray paper presets, with document backgrounds and export colors retained. Read Mode None follows the screen preset; Sepia/Inverse retain priority. | | 2026-10-31 | trivial | Progress log: TOC page numbers are PAGEREF fields (#5097) | | 2026-10-31 | trivial | Progress log: Backstage keytips, Alt, F, P prints (#4960) | | 2026-10-31 | minor | #3693: Delete Previous Sentence command and keyboard dispatch, with sentence/paragraph/cell, selection, undo and tracking regressions. Additional WordCraft behavior; Word-parity estimates unchanged. | -| 2026-10-30 | trivial | Progress log: only the PDF sent to the printer leaves out link annotations; Save these pages as PDF keeps them (#4734) | -| 2026-10-29 | trivial | Progress log: documents with links print (#4734) | | 2026-10-31 | trivial | Synchronize the existing Proofing pane with main `eecbb8f`; preserve explicit-position lookup, implicit selection, navigation, undo and per-window state; fresh exact-SHA hosted validation pending, readiness unchanged | -| 2026-10-30 | trivial | Synchronize the existing Proofing pane and navigation/selection/undo regressions with main `3b7f7ed`; new-SHA validation pending, readiness unchanged | | 2026-10-31 | trivial | Progress log: Linux Read Aloud through Speech Dispatcher (#4576) | -| 2026-10-28 | trivial | Aligned copies retain their locked document coordinate during middle-button scrolling and can start on secondary selected objects; existing Ctrl and Shift selection behavior stays (#4764) | -| 2026-10-28 | trivial | Ctrl/Command+Shift drags a selected floating object into an axis-aligned copy (#4764); synthetic Linux interaction and persistence controls, native desktop and Word untested; gap/readiness estimates unchanged | -| 2026-10-28 | trivial | Connector object lookups retain the typed column-selection inputs on current main (#3631); readiness estimates unchanged | -| 2026-10-27 | trivial | Connector rerouting indexes laid-out object positions once per batch, preserving page hints, first-match order and same-page glue; synthetic equivalence, geometry and scaling regressions (#3631); routing policy and readiness estimates unchanged | -| 2026-10-28 | trivial | Preserve custom-property bookmark link targets through saves, value edits and dialog renames (#4767); no linked-value evaluation or readiness change | +| 2026-10-31 | trivial | Progress log: Field dialog capitalization Format list for text fields | +| 2026-10-30 | trivial | the Paste button is named "Paste" for screen readers, without macOS's key on other platforms; the status bar's Go To hint shows the platform's key | +| 2026-10-30 | trivial | Progress log: under Track Changes a list item deleted whole shows its number as deleted text, in the deletion's colour and mark (#4828); readiness unchanged | +| 2026-10-30 | trivial | Progress log: typed n-ary operators such as ∫ and ∑ wait for their limits, and any character that cannot continue a math name corrects it, as observed in Word for Windows on #4938; Enter, arrow keys and nested operators are WordCraft's own choices (#4917); readiness unchanged | +| 2026-10-30 | trivial | Progress log: layout resource caps — repeated table headers are bounded by item counts, the wrap cache by decoded pixels and linked text box layout by its lines and items; PDF export, hit testing, tracked changes, clipped tables and long endnote selections cost linear time (#3867, #3866) | +| 2026-10-30 | trivial | Progress log: only the PDF sent to the printer leaves out link annotations; Save these pages as PDF keeps them (#4734) | +| 2026-10-30 | trivial | Synchronize the existing Proofing pane and navigation/selection/undo regressions with main `3b7f7ed`; new-SHA validation pending, readiness unchanged | +| 2026-10-30 | trivial | Progress log: the Paragraph dialog's Special box sets First line and Hanging indents | +| 2026-10-29 | trivial | Page drawing indexes text-box warp lookups per paragraph (#3614); requested offsets only, bounded prefix traversal, original Linux display and persistence controls; readiness estimates unchanged | +| 2026-10-29 | trivial | Progress log: Print Markup balloon anchors use one object walk per paragraph (#3614); readiness estimates unchanged | +| 2026-10-29 | trivial | Progress log: documents with links print (#4734) | | 2026-10-29 | trivial | Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged | -| 2026-10-28 | trivial | Arabic Backspace removes one combining mark and keeps its base letter (#4757); stored mark order, caret/forward-Delete and other-script behavior retained; original synthetic command/history/protection/save-reopen checks, no native Word comparison; readiness estimates unchanged | -| 2026-10-28 | trivial | Note conversion walks reference offsets and formatting runs together, #4750; readiness estimates unchanged. | | 2026-10-29 | trivial | DOCX comment IDs use ordered paragraph lookup and one durable-ID reservation set; threading and ID rules unchanged | -| 2026-10-28 | trivial | #4658: bound Markdown reference-label rejection work, preserving literal source and ordinary link matching | -| 2026-11-01 | trivial | Progress log: the ruler shows the spaces between text columns (#5197) | | 2026-10-29 | trivial | Progress log: Insert › Shapes icon grid (#4349) | | 2026-10-29 | trivial | HTML import keeps preformatted lines with CR, CRLF or LF input newlines (#4810); numeric character references retain their separate meaning; readiness estimates unchanged. | | 2026-10-29 | trivial | Progress log: window fallback geometry and equation symbol tooltips | | 2026-10-29 | trivial | Progress log: window titles omit NUL characters (#3634) | -| 2026-10-30 | trivial | Progress log: the Paragraph dialog's Special box sets First line and Hanging indents | | 2026-10-29 | trivial | Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880). Filtered/sorted order, product geometry and single-label mode retained; readiness estimates unchanged. | -| 2026-10-19 | trivial | Progress log: Linux display server setting (#2184) | -| 2026-10-19 | trivial | Progress log: the status bar's count can be words, characters or characters without spaces (#2797) | +| 2026-10-29 | trivial | Progress log: corporate authors in bibliographies (#4848) | +| 2026-10-29 | trivial | Progress log: Table Properties follows the selection (#4857) | +| 2026-10-29 | trivial | Progress log: citation source and bibliography-number lookups (#4888) | +| 2026-10-28 | trivial | Per-page ink object lookups, #3614. Drawing order, geometry and saved data retain their behavior; no readiness estimate change | +| 2026-10-28 | trivial | Shared MATH construction records reuse variants and assembly data without changing glyph mappings or existing limits (#3630); readiness estimates unchanged | +| 2026-10-28 | trivial | Protected typing boundary lookup counts preceding objects once and indexes editable permission IDs (#3614); caret movement and enforcement policy are unchanged. | +| 2026-10-28 | trivial | Print Markup text-copy comment discovery walks paragraph objects once (#3614); quotes, order, limits and readiness estimates unchanged | +| 2026-10-28 | trivial | Aligned copies retain their locked document coordinate during middle-button scrolling and can start on secondary selected objects; existing Ctrl and Shift selection behavior stays (#4764) | +| 2026-10-28 | trivial | Ctrl/Command+Shift drags a selected floating object into an axis-aligned copy (#4764); synthetic Linux interaction and persistence controls, native desktop and Word untested; gap/readiness estimates unchanged | +| 2026-10-28 | trivial | Connector object lookups retain the typed column-selection inputs on current main (#3631); readiness estimates unchanged | +| 2026-10-28 | trivial | Preserve custom-property bookmark link targets through saves, value edits and dialog renames (#4767); no linked-value evaluation or readiness change | +| 2026-10-28 | trivial | Arabic Backspace removes one combining mark and keeps its base letter (#4757); stored mark order, caret/forward-Delete and other-script behavior retained; original synthetic command/history/protection/save-reopen checks, no native Word comparison; readiness estimates unchanged | +| 2026-10-28 | trivial | Note conversion walks reference offsets and formatting runs together, #4750; readiness estimates unchanged. | +| 2026-10-28 | trivial | #4658: bound Markdown reference-label rejection work, preserving literal source and ordinary link matching | +| 2026-10-28 | trivial | Progress log: chart and SmartArt text the font lacks is drawn in a fallback face (#4720) | +| 2026-10-28 | trivial | Progress log: RTF metafile pictures are imported (#4259) | +| 2026-10-28 | trivial | Progress log: Chinese and Japanese text counts a word per character (#4547) | +| 2026-10-27 | trivial | Connector rerouting indexes laid-out object positions once per batch, preserving page hints, first-match order and same-page glue; synthetic equivalence, geometry and scaling regressions (#3631); routing policy and readiness estimates unchanged | | 2026-10-27 | trivial | Progress log: Return on File › Print prints, as Word's default Print button does | | 2026-10-27 | trivial | PR #4609: Numeric cross-references (#4533): preserve the numbered clause through field updates; adapted from @Alyosha-dot-shop's issue patch, with extra relative-context and cache guards. Synthetic checks only; readiness estimates unchanged. | -| 2026-10-26 | minor | Word-observed Proofing task pane uses shared review commands; clicking a suggestion corrects and advances; context, suggestion cards and ignore/dictionary links follow the Windows reference; inspected previews prompted a full-width context and scrollable three-card list; exact selected spelling takes priority over overlapping grammar, with command/pane regressions and integration workflow paths; readiness estimates unchanged | -| 2026-10-14 | trivial | Progress log: Insert Date and Time and DATE/TIME fields use local time (#1707) | | 2026-10-27 | trivial | Preserve #4249 complete-record CSV delimiter detection and its regressions in the mailings modules; recipient commands, limits and refusal behavior unchanged. | +| 2026-10-27 | trivial | Progress log: AutoCorrect Options with no document open (#4585) | +| 2026-10-27 | trivial | 2026-10-27 · #4533 review: numeric REF updates lazily index body bookmarks once per update, retaining the first body bookmark for duplicate names. Unsupported switches and ordinary REF/PAGEREF behavior are unchanged; a synthetic 64-reference regression covers repeated updates and duplicate names. Estimates unchanged. | +| 2026-10-27 | trivial | 2026-10-27 · #4533: numeric REF fields use paragraph list numbers for no/full/relative context, reusing bounded numbering. Shared context already embedded in a level label is removed; merged-away cells do not count. Unsupported separator/text/position switches and ambiguous contexts or delimiter-free joins retain cached results. Synthetic OOXML regressions; no native Word or real-document validation, estimates unchanged. | +| 2026-10-26 | trivial | Progress log: dialog sections across 13 dialogs; conditional scrolling for tall dialogs (#4035, #4038) | +| 2026-10-26 | minor | Word-observed Proofing task pane uses shared review commands; clicking a suggestion corrects and advances; context, suggestion cards and ignore/dictionary links follow the Windows reference; inspected previews prompted a full-width context and scrollable three-card list; exact selected spelling takes priority over overlapping grammar, with command/pane regressions and integration workflow paths; readiness estimates unchanged | | 2026-10-26 | trivial | Integrate #4249 with current-main CSV helpers, preserving logical-record detection, existing recipient limits and refusal behavior. | +| 2026-10-26 | trivial | Progress log: floating lines move by their body and resize by their ends, and a level line stays level | +| 2026-10-26 | trivial | View › Window across the native windows (#322): View catalog 26/29 → 29/29 | | 2026-10-25 | trivial | Recipient CSV delimiter detection reads the first complete record, including quoted line breaks and doubled quotes; separator ties and cell parsing remain unchanged. Original parser and CLI import/save/reopen checks; readiness estimates unchanged. | | 2026-10-25 | trivial | Progress log: built-in styles and table styles write `w:bCs` beside `w:b` and `w:iCs` beside `w:i` (#4198) | -| 2026-10-22 | trivial | Progress log: one native window per open document | -| 2026-10-22 | trivial | Progress log: every open document keeps its own recovery copy | -| 2026-10-22 | trivial | Progress log: several open documents in the desktop window | -| 2026-10-22 | trivial | Progress log: several open documents in one session | -| 2026-10-22 | trivial | Decode numeric XML references once in legacy form names and drop-down labels | -| 2026-10-26 | trivial | Progress log: floating lines move by their body and resize by their ends, and a level line stays level | | 2026-10-25 | trivial | Progress log: egui 0.37 migration records the `craft-i18n.rev` catalog pin (9205108…; 27 languages) and the input-method handling; managed CI passed; native acceptance and native-speaker review remain open | | 2026-10-25 | trivial | Progress log: justified and distributed lines keep the width of the spaces before their first character | -| 2026-10-17 | trivial | Progress log: Standard-encrypted (AES) Word files open (gap 9) | | 2026-10-25 | trivial | Progress log: Text Highlight Color buttons show the remembered colour, or no colour bar after No Color (#4087) | -| 2026-10-23 | minor | A command that changes nothing is not an edit: no undo step, no unsaved changes, no relayout, and the redo stack survives it. | -| 2026-10-23 | trivial | cu20we: preserve and render outline caps across DOCX/VML, screen and PDF; synthetic regressions; readiness estimates unchanged | -| 2026-10-23 | trivial | cu20we: box float paragraph origins corrected, synthetic regressions added | +| 2026-10-25 | trivial | Highlight decisions include fully selected paragraph marks in whole cells and ordinary ranges, including empty paragraphs; partial text columns exclude unselected marks (#4085). | +| 2026-10-25 | trivial | Highlight toggle checks the full target beyond 10,000 runs without collecting resolved formatting; mixed and inherited tails and Undo/Redo covered (#4085). | | 2026-10-24 | trivial | Exact-spacing table contact uses the specified line height in row selection and word skipping; large/small mark regressions in modes 11/12/14/15 (#3977); shape estimates unchanged | | 2026-10-24 | trivial | Floating tables count exact line-bottom contact; shapes keep strict overlap (#3977); original boundary/skip regressions in modes 11/12/14/15, expected Word rule from cyril265; readiness estimates unchanged | | 2026-10-24 | trivial | Progress log: AutoCorrect corrects a word typed after a no-break space or an ideographic space | -| 2026-10-25 | trivial | Highlight decisions include fully selected paragraph marks in whole cells and ordinary ranges, including empty paragraphs; partial text columns exclude unselected marks (#4085). | -| 2026-10-25 | trivial | Highlight toggle checks the full target beyond 10,000 runs without collecting resolved formatting; mixed and inherited tails and Undo/Redo covered (#4085). | | 2026-10-24 | trivial | Highlight shortcut toggles the last chosen colour off when the whole selection has it; explicit colour commands remain setters (#4085). | | 2026-10-24 | trivial | Progress log: AutoFormat As You Type turns `*bold*` and `_italic_` marks into formatting | | 2026-10-24 | trivial | Progress log: the parity catalog counts Read Mode's View menu (Column Width, Page Color, Layout) | | 2026-10-24 | trivial | Progress log: regex Replace expands capture groups (#4177) | | 2026-10-24 | trivial | Progress log: a click just outside a floating table by turned cell text goes to the text after it (#4181) | +| 2026-10-23 | minor | A command that changes nothing is not an edit: no undo step, no unsaved changes, no relayout, and the redo stack survives it. | +| 2026-10-23 | trivial | cu20we: preserve and render outline caps across DOCX/VML, screen and PDF; synthetic regressions; readiness estimates unchanged | +| 2026-10-23 | trivial | cu20we: box float paragraph origins corrected, synthetic regressions added | | 2026-10-23 | trivial | Progress log: interface translations from storytold/craft-i18n through the `craft-i18n` crate | | 2026-10-23 | trivial | Progress log: comment times in local time (#2322, #2337) | -| 2026-10-22 | trivial | Progress log: mail merge record navigation and record ranges for Finish & Merge and Print Documents (#3028) | | 2026-10-23 | trivial | Progress log: a relationship the markup names without the prefix is read as it wrote (#3411 follow-up) | -| 2026-10-21 | trivial | Progress log: a document with many relationships opens in the time its part takes (#3411) | | 2026-10-23 | trivial | Progress log: an empty paragraph with a hidden mark draws no list number (#3982) | -| 2026-10-22 | minor | Progress log: Spanish proofing (#3360, #3553) | | 2026-10-23 | trivial | Progress log: Update Table keeps a two-column TOC from a localized Word in its columns (#3889) | +| 2026-10-23 | trivial | Progress log: continuous sections paginate, #3907 | +| 2026-10-23 | trivial | Progress log: justified lines ending in a manual line break reach the margin (#3924) | +| 2026-10-23 | trivial | Progress log: "NaN" in the Font dialog's Size box no longer closes the app (#3663) | +| 2026-10-23 | trivial | Progress log: a table cell span from a `.json` file no longer overflows (#3637) | +| 2026-10-22 | trivial | Progress log: one native window per open document | +| 2026-10-22 | trivial | Progress log: every open document keeps its own recovery copy | +| 2026-10-22 | trivial | Progress log: several open documents in the desktop window | +| 2026-10-22 | trivial | Progress log: several open documents in one session | +| 2026-10-22 | trivial | Decode numeric XML references once in legacy form names and drop-down labels | +| 2026-10-22 | trivial | Progress log: mail merge record navigation and record ranges for Finish & Merge and Print Documents (#3028) | +| 2026-10-22 | minor | Progress log: Spanish proofing (#3360, #3553) | | 2026-10-22 | minor | Compare's new and revised untitled results clear the previous document's version snapshots; a rejected protected comparison or mailing result preserves the snapshots and file identity. | | 2026-10-22 | minor | The CLI author flag and the Options user name field cannot change the session name after protection starts (#3279 follow-up). | -| 2026-10-21 | trivial | Progress log: a word with no break opportunity in it no longer makes the layout quadratic (#3412) | -| 2026-10-20 | minor | The Document Inspector's removals are refused while the document tracks changes (they delete straight from the document, so the text would go with no revision to show for it and the revision trail would be broken behind the user's back), and a version snapshot belongs to the document it was taken from | -| 2026-10-20 | minor | Restrict Editing, three more gaps closed: the protection of a protected document only changes through the explicit stop, the session author can't change through `file.setAuthor` under protection, and the post-check compares the settings and the metadata as well as the text and the formatting | -| 2026-10-20 | minor | Restrict Editing: a file command that changes the open document is checked like any other — the privacy options, the properties and the inspector's removals are refused on a protected document, and restoring a stored version no longer lifts the protection or drops its password | -| 2026-10-17 | trivial | Progress log: disabled-control reasons translated (#2678) | | 2026-10-22 | trivial | Markdown code spans normalize line endings before export, keeping block markers literal (#3738); format readiness unchanged | -| 2026-10-23 | trivial | Progress log: continuous sections paginate, #3907 | | 2026-10-22 | trivial | Progress log: a click in the footer while editing the header moves there | -| 2026-10-18 | trivial | Explicit New/Open is not interrupted by startup recovery discovery; older copies stay available and Recover follows the interface theme. | -| 2026-10-17 | trivial | Progress log: Home › Underline drop-down (#2738) | -| 2026-10-19 | trivial | Text context menus include the existing formatting mini toolbar (#2959); paste options remain in PR #2599. Readiness estimates unchanged. | -| 2026-10-19 | trivial | Progress log: Insert Caption picks the label used last (#3120) | -| 2026-10-16 | trivial | Progress log: `HYPERLINK` fields read as links (#2174) | -| 2026-10-18 | trivial | Progress log: German text hyphenates by the German patterns | +| 2026-10-21 | trivial | Progress log: a document with many relationships opens in the time its part takes (#3411) | +| 2026-10-21 | trivial | Progress log: a word with no break opportunity in it no longer makes the layout quadratic (#3412) | | 2026-10-21 | trivial | Progress log: File › Recover follows the app theme (#3243) | | 2026-10-21 | trivial | Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459) | | 2026-10-21 | trivial | Progress log: table style band sizes, banded rows as in Word (#3415) | | 2026-10-21 | trivial | Progress log: ODT table column widths are read, so widths set in LibreOffice or changed in WordCraft survive a save | | 2026-10-21 | trivial | Pin the font input of four geometric layout controls; assertions and renderer font policy unchanged. | | 2026-10-21 | trivial | Progress log: a document with many content controls saves in the time the controls take (#13) | +| 2026-10-20 | minor | The Document Inspector's removals are refused while the document tracks changes (they delete straight from the document, so the text would go with no revision to show for it and the revision trail would be broken behind the user's back), and a version snapshot belongs to the document it was taken from | +| 2026-10-20 | minor | Restrict Editing, three more gaps closed: the protection of a protected document only changes through the explicit stop, the session author can't change through `file.setAuthor` under protection, and the post-check compares the settings and the metadata as well as the text and the formatting | +| 2026-10-20 | minor | Restrict Editing: a file command that changes the open document is checked like any other — the privacy options, the properties and the inspector's removals are refused on a protected document, and restoring a stored version no longer lifts the protection or drops its password | | 2026-10-20 | trivial | Russian sorting keeps ё with е and recognises decomposed ё/й; synthetic ordering, case and index-heading regressions; broader parity estimates unchanged | | 2026-10-20 | trivial | Progress log: a click below a floating table goes to the text after it, not its last row (#2038) | | 2026-10-20 | trivial | Progress log: the table handles show while the caret is in the table (#2428) | @@ -1160,6 +1230,13 @@ MATH glyphs that reference the same construction now share its immutable variant | 2026-10-20 | trivial | Progress log: read only and comments-only protection grey out edits | | 2026-10-20 | trivial | Progress log: forms protection greys out the Developer tab's control buttons and Properties | | 2026-10-20 | trivial | Progress log: the scrollbar page tip stays on one line (#3341) | +| 2026-10-20 | trivial | Progress log: Times and Courier take their Windows counterparts' line spacing | +| 2026-10-20 | trivial | Progress log: saving to a NAS share mounted by GVFS (#3003) | +| 2026-10-19 | trivial | Empty window (#3126): with no document open (Esc on the Start screen, File › Close), the page area says no document is open and offers Blank document, Browse… and Home; Home goes back to the Start screen without making a document | +| 2026-10-19 | trivial | Progress log: Linux display server setting (#2184) | +| 2026-10-19 | trivial | Progress log: the status bar's count can be words, characters or characters without spaces (#2797) | +| 2026-10-19 | trivial | Text context menus include the existing formatting mini toolbar (#2959); paste options remain in PR #2599. Readiness estimates unchanged. | +| 2026-10-19 | trivial | Progress log: Insert Caption picks the label used last (#3120) | | 2026-10-19 | trivial | Progress log: typing no longer stops after clicking Search (#2986) | | 2026-10-19 | trivial | Progress log: Delete on selected table cells leaves one empty paragraph in each (#2802) | | 2026-10-19 | trivial | A right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, starts the next line with its text instead of ending the line (a TOC entry's page number keeps its leader); a left tab still past the right indent there takes no room (#1840) | @@ -1168,234 +1245,265 @@ MATH glyphs that reference the same construction now share its immutable variant | 2026-10-19 | trivial | Progress log: pointer zoom no longer re-renders pages every frame | | 2026-10-19 | trivial | Progress log: dark-theme interface text on Linux no longer looks semi-bold | | 2026-10-19 | trivial | Progress log: page text on Linux is hinted like Firefox draws text there | -| 2026-10-20 | trivial | Progress log: Times and Courier take their Windows counterparts' line spacing | | 2026-10-19 | trivial | Progress log: forms protection keeps its content controls: no inserting, Properties or Remove Content Control | | 2026-10-19 | trivial | Progress log: text typed into a content control takes the control's formatting; localized placeholder styles recognised | -| 2026-10-17 | trivial | Progress log: #2048 entry covers anchors pushed onto the next page | -| 2026-10-17 | trivial | A line breaks after a hyphen before a digit, like Word (#2712) | -| 2026-10-15 | trivial | Progress log: text above a float's anchor wraps around it, #2048 | -| 2026-10-18 | trivial | Progress log: long navigation headings wrap within the pane instead of ending in an ellipsis (#3015) | -| 2026-10-26 | trivial | View › Window across the native windows (#322): View catalog 26/29 → 29/29 | -| 2026-10-18 | trivial | Font list starts at its first row after clearing a no-match query; recent heading remains visible (#2068) | -| 2026-10-18 | trivial | A word after a slash wraps whole, like Word (#2963) | | 2026-10-19 | trivial | Progress log: render threads reused while typing (#3027) | | 2026-10-19 | trivial | #2964: a centred or end-aligned list label after a leading page break uses its text line's alignment. Synthetic LTR/RTL numbered/bulleted controls and the issue's DOCX export; broader pagination gaps and readiness estimates unchanged | -| 2026-10-17 | trivial | Progress log: recipient list search and merged-only view (#1576) | -| 2026-10-17 | trivial | Progress log: removing documents from the recent list (#2716) | +| 2026-10-19 | trivial | Progress log: personal templates in File › New, Save as Word Template (#2852) | +| 2026-10-18 | trivial | Explicit New/Open is not interrupted by startup recovery discovery; older copies stay available and Recover follows the interface theme. | +| 2026-10-18 | trivial | Progress log: German text hyphenates by the German patterns | +| 2026-10-18 | trivial | Progress log: long navigation headings wrap within the pane instead of ending in an ellipsis (#3015) | +| 2026-10-18 | trivial | Font list starts at its first row after clearing a no-match query; recent heading remains visible (#2068) | +| 2026-10-18 | trivial | A word after a slash wraps whole, like Word (#2963) | | 2026-10-18 | trivial | Progress log: a single selected cell's border drags in its row only | | 2026-10-18 | trivial | Progress log: symbols keep their font when the text font changes (#2036) | -| 2026-10-17 | trivial | Progress log: Restrict Editing guards tables, Paste Formatting and merge fields (#1327) | | 2026-10-18 | trivial | Progress log: Picture Format › Size, sizes typed in any unit and the Size dialog (#2573); readiness estimates unchanged | | 2026-10-18 | trivial | Progress log: Manage Sources imports Word's `Sources.xml` (#2640) | -| 2026-10-14 | trivial | Progress log: a list item's first word is not flagged for a missing capital (#1741) | | 2026-10-18 | trivial | #2445: pending Save As answers keep their originating document identity, so a replacement document is never written to an old picker destination; real Save-button and focused-editor shortcut controls verified | -| 2026-10-16 | trivial | #2445: interactive Save on import-only .doc/.dot paths uses the existing DOCX Save As flow; cancel and failed writes keep the draft, and Close waits for a successful save. Explicit/script saves still report unsupported legacy output | -| 2026-10-16 | trivial | Save Changes exposes an alert-dialog role, the document-specific question and loss/failure context to accessibility; full-app focus/ancestry regression. Native screen-reader verification remains pending. | | 2026-10-18 | trivial | Progress log: legacy menu keys (#1697) | | 2026-10-18 | trivial | Progress log: Focus fills the screen; Full Screen View (#1678) | -| 2026-10-16 | trivial | Progress log: the Spike | -| 2026-10-16 | trivial | Progress log: `w:eastAsianLayout` kept on save | -| 2026-10-15 | trivial | Progress log: undrawable private-use list bullets show the level's default bullet (#1683) | -| 2026-10-15 | trivial | Progress log: web preferences kept between visits (#2132) | -| 2026-10-15 | trivial | Progress log: Recently Used Fonts in the font box (#2068) | -| 2026-10-15 | trivial | Progress log: one Thai face for a run in a missing Thai font (#1549) | | 2026-10-18 | trivial | Progress log: Different First Page headers reachable from page 1 (#2826) | | 2026-10-18 | trivial | Progress log: bold Black/Heavy fonts are not emboldened again | | 2026-10-18 | trivial | Progress log: shape gradients and transparency (#1500) | -| 2026-10-16 | trivial | Progress log: Web Layout fills the window width (#1876) | -| 2026-10-17 | trivial | Progress log: DOCX glossary documents (building blocks) | -| 2026-10-15 | trivial | Progress log: move options in Track Changes Options (gap #5) | -| 2026-10-15 | trivial | Progress log: image size limits checked before allocation (#1321) | -| 2026-10-17 | trivial | Progress log: Read Aloud speaks each sentence in its own language, #1843 | | 2026-10-18 | trivial | Progress log: `wordcraft-cli run --script` (#1963) | | 2026-10-18 | trivial | Progress log: header-cell picture watermarks drawn behind the text (#1775); readiness estimates unchanged | -| 2026-10-14 | trivial | Progress log: comment drafts kept and written before saving or closing (#1348) | +| 2026-10-18 | trivial | Progress log: Split Cells and Convert Text to Table dialogs, matched to the Word check (#2592) | +| 2026-10-17 | trivial | Progress log: RTF on the system clipboard | +| 2026-10-17 | trivial | Progress log: Standard-encrypted (AES) Word files open (gap 9) | +| 2026-10-17 | trivial | Progress log: disabled-control reasons translated (#2678) | +| 2026-10-17 | trivial | Progress log: Home › Underline drop-down (#2738) | +| 2026-10-17 | trivial | Progress log: #2048 entry covers anchors pushed onto the next page | +| 2026-10-17 | trivial | A line breaks after a hyphen before a digit, like Word (#2712) | +| 2026-10-17 | trivial | Progress log: recipient list search and merged-only view (#1576) | +| 2026-10-17 | trivial | Progress log: removing documents from the recent list (#2716) | +| 2026-10-17 | trivial | Progress log: Restrict Editing guards tables, Paste Formatting and merge fields (#1327) | +| 2026-10-17 | trivial | Progress log: DOCX glossary documents (building blocks) | +| 2026-10-17 | trivial | Progress log: Read Aloud speaks each sentence in its own language, #1843 | | 2026-10-17 | trivial | Language dialog keeps inherited proofing language and no-proof choices (#2717); readiness estimates unchanged | | 2026-10-17 | trivial | Progress log: macOS launch arguments and open failures (#1103) | -| 2026-10-14 | trivial | Progress log: ASK and SET fields show nothing (#1765) | -| 2026-10-15 | trivial | Progress log: at-least table rows start the next page whole (#1742) | -| 2026-10-14 | trivial | Progress log: ODT sections on export (gap 19) | -| 2026-10-15 | trivial | Progress log: selection bar for right-to-left paragraphs and table rows | | 2026-10-17 | trivial | Explicit DrawingML preset/custom outline dashes survive import/save and paint in raster/PDF, scaled to the effective stroke width even for zero-width paths. Synthetic controls; theme-inherited dashes and line caps remain unverified. | -| 2026-10-15 | trivial | `wordcraft-cli convert --update-fields` explicitly refreshes unlocked fields before conversion; ordinary conversion keeps cached results. Field refresh can change pagination | | 2026-10-17 | trivial | Arial Unicode MS uses Arial and its proportional substitutes; glyph coverage and exact Word line height remain font-dependent. | -| 2026-10-18 | trivial | Progress log: Split Cells and Convert Text to Table dialogs, matched to the Word check (#2592) | +| 2026-10-17 | minor | Progress log: Drop Cap Options (#2601) | +| 2026-10-17 | trivial | SECTIONPAGES includes shared continuous-section pages in body and header/footer fields | +| 2026-10-17 | trivial | Footer page tables no longer inflate footer text height; body lines wrap at their physical bounds | +| 2026-10-17 | minor | Progress log: Scale to paper size on File › Print, #2108 | +| 2026-10-17 | trivial | Non-overlapping body floating tables clear header tables; overlapping tables keep their requested position | +| 2026-10-17 | trivial | Progress log: the ribbon's paste choices in the context menu (#2583) | +| 2026-10-17 | trivial | Progress log: Scale Font Sizes command (#1475) | +| 2026-10-17 | trivial | Progress log: saving into a folder that refuses a temporary file (#2138) | +| 2026-10-16 | trivial | Progress log: `HYPERLINK` fields read as links (#2174) | +| 2026-10-16 | trivial | #2445: interactive Save on import-only .doc/.dot paths uses the existing DOCX Save As flow; cancel and failed writes keep the draft, and Close waits for a successful save. Explicit/script saves still report unsupported legacy output | +| 2026-10-16 | trivial | Save Changes exposes an alert-dialog role, the document-specific question and loss/failure context to accessibility; full-app focus/ancestry regression. Native screen-reader verification remains pending. | +| 2026-10-16 | trivial | Progress log: the Spike | +| 2026-10-16 | trivial | Progress log: `w:eastAsianLayout` kept on save | +| 2026-10-16 | trivial | Progress log: Web Layout fills the window width (#1876) | | 2026-10-16 | trivial | Progress log: tall-ascent font list entries no longer cut off (#2570) | | 2026-10-16 | trivial | Progress log: Read Mode keeps the keyboard, whole columns, page-turn bar clear (#1772) | | 2026-10-16 | trivial | Progress log: comments readable in the dark theme (#2045) | | 2026-10-16 | trivial | Progress log: Indonesian proofing (#498) | | 2026-10-16 | trivial | Progress log: legacy outline, shadow, emboss and imprint text effects drawn (#2534) | +| 2026-10-16 | trivial | Progress log: Hebrew field results and smart quotes (#1670) | +| 2026-10-16 | trivial | Progress log: Ctrl+wheel zoom no longer scrolls the document (#1743) | +| 2026-10-16 | trivial | Hint-reliant CJK fonts execute TrueType contour assembly; Windows DFKai-SB no longer loses strokes. Synthetic local-font regression; no font binaries bundled. | +| 2026-10-16 | trivial | Drawing dispatch uses the direct graphic-data child so nested pictures keep their text boxes. Synthetic regressions. | +| 2026-10-16 | trivial | Zero-extent drawing anchors contribute no inline font height. Synthetic regressions. | +| 2026-10-16 | trivial | Control keyboard/text input works in the inactive native window (#2420) | +| 2026-10-16 | trivial | Body and active note text keep normal opacity while editing footnotes or endnotes (#2545); header/footer dimming is unchanged | +| 2026-10-16 | trivial | An otherwise empty section at page start retains its line before continuous content; later closing marks stay quiet | +| 2026-10-16 | trivial | Progress log: equations from Word files keep their content (#1273) | +| 2026-10-16 | trivial | Progress log: Insert Caption… on objects and Page Setup header and footer options (#1230) | +| 2026-10-16 | trivial | Progress log: live rotation preview while dragging (#2277); readiness estimates unchanged | +| 2026-10-16 | trivial | Progress log: a text frame in the paragraph defaults frames nothing (#2360) | +| 2026-10-16 | trivial | Progress log: a text file saved over itself closes without asking (#2376) | +| 2026-10-16 | trivial | Progress log: opening a DOCX no longer copies its pictures | +| 2026-10-16 | trivial | Progress log: lam-alef drawn as two glyphs at one x extracts whole from exported PDFs (#2310) | +| 2026-10-15 | trivial | Progress log: text above a float's anchor wraps around it, #2048 | +| 2026-10-15 | trivial | Progress log: undrawable private-use list bullets show the level's default bullet (#1683) | +| 2026-10-15 | trivial | Progress log: web preferences kept between visits (#2132) | +| 2026-10-15 | trivial | Progress log: Recently Used Fonts in the font box (#2068) | +| 2026-10-15 | trivial | Progress log: one Thai face for a run in a missing Thai font (#1549) | +| 2026-10-15 | trivial | Progress log: move options in Track Changes Options (gap #5) | +| 2026-10-15 | trivial | Progress log: image size limits checked before allocation (#1321) | +| 2026-10-15 | trivial | Progress log: at-least table rows start the next page whole (#1742) | +| 2026-10-15 | trivial | Progress log: selection bar for right-to-left paragraphs and table rows | +| 2026-10-15 | trivial | `wordcraft-cli convert --update-fields` explicitly refreshes unlocked fields before conversion; ordinary conversion keeps cached results. Field refresh can change pagination | | 2026-10-15 | trivial | Progress log: Columns on selected text (#2024) | | 2026-10-15 | trivial | Navigation Find and query edits expose Results (#2096) | | 2026-10-15 | trivial | Progress log: numbered headings (#1793) | | 2026-10-15 | trivial | Add the missing `-->` → `→` AutoCorrect entry (#2223), with typing, undo and preference regression coverage; existing arrow bullets unchanged | | 2026-10-15 | trivial | Progress log: Update Field updates the part being edited, as in Word (#1706) | -| 2026-10-14 | trivial | Progress log: Update Fields reaches headers, footers and text boxes (#1706) | | 2026-10-15 | trivial | Progress log: font family caches bounded; math font resolution follows font changes (#1354) | | 2026-10-15 | trivial | Progress log: web typing in non-Latin text no longer repeats (#1480) | | 2026-10-15 | trivial | Progress log: Backspace removes a selected table, rows or columns (#1844) | -| 2026-10-16 | trivial | Progress log: Hebrew field results and smart quotes (#1670) | -| 2026-10-16 | trivial | Progress log: Ctrl+wheel zoom no longer scrolls the document (#1743) | -| 2026-10-16 | trivial | Hint-reliant CJK fonts execute TrueType contour assembly; Windows DFKai-SB no longer loses strokes. Synthetic local-font regression; no font binaries bundled. | -| 2026-10-16 | trivial | Drawing dispatch uses the direct graphic-data child so nested pictures keep their text boxes. Synthetic regressions. | -| 2026-10-14 | trivial | Progress log: RTF export writes sections (gap 19) | | 2026-10-15 | trivial | Progress log: multi-letter equation scripts (#1609) | | 2026-10-15 | trivial | Progress log: plain-text paste keeps the paragraph formatting where it lands | -| 2026-10-14 | trivial | Progress log: Add Font imports every selected font file (#1789) | | 2026-10-15 | trivial | Additive paragraph spacing retains the full before-space after a section page break; ordinary overlapping spacing is unchanged. | | 2026-10-15 | trivial | Exact line spacing keeps the run font baseline around tall equations; automatic and minimum spacing still grow for math. | -| 2026-10-16 | trivial | Zero-extent drawing anchors contribute no inline font height. Synthetic regressions. | -| 2026-10-16 | trivial | Control keyboard/text input works in the inactive native window (#2420) | | 2026-10-15 | trivial | Progress log: Hide Quick Access Toolbar (#1945) | | 2026-10-15 | trivial | Progress log: native ink nested in groups and drawing canvases kept on save | | 2026-10-15 | trivial | Progress log: the word being typed gets no squiggle until the caret leaves it (#1552) | | 2026-10-15 | trivial | Progress log: Highlight No Color sticks to the button (#2105) | -| 2026-10-16 | trivial | Body and active note text keep normal opacity while editing footnotes or endnotes (#2545); header/footer dimming is unchanged | -| 2026-10-17 | minor | Progress log: Drop Cap Options (#2601) | -| 2026-10-16 | trivial | An otherwise empty section at page start retains its line before continuous content; later closing marks stay quiet | -| 2026-10-16 | trivial | Progress log: equations from Word files keep their content (#1273) | -| 2026-10-16 | trivial | Progress log: Insert Caption… on objects and Page Setup header and footer options (#1230) | -| 2026-10-17 | trivial | SECTIONPAGES includes shared continuous-section pages in body and header/footer fields | -| 2026-10-17 | trivial | Footer page tables no longer inflate footer text height; body lines wrap at their physical bounds | -| 2026-10-17 | minor | Progress log: Scale to paper size on File › Print, #2108 | -| 2026-10-17 | trivial | Non-overlapping body floating tables clear header tables; overlapping tables keep their requested position | | 2026-10-15 | trivial | Progress log: caret inside ligatures (#1974) | -| 2026-10-17 | trivial | Progress log: the ribbon's paste choices in the context menu (#2583) | -| 2026-10-16 | trivial | Progress log: live rotation preview while dragging (#2277); readiness estimates unchanged | -| 2026-10-16 | trivial | Progress log: a text frame in the paragraph defaults frames nothing (#2360) | -| 2026-10-16 | trivial | Progress log: a text file saved over itself closes without asking (#2376) | | 2026-10-15 | trivial | Progress log: recovery copies and .json files store pictures as base64 (#586 follow-up) | | 2026-10-15 | trivial | Progress log: selected table rows and cells copy as a table; Cut clears their text (#1744) | -| 2026-10-14 | trivial | Progress log: Select Table copies and cuts the whole table (#1744) | -| 2026-10-17 | trivial | Progress log: Scale Font Sizes command (#1475) | -| 2026-10-14 | trivial | Progress log: row table border exceptions | -| 2026-10-12 | minor | Czech proofing review: short-word splits rank after deletion, NOSUGGEST excludes suggestions while accepting typed forms, affix comments apply only to headers, ratios keep spaces and repeated-word messages use Czech quotes; synthetic engine end-to-end and latency checks | | 2026-10-15 | trivial | Three-column header/footer presets use editable table cells and screen-only editing guides (#2197); readiness unchanged | -| 2026-10-12 | minor | Czech spelling from the installed Hunspell dictionary, runtime-table suggestions and generic checks; Czech interface writes cs-CZ documents; no Czech hyphenation patterns bundled; estimates unchanged | -| 2026-10-12 | trivial | Progress log: one selected cell's border drags in its row only (#962) | -| 2026-10-16 | trivial | Progress log: opening a DOCX no longer copies its pictures | -| 2026-10-12 | minor | Progress log: Word default shortcuts expanded to 140 commands on macOS (169 combinations) and 158 on Linux/Windows (188 combinations), addressing gap #24 | -| 2026-10-13 | trivial | Web/Draft long-page blur fixed with visible full-resolution raster tiles | +| 2026-10-15 | trivial | Progress log: comments outside the body in the list, balloons and Next/Previous (#2289) | +| 2026-10-15 | trivial | Progress log: Ink to Shape two-stroke and closed-head arrows | +| 2026-10-15 | trivial | Charts: radar charts (standard, marker, filled) are drawn instead of a placeholder (#1890) | +| 2026-10-15 | trivial | Progress log: dialog close box (#1885) | +| 2026-10-15 | trivial | Progress log: mixed Hebrew/Latin text keeps its order in Word (#1543) | +| 2026-10-15 | trivial | Progress log: ruler numbers by zoom, rulers follow the caret's page (#1878) | +| 2026-10-14 | trivial | Progress log: Insert Date and Time and DATE/TIME fields use local time (#1707) | +| 2026-10-14 | trivial | Progress log: a list item's first word is not flagged for a missing capital (#1741) | +| 2026-10-14 | trivial | Progress log: comment drafts kept and written before saving or closing (#1348) | +| 2026-10-14 | trivial | Progress log: ASK and SET fields show nothing (#1765) | +| 2026-10-14 | trivial | Progress log: ODT sections on export (gap 19) | +| 2026-10-14 | trivial | Progress log: Update Fields reaches headers, footers and text boxes (#1706) | +| 2026-10-14 | trivial | Progress log: RTF export writes sections (gap 19) | +| 2026-10-14 | trivial | Progress log: Add Font imports every selected font file (#1789) | +| 2026-10-14 | trivial | Progress log: Select Table copies and cuts the whole table (#1744) | +| 2026-10-14 | trivial | Progress log: row table border exceptions | | 2026-10-14 | trivial | Progress log: VML freeforms read and kept on save | | 2026-10-14 | trivial | Progress log: consistent preferred cell widths | | 2026-10-14 | trivial | Field instructions spanning paragraphs no longer add blank lines during pagination; empty result paragraphs still take a line. | | 2026-10-14 | trivial | A list paragraph containing only a page break has no visible label; it still advances the list counter. Ordinary empty list items keep their label. | | 2026-10-14 | trivial | Floating-table overlap checks use visible line content; empty line-break lines no longer move a table | -| 2026-10-15 | trivial | Progress log: comments outside the body in the list, balloons and Next/Previous (#2289) | | 2026-10-14 | trivial | Progress log: deleting a comment leaves no dangling anchors or replies (#1345) | | 2026-10-14 | minor | Legacy DOC DIB conversion byte limits only; related #1334/#1554, stage and readiness estimates unchanged | -| 2026-10-15 | trivial | Progress log: Ink to Shape two-stroke and closed-head arrows | -| 2026-10-13 | trivial | Progress log: justified vertical page alignment (#1320) | | 2026-10-14 | trivial | Progress log: file names that aren't valid Unicode (#1440) | -| 2026-10-13 | trivial | Behind Text pictures and shapes drag over overlapping text in the body and headers, selected or not, while ordinary clicks keep editing text; In Front of Text drag covered too | -| 2026-10-13 | trivial | Progress log: the watermark written to DOCX (#1290) | -| 2026-10-13 | trivial | Progress log: Word's text watermark read from DOCX (#1290) | -| 2026-10-13 | trivial | Progress log: Insert Hyperlink › Place in This Document (#1234) | -| 2026-10-13 | trivial | Progress log: Insert › Bookmark deletes and goes to bookmarks (#1236) | -| 2026-10-12 | trivial | Progress log: an option to show only the selected text's comment (#1055) | -| 2026-10-12 | trivial | Progress log: clicking in a comment's text moves its caret (#1013) | | 2026-10-14 | trivial | Comment commands reject malformed explicit IDs instead of truncating floats or targeting the caret (#1690, finding 3); synthetic command, undo/redo and DOCX save/reopen coverage; readiness estimates unchanged | -| 2026-10-12 | trivial | Progress log: a press on the ribbon no longer scrolls the document (#1019) | -| 2026-10-12 | trivial | Progress log: Ctrl+drag copies an object (#1014) | -| 2026-10-12 | trivial | Document title opens Rename Document; the account badge opens Options › General for user name and initials. | | 2026-10-14 | trivial | Progress log: tables nest 24 deep at most (#1596) | -| 2026-10-13 | trivial | Progress log: rounded rectangle corners (#1476) | -| 2026-10-13 | trivial | Progress log: PAGEREF in headers and footers (#1477) | -| 2026-10-13 | trivial | Replace All checks content-control locks before editing; a refused batch leaves the document and undo history unchanged; existing deletion-lock rules reused, with tracked/untracked regression coverage | | 2026-10-14 | trivial | Progress log: print-area strings translated in every catalog | | 2026-10-14 | trivial | Progress log: All Caps and Small Caps draw ß as SS (#1581) | -| 2026-10-13 | trivial | Progress log: Windows Magnifier follows the caret onto a new line (#1119) | -| 2026-10-13 | trivial | Progress log: a window too big for its screen shrinks to fit (#1215) | | 2026-10-14 | trivial | Progress log: Page Setup sections are validated (#1582) | -| 2026-10-13 | trivial | Progress log: `--control` checks its port (#1426) | | 2026-10-14 | trivial | Progress log: words beside a floating picture are no longer split (#1376) | | 2026-10-14 | trivial | Progress log: VML preset shapes (#1377) | | 2026-10-14 | trivial | Progress log: Russian letter list labels | | 2026-10-14 | trivial | Progress log: the save prompt takes the keyboard from the page (#1597) | -| 2026-10-12 | trivial | Progress log: VML text box margins, fit and alignment; hidden drawings | -| 2026-10-13 | trivial | Progress log: comment balloon buttons work, empty comments can be deleted (#1085) | -| 2026-10-12 | trivial | Progress log: sample-text formulas on Enter (#1067) | -| 2026-10-12 | trivial | Progress log: direct run-level native InkML content parts survive DOCX edits and repeated saves | -| 2026-10-13 | trivial | Progress log: the caret contrasts with its background (#299) | -| 2026-10-13 | trivial | Progress log: clicks on ribbon chrome keep typing in the document (#1093) | -| 2026-10-13 | trivial | Progress log: dragged shapes wrap in their new column (#884) | | 2026-10-14 | trivial | Progress log: All Caps and Small Caps text extracts from PDFs as shown (#1473) | | 2026-10-14 | trivial | Progress log: the web's Save before New/Open waits for the save picker (#1315) | -| 2026-10-13 | trivial | Progress log: a failed save from the close prompt says so (#1445) | | 2026-10-14 | trivial | Progress log: Inspect Document removes hidden text in every story (#1344) | | 2026-10-14 | trivial | Progress log: ODT tracked changes (gap 19) | | 2026-10-14 | trivial | Progress log: RTF tracked insertions and deletions (gap 19) | | 2026-10-14 | trivial | Progress log: alignment guides while dragging pictures and shapes | | 2026-10-14 | trivial | Progress log: ODT sections on import (#1379) | | 2026-10-14 | trivial | Progress log: right-to-left text in exported PDFs extracts as whole words (#1383) | -| 2026-10-16 | trivial | Progress log: lam-alef drawn as two glyphs at one x extracts whole from exported PDFs (#2310) | | 2026-10-14 | trivial | Progress log: HTML header cells, cell alignment and region paper for opened HTML/Markdown/text (#1381) | | 2026-10-14 | trivial | Progress log: custom page size from More Paper Sizes… and Page Setup (#1433) | +| 2026-10-14 | trivial | Progress log: continued paragraphs wrap around the next column's shapes (#1374) | +| 2026-10-14 | trivial | Progress log: RTF import keeps sections (#1378) | +| 2026-10-14 | trivial | Progress log: colour emoji drawn on screen and in page renders (#1269) | +| 2026-10-14 | trivial | Progress log: `.doc` table shading and the extra column (#1380) | +| 2026-10-14 | trivial | Progress log: table deletes, Change Case and Unlink Fields respect Track Changes and locked content controls (#1329) | +| 2026-10-14 | trivial | Progress log: Ink to Shape recognises single-stroke arrows | +| 2026-10-14 | trivial | Progress log: Save As type list (#1399) | +| 2026-10-14 | trivial | Progress log: a picture inserted by a command survives the next typing (#965) | +| 2026-10-14 | trivial | Progress log: `.doc` notes, headers and text boxes read their text once (#1319) | +| 2026-10-14 | trivial | Progress log: ODT and `.doc` pictures read once, within their byte budget (#1334) | +| 2026-10-14 | trivial | Progress log: text boxes in deeply nested tables kept through edits (#1339) | +| 2026-10-14 | trivial | Progress log: Flat OPC reading bounded everywhere in the file, CDATA base64 read (#1353) | +| 2026-10-13 | trivial | Web/Draft long-page blur fixed with visible full-resolution raster tiles | +| 2026-10-13 | trivial | Progress log: justified vertical page alignment (#1320) | +| 2026-10-13 | trivial | Behind Text pictures and shapes drag over overlapping text in the body and headers, selected or not, while ordinary clicks keep editing text; In Front of Text drag covered too | +| 2026-10-13 | trivial | Progress log: the watermark written to DOCX (#1290) | +| 2026-10-13 | trivial | Progress log: Word's text watermark read from DOCX (#1290) | +| 2026-10-13 | trivial | Progress log: Insert Hyperlink › Place in This Document (#1234) | +| 2026-10-13 | trivial | Progress log: Insert › Bookmark deletes and goes to bookmarks (#1236) | +| 2026-10-13 | trivial | Progress log: rounded rectangle corners (#1476) | +| 2026-10-13 | trivial | Progress log: PAGEREF in headers and footers (#1477) | +| 2026-10-13 | trivial | Replace All checks content-control locks before editing; a refused batch leaves the document and undo history unchanged; existing deletion-lock rules reused, with tracked/untracked regression coverage | +| 2026-10-13 | trivial | Progress log: Windows Magnifier follows the caret onto a new line (#1119) | +| 2026-10-13 | trivial | Progress log: a window too big for its screen shrinks to fit (#1215) | +| 2026-10-13 | trivial | Progress log: `--control` checks its port (#1426) | +| 2026-10-13 | trivial | Progress log: comment balloon buttons work, empty comments can be deleted (#1085) | +| 2026-10-13 | trivial | Progress log: the caret contrasts with its background (#299) | +| 2026-10-13 | trivial | Progress log: clicks on ribbon chrome keep typing in the document (#1093) | +| 2026-10-13 | trivial | Progress log: dragged shapes wrap in their new column (#884) | +| 2026-10-13 | trivial | Progress log: a failed save from the close prompt says so (#1445) | | 2026-10-13 | trivial | Progress log: highlighted text on a dark page (#1252) | | 2026-10-13 | trivial | Progress log: full screen on F11 (#980) | | 2026-10-13 | trivial | Progress log: interface audit back in CI (#1128) | | 2026-10-13 | trivial | Progress log: double-click the margin to create and edit a header or footer (#960) | | 2026-10-13 | trivial | Progress log: Set Proofing Language… in the Language menu (#860) | -| 2026-10-12 | trivial | Progress log: list label follows paragraph alignment (#1159) | | 2026-10-13 | trivial | Progress log: space after a page break | | 2026-10-13 | trivial | Progress log: table row margins and splitting | | 2026-10-13 | trivial | Progress log: lines inside groups in PDF export (#1474) | -| 2026-10-14 | trivial | Progress log: continued paragraphs wrap around the next column's shapes (#1374) | | 2026-10-13 | trivial | Progress log: PAGE fields on the pages a paragraph runs onto (#1352) | -| 2026-10-14 | trivial | Progress log: RTF import keeps sections (#1378) | -| 2026-10-14 | trivial | Progress log: colour emoji drawn on screen and in page renders (#1269) | -| 2026-10-14 | trivial | Progress log: `.doc` table shading and the extra column (#1380) | -| 2026-10-12 | trivial | Progress log: web picture paste respects the edit target (#1349) | -| 2026-10-14 | trivial | Progress log: table deletes, Change Case and Unlink Fields respect Track Changes and locked content controls (#1329) | -| 2026-10-14 | trivial | Progress log: Ink to Shape recognises single-stroke arrows | | 2026-10-13 | trivial | Progress log: Styles gallery fallback for DOCX files without qFormat (#1238) | | 2026-10-13 | trivial | Progress log: crop handles on the canvas | | 2026-10-13 | trivial | Progress log: cell size boxes act on the whole selection (#1242) | +| 2026-10-13 | trivial | Progress log: equation pictures keep the theme colours on Windows (#1002) | +| 2026-10-13 | trivial | Progress log: no document behind the Start screen (#1129) | +| 2026-10-13 | trivial | Progress log: an empty .docx opens and saves back to itself (#1384) | +| 2026-10-13 | trivial | Progress log: the Paragraph dialog leaves mixed formatting alone (#1346) | +| 2026-10-13 | trivial | Progress log: Word 365 cover pages, positions and closed freeforms (#743) | +| 2026-10-13 | trivial | Progress log: every distinct format in a paragraph keeps its own layout style (#1340) | +| 2026-10-13 | trivial | Progress log: free part, list and comment ids after a file's largest ones (#1338) | +| 2026-10-13 | trivial | Progress log: Markdown backtick runs read in linear time (#1336) | +| 2026-10-13 | trivial | Progress log: Markdown brackets no longer turn later links into text (#1452) | +| 2026-10-13 | trivial | Swedish interface (`sv`): progress log and shipped languages | +| 2026-10-13 | trivial | Croatian interface (`hr`): progress log and shipped languages | +| 2026-10-12 | minor | Czech proofing review: short-word splits rank after deletion, NOSUGGEST excludes suggestions while accepting typed forms, affix comments apply only to headers, ratios keep spaces and repeated-word messages use Czech quotes; synthetic engine end-to-end and latency checks | +| 2026-10-12 | minor | Czech spelling from the installed Hunspell dictionary, runtime-table suggestions and generic checks; Czech interface writes cs-CZ documents; no Czech hyphenation patterns bundled; estimates unchanged | +| 2026-10-12 | trivial | Progress log: one selected cell's border drags in its row only (#962) | +| 2026-10-12 | minor | Progress log: Word default shortcuts expanded to 140 commands on macOS (169 combinations) and 158 on Linux/Windows (188 combinations), addressing gap #24 | +| 2026-10-12 | trivial | Progress log: an option to show only the selected text's comment (#1055) | +| 2026-10-12 | trivial | Progress log: clicking in a comment's text moves its caret (#1013) | +| 2026-10-12 | trivial | Progress log: a press on the ribbon no longer scrolls the document (#1019) | +| 2026-10-12 | trivial | Progress log: Ctrl+drag copies an object (#1014) | +| 2026-10-12 | trivial | Document title opens Rename Document; the account badge opens Options › General for user name and initials. | +| 2026-10-12 | trivial | Progress log: VML text box margins, fit and alignment; hidden drawings | +| 2026-10-12 | trivial | Progress log: sample-text formulas on Enter (#1067) | +| 2026-10-12 | trivial | Progress log: direct run-level native InkML content parts survive DOCX edits and repeated saves | +| 2026-10-12 | trivial | Progress log: list label follows paragraph alignment (#1159) | +| 2026-10-12 | trivial | Progress log: web picture paste respects the edit target (#1349) | | 2026-10-12 | trivial | Progress log: Accept All and Reject All keep the right paragraph marks (#864) | | 2026-10-12 | trivial | Progress log: `--help` for the app and every CLI subcommand (#968) | | 2026-10-12 | trivial | Progress log: Down and Up no longer skip a table (#1007) | -| 2026-10-13 | trivial | Progress log: equation pictures keep the theme colours on Windows (#1002) | | 2026-10-12 | trivial | Progress log: table style editor (#714) | -| 2026-10-11 | trivial | Progress log: Ctrl, Alt, left-edge and selected-cells table border drags (#711) | -| 2026-10-11 | trivial | Progress log: table markers on the rulers (#700) | -| 2026-10-11 | trivial | Progress log: the table context menu | | 2026-10-12 | trivial | Progress log: AutoFit in a nested table, whole cells shaded for a selection through a table, Shift+Right at a cell's end (#971) | -| 2026-10-11 | trivial | Progress log: drags and Shift+arrows over table cells select whole cells | -| 2026-10-11 | trivial | Progress log: table selection areas, insert buttons, move handle and double-click AutoFit; catalog 484/499 | | 2026-10-12 | trivial | Progress log: Undo history list (#701) | -| 2026-10-14 | trivial | Progress log: Save As type list (#1399) | | 2026-10-12 | trivial | Progress log: Start screen at launch (#766) | -| 2026-10-13 | trivial | Progress log: no document behind the Start screen (#1129) | | 2026-10-12 | trivial | Progress log: Alt+Q command search (#819); log table header fixed | | 2026-10-12 | trivial | Progress log: ribbon groups fit above their labels | | 2026-10-12 | trivial | Font list previews no longer grow memory (#848) | | 2026-10-12 | trivial | Progress log: section break keeps the selected text (#852) | | 2026-10-12 | trivial | Progress log: save prompt from the keyboard (#861) | -| 2026-10-13 | trivial | Progress log: an empty .docx opens and saves back to itself (#1384) | | 2026-10-12 | trivial | Progress log: craft-fonts Simplified Chinese in documents | | 2026-10-12 | trivial | Progress log: symbol-font text drawn as Unicode symbols (#776) | -| 2026-10-13 | trivial | Progress log: the Paragraph dialog leaves mixed formatting alone (#1346) | | 2026-10-12 | trivial | Progress log: WMF and EMF pictures can be inserted (#802) | -| 2026-10-14 | trivial | Progress log: a picture inserted by a command survives the next typing (#965) | -| 2026-10-11 | trivial | Progress log and shipped languages: Turkish interface completed, 2,325 entries (#774) | | 2026-10-12 | trivial | Progress log: Navigation heading truncation (#759) | -| 2026-10-11 | trivial | Progress log: Reading Mode implementation | | 2026-10-12 | trivial | Progress log: new documents follow the system region (#838) | +| 2026-10-12 | trivial | Progress log: AutoCorrect replacement list follows the text's language (#835) | +| 2026-10-12 | trivial | Progress log: language-aware sorting and table numbers (#836, #837) | +| 2026-10-12 | trivial | Progress log: Word 365 cover pages (#743) | +| 2026-10-12 | trivial | Progress log: large-table scrolling (#811) | +| 2026-10-12 | minor | Desktop File > Print now discovers printers and submits PDF jobs through pinned craft-print with printer choice, copies, collation, duplex and grayscale; the upstream preview, ranges, parity and Print Markup remain available, along with browser printing and PDF export. Remaining print parity includes driver-specific tray/options and pages-per-sheet UI; physical printer fidelity needs hardware validation. | +| 2026-10-12 | trivial | Progress log: selection bar in the left margin (#856) | +| 2026-10-12 | minor | Progress log: opaque custom XML store preservation, with synthetic package regressions and explicit limits | +| 2026-10-12 | minor | Preserve imported TOC ranges and retain #538 refresh/undo/save coverage on current main; readiness unchanged | +| 2026-10-12 | trivial | Native saves protect existing temporary-name entries and originals on pre-replacement failure; synthetic macOS evidence, explicit durability/platform limits; readiness unchanged | +| 2026-10-12 | trivial | Bulgarian interface (`bg`): progress log and shipped languages | +| 2026-10-12 | minor | Native drawing-level ink and its picture fallback survive DOCX edits and repeated saves; adapted to the current graphic writer; rendering and editing InkML remain missing | +| 2026-10-12 | minor | List-label automatic/AtLeast line-height inflation corrected; gap #4 remains open and readiness unchanged | +| 2026-10-12 | minor | Local desktop recovery: unsaved drafts and edits are snapshotted in the profile; File › Recover restores an unsaved copy or confirms discard. Full model storage includes media and opaque parts. Password sessions skip plaintext snapshots. See [recovery.md](docs/recovery.md); stability estimates remain unchanged. | +| 2026-10-12 | trivial | Legacy table paragraph spacing preserved; modes 11/12/14 versus 15 checked with original synthetic documents | +| 2026-10-12 | trivial | Progress log: recipient filter and sort, .xls and legacy-encoding recipient lists (#778) | +| 2026-10-11 | trivial | Progress log: Ctrl, Alt, left-edge and selected-cells table border drags (#711) | +| 2026-10-11 | trivial | Progress log: table markers on the rulers (#700) | +| 2026-10-11 | trivial | Progress log: the table context menu | +| 2026-10-11 | trivial | Progress log: drags and Shift+arrows over table cells select whole cells | +| 2026-10-11 | trivial | Progress log: table selection areas, insert buttons, move handle and double-click AutoFit; catalog 484/499 | +| 2026-10-11 | trivial | Progress log and shipped languages: Turkish interface completed, 2,325 entries (#774) | +| 2026-10-11 | trivial | Progress log: Reading Mode implementation | | 2026-10-11 | trivial | DOCX complex-script formatting inheritance fix and round-trip coverage | | 2026-10-11 | minor | Czech (`cs`) interface catalog added | -| 2026-10-12 | trivial | Progress log: AutoCorrect replacement list follows the text's language (#835) | | 2026-10-11 | trivial | Progress log: German interface (#574) | -| 2026-10-12 | trivial | Progress log: language-aware sorting and table numbers (#836, #837) | -| 2026-10-13 | trivial | Progress log: Word 365 cover pages, positions and closed freeforms (#743) | -| 2026-10-12 | trivial | Progress log: Word 365 cover pages (#743) | | 2026-10-11 | trivial | Progress log: tables resize with the mouse (#217) | | 2026-10-11 | trivial | Progress log: Animation effects setting | | 2026-10-11 | trivial | Progress log: built-in file browser when the system file dialog is unavailable (#576) | -| 2026-10-12 | trivial | Progress log: large-table scrolling (#811) | | 2026-10-11 | trivial | Progress log: security review fixes (temp files, exported link schemes) | -| 2026-10-13 | trivial | Progress log: every distinct format in a paragraph keeps its own layout style (#1340) | | 2026-10-11 | trivial | Progress log: Find and Replace special characters and wildcards (#543) | -| 2026-10-12 | minor | Desktop File > Print now discovers printers and submits PDF jobs through pinned craft-print with printer choice, copies, collation, duplex and grayscale; the upstream preview, ranges, parity and Print Markup remain available, along with browser printing and PDF export. Remaining print parity includes driver-specific tray/options and pages-per-sheet UI; physical printer fidelity needs hardware validation. | | 2026-10-11 | trivial | Progress log: Windows DX12 shaders compiled with FXC (#603) | | 2026-10-11 | trivial | Progress log: Insert › SmartArt (#497); catalog 429/451 → 437/458 (95.4%) | | 2026-10-11 | trivial | Progress log: Outline view (#493) | @@ -1406,51 +1514,33 @@ MATH glyphs that reference the same construction now share its immutable variant | 2026-10-11 | trivial | Progress log: complex-script shaping (#604) | | 2026-10-11 | trivial | Progress log: unknown text extensions open as text (#569) | | 2026-10-11 | trivial | Progress log: drag-select by words/paragraphs/sentences (#549) | -| 2026-10-12 | trivial | Progress log: selection bar in the left margin (#856) | | 2026-10-11 | trivial | Progress log: content controls (#381) | | 2026-10-11 | trivial | Progress log: Insert › Chart (#409); catalog 408/439 (92.9%) | -| 2026-10-13 | trivial | Progress log: free part, list and comment ids after a file's largest ones (#1338) | | 2026-10-11 | trivial | Progress log: Line Numbers, Hyphenation, Language, Envelopes and Labels dialogs (#407) | | 2026-10-11 | trivial | Progress log: Alt Text pane, decorative objects, deeper accessibility checker (#386) | | 2026-10-11 | trivial | Progress log: Draw lasso, Add Pen, Ink to Shape, Ink Replay (#395); catalog 406/434 | | 2026-10-11 | trivial | Progress log: document grid (#391) | | 2026-10-11 | trivial | Progress log: text direction, Align Text and linked text boxes (#369) | -| 2026-10-10 | trivial | Progress: Drawing Canvas (#344): insert, shapes/pictures/text boxes inside, Fit/Expand/Scale, DOCX `wpc:wpc`, turns and flips as a whole; catalog 404/434 | | 2026-10-11 | trivial | Quick Access Toolbar KeyTips and persisted enable/disable setting (#620) | | 2026-10-11 | trivial | Progress log: mail-merge recipients from .xlsx/.xlsm/.ods (#334) | | 2026-10-11 | trivial | Insert › Icons landed (#309): catalog 402/434 → 403/434 (92.9%) | -| 2026-10-13 | trivial | Progress log: Markdown backtick runs read in linear time (#1336) | -| 2026-10-13 | trivial | Progress log: Markdown brackets no longer turn later links into text (#1452) | | 2026-10-11 | trivial | Enclose Characters (#297): catalog 403/434 (92.9%) | -| 2026-10-12 | minor | Progress log: opaque custom XML store preservation, with synthetic package regressions and explicit limits | -| 2026-10-12 | minor | Preserve imported TOC ranges and retain #538 refresh/undo/save coverage on current main; readiness unchanged | | 2026-10-11 | trivial | Progress log: Customize Ribbon and the Quick Access Toolbar (#379) | | 2026-10-11 | trivial | Omitted `w:pPrDefault` stays omitted across saves; explicit empty/default properties and later spacing edits remain writable. Synthetic preservation checks only; readiness estimates unchanged | | 2026-10-11 | trivial | Progress log: Customize Keyboard (#368) | -| 2026-10-12 | trivial | Native saves protect existing temporary-name entries and originals on pre-replacement failure; synthetic macOS evidence, explicit durability/platform limits; readiness unchanged | | 2026-10-11 | trivial | Word's common keyboard shortcuts (#330): 125 of ~250 | | 2026-10-11 | trivial | Collapsed duplicate rows left by parallel merges | -| 2026-10-13 | trivial | Swedish interface (`sv`): progress log and shipped languages | -| 2026-10-12 | trivial | Bulgarian interface (`bg`): progress log and shipped languages | -| 2026-10-13 | trivial | Croatian interface (`hr`): progress log and shipped languages | | 2026-10-11 | trivial | Hungarian interface (`hu`): progress log and shipped languages | | 2026-10-11 | trivial | Turkish interface (`tr`): progress log and shipped languages | -| 2026-10-14 | trivial | Progress log: `.doc` notes, headers and text boxes read their text once (#1319) | -| 2026-10-12 | minor | Native drawing-level ink and its picture fallback survive DOCX edits and repeated saves; adapted to the current graphic writer; rendering and editing InkML remain missing | -| 2026-10-12 | minor | List-label automatic/AtLeast line-height inflation corrected; gap #4 remains open and readiness unchanged | -| 2026-10-12 | minor | Local desktop recovery: unsaved drafts and edits are snapshotted in the profile; File › Recover restores an unsaved copy or confirms discard. Full model storage includes media and opaque parts. Password sessions skip plaintext snapshots. See [recovery.md](docs/recovery.md); stability estimates remain unchanged. | -| 2026-10-12 | trivial | Legacy table paragraph spacing preserved; modes 11/12/14 versus 15 checked with original synthetic documents | | 2026-10-11 | minor | Progress log: contextual paragraph spacing in body paragraphs and headers | | 2026-10-11 | trivial | Progress log: eight more bibliography styles (#383) | -| 2026-10-14 | trivial | Progress log: ODT and `.doc` pictures read once, within their byte budget (#1334) | +| 2026-10-10 | trivial | Progress: Drawing Canvas (#344): insert, shapes/pictures/text boxes inside, Fit/Expand/Scale, DOCX `wpc:wpc`, turns and flips as a whole; catalog 404/434 | | 2026-10-10 | trivial | Progress log: Draw tab ink (#307) | | 2026-10-10 | trivial | Draw Table and Eraser (#303): catalog 393/431 (91.2%) | | 2026-10-10 | trivial | Progress log: charts, SmartArt and OLE objects kept on DOCX save (#319) | | 2026-10-10 | trivial | Progress log: contour wrap (#354) | -| 2026-10-14 | trivial | Progress log: text boxes in deeply nested tables kept through edits (#1339) | | 2026-10-10 | trivial | Progress log: free rotation and flips (#332) | | 2026-10-10 | trivial | Progress log: Windows OpenGL fallback without a DirectX 12 driver (#316) | -| 2026-10-14 | trivial | Progress log: Flat OPC reading bounded everywhere in the file, CDATA base64 read (#1353) | | 2026-10-10 | minor | Password-protected .docx (#281): files encrypted with a password (agile encryption) open and save; File › Info › Encrypt with Password | | 2026-10-10 | minor | Relanded clipboard pane, table styles editor, Manage Styles, Asian typography (kinsoku), Group/Ungroup and Shape Effects (#264 #263 #270 #271 #267 #280): catalog 390/431 (90.5%) | | 2026-10-10 | minor | Polish interface and proofing landed: Localization 25% → 27%, Proofing 35% → 40% | @@ -1461,42 +1551,14 @@ MATH glyphs that reference the same construction now share its immutable variant | 2026-10-10 | major | Full re-measure; progress docs restructured (stage banner, two numbers, dimensions, languages, upcoming, progress log); parity tables moved to `docs/target-app-parity.md`, milestones to `docs/roadmap.md` | | 2026-10-09 | minor | Recently landed: RTL, Ukrainian and Brazilian Portuguese | | 2026-10-06 | major | First honest estimate: 88% catalog, ~62% real parity, alpha ~85% of the way | -| 2026-10-12 | trivial | Progress log: recipient filter and sort, .xls and legacy-encoding recipient lists (#778) | -| 2026-10-15 | trivial | Charts: radar charts (standard, marker, filled) are drawn instead of a placeholder (#1890) | -| 2026-10-15 | trivial | Progress log: dialog close box (#1885) | -| 2026-10-15 | trivial | Progress log: mixed Hebrew/Latin text keeps its order in Word (#1543) | -| 2026-10-15 | trivial | Progress log: ruler numbers by zoom, rulers follow the caret's page (#1878) | -| 2026-10-17 | trivial | Progress log: saving into a folder that refuses a temporary file (#2138) | -| 2026-10-19 | trivial | Progress log: personal templates in File › New, Save as Word Template (#2852) | -| 2026-10-20 | trivial | Progress log: saving to a NAS share mounted by GVFS (#3003) | -| 2026-10-23 | trivial | Progress log: justified lines ending in a manual line break reach the margin (#3924) | -| 2026-10-23 | trivial | Progress log: "NaN" in the Font dialog's Size box no longer closes the app (#3663) | -| 2026-10-23 | trivial | Progress log: a table cell span from a `.json` file no longer overflows (#3637) | -| 2026-10-28 | trivial | Progress log: chart and SmartArt text the font lacks is drawn in a fallback face (#4720) | -| 2026-11-02 | trivial | Progress log: ODT controls, custom shapes, in-line placement (gap 19) | -| 2026-11-02 | trivial | Progress log: ODT charts kept, frame outlines, header height (gap 19) | -| 2026-11-02 | trivial | Progress log: ODT header rows (gap 19) | -| 2026-11-02 | trivial | Progress log: ODT layout setting, padding, columns (gap 19) | -| 2026-11-02 | trivial | Progress log: ODT tables, header spacing, picture paragraphs (gap 19) | -| 2026-11-02 | trivial | Progress log: ODT round trips keep their page count (gap 19) | -| 2026-11-02 | trivial | Progress log: emphasis marks, SET fields, ODT page backgrounds and tables (gap 19) | -| 2026-11-02 | trivial | Progress log: ODT checked against LibreOffice's templates (gap 19) | -| 2026-11-01 | trivial | Progress log: ODT at ~90% (gap 19) | -| 2026-10-29 | trivial | Progress log: corporate authors in bibliographies (#4848) | -| 2026-10-29 | trivial | Progress log: Table Properties follows the selection (#4857) | -| 2026-11-01 | trivial | Progress log: a list inside a Markdown block quote stays quoted | -| 2026-10-29 | trivial | Progress log: citation source and bibliography-number lookups (#4888) | -| 2026-10-27 | trivial | Progress log: AutoCorrect Options with no document open (#4585) | -| 2026-10-28 | trivial | Progress log: RTF metafile pictures are imported (#4259) | -| 2026-10-28 | trivial | Progress log: Chinese and Japanese text counts a word per character (#4547) | -| 2026-10-31 | trivial | Progress log: Field dialog capitalization Format list for text fields | -| 2026-10-27 | trivial | 2026-10-27 · #4533 review: numeric REF updates lazily index body bookmarks once per update, retaining the first body bookmark for duplicate names. Unsupported switches and ordinary REF/PAGEREF behavior are unchanged; a synthetic 64-reference regression covers repeated updates and duplicate names. Estimates unchanged. | -| 2026-10-27 | trivial | 2026-10-27 · #4533: numeric REF fields use paragraph list numbers for no/full/relative context, reusing bounded numbering. Shared context already embedded in a level label is removed; merged-away cells do not count. Unsupported separator/text/position switches and ambiguous contexts or delimiter-free joins retain cached results. Synthetic OOXML regressions; no native Word or real-document validation, estimates unchanged. | -> 2026-10-29 · Port #3915 to split layout modules: ordinary LTR tab groups follow paragraph alignment. Positional tabs, lists, RTL and display math retain their alignment paths. Source port only; no test execution or new native measurements. +| 2026-11-07 | trivial | Progress log: a justified line with a tab shrinks the spaces after it (#5847) | +> 2026-10-27 · Technical synchronization: existing Proofing pane hooks and regression tests follow the extracted engine/UI modules on main `436d444`; compact context menus remain upstream. New-SHA validation is pending; readiness unchanged. -> 2026-10-29 · Port #2437 to split layout modules: finite border extents and terminal-break keep preflight. Recursive keep lookahead remains outside scope. Source port only; no test execution or new native measurements. -| 2026-11-03 | trivial | Progress log: a line breaks after a hyphen before a slash (#3408) | +> 2026-10-23 · cu20we review follow-up: Only paragraph-relative box floats use the pre-spacing origin. Line-relative floats and page/margin fallbacks in cells and text boxes keep the text-top origin. Synthetic controls compare zero and 24 pt space-before across all four box contexts. New cap conversion helpers and regression tests document their contracts; readiness estimates unchanged. | 2026-11-12 | minor | Progress log: layout.fitOnePage condenses a multi-page document by one page while preserving typography hierarchy (#6433) | +| 2026-11-03 | trivial | Progress log: a line breaks after a hyphen before a slash (#3408) | +| 2026-10-19 | trivial | Progress log: Latin text in right-to-left lines keeps its order (#2150) | +| 2026-10-30 | trivial | Progress log: Left and Right step into an equation next to the caret (#4138); readiness estimates unchanged | ### Format Painter integration refresh, 2026-10-30 diff --git a/apps/wordcraft-cli/Cargo.toml b/apps/wordcraft-cli/Cargo.toml index 97f09c738d..95a039f9bd 100644 --- a/apps/wordcraft-cli/Cargo.toml +++ b/apps/wordcraft-cli/Cargo.toml @@ -19,6 +19,7 @@ wordcraft-engine = { workspace = true } wordcraft-render = { workspace = true } wordcraft-mcp = { workspace = true } wordcraft-zotero = { workspace = true } +wordcraft-validate = { workspace = true } serde_json = { workspace = true } sys-locale = "0.3" diff --git a/apps/wordcraft-cli/src/main.rs b/apps/wordcraft-cli/src/main.rs index 944a66a64a..436fccb924 100644 --- a/apps/wordcraft-cli/src/main.rs +++ b/apps/wordcraft-cli/src/main.rs @@ -36,9 +36,11 @@ USAGE: page can't be drawn or a picture is missing or undecodable (report on stderr, as for convert --strict) wordcraft-cli run [--file F | --template T] [--script FILE|-] [--cmd 'id={json}' …] - [--save OUT] [--page N] [--scale S] [--print] [--author NAME] + [--save OUT …] [--page N] [--scale S] [--print] [--author NAME] run commands headlessly, then save (--author names who tracked changes and comments are by). + Repeat --save OUT to write multiple outputs in order, + after any outputs from --script. PNG saves use --page (1-based, default 1) and --scale (default 2). --script runs a JSON file (- is stdin) first: {\"file\"?, \"template\"?, \"commands\": [{\"command\": id, @@ -51,6 +53,7 @@ USAGE: documents and with {\"id\": N} makes one active wordcraft-cli commands [--json] list every command wordcraft-cli parity [--markdown] feature-catalog parity + wordcraft-cli validate [--json] structural integrity check (exit 0 pass, 1 fail, 2 incomplete, 3 usage/IO) wordcraft-cli mcp --automation-read-root DIR --automation-write-root DIR [--author NAME] MCP server on stdio, with a headless session. Both roots are required: the agent's commands read @@ -81,7 +84,7 @@ same output on every machine. "; /// The subcommands, in `USAGE` order; `--help` or `-h` after any of them prints `USAGE` (#968). -const SUBCOMMANDS: &[&str] = &["convert", "info", "text", "inspect", "render", "run", "commands", "parity", "mcp", "zotero"]; +const SUBCOMMANDS: &[&str] = &["convert", "info", "text", "inspect", "render", "run", "commands", "parity", "validate", "mcp", "zotero"]; fn wants_help(cmd: &str, rest: &[String]) -> bool { SUBCOMMANDS.contains(&cmd) && rest.iter().any(|a| a == "--help" || a == "-h") @@ -118,7 +121,7 @@ fn open(path: &Path, password: Option<&str>) -> Result { /// The commands that open a file, and which positional argument it is, excluding option values. /// `run` opens the value of `--file`. -const OPENS_FILE: &[(&str, usize)] = &[("convert", 0), ("info", 0), ("text", 0), ("inspect", 0), ("render", 0), ("zotero", 1)]; +const OPENS_FILE: &[(&str, usize)] = &[("convert", 0), ("info", 0), ("text", 0), ("inspect", 0), ("render", 0), ("validate", 0), ("zotero", 1)]; /// The arguments as text. Only the file the command opens may have a name that isn't valid Unicode, /// such as a Latin-1 one (#1440): it comes back as the path to open, and lossy among the arguments. @@ -367,6 +370,8 @@ const RUN_OPTIONS: &[OptionSpec] = &[ ]; const COMMANDS_OPTIONS: &[OptionSpec] = &[OptionSpec { name: "--json", takes_value: false }]; const PARITY_OPTIONS: &[OptionSpec] = &[OptionSpec { name: "--markdown", takes_value: false }]; +const VALIDATE_OPTIONS: &[OptionSpec] = &[OptionSpec { name: "--json", takes_value: false }]; + /// Why `mcp` won't start unconfined (shared rule 18, #7124). const MCP_NEEDS_ROOTS: &str = "mcp: give both --automation-read-root DIR and --automation-write-root DIR: an agent's \ commands may read only inside the read root and write only inside the write root (the same folder may be both)"; @@ -391,8 +396,10 @@ enum Failure { /// A real error, reported on stderr with a failing exit status. Error(String), /// Whoever read stdout closed it (`wordcraft-cli commands --json | head`): there is nobody left - /// to write to, so stop quietly and exit 0 like other command-line tools. + /// to write to. Most commands exit 0; validation retains its verdict status. StdoutClosed, + /// The subcommand has already written its output and decided its own exit status (`validate`). + Status(u8), /// `convert --strict` refused: the text for stderr (the report's lines, then its JSON line). /// Exit status 3. Strict(String), @@ -403,6 +410,7 @@ impl fmt::Display for Failure { match self { Failure::Error(e) => f.write_str(e), Failure::StdoutClosed => f.write_str("stdout closed"), + Failure::Status(code) => write!(f, "exit {code}"), Failure::Strict(report) => f.write_str(report), } } @@ -626,6 +634,13 @@ fn run>(args: &[S]) -> Result<(), Failure> { } } validate_options("run", &rest, RUN_OPTIONS)?; + let mut cli_outputs = Vec::new(); + for (i, arg) in rest.iter().enumerate() { + if arg == "--save" { + let path = rest.get(i + 1).filter(|value| !value.is_empty() && !value.starts_with("--")).ok_or("run: --save requires a path")?; + cli_outputs.push(path.clone()); + } + } let page = parse_page_arg("run", &rest)?; let scale = parse_scale_arg("run", &rest)?; let password = password_from(&rest)?; @@ -674,7 +689,7 @@ fn run>(args: &[S]) -> Result<(), Failure> { i += 1; } } - let outputs: Vec = script.iter().flat_map(|c| c.save.iter().cloned()).chain(arg_value(&rest, "--save")).collect(); + let outputs: Vec = script.iter().flat_map(|c| c.save.iter().cloned()).chain(cli_outputs).collect(); // Check every output can be made before writing any, so a bad one leaves no half-done job. for out in &outputs { let parent = Path::new(out).parent().filter(|p| !p.as_os_str().is_empty()); @@ -717,7 +732,7 @@ fn run>(args: &[S]) -> Result<(), Failure> { for c in s.registry.all() { writeln!(o, "{:<32} {:<36} {:<24} {}", c.id, c.label, c.shortcut, c.location)?; } - Ok(()) + writeln!(o, "{:<32} Structural integrity check", "validate") }) } } @@ -731,6 +746,7 @@ fn run>(args: &[S]) -> Result<(), Failure> { write_stdout(|o| writeln!(o, "{}", serde_json::to_string_pretty(&p).unwrap_or_default())) } } + "validate" => run_validate(file.as_deref(), &rest), "mcp" => { let (roots, rest) = automation_roots("mcp", &rest)?; // Refused with or without a value, before the option check, so `--connect=…` gets this refusal rather than @@ -882,6 +898,17 @@ fn parity_markdown(p: &Value) -> String { for t in p["tabs"].as_array().cloned().unwrap_or_default() { s += &format!("| {} | {} | {} |\n", t["tab"].as_str().unwrap_or(""), t["live"], t["total"]); } + let h = &p["headless"]; + s += &format!( + "\n**Headless ([RFC-0052](https://github.com/storytold/craft-contrib/blob/main/rfcs/0052-headless-reach.md)): {} yes, {} no (window {}, os {}, engine-gap {}), {} partial, {} unknown.** A feature is `headless: yes` when its command is in the engine registry that `wordcraft-cli` and the MCP server load, so every live feature above is `yes`; the missing ones carry the hand mark from `HEADLESS` in `crates/engine/src/catalog.rs`, or `unknown`.\n", + h["yes"], + h["no"]["window"].as_u64().unwrap_or(0) + h["no"]["os"].as_u64().unwrap_or(0) + h["no"]["engine-gap"].as_u64().unwrap_or(0), + h["no"]["window"], + h["no"]["os"], + h["no"]["engine-gap"], + h["partial"], + h["unknown"] + ); s += "\n## Missing\n\n"; for t in p["tabs"].as_array().cloned().unwrap_or_default() { let m = t["missing"].as_array().cloned().unwrap_or_default(); @@ -897,8 +924,145 @@ fn parity_markdown(p: &Value) -> String { s } +/// `validate`: exactly one positional path (batch mode does not exist yet, so a surplus operand is +/// a usage error rather than a silently ignored second file). `file` is the preserved operand, so a +/// file name that is not valid Unicode still reaches the validator. +fn run_validate(file: Option<&Path>, rest: &[String]) -> Result<(), Failure> { + if let Err(e) = validate_options("validate", rest, VALIDATE_OPTIONS) { + eprintln!("wordcraft-cli: {e}"); + return Err(Failure::Status(3)); + } + let paths = positionals(rest, VALIDATE_OPTIONS); + if paths.len() != 1 { + eprintln!("wordcraft-cli: validate takes exactly one file\n\n{USAGE}"); + return Err(Failure::Status(3)); + } + let path = file.unwrap_or_else(|| Path::new(paths[0])); + let report = match wordcraft_validate::validate_path(path) { + Ok(report) => report, + Err(e) => { + eprintln!("wordcraft-cli: {}: {e}", path.display()); + return Err(Failure::Status(3)); + } + }; + let written = if rest.iter().any(|a| a == "--json") { + let json = serde_json::to_string_pretty(&report).unwrap_or_default(); + write_stdout(|o| writeln!(o, "{json}")) + } else { + write_stdout(|o| write_validate_report(o, &report)) + }; + match written { + // A reader closing early must not turn a FAIL or INCOMPLETE verdict into PASS. + Ok(()) | Err(Failure::StdoutClosed) => {} + Err(error) => { + eprintln!("wordcraft-cli: {error}"); + return Err(Failure::Status(3)); + } + } + match report.verdict { + wordcraft_validate::Verdict::Pass => Ok(()), + wordcraft_validate::Verdict::Fail => Err(Failure::Status(1)), + wordcraft_validate::Verdict::Incomplete => Err(Failure::Status(2)), + } +} + +/// Write a `validate` report for people: the verdict, then one line per finding +/// (`SEVERITY RULE [part] message`), then the coverage notes. +fn write_validate_report(o: &mut std::io::StdoutLock<'static>, report: &wordcraft_validate::Report) -> std::io::Result<()> { + o.write_all(render_validate_report(report).as_bytes()) +} + +/// Render a `validate` report for people. Document-controlled text — a ZIP entry name flowing into +/// a finding part or coverage note — is escaped so a name cannot end its line or drive the +/// terminal; printable text, including Unicode, is left as written. +/// +/// The `--json` form is not escaped by hand; it is the validator's own `serde_json` serialization. +/// `serde_json` escapes `U+0000`–`U+001F`, `"` and `\`; C1 controls such as `U+009B` and the bidi +/// embeddings/overrides (`U+202A`–`U+202E`, `U+2066`–`U+2069`) are emitted raw. So a control or bidi +/// run carried by a ZIP entry name survives into the JSON text; JSON is only safe because a +/// *parser* takes the string value as data. If that text is printed directly to a terminal, the raw +/// C1/bidi run reaches the terminal exactly as it would from any other text, so the JSON form is +/// not a terminal-safe rendering. Only the human report below escapes those characters, and it does +/// so to defend the terminal; keeping the JSON byte-for-byte the validator's own serialization is +/// why its escaping is left to `serde_json`. +fn render_validate_report(report: &wordcraft_validate::Report) -> String { + let mut out = format!("{}\n", verdict_label(report.verdict)); + for f in &report.findings { + let severity = severity_label(f.severity); + match &f.part { + Some(part) => out.push_str(&format!("{severity} {} [{}] {}\n", f.rule, escape_report_text(part), escape_report_text(&f.message))), + None => out.push_str(&format!("{severity} {} {}\n", f.rule, escape_report_text(&f.message))), + } + } + for note in &report.coverage_notes { + out.push_str(&format!("note: {}\n", escape_report_text(note))); + } + out +} + +/// Escape the control and invisible-formatting characters that could spoof a report line, in the +/// same escape *form* `escape_debug` uses (`\u{1b}`, `\n`); printable characters (including Unicode) +/// are left untouched. The *selection* is a hand-picked set ([`is_invisible_format`] plus +/// `char::is_control`), not `escape_debug`'s full non-printable set: it omits, for example, the +/// U+E0000 tag block, U+FFF9–U+FFFB and the Hangul fillers. None of those can end a line or drive a +/// terminal, which is the threat this guards against. Backslash is not escaped, so a name that +/// literally contains the text `\u{1b}` prints exactly like an escaped ESC and the output is not +/// injective. +fn escape_report_text(s: &str) -> String { + let mut out = String::with_capacity(s.len()); + for c in s.chars() { + if c.is_control() || is_invisible_format(c) { + out.extend(c.escape_debug()); + } else { + out.push(c); + } + } + out +} + +/// Invisible Unicode formatting characters and line/paragraph separators: no glyph, but they can +/// alter how a terminal renders the rest of the line (`char::is_control` covers C0/C1 controls). +fn is_invisible_format(c: char) -> bool { + matches!( + c, + '\u{00ad}' | '\u{061c}' | '\u{180e}' | '\u{200b}'..='\u{200f}' | '\u{2028}'..='\u{202e}' | '\u{2060}'..='\u{206f}' | '\u{feff}' + ) +} + +/// Map a validation verdict enum to its human-readable uppercase display label. +fn verdict_label(v: wordcraft_validate::Verdict) -> &'static str { + match v { + wordcraft_validate::Verdict::Pass => "PASS", + wordcraft_validate::Verdict::Fail => "FAIL", + wordcraft_validate::Verdict::Incomplete => "INCOMPLETE", + } +} + +/// Map a validation severity enum to its human-readable uppercase display label. +fn severity_label(s: wordcraft_validate::Severity) -> &'static str { + match s { + wordcraft_validate::Severity::Corrupt => "CORRUPT", + wordcraft_validate::Severity::Error => "ERROR", + wordcraft_validate::Severity::Warning => "WARNING", + } +} + +/// The Launcher's Nightly bootstrap belongs to the desktop app: a CLI must not accept it, in the +/// separate-token or `=` form, so a mis-routed launch fails loudly instead of editing stable data. +fn launcher_profile_flag(args: &[OsString]) -> bool { + args.iter().any(|arg| { + let arg = arg.to_string_lossy(); + arg == "--launch-profile" || arg == "--profile-root" || arg.starts_with("--launch-profile=") || arg.starts_with("--profile-root=") + }) +} + fn main() -> ExitCode { + wordcraft_engine::malloc_tuning::apply(); let args: Vec = std::env::args_os().skip(1).collect(); + if launcher_profile_flag(&args) { + eprintln!("wordcraft-cli: --launch-profile and --profile-root are the desktop app's Nightly bootstrap, not a CLI option"); + return ExitCode::from(2); + } // Language packs installed in the suite's font store are used; `proof.installPack` installs // only while the person has turned downloading on in the app. wordcraft_engine::packs::use_font_store(false); @@ -907,6 +1071,7 @@ fn main() -> ExitCode { } match run(&args) { Ok(()) | Err(Failure::StdoutClosed) => ExitCode::SUCCESS, + Err(Failure::Status(code)) => ExitCode::from(code), Err(Failure::Error(e)) => { eprintln!("wordcraft-cli: {e}"); ExitCode::FAILURE diff --git a/apps/wordcraft-cli/src/tests.rs b/apps/wordcraft-cli/src/tests.rs index 110f3ad223..def150bec6 100644 --- a/apps/wordcraft-cli/src/tests.rs +++ b/apps/wordcraft-cli/src/tests.rs @@ -1,6 +1,23 @@ use super::*; use std::io::Read; +/// The desktop app's Nightly bootstrap is never a CLI option, in either spelling. +#[test] +fn the_launcher_profile_bootstrap_is_refused_in_both_forms() { + for argv in [ + &["--launch-profile", "nightly-v1", "--profile-root", "/nightly/profiles/wordcraft", "--version"][..], + &["--launch-profile=nightly-v1", "--profile-root=/nightly/profiles/wordcraft"][..], + &["--profile-root", "/nightly/profiles/wordcraft"][..], + ] { + let argv: Vec = argv.iter().map(std::ffi::OsString::from).collect(); + assert!(launcher_profile_flag(&argv), "{argv:?}"); + } + for argv in [&["--version"][..], &["proof.check", "--launch-profiles"][..], &["--profile-roots"][..]] { + let argv: Vec = argv.iter().map(std::ffi::OsString::from).collect(); + assert!(!launcher_profile_flag(&argv), "{argv:?}"); + } +} + fn args(values: &[&str]) -> Vec { values.iter().map(|value| (*value).into()).collect() } @@ -213,10 +230,12 @@ fn only_the_opened_file_may_be_other_than_unicode() { assert_eq!(ok(vec!["run".into(), "--print".into(), "--file".into(), latin1()]), Some(PathBuf::from(latin1()))); assert_eq!(ok(vec!["info".into(), "in.docx".into()]), None); // Every command that opens a file reaches the open with it (no such file here), so - // `OPENS_FILE` and the commands' own arguments agree. + // `OPENS_FILE` and the commands' own arguments agree. `validate` takes exactly one path, so it + // is checked separately below, together with its exit-3 usage status. let missing = || OsString::from_vec(b"/definitely/not/caf\xe9.docx".to_vec()); let mut opening: Vec> = OPENS_FILE .iter() + .filter(|(cmd, _)| *cmd != "validate") .map(|(cmd, n)| [vec![(*cmd).into()], vec![OsString::from("refresh"); *n], vec![missing(), "out.png".into()]].concat()) .collect(); opening.push(vec!["run".into(), "--file".into(), missing()]); @@ -224,6 +243,7 @@ fn only_the_opened_file_may_be_other_than_unicode() { let e = run(&raw).unwrap_err().to_string(); assert!(e.contains("No such file"), "{raw:?}: {e}"); } + assert!(matches!(run(&["validate".into(), missing()]), Err(Failure::Status(3)))); for (raw, n) in [ (vec!["zotero".into(), latin1(), "in.docx".into()], 2), (vec!["render".into(), "in.docx".into(), latin1()], 3), @@ -281,6 +301,7 @@ fn every_agent_entry_point_refuses_to_start_without_both_roots() { ("run", NotAgent("runs the commands and script named on its command line, then exits")), ("commands", NotAgent("lists the commands; touches no file")), ("parity", NotAgent("prints the feature catalog; touches no file")), + ("validate", NotAgent("validates the one file named on its command line, then exits")), ("mcp", Agent), ("zotero", NotAgent("runs one named Zotero command; Zotero's replies edit citations and name no file")), ]; @@ -543,6 +564,64 @@ fn script_builds_a_document_and_saves_docx_and_pdf_relative_to_the_script() { assert!(json.contains("Hello script") && json.contains("\"bold\":true")); } +#[test] +fn run_saves_each_cli_output_and_still_accepts_a_single_save() { + let dir = script_dir("cli-saves"); + let input = dir.join("in.docx"); + let docx = dir.join("out.docx"); + let pdf = dir.join("out.pdf"); + run(&args(&["run", "--template", "sample", "--save", &input.to_string_lossy()])).unwrap(); + run(&args(&["run", "--file", &input.to_string_lossy(), "--save", &docx.to_string_lossy(), "--save", &pdf.to_string_lossy()])).unwrap(); + assert_eq!(listed_text(&open(&docx, None).unwrap().doc).unwrap(), listed_text(&open(&input, None).unwrap().doc).unwrap()); + assert!(std::fs::read(pdf).unwrap().starts_with(b"%PDF")); +} + +#[test] +fn run_saves_script_and_cli_outputs() { + let dir = script_dir("mixed-saves"); + let script = write_script(&dir, r#"{"commands":["caret.docEnd"],"save":["script.txt","script.docx"]}"#); + let first = dir.join("cli.txt"); + let second = dir.join("cli.docx"); + run(&args(&["run", "--save", &first.to_string_lossy(), "--script", &script, "--save", &second.to_string_lossy()])).unwrap(); + for path in [dir.join("script.txt"), dir.join("script.docx"), first, second] { + assert!(path.is_file(), "{} was not written", path.display()); + } +} + +#[test] +fn run_rejects_a_missing_second_save_path_before_writing() { + let dir = script_dir("missing-save"); + let first = dir.join("first.docx"); + let first_path = first.to_string_lossy(); + for tail in [vec!["--save"], vec!["--save", "--print"], vec!["--save", ""]] { + let mut argv: Vec<&str> = vec!["run", "--save", &first_path]; + argv.extend(tail); + assert_eq!(run(&args(&argv)), Err("run: --save requires a path".into())); + assert!(!first.exists()); + } +} + +#[test] +fn run_preflights_script_and_cli_outputs_in_order_before_writing() { + let dir = script_dir("preflight-saves"); + let first = dir.join("first.docx"); + let invalid = dir.join("missing/later.docx"); + let last = dir.join("missing-too/last.docx"); + let mut script = write_script(&dir, r#"{"commands":["caret.docEnd"],"save":["missing-script/script.docx"]}"#); + let first_path = first.to_string_lossy(); + let invalid_path = invalid.to_string_lossy(); + let last_path = last.to_string_lossy(); + let argv = |script: &str| args(&["run", "--save", &first_path, "--save", &invalid_path, "--script", script, "--save", &last_path]); + let err = run(&argv(&script)).unwrap_err().to_string(); + assert!(err.contains("script.docx"), "{err}"); + assert!(!first.exists()); + + script = write_script(&dir, r#"{"commands":["caret.docEnd"],"save":["script.docx"]}"#); + let err = run(&argv(&script)).unwrap_err().to_string(); + assert!(err.contains("later.docx"), "{err}"); + assert!(!first.exists() && !dir.join("script.docx").exists()); +} + #[test] fn script_with_a_bad_output_writes_no_output() { let dir = script_dir("badout"); @@ -683,6 +762,114 @@ fn script_parse_resolves_paths_against_the_base() { assert_eq!(s.commands.len(), 1); } +/// Finding 3: a surplus operand is a usage error (exit 3) rejected in the operand check, before any +/// file is validated, so a valid first path can no longer make `validate a.docx b.docx` print PASS. +/// The two paths are DIFFERENT files and validating either one would return `Ok`; the code path +/// returns `Status(3)` from the `paths.len() != 1` check before `validate_path` runs, so no file was +/// validated to produce it. (A `Status(3)` on its own does not prove that — `validate` also returns +/// it for an I/O error after a single valid operand reaches the validator — which is why the +/// operand check, not the status, is what establishes the rejection happened first.) +#[test] +fn validate_rejects_missing_or_surplus_operands_without_validating() { + let dir = std::env::temp_dir().join(format!("wc-cli-validate-args-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + let first = dir.join("first.docx"); + let second = dir.join("second.docx"); + run(&args(&["run", "--template", "sample", "--save", &first.to_string_lossy()])).unwrap(); + run(&args(&["run", "--template", "sample", "--save", &second.to_string_lossy()])).unwrap(); + let (first, second) = (first.to_string_lossy().into_owned(), second.to_string_lossy().into_owned()); + assert_ne!(first, second, "the two operands must be different files"); + assert_eq!(run(&args(&["validate", &first])), Ok(()), "one valid path reports PASS"); + assert_eq!( + run(&args(&["validate", &first, &second])), + Err(Failure::Status(3)), + "two different paths are a usage error; validating either would return Ok, so it validated neither" + ); + assert_eq!(run(&args(&["validate"])), Err(Failure::Status(3)), "no path is a usage error"); + let _ = std::fs::remove_dir_all(dir); +} + +/// Finding 4: `validate` is in `OPENS_FILE`, so a file name that is not valid Unicode reaches the +/// validator by its preserved path rather than being rejected as a bad argument. +/// APFS refuses invalid UTF-8 file names, so macOS covers native path handling without creating one. +#[cfg(all(unix, not(target_os = "macos")))] +#[test] +fn validate_accepts_a_file_name_that_is_not_unicode() { + use std::os::unix::ffi::OsStringExt; + let dir = std::env::temp_dir().join(format!("wc-cli-validate-nonutf8-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + let doc = wordcraft_doc::Document::from_text("Bonjour"); + let bytes = wordcraft_engine::io::save_bytes("x.docx", &doc).unwrap(); + let mut name = dir.as_os_str().to_os_string().into_vec(); + name.extend_from_slice(b"/caf\xe9.docx"); + let path = PathBuf::from(OsString::from_vec(name)); + std::fs::write(&path, bytes).unwrap(); + let raw = vec![OsString::from("validate"), path.into_os_string()]; + assert_eq!(run(&raw), Ok(()), "a non-Unicode path validates and reports PASS"); + let _ = std::fs::remove_dir_all(dir); +} + +/// A real `.docx` archive with `extra` parts added: content types, package relationships, the main +/// document and an empty main relationships part. Used to drive `validate_bytes` from real bytes so +/// a document-controlled entry name is shown to reach the report the way production does. +fn validate_fixture_zip(extra: &[(&str, &[u8])]) -> Vec { + let mut w = craft_zip::Writer::new(); + w.add( + "[Content_Types].xml", + br#""#, + craft_zip::Compression::Stored, + ) + .unwrap(); + w.add( + "_rels/.rels", + br#""#, + craft_zip::Compression::Stored, + ) + .unwrap(); + w.add( + "word/document.xml", + br#""#, + craft_zip::Compression::Stored, + ) + .unwrap(); + for (name, bytes) in extra { + w.add(name, bytes, craft_zip::Compression::Stored).unwrap(); + } + w.finish().unwrap() +} + +/// Finding 5: document-controlled text (a ZIP entry name) is escaped in the human report, while the +/// JSON form keeps serde's escaping. The input is a real archive whose entry name carries a control +/// character, so the test shows the name actually reaches the escaped fields (part and message). +#[test] +fn human_report_escapes_document_controlled_text() { + let evil = "word/evil\u{1b}[2J.bin"; + let printable = "word/café—naïve.bin"; + let zip = validate_fixture_zip(&[(evil, b"x"), (printable, b"x")]); + let report = wordcraft_validate::validate_bytes(&zip); + // The undeclared part carries the raw control character in its part field and its message. + let finding = report + .findings + .iter() + .find(|f| f.rule == "CT-UNDECLARED" && f.part.as_deref() == Some(evil)) + .unwrap_or_else(|| panic!("expected CT-UNDECLARED at the control-character name: {:#?}", report.findings)); + assert!(finding.message.contains(evil), "the name reaches the message too: {:?}", finding.message); + + let human = render_validate_report(&report); + assert!(!human.contains('\u{1b}'), "no raw escape survives the human report: {human:?}"); + assert!(human.contains("\\u{1b}"), "{human:?}"); + assert!(human.contains("[2J"), "the surrounding name text is kept as written: {human:?}"); + // Printable Unicode in a name is left as written. + assert!(human.contains(printable), "printable Unicode must be untouched: {human:?}"); + + // JSON output is unchanged by the human escaping: serde still emits the control character as + // its own JSON escape. + let json = serde_json::to_string(&report).unwrap(); + assert!(json.contains("\\u001b"), "{json}"); +} + #[test] fn invisible_characters_are_escaped_and_json_lines_still_parse_back() { let hidden = "a\u{ad}b\u{200b}c\u{200d}d\u{2060}e\u{2064}f\u{feff}g\u{e0041}h\u{e007f}i\u{85}j\u{202e}k"; @@ -698,3 +885,18 @@ fn invisible_characters_are_escaped_and_json_lines_still_parse_back() { assert!(line.contains("\\ud800") || line.contains("\\udb40"), "{line}"); assert_eq!(serde_json::from_str::(&line).unwrap(), value); } + +/// Native non-Unicode paths survive argument parsing and reach the validator's I/O error path. +/// No file is created: APFS refuses invalid UTF-8 names. The original bytes, rather than their +/// lossy display spelling, must be retained even when options precede the operand. +#[cfg(unix)] +#[test] +fn validate_preserves_a_non_unicode_path_without_creating_a_file() { + use std::os::unix::ffi::OsStringExt; + let raw_path = OsString::from_vec(b"wordcraft-nonexistent-caf\xe9.docx".to_vec()); + let raw = vec![OsString::from("validate"), OsString::from("--json"), raw_path.clone()]; + let (_, parsed) = text_args(&raw).unwrap(); + assert_eq!(parsed.as_deref(), Some(Path::new(&raw_path))); + assert!(parsed.as_deref().unwrap().to_str().is_none()); + assert_eq!(run(&raw), Err(Failure::Status(3)), "native path reaches I/O handling"); +} diff --git a/apps/wordcraft-cli/tests/it/closed_stdout.rs b/apps/wordcraft-cli/tests/it/closed_stdout.rs index 55c939456d..f9c7166101 100644 --- a/apps/wordcraft-cli/tests/it/closed_stdout.rs +++ b/apps/wordcraft-cli/tests/it/closed_stdout.rs @@ -1,5 +1,5 @@ -//! A reader that closes stdout early (`wordcraft-cli commands --json | head`) must end the CLI -//! quietly with exit 0, never with a panic (#508). +//! Readers closing stdout early must not panic (#508). Listing and MCP stop quietly; +//! validation retains its verdict exit status. use std::io::{Read, Write}; use std::process::{Command, Stdio}; @@ -47,3 +47,65 @@ fn mcp_server_ends_cleanly_when_its_client_closes_stdout() { assert!(out.status.success(), "status {:?}, stderr: {stderr}", out.status); assert!(!stderr.contains("panicked"), "stderr: {stderr}"); } + +/// A closed reader preserves validation's verdict for both report formats, including INCOMPLETE. +#[test] +fn validate_closed_stdout_preserves_verdict() { + let corpus = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../crates/validate/corpus/calibration"); + let sparse = std::env::temp_dir().join(format!("wordcraft-validate-closed-stdout-{}.docx", std::process::id())); + // The validator checks metadata before reading inputs over its 512 MiB limit. + std::fs::File::create(&sparse).unwrap().set_len((512 << 20) + 1).unwrap(); + let pass = sparse.with_file_name(format!("wordcraft-validate-closed-stdout-pass-{}.docx", std::process::id())); + let bytes = wordcraft_engine::io::save_bytes("pass.docx", &wordcraft_doc::Document::from_text("Control")).unwrap(); + std::fs::write(&pass, bytes).unwrap(); + let mut results = Vec::new(); + for (fixture, expected) in [(pass.clone(), 0), (corpus.join("14-comment-dup.docx"), 1), (sparse.clone(), 2)] { + for json in [false, true] { + let mut open = cli(); + open.arg("validate").arg(&fixture); + if json { + open.arg("--json"); + } + let open = open.output().unwrap(); + // Close the only reader before spawning, so even a short report reliably gets BrokenPipe. + let (reader, writer) = std::io::pipe().unwrap(); + drop(reader); + let mut closed = cli(); + closed.arg("validate").arg(&fixture).stdout(writer); + if json { + closed.arg("--json"); + } + results.push((fixture.clone(), json, expected, open, closed.output().unwrap())); + } + } + std::fs::remove_file(sparse).unwrap(); + std::fs::remove_file(pass).unwrap(); + for (fixture, json, expected, open, closed) in results { + assert_eq!(open.status.code(), Some(expected), "{}, json={json}: {open:?}", fixture.display()); + assert_eq!(closed.status.code(), Some(expected), "{}, json={json}: {closed:?}", fixture.display()); + assert!(!String::from_utf8_lossy(&closed.stderr).contains("panicked"), "{closed:?}"); + } +} + +/// Other report-write failures are I/O status 3; a child-only file-size limit forces EFBIG on stdout. +#[test] +fn validate_stdout_write_error_is_io_status() { + let fixture = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../crates/validate/corpus/calibration/14-comment-dup.docx"); + let stdout = std::env::temp_dir().join(format!("wordcraft-validate-stdout-error-{}", std::process::id())); + let mut results = Vec::new(); + for json in [false, true] { + // Ignore SIGXFSZ so the write returns an error rather than terminating the CLI. + let mut command = Command::new("/bin/sh"); + command.args(["-c", "trap '' XFSZ; ulimit -f 0 || exit 99; exec \"$@\"", "sh", env!("CARGO_BIN_EXE_wordcraft-cli"), "validate"]); + command.arg(&fixture).stdout(std::fs::File::create(&stdout).unwrap()); + if json { + command.arg("--json"); + } + results.push((json, command.output().unwrap())); + } + std::fs::remove_file(stdout).unwrap(); + for (json, output) in results { + assert_eq!(output.status.code(), Some(3), "json={json}: {output:?}"); + assert!(!String::from_utf8_lossy(&output.stderr).contains("panicked"), "{output:?}"); + } +} diff --git a/apps/wordcraft-cli/tests/it/main.rs b/apps/wordcraft-cli/tests/it/main.rs index 15e6a68665..931e05d06d 100644 --- a/apps/wordcraft-cli/tests/it/main.rs +++ b/apps/wordcraft-cli/tests/it/main.rs @@ -3,6 +3,8 @@ mod closed_stdout; mod convert_fields; mod convert_region; mod help; +#[cfg(all(target_os = "linux", target_env = "gnu"))] +mod malloc_tuning; mod mcp_roots; #[cfg(all(unix, not(target_os = "macos")))] mod non_utf8_args; diff --git a/apps/wordcraft-cli/tests/it/malloc_tuning.rs b/apps/wordcraft-cli/tests/it/malloc_tuning.rs new file mode 100644 index 0000000000..27920c5948 --- /dev/null +++ b/apps/wordcraft-cli/tests/it/malloc_tuning.rs @@ -0,0 +1,78 @@ +//! The CLI binary re-executes itself on Linux glibc with `MALLOC_TRIM_THRESHOLD_` fixed so freed +//! page/render buffers are returned to the OS while respecting caller-supplied values. + +use std::io::{BufRead, BufReader, Write}; +use std::path::{Path, PathBuf}; +use std::process::{Command, Stdio}; +use std::sync::atomic::{AtomicUsize, Ordering}; + +use wordcraft_engine::malloc_tuning::{TRIM_THRESHOLD, TRIM_THRESHOLD_VAR}; + +struct TempDirs(PathBuf); + +impl TempDirs { + fn new(tag: &str) -> Self { + static NEXT: AtomicUsize = AtomicUsize::new(0); + let root = loop { + let n = NEXT.fetch_add(1, Ordering::Relaxed); + let dir = std::env::temp_dir().join(format!("wc-cli-malloc-{tag}-{}-{n}", std::process::id())); + match std::fs::create_dir(&dir) { + Ok(()) => break dir, + Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => {} + Err(e) => panic!("temp dir {}: {e}", dir.display()), + } + }; + std::fs::create_dir_all(root.join("in")).unwrap(); + std::fs::create_dir_all(root.join("out")).unwrap(); + Self(root) + } +} + +impl Drop for TempDirs { + fn drop(&mut self) { + let _ = std::fs::remove_dir_all(&self.0); + } +} + +fn s(p: &Path) -> String { + p.to_string_lossy().into_owned() +} + +fn mcp_environ(tag: &str, set: Option<&str>) -> Vec { + let dirs = TempDirs::new(tag); + let mut cmd = Command::new(env!("CARGO_BIN_EXE_wordcraft-cli")); + for var in [TRIM_THRESHOLD_VAR, "MALLOC_MMAP_THRESHOLD_", "MALLOC_TOP_PAD_", "MALLOC_MMAP_MAX_", "MALLOC_ARENA_MAX", "GLIBC_TUNABLES"] { + cmd.env_remove(var); + } + if let Some(v) = set { + cmd.env(TRIM_THRESHOLD_VAR, v); + } + let mut child = cmd + .args(["mcp", "--automation-read-root", &s(&dirs.0.join("in")), "--automation-write-root", &s(&dirs.0.join("out"))]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::null()) + .spawn() + .unwrap(); + let mut stdin = child.stdin.take().unwrap(); + writeln!(stdin, r#"{{"jsonrpc":"2.0","id":1,"method":"ping"}}"#).unwrap(); + let mut reply = String::new(); + BufReader::new(child.stdout.take().unwrap()).read_line(&mut reply).unwrap(); + assert!(reply.contains(r#""id":1"#), "mcp answered after re-exec: {reply}"); + let environ = std::fs::read(format!("/proc/{}/environ", child.id())).unwrap(); + drop(stdin); + assert!(child.wait().unwrap().success()); + environ.split(|&b| b == 0).map(|e| String::from_utf8_lossy(e).into_owned()).collect() +} + +#[test] +fn sets_the_trim_threshold() { + let env = mcp_environ("default", None); + assert!(env.contains(&format!("{TRIM_THRESHOLD_VAR}={TRIM_THRESHOLD}")), "{env:?}"); +} + +#[test] +fn keeps_a_value_the_user_set() { + let env = mcp_environ("explicit", Some("999999")); + assert!(env.contains(&format!("{TRIM_THRESHOLD_VAR}=999999")), "{env:?}"); +} diff --git a/apps/wordcraft-web/src/api.rs b/apps/wordcraft-web/src/api.rs index 858a44c433..b9e354dd88 100644 --- a/apps/wordcraft-web/src/api.rs +++ b/apps/wordcraft-web/src/api.rs @@ -27,6 +27,7 @@ const POLL_MS: i32 = 16; pub fn install(ctx: egui::Context) -> Receiver { let (queue, requests) = channel::(); 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"}) }); diff --git a/apps/wordcraft-web/src/host.rs b/apps/wordcraft-web/src/host.rs index 26732ffcfd..94f8e821a6 100644 --- a/apps/wordcraft-web/src/host.rs +++ b/apps/wordcraft-web/src/host.rs @@ -37,9 +37,9 @@ use std::rc::Rc; use std::sync::Arc; use std::sync::Mutex; -use craft::host::{FileError, Files, PickId, PickRequest, Picked}; +use craft::host::{FileError, Files, PendingPick, PickId, PickRequest, Picked, WriteIntent}; use craft::platform::browser_files::BrowserFiles; -use craft::platform::open::{DropTarget, DroppedFile, IntakeSender}; +use craft::platform::open::{DroppedFile, IntakeSender}; use craft::web_host::web::{FileData, Host, Message}; use wordcraft_ui_egui::{Services, WordApp}; @@ -110,7 +110,7 @@ impl Bridge { fn listen(&self, intake: IntakeSender) { self.host.listen(move |message| { if let Message::Open { name, data } = message { - deliver_open(&intake, &name, &data); + deliver_open(&intake, name.as_deref().unwrap_or("document"), &data); } }); } @@ -119,7 +119,7 @@ impl Bridge { /// The file an open message carries, queued for the next frame like a dropped file. A host's file /// is untrusted input: an oversized one is refused before it is copied into the app's memory (the /// data's own length, not the host's claim). The crate has cleaned the name (and cut it to 255 -/// characters); a blank one comes as `document` and becomes `Document.docx`. +/// characters); a missing one comes as `None` and becomes `Document.docx`. fn deliver_open(intake: &IntakeSender, name: &str, data: &FileData) { let name = if name == "document" { DEFAULT_NAME } else { name }.to_string(); let FileData::Bytes(array) = data else { @@ -131,7 +131,7 @@ fn deliver_open(intake: &IntakeSender, name: &str, data: &FileData) { return; } let file = DroppedFile { path: None, name, bytes: Some(Arc::from(array.to_vec())) }; - intake.dropped(vec![file], DropTarget::Elsewhere); + intake.dropped(vec![file]); } /// The files of a hosted page: reads go to the browser's files, but a save goes to the host page, @@ -167,16 +167,16 @@ impl Files for HostedFiles { } } - fn pick_pending(&self) -> bool { - self.inner.pick_pending() + fn pending_pick(&self) -> Option { + self.inner.pending_pick() } fn read(&self, path: &Path) -> Result, FileError> { self.inner.read(path) } - fn write(&self, path: &Path, bytes: &[u8]) -> Result<(), FileError> { - self.inner.write(path, bytes) + fn write(&self, path: &Path, bytes: &[u8], intent: WriteIntent) -> Result { + self.inner.write(path, bytes, intent) } fn last_folder(&self, purpose: &str) -> Option { @@ -192,7 +192,7 @@ impl Files for HostedFiles { let answer = match sent { // A Save As or first Save makes the page hold the document as this file: the answer // names it, and the next Save posts the name with `save_as` false. - Ok(()) if request.save_as => Picked::Paths(vec![PathBuf::from(&name)]), + Ok(()) if request.save_as => Picked::Saved { path: PathBuf::from(&name), file_type: None }, // An overwrite of the opened file, or a copy: the document's file stays as it is. Ok(()) => Picked::Downloaded(name), Err(error) => Picked::Failed(error), diff --git a/apps/wordcraft-web/src/main.rs b/apps/wordcraft-web/src/main.rs index 11720849b7..7a5cc73655 100644 --- a/apps/wordcraft-web/src/main.rs +++ b/apps/wordcraft-web/src/main.rs @@ -23,6 +23,8 @@ 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; diff --git a/apps/wordcraft-web/src/page_params.rs b/apps/wordcraft-web/src/page_params.rs new file mode 100644 index 0000000000..ea1ffdb805 --- /dev/null +++ b/apps/wordcraft-web/src/page_params.rs @@ -0,0 +1,55 @@ +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(¶ms).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(¶ms).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); + } + } +} diff --git a/apps/wordcraft-web/src/prefs.rs b/apps/wordcraft-web/src/prefs.rs index 5ca6055e59..bdf68c90cf 100644 --- a/apps/wordcraft-web/src/prefs.rs +++ b/apps/wordcraft-web/src/prefs.rs @@ -13,14 +13,14 @@ pub fn open() -> (SharedSettings, craft::settings::LoadReport) { use std::time::Duration; use craft::settings::{LegacyFile, LocalStorageFiles, Location, OpenOptions, SettingsStore}; - use wordcraft_ui_egui::prefs::legacy_ui_json; + use wordcraft_ui_egui::prefs::legacy_ui_json_slots; /// Largest stored value read back (`localStorage` holds about 5 MB per site). const MAX_STORED: usize = 4 << 20; let options = OpenOptions::new(Location::Dir("wordcraft".into())) .files(Arc::new(LocalStorageFiles::new(MAX_STORED))) .debounce(Duration::ZERO) - .legacy(vec![LegacyFile { path: "wordcraft.ui".into(), parse: legacy_ui_json }]); + .legacy(vec![LegacyFile { paths: vec!["wordcraft.ui".into()], parse: legacy_ui_json_slots }]); let (store, report) = SettingsStore::open_with(options); (SharedSettings::new(store), report) } diff --git a/apps/wordcraft-web/src/web.rs b/apps/wordcraft-web/src/web.rs index b754836936..c1ee1ababb 100644 --- a/apps/wordcraft-web/src/web.rs +++ b/apps/wordcraft-web/src/web.rs @@ -10,7 +10,7 @@ use craft::host::{Files, Host, Wake}; use craft::platform::appearance::SystemReader; use craft::platform::browser_files::BrowserFiles; use craft::platform::clipboard::{Clipboard, ClipboardError, EventClipboard, Flavor, LateOffers, TEXT}; -use craft::platform::open::{DropTarget, DroppedFile, FileIntake, IntakeSender}; +use craft::platform::open::{DroppedFile, FileIntake, IntakeSender}; use craft::print::spool::Spool; use craft::settings::SharedSettings; use craft::ui::InstallSpec; @@ -227,7 +227,7 @@ impl eframe::App for WebShell { match f.bytes_async().await { Ok(bytes) => { let file = DroppedFile { path: None, name, bytes: Some(Arc::from(bytes)) }; - sender.dropped(vec![file], DropTarget::Elsewhere); + sender.dropped(vec![file]); } Err(e) => log::error!("couldn't read dropped file {name}: {e}"), } @@ -412,7 +412,7 @@ fn guard_unload(dirty: Rc>, files: Arc) -> Result<(), S let window = web_sys::window().ok_or("no window")?; let on_unload = wasm_bindgen::closure::Closure::::new(move |e: web_sys::BeforeUnloadEvent| { // A save still in the browser's picker hasn't written anything yet. - if dirty.get() || files.pick_pending() { + if dirty.get() || files.pending_pick().is_some() { e.prevent_default(); // Older browsers ask only when `returnValue` is set. e.set_return_value("unsaved changes"); diff --git a/apps/wordcraft/Cargo.toml b/apps/wordcraft/Cargo.toml index e972797dcd..51de73f2b8 100644 --- a/apps/wordcraft/Cargo.toml +++ b/apps/wordcraft/Cargo.toml @@ -25,6 +25,9 @@ eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", " egui = { workspace = true } serde_json = { workspace = true } log = { workspace = true } +# The nightly launch profile's refusal dialog (a native message box, like the app's other OS errors). +rfd = { workspace = true } +thiserror = { workspace = true } # The suite's shared libraries: the runtime hooks (`ui`, `ui-app`), file dialogs, the control # channel's arguments, the GPU choice, printing, settings and window placement, the OS appearance # reader and the system clipboard. @@ -40,6 +43,7 @@ craft = { workspace = true, features = [ "platform-appearance", "platform-clipboard-system", ] } +craft-nightly = { workspace = true } [dev-dependencies] # Temporary settings folders for the `prefs` tests. @@ -54,10 +58,16 @@ winresource = "0.1" [target.'cfg(target_os = "macos")'.dependencies] # Finder double-click, Open With, Dock drops and `open -a WordCraft letter.docx` arrive as a # kAEOpenDocuments Apple event, which winit doesn't handle (#27). -craft = { workspace = true, features = ["platform-apple-events"] } +craft = { workspace = true, features = ["platform-apple-events", "menu"] } + +[target.'cfg(all(unix, not(any(target_os = "macos", target_os = "linux"))))'.dependencies] +winit = { version = "0.30", default-features = false, features = ["x11"] } + +[target.'cfg(target_os = "linux")'.dependencies] +# Retain X11 fallback; draw Wayland client-side controls without bundled title fonts. +winit = { version = "0.30", default-features = false, features = ["x11", "wayland-csd-adwaita-notitle"] } [target.'cfg(all(unix, not(target_os = "macos")))'.dependencies] -winit = { version = "0.30", default-features = false, features = ["x11"] } # Check that the libraries winit's X11 backend opens are installed before choosing XWayland (see # `x11_libraries` in main.rs). Both are already in the build through winit's `x11` feature, at # these versions and with this feature. @@ -68,3 +78,6 @@ xkbcommon-dl = { version = "0.4.2", features = ["x11"] } # The update helper: a copy of this program started with `--finish-update` # (`craft::update::self_update::finish`). craft = { workspace = true, features = ["update"] } +# The nightly Windows identity: an explicit AppUserModelID, so Nightly gets its own taskbar +# button instead of sharing the stable app's (#16335's rule for the suite). +winsafe = { version = "=0.0.29", default-features = false, features = ["user", "shell"] } diff --git a/apps/wordcraft/build.rs b/apps/wordcraft/build.rs index d025b2f892..b93d9855b5 100644 --- a/apps/wordcraft/build.rs +++ b/apps/wordcraft/build.rs @@ -1,25 +1,63 @@ //! Windows only: embed the app icon and version info (VERSIONINFO) into `wordcraft.exe`, so it //! shows in Explorer, the taskbar, the Start menu and Alt-Tab. //! -//! On every other target this does nothing. A missing resource compiler is a warning, so a -//! cross-compile from macOS or Linux still links, unless `WORDCRAFT_REQUIRE_WINRES=1` turns it +//! The build channel (`WORDCRAFT_BUILD_CHANNEL`) is decided here, before any code is compiled: a +//! nightly-v1 build gets its own cfg, its own icon and its exact feed version in VERSIONINFO. +//! On every other target this does nothing but that. A missing resource compiler is a warning, so +//! a cross-compile from macOS or Linux still links, unless `WORDCRAFT_REQUIRE_WINRES=1` turns it //! into an error (for release builds). +#[path = "src/build_channel.rs"] +mod build_channel; + fn main() { println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=WORDCRAFT_BUILD_CHANNEL"); + println!("cargo:rustc-check-cfg=cfg(wordcraft_nightly_v1)"); + let nightly = match std::env::var("WORDCRAFT_BUILD_CHANNEL").as_deref() { + Ok("nightly-v1") => { + println!("cargo:rustc-cfg=wordcraft_nightly_v1"); + true + } + // An empty value (an unset CI input) means the default stable build. + Ok("stable" | "") | Err(std::env::VarError::NotPresent) => false, + _ => { + eprintln!("unsupported WORDCRAFT_BUILD_CHANNEL (expected stable or nightly-v1)"); + std::process::exit(1); + } + }; println!("cargo:rerun-if-changed=../../assets/app-icon/wordcraft.ico"); + println!("cargo:rerun-if-changed=../../assets/app-icon/wordcraft-nightly.ico"); println!("cargo:rerun-if-env-changed=WORDCRAFT_REQUIRE_WINRES"); + println!("cargo:rerun-if-env-changed=WORDCRAFT_VERSION"); + let built_version = if nightly { + match std::env::var("WORDCRAFT_VERSION") { + Ok(version) if build_channel::is_nightly_version(&version) => version, + _ => { + eprintln!("nightly-v1 requires an explicit WORDCRAFT_VERSION feed identity"); + std::process::exit(1); + } + } + } else { + std::env::var("CARGO_PKG_VERSION").unwrap_or_default() + }; + println!("cargo:rustc-env=WORDCRAFT_BUILT_VERSION={built_version}"); + if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") { return; } let mut res = winresource::WindowsResource::new(); - res.set_icon("../../assets/app-icon/wordcraft.ico") - .set("ProductName", "WordCraft") - .set("FileDescription", "WordCraft word processor") + res.set_icon(build_channel::windows_icon_path(nightly)) + .set("ProductName", if nightly { "WordCraft Nightly" } else { "WordCraft" }) + .set("FileDescription", if nightly { "WordCraft Nightly word processor" } else { "WordCraft word processor" }) .set("CompanyName", "Learning Machines LLC") .set("LegalCopyright", "Copyright (c) the WordCraft authors. MIT OR Apache-2.0.") .set("OriginalFilename", "wordcraft.exe") .set("InternalName", "wordcraft"); + if nightly { + // The Launcher verifies the PE ProductVersion against the exact feed identity, not FileVersion. + res.set("ProductVersion", &built_version); + } if let Err(e) = res.compile() { if std::env::var_os("WORDCRAFT_REQUIRE_WINRES").is_some() { eprintln!("embedding Windows resources failed: {e}"); diff --git a/apps/wordcraft/src/build_channel.rs b/apps/wordcraft/src/build_channel.rs new file mode 100644 index 0000000000..d941e31c40 --- /dev/null +++ b/apps/wordcraft/src/build_channel.rs @@ -0,0 +1,54 @@ +//! The build-time nightly identity shared by the build script and its pure regression tests. +pub fn is_nightly_version(version: &str) -> bool { + let Some((base, suffix)) = version.split_once("-nightly.") else { return false }; + let digits = |s: &str| !s.is_empty() && s.bytes().all(|b| b.is_ascii_digit()); + let base: Vec<_> = base.split('.').collect(); + let parts: Vec<_> = suffix.split('.').collect(); + base.len() == 3 + && base.iter().all(|s| digits(s)) + && parts.len() == 4 + && parts[0].len() == 8 + && digits(parts[0]) + && digits(parts[1]) + && digits(parts[2]) + && parts[3].strip_prefix('g').is_some_and(|sha| sha.len() == 12 && sha.bytes().all(|b| b.is_ascii_digit() || (b'a'..=b'f').contains(&b))) +} +pub fn windows_icon_path(nightly: bool) -> &'static str { + if nightly { "../../assets/app-icon/wordcraft-nightly.ico" } else { "../../assets/app-icon/wordcraft.ico" } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn windows_resource_uses_the_flavor_specific_icon_without_changing_stable() { + assert_eq!(windows_icon_path(false), "../../assets/app-icon/wordcraft.ico"); + assert_eq!(windows_icon_path(true), "../../assets/app-icon/wordcraft-nightly.ico"); + } + + #[test] + fn explicit_feed_identity_is_required_for_a_nightly_build() { + assert!(is_nightly_version("0.18.1-nightly.20261124.17.1.gabcdef012345")); + for invalid in [ + "", + "0.18.1", + "0.18.1-nightly", + "0.18.1-nightly.20261124", + "0.18.1-nightly.20261124.17.1.gABCDEF012345", + "0.18.1-nightly.20261124.17.1.gabcdef012345\n", + ] { + assert!(!is_nightly_version(invalid), "{invalid:?}"); + } + } + + #[test] + fn version_cannot_inject_a_path_or_an_extra_build_directive() { + for invalid in [ + "../0.18.1-nightly.20261124.1.1.gabcdef012345", + "0.18.1-nightly.20261124.1.1.gabcdef012345/other", + "0.18.1-nightly.20261124.1.1.gabcdef012345\ncargo:rustc-cfg=other", + ] { + assert!(!is_nightly_version(invalid)); + } + } +} diff --git a/apps/wordcraft/src/build_flavor.rs b/apps/wordcraft/src/build_flavor.rs new file mode 100644 index 0000000000..d59f91ff65 --- /dev/null +++ b/apps/wordcraft/src/build_flavor.rs @@ -0,0 +1,66 @@ +//! Build-time channel is distinct from a launch selector. A runtime environment cannot promote a stable build. + +use std::ffi::OsString; + +pub use craft_nightly::BuildFlavor; + +pub const COMPILED: BuildFlavor = if cfg!(wordcraft_nightly_v1) { BuildFlavor::NightlyV1 } else { BuildFlavor::Stable }; + +pub fn needs_native_error(flavor: BuildFlavor, desktop_session: bool) -> bool { + desktop_session && flavor == BuildFlavor::NightlyV1 +} + +/// The Launcher's version line: `WordCraft (nightly-v1)` for a nightly build. +pub fn version(flavor: BuildFlavor, stable: &str) -> String { + match flavor { + BuildFlavor::Stable => stable.to_owned(), + BuildFlavor::NightlyV1 => format!("WordCraft {stable} (nightly-v1)"), + } +} + +/// A plain `--version` / `-V`: the only arguments, answered before any startup work. +pub fn version_query(args: &[OsString]) -> bool { + matches!(args, [arg] if arg == "--version" || arg == "-V") +} + +#[cfg(test)] +mod tests { + use super::{BuildFlavor, needs_native_error, version, version_query}; + use craft_nightly::{Profile, ProfileError, StartupOptions, canonical_profile_root, parse_startup}; + use std::ffi::OsString; + + #[test] + fn only_a_nightly_desktop_refusal_requests_a_native_dialog() { + assert!(needs_native_error(BuildFlavor::NightlyV1, true)); + assert!(!needs_native_error(BuildFlavor::NightlyV1, false)); + assert!(!needs_native_error(BuildFlavor::Stable, true)); + assert!(!needs_native_error(BuildFlavor::Stable, false)); + } + + #[test] + fn direct_nightly_launch_self_isolates_into_canonical_profile_root() { + let spec = crate::profile_root::spec(); + let expected_root = canonical_profile_root(spec.app_id).unwrap(); + let launch = parse_startup(BuildFlavor::NightlyV1, &spec, [OsString::from("letter.docx")], &StartupOptions::new()).unwrap(); + assert_eq!(launch.profile, Profile::NightlyV1(expected_root)); + assert_eq!(launch.passthrough_args, vec![OsString::from("letter.docx")]); + } + + #[test] + fn stable_build_refuses_nightly_launch_flags() { + let spec = crate::profile_root::spec(); + let args = craft_nightly::launch_arguments(std::path::Path::new(crate::launch_profile::launcher_root()), &[]); + let err = parse_startup(BuildFlavor::Stable, &spec, args, &StartupOptions::new()).unwrap_err(); + assert!(matches!(err, ProfileError::NightlyFlagsInStableBuild)); + } + + #[test] + fn nightly_version_query_is_unambiguous_and_never_reinterprets_file_arguments() { + assert_eq!(version(BuildFlavor::Stable, "0.18.1"), "0.18.1"); + assert_eq!(version(BuildFlavor::NightlyV1, "0.18.1"), "WordCraft 0.18.1 (nightly-v1)"); + assert!(version_query(&["--version".into()])); + assert!(version_query(&["-V".into()])); + assert!(!version_query(&["--".into(), "--version".into()])); + assert!(!version_query(&[])); + } +} diff --git a/apps/wordcraft/src/control_server.rs b/apps/wordcraft/src/control_server.rs index 01729eb5a7..685360875b 100644 --- a/apps/wordcraft/src/control_server.rs +++ b/apps/wordcraft/src/control_server.rs @@ -10,6 +10,7 @@ use std::net::TcpListener; use std::path::{Path, PathBuf}; use std::sync::mpsc::Receiver; +use craft::automation::AutomationError; use craft::automation::args::ControlOptions; use craft::automation::control::ControlRequest; use craft::automation::server::{Listening, serve}; @@ -38,6 +39,22 @@ fn remove(path: Option<&Path>) { } } +/// Why starting the control server did not succeed. +enum StartError { + /// Windows external-tool timeout while creating or checking the owner-only token file. + TokenTimeout(String), + /// Any other bind, token, or accept-thread error. + Other(String), +} + +impl StartError { + fn message(&self) -> &str { + match self { + Self::TokenTimeout(msg) | Self::Other(msg) => msg, + } + } +} + /// Bind `127.0.0.1:port`, settle the token and serve. `None` when the port cannot be bound or /// the token cannot be set up (the control channel is off); a taken port leaves no token file. /// @@ -45,35 +62,49 @@ fn remove(path: Option<&Path>) { /// `port` in `settings`; a file left by a run that did not exit cleanly is replaced. Without a /// settings folder a fresh token is generated and reported by the log. pub fn start(options: &ControlOptions, port: u16, host: WindowHost, settings: Option<&Path>) -> Option<(Receiver, Control)> { - let listener = match TcpListener::bind(("127.0.0.1", port)) { - Ok(l) => l, - Err(e) => { - log::error!("control server failed to bind 127.0.0.1:{port}: {e}"); - return None; + match start_with(options, port, host, settings, ControlOptions::server_token) { + Ok(started) => Some(started), + Err(err) => { + log::error!("{}", err.message()); + None } - }; + } +} + +fn start_with( + options: &ControlOptions, + port: u16, + host: WindowHost, + settings: Option<&Path>, + token_for: impl FnOnce(&ControlOptions) -> Result, +) -> Result<(Receiver, Control), StartError> { + let listener = + TcpListener::bind(("127.0.0.1", port)).map_err(|e| StartError::Other(format!("control server failed to bind 127.0.0.1:{port}: {e}")))?; let created = settings.filter(|_| options.token.is_none() && options.token_file.is_none()).map(|dir| wordcraft_control_key::key_path(dir, port)); // The port was free, so no other run owns a file left here. remove(created.as_deref()); let effective = ControlOptions { token_file: created.clone().or_else(|| options.token_file.clone()), ..options.clone() }; - let token = match effective.server_token() { + let token = match token_for(&effective) { Ok(t) => t, Err(e) => { remove(created.as_deref()); - log::error!("control server off: {e}"); - return None; + let msg = format!("control server off: {e}"); + return Err(if matches!(&e, AutomationError::Io(text) if text.contains("did not finish within ")) { + StartError::TokenTimeout(msg) + } else { + StartError::Other(msg) + }); } }; let notice = effective.token_notice(&token); match serve(listener, token, host) { Ok((rx, listening)) => { log::info!("control server listening on {}, {notice}", listening.addr); - Some((rx, Control { listening, created })) + Ok((rx, Control { listening, created })) } Err(e) => { remove(created.as_deref()); - log::error!("control server off: cannot start the accept thread ({e})"); - None + Err(StartError::Other(format!("control server off: cannot start the accept thread ({e})"))) } } } @@ -87,6 +118,41 @@ mod tests { WindowHost::of(&egui::Context::default()) } + /// Attempts for `start_with` when Windows `owner_only` hits its 10 s external-tool limit on + /// a busy CI runner (#8556). Non-timeout failures stop on the first attempt. + const TOKEN_TIMEOUT_ATTEMPTS: usize = 3; + + fn try_start_retrying_token_timeout( + options: &ControlOptions, + port: u16, + host: WindowHost, + settings: Option<&Path>, + mut token_for: impl FnMut(&ControlOptions) -> Result, + ) -> Result<(Receiver, Control), (usize, StartError)> { + let mut attempt = 1; + loop { + match start_with(options, port, host.clone(), settings, &mut token_for) { + Ok(started) => return Ok(started), + Err(StartError::TokenTimeout(msg)) if attempt < TOKEN_TIMEOUT_ATTEMPTS => { + log::warn!("retrying control server start after Windows token-file timeout ({attempt}/{TOKEN_TIMEOUT_ATTEMPTS}): {msg}"); + attempt += 1; + } + Err(err) => return Err((attempt, err)), + } + } + } + + fn start_retrying_token_timeout( + options: &ControlOptions, + port: u16, + host: WindowHost, + settings: Option<&Path>, + token_for: impl FnMut(&ControlOptions) -> Result, + ) -> (Receiver, Control) { + try_start_retrying_token_timeout(options, port, host, settings, token_for) + .unwrap_or_else(|(attempt, err)| panic!("control server start failed on attempt {attempt}: {}", err.message())) + } + #[test] fn the_token_file_is_written_after_the_bind_and_removed_on_exit() { let dir = std::env::temp_dir().join(format!("wordcraft-control-life-{}", std::process::id())); @@ -101,7 +167,7 @@ mod tests { drop(taken); // Bound: the default file holds the token that opens the port. - let (_rx, control) = start(&options, 0, host(), Some(&dir)).unwrap(); + let (_rx, control) = start_retrying_token_timeout(&options, 0, host(), Some(&dir), ControlOptions::server_token); let path = control.created.clone().unwrap(); assert_eq!(path, wordcraft_control_key::key_path(&dir, 0)); let token = std::fs::read_to_string(&path).unwrap(); @@ -117,10 +183,221 @@ mod tests { // A token file the user supplied stays. let supplied = dir.join("supplied-token"); let options = ControlOptions { token_file: Some(supplied.clone()), ..ControlOptions::default() }; - let (_rx, control) = start(&options, 0, host(), Some(&dir)).unwrap(); + let (_rx, control) = start_retrying_token_timeout(&options, 0, host(), Some(&dir), ControlOptions::server_token); assert!(control.created.is_none()); control.shut_down(); assert!(supplied.exists()); let _ = std::fs::remove_dir_all(&dir); } + + #[test] + fn a_transient_token_file_timeout_retries_while_other_errors_stop() { + let dir = std::env::temp_dir().join(format!("wordcraft-control-retry-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + let options = ControlOptions::default(); + + // A Windows `owner_only` external-tool timeout retries and recovers on a later attempt. + let mut timeout_then_ok = 0usize; + let (_rx, control) = start_retrying_token_timeout(&options, 0, host(), Some(&dir), |effective| { + timeout_then_ok += 1; + if timeout_then_ok == 1 { + let path = effective.token_file.as_ref().unwrap(); + Err(AutomationError::Io(format!( + "{}: cannot create the control token file for its owner only: powershell.exe did not finish within 10 s and was ended", + path.display() + ))) + } else { + Ok(TOKEN.to_string()) + } + }); + assert_eq!(timeout_then_ok, 2); + control.shut_down(); + + // Repeated timeouts stop after `TOKEN_TIMEOUT_ATTEMPTS` instead of looping forever. + let mut exhausted = 0usize; + let Err((attempt, err)) = try_start_retrying_token_timeout(&options, 0, host(), Some(&dir), |_| { + exhausted += 1; + Err(AutomationError::Io("powershell.exe did not finish within 10 s and was ended".into())) + }) else { + panic!("exhausted timeouts must fail"); + }; + assert_eq!((attempt, exhausted), (TOKEN_TIMEOUT_ATTEMPTS, TOKEN_TIMEOUT_ATTEMPTS)); + assert!(matches!(err, StartError::TokenTimeout(_))); + + // Non-timeout failures stop on the first attempt. + let mut other = 0usize; + let Err((attempt, err)) = try_start_retrying_token_timeout(&options, 0, host(), Some(&dir), |_| { + other += 1; + Err(AutomationError::Io("permission denied".into())) + }) else { + panic!("non-timeout error must fail"); + }; + assert_eq!((attempt, other), (1, 1)); + assert!(matches!(err, StartError::Other(msg) if msg.contains("permission denied"))); + + let _ = std::fs::remove_dir_all(&dir); + } + + const TOKEN: &str = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"; + + fn boot() -> (u16, Receiver, Control) { + let options = ControlOptions { token: Some(TOKEN.to_string()), ..ControlOptions::default() }; + let (rx, control) = start(&options, 0, host(), None).unwrap(); + let port = control.listening.addr.port(); + (port, rx, control) + } + + /// Answer the next request that reaches the UI with `ok`, and return it. + fn answer(rx: &Receiver) -> ControlRequest { + let req = rx.recv_timeout(std::time::Duration::from_secs(5)).unwrap(); + let _ = req.reply.send(serde_json::json!({"ok": true, "result": {}})); + req + } + + /// One connection, several lines. + struct Conn(std::io::BufReader, std::net::TcpStream); + + impl Conn { + fn open(port: u16) -> Self { + let s = std::net::TcpStream::connect(("127.0.0.1", port)).unwrap(); + s.set_read_timeout(Some(std::time::Duration::from_secs(5))).unwrap(); + Self(std::io::BufReader::new(s.try_clone().unwrap()), s) + } + fn send(&mut self, line: &str) { + use std::io::Write; + writeln!(self.1, "{line}").unwrap(); + } + fn recv(&mut self) -> serde_json::Value { + use std::io::BufRead; + let mut r = String::new(); + let n = self.0.read_line(&mut r).expect("read reply line"); + assert!(n > 0, "unexpected EOF while waiting for reply"); + serde_json::from_str(&r).expect("reply is valid JSON") + } + fn call(&mut self, line: &str) -> serde_json::Value { + self.send(line); + self.recv() + } + /// The server closed the connection. + fn closed(&mut self) -> bool { + use std::io::BufRead; + let mut r = String::new(); + match self.0.read_line(&mut r) { + Ok(0) => true, + Err(e) => matches!( + e.kind(), + std::io::ErrorKind::ConnectionReset + | std::io::ErrorKind::ConnectionAborted + | std::io::ErrorKind::NotConnected + | std::io::ErrorKind::BrokenPipe + ), + _ => false, + } + } + } + + /// Post-#7101 adaptation of `the_key_on_each_request` (#124, tracked under #7317 / #7720): + /// `craft::automation::server` replaced the legacy per-request `"key"` field with one-time + /// per-connection token authentication (`docs/control-protocol.md`, Token). + #[test] + fn a_connection_authenticates_once_with_the_token_and_unauthenticated_requests_are_refused() { + let (port, rx, control) = boot(); + + // Authenticate once per connection with `params.token`. + let mut c = Conn::open(port); + let auth_resp = c.call(&format!(r#"{{"id":1,"method":"auth","params":{{"token":"{TOKEN}"}}}}"#)); + assert_eq!(auth_resp, serde_json::json!({"id": 1, "ok": true, "result": {"authenticated": true}})); + + // Subsequent requests on the authenticated connection carry no token and reach the UI. + c.send(r#"{"id":7,"method":"document.inspect","params":{"text":true}}"#); + let req = answer(&rx); + assert_eq!((req.method.as_str(), &req.params), ("document.inspect", &serde_json::json!({"text": true}))); + let r = c.recv(); + assert_eq!((&r["ok"], &r["id"]), (&serde_json::json!(true), &serde_json::json!(7))); + + c.send(r#"{"id":8,"method":"document.inspect","params":{"text":false}}"#); + let req = answer(&rx); + assert_eq!((req.method.as_str(), &req.params), ("document.inspect", &serde_json::json!({"text": false}))); + let r = c.recv(); + assert_eq!((&r["ok"], &r["id"]), (&serde_json::json!(true), &serde_json::json!(8))); + drop(c); + + // An unauthenticated connection is refused and closed without reaching the UI. + let mut unauth = Conn::open(port); + let r = unauth.call(r#"{"id":9,"method":"document.inspect"}"#); + assert_eq!(r, serde_json::json!({"id": 9, "ok": false, "error": "authentication required"})); + assert!(unauth.closed()); + assert!(rx.try_recv().is_err(), "unauthenticated request must not reach the UI"); + drop(unauth); + + // Legacy pre-#7101 per-request `"key"` does not bypass `auth` and closes the connection. + let mut legacy = Conn::open(port); + let r = legacy.call(&format!(r#"{{"id":10,"key":"{TOKEN}","method":"document.inspect","params":{{"text":true}}}}"#)); + assert_eq!(r, serde_json::json!({"id": 10, "ok": false, "error": "authentication required"})); + assert!(legacy.closed()); + assert!(rx.try_recv().is_err(), "legacy per-request key must not reach the UI"); + drop(legacy); + + control.shut_down(); + } + + /// Post-#7101 adaptation of `params_key_is_only_a_secret_for_auth` (#124, tracked under #7317 / #7729): + /// `craft::automation::server` replaced legacy `"key"` / `params.key` secrets with one-time + /// per-connection `auth` using `params.token` (`docs/control-protocol.md`, Token). + #[test] + fn params_token_is_only_a_secret_for_auth() { + let (port, rx, control) = boot(); + + // Neither `params.token` on a non-`auth` method nor legacy `params.key` on + // `document.inspect` or `auth` authenticates. + for (id, line) in [ + (1, format!(r#"{{"id":1,"method":"document.inspect","params":{{"token":"{TOKEN}"}}}}"#)), + (2, format!(r#"{{"id":2,"method":"document.inspect","params":{{"key":"{TOKEN}"}}}}"#)), + (3, format!(r#"{{"id":3,"method":"auth","params":{{"key":"{TOKEN}"}}}}"#)), + ] { + let mut c = Conn::open(port); + assert_eq!(c.call(&line), serde_json::json!({"id": id, "ok": false, "error": "authentication required"})); + assert!(c.closed()); + } + assert!(rx.try_recv().is_err(), "refused requests must not reach the UI"); + + // Authenticate once with `params.token`; `params.key` and `params.token` on subsequent + // non-`auth` methods are forwarded untouched as ordinary parameters. + let mut c = Conn::open(port); + let auth_resp = c.call(&format!(r#"{{"id":1,"method":"auth","params":{{"token":"{TOKEN}"}}}}"#)); + assert_eq!(auth_resp, serde_json::json!({"id": 1, "ok": true, "result": {"authenticated": true}})); + + c.send(r#"{"id":2,"method":"ui.key","params":{"key":"Enter"}}"#); + let req = answer(&rx); + assert_eq!((req.method.as_str(), &req.params), ("ui.key", &serde_json::json!({"key": "Enter"}))); + let r = c.recv(); + assert_eq!((&r["ok"], &r["id"]), (&serde_json::json!(true), &serde_json::json!(2))); + + c.send(r#"{"id":3,"method":"document.inspect","params":{"token":"ordinary"}}"#); + let req = answer(&rx); + assert_eq!((req.method.as_str(), &req.params), ("document.inspect", &serde_json::json!({"token": "ordinary"}))); + let r = c.recv(); + assert_eq!((&r["ok"], &r["id"]), (&serde_json::json!(true), &serde_json::json!(3))); + drop(c); + + control.shut_down(); + } + + /// Post-#7101 adaptation of `a_wrong_key_is_refused_and_closed` (#124, tracked under #7317): + /// wrong, short, and long `params.token` values are refused and close the connection without + /// reaching the UI. + #[test] + fn a_wrong_token_is_refused_and_closed() { + let (port, rx, control) = boot(); + let wrong = TOKEN.replace('0', "1"); + let long = format!("{TOKEN}0"); + for token in ["nope", wrong.as_str(), &TOKEN[..63], long.as_str()] { + let mut c = Conn::open(port); + let resp = c.call(&format!(r#"{{"id":1,"method":"auth","params":{{"token":"{token}"}}}}"#)); + assert_eq!(resp, serde_json::json!({"id": 1, "ok": false, "error": "authentication required"}), "{token}"); + assert!(c.closed(), "{token}"); + } + assert!(rx.try_recv().is_err(), "refused auth attempts must not reach the UI"); + control.shut_down(); + } } diff --git a/apps/wordcraft/src/default_apps.rs b/apps/wordcraft/src/default_apps.rs index ae0955fcee..2519f86256 100644 --- a/apps/wordcraft/src/default_apps.rs +++ b/apps/wordcraft/src/default_apps.rs @@ -54,6 +54,23 @@ pub fn identity() -> AppIdentity { mod tests { use super::*; + /// Every type the button claims is included in identity, and plain text/Markdown are never claimed. + #[test] + fn xdg_mime_sets_every_word_type_in_one_call() { + let id = identity(); + assert_eq!(id.desktop_id, "ai.storyteller.wordcraft.desktop"); + assert_eq!(id.registered_name, "WordCraft"); + for t in [ + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "application/msword", + "application/rtf", + "application/vnd.oasis.opendocument.text", + ] { + assert!(id.mime_types.iter().any(|a| a == t), "{t}"); + } + assert!(!id.mime_types.iter().any(|a| a == "text/plain" || a == "text/markdown"), "plain text and Markdown are never claimed"); + } + /// Every type the button claims is one the desktop entry declares, or desktops ignore it. #[test] fn the_desktop_entry_declares_every_claimed_type() { diff --git a/apps/wordcraft/src/launch_profile.rs b/apps/wordcraft/src/launch_profile.rs new file mode 100644 index 0000000000..4a0a2d5e27 --- /dev/null +++ b/apps/wordcraft/src/launch_profile.rs @@ -0,0 +1,170 @@ +//! Nightly-v1 bootstrap backed by `craft-nightly`. Selected before logging, preferences, fonts or +//! saved state. Stable launches retain their original arguments and directory policy. + +use std::ffi::{OsStr, OsString}; + +pub use craft_nightly::Profile; + +/// Returns the active launch profile for this process, defaulting to [`Profile::Stable`] before +/// `craft_nightly::prepare_launch` installs one. +pub fn current() -> &'static Profile { + static STABLE: Profile = Profile::Stable; + craft_nightly::current().unwrap_or(&STABLE) +} + +fn is_nightly_flag_token(arg: &OsStr) -> bool { + arg.to_str().is_some_and(|s| { + s == craft_nightly::LAUNCH_PROFILE_FLAG + || s == craft_nightly::PROFILE_ROOT_FLAG + || s.starts_with("--launch-profile=") + || s.starts_with("--profile-root=") + }) +} + +/// Returns `true` when `args` starts with nightly launch protocol flags followed by `--`. +/// `craft_nightly::parse_startup` consumes that `--`; preserving it lets `main.rs`'s +/// `split_at_delimiter` treat every argument after `--` as a document path. +pub fn had_launcher_separator(args: &[OsString]) -> bool { + if !args.first().is_some_and(|arg| is_nightly_flag_token(arg)) { + return false; + } + let mut idx = 0; + while let Some(arg) = args.get(idx) { + if arg == "--" { + return true; + } + if arg == craft_nightly::LAUNCH_PROFILE_FLAG || arg == craft_nightly::PROFILE_ROOT_FLAG { + idx += 2; + } else if arg.to_str().is_some_and(|s| s.starts_with("--launch-profile=") || s.starts_with("--profile-root=")) { + idx += 1; + } else { + break; + } + } + false +} + +/// Re-attaches the `--` separator when `craft_nightly` stripped one from an explicit launcher +/// header, leaving direct-launch arguments untouched. +pub fn passthrough_args(args: Vec, had_separator: bool) -> Vec { + if had_separator { std::iter::once(OsString::from("--")).chain(args).collect() } else { args } +} + +/// The root the Launcher hands a nightly on this platform, in that platform's own spelling: `C:\NightlyData\profiles\wordcraft` +/// on Windows, `/nightly-data/profiles/wordcraft` elsewhere. A test that fixtures the hand-off uses this rather than a +/// literal, because a root literal in the other platform's spelling is not absolute here and validation refuses it (#7849). +#[cfg(test)] +pub(crate) fn launcher_root() -> &'static str { + if cfg!(windows) { r"C:\NightlyData\profiles\wordcraft" } else { "/nightly-data/profiles/wordcraft" } +} + +#[cfg(test)] +mod tests { + use super::{had_launcher_separator, launcher_root, passthrough_args}; + use craft_nightly::{ + BuildFlavor, NIGHTLY_V1_CONTRACT, Profile, ProfileError, StartupOptions, canonical_profile_root, parse_startup, validate_and_prepare_root, + }; + use std::ffi::OsString; + use std::path::PathBuf; + + fn args(values: &[&str]) -> Vec { + values.iter().map(OsString::from).collect() + } + + fn absolute() -> &'static str { + launcher_root() + } + + fn nightly() -> Vec { + args(&["--launch-profile", NIGHTLY_V1_CONTRACT, "--profile-root", absolute(), "--"]) + } + + #[test] + fn stable_arguments_and_directory_policy_are_unchanged() { + let spec = crate::profile_root::spec(); + for argv in [args(&[]), args(&["--control", "7981", "a.docx"]), args(&["--", "--launch-profile", "file.docx"])] { + let had_sep = had_launcher_separator(&argv); + assert!(!had_sep); + let launch = parse_startup(BuildFlavor::Stable, &spec, argv.clone(), &StartupOptions::new()).unwrap(); + assert_eq!(launch.profile, Profile::Stable); + assert_eq!(passthrough_args(launch.passthrough_args, had_sep), argv); + } + } + + #[test] + fn direct_nightly_launch_resolves_canonical_root_and_preserves_user_arguments() { + let spec = crate::profile_root::spec(); + let expected_root = canonical_profile_root(spec.app_id).unwrap(); + let argv = args(&["--sample", "letter.docx"]); + let had_sep = had_launcher_separator(&argv); + assert!(!had_sep); + let launch = parse_startup(BuildFlavor::NightlyV1, &spec, argv.clone(), &StartupOptions::new()).unwrap(); + assert_eq!(launch.profile, Profile::NightlyV1(expected_root)); + assert_eq!(passthrough_args(launch.passthrough_args, had_sep), argv); + } + + #[test] + fn exact_version_and_root_are_parsed_without_reinterpreting_file_names() { + let spec = crate::profile_root::spec(); + let mut argv = nightly(); + argv.extend(args(&["--profile-root", "letter with spaces.docx"])); + let had_sep = had_launcher_separator(&argv); + assert!(had_sep); + let launch = parse_startup(BuildFlavor::NightlyV1, &spec, argv, &StartupOptions::new()).unwrap(); + assert_eq!(launch.profile, Profile::NightlyV1(PathBuf::from(absolute()))); + assert_eq!(passthrough_args(launch.passthrough_args, had_sep), args(&["--", "--profile-root", "letter with spaces.docx"])); + } + + #[test] + fn missing_duplicate_and_unknown_profile_arguments_are_refused() { + let spec = crate::profile_root::spec(); + for argv in [ + args(&["--launch-profile", NIGHTLY_V1_CONTRACT]), + args(&["--profile-root", absolute()]), + args(&["--launch-profile", "future-v2", "--profile-root", absolute(), "--"]), + args(&["--launch-profile", NIGHTLY_V1_CONTRACT, "--launch-profile", NIGHTLY_V1_CONTRACT, "--profile-root", absolute(), "--"]), + args(&["--launch-profile", NIGHTLY_V1_CONTRACT, "--profile-root", absolute(), "--profile-root", absolute(), "--"]), + args(&["--launch-profile", NIGHTLY_V1_CONTRACT, "--profile-root", "", "--"]), + ] { + assert!(parse_startup(BuildFlavor::NightlyV1, &spec, argv, &StartupOptions::new()).is_err()); + } + } + + /// #7849: `/nightly-data/...` carries no drive prefix and so is not absolute on Windows, and `C:\...` + /// is one relative name on Unix. A launch that carries the other platform's root spelling is refused + /// instead of run against a directory this platform never meant. + #[test] + fn a_root_absolute_only_in_the_other_platforms_spelling_is_refused() { + let spec = crate::profile_root::spec(); + let foreign = if cfg!(windows) { "/nightly-data/profiles/wordcraft" } else { r"C:\NightlyData\profiles\wordcraft" }; + let err = validate_and_prepare_root(std::path::Path::new(foreign), &spec).unwrap_err(); + assert!(matches!(err, ProfileError::RelativeProfileRoot(_)), "the other platform's root spelling must not stand in: {foreign}"); + } + + #[test] + fn launcher_and_plain_version_queries_are_recognized() { + let spec = crate::profile_root::spec(); + let pair = &["--launch-profile", NIGHTLY_V1_CONTRACT, "--profile-root", absolute()]; + let reversed = &["--profile-root", absolute(), "--launch-profile", NIGHTLY_V1_CONTRACT]; + for flag in ["--version", "-V"] { + let plain = parse_startup(BuildFlavor::NightlyV1, &spec, args(&[flag]), &StartupOptions::new()).unwrap(); + assert!(plain.is_version_query()); + for form in [pair, reversed] { + let mut argv = args(form); + argv.push(flag.into()); + let direct = parse_startup(BuildFlavor::NightlyV1, &spec, argv.clone(), &StartupOptions::new()).unwrap(); + assert!(direct.is_version_query()); + argv.push("letter with spaces.docx".into()); + let with_document = parse_startup(BuildFlavor::NightlyV1, &spec, argv, &StartupOptions::new()).unwrap(); + assert!(!with_document.is_version_query()); + assert_eq!(with_document.passthrough_args, args(&[flag, "letter with spaces.docx"])); + + let mut with_sep = args(form); + with_sep.push("--".into()); + with_sep.push(flag.into()); + let separated = parse_startup(BuildFlavor::NightlyV1, &spec, with_sep, &StartupOptions::new()).unwrap(); + assert!(separated.is_version_query()); + } + } + } +} diff --git a/apps/wordcraft/src/main.rs b/apps/wordcraft/src/main.rs index 597eaeb7fd..e9f87e64a9 100644 --- a/apps/wordcraft/src/main.rs +++ b/apps/wordcraft/src/main.rs @@ -14,9 +14,18 @@ #[cfg(target_os = "linux")] mod appimage_env; +#[cfg(test)] +mod build_channel; +mod build_flavor; mod control_server; mod default_apps; +mod launch_profile; +#[cfg(target_os = "macos")] +mod native_menu; +mod nightly_session; mod prefs; +mod process_identity; +mod profile_root; mod region; use std::path::PathBuf; @@ -31,7 +40,7 @@ use craft::platform::appearance::SystemReader; use craft::platform::clipboard::{Clipboard, ClipboardImage, SystemClipboard}; use craft::platform::default_app::{DefaultApp, DefaultAppError}; use craft::platform::logs::{self, LogNames, crash}; -use craft::platform::open::{DropTarget, DroppedFile, FileIntake, IntakeSender}; +use craft::platform::open::{DroppedFile, FileIntake, IntakeSender}; use craft::print::spool::Spool; use craft::settings::SharedSettings; use craft::ui::InstallSpec; @@ -47,6 +56,8 @@ use wordcraft_ui_egui::{Services, WordApp, prefs::Prefs}; /// exit, the print spool it waits for at exit and the control server it stops at exit. struct App { app: WordApp, + #[cfg(target_os = "macos")] + native_menu: Option, /// The native panels behind the file service the app reaches through `Host::files`. panels: FilePanels, /// Feeds the files dropped on the window into the app's intake (`Services::intake`), the one @@ -58,13 +69,28 @@ struct App { spool: Spool, /// The control server, when `--control` started one; it removes the token file it made. control: Option, + /// The app binary's last step as the app leaves, run once at the end of `finish` (a Nightly + /// quit ends the process inside AppKit's terminate, after eframe's `on_exit`). + exit: Option>, } impl App { + fn before_input(&mut self, ctx: &egui::Context) { + #[cfg(target_os = "macos")] + if let Some(menu) = &mut self.native_menu { + menu.poll(ctx); + } + embed::before_input(ctx, |out| self.app.frame_input(out)); + } + /// One frame's logic: what the OS asked, the app, its file dialogs, then the root window's close /// path. Without `frame` (a test over no window) the dialogs have no parent window. fn logic_pass(&mut self, ctx: &egui::Context, frame: Option<&eframe::Frame>) { self.app.logic(ctx); + #[cfg(target_os = "macos")] + if let Some(menu) = &mut self.native_menu { + native_menu::update(menu, &mut self.app, ctx); + } self.panels.pump_with(self.app.dialog_host_mut(), frame); // A quit that waits for nothing (the documents are answered for) closes the root window. if self.app.quit_requested && !self.app.printing.busy() { @@ -95,7 +121,12 @@ impl App { if let Some(control) = self.control.take() { control.shut_down(); } - self.app.start_pending_update(); + if !launch_profile::current().is_nightly() { + self.app.start_pending_update(); + } + if let Some(exit) = self.exit.take() { + exit(); + } } } @@ -106,9 +137,9 @@ impl eframe::App for App { // Once per frame, before any pass; the files stay in `raw` for the runtime's own reading. let files = dropped_files(raw); if !files.is_empty() { - self.drops.dropped(files, DropTarget::Elsewhere); + self.drops.dropped(files); } - embed::before_input(ctx, |out| self.app.frame_input(out)); + self.before_input(ctx); } fn logic(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) { self.logic_pass(ctx, Some(frame)); @@ -121,6 +152,21 @@ impl eframe::App for App { } } +/// Files dropped on a document window. eframe hands `raw_input_hook` only the root's and deferred +/// viewports' input, and document windows are immediate viewports (every one under the windowless +/// root), so their drops come through this hook. It runs first and takes the batch, so nothing reads +/// it twice. +struct ChildDrops(IntakeSender); + +impl eframe::ViewportHooks for ChildDrops { + fn raw_input(&self, _ctx: &egui::Context, raw: &mut egui::RawInput) { + if raw.viewport_id != egui::ViewportId::ROOT && !raw.dropped_files.is_empty() { + self.0.dropped(dropped_files(raw)); + raw.dropped_files.clear(); + } + } +} + /// The files dropped in this frame's input, as the intake carries them: a file with a path by its /// path, a file without one by its bytes. fn dropped_files(raw: &egui::RawInput) -> Vec { @@ -202,10 +248,12 @@ type MakeDefault = Box Result>; /// What the app takes from its host beyond the runtime: File › Print through the system spooler, /// personal templates (#2852, made on first save in `Templates` in the settings folder), and making /// WordCraft the default app for Word documents (#295; macOS has no way to, so no button there). -fn services(spool: Spool, intake: FileIntake) -> Services { +fn services(spool: Spool, intake: FileIntake, nightly: bool) -> Services { + // Nightly never claims the stable app's file associations: the button would rewrite the same + // OS registration the stable WordCraft owns. #[cfg(any(unix, windows))] - let make_default_app = - (!cfg!(target_os = "macos")).then(|| -> MakeDefault { Box::new(|| craft::platform::default_app::make_default(&default_apps::identity())) }); + let make_default_app = (!cfg!(target_os = "macos") && !nightly) + .then(|| -> MakeDefault { Box::new(|| craft::platform::default_app::make_default(&default_apps::identity())) }); #[cfg(not(any(unix, windows)))] let make_default_app: Option = None; Services { @@ -256,11 +304,35 @@ fn build_sha() -> &'static str { option_env!("WORDCRAFT_BUILD_SHA").map(|s| s.get(..8).unwrap_or(s)).unwrap_or("dev") } +/// Split the command line at its first `--`: the options before it, the documents after it. The +/// Launcher's nightly hand-off arrives as `--` followed by the file names (`launch_profile::parse` +/// puts that separator first), so it is dropped here rather than opened as a document. +fn split_at_delimiter(args: Vec) -> (Vec, Vec) { + match args.iter().position(|a| a == "--") { + Some(i) => { + let mut options = args; + let files = options.split_off(i + 1); + options.pop(); + (options, files) + } + None => (args, Vec::new()), + } +} + +/// The documents to open, in the order the command line gave them: the words before `--` that the flag +/// loop kept, then the ones after it. The separator moves no document, and the Launcher, which sends +/// none before it, opens just its own file names in order. +fn documents_to_open(before: Vec, after: Vec) -> Vec { + let mut documents = before; + documents.extend(after); + documents +} + /// The arguments as text, and apart the files whose names aren't valid Unicode, such as a Latin-1 /// one (#1440). A `--control` port, a token or a token file that isn't is an error. -fn text_args() -> (Vec, Vec) { +fn text_args(arguments: Vec) -> (Vec, Vec) { let (mut args, mut files) = (Vec::new(), Vec::new()); - for (i, a) in std::env::args_os().skip(1).enumerate() { + for (i, a) in arguments.into_iter().enumerate() { match a.into_string() { Ok(a) => args.push(a), Err(a) if args.last().is_some_and(|p| matches!(p.as_str(), "--control" | "--control-token" | "--control-token-file")) => { @@ -318,18 +390,152 @@ fn complain(message: std::fmt::Arguments<'_>) { let _ = std::io::Write::write_fmt(&mut std::io::stderr(), format_args!("wordcraft: {message}\n")); } +fn initialize_nightly_process_identity() -> Result<(), process_identity::IdentityError> { + process_identity::initialize( + build_flavor::COMPILED == build_flavor::BuildFlavor::NightlyV1, + wordcraft_ui_egui::os_window::id_for(wordcraft_ui_egui::os_window::LaunchIdentity::NightlyV1), + ) +} + +/// Whether a refusal may also open a native message box. Standard error always carries the reason; +/// this only adds a box where one renders without the app's event loop. Never on macOS: rfd's alert +/// there needs the AppKit run loop this start has not reached, so a refused nightly launch hung in +/// an invisible modal instead of exiting (GridCraft Mac smoke, 2026-11-26). +fn refusal_dialog(flavor: build_flavor::BuildFlavor, desktop_session: bool, macos: bool) -> bool { + build_flavor::needs_native_error(flavor, desktop_session) && !macos +} + +/// Tell the person why a Launcher launch was refused: on standard error always, and with a native +/// message box on a desktop session whose modal renders without the app's run loop (Windows, +/// X11/Wayland) — a Launcher start has no terminal to read standard error from, and on macOS a modal +/// before the event loop never appears. +fn report_launch_profile_error(error: &str) { + complain(format_args!("launch profile: {error}")); + let desktop_session = cfg!(windows) + || cfg!(target_os = "macos") + || (cfg!(target_os = "linux") && ["DISPLAY", "WAYLAND_DISPLAY"].into_iter().any(|key| std::env::var_os(key).is_some_and(|v| !v.is_empty()))); + if refusal_dialog(build_flavor::COMPILED, desktop_session, cfg!(target_os = "macos")) { + if let Err(identity) = initialize_nightly_process_identity() { + complain(format_args!("launch profile: {identity}")); + return; + } + let _ = rfd::MessageDialog::new() + .set_title("WordCraft Nightly") + .set_description(error) + .set_level(rfd::MessageLevel::Error) + .set_buttons(rfd::MessageButtons::Ok) + .show(); + } +} + +/// Select the immutable launch profile before any startup service or side effect. +fn prepare_launch() -> Option> { + // The launch profile is decided before logging, crash handling, the update helper, + // fonts, preferences or the settings folder. + let argv: Vec<_> = std::env::args_os().skip(1).collect(); + // Plain `--version` / `-V` on nightly: answered before root resolution, validation, + // process identity, IPC or any window. + if build_flavor::COMPILED == build_flavor::BuildFlavor::NightlyV1 && build_flavor::version_query(&argv) { + let line = build_flavor::version(build_flavor::COMPILED, env!("WORDCRAFT_BUILT_VERSION")); + let _ = std::io::Write::write_all(&mut std::io::stdout(), format!("{line}\n").as_bytes()); + return None; + } + let had_separator = launch_profile::had_launcher_separator(&argv); + let early = craft_nightly::prepare_launch(build_flavor::COMPILED, &profile_root::spec(), argv, &craft_nightly::StartupOptions::new()) + .unwrap_or_else(|error| { + report_launch_profile_error(&error.to_string()); + std::process::exit(2) + }); + // Launcher `--launch-profile nightly-v1 --profile-root [--] --version` / `-V`: + // `craft_nightly::prepare_launch` skips root validation and profile installation for + // version queries, so answer and exit before any startup side effect. + if build_flavor::COMPILED == build_flavor::BuildFlavor::NightlyV1 && early.is_version_query() { + let line = build_flavor::version(build_flavor::COMPILED, env!("WORDCRAFT_BUILT_VERSION")); + let _ = std::io::Write::write_all(&mut std::io::stdout(), format!("{line}\n").as_bytes()); + return None; + } + if let Err(error) = initialize_nightly_process_identity() { + report_launch_profile_error(&error.to_string()); + std::process::exit(2); + } + let identity = if early.profile.is_nightly() { + wordcraft_ui_egui::os_window::LaunchIdentity::NightlyV1 + } else { + wordcraft_ui_egui::os_window::LaunchIdentity::Stable + }; + if let Err(error) = wordcraft_ui_egui::os_window::select_identity(identity) { + report_launch_profile_error(&error); + std::process::exit(2); + } + // One data root for everything the app keeps: preferences, window place, logs, recovery, + // fonts, templates, dictionaries and control token files all come from it. + if let Some(root) = launch_profile::current().root() + && let Err(error) = wordcraft_control_key::use_settings_dir(root.to_path_buf()) + { + report_launch_profile_error(&error); + std::process::exit(2); + } + Some(launch_profile::passthrough_args(early.passthrough_args, had_separator)) +} + +/// Runs the app with the windowless root when `windowless` is set, and with the visible root when it is not. eframe +/// refuses a windowless root on a session that cannot run it before it calls the creator, which then stays in its +/// cell for a retry with the visible root: the app always starts. +fn run_with_visible_root_fallback( + creator: eframe::AppCreator<'static>, + windowless: Arc, + mut options: eframe::NativeOptions, +) -> eframe::Result { + use std::sync::atomic::Ordering::Relaxed; + let creator = std::rc::Rc::new(std::cell::RefCell::new(Some(creator))); + let name = wordcraft_ui_egui::os_window::name_for(wordcraft_ui_egui::os_window::identity()); + let run = |options: eframe::NativeOptions| { + let creator = creator.clone(); + eframe::run_native( + name, + options, + Box::new(move |cc| match creator.borrow_mut().take() { + Some(create) => create(cc), + None => Err("the app was already created".into()), + }), + ) + }; + let on = windowless.load(Relaxed); + // The clone keeps no event-loop hook, which only the X11 start sets and that start is windowed. + let mut visible_root = on.then(|| options.clone()); + if on { + options.root_viewport_mode = eframe::RootViewportMode::Windowless; + } + let result = run(options); + if let Err(eframe::Error::UnsupportedConfiguration(reason)) = &result + && let Some(options) = visible_root.take() + && creator.borrow().is_some() + { + log::warn!("windowless root unavailable ({reason}); starting with a visible root window"); + windowless.store(false, Relaxed); + return run(options); + } + result +} + /// Parses the command line, installs logging and the panic hook, restores preferences and window /// geometry, opens requested documents or the Start screen, starts the control server when /// asked, and runs the eframe event loop. fn main() -> eframe::Result { // Windows: the print helper is a copy of this program that runs one job in its own process. + // It reads only its own job folder, so it runs before the launch profile is parsed: a Nightly + // wants a profile on every start, and the helper must print without one. #[cfg(windows)] if let Some(code) = craft::print::spool::isolated::helper_main() { std::process::exit(code); } + let Some(arguments) = prepare_launch() else { return Ok(()) }; // Windows: the update helper is a copy of this program started with `--finish-update`. + // A Nightly never updates itself: the Launcher owns its updates. #[cfg(windows)] - if let Some(result) = craft::update::self_update::finish(&wordcraft_ui_egui::UPDATE_APP, &std::env::args_os().skip(1).collect::>()) { + if !launch_profile::current().is_nightly() + && let Some(result) = craft::update::self_update::finish(&wordcraft_ui_egui::UPDATE_APP, &arguments) + { std::process::exit(i32::from(result.is_err())); } // Linux: before anything reads another program's AppImage variables, or a thread starts (#5653). @@ -341,6 +547,9 @@ fn main() -> eframe::Result { let updates_unsafe = start_over_failed.is_some(); #[cfg(not(target_os = "linux"))] let updates_unsafe = false; + // Before any thread or logger starts: re-exec on Linux glibc with MALLOC_TRIM_THRESHOLD_ + // fixed so large freed document/render buffers return to the OS. + wordcraft_engine::malloc_tuning::apply(); // First, so the panic hook (set once, by this call; the later one only gives it the crash-log // folder) and every start-up warning are recorded. let logger = logs::install(LogNames::new("wordcraft")); @@ -350,11 +559,16 @@ fn main() -> eframe::Result { log::error!("couldn't start again without another program's AppImage variables, so the self-update is off in this window: {e}"); } let mut flags = ControlOptions::default(); - let mut files = Vec::new(); let mut sample = false; - let (args, other_files) = text_args(); - // Only macOS (Finder / LaunchServices) adds these; elsewhere `-NS…` could be a real file name. + let (args, other_files) = text_args(arguments); + // The Launcher's own hand-off: `--` ends the options, so nothing after it is read as one and + // the separator itself never becomes a document. + let (args, after_separator) = split_at_delimiter(args); + // Only macOS (Finder / LaunchServices) adds these, and only to the options: a Finder launch carries + // no separator for them to sit after, and the Launcher starts the app itself, so a document whose + // name merely looks like one of these (`-NSNotes.docx`) is still opened (#7849 review). let args = if cfg!(target_os = "macos") { without_launch_args(args) } else { args }; + let mut documents: Vec = Vec::new(); let mut bad_control: Option> = None; let mut missing_value: Option<&'static str> = None; let mut args = args.into_iter().peekable(); @@ -388,6 +602,7 @@ fn main() -> eframe::Result { }, "--sample" => sample = true, "--version" => { + // A nightly build reported its channel line before this parser ran. println!("wordcraft {} ({})", env!("CARGO_PKG_VERSION"), build_sha()); return Ok(()); } @@ -396,9 +611,12 @@ fn main() -> eframe::Result { let _ = std::io::Write::write_all(&mut std::io::stdout(), USAGE.as_bytes()); return Ok(()); } - _ => files.push(a), + _ => documents.push(a), } } + // After the loop, so a document before `--` opens before the ones after it (a stable launch's + // `a.docx -- b.docx` used to be reversed when the Launcher's list was the one collected first). + let files = documents_to_open(documents, after_separator); // After the loop, so `--version` later on the line still wins. if let Some(port) = bad_control { let got = port.map(|p| format!(", got {p:?}")).unwrap_or_default(); @@ -422,6 +640,13 @@ fn main() -> eframe::Result { complain(format_args!("--control needs a port number from 1 to 65535, got \"0\"")); std::process::exit(2); } + // Nightly runs the Launcher's documents only: no control server, token file or automation + // switch, and none inherited from a stable launch's environment. + if launch_profile::current().is_nightly() && (control.port.is_some() || control.token.is_some() || control.token_file.is_some()) { + complain(format_args!("a WordCraft Nightly window does not start a control server; open documents through ArtCraft Launcher")); + std::process::exit(2); + } + let nightly = launch_profile::current().is_nightly(); let settings_dir = wordcraft_control_key::settings_dir(); // The log file lives in the settings directory, next to the preferences; opened after the // arguments, so `--version` leaves no file behind. Records logged until now are written to it @@ -440,10 +665,16 @@ fn main() -> eframe::Result { None => logger.stderr_only(), } } + // A Nightly window always carries its own id; a stable one keeps the Flatpak sandbox's id + // when it runs inside one (so docks match the flatpak's desktop file). + let app_id = match launch_profile::current().root() { + Some(_) => wordcraft_ui_egui::os_window::app_id().to_string(), + None => std::env::var("FLATPAK_ID").ok().filter(|id| !id.is_empty()).unwrap_or_else(|| wordcraft_ui_egui::os_window::APP_ID.to_string()), + }; let mut options = eframe::NativeOptions { viewport: egui::ViewportBuilder::default() - .with_title("WordCraft") - .with_app_id("ai.storyteller.wordcraft") + .with_title(wordcraft_ui_egui::os_window::name_for(wordcraft_ui_egui::os_window::identity())) + .with_app_id(app_id) .with_inner_size([1440.0, 920.0]) .with_min_inner_size(wordcraft_ui_egui::window_geometry::MIN_SIZE) .with_drag_and_drop(true) @@ -500,107 +731,184 @@ fn main() -> eframe::Result { // Registered before the event loop starts, so it catches the Finder event that launched us as // well as later ones. Lives until the event loop returns. let drops = intake.sender(); + options.viewport_hooks = Some(Arc::new(ChildDrops(drops.clone()))); #[cfg(target_os = "macos")] let _apple_events = craft::platform::open::apple_events::install(sender); #[cfg(not(target_os = "macos"))] drop(sender); + // Nightly's own health record: one owner per profile, cleared only by a controlled return. + let (nightly_record, health_unavailable) = match nightly_session::Session::begin_with_health( + launch_profile::current().root(), + env!("WORDCRAFT_BUILT_VERSION"), + option_env!("WORDCRAFT_BUILD_SHA"), + ) { + Ok(pair) => pair, + Err(error) => { + log::warn!("Nightly session health is unavailable: {error}"); + (None, launch_profile::current().is_nightly()) + } + }; + let session_health_warning: Option = health_unavailable.then(|| { + "WordCraft Nightly could not record session health in its private profile. You can still edit, but abnormal-exit detection is unavailable." + .to_string() + }); + let previous_nightly_unclean = nightly_record.as_ref().is_some_and(nightly_session::Session::previous_unclean); + let nightly_watch: nightly_session::Shared = Arc::new(Mutex::new(nightly_record)); + let unclean_notice_shown = Arc::new(std::sync::atomic::AtomicBool::new(false)); + // The window body and its exit hook each take a clone of the flag; the return path keeps the + // other, so a start that created no window can still finish the record. + let session_for_exit = nightly_watch.clone(); + let noticed_for_exit = unclean_notice_shown.clone(); + let noticed_in_window = unclean_notice_shown.clone(); let exit_settings = settings.clone(); - let result = eframe::run_native( - "WordCraft", - options, - Box::new(move |cc| { - let ctx = cc.egui_ctx.clone(); - let _ = repaint.set(ctx.clone()); - let wake = { - let ctx = ctx.clone(); - move || ctx.request_repaint() - }; - // The interface language: the saved choice, else the system's. - let lang = wordcraft_ui_egui::i18n::Lang::from_pref(&settings.lock().get().language); - let (file_service, panels) = FileService::new(Wake::new(wake.clone())); - let host = Arc::new( - Host::builder(wordcraft_ui_egui::APP) - .i18n(wordcraft_ui_egui::i18n::catalogs()) - .files(Arc::new(file_service)) - .settings(Arc::new(settings.clone())) - .lang(lang.craft_lang()) - .build(), - ); - let shell = ShellInfo::current().backend(if x11 { Backend::X11 } else { Backend::from_env() }); - let spec = InstallSpec::new(shell, Arc::new(SystemWindows)) - .app_id("ai.storyteller.wordcraft") - .system(SystemReader::start(wake)) - .clipboard(Clipboard::new(SystemClipboard::new().decoder(decode_png))) - .placement(placement); - // PLAN: assumed `wordcraft_ui_egui::ui_fonts` re-exports sh.A10's `app::fonts::ui_fonts` (`mod app` is private; app-hub/shell-w11). - embed::install(&ctx, spec, &wordcraft_ui_egui::ui_fonts(lang)).map_err(|e| format!("the runtime could not be installed: {e}"))?; - // The system region picks the new document's paper, the units and the decimal - // separator (#838). - let region = region::system(); - let doc = if sample { wordcraft_engine::sample::sample_document() } else { wordcraft_engine::blank_document(®ion) }; - let mut session = Session::new(doc); - session.system_region = region; - // The custom dictionary's words (#40) count as loaded settings. - if prefs::enabled() - && let Some(path) = prefs::user_dict_path() - { - prefs::load_user_dictionary(&mut session, &settings, path); - } - let spool = Spool::new(host.jobs_shared().clone()); - let mut app = WordApp::new(session, services(spool.clone(), intake)).with_host(host).with_settings(settings.clone()); - // PLAN: writer note 9 puts `with_settings` after `with_control`; it comes first here because - // the region check below reads the saved region the settings apply. - if std::env::var("WORDCRAFT_FILE_DIALOG").is_ok_and(|v| v.trim().eq_ignore_ascii_case("builtin")) { - app = app.with_fallback_chooser(true); + // The root window is never shown (ADR 0001): eframe runs a windowless root and every document is a child + // window. X11, XWayland and BSD on X11 cannot, so they keep the visible root (the ADR's amendment). The mode + // is read by the app creator, which runs once the mode is settled. + let windowless = Arc::new(std::sync::atomic::AtomicBool::new(!x11)); + let windowless_in_app = windowless.clone(); + let creator: eframe::AppCreator<'static> = Box::new(move |cc| { + let ctx = cc.egui_ctx.clone(); + let _ = repaint.set(ctx.clone()); + let wake = { + let ctx = ctx.clone(); + move || ctx.request_repaint() + }; + // The interface language: the saved choice, else the system's. + let lang = wordcraft_ui_egui::i18n::Lang::from_pref(&settings.lock().get().language); + let (file_service, panels) = FileService::new(Wake::new(wake.clone())); + let host = Arc::new( + Host::builder(wordcraft_ui_egui::APP) + .i18n(wordcraft_ui_egui::i18n::catalogs()) + .files(Arc::new(file_service)) + .settings(Arc::new(settings.clone())) + .lang(lang.craft_lang()) + .build(), + ); + let shell = ShellInfo::current().backend(if x11 { Backend::X11 } else { Backend::from_env() }); + let mut spec = InstallSpec::new(shell, Arc::new(SystemWindows)) + .app_id(wordcraft_ui_egui::os_window::app_id()) + .system(SystemReader::start(wake)) + .clipboard(Clipboard::new(SystemClipboard::new().decoder(decode_png))) + .placement(placement); + // The runtime and eframe must agree on the root. + if windowless_in_app.load(std::sync::atomic::Ordering::Relaxed) { + spec = spec.windowless_root(); + } + // PLAN: assumed `wordcraft_ui_egui::ui_fonts` re-exports sh.A10's `app::fonts::ui_fonts` (`mod app` is private; app-hub/shell-w11). + embed::install(&ctx, spec, &wordcraft_ui_egui::ui_fonts(lang)).map_err(|e| format!("the runtime could not be installed: {e}"))?; + // The system region picks the new document's paper, the units and the decimal + // separator (#838). + let region = region::system(); + let doc = if sample { wordcraft_engine::sample::sample_document() } else { wordcraft_engine::blank_document(®ion) }; + let mut session = Session::new(doc); + session.system_region = region; + // The custom dictionary's words (#40) count as loaded settings. + if prefs::enabled() + && let Some(path) = prefs::user_dict_path() + { + prefs::load_user_dictionary(&mut session, &settings, path); + } + let spool = Spool::new(host.jobs_shared().clone()); + let mut app = WordApp::new(session, services(spool.clone(), intake, nightly)).with_host(host).with_settings(settings.clone()); + // Drawn by the processor (WARP, llvmpipe; #2221), animations that follow the system stop. + if let Some(state) = &cc.wgpu_render_state { + let info = state.adapter.get_info(); + let software = info.device_type == eframe::wgpu::DeviceType::Cpu; + if software { + log::warn!("graphics: drawing in software on {} ({:?}): animations that follow the system are off", info.name, info.backend); } + app.set_software_drawing(software); + } + // PLAN: writer note 9 puts `with_settings` after `with_control`; it comes first here because + // the region check below reads the saved region the settings apply. + if std::env::var("WORDCRAFT_FILE_DIALOG").is_ok_and(|v| v.trim().eq_ignore_ascii_case("builtin")) { + app = app.with_fallback_chooser(true); + } + if nightly { + // The Launcher installs Nightly; Help › Check for Updates says so instead. + app.use_launcher_updates(); + } else { app.set_startup_update_check(true); // After the preferences, so the reason it gives is in the interface language. if updates_unsafe { app.disable_self_update(); } - // Language packs from the suite's font store; an Install click is the person's own. - wordcraft_engine::packs::use_font_store(true); - // A region chosen in File › Options replaces the system's for the first blank - // document too (#838). - if !sample && app.session.prefs.region.is_some() { - let doc = app.session.blank_document(); - app.replace_startup_document(doc); + } + // Language packs from the suite's font store; an Install click is the person's own. + // Nightly keeps its own store in the profile, so a pack installed there is not a + // change to the stable apps' shared fonts. + match launch_profile::current().root() { + Some(root) => wordcraft_engine::packs::use_font_store_in(root.join("FontStore"), true), + None => { + wordcraft_engine::packs::use_font_store(true); } - app.tell_about_font_downloads(); - if prefs::enabled() - && let Some(dir) = wordcraft_control_key::settings_dir() - { - let ctx = ctx.clone(); - if let Err(e) = app.session.enable_recovery(dir.join("recovery"), Arc::new(move || ctx.request_repaint())) { - log::warn!("local recovery unavailable: {e}"); - } + } + // A region chosen in File › Options replaces the system's for the first blank + // document too (#838). + if !sample && app.session.prefs.region.is_some() { + let doc = app.session.blank_document(); + app.replace_startup_document(doc); + } + app.tell_about_font_downloads(); + if prefs::enabled() + && let Some(dir) = wordcraft_control_key::settings_dir() + { + let ctx = ctx.clone(); + if let Err(e) = app.session.enable_recovery(dir.join("recovery"), Arc::new(move || ctx.request_repaint())) { + log::warn!("local recovery unavailable: {e}"); } - let mut control_server = None; - if let Some(port) = control.port - && let Some((rx, started)) = - control_server::start(&control, port, WindowHost::of(&ctx), wordcraft_control_key::settings_dir().as_deref()) - { - app = app.with_control(ControlChannel::new(rx)); - control_server = Some(started); + } + let mut control_server = None; + if !nightly + && let Some(port) = control.port + && let Some((rx, started)) = control_server::start(&control, port, WindowHost::of(&ctx), wordcraft_control_key::settings_dir().as_deref()) + { + app = app.with_control(ControlChannel::new(rx)); + control_server = Some(started); + } + // Nothing to open (no files, no sample, no control channel driving the editor): start + // on File › Home, as Word does (#766), unless the Start screen option is off. Files + // the OS hands over later open on top of it and close it. + if files.is_empty() && other_files.is_empty() && !sample && control.port.is_none() { + app.start_screen(); + } + // A Word template named here starts a new document based on it (#3433). + for f in files { + if let Err(e) = app.open_from_platform(&f, None) { + app.report_open_failure(&f, &e); } - // Nothing to open (no files, no sample, no control channel driving the editor): start - // on File › Home, as Word does (#766), unless the Start screen option is off. Files - // the OS hands over later open on top of it and close it. - if files.is_empty() && other_files.is_empty() && !sample && control.port.is_none() { - app.start_screen(); - } - // A Word template named here starts a new document based on it (#3433). - for f in files { - if let Err(e) = app.open_from_platform(&f, None) { - app.report_open_failure(&f, &e); - } - } - for f in other_files { - open_non_unicode(&mut app, &f); - } - Ok(Box::new(App { app, panels, drops, settings, spool, control: control_server })) - }), - ); + } + for f in other_files { + open_non_unicode(&mut app, &f); + } + // The personal agent files, the session record and the control token all live in the + // profile; the app's own services are built with the nightly rule in mind. + if let Some(warning) = &session_health_warning { + app.status_long(warning.clone()); + } + if previous_nightly_unclean { + app.status_long( + "The previous WordCraft Nightly session did not finish normally. You can report a problem from Help › About. No diagnostics have been sent.", + ); + noticed_in_window.store(true, std::sync::atomic::Ordering::Relaxed); + } + Ok(Box::new(App { + #[cfg(target_os = "macos")] + native_menu: native_menu::install(&ctx, &app), + app, + panels, + drops, + settings, + spool, + control: control_server, + exit: Some(Box::new(move || { + nightly_session::finish_once(&session_for_exit, noticed_for_exit.load(std::sync::atomic::Ordering::Relaxed)); + })), + })) + }); + let result = run_with_visible_root_fallback(creator, windowless, options); + // The exit hook has run; this is the no-op fallback for a start that created no window. + nightly_session::finish_once(&nightly_watch, unclean_notice_shown.load(std::sync::atomic::Ordering::Relaxed)); // The app is dropped by now: whatever it saved on the way out is in the store. if let Err(e) = exit_settings.lock().flush() { log::warn!("preferences: {e}"); @@ -802,15 +1110,30 @@ mod smoke { let (intake, sender) = FileIntake::new(Wake::new(|| {})); let drops = intake.sender(); let session = Session::new(wordcraft_doc::Document::new()); - let app = WordApp::new(session, services(spool.clone(), intake)).with_host(host).with_settings(settings.clone()); - Run { app: App { app, panels, drops, settings, spool, control: None }, frames, ctx, sender } + let app = WordApp::new(session, services(spool.clone(), intake, false)).with_host(host).with_settings(settings.clone()); + Run { + app: App { + #[cfg(target_os = "macos")] + native_menu: None, + app, + panels, + drops, + settings, + spool, + control: None, + exit: None, + }, + frames, + ctx, + sender, + } } /// One frame as eframe runs it: the input hook once, the logic once, the UI per pass. /// Returns whether the frame sent a close command. fn step(&mut self, events: Vec) -> bool { let Run { app, frames, ctx, .. } = self; - embed::before_input(ctx, |out| app.app.frame_input(out)); + app.before_input(ctx); let mut first = true; frames.frame_without_input(events, |ui| { if std::mem::take(&mut first) { @@ -833,7 +1156,7 @@ mod smoke { /// cancelling the close. fn close_request_is_let_through(&mut self) -> bool { let Run { app, ctx, .. } = self; - embed::before_input(ctx, |out| app.app.frame_input(out)); + app.before_input(ctx); let mut input = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1440.0, 920.0))), ..Default::default() }; input.viewports.insert(egui::ViewportId::ROOT, egui::ViewportInfo { events: vec![egui::ViewportEvent::Close], ..Default::default() }); @@ -867,7 +1190,7 @@ mod smoke { std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("dropped.txt"); std::fs::write(&path, "Dropped words").unwrap(); - run.sender.dropped(vec![DroppedFile { path: Some(path), name: "dropped.txt".into(), bytes: None }], DropTarget::Elsewhere); + run.sender.dropped(vec![DroppedFile { path: Some(path), name: "dropped.txt".into(), bytes: None }]); run.settle(); assert!(run.app.app.session.doc.plain_text(wordcraft_doc::StoryRef::Body).contains("Dropped words"), "the dropped file opened"); let _ = std::fs::remove_dir_all(dir); @@ -907,4 +1230,121 @@ mod smoke { assert!(closed, "Don't Save lets the close through"); } } + + /// A native menu selection reaches the hosted About dialog, including its credits, and Escape + /// dismisses it without changing the document. The fake backend supplies the OS selection. + #[cfg(target_os = "macos")] + #[test] + fn native_about_shows_credits_and_closes_with_escape() { + use craft::menu::{Backend, Dispatch, Event, ItemRole, MenuBar, NativeMenu}; + + struct Selection(Vec); + impl Backend for Selection { + fn sync(&mut self, _: &MenuBar) {} + fn attach(&mut self, _: Dispatch) {} + fn drain(&mut self) -> Vec { + std::mem::take(&mut self.0) + } + } + + let mut run = Run::new(); + run.app.app.start_screen(); + run.settle(); + let before = run.app.app.session.doc.plain_text(wordcraft_doc::StoryRef::Body); + let layout = native_menu::layout(&str::to_owned); + let about = layout.bar.items().into_iter().find(|item| item.role == Some(ItemRole::About)).unwrap().command.clone(); + run.app.native_menu = Some(NativeMenu::new(Box::new(Selection(vec![Event::Click(about)])))); + run.settle(); + assert!(run.app.app.dialog_host_mut().shows_modal()); + let tree = run.frames.tree(); + for label in ["WordCraft", "Contributors", "Models", "Language data"] { + assert!(tree.keys().into_iter().any(|key| craft::ui::testing::access::name(&tree, key) == Some(label)), "About exposes {label}"); + } + run.step(vec![egui::Event::Key { + key: egui::Key::Escape, + physical_key: None, + pressed: true, + repeat: false, + modifiers: egui::Modifiers::NONE, + }]); + run.settle(); + assert!(run.app.app.dialog_host_mut().is_empty(), "Escape dismisses About"); + assert_eq!(run.app.app.session.doc.plain_text(wordcraft_doc::StoryRef::Body), before); + } +} + +#[cfg(test)] +mod command_line_tests { + use super::{documents_to_open, split_at_delimiter}; + + /// The argv the Launcher starts a nightly with, as `prepare_launch` hands it on. The root is the one this + /// platform would pass: `/nightly-data/...` has no drive prefix, so on Windows validation rightly refuses it. + fn launcher_argv(tail: &[&str]) -> Vec { + let mut argv: Vec = ["--launch-profile", "nightly-v1", "--profile-root", super::launch_profile::launcher_root(), "--"] + .iter() + .map(std::ffi::OsString::from) + .collect(); + argv.extend(tail.iter().map(std::ffi::OsString::from)); + let had_separator = super::launch_profile::had_launcher_separator(&argv); + let launch = craft_nightly::parse_startup( + crate::build_flavor::BuildFlavor::NightlyV1, + &crate::profile_root::spec(), + argv, + &craft_nightly::StartupOptions::new(), + ) + .unwrap(); + super::launch_profile::passthrough_args(launch.passthrough_args, had_separator).iter().map(|a| a.to_string_lossy().into_owned()).collect() + } + + #[test] + fn the_launchers_separator_is_never_a_document() { + let (options, files) = split_at_delimiter(launcher_argv(&[])); + assert!(options.is_empty(), "{options:?}"); + assert!(files.is_empty(), "the separator must not reach the documents: {files:?}"); + } + + #[test] + fn documents_after_the_separator_are_kept_in_order() { + let (options, files) = split_at_delimiter(launcher_argv(&["a.file"])); + assert!(options.is_empty(), "{options:?}"); + assert_eq!(files, ["a.file"]); + let (_, files) = split_at_delimiter(launcher_argv(&["a.file", "--version", "--sample"])); + assert_eq!(files, ["a.file", "--version", "--sample"], "after -- every word is a document"); + // A real document path, as Windows hands one on: kept whole, in order, backslashes and spaces intact. + let (_, files) = split_at_delimiter(launcher_argv(&[r"C:\Users\user\Holiday letter.docx", "a.file"])); + assert_eq!(files, [r"C:\Users\user\Holiday letter.docx", "a.file"], "a real path after -- stays a document, in order"); + } + + /// A document whose name looks like a LaunchServices option is one only after the separator: the strip + /// for macOS runs on the options, after the split, so `-- -NSNotes.docx report.docx` opens both. + #[test] + fn a_document_named_like_a_launch_argument_survives_the_separator() { + let (options, after) = split_at_delimiter(["-psn_0_12345", "--", "-NSNotes.docx", "report.docx"].map(String::from).to_vec()); + assert!(super::without_launch_args(options).is_empty(), "the option before the separator goes"); + let hazard: Vec = ["-NSNotes.docx", "report.docx"].map(String::from).to_vec(); + assert!(super::without_launch_args(hazard).is_empty(), "before the split the strip takes the document and the one after it"); + assert_eq!(documents_to_open(Vec::new(), after), ["-NSNotes.docx", "report.docx"], "what follows the separator is opened, in order"); + } + + /// A stable line that carries its own separator: `a.file` before `--` opens before `b.file` after it. + /// The flag loop keeps `a.file` (its `_` arm, one push) and `documents_to_open` puts the two lists + /// back in command-line order; the reverse, appending the loop's list to the separator's, opened them + /// backwards (found in review of #7849). + #[test] + fn documents_before_the_separator_keep_their_place_before_the_ones_after_it() { + let (options, after) = split_at_delimiter(["--sample", "a.file", "--", "b.file"].map(String::from).to_vec()); + assert_eq!(options, ["--sample", "a.file"], "--sample is a switch and a.file is left for the loop"); + assert_eq!(documents_to_open(vec!["a.file".into()], after), ["a.file", "b.file"]); + let (_, after) = split_at_delimiter(launcher_argv(&["b.file"])); + assert_eq!(documents_to_open(Vec::new(), after), ["b.file"], "the Launcher sends nothing before the separator"); + } + + #[test] + fn a_refusal_never_blocks_on_a_modal_before_the_event_loop_on_macos() { + use crate::build_flavor::BuildFlavor; + assert!(super::refusal_dialog(BuildFlavor::NightlyV1, true, false), "a desktop refusal still shows the box where one renders"); + assert!(!super::refusal_dialog(BuildFlavor::NightlyV1, true, true), "macOS has no run loop yet: the modal would hang"); + assert!(!super::refusal_dialog(BuildFlavor::NightlyV1, false, false), "a headless session has no box"); + assert!(!super::refusal_dialog(BuildFlavor::Stable, true, false), "only a nightly refusal explains itself in a box"); + } } diff --git a/apps/wordcraft/src/native_menu.rs b/apps/wordcraft/src/native_menu.rs new file mode 100644 index 0000000000..1aec6037ca --- /dev/null +++ b/apps/wordcraft/src/native_menu.rs @@ -0,0 +1,81 @@ +//! The macOS application menu uses the same About dialog as File › About. + +use craft::menu::{CommandRef, Gate, Item, ItemRole, Layout, LayoutOptions, Menu, MenuBar, MenuRole, NativeMenu, mac_layout}; +use serde_json::json; +use wordcraft_ui_egui::{WordApp, i18n}; + +const APP_NAME: &str = "WordCraft"; +const ABOUT: &str = "About WordCraft"; +const QUIT: &str = "Quit WordCraft"; + +/// The application menu, with `tr` the translation of an English string. +pub(super) fn layout(tr: &dyn Fn(&'static str) -> String) -> Layout { + let about = Item::new(CommandRef::with_params("ui.dialog", json!({"name": "about"})), tr(ABOUT)).role(ItemRole::About); + // Without its own Quit `mac_layout` adds one whose click only closes the root window: it must ask about every document. + let quit = Item::new(CommandRef::new("ui.quit"), tr(QUIT)).role(ItemRole::Quit); + let bar = MenuBar::new(vec![Menu::new(APP_NAME, vec![about.into(), quit.into()]).role(MenuRole::App)]); + // `mac_layout` words About as the template; WordCraft's catalogs translate the whole label. + let label = |s: &'static str| { + tr(match s { + "About {app}" => ABOUT, + "Quit {app}" => QUIT, + s => s, + }) + }; + let mut layout = mac_layout(&bar, &LayoutOptions::new(APP_NAME).label(&label)); + // WordCraft's document menus live in its ribbon; keep only the application menu. + layout.bar.menus.retain(|menu| menu.role == MenuRole::App); + layout +} + +fn lang(app: &WordApp) -> i18n::Lang { + i18n::Lang::from_pref(&app.ui.language) +} + +fn layout_in(lang: i18n::Lang) -> Layout { + layout(&|s| i18n::tr(lang, s).to_owned()) +} + +pub(super) fn install(ctx: &egui::Context, app: &WordApp) -> Option { + let menu = craft::menu::mac::install(ctx, &layout_in(lang(app)).bar); + if menu.is_none() { + log::warn!("the WordCraft application menu could not be installed"); + } + menu +} + +pub(super) fn update(menu: &mut NativeMenu, app: &mut WordApp, ctx: &egui::Context) { + menu.set_gate(Gate::default().modal(app.dialog_host_mut().shows_modal())); + for command in menu.take_clicks(ctx) { + if let Err(error) = app.run(&command.id, command.params) { + log::warn!("application menu: {error}"); + } + } + menu.set_gate(Gate::default().modal(app.dialog_host_mut().shows_modal())); + let lang = lang(app); + for clash in menu.sync_with(lang.code(), || layout_in(lang)) { + log::warn!("application menu: {clash:?}"); + } +} + +#[cfg(test)] +mod tests { + use super::*; + + /// The catalogs translate "About WordCraft" and have no "About {app}" row. + #[test] + fn about_shows_the_catalogs_translation() { + let translate = |s: &'static str| if s == "About WordCraft" { "Über WordCraft".to_owned() } else { s.to_owned() }; + let layout = layout(&translate); + let about = layout.bar.items().into_iter().find(|item| item.role == Some(ItemRole::About)).unwrap(); + assert_eq!(about.label, "Über WordCraft"); + } + + /// ⌘Q and the menu's Quit run `ui.quit`, which asks about unsaved documents; craft's built-in Quit only closes the root window (#8709). + #[test] + fn quit_runs_the_command_that_asks_about_documents() { + let layout = layout(&|s| s.to_owned()); + let quit = layout.bar.items().into_iter().find(|item| item.role == Some(ItemRole::Quit)).unwrap(); + assert_eq!(quit.command.id, "ui.quit"); + } +} diff --git a/apps/wordcraft/src/nightly_session.rs b/apps/wordcraft/src/nightly_session.rs new file mode 100644 index 0000000000..978ca2cc15 --- /dev/null +++ b/apps/wordcraft/src/nightly_session.rs @@ -0,0 +1,266 @@ +//! App-private Nightly session health, not telemetry or a Launcher protocol. +//! A live owner holds a separate persistent lease; secondary launches never rewrite its record. +//! Dropping the guard does not clear the marker. Only the app's controlled return path does. + +use std::fs::{File, OpenOptions}; +use std::io::{self, Read}; +use std::path::{Path, PathBuf}; +use std::sync::{Arc, Mutex, PoisonError}; + +const RECORD: &str = "nightly-session.json"; +const LEASE: &str = "nightly-session.lock"; +const MAX_METADATA_BYTES: usize = 256; + +pub struct Session { + _lease: File, + path: PathBuf, + own_record: Vec, + previous_unclean: bool, +} + +fn regular_or_missing(path: &Path) -> io::Result { + match std::fs::symlink_metadata(path) { + Ok(metadata) if metadata.file_type().is_file() && !metadata.file_type().is_symlink() => Ok(true), + Ok(_) => Err(io::Error::other("Nightly session state must be a regular file, not an alias or directory")), + Err(error) if error.kind() == io::ErrorKind::NotFound => Ok(false), + Err(error) => Err(error), + } +} + +/// Write `bytes` to `path` through a fresh temporary file in the same folder and a rename: the +/// destination entry is replaced, never followed, so a link planted at `path` is not written +/// through. The file is synced and the folder is synced after the rename. +fn write_no_follow(path: &Path, bytes: &[u8]) -> io::Result<()> { + static NEXT: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0); + let directory = path.parent().ok_or_else(|| io::Error::other("the session record has no folder"))?; + let name = path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(); + let temporary = directory.join(format!(".{name}.{}-{}", std::process::id(), NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed))); + let mut file = OpenOptions::new().write(true).create_new(true).open(&temporary)?; + let written = std::io::Write::write_all(&mut file, bytes).and_then(|()| file.sync_all()); + drop(file); + if let Err(error) = written { + let _ = std::fs::remove_file(&temporary); + return Err(error); + } + if let Err(error) = std::fs::rename(&temporary, path) { + let _ = std::fs::remove_file(&temporary); + return Err(error); + } + if let Ok(directory) = File::open(directory) { + let _ = directory.sync_all(); + } + Ok(()) +} + +/// The owner's session, shared by the app's exit hook (macOS: a quit ends the process inside +/// AppKit's terminate) and the code after the event loop. +pub type Shared = Arc>>; + +/// The controlled return ([`Session::finish`]) by whichever path comes first; later calls do nothing. +pub fn finish_once(shared: &Shared, unclean_notice_shown: bool) { + let watch = shared.lock().unwrap_or_else(PoisonError::into_inner).take(); + if let Some(watch) = watch + && let Err(error) = watch.finish(unclean_notice_shown) + { + log::warn!("Nightly session state was left intact: {error}"); + } +} + +impl Session { + /// The warning belongs to this window: a busy secondary has no health-record coverage, + /// while Stable and a lease-owning Nightly window preserve their existing result. + pub fn begin_with_health(root: Option<&Path>, version: &str, commit: Option<&str>) -> io::Result<(Option, bool)> { + let watch = Self::begin(root, version, commit)?; + let unavailable = root.is_some() && watch.is_none(); + Ok((watch, unavailable)) + } + + /// `None` is stable or another owner of this profile. Neither case touches the record. + /// The supplied root must already be the validated private Nightly profile. + pub fn begin(root: Option<&Path>, version: &str, commit: Option<&str>) -> io::Result> { + let Some(root) = root else { return Ok(None) }; + if version.is_empty() || version.len() > MAX_METADATA_BYTES || commit.is_some_and(|value| value.len() > MAX_METADATA_BYTES) { + return Err(io::Error::new(io::ErrorKind::InvalidInput, "Nightly session provenance is missing or too large")); + } + let lease_path = root.join(LEASE); + regular_or_missing(&lease_path)?; + let lease = OpenOptions::new().read(true).write(true).create(true).truncate(false).open(lease_path)?; + match lease.try_lock() { + Ok(()) => {} + Err(std::fs::TryLockError::WouldBlock) => return Ok(None), + Err(std::fs::TryLockError::Error(error)) => return Err(error), + } + let path = root.join(RECORD); + let previous_unclean = regular_or_missing(&path)?; + let own_record = serde_json::to_vec(&serde_json::json!({ + "schema_version": 1, + "channel": "nightly-v1", + "version": version, + "commit": commit.filter(|value| !value.is_empty()), + }))?; + write_no_follow(&path, &own_record)?; + Ok(Some(Self { _lease: lease, path, own_record, previous_unclean })) + } + + pub fn previous_unclean(&self) -> bool { + self.previous_unclean + } + + /// Controlled return. If an earlier session's interruption was detected but no window showed + /// it yet, the record is left for the next owner to report; otherwise this is [`Self::complete`]. + pub fn finish(self, unclean_notice_shown: bool) -> io::Result<()> { + if self.previous_unclean && !unclean_notice_shown { + return Ok(()); + } + self.complete() + } + + /// Controlled event-loop completion includes a handled startup error, not only exit 0. + /// An unwind, abort, forced exit or killed process never calls this method. + pub fn complete(self) -> io::Result<()> { + if !regular_or_missing(&self.path)? { + return Ok(()); + } + let mut current = Vec::new(); + File::open(&self.path)?.take(self.own_record.len() as u64 + 1).read_to_end(&mut current)?; + if current != self.own_record { + return Err(io::Error::other("Nightly session state changed; leaving it intact")); + } + std::fs::remove_file(&self.path) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::sync::atomic::{AtomicU64, Ordering}; + + struct Fixture(PathBuf); + impl Fixture { + fn new() -> Self { + static NEXT: AtomicU64 = AtomicU64::new(0); + loop { + let path = + std::env::temp_dir().join(format!("wordcraft-nightly-session-{}-{}", std::process::id(), NEXT.fetch_add(1, Ordering::Relaxed))); + match std::fs::create_dir(&path) { + Ok(()) => return Self(path), + Err(error) if error.kind() == io::ErrorKind::AlreadyExists => continue, + Err(error) => panic!("cannot create owned fixture: {error}"), + } + } + } + } + impl Drop for Fixture { + fn drop(&mut self) { + std::fs::remove_dir_all(&self.0).unwrap(); + } + } + + #[test] + fn busy_secondary_reports_unavailable_without_replacing_the_owner_record() { + let fixture = Fixture::new(); + let (stable, warning) = Session::begin_with_health(None, "stable", None).unwrap(); + assert!(stable.is_none() && !warning); + let (first, warning) = Session::begin_with_health(Some(&fixture.0), "nightly", Some("owned-commit")).unwrap(); + assert!(!warning); + let first = first.unwrap(); + let record = std::fs::read(fixture.0.join(RECORD)).unwrap(); + let (secondary, warning) = Session::begin_with_health(Some(&fixture.0), "secondary", None).unwrap(); + assert!(secondary.is_none() && warning, "a secondary window cannot claim recorded exit/crash coverage"); + assert_eq!(std::fs::read(fixture.0.join(RECORD)).unwrap(), record); + first.complete().unwrap(); + assert!(!fixture.0.join(RECORD).exists()); + } + + #[test] + fn controlled_completion_is_clean_but_an_unfinished_owner_is_reported_next_time() { + let fixture = Fixture::new(); + let first = Session::begin(Some(&fixture.0), "first", Some("recorded-commit")).unwrap().unwrap(); + assert!(!first.previous_unclean()); + let own = std::fs::read(fixture.0.join(RECORD)).unwrap(); + assert!(Session::begin(Some(&fixture.0), "secondary", None).unwrap().is_none()); + assert_eq!(std::fs::read(fixture.0.join(RECORD)).unwrap(), own, "a busy secondary must not replace the owner's record"); + first.complete().unwrap(); + assert!(!fixture.0.join(RECORD).exists()); + let unimportant = Session::begin(Some(&fixture.0), "second", None).unwrap().unwrap(); + assert!(!unimportant.previous_unclean()); + drop(unimportant); // Unwind/abnormal-path ownership release, not a controlled completion. + let next = Session::begin(Some(&fixture.0), "third", None).unwrap().unwrap(); + assert!(next.previous_unclean()); + next.complete().unwrap(); + assert!(!fixture.0.join(RECORD).exists()); + } + + #[test] + fn an_interruption_no_window_showed_survives_a_handled_startup_failure() { + let fixture = Fixture::new(); + drop(Session::begin(Some(&fixture.0), "crashed", None).unwrap().unwrap()); + // The window never started: no notice was shown. + let failed = Session::begin(Some(&fixture.0), "startup-failed", None).unwrap().unwrap(); + assert!(failed.previous_unclean()); + failed.finish(false).unwrap(); + // The next start still sees the interruption and shows it. + let next = Session::begin(Some(&fixture.0), "next", None).unwrap().unwrap(); + assert!(next.previous_unclean()); + next.finish(true).unwrap(); + assert!(!fixture.0.join(RECORD).exists(), "a session that showed the notice clears its record"); + let clean = Session::begin(Some(&fixture.0), "clean", None).unwrap().unwrap(); + assert!(!clean.previous_unclean()); + clean.finish(false).unwrap(); + assert!(!fixture.0.join(RECORD).exists()); + } + + #[test] + fn the_exit_hook_and_the_return_path_finish_the_session_once() { + let fixture = Fixture::new(); + let shared: Shared = Arc::new(Mutex::new(Session::begin(Some(&fixture.0), "quitting", None).unwrap())); + // The exit hook (macOS quit: the only path that runs there). + finish_once(&shared, false); + assert!(!fixture.0.join(RECORD).exists(), "a quit that ran the exit hook is a clean exit"); + // Elsewhere the return path runs too, by then possibly after a successor took the profile. + let successor = Session::begin(Some(&fixture.0), "successor", None).unwrap().unwrap(); + assert!(!successor.previous_unclean()); + let record = std::fs::read(fixture.0.join(RECORD)).unwrap(); + finish_once(&shared, false); + assert_eq!(std::fs::read(fixture.0.join(RECORD)).unwrap(), record, "the second finish must not touch a successor's record"); + successor.complete().unwrap(); + } + + #[test] + fn cleanup_never_removes_an_unknown_changed_record() { + let fixture = Fixture::new(); + let watch = Session::begin(Some(&fixture.0), "nightly", None).unwrap().unwrap(); + std::fs::write(fixture.0.join(RECORD), b"replacement owned by someone else").unwrap(); + assert!(watch.complete().is_err()); + assert_eq!(std::fs::read(fixture.0.join(RECORD)).unwrap(), b"replacement owned by someone else"); + } + + #[test] + fn provenance_is_bounded_and_never_collects_documents_paths_or_diagnostics() { + let fixture = Fixture::new(); + assert!(Session::begin(Some(&fixture.0), &"x".repeat(MAX_METADATA_BYTES + 1), None).is_err()); + assert_eq!(std::fs::read_dir(&fixture.0).unwrap().count(), 0); + assert!(Session::begin(None, "", None).unwrap().is_none(), "stable has no session-health side effects"); + let watch = Session::begin(Some(&fixture.0), "nightly", None).unwrap().unwrap(); + let data: serde_json::Value = serde_json::from_slice(&std::fs::read(fixture.0.join(RECORD)).unwrap()).unwrap(); + let fields = data.as_object().unwrap().keys().map(String::as_str).collect::>(); + assert_eq!(fields, ["schema_version", "channel", "version", "commit"].into_iter().collect()); + assert!(data["commit"].is_null(), "missing provenance must not be invented"); + watch.complete().unwrap(); + } + + #[test] + #[cfg(unix)] + fn reserved_state_aliases_do_not_modify_external_files() { + let fixture = Fixture::new(); + let external = fixture.0.join("stable-document"); + std::fs::write(&external, b"stable bytes").unwrap(); + for name in [LEASE, RECORD] { + let alias = fixture.0.join(name); + std::os::unix::fs::symlink(&external, &alias).unwrap(); + assert!(Session::begin(Some(&fixture.0), "nightly", None).is_err()); + assert_eq!(std::fs::read(&external).unwrap(), b"stable bytes"); + std::fs::remove_file(alias).unwrap(); + } + } +} diff --git a/apps/wordcraft/src/prefs.rs b/apps/wordcraft/src/prefs.rs index e416ad51e9..bc38e12cfe 100644 --- a/apps/wordcraft/src/prefs.rs +++ b/apps/wordcraft/src/prefs.rs @@ -10,14 +10,16 @@ use std::path::{Path, PathBuf}; use craft::settings::{LegacyFile, LoadReport, Location, OpenOptions, SettingsStore, SharedSettings, Source}; use craft::window::restore::Store; -use wordcraft_ui_egui::prefs::{Prefs, import_legacy_window, legacy_ui_json}; +use wordcraft_ui_egui::prefs::{Prefs, import_legacy_window, legacy_ui_json_slots}; /// The most of an old `ui.json` read for its window entry; the file is a few kilobytes. const LEGACY_LIMIT: u64 = 8 << 20; -/// Whether this run reads and writes preferences. `WORDCRAFT_NO_PREFS` turns them off. +/// Whether this run reads and writes preferences. `WORDCRAFT_NO_PREFS` turns them off; a Nightly +/// profile always keeps its own, so an inherited developer switch cannot leave the app with no +/// preferences folder at all. pub fn enabled() -> bool { - std::env::var_os("WORDCRAFT_NO_PREFS").is_none() + crate::launch_profile::current().is_nightly() || std::env::var_os("WORDCRAFT_NO_PREFS").is_none() } /// `custom-dictionary.txt` in the settings folder: the words Add to Dictionary kept (#40). @@ -39,7 +41,7 @@ fn open_in(dir: Option, placement: &mut Store) -> (SharedSettings OpenOptions::new(Location::Memory), }; if let Some(dir) = &dir { - options = options.legacy(vec![LegacyFile { path: dir.join("ui.json"), parse: legacy_ui_json }]); + options = options.legacy(vec![LegacyFile { paths: vec![dir.join("ui.json")], parse: legacy_ui_json_slots }]); } let (store, report) = SettingsStore::::open_with(options); if let Source::Legacy(path) = &report.source { diff --git a/apps/wordcraft/src/process_identity.rs b/apps/wordcraft/src/process_identity.rs new file mode 100644 index 0000000000..9d2e1c1799 --- /dev/null +++ b/apps/wordcraft/src/process_identity.rs @@ -0,0 +1,70 @@ +//! Set the immutable nightly Windows identity before any native window or COM service. +//! Stable deliberately leaves its implicit shortcut/path identity unchanged. + +use std::sync::OnceLock; + +#[derive(Clone, Debug, thiserror::Error)] +pub enum IdentityError { + #[error("{0}")] + Configuration(String), +} + +pub fn initialize(nightly: bool, app_id: &str) -> Result<(), IdentityError> { + configure(nightly && cfg!(windows), app_id, |id| { + static RESULT: OnceLock> = OnceLock::new(); + RESULT + .get_or_init(|| { + #[cfg(windows)] + { + winsafe::SetCurrentProcessExplicitAppUserModelID(id) + .map_err(|error| format!("cannot set the nightly Windows identity: {error}"))?; + let actual = winsafe::GetCurrentProcessExplicitAppUserModelID() + .map_err(|error| format!("cannot read back the nightly Windows identity: {error}"))?; + if actual != id { + return Err("the native Windows identity did not match the selected nightly channel".into()); + } + Ok(()) + } + #[cfg(not(windows))] + { + let _ = id; + Ok(()) + } + }) + .clone() + }) + .map_err(IdentityError::Configuration) +} + +fn configure(explicit_nightly: bool, app_id: &str, set: impl FnOnce(&str) -> Result<(), String>) -> Result<(), String> { + if explicit_nightly { set(app_id) } else { Ok(()) } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn stable_does_not_call_the_explicit_identity_api() { + configure(false, "nightly-id", |_| panic!("stable identity must remain implicit")).unwrap(); + } + + #[test] + fn nightly_applies_the_supplied_identity_once() { + let calls = std::cell::Cell::new(0); + configure(true, "nightly-id", |id| { + assert_eq!(id, "nightly-id"); + calls.set(calls.get() + 1); + Ok(()) + }) + .unwrap(); + assert_eq!(calls.get(), 1); + } + + #[test] + fn native_identity_failure_is_returned_instead_of_starting_a_window() { + let started = std::cell::Cell::new(false); + let result = configure(true, "nightly-id", |_| Err("native identity refused".into())).map(|()| started.set(true)); + assert_eq!(result.unwrap_err(), "native identity refused"); + assert!(!started.get()); + } +} diff --git a/apps/wordcraft/src/profile_root.rs b/apps/wordcraft/src/profile_root.rs new file mode 100644 index 0000000000..502d4e6938 --- /dev/null +++ b/apps/wordcraft/src/profile_root.rs @@ -0,0 +1,217 @@ +//! App-owned nightly profile specification for `craft-nightly`; no stable fallback, migration or +//! process environment changes. +//! +//! WordCraft keeps all of its user state in one settings folder (`wordcraft_control_key::settings_dir`): +//! `config.toml`, `window.json`, `logs/`, `recovery/`, `fonts/`, `Templates/`, +//! `custom-dictionary.txt` and the control token files. The suite's shared font store +//! (`Craft Fonts` / `craft-fonts`, which also holds installed Language packs) is the one other +//! per-user folder the app writes, and Nightly points it at the profile too +//! (`wordcraft_engine::packs::use_font_store_in`). Every stable location of either is fenced here. + +use std::ffi::OsString; +use std::path::PathBuf; + +use craft_nightly::AppProfileSpec; + +pub const APP_ID: &str = "wordcraft"; +pub const DISPLAY_NAME: &str = "WordCraft"; +pub const STABLE_PACKAGE_ID: &str = "ai.storyteller.wordcraft"; +pub const NIGHTLY_PACKAGE_ID: &str = "ai.storyteller.wordcraft.nightly"; +pub const STABLE_DIR_NAMES: &[&str] = &["wordcraft", "WordCraft", "craft-fonts", "Craft Fonts"]; +pub const FORBIDDEN_ENV_VARS: &[&str] = &["WORDCRAFT_PROFILE_DIR"]; +pub const FOLDER_ONLY_ENTRIES: &[&str] = &["recovery", "logs", "fonts", "Templates", "FontStore"]; + +/// Returns WordCraft's `craft-nightly` isolation specification, including OS-specific installation +/// and sandbox roots that must never overlap a nightly profile. +pub fn spec() -> AppProfileSpec { + spec_with(|key| std::env::var_os(key)) +} + +fn spec_with(env: impl Fn(&str) -> Option) -> AppProfileSpec { + AppProfileSpec { + app_id: APP_ID, + display_name: DISPLAY_NAME, + stable_dir_names: STABLE_DIR_NAMES, + stable_package_id: STABLE_PACKAGE_ID, + nightly_package_id: NIGHTLY_PACKAGE_ID, + profile_root_env: None, + forbidden_env_vars: FORBIDDEN_ENV_VARS, + portable_markers: &[], + folder_only_entries: FOLDER_ONLY_ENTRIES, + extra_forbidden_roots: extra_forbidden_roots_with(env), + } +} + +#[cfg(any(unix, target_os = "windows"))] +fn non_empty_abs(env: &impl Fn(&str) -> Option, key: &str) -> Option { + let value = env(key)?; + if value.is_empty() { + return None; + } + let path = PathBuf::from(value); + if path.is_absolute() { Some(path) } else { None } +} + +fn extra_forbidden_roots_with(env: impl Fn(&str) -> Option) -> Vec { + let mut roots = Vec::new(); + #[cfg(target_os = "windows")] + { + // Per-user and per-machine MSI install locations. + if let Some(local) = + non_empty_abs(&env, "LOCALAPPDATA").or_else(|| non_empty_abs(&env, "USERPROFILE").map(|p| p.join("AppData").join("Local"))) + { + roots.push(local.join("Programs").join("ArtCraft").join("WordCraft")); + } + for key in ["ProgramW6432", "ProgramFiles", "ProgramFiles(x86)"] { + if let Some(base) = non_empty_abs(&env, key) { + roots.push(base.join("ArtCraft").join("WordCraft")); + } + } + } + #[cfg(all(unix, not(target_os = "macos")))] + { + // Native packages' locations and the stable Flatpak's per-app data folder. + roots.extend(["/usr/bin/wordcraft", "/usr/local/bin/wordcraft", "/opt/wordcraft"].map(PathBuf::from)); + if let Some(home) = non_empty_abs(&env, "HOME") { + roots.push(home.join(".var/app/ai.storyteller.wordcraft")); + } + } + #[cfg(target_os = "macos")] + { + roots.push(PathBuf::from("/Applications/WordCraft.app")); + if let Some(home) = non_empty_abs(&env, "HOME") { + let library = home.join("Library"); + roots.push(library.join("Preferences/ai.storyteller.wordcraft.plist")); + roots.push(library.join("Saved Application State/ai.storyteller.wordcraft.savedState")); + roots.push(home.join("Applications/WordCraft.app")); + } + } + #[cfg(not(any(unix, target_os = "windows")))] + let _ = env; + roots +} + +#[cfg(test)] +mod tests { + use super::{ + APP_ID, DISPLAY_NAME, FOLDER_ONLY_ENTRIES, FORBIDDEN_ENV_VARS, NIGHTLY_PACKAGE_ID, STABLE_DIR_NAMES, STABLE_PACKAGE_ID, + extra_forbidden_roots_with, spec_with, + }; + use craft_nightly::{ProfileError, validate_and_prepare_root}; + use std::collections::BTreeMap; + use std::ffi::OsString; + use std::path::PathBuf; + use std::sync::atomic::{AtomicU64, Ordering}; + + struct TempRoot(PathBuf); + + impl TempRoot { + fn new(label: &str) -> Self { + static NEXT: AtomicU64 = AtomicU64::new(0); + let root = loop { + let candidate = std::env::temp_dir().join(format!( + "wordcraft-profile-spec-{label}-{}-{}", + std::process::id(), + NEXT.fetch_add(1, Ordering::Relaxed) + )); + match std::fs::create_dir(&candidate) { + Ok(()) => break std::fs::canonicalize(candidate).unwrap(), + Err(error) if error.kind() == std::io::ErrorKind::AlreadyExists => continue, + Err(error) => panic!("cannot create owned fixture: {error}"), + } + }; + Self(root) + } + } + + impl Drop for TempRoot { + fn drop(&mut self) { + let _ = std::fs::remove_dir_all(&self.0); + } + } + + #[test] + fn spec_preserves_wordcraft_isolation_contract() { + let spec = spec_with(|_| None); + assert_eq!(spec.app_id, APP_ID); + assert_eq!(spec.display_name, DISPLAY_NAME); + assert_eq!(spec.stable_dir_names, STABLE_DIR_NAMES); + assert_eq!(spec.stable_package_id, STABLE_PACKAGE_ID); + assert_eq!(spec.nightly_package_id, NIGHTLY_PACKAGE_ID); + assert_eq!(spec.profile_root_env, None); + assert_eq!(spec.forbidden_env_vars, FORBIDDEN_ENV_VARS); + assert!(spec.portable_markers.is_empty()); + assert_eq!(spec.folder_only_entries, FOLDER_ONLY_ENTRIES); + } + + #[cfg(all(unix, not(target_os = "macos")))] + #[test] + fn linux_extra_forbidden_roots_cover_native_packages_and_stable_flatpak() { + let env = BTreeMap::from([(String::from("HOME"), OsString::from("/home/tester"))]); + let roots = extra_forbidden_roots_with(|k| env.get(k).cloned()); + assert!(roots.contains(&PathBuf::from("/usr/bin/wordcraft"))); + assert!(roots.contains(&PathBuf::from("/usr/local/bin/wordcraft"))); + assert!(roots.contains(&PathBuf::from("/opt/wordcraft"))); + assert!(roots.contains(&PathBuf::from("/home/tester/.var/app/ai.storyteller.wordcraft"))); + } + + #[cfg(target_os = "macos")] + #[test] + fn macos_extra_forbidden_roots_cover_bundles_plist_and_saved_state() { + let env = BTreeMap::from([(String::from("HOME"), OsString::from("/Users/tester"))]); + let roots = extra_forbidden_roots_with(|k| env.get(k).cloned()); + assert!(roots.contains(&PathBuf::from("/Applications/WordCraft.app"))); + assert!(roots.contains(&PathBuf::from("/Users/tester/Applications/WordCraft.app"))); + assert!(roots.contains(&PathBuf::from("/Users/tester/Library/Preferences/ai.storyteller.wordcraft.plist"))); + assert!(roots.contains(&PathBuf::from("/Users/tester/Library/Saved Application State/ai.storyteller.wordcraft.savedState"))); + } + + #[cfg(target_os = "windows")] + #[test] + fn windows_extra_forbidden_roots_cover_per_user_and_machine_installs() { + let env = BTreeMap::from([ + (String::from("LOCALAPPDATA"), OsString::from(r"C:\Users\tester\AppData\Local")), + (String::from("ProgramFiles"), OsString::from(r"C:\Program Files")), + (String::from("ProgramFiles(x86)"), OsString::from(r"C:\Program Files (x86)")), + ]); + let roots = extra_forbidden_roots_with(|k| env.get(k).cloned()); + assert!(roots.contains(&PathBuf::from(r"C:\Users\tester\AppData\Local\Programs\ArtCraft\WordCraft"))); + assert!(roots.contains(&PathBuf::from(r"C:\Program Files\ArtCraft\WordCraft"))); + assert!(roots.contains(&PathBuf::from(r"C:\Program Files (x86)\ArtCraft\WordCraft"))); + } + + #[test] + fn nightly_profile_reopens_and_enforces_folder_only_entries_and_extra_fences() { + let temp = TempRoot::new("reopen"); + let fenced = temp.0.join("fenced-stable"); + let mut spec = spec_with(|_| None); + spec.extra_forbidden_roots.push(fenced.clone()); + + let overlap = validate_and_prepare_root(&fenced.join("nightly"), &spec).unwrap_err(); + assert!(matches!(overlap, ProfileError::ForbiddenRootOverlap { .. })); + assert!(!fenced.exists()); + + let private = temp.0.join("nightly-private"); + assert_eq!(validate_and_prepare_root(&private, &spec).unwrap(), private); + for name in ["config.toml", "window.json", "nightly-session.lock", "nightly-session.json"] { + std::fs::write(private.join(name), b"saved profile data").unwrap(); + } + for name in FOLDER_ONLY_ENTRIES { + std::fs::create_dir(private.join(name)).unwrap(); + } + assert_eq!(validate_and_prepare_root(&private, &spec).unwrap(), private); + for name in ["config.toml", "window.json", "nightly-session.lock", "nightly-session.json"] { + assert_eq!(std::fs::read(private.join(name)).unwrap(), b"saved profile data", "{name} remains intact after reopen"); + } + + for name in FOLDER_ONLY_ENTRIES { + let path = private.join(name); + std::fs::remove_dir(&path).unwrap(); + std::fs::write(&path, b"not a directory").unwrap(); + let err = validate_and_prepare_root(&private, &spec).unwrap_err(); + assert!(matches!(err, ProfileError::ExpectedDirectoryEntry(_)), "{name} must stay a directory"); + std::fs::remove_file(&path).unwrap(); + std::fs::create_dir(&path).unwrap(); + } + } +} diff --git a/apps/wordcraft/tests/it/linux_decorations.rs b/apps/wordcraft/tests/it/linux_decorations.rs new file mode 100644 index 0000000000..e073ea54fa --- /dev/null +++ b/apps/wordcraft/tests/it/linux_decorations.rs @@ -0,0 +1,167 @@ +//! Integration test for Linux Wayland client-side window decoration controls (#5814, #5375). +//! +//! Ensures that on Linux, client-side window controls use font-free Adwaita vector paths +//! so the close button is rendered as a clean vector cross rather than a square fallback, +//! and that sctk-adwaita has proper license attribution in NOTICE without bundling font files. + +use std::path::Path; + +/// Strips an unquoted TOML `#` comment from a single line. +fn strip_toml_comment(line: &str) -> &str { + let mut in_double = false; + let mut in_single = false; + for (idx, ch) in line.char_indices() { + match ch { + '"' if !in_single => in_double = !in_double, + '\'' if !in_double => in_single = !in_single, + '#' if !in_double && !in_single => return &line[..idx], + _ => {} + } + } + line +} + +/// Extracts the comment-stripped body of a TOML table section by exact `[header]`. +fn toml_section(content: &str, header: &str) -> String { + let mut in_section = false; + let mut out = String::new(); + for raw_line in content.lines() { + let line = strip_toml_comment(raw_line).trim(); + if line.starts_with('[') && line.ends_with(']') { + if in_section { + break; + } + in_section = line == header; + continue; + } + if in_section && !line.is_empty() { + out.push_str(line); + out.push('\n'); + } + } + assert!(in_section, "expected target section {header} in apps/wordcraft/Cargo.toml"); + out +} + +/// Parses the `features = [...]` string array from the `winit = { ... }` dependency entry in a TOML section. +fn winit_features(section: &str) -> Vec<&str> { + let winit_start = section.find("winit").expect("target section must declare a winit dependency"); + let after_winit = §ion[winit_start..]; + let table_end = after_winit.find('}').expect("winit inline table must close with '}'"); + let winit_table = &after_winit[..=table_end]; + let features_start = winit_table.find("features").expect("winit dependency must declare features"); + let after_features = &winit_table[features_start..]; + let open_bracket = after_features.find('[').expect("winit features must open with '['"); + let after_open = &after_features[open_bracket + 1..]; + let close_bracket = after_open.find(']').expect("winit features must close with ']'"); + let array_body = &after_open[..close_bracket]; + array_body.split(',').map(|item| item.trim().trim_matches('"')).filter(|item| !item.is_empty()).collect() +} + +/// Verifies that `apps/wordcraft/Cargo.toml` enables `wayland-csd-adwaita-notitle` for Linux. +#[test] +fn linux_manifest_enables_wayland_csd_adwaita_notitle() { + let cargo_toml = Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml"); + let content = std::fs::read_to_string(&cargo_toml).expect("read apps/wordcraft/Cargo.toml"); + + let linux_section = toml_section(&content, "[target.'cfg(target_os = \"linux\")'.dependencies]"); + let linux_features = winit_features(&linux_section); + assert!( + linux_features.contains(&"x11") && linux_features.contains(&"wayland-csd-adwaita-notitle"), + "Linux winit dependency must enable x11 and wayland-csd-adwaita-notitle, got: {linux_features:?}" + ); + + let other_unix_section = toml_section(&content, "[target.'cfg(all(unix, not(any(target_os = \"macos\", target_os = \"linux\"))))'.dependencies]"); + let other_unix_features = winit_features(&other_unix_section); + assert!( + other_unix_features.contains(&"x11") && !other_unix_features.contains(&"wayland-csd-adwaita-notitle"), + "Non-Linux Unix winit dependency must enable x11 without wayland-csd-adwaita-notitle, got: {other_unix_features:?}" + ); +} + +/// Verifies that `NOTICE` documents sctk-adwaita and its MIT licence. +#[test] +fn notice_documents_sctk_adwaita_attribution() { + let workspace_root = Path::new(env!("CARGO_MANIFEST_DIR")).parent().and_then(Path::parent).expect("workspace root"); + let notice = std::fs::read_to_string(workspace_root.join("NOTICE")).expect("read NOTICE"); + assert!(notice.contains("Linux Wayland window decorations"), "NOTICE must include 'Linux Wayland window decorations'"); + assert!(notice.contains("sctk-adwaita"), "NOTICE must document sctk-adwaita"); + assert!(notice.contains("Bartłomiej Maryńczak"), "NOTICE must retain sctk-adwaita's author copyright"); +} + +/// Parses `[[package]]` entries from `Cargo.lock` as `(name, version, dependencies)`. +fn parse_lockfile_packages(lockfile: &str) -> Vec<(&str, &str, Vec<&str>)> { + lockfile + .split("[[package]]") + .skip(1) + .filter_map(|chunk| { + let mut name = None; + let mut version = None; + let mut deps = Vec::new(); + let mut in_deps = false; + for raw_line in chunk.lines() { + let line = raw_line.trim(); + if in_deps { + if line == "]" { + in_deps = false; + continue; + } + let dep = line.trim_end_matches(',').trim().trim_matches('"'); + if !dep.is_empty() { + deps.push(dep); + } + continue; + } + if let Some(rest) = line.strip_prefix("name = ") { + name = Some(rest.trim_matches('"')); + } else if let Some(rest) = line.strip_prefix("version = ") { + version = Some(rest.trim_matches('"')); + } else if line == "dependencies = [" { + in_deps = true; + } + } + Some((name?, version?, deps)) + }) + .collect() +} + +/// Verifies that WordCraft's resolved Linux `winit` -> `sctk-adwaita` dependency path in +/// `Cargo.lock` does not pull in any title-font renderer crates. +#[test] +fn cargo_lock_contains_font_free_sctk_adwaita() { + use std::collections::{HashSet, VecDeque}; + + let workspace_root = Path::new(env!("CARGO_MANIFEST_DIR")).parent().and_then(Path::parent).expect("workspace root"); + let lockfile = std::fs::read_to_string(workspace_root.join("Cargo.lock")).expect("read Cargo.lock"); + let packages = parse_lockfile_packages(&lockfile); + + let has_dep = |pkg_name: &str, target: &str| { + packages.iter().any(|(name, _, deps)| *name == pkg_name && deps.iter().any(|spec| spec.split_whitespace().next() == Some(target))) + }; + assert!(has_dep("winit", "sctk-adwaita"), "winit in Cargo.lock must depend on sctk-adwaita"); + + let mut queue = VecDeque::new(); + let mut visited = HashSet::new(); + for (idx, (name, _, _)) in packages.iter().enumerate() { + if *name == "sctk-adwaita" && visited.insert(idx) { + queue.push_back(idx); + } + } + assert!(!queue.is_empty(), "Cargo.lock must include sctk-adwaita"); + + let forbidden = ["fontdue", "ab_glyph", "cosmic-text", "crossfont"]; + while let Some(idx) = queue.pop_front() { + let (name, _, deps) = &packages[idx]; + assert!(!forbidden.contains(name), "sctk-adwaita's resolved dependency path must not include title-font renderer {name}"); + for spec in deps { + let mut parts = spec.split_whitespace(); + let dep_name = parts.next().expect("dependency name"); + let dep_ver = parts.next(); + for (next_idx, (cand_name, cand_ver, _)) in packages.iter().enumerate() { + if *cand_name == dep_name && dep_ver.is_none_or(|v| v == *cand_ver) && visited.insert(next_idx) { + queue.push_back(next_idx); + } + } + } + } +} diff --git a/apps/wordcraft/tests/it/main.rs b/apps/wordcraft/tests/it/main.rs index cfa99b937d..a412732dc3 100644 --- a/apps/wordcraft/tests/it/main.rs +++ b/apps/wordcraft/tests/it/main.rs @@ -2,5 +2,7 @@ mod appimage_env; mod control_arg; mod help; +#[cfg(target_os = "linux")] +mod linux_decorations; #[cfg(unix)] mod non_utf8_args; diff --git a/assets/app-icon/README.md b/assets/app-icon/README.md new file mode 100644 index 0000000000..8f9b9e0677 --- /dev/null +++ b/assets/app-icon/README.md @@ -0,0 +1,39 @@ +# WordCraft app icon + +A **page and pen**: a sheet of paper with a folded corner and ruled lines, with a fountain pen +lying across its lower right, on the app's blue field. It is drawn in the canvas palette the app's +own artwork uses (`#3b5bdb` field, `#efe9dc` paper, `#0b0b0c` ink). + +`wordcraft.svg` is the canonical master: a full-bleed 512-unit tile with a rounded square +(`rx=112`) and no border. Windows and Linux use the tile as it is; the macOS renders sit on +Apple's grid, an 824/1024 body with a transparent margin. + +## Files + +- `wordcraft.svg`: canonical master (also the hicolor scalable icon). +- `wordcraft-1024.png`: 1024 px full-bleed render. +- `wordcraft-macos-512.png`: the padded macOS render (Dock, window icon; embedded by the app). +- `wordcraft.icns`: macOS bundle icon (`CFBundleIconFile`), padded frames. +- `wordcraft.ico`: Windows icon, 16–256 px, embedded in `wordcraft.exe` by + `apps/wordcraft/build.rs`. +- `hicolor//apps/ai.storyteller.wordcraft.png` (16–512) and `hicolor/scalable/...svg`: + Linux icon theme. + +## Regenerate + +Replace `wordcraft.svg`, then run `packaging/icons.sh`. It needs `resvg`, plus `iconutil` on macOS; +`cargo run -p xtask -- ico` packs the Windows icon. + +## Nightly channel + +The Nightly icons keep the drawing, its alpha and the macOS padding exactly as the stable renders +have them. Only the background contribution changes: from the app blue to the deeper Nightly +background `#232c67`. There is no letter badge, crescent or other mark; the app and the Launcher +name the channel in text. + +`packaging/nightly-icons.py` derives the four files from the committed stable renders (the `.ico` +frames, the `.icns` slots, the 256 px hicolor render and the padded 512 px macOS master) and +records their hashes in [`nightly-provenance.json`](nightly-provenance.json). `--check` re-derives +them and compares. The three smallest macOS slots (16, 32 and 64 px) are box-filtered from the +padded master; every other frame is the same size as the stable frame it comes from, so nothing is +upscaled. The stable files are not modified. diff --git a/assets/app-icon/nightly-provenance.json b/assets/app-icon/nightly-provenance.json new file mode 100644 index 0000000000..55a3b09ff3 --- /dev/null +++ b/assets/app-icon/nightly-provenance.json @@ -0,0 +1,72 @@ +{ + "title": "WordCraft nightly deep-background icons", + "author": "@skylartaylor", + "license": "MIT OR Apache-2.0", + "source_commit": null, + "inputs": [ + { + "path": "assets/app-icon/hicolor/256x256/apps/ai.storyteller.wordcraft.png", + "sha256": "7c1791408282d01e8c5d0cb1f4080971eaa412c60518694a1cec1e60b23c7406", + "purpose": "Windows/Linux native256 master" + }, + { + "path": "assets/app-icon/wordcraft.ico", + "sha256": "53a23dcf66260f44d87d4d143d633395f3e967f391eda47e6e9cc3a52f820225", + "purpose": "nine full-bleed frames, 16-256 px" + }, + { + "path": "assets/app-icon/wordcraft.icns", + "sha256": "02ac9dcb7ee06858416c7ef70ca2b359cad38dbef4a0b526bb1f28953d90170f", + "purpose": "padded macOS frames, 32-1024 px" + }, + { + "path": "assets/app-icon/wordcraft-macos-512.png", + "sha256": "5a8a4476c1fb67123f803a8ab7a7a0dbd9912675ae54d695c17e74454913ceae", + "purpose": "padded macOS master (box-filtered down to the 16/32/64 px slots, never upscaled)" + } + ], + "method": { + "kind": "derived from the project-owned stable renders by a committed, reproducible script", + "original_palette": { + "ink": "#0b0b0c", + "paper": "#efe9dc", + "background": "#3b5bdb" + }, + "nightly_background": "#232c67", + "transform": "Decompose every pixel in the stable three-colour palette (ink, paper, background) and rebuild it with the Nightly background, keeping the ink and paper weights, alpha and padding. Clamped and renormalised where an antialiased pixel falls outside the triangle. No crescent, letter or badge.", + "generator": "packaging/nightly-icons.py", + "generator_sha256": "7a31bc6d3a00d991cf4fd6b1f2ce06b3bdc9201525d207ba84a935a877ee8e4a", + "reproduce": "python3 packaging/nightly-icons.py --check" + }, + "outputs": { + "assets/app-icon/wordcraft-nightly.png": "43a002255f6db703599de99224cd47274905b8742d92f91d0f7c41c8cb5656e2", + "assets/app-icon/wordcraft-nightly.ico": "f4bb314bb6c8c131c7250e441407be5e22e645579881f0a80fe7bd963adda54a", + "assets/app-icon/wordcraft-nightly-1024.png": "36e21d31b852ac222c787ee27af45667882353eb9b1c3bfb62a9038c17843b25", + "assets/app-icon/wordcraft-nightly.icns": "0b359aa7f07fda079298a97215da207486ca092bbe9c6b277a5de3d3fbc4f9ef" + }, + "ico_frame_sizes": [ + 16, + 20, + 24, + 32, + 40, + 48, + 64, + 128, + 256 + ], + "icns_png_slots": { + "icp4": 16, + "icp5": 32, + "icp6": 64, + "ic07": 128, + "ic08": 256, + "ic13": 256, + "ic09": 512, + "ic14": 512, + "ic10": 1024, + "ic11": 32, + "ic12": 64 + }, + "validation": "Every output is re-derived from the committed inputs by the committed script (--check) and compared by SHA-256; the frames' pixel dimensions and the containers' members are checked while deriving; the foreground and padding were compared visually against the stable renders. Native Explorer/Finder qualification is unrun." +} diff --git a/assets/app-icon/wordcraft-nightly-1024.png b/assets/app-icon/wordcraft-nightly-1024.png new file mode 100644 index 0000000000..f4f42a894b Binary files /dev/null and b/assets/app-icon/wordcraft-nightly-1024.png differ diff --git a/assets/app-icon/wordcraft-nightly.icns b/assets/app-icon/wordcraft-nightly.icns new file mode 100644 index 0000000000..97378e1999 Binary files /dev/null and b/assets/app-icon/wordcraft-nightly.icns differ diff --git a/assets/app-icon/wordcraft-nightly.ico b/assets/app-icon/wordcraft-nightly.ico new file mode 100644 index 0000000000..7583215737 Binary files /dev/null and b/assets/app-icon/wordcraft-nightly.ico differ diff --git a/assets/app-icon/wordcraft-nightly.png b/assets/app-icon/wordcraft-nightly.png new file mode 100644 index 0000000000..1e467c7154 Binary files /dev/null and b/assets/app-icon/wordcraft-nightly.png differ diff --git a/contributors/people.toml b/contributors/people.toml index aa90e311ed..1216b3bbf6 100644 --- a/contributors/people.toml +++ b/contributors/people.toml @@ -209,5 +209,7 @@ real_name = "Helen Kwok" [people.ashokram-si] real_name = "Ashok Ram" +[people.reubgr] +real_name = "Reuben Grinberg" [people.benandez] sync_github_name = true diff --git a/corpus/docx/README.md b/corpus/docx/README.md new file mode 100644 index 0000000000..71456ae45e --- /dev/null +++ b/corpus/docx/README.md @@ -0,0 +1,96 @@ +# DOCX corpus (local only) + +This directory is where a local, real-world DOCX corpus can live for the opt-in +`cargo xtask docx-corpus` harness. **The corpus is never committed.** `/corpus` is +git-ignored; only this README is tracked. Never commit Word-produced files, documents +you do not have the right to redistribute, or any proprietary template, theme, font +or image. Word-produced documents are useful locally, including ones you made +yourself, but they must stay untracked. + +## Populate it + +Put `.docx` files anywhere under this directory (subfolders are walked, symlinks are +skipped): + +```sh +mkdir -p corpus/docx/mine +cp ~/Documents/report.docx corpus/docx/mine/ +``` + +Useful sources for a local corpus: + +- documents you wrote yourself, exported from Word, Google Docs, LibreOffice or Pages; +- public-domain or openly licensed DOCX samples whose licence allows local testing; +- synthetic files generated by WordCraft (`wordcraft-cli run --template sample --save …`); +- deliberately broken files for the failure path (a text file renamed `.docx`, a + truncated ZIP, a package missing `word/document.xml`). + +Keep a note of where each file came from. If a corpus must be shared, share the +manifest and the harness report, not the documents. + +## Run it + +```sh +# The runner builds wordcraft-cli before every run (a no-op when it is current). +cargo xtask docx-corpus --dir corpus/docx +cargo xtask docx-corpus --dir corpus/docx --out target/docx-corpus/report.json +cargo xtask docx-corpus --dir corpus/docx --all-pages +cargo xtask docx-corpus --dir corpus/docx --timeout 120 --cli target/debug/wordcraft-cli +``` + +Options: + +| Option | Meaning | +|---|---| +| `--dir ` | corpus directory (required) | +| `--out ` | JSON report path (default `target/docx-corpus/report.json`); the Markdown summary is written beside it with an `.md` extension | +| `--all-pages` | render every page instead of only page 1 (capped at 2,000 pages per file) | +| `--timeout ` | per-child-process timeout, default 60, maximum 3,600 | +| `--cli ` | use a specific `wordcraft-cli` binary | +| `-h`, `--help` | usage | + +A missing or empty corpus directory is not an error: the command explains what is +missing and exits successfully. + +## What each file goes through + +Every `.docx` is handled in child `wordcraft-cli` processes, each with the timeout +above, so one hostile or hanging file cannot stop the run: + +1. **Open + inspect** — `wordcraft-cli info` gives page and word counts; `wordcraft-cli text` + gives the plain text baseline. +2. **Render** — page 1 to PNG (`--all-pages` renders every page). Images go to + `-artifacts/-/page-NNNN.png` beside the report. +3. **Save** — `wordcraft-cli convert` writes a temporary `.docx` copy under the system + temporary directory. +4. **Reopen + compare** — the copy is opened again for page count and plain text. The + temporary copy is then deleted. + +The report records file name, bytes, open time, page count, word count, render time, +round-trip time, rendered images, and every failure. Failures are classified as: + +| Kind | Meaning | +|---|---| +| `open` | the file could not be opened or inspected (invalid package, encrypted, timeout, oversized, …) | +| `render` | page rendering failed | +| `save` | saving the temporary copy failed | +| `reopen` | the saved copy could not be opened or its text read | +| `text_mismatch` | reopened plain text differs from the original | +| `page_count_delta` | reopened page count differs from the original | + +The JSON report is deterministic for the same corpus and arguments apart from the +timing fields: files are sorted by relative path, failure counts are always present, +and there is no timestamp. The Markdown summary is a short human-readable table. + +## Limits + +- This harness measures open/render/save/reopen and text/page stability. It does **not** + compare with Word's own rendering or page count, and it does not fix document bugs. + A Word-vs-WordCraft visual comparison is a separate task. +- PNG rendering is a smoke test that the page can be produced, not a fidelity score. +- Files are treated as hostile: recursion depth, file count, file size, render pages and + child output are capped, and symlinks are skipped. The caps are deliberately generous + for normal documents; a file above them is reported as a failure rather than skipped + silently. +- The corpus and its reports stay local. `target/` is git-ignored too, so reports do not + enter commits. diff --git a/craft-i18n.rev b/craft-i18n.rev index b91ff589cd..b790685cd3 100644 --- a/craft-i18n.rev +++ b/craft-i18n.rev @@ -1 +1 @@ -e56d26244bbac099bfd42e23fb12f78a4be418a7 +217f4130d7d3dbb21a160f23f6b0021918906cc0 diff --git a/crates/control-key/src/lib.rs b/crates/control-key/src/lib.rs index 775b5db1ff..2d8cdbcb80 100644 --- a/crates/control-key/src/lib.rs +++ b/crates/control-key/src/lib.rs @@ -4,23 +4,49 @@ use std::path::{Path, PathBuf}; +/// The folder the desktop app chose before any of its state was read: a Launcher-selected +/// Nightly profile (`launch_profile`). Set once, at startup, before the first [`settings_dir`] +/// call; tests and the CLI leave it unset. +static CHOSEN: std::sync::OnceLock = std::sync::OnceLock::new(); + +/// Point [`settings_dir`] at `dir` for this process. Fails when a folder was already chosen. +pub fn use_settings_dir(dir: PathBuf) -> Result<(), String> { + CHOSEN.set(dir).map_err(|_| "the settings folder was already selected".into()) +} + /// The app's settings folder (preferences, logs, token files): macOS /// `~/Library/Application Support/WordCraft`, Windows `%APPDATA%\WordCraft`, otherwise /// `$XDG_CONFIG_HOME/wordcraft` or `~/.config/wordcraft`. -/// `WORDCRAFT_PROFILE_DIR` overrides the entire folder for isolated runs. +/// A folder chosen by the app through [`use_settings_dir`] wins: it is a launch decision, not +/// an environment variable a child or a wrapper might have inherited. `WORDCRAFT_PROFILE_DIR` +/// overrides the entire folder for isolated runs otherwise. pub fn settings_dir() -> Option { - if let Some(path) = std::env::var_os("WORDCRAFT_PROFILE_DIR").filter(|p| !p.is_empty()) { + settings_dir_with(CHOSEN.get(), |k| std::env::var_os(k)) +} + +fn settings_dir_with(chosen: Option<&PathBuf>, mut env: impl FnMut(&str) -> Option) -> Option { + if let Some(path) = chosen { + return Some(path.clone()); + } + if let Some(path) = env("WORDCRAFT_PROFILE_DIR").filter(|p| !p.is_empty()) { return Some(PathBuf::from(path)); } + platform_settings_dir_for(env) +} + +/// The platform's own folder, when nothing chose one (see [`settings_dir`]). +#[cfg(test)] +fn platform_settings_dir() -> Option { + platform_settings_dir_for(|k| std::env::var_os(k)) +} + +fn platform_settings_dir_for(mut env: impl FnMut(&str) -> Option) -> Option { if cfg!(target_os = "macos") { - std::env::var_os("HOME").map(|h| PathBuf::from(h).join("Library/Application Support/WordCraft")) + env("HOME").map(|h| PathBuf::from(h).join("Library/Application Support/WordCraft")) } else if cfg!(windows) { - std::env::var_os("APPDATA").map(|a| PathBuf::from(a).join("WordCraft")) + env("APPDATA").map(|a| PathBuf::from(a).join("WordCraft")) } else { - std::env::var_os("XDG_CONFIG_HOME") - .map(PathBuf::from) - .or_else(|| std::env::var_os("HOME").map(|h| PathBuf::from(h).join(".config"))) - .map(|c| c.join("wordcraft")) + env("XDG_CONFIG_HOME").map(PathBuf::from).or_else(|| env("HOME").map(|h| PathBuf::from(h).join(".config"))).map(|c| c.join("wordcraft")) } } @@ -67,6 +93,18 @@ mod tests { assert_eq!(parse_instance_id("app=ai.storyteller.wordcraft\n"), None); } + #[test] + fn a_chosen_folder_wins_over_the_environment() { + // The chosen folder is process-wide and set once, so this test only reads the rule when + // nothing chose one (the crate's own tests and the CLI never do). + if CHOSEN.get().is_none() { + assert_eq!(settings_dir(), super::platform_settings_dir()); + assert!(use_settings_dir(PathBuf::from("/chosen/profile")).is_ok()); + assert_eq!(settings_dir().as_deref(), Some(std::path::Path::new("/chosen/profile"))); + assert!(use_settings_dir(PathBuf::from("/other")).is_err(), "the folder is selected once"); + } + } + #[test] fn key_file_per_instance() { let dir = Path::new("/settings/wordcraft"); @@ -77,4 +115,26 @@ mod tests { assert_eq!(key_path(dir, 7981), dir.join("control-key.local-7981")); } } + + #[test] + fn settings_dir_is_the_apps_folder() { + let default_dir = settings_dir_with(None, |key| match key { + "HOME" | "APPDATA" | "XDG_CONFIG_HOME" => Some("/tmp/base".into()), + _ => None, + }) + .expect("settings_dir should return Some when platform env var is set"); + let default_name = default_dir.file_name().and_then(|n| n.to_str()).unwrap_or(""); + assert!(default_name == "wordcraft" || default_name == "WordCraft", "{}", default_dir.display()); + assert_eq!(settings_dir_with(None, |_| None), None); + + let override_dir = settings_dir_with(None, |key| (key == "WORDCRAFT_PROFILE_DIR").then(|| "/tmp/profile".into())); + assert_eq!(override_dir.as_deref(), Some(Path::new("/tmp/profile"))); + + let empty_override = settings_dir_with(None, |key| match key { + "WORDCRAFT_PROFILE_DIR" => Some("".into()), + "HOME" | "APPDATA" | "XDG_CONFIG_HOME" => Some("/tmp/base".into()), + _ => None, + }); + assert_eq!(empty_override, Some(default_dir)); + } } diff --git a/crates/doc/src/chart.rs b/crates/doc/src/chart.rs index 4132252af1..6ce2999a00 100644 --- a/crates/doc/src/chart.rs +++ b/crates/doc/src/chart.rs @@ -230,10 +230,26 @@ impl ChartAxis { pub const MAX_FMT: usize = 128; /// A number format code: control characters as spaces, ends trimmed, at most [`MAX_FMT`] -/// characters. +/// characters. A trailing space stays when it is part of the code: the character after `_`, +/// `*` or `\`, or text inside quotes. pub fn clean_fmt(s: &str) -> String { - let s: String = s.chars().take(MAX_FMT * 4).map(|c| if c.is_control() { ' ' } else { c }).collect(); - s.trim().chars().take(MAX_FMT).collect::().trim_end().to_string() + let chars: Vec = s.chars().take(MAX_FMT * 4).skip_while(|c| c.is_whitespace() || c.is_control()).take(MAX_FMT).collect(); + let mut keep = 0; + let mut quoted = false; + let mut operand = false; + for (i, &c) in chars.iter().enumerate() { + if !c.is_control() && (!c.is_whitespace() || operand || quoted) { + keep = i + 1; + } + if operand { + operand = false; + } else if c == '"' { + quoted = !quoted; + } else if !quoted && matches!(c, '_' | '*' | '\\') { + operand = true; + } + } + chars[..keep].iter().map(|&c| if c.is_control() { ' ' } else { c }).collect() } /// A chart WordCraft can edit. @@ -512,4 +528,37 @@ mod tests { spec.sanitize(); assert_eq!(spec.series[0].line_w, Some(20.0), "a wild width clamps to 20 pt"); } + + #[test] + fn format_keeps_a_trailing_space_that_is_an_operand() { + // `_`, `*` and `\` take the next character, so a final space after one is part of the code. + assert_eq!(clean_fmt("0_ "), "0_ "); + assert_eq!(clean_fmt("#,##0_ "), "#,##0_ "); + assert_eq!(clean_fmt("0* "), "0* "); + assert_eq!(clean_fmt("0\\ "), "0\\ "); + assert_eq!(clean_fmt("0_ \n "), "0_ "); + assert_eq!(clean_fmt("0\"a "), "0\"a ", "a space inside quotes is text"); + // Other spaces at the ends, and control characters, still go. + assert_eq!(clean_fmt(" 0.00 \t"), "0.00"); + assert_eq!(clean_fmt("0_\n"), "0_"); + assert_eq!(clean_fmt("0\"a\" "), "0\"a\""); + assert_eq!(clean_fmt("\\_ "), "\\_", "an escaped `_` takes no operand"); + assert_eq!(clean_fmt("0\u{1}0"), "0 0"); + assert_eq!(clean_fmt("_\u{1}"), "_"); + assert_eq!(clean_fmt(" \n "), ""); + let long = format!("{}_ ", "0".repeat(MAX_FMT - 2)); + assert_eq!(clean_fmt(&long), long, "a code of exactly MAX_FMT characters keeps its operand"); + + // Axis and series formats both go through the cleaner. + let mut a = ChartAxis { fmt: Some("0_ ".into()), ..Default::default() }; + a.sanitize(); + assert_eq!(a.fmt.as_deref(), Some("0_ ")); + let mut spec = ChartSpec { + series: vec![ChartSeries { name: "s".into(), values: vec![Some(1.0)], fmt: Some("#,##0_ ".into()), ..Default::default() }], + categories: vec!["a".into()], + ..Default::default() + }; + spec.sanitize(); + assert_eq!(spec.series[0].fmt.as_deref(), Some("#,##0_ ")); + } } diff --git a/crates/doc/src/document.rs b/crates/doc/src/document.rs index b03ab1690c..6b94a1a946 100644 --- a/crates/doc/src/document.rs +++ b/crates/doc/src/document.rs @@ -703,25 +703,44 @@ impl Document { } /// A drawing id no shape uses yet (for gluing a connector to a shape that has none). + /// + /// Returns one past the largest in-use shape id across the body, all secondary parts, and + /// footnote/endnote separator stories (walking nested groups and tables); if `u32::MAX` is + /// already in use, falls back via [`free_id`] to the smallest unused non-zero id (or `0` only + /// if every non-zero `u32` id is taken). pub fn next_shape_id(&self) -> u32 { - let mut max = 0u32; + let mut largest: Option = None; + let mut used: Vec = Vec::new(); + let mut record = |id: u32| { + if id != 0 { + largest = largest.max(Some(id)); + used.push(id); + } + }; let mut see = |o: &InlineObject| match o { - InlineObject::Shape { extra, .. } => max = max.max(extra.id), + InlineObject::Shape { extra, .. } => record(extra.id), InlineObject::Group { children, .. } => { - for c in children { - if let InlineObject::Shape { extra, .. } = &c.obj { - max = max.max(extra.id); + let mut todo: Vec<&InlineObject> = children.iter().map(|c| &c.obj).collect(); + while let Some(obj) = todo.pop() { + match obj { + InlineObject::Shape { extra, .. } => record(extra.id), + InlineObject::Group { children, .. } => todo.extend(children.iter().map(|c| &c.obj)), + _ => {} } } } _ => {} }; - for blocks in std::iter::once(&self.body).chain(self.parts.values().map(|p| &p.blocks)) { + let sep_stories = [&self.footnote_separators, &self.endnote_separators] + .into_iter() + .flat_map(|s| [&s.separator, &s.continuation_separator, &s.continuation_notice]) + .flatten(); + for blocks in std::iter::once(&self.body).chain(self.parts.values().map(|p| &p.blocks)).chain(sep_stories) { for b in blocks { edit::each_para(b, 0, &mut |p| p.objects.iter().for_each(&mut see)); } } - max.saturating_add(1).max(1) + free_id(largest, used.into_iter(), 1).unwrap_or(0) } /// Change every inline object in every story (paragraphs inside tables too), copying only @@ -798,7 +817,10 @@ impl Document { stories.extend(self.parts.values_mut().map(|p| &mut p.blocks)); for blocks in stories { for b in blocks.iter_mut() { - edit::each_para_mut(Arc::make_mut(b), 0, &mut Paragraph::normalize); + edit::each_para_mut(Arc::make_mut(b), 0, &mut |p: &mut Paragraph| { + p.normalize(); + p.reconcile_objects(); + }); } } } diff --git a/crates/doc/src/edit.rs b/crates/doc/src/edit.rs index 14081425e1..ae30e8c21d 100644 --- a/crates/doc/src/edit.rs +++ b/crates/doc/src/edit.rs @@ -7,7 +7,7 @@ use std::sync::Arc; use serde::{Deserialize, Serialize}; -use crate::para::{InlineObject, Run}; +use crate::para::{InlineObject, OBJ, Run}; use crate::props::{CharProps, ParaProps}; use crate::{Block, Blocks, DocError, Document, Paragraph, Part, PartKind, Path, Pos, Result, para_block}; use crate::{Table, table::MAX_TABLE_DEPTH}; @@ -26,8 +26,41 @@ pub struct Fragment { } impl Fragment { + /// Text box story IDs referenced by the fragment's objects in document order, falling + /// back to the parts map's keys if no inline objects reference them. + fn text_box_ids(&self) -> Vec { + let mut ids = Vec::new(); + for b in &self.blocks { + each_para(b, 0, &mut |p| { + for o in &p.objects { + for id in o.text_boxes() { + if self.parts.get(&id).is_some_and(|part| part.kind == crate::PartKind::TextBox) { + ids.push(id); + } + } + } + }); + } + if ids.is_empty() { + ids.extend(self.parts.iter().filter(|(_, p)| p.kind == crate::PartKind::TextBox).map(|(id, _)| *id)); + } + ids + } + + /// The plain text representation of the fragment's body, falling back to text box part stories + /// when the body text has no real text (empty or only whitespace/object markers). pub fn plain_text(&self) -> String { - self.to_document().plain_text(crate::StoryRef::Body) + let d = self.to_document(); + let text = d.plain_text(crate::StoryRef::Body); + let has_body_text = text.chars().any(|c| !c.is_whitespace() && c != OBJ); + if !has_body_text && !self.parts.is_empty() { + let parts: Vec = + self.text_box_ids().into_iter().map(|id| d.plain_text(crate::StoryRef::Part(id))).filter(|s| !s.is_empty()).collect(); + if !parts.is_empty() { + return parts.join("\n"); + } + } + text } /// The fragment as the body of a new document (default styles). pub fn to_document(&self) -> Document { @@ -67,9 +100,20 @@ impl Fragment { found } /// The text a copy puts on the clipboard: [`Self::plain_text`] with symbol-font characters - /// (Wingdings…) as their Unicode equivalents. + /// (Wingdings…) as their Unicode equivalents. Falls back to text box part stories when body + /// text has no real text (empty or only whitespace/object markers). pub fn clipboard_text(&self) -> String { - self.to_document().shown_text(crate::StoryRef::Body) + let d = self.to_document(); + let text = d.shown_text(crate::StoryRef::Body); + let has_body_text = text.chars().any(|c| !c.is_whitespace() && c != OBJ); + if !has_body_text && !self.parts.is_empty() { + let parts: Vec = + self.text_box_ids().into_iter().map(|id| d.shown_text(crate::StoryRef::Part(id))).filter(|s| !s.is_empty()).collect(); + if !parts.is_empty() { + return parts.join("\n"); + } + } + text } /// Add `piece` at the end, followed by a paragraph mark unless it already ends with one: how /// Word's Spike collects what it cuts. The piece's text box stories get ids after this @@ -603,6 +647,61 @@ fn remap_media_block(b: &mut Block, map: &BTreeMap) { }); } +/// Remaps media references across `blocks` and any text box stories in `parts`. +fn remap_media_in(blocks: &mut [Block], parts: &mut BTreeMap, map: &BTreeMap) { + if map.is_empty() { + return; + } + for b in blocks { + remap_media_block(b, map); + } + for part in parts.values_mut() { + for b in &mut part.blocks { + remap_media_block(Arc::make_mut(b), map); + } + } +} +/// Visit `(index, item)` in forward (`!last`) or reverse (`last`) order, returning the first `Some`. +fn find_in_slice(slice: &[T], last: bool, mut f: impl FnMut(usize, &T) -> Option) -> Option { + if last { slice.iter().enumerate().rev().find_map(|(i, x)| f(i, x)) } else { slice.iter().enumerate().find_map(|(i, x)| f(i, x)) } +} + +/// First (`last == false`) or last (`last == true`) paragraph path inside `blk`, +/// matching [`crate::text_walk::walk`] order and bounded by [`crate::PARA_WALK_DEPTH`]. +fn edge_para_in_block(blk: &Block, prefix: &mut Vec, depth: usize, last: bool) -> Option { + if depth > crate::PARA_WALK_DEPTH { + return None; + } + match blk { + Block::Para(_) => Some(Path(prefix.clone())), + Block::Table(t) => find_in_slice(&t.rows, last, |r, row| { + find_in_slice(&row.cells, last, |c, cell| { + prefix.push(r as u32); + prefix.push(c as u32); + let found = find_in_slice(&cell.blocks, last, |bi, b| { + prefix.push(bi as u32); + let res = edge_para_in_block(b, prefix, depth + 1, last); + prefix.pop(); + res + }); + prefix.pop(); + prefix.pop(); + found + }) + }), + } +} + +/// Trim a paragraph to the offset range `from..to`, optionally clearing section breaks. +fn trim_para(para: &Paragraph, from: usize, to: usize, clear_section: bool) -> Paragraph { + let mut p = para.clone(); + let _ = p.delete(to.min(p.len()), p.len()); + let _ = p.delete(0, from.min(p.len())); + if clear_section { + p.section = None; + } + p +} impl Document { /// Convert notes between footnotes and endnotes: footnotes (`foot`) become endnotes and /// endnotes (`end`) footnotes, both at once to swap them. Each note's kind changes, as do its @@ -1340,6 +1439,22 @@ impl Document { out } + /// Copy paragraphs in linear document order between `a` and `b` inclusive (#5906). + fn copy_para_range(&self, a: &Pos, b: &Pos) -> Vec { + let (a, b) = order(a, b); + let mut out = Vec::new(); + for p in self.paths_between(&a, &b) { + if let Some(para) = self.para(a.story, &p) { + let from = if p == a.path { a.off } else { 0 }; + let to = if p == b.path { b.off } else { para.len() }; + let clear = p == b.path && b.off < para.len(); + out.push(Block::Para(trim_para(para, from, to, clear))); + } + } + out + } + + /// Copy blocks spanning `a..b`, preserving whole tables when covered across containers (#5906). fn copy_blocks(&self, a: &Pos, b: &Pos) -> Vec { let (a, b) = order(a, b); let mut out = Vec::new(); @@ -1352,21 +1467,17 @@ impl Document { let Some(blk) = bl.get(i) else { break }; match &**blk { Block::Para(p) => { - let mut p = p.clone(); let to = if i == b.path.last() { b.off } else { p.len() }; let from = if i == a.path.last() { a.off } else { 0 }; - let _ = p.delete(to.min(p.len()), p.len()); - let _ = p.delete(0, from.min(p.len())); - if i == b.path.last() && to < self.para(a.story, &b.path).map(Paragraph::len).unwrap_or(0) { - p.section = None; - } - out.push(Block::Para(p)); + let clear = i == b.path.last() && to < p.len(); + out.push(Block::Para(trim_para(p, from, to, clear))); } - Block::Table(t) => out.push(Block::Table(t.clone())), + Block::Table(_) => out.push((**blk).clone()), } } return out; } + // Across the cells of a whole table: the table itself, not its cells' paragraphs (#1744). if let Some(tp) = self.whole_table(&a, &b) && let Some(blk) = self.block(a.story, &tp) @@ -1374,17 +1485,92 @@ impl Document { out.push(blk.clone()); return out; } - for p in self.paths_between(&a, &b) { - if let Some(para) = self.para(a.story, &p) { - let mut q = para.clone(); - let to = if p == b.path { b.off } else { q.len() }; - let from = if p == a.path { a.off } else { 0 }; - let _ = q.delete(to.min(q.len()), q.len()); - let _ = q.delete(0, from.min(q.len())); - q.section = None; - out.push(Block::Para(q)); + + // Find the lowest common ancestor container. + let common = a.path.0.iter().zip(&b.path.0).take_while(|(x, y)| x == y).count(); + let level = common.saturating_sub(common % 3); + let prefix = a.path.0.get(..level).unwrap_or_default().to_vec(); + let block_path = |i: usize| { + let mut v = prefix.clone(); + v.push(i as u32); + Path(v) + }; + + let (Some(&ia), Some(&ib)) = (a.path.0.get(level), b.path.0.get(level)) else { + return self.copy_para_range(&a, &b); + }; + let (ia, ib) = (ia as usize, ib as usize); + if ia >= ib { + return self.copy_para_range(&a, &b); + } + + let Some(bl) = self.container(a.story, &block_path(ia)) else { + return self.copy_para_range(&a, &b); + }; + + let edge_para = |i: usize, last: bool| -> Option { + let blk = bl.get(i)?; + if matches!(&**blk, Block::Para(_)) { + return None; + } + let mut pre = block_path(i).0; + edge_para_in_block(blk, &mut pre, level / 3, last) + }; + let walked = |i: usize| bl.get(i).is_some_and(|b| !deeper_than_walk(b, level / 3)); + + let a_covers = if a.path.0.len() == level + 1 { + a.off == 0 + } else { + a.path.0.len() > level + 1 && a.off == 0 && walked(ia) && edge_para(ia, false).as_ref() == Some(&a.path) + }; + + let b_at_end = self.para(b.story, &b.path).is_some_and(|p| p.len() == b.off); + let b_covers = if b.path.0.len() == level + 1 { + b_at_end + } else { + b.path.0.len() > level + 1 && walked(ib) && edge_para(ib, true).as_ref() == Some(&b.path) && b_at_end + }; + + // Start block ia: + if a_covers { + if let Some(blk) = bl.get(ia) { + out.push((**blk).clone()); + } + } else if a.path.0.len() == level + 1 { + if let Some(blk) = bl.get(ia) + && let Block::Para(p) = &**blk + { + out.push(Block::Para(trim_para(p, a.off, p.len(), false))); + } + } else if let Some(last_in_a) = edge_para(ia, true) { + let end_pos = Pos { story: a.story, path: last_in_a.clone(), off: self.para(a.story, &last_in_a).map_or(0, Paragraph::len) }; + out.extend(self.copy_para_range(&a, &end_pos)); + } + + // Blocks strictly between ia and ib: whole blocks + for i in ia + 1..ib { + if let Some(blk) = bl.get(i) { + out.push((**blk).clone()); } } + + // End block ib: + if b_covers { + if let Some(blk) = bl.get(ib) { + out.push((**blk).clone()); + } + } else if b.path.0.len() == level + 1 { + if let Some(blk) = bl.get(ib) + && let Block::Para(p) = &**blk + { + let clear = b.off < p.len(); + out.push(Block::Para(trim_para(p, 0, b.off, clear))); + } + } else if let Some(first_in_b) = edge_para(ib, false) { + let start_pos = Pos { story: b.story, path: first_in_b, off: 0 }; + out.extend(self.copy_para_range(&start_pos, &b)); + } + out } @@ -1470,13 +1656,41 @@ impl Document { Some(id) } - /// The blocks of `frag`, a fragment of another document, with every text box given a new - /// story of its own here copied from the fragment's parts (as a paste does), to place them - /// in this document; a box the fragment has no story for keeps none. + /// Copies `media` into `self.media`, returning a remap for keys whose bytes differ from an + /// existing entry under the same key. + fn adopt_media(&mut self, media: &BTreeMap>>) -> BTreeMap { + let mut media_remap = BTreeMap::new(); + for (k, v) in media { + if let Some(existing) = self.media.get(k) { + if existing.as_slice() != v.as_slice() { + let ext = k.rsplit_once('.').map_or("png", |(_, ext)| ext); + let new_key = self.add_media((**v).clone(), ext); + media_remap.insert(k.clone(), new_key); + } + } else { + self.media.insert(k.clone(), v.clone()); + } + } + media_remap + } + + /// The blocks of `frag`, a fragment of another document, with its media copied (remapping + /// conflicting keys) and every text box given a new story of its own here copied from the + /// fragment's parts (as a paste does), to place them in this document; a box the fragment + /// has no story for keeps none. pub fn adopt_fragment(&mut self, frag: &Fragment) -> Vec { + let media_remap = self.adopt_media(&frag.media); let mut blocks = frag.blocks.clone(); + let mut remapped_parts; + let parts = if media_remap.is_empty() { + &frag.parts + } else { + remapped_parts = frag.parts.clone(); + remap_media_in(&mut blocks, &mut remapped_parts, &media_remap); + &remapped_parts + }; let mut budget = BoxBudget { local: false, ..BoxBudget::new() }; - self.adopt_text_boxes(&mut blocks, &frag.parts, 0, &mut budget); + self.adopt_text_boxes(&mut blocks, parts, 0, &mut budget); if budget.skipped > 0 { log::warn!( "{} text boxes are left empty; their stories are past what one copy brings ({MAX_PASTED_BOXES} stories, {MAX_PASTED_BOX_BYTES} bytes)", @@ -1488,18 +1702,7 @@ impl Document { /// Insert a fragment at `pos`; returns the position after the pasted content. pub fn insert_fragment(&mut self, pos: &Pos, frag: &Fragment) -> Result { - let mut media_remap = BTreeMap::new(); - for (k, v) in &frag.media { - if let Some(existing) = self.media.get(k) { - if existing.as_slice() != v.as_slice() { - let ext = k.rsplit_once('.').map_or("png", |(_, ext)| ext); - let new_key = self.add_media((**v).clone(), ext); - media_remap.insert(k.clone(), new_key); - } - } else { - self.media.insert(k.clone(), v.clone()); - } - } + let media_remap = self.adopt_media(&frag.media); // Tables that would nest deeper than the limit here become their paragraphs (#1596). let room = MAX_TABLE_DEPTH.saturating_sub(pos.path.depth()); let mut blocks = Vec::with_capacity(frag.blocks.len()); @@ -1509,20 +1712,14 @@ impl Document { if blocks.is_empty() { return Ok(pos.clone()); } - if self.para_at(pos).is_none() { + let Some(dest_para) = self.para_at(pos) else { return Err(DocError::BadPath(pos.path.to_string())); - } + }; + let is_dest_empty = dest_para.is_empty(); + let table_para = table_style_para(self, pos); + let destination_shading = self.styles.resolve_para_in(&dest_para.props, table_para.as_ref()).shading; let mut parts = frag.parts.clone(); - if !media_remap.is_empty() { - for b in &mut blocks { - remap_media_block(b, &media_remap); - } - for part in parts.values_mut() { - for b in &mut part.blocks { - remap_media_block(Arc::make_mut(b), &media_remap); - } - } - } + remap_media_in(&mut blocks, &mut parts, &media_remap); // Pasted text boxes get stories of their own (never shared with the copy's source). let mut budget = BoxBudget::new(); self.adopt_text_boxes(&mut blocks, &parts, 0, &mut budget); @@ -1538,6 +1735,7 @@ impl Document { && let Some(Block::Para(src)) = blocks.first() { let src = src.clone(); + let src_shading = self.styles.resolve_para(&src.props).shading; let target = self.para_mut(pos.story, &pos.path)?; let tail = target.split_off(pos.off)?; let added = src.len(); @@ -1548,6 +1746,13 @@ impl Document { target.append(src); target.append(tail); target.props = keep; + // Paragraph shading is the pasted text's background (HTML container backgrounds + // become paragraph shading), so an empty unshaded destination takes the source's. + // A paste without a paragraph mark into an existing paragraph leaves the + // destination paragraph's formatting unchanged (#6157). + if is_dest_empty && destination_shading.is_none() { + target.props.shading = src_shading; + } target.section = sect; return Ok(Pos { off: pos.off + added, ..pos.clone() }); } @@ -1559,13 +1764,28 @@ impl Document { let mut idx = left.last() + 1; match first { Block::Para(p) => { + let src_shading = self.styles.resolve_para(&p.props).shading; let l = self.para_mut(pos.story, &left)?; let keep = l.props.clone(); + let keep_empty = keep.is_empty(); + let keep_shading = keep.shading; let mut p2 = p; let pprops = p2.props.clone(); p2.section = None; l.append(p2); - l.props = if keep.is_empty() { pprops } else { keep }; + l.props = if keep_empty { pprops } else { keep }; + if destination_shading.is_some() { + // When adopting a source paragraph style into an empty destination, + // preserve the destination background as a direct override so the + // source style's shading does not win over it (#6157). + if keep_empty && l.props.style.is_some() { + l.props.shading = destination_shading; + } else { + l.props.shading = keep_shading; + } + } else if is_dest_empty && !keep_empty && l.props.shading.is_none() { + l.props.shading = src_shading; + } } t @ Block::Table(_) => { self.insert_block(pos.story, &left.with_last(idx), t)?; @@ -1606,6 +1826,13 @@ impl Document { } } +/// Paragraph formatting of the table style enclosing `pos`, if any. +fn table_style_para(doc: &Document, pos: &Pos) -> Option { + let (tp, _, _) = pos.path.cell()?; + let id = doc.table(pos.story, &tp)?.props.style.as_deref()?; + Some(doc.styles.table_style(id)?.para.clone()) +} + /// Take the drop cap (and its options) off a paragraph's properties. fn clear_drop_cap(props: &mut crate::props::ParaProps) { props.drop_cap = None; diff --git a/crates/doc/src/edit/tests.rs b/crates/doc/src/edit/tests.rs index 7b85dcc694..92632c7f1d 100644 --- a/crates/doc/src/edit/tests.rs +++ b/crates/doc/src/edit/tests.rs @@ -118,6 +118,182 @@ fn copy_paste_round_trip() { assert!(d.plain_text(StoryRef::Body).starts_with("XYalpha")); } +/// Shading a pasted paragraph gets from its style is kept as direct shading on an empty unshaded destination (#6157). +#[test] +fn paste_keeps_source_style_shading() { + let mut d = doc(&[""]); + Arc::make_mut(&mut d.styles).upsert(crate::Style { + id: "SourceShaded".into(), + name: "Source Shaded".into(), + kind: crate::StyleKind::Paragraph, + based_on: Some("Normal".into()), + para: ParaProps { shading: Some(crate::Rgb(0x33, 0x33, 0x33)), ..Default::default() }, + ..Default::default() + }); + let mut src = Paragraph::with_text("X", CharProps::default()); + src.props.style = Some("SourceShaded".into()); + let one = Fragment { blocks: vec![Block::Para(src)], ..Default::default() }; + d.insert_fragment(&Pos::body(0, 0), &one).unwrap(); + let p = d.para(StoryRef::Body, &Path::top(0)).unwrap(); + assert_eq!(p.props.shading, Some(crate::Rgb(0x33, 0x33, 0x33)), "source style shading is kept on empty destination"); +} + +/// A one-line paste without a paragraph mark into a non-empty paragraph leaves destination shading unshaded (#6157). +#[test] +fn single_block_paste_into_non_empty_paragraph_leaves_destination_unshaded() { + let mut d = doc(&["plain"]); + Arc::make_mut(&mut d.styles).upsert(crate::Style { + id: "SourceShaded".into(), + name: "Source Shaded".into(), + kind: crate::StyleKind::Paragraph, + based_on: Some("Normal".into()), + para: ParaProps { shading: Some(crate::Rgb(0x33, 0x33, 0x33)), ..Default::default() }, + ..Default::default() + }); + let mut src = Paragraph::with_text("X", CharProps::default()); + src.props.style = Some("SourceShaded".into()); + let one = Fragment { blocks: vec![Block::Para(src)], ..Default::default() }; + d.insert_fragment(&Pos::body(0, 5), &one).unwrap(); + let p = d.para(StoryRef::Body, &Path::top(0)).unwrap(); + assert_eq!(p.props.shading, None, "one-line paste without a paragraph mark must not shade destination paragraph"); +} + +/// An empty destination with direct properties keeps the first pasted paragraph's style shading (#6157). +#[test] +fn multi_block_paste_keeps_source_style_shading() { + let mut d = doc(&[""]); + Arc::make_mut(&mut d.styles).upsert(crate::Style { + id: "SourceShaded".into(), + name: "Source Shaded".into(), + kind: crate::StyleKind::Paragraph, + based_on: Some("Normal".into()), + para: ParaProps { shading: Some(crate::Rgb(0x33, 0x33, 0x33)), ..Default::default() }, + ..Default::default() + }); + let mut a = Paragraph::with_text("A", CharProps::default()); + a.props.style = Some("SourceShaded".into()); + let b = Paragraph::with_text("B", CharProps::default()); + let frag = Fragment { blocks: vec![Block::Para(a), Block::Para(b)], ..Default::default() }; + d.para_mut(StoryRef::Body, &Path::top(0)).unwrap().props.align = Some(crate::props::Align::Center); + d.insert_fragment(&Pos::body(0, 0), &frag).unwrap(); + let p = d.para(StoryRef::Body, &Path::top(0)).unwrap(); + assert_eq!(p.props.shading, Some(crate::Rgb(0x33, 0x33, 0x33)), "first pasted paragraph keeps its style shading"); +} + +/// The destination's resolved (default) shading is not replaced by the source's direct shading (#6157). +#[test] +fn multi_block_paste_keeps_destination_default_shading() { + let mut d = doc(&["plain"]); + Arc::make_mut(&mut d.styles).default_para.shading = Some(crate::Rgb(0x22, 0x22, 0x22)); + let mut a = Paragraph::with_text("A", CharProps::default()); + a.props.shading = Some(crate::Rgb(0x11, 0x11, 0x11)); + let b = Paragraph::with_text("B", CharProps::default()); + let frag = Fragment { blocks: vec![Block::Para(a), Block::Para(b)], ..Default::default() }; + d.insert_fragment(&Pos::body(0, 5), &frag).unwrap(); + let p = d.para(StoryRef::Body, &Path::top(0)).unwrap(); + assert_eq!(p.props.shading, None, "source direct shading must not override the destination default"); + assert_eq!(d.styles.resolve_para(&p.props).shading, Some(crate::Rgb(0x22, 0x22, 0x22))); +} + +/// An empty destination with inherited shading keeps its shading when pasting a differently shaded source style (#6157). +#[test] +fn multi_block_paste_keeps_destination_inherited_shading_over_source_style() { + let mut d = doc(&["plain"]); + Arc::make_mut(&mut d.styles).default_para.shading = Some(crate::Rgb(0x22, 0x22, 0x22)); + Arc::make_mut(&mut d.styles).upsert(crate::Style { + id: "SourceShaded".into(), + name: "Source Shaded".into(), + kind: crate::StyleKind::Paragraph, + based_on: Some("Normal".into()), + para: ParaProps { shading: Some(crate::Rgb(0x33, 0x33, 0x33)), ..Default::default() }, + ..Default::default() + }); + let mut a = Paragraph::with_text("A", CharProps::default()); + a.props.style = Some("SourceShaded".into()); + let b = Paragraph::with_text("B", CharProps::default()); + let frag = Fragment { blocks: vec![Block::Para(a), Block::Para(b)], ..Default::default() }; + d.insert_fragment(&Pos::body(0, 5), &frag).unwrap(); + let p = d.para(StoryRef::Body, &Path::top(0)).unwrap(); + assert_eq!(p.props.shading, Some(crate::Rgb(0x22, 0x22, 0x22)), "destination inherited shading is preserved as a direct override"); + assert_eq!( + d.styles.resolve_para(&p.props).shading, + Some(crate::Rgb(0x22, 0x22, 0x22)), + "resolved shading must match the destination background, not the source style" + ); +} + +/// Multi-block paste into an empty unshaded destination keeps a shaded source style without +/// duplicating its color into direct paragraph shading (#6157). +#[test] +fn multi_block_paste_into_empty_destination_keeps_source_style_without_direct_shading() { + let mut d = doc(&[""]); + Arc::make_mut(&mut d.styles).upsert(crate::Style { + id: "SourceShaded".into(), + name: "Source Shaded".into(), + kind: crate::StyleKind::Paragraph, + based_on: Some("Normal".into()), + para: ParaProps { shading: Some(crate::Rgb(0x33, 0x33, 0x33)), ..Default::default() }, + ..Default::default() + }); + let mut a = Paragraph::with_text("A", CharProps::default()); + a.props.style = Some("SourceShaded".into()); + let mut b = Paragraph::with_text("B", CharProps::default()); + b.props.style = Some("SourceShaded".into()); + let frag = Fragment { blocks: vec![Block::Para(a), Block::Para(b)], ..Default::default() }; + d.insert_fragment(&Pos::body(0, 0), &frag).unwrap(); + for idx in [0, 1] { + let p = d.para(StoryRef::Body, &Path::top(idx)).unwrap(); + assert_eq!(p.props.style.as_deref(), Some("SourceShaded")); + assert_eq!(p.props.shading, None, "paragraph {idx} inherits from its style without redundant direct shading"); + assert_eq!(d.styles.resolve_para(&p.props).shading, Some(crate::Rgb(0x33, 0x33, 0x33))); + } +} + +/// Paragraph shading inherited from an enclosing table's style is preserved as destination shading (#6157). +#[test] +fn paste_keeps_destination_table_style_shading() { + let mut d = doc(&["outside"]); + Arc::make_mut(&mut d.styles).upsert(crate::Style { + id: "ShadedGrid".into(), + name: "Shaded Grid".into(), + kind: crate::StyleKind::Table, + para: ParaProps { shading: Some(crate::Rgb(0x22, 0x22, 0x22)), ..Default::default() }, + ..Default::default() + }); + Arc::make_mut(&mut d.styles).upsert(crate::Style { + id: "SourceShaded".into(), + name: "Source Shaded".into(), + kind: crate::StyleKind::Paragraph, + based_on: Some("Normal".into()), + para: ParaProps { shading: Some(crate::Rgb(0x44, 0x44, 0x44)), ..Default::default() }, + ..Default::default() + }); + let mut t = Table::new(1, 2, 200.0); + t.props.style = Some("ShadedGrid".into()); + d.insert_block(StoryRef::Body, &Path::top(0), Block::Table(t)).unwrap(); + + // Single-block paste into cell (0, 0): table-style paragraph shading is not overridden. + let mut src = Paragraph::with_text("cell1", CharProps::default()); + src.props.shading = Some(crate::Rgb(0x1e, 0x1e, 0x1e)); + let one = Fragment { blocks: vec![Block::Para(src)], ..Default::default() }; + let cell0 = Pos { story: StoryRef::Body, path: Path(vec![0, 0, 0, 0]), off: 0 }; + d.insert_fragment(&cell0, &one).unwrap(); + let p0 = d.para(StoryRef::Body, &cell0.path).unwrap(); + assert_eq!(p0.props.shading, None); + let tp = &d.styles.table_style("ShadedGrid").unwrap().para; + assert_eq!(d.styles.resolve_para_in(&p0.props, Some(tp)).shading, Some(crate::Rgb(0x22, 0x22, 0x22))); + + // Multi-block paste with a differently shaded source style into empty cell (0, 1). + let mut a = Paragraph::with_text("A", CharProps::default()); + a.props.style = Some("SourceShaded".into()); + let b = Paragraph::with_text("B", CharProps::default()); + let multi = Fragment { blocks: vec![Block::Para(a), Block::Para(b)], ..Default::default() }; + let cell1 = Pos { story: StoryRef::Body, path: Path(vec![0, 0, 1, 0]), off: 0 }; + d.insert_fragment(&cell1, &multi).unwrap(); + let p1 = d.para(StoryRef::Body, &cell1.path).unwrap(); + assert_eq!(d.styles.resolve_para_in(&p1.props, Some(tp)).shading, Some(crate::Rgb(0x22, 0x22, 0x22))); +} + /// The first paragraph of the deepest cell, following the first table at each level. fn deepest(d: &Document) -> Path { let (mut path, mut blocks) = (Vec::new(), &d.body); @@ -304,6 +480,33 @@ fn fragment_without_parts_never_shows_an_unrelated_story() { assert_eq!(got[2], None, "a header isn't a text box"); } +#[test] +fn fragment_extracts_text_box_stories_in_object_order() { + let mut p = Paragraph::new(); + p.insert_object(0, box_shape(Some(20)), &CharProps::default()).unwrap(); + p.insert_object(p.text.len(), box_shape(Some(10)), &CharProps::default()).unwrap(); + let mut parts = BTreeMap::new(); + parts.insert( + 10, + crate::Part { + kind: PartKind::TextBox, + blocks: vec![para_block(Paragraph::with_text("Second", CharProps::default()))], + body: Default::default(), + }, + ); + parts.insert( + 20, + crate::Part { + kind: PartKind::TextBox, + blocks: vec![para_block(Paragraph::with_text("First", CharProps::default()))], + body: Default::default(), + }, + ); + let f = Fragment { blocks: vec![Block::Para(p)], parts, ..Default::default() }; + assert_eq!(f.plain_text(), "First\nSecond"); + assert_eq!(f.clipboard_text(), "First\nSecond"); +} + #[test] fn self_nested_text_box_paste_is_bounded() { let mut d = doc(&["x"]); @@ -989,6 +1192,61 @@ fn insert_fragment_remaps_conflicting_media_keys() { assert_eq!(remapped, other_key); } +#[test] +fn adopt_fragment_copies_and_remaps_conflicting_media_in_blocks_and_text_boxes() { + let mut d = doc(&["destination"]); + d.media.insert("image1.png".into(), Arc::new(vec![1, 1, 1])); + + let mut frag_media = std::collections::BTreeMap::new(); + frag_media.insert("image1.png".into(), Arc::new(vec![2, 2, 2])); + frag_media.insert("missing.png".into(), Arc::new(vec![3, 3, 3])); + + let img = |key: &str| InlineObject::Image { + media: key.into(), + w: 10.0, + h: 10.0, + alt: String::new(), + float: Default::default(), + crop: [0.0; 4], + fx: Default::default(), + ole: None, + }; + + let mut tb_para = Paragraph::with_text(&crate::para::OBJ.to_string(), CharProps::default()); + tb_para.objects.push(img("image1.png")); + let mut parts = std::collections::BTreeMap::new(); + parts.insert(7, Part { kind: PartKind::TextBox, blocks: vec![para_block(tb_para)], body: Default::default() }); + + let mut top_para = Paragraph::with_text(&format!("{}{}", crate::para::OBJ, crate::para::OBJ), CharProps::default()); + top_para.objects.push(img("missing.png")); + top_para.objects.push(InlineObject::Shape { + kind: crate::para::ShapeKind::TextBox, + w: 40.0, + h: 40.0, + fill: None, + stroke: None, + stroke_width: 1.0, + float: Default::default(), + story: Some(7), + freeform: None, + effects: Default::default(), + extra: Default::default(), + }); + let frag = Fragment { blocks: vec![Block::Para(top_para)], parts, media: frag_media }; + + let adopted = d.adopt_fragment(&frag); + assert_eq!(d.media["image1.png"].as_slice(), &[1, 1, 1]); + assert_eq!(d.media["missing.png"].as_slice(), &[3, 3, 3]); + let remapped_key = d.media.keys().find(|k| k.as_str() != "image1.png" && k.as_str() != "missing.png").unwrap(); + assert_eq!(d.media[remapped_key].as_slice(), &[2, 2, 2]); + + let adopted_para = adopted[0].as_para().unwrap(); + assert!(matches!(&adopted_para.objects[0], InlineObject::Image { media, .. } if media == "missing.png")); + let adopted_tb_id = adopted_para.objects[1].text_box().unwrap(); + let adopted_tb_para = d.parts[&adopted_tb_id].blocks[0].as_para().unwrap(); + assert!(matches!(&adopted_tb_para.objects[0], InlineObject::Image { media, .. } if media == remapped_key)); +} + /// #6788: splitting a paragraph after its first letters leaves the drop cap on the first /// paragraph only; the new one (also when it is empty) is plain. A split at offset 0 is unchanged. #[test] @@ -1023,3 +1281,130 @@ fn split_paragraph_keeps_the_drop_cap_on_the_first_paragraph_only() { d.split_paragraph(&Pos::body(0, 0)).unwrap(); assert_eq!((drop_cap(&d, 0), drop_cap(&d, 1)), (cap.clone(), cap)); } + +/// #5906: Copying a range spanning from inside a table to an outside paragraph preserves the table. +#[test] +fn copy_range_preserves_table_structure_across_blocks() { + let mut d = Document::new(); + let mut t = Table::new(2, 2, 200.0); + t.rows[0].cells[0].blocks = vec![para_block(Paragraph::with_text("A1", CharProps::default()))]; + t.rows[0].cells[1].blocks = vec![para_block(Paragraph::with_text("B1", CharProps::default()))]; + t.rows[1].cells[0].blocks = vec![para_block(Paragraph::with_text("A2", CharProps::default()))]; + t.rows[1].cells[1].blocks = vec![para_block(Paragraph::with_text("B2", CharProps::default()))]; + d.body = vec![Arc::new(Block::Table(t)), Arc::new(Block::Para(Paragraph::with_text("Trailing", CharProps::default())))]; + let start = d.start_of(StoryRef::Body); + let end = d.end_of(StoryRef::Body); + let frag = d.copy_range(&start, &end); + assert_eq!(frag.blocks.len(), 2, "expected table and trailing paragraph, got {:?}", frag.blocks); + let Block::Table(tbl) = &frag.blocks[0] else { panic!("first block should be Table") }; + assert_eq!(tbl.rows.len(), 2, "copied table row count"); + assert_eq!(tbl.cols(), 2, "copied table col count"); + let c00 = tbl.rows[0].cells[0].blocks.first().and_then(|b| match &**b { + Block::Para(p) => Some(p.text.as_str()), + _ => None, + }); + assert_eq!(c00, Some("A1"), "cell (0, 0) text"); + let Block::Para(trail) = &frag.blocks[1] else { panic!("second block should be Para") }; + assert_eq!(trail.text.as_str(), "Trailing"); +} + +/// #5906: Copying a range enclosing a table between paragraphs preserves the table block. +#[test] +fn copy_range_preserves_table_between_paragraphs() { + let mut d = Document::new(); + let mut t = Table::new(2, 2, 200.0); + t.rows[0].cells[0].blocks = vec![para_block(Paragraph::with_text("A1", CharProps::default()))]; + t.rows[0].cells[1].blocks = vec![para_block(Paragraph::with_text("B1", CharProps::default()))]; + t.rows[1].cells[0].blocks = vec![para_block(Paragraph::with_text("A2", CharProps::default()))]; + t.rows[1].cells[1].blocks = vec![para_block(Paragraph::with_text("B2", CharProps::default()))]; + d.body = vec![ + Arc::new(Block::Para(Paragraph::with_text("Intro", CharProps::default()))), + Arc::new(Block::Table(t)), + Arc::new(Block::Para(Paragraph::with_text("Outro", CharProps::default()))), + ]; + let start = Pos { story: StoryRef::Body, path: Path(vec![0]), off: 0 }; + let end = d.end_of(StoryRef::Body); + let frag = d.copy_range(&start, &end); + assert_eq!(frag.blocks.len(), 3, "expected intro, table, and outro, got {:?}", frag.blocks); + assert!(matches!(&frag.blocks[0], Block::Para(p) if p.text == "Intro")); + let Block::Table(tbl) = &frag.blocks[1] else { panic!("second block should be Table") }; + assert_eq!(tbl.rows.len(), 2, "copied table row count"); + assert_eq!(tbl.cols(), 2, "copied table col count"); + assert!(matches!(&frag.blocks[2], Block::Para(p) if p.text == "Outro")); +} + +/// #5906: Copy range across cells inside a table preserves all traversed paragraphs in linear order. +#[test] +fn copy_range_linear_cross_cells_preserves_all_traversed_paragraphs() { + let mut d = Document::new(); + let mut t = Table::new(3, 3, 300.0); + for (r, row) in t.rows.iter_mut().enumerate() { + for (c, cell) in row.cells.iter_mut().enumerate() { + cell.blocks = vec![para_block(Paragraph::with_text(&format!("R{r}C{c}"), CharProps::default()))]; + } + } + d.body = vec![Arc::new(Block::Table(t))]; + // Start at (0, 1) offset 1 ("0C1"), end at (1, 1) offset 3 ("R1C") + let a = Pos { story: StoryRef::Body, path: Path(vec![0, 0, 1, 0]), off: 1 }; + let b = Pos { story: StoryRef::Body, path: Path(vec![0, 1, 1, 0]), off: 3 }; + let frag = d.copy_range(&a, &b); + assert_eq!(frag.blocks.len(), 4, "all 4 traversed cells in linear order"); + let texts: Vec<&str> = frag + .blocks + .iter() + .filter_map(|b| match b { + Block::Para(p) => Some(p.text.as_str()), + _ => None, + }) + .collect(); + assert_eq!(texts, vec!["0C1", "R0C2", "R1C0", "R1C"]); +} + +/// #5906: Copy range from paragraph before table into non-corner cell preserves all traversed text in linear order. +#[test] +fn copy_range_from_para_before_table_to_non_corner_cell() { + let mut d = Document::new(); + let mut t = Table::new(3, 3, 300.0); + for (r, row) in t.rows.iter_mut().enumerate() { + for (c, cell) in row.cells.iter_mut().enumerate() { + cell.blocks = vec![para_block(Paragraph::with_text(&format!("R{r}C{c}"), CharProps::default()))]; + } + } + d.body = vec![Arc::new(Block::Para(Paragraph::with_text("LeadingText", CharProps::default()))), Arc::new(Block::Table(t))]; + let a = Pos { story: StoryRef::Body, path: Path(vec![0]), off: 7 }; + let b = Pos { story: StoryRef::Body, path: Path(vec![1, 1, 1, 0]), off: 3 }; + let frag = d.copy_range(&a, &b); + let texts: Vec<&str> = frag + .blocks + .iter() + .filter_map(|b| match b { + Block::Para(p) => Some(p.text.as_str()), + _ => None, + }) + .collect(); + assert_eq!(texts, vec!["Text", "R0C0", "R0C1", "R0C2", "R1C0", "R1C"]); +} + +/// #5906: Copy range from non-corner cell into following paragraph preserves all traversed text in linear order. +#[test] +fn copy_range_from_cell_into_para_after_table() { + let mut d = Document::new(); + let mut t = Table::new(2, 2, 200.0); + t.rows[0].cells[0].blocks = vec![para_block(Paragraph::with_text("Hello", CharProps::default()))]; + t.rows[0].cells[1].blocks = vec![para_block(Paragraph::with_text("World", CharProps::default()))]; + t.rows[1].cells[0].blocks = vec![para_block(Paragraph::with_text("Foo", CharProps::default()))]; + t.rows[1].cells[1].blocks = vec![para_block(Paragraph::with_text("Bar", CharProps::default()))]; + d.body = vec![Arc::new(Block::Table(t)), Arc::new(Block::Para(Paragraph::with_text("Trailing", CharProps::default())))]; + let a = Pos { story: StoryRef::Body, path: Path(vec![0, 0, 1, 0]), off: 1 }; + let b = Pos { story: StoryRef::Body, path: Path(vec![1]), off: 5 }; + let frag = d.copy_range(&a, &b); + let texts: Vec<&str> = frag + .blocks + .iter() + .filter_map(|b| match b { + Block::Para(p) => Some(p.text.as_str()), + _ => None, + }) + .collect(); + assert_eq!(texts, vec!["orld", "Foo", "Bar", "Trail"]); +} diff --git a/crates/doc/src/numbering.rs b/crates/doc/src/numbering.rs index 5ab94ea877..1e75e227fb 100644 --- a/crates/doc/src/numbering.rs +++ b/crates/doc/src/numbering.rs @@ -109,6 +109,55 @@ pub struct Numbering { pub nums: Vec, } +/// Borrowed definition lookups for a walk over immutable numbering. The first occurrence of +/// each id wins, as in the linear methods; the public vectors and saved data are unchanged. +pub struct NumberingIndex<'a> { + nums: HashMap, + abstracts: HashMap, +} + +impl<'a> NumberingIndex<'a> { + pub fn new(numbering: &'a Numbering) -> Self { + let mut nums = HashMap::new(); + let mut abstracts = HashMap::new(); + for n in &numbering.nums { + nums.entry(n.id).or_insert(n); + } + for a in &numbering.abstracts { + abstracts.entry(a.id).or_insert(a); + } + Self { nums, abstracts } + } + + pub fn num(&self, id: u32) -> Option<&'a Num> { + self.nums.get(&id).copied() + } + + pub fn abstract_of(&self, num: u32) -> Option<&'a AbstractNum> { + self.abstract_for(self.num(num)?) + } + + fn abstract_for(&self, num: &Num) -> Option<&'a AbstractNum> { + self.abstracts.get(&num.abstract_id).copied() + } + + pub fn level(&self, num: u32, level: u8) -> Option<&'a Level> { + let n = self.num(num)?; + n.level(self.abstract_for(n), level) + } + + /// Whether a paragraph has a defined label, without advancing the counters. + pub fn shows_label(&self, num: u32, level: u8) -> bool { + self.num(num).is_some_and(|n| self.abstract_for(n).is_some_and(|a| n.level(Some(a), level.min(8)).is_some())) + } +} + +impl Num { + fn level<'a>(&'a self, abstract_num: Option<&'a AbstractNum>, level: u8) -> Option<&'a Level> { + self.level_overrides.iter().find(|(i, _)| *i == level).map(|(_, l)| l).or_else(|| abstract_num?.levels.get(level as usize)) + } +} + /// Built-in list kinds for the Bullets / Numbering / Multilevel galleries. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] @@ -321,10 +370,28 @@ impl Counters { /// Advance the counter for `num`/`level` and return the label (`"1."`, `"a)"`, `"•"`). pub fn next_label(&mut self, numbering: &Numbering, num: u32, level: u8) -> Option<(String, Level)> { let n = numbering.num(num)?; + let abs = numbering.abstracts.iter().find(|a| a.id == n.abstract_id)?; + self.next_label_from(n, abs, level) + } + + /// Like [`Self::next_label`], using one walk's borrowed definition index. + pub fn next_label_indexed(&mut self, numbering: &NumberingIndex<'_>, num: u32, level: u8) -> Option<(String, Level)> { + let n = numbering.num(num)?; + let abs = numbering.abstract_for(n)?; + self.next_label_from(n, abs, level) + } + + /// Like [`Self::values`], using one walk's borrowed definition index. + pub fn values_indexed(&self, numbering: &NumberingIndex<'_>, num: u32) -> Option<[u32; 9]> { let abs = numbering.abstract_of(num)?; + Some(self.state.get(&abs.id).copied().unwrap_or([0; 9])) + } + + fn next_label_from(&mut self, n: &Num, abs: &AbstractNum, level: u8) -> Option<(String, Level)> { + let num = n.id; let lv = (level as usize).min(8); // This list's own definition of a level wins over its abstract list's. - let level_def = |k: usize| numbering.level(num, k as u8); + let level_def = |k: usize| n.level(Some(abs), k as u8); // A "none" level (Word's numFmt none) still counts and restarts the levels below it; only // its number reads as nothing, so its literal text ("RESPONSE:") shows (#4985). let def = level_def(lv)?.clone(); @@ -378,7 +445,7 @@ impl Counters { let vals = *st; let started = *fl; let numeric = def.format != NumFormat::Bullet; - let label = if numeric { render_label(numbering, num, &def, &vals, &started) } else { def.text.clone() }; + let label = if numeric { render_label(level_def, &def, &vals, &started) } else { def.text.clone() }; // A "none" level shows its literal text, but has no number of its own for a reference to // show (#4985): it is kept as one that shows none. let counted = if def.format == NumFormat::None { @@ -400,18 +467,19 @@ impl Counters { /// the last paragraph at that level showed (`"14."` while walking clause 14's sub-clauses). /// `None` for a bullet or "none" level, or a level the list doesn't define. pub fn current_label(&self, numbering: &Numbering, num: u32, level: u8) -> Option { - let abs = numbering.abstract_of(num)?; + let n = numbering.num(num)?; + let abs = numbering.abstracts.iter().find(|a| a.id == n.abstract_id)?; if let Some(last) = self.labels.get(&(abs.id, level.min(8))) { return last.label.clone(); } // A deeper item can count a level implicitly without rendering a paragraph there. - let def = numbering.level(num, level.min(8))?; + let def = n.level(Some(abs), level.min(8))?; if matches!(def.format, NumFormat::None | NumFormat::Bullet) { return None; } let vals = self.state.get(&abs.id).copied().unwrap_or([0; 9]); let started = self.flags.get(&abs.id).copied().unwrap_or_default(); - Some(render_label(numbering, num, def, &vals, &started)) + Some(render_label(|k| n.level(Some(abs), k as u8), def, &vals, &started)) } /// Levels shown by the last rendered label, or the current definition for an implicit level. @@ -444,8 +512,7 @@ pub fn template_levels(text: &str) -> Vec { } /// Render a list label without advancing counters, retaining the existing hostile-input caps. -fn render_label(numbering: &Numbering, num: u32, def: &Level, vals: &[u32; 9], started: &[LevelFlags; 9]) -> String { - let level_def = |k: usize| numbering.level(num, k as u8); +fn render_label<'a>(level_def: impl Fn(usize) -> Option<&'a Level>, def: &Level, vals: &[u32; 9], started: &[LevelFlags; 9]) -> String { let mut label = String::new(); // Word's level text is short; .docx and the lists command already cap it at 64. let mut chars = def.text.chars().take(MAX_LEVEL_TEXT).peekable(); @@ -457,10 +524,11 @@ fn render_label(numbering: &Numbering, num: u32, def: &Level, vals: &[u32; 9], s let k = (d as usize).saturating_sub(1).min(8); let val = vals.get(k).copied().unwrap_or(0); let counted = started.get(k).is_some_and(|f| f.started); - let val = if counted { val } else { level_def(k).map(|l| l.start).unwrap_or(1) }; + let level = level_def(k); + let val = if counted { val } else { level.map_or(1, |l| l.start) }; // Legal numbering (w:isLgl) shows every level in Arabic digits, whatever its own // format (二 of a Chinese outline becomes 2 in "2.1"); a "none" level stays empty. - let fmt = match level_def(k).map(|l| l.format).unwrap_or(NumFormat::Decimal) { + let fmt = match level.map_or(NumFormat::Decimal, |l| l.format) { f @ (NumFormat::DecimalZero | NumFormat::None) => f, _ if def.legal => NumFormat::Decimal, f => f, @@ -773,4 +841,72 @@ mod tests { let mut c = Counters::default(); assert_eq!(c.next_label(&n, r, 0).unwrap().0, "Part V"); } + + #[test] + fn definition_index_keeps_first_ids_overrides_and_missing_definitions() { + let override_level = Level { start: 0, text: "own %1".into(), ..Default::default() }; + let n = Numbering { + abstracts: vec![ + AbstractNum { id: 7, levels: levels_for(ListKind::Numbered), ..Default::default() }, + AbstractNum { id: 7, levels: levels_for(ListKind::Bullet), ..Default::default() }, + AbstractNum { id: 8, levels: Vec::new(), ..Default::default() }, + ], + nums: vec![ + Num { id: 0, abstract_id: 7, ..Default::default() }, + Num { id: 1, abstract_id: 7, ..Default::default() }, + Num { id: 1, abstract_id: 8, ..Default::default() }, + Num { id: 2, abstract_id: 99, level_overrides: vec![(0, override_level.clone())], ..Default::default() }, + Num { id: 3, abstract_id: 8, level_overrides: vec![(0, override_level), (0, Level::default())], ..Default::default() }, + ], + }; + let index = NumberingIndex::new(&n); + for id in [0, 1, 2, 3, 7, 99, u32::MAX] { + assert_eq!(index.num(id), n.num(id)); + assert_eq!(index.abstract_of(id), n.abstract_of(id)); + for level in [0, 1, 2, 8, 9, u8::MAX] { + assert_eq!(index.level(id, level), n.level(id, level)); + assert_eq!(index.shows_label(id, level), n.shows_label(id, level)); + } + } + assert_eq!(index.level(3, 0).unwrap().start, 0); + assert!(index.level(2, 0).is_some(), "a local override exists even without its abstract"); + assert!(!index.shows_label(2, 0), "counting still requires the abstract list"); + } + + #[test] + fn indexed_counters_preserve_shared_state_starts_and_restarts() { + let mut n = Numbering::default(); + let a = n.add_list(ListKind::Legal); + let b = n.restart(a).unwrap(); + let bullet = n.add_list(ListKind::Bullet); + let none = n.add_list(ListKind::Numbered); + n.abstracts[0].levels[0].start = 0; + n.abstracts[0].levels[1].restart_after = Some(1); + n.abstracts[0].levels[2].restart = false; + n.abstracts[0].levels[3].format = NumFormat::DecimalZero; + n.nums[0].start_overrides = vec![(1, 5), (1, 99)]; + n.nums[1].start_overrides = vec![(0, 9), (2, 0)]; + n.nums[1].level_overrides = vec![ + (2, Level { format: NumFormat::UpperRoman, text: "%1.%2.%3.".into(), legal: true, ..Default::default() }), + (2, Level { format: NumFormat::None, ..Default::default() }), + ]; + let literal = &mut n.abstracts.last_mut().unwrap().levels[0]; + literal.format = NumFormat::None; + literal.text = "RESPONSE: %1".into(); + literal.legal = true; + let index = NumberingIndex::new(&n); + let (mut linear, mut indexed) = (Counters::default(), Counters::default()); + let sequence = [(a, 2), (a, 0), (a, 1), (a, 2), (a, 1), (b, 2), (b, 0), (a, 2), (a, 3), (bullet, 0), (none, 0), (a, 255), (999, 0)]; + for (num, level) in sequence.into_iter().cycle().take(120) { + assert_eq!(indexed.next_label_indexed(&index, num, level), linear.next_label(&n, num, level), "{num}/{level}"); + for id in [a, b, bullet, none, 999] { + assert_eq!(indexed.values_indexed(&index, id), linear.values(&n, id)); + } + } + assert!(index.shows_label(none, 0)); + assert_eq!(indexed.next_label_indexed(&index, none, 0).unwrap().0, "RESPONSE: "); + assert_eq!(indexed.next_label_indexed(&index, none, 0), linear.next_label(&n, none, 0)); + assert_eq!(indexed.current_label(&n, none, 0), None); + assert_eq!(indexed.current_label(&n, a, 0), linear.current_label(&n, a, 0)); + } } diff --git a/crates/doc/src/para.rs b/crates/doc/src/para.rs index 0ed90870b1..7e2104de8c 100644 --- a/crates/doc/src/para.rs +++ b/crates/doc/src/para.rs @@ -340,6 +340,72 @@ impl Paragraph { self.runs = out; } + /// Make the objects match the U+FFFC markers one to one (files lie): drop surplus objects, + /// and remove markers past the last object. Runs must already cover the text. + /// + /// One scan finds the unmatched markers, one pass removes them and the runs and objects are + /// fixed up once, so the cost is linear in the paragraph however many markers are unmatched. + /// There is no cap on the markers: stopping early would leave markers without objects. + pub fn reconcile_objects(&mut self) { + let keep = self.objects.len(); + // Byte offsets of the unmatched markers (every marker after the first `keep`), ascending. + let mut seen = 0usize; + let mut drop: Vec = Vec::new(); + for (i, _) in self.text.match_indices(OBJ) { + crate::work::steps(1); + if seen >= keep { + drop.push(i); + } + seen += 1; + } + if self.objects.len() > seen { + self.objects.truncate(seen); + self.touch(); + } + if drop.is_empty() { + return; + } + let w = OBJ.len_utf8(); + if self.text.len() == drop.len() * w { + // Emptying: the mark keeps the formatting of what was deleted (as `delete` does). + let revisions = (self.mark.ins, self.mark.del, self.mark.fmt_change.clone()); + let mut mark = self.props_of_char(0).clone(); + (mark.ins, mark.del, mark.fmt_change) = revisions; + self.mark = mark; + } + // Shrink the runs: each removed marker takes `w` bytes off the run that holds it. + let mut d = 0usize; + let mut start = 0usize; + for r in &mut self.runs { + crate::work::steps(1); + let re = start + r.len; + let mut cut = 0usize; + while let Some(&off) = drop.get(d) { + crate::work::steps(1); + if off >= re { + break; + } + if off >= start { + cut += w; + } + d += 1; + } + start = re; + r.len -= cut.min(r.len); + } + let mut out = String::with_capacity(self.text.len() - drop.len() * w); + // The pieces between markers; marker `k` sits before piece `k + 1` and stays if matched. + for (k, piece) in self.text.split(OBJ).enumerate() { + if k > 0 && k <= keep { + out.push(OBJ); + } + out.push_str(piece); + } + self.text = out; + self.normalize(); + self.touch(); + } + /// Delete `a..b` (bytes). Objects inside are removed. pub fn delete(&mut self, a: usize, b: usize) -> Result<()> { let (a, b) = (a.min(b), a.max(b)); @@ -553,7 +619,8 @@ impl Paragraph { /// The word around `off` (double-click): (start, end) without trailing space. pub fn word_at(&self, off: usize) -> (usize, usize) { let off = self.clamp(off); - let is_w = |c: char| crate::bidi::is_word_char(c); + // Word's word unit takes a typographic apostrophe (’) like `'`, at either end too (#6517). + let is_w = |c: char| crate::bidi::is_word_char(c) || c == '’'; let mut a = off; for (i, c) in self.text.get(..off).unwrap_or("").char_indices().rev() { if !is_w(c) { @@ -786,6 +853,21 @@ mod tests { assert_eq!(p.prev_boundary(0), 0); } + #[test] + fn word_at_takes_a_typographic_apostrophe_like_a_straight_one() { + // Byte offsets: `’` is three bytes. Word: `don’t ` (#6517). + let p = Paragraph::with_text("don’t stop", CharProps::default()); + assert_eq!(p.word_at(1), (0, 8)); + assert_eq!(p.word_at(2), (0, 8)); + let p = Paragraph::with_text("the dogs’ bone", CharProps::default()); + assert_eq!(p.word_at(5), (4, 12)); + let p = Paragraph::with_text("’tis here", CharProps::default()); + assert_eq!(p.word_at(3), (0, 7)); + assert_eq!(p.word_at(4), (0, 7)); + let p = Paragraph::with_text("well-known", CharProps::default()); + assert_eq!(p.word_at(1), (0, 4)); + } + proptest::proptest! { #[test] fn edits_keep_runs_consistent(ops in proptest::collection::vec((0u8..4, 0usize..40, 0usize..40, "[a-zé ]{0,5}"), 0..40)) { diff --git a/crates/doc/src/para/inline_object.rs b/crates/doc/src/para/inline_object.rs index c33eb078e4..f5a0bc95c5 100644 --- a/crates/doc/src/para/inline_object.rs +++ b/crates/doc/src/para/inline_object.rs @@ -291,25 +291,47 @@ impl InlineObject { _ => None, } } - /// The text box stories this object shows: a text box's, or its group members'. + /// The text box stories this object shows: a text box's, or its group members' (nested groups + /// included, in member order). pub fn text_boxes(&self) -> Vec { match self { InlineObject::Shape { story: Some(id), .. } => vec![*id], - InlineObject::Group { children, .. } => children.iter().filter_map(|c| c.obj.text_box()).collect(), + InlineObject::Group { children, .. } => { + let mut out = Vec::new(); + let mut todo: Vec<&InlineObject> = children.iter().rev().map(|c| &c.obj).collect(); + while let Some(obj) = todo.pop() { + match obj { + InlineObject::Shape { story: Some(id), .. } => out.push(*id), + InlineObject::Group { children, .. } => { + todo.extend(children.iter().rev().map(|c| &c.obj)); + } + _ => {} + } + } + out + } _ => Vec::new(), } } - /// The text box story slots of this object and its group members, to repoint. + /// The text box story slots of this object and its group members (nested groups included, in + /// member order), to repoint. pub fn text_box_slots(&mut self) -> Vec<&mut Option> { match self { InlineObject::Shape { story, .. } => vec![story], - InlineObject::Group { children, .. } => children - .iter_mut() - .filter_map(|c| match &mut c.obj { - InlineObject::Shape { story, .. } => Some(story), - _ => None, - }) - .collect(), + InlineObject::Group { children, .. } => { + let mut out = Vec::new(); + let mut todo: Vec<&mut InlineObject> = children.iter_mut().rev().map(|c| &mut c.obj).collect(); + while let Some(obj) = todo.pop() { + match obj { + InlineObject::Shape { story, .. } => out.push(story), + InlineObject::Group { children, .. } => { + todo.extend(children.iter_mut().rev().map(|c| &mut c.obj)); + } + _ => {} + } + } + out + } _ => Vec::new(), } } diff --git a/crates/doc/src/props.rs b/crates/doc/src/props.rs index 38feba083c..77dcc90024 100644 --- a/crates/doc/src/props.rs +++ b/crates/doc/src/props.rs @@ -23,7 +23,8 @@ mod para_props; mod table_props; pub use char_props::{ - CharProps, CombineBrackets, DEFAULT_FONT_SIZE, EastAsianLayout, EmphasisMark, Highlight, Ligatures, NumChange, PropChange, Underline, VertAlign, + CharProps, CombineBrackets, DEFAULT_FONT_SIZE, EastAsianLayout, EmphasisMark, Highlight, Ligatures, NumChange, PropChange, ThemeFont, Underline, + VertAlign, }; pub use color::{Rgb, TextColor}; pub use para_props::{ @@ -200,4 +201,26 @@ mod tests { assert_eq!(changed.sym_font.as_deref(), Some("Wingdings")); assert_eq!(p.cleared().sym_font.as_deref(), Some("Wingdings")); } + + #[test] + fn named_east_asian_font_replaces_theme_slot_and_minus_round_trips() { + let mut base = CharProps { font_ea: Some("Times New Roman".into()), font_ea_theme: Some(ThemeFont::MinorEastAsia), ..Default::default() }; + let named = CharProps { font_ea: Some("SimSun".into()), ..Default::default() }; + base.overlay(&named); + assert_eq!(base.font_ea.as_deref(), Some("SimSun")); + assert_eq!(base.font_ea_theme, None); + + // Changing only `font_ea` while keeping `font_ea_theme` preserves the slot across minus/overlay. + let themed_base = CharProps { font_ea: Some("SimSun".into()), font_ea_theme: Some(ThemeFont::MinorEastAsia), ..Default::default() }; + let run = CharProps { font_ea: Some("MS Mincho".into()), ..themed_base.clone() }; + let mut back = themed_base.clone(); + back.overlay(&run.clone().minus(&themed_base)); + assert_eq!(back, run); + + // Clearing `font_ea_theme` while keeping the same `font_ea` preserves `font_ea` in the patch. + let cleared_slot = CharProps { font_ea_theme: None, ..themed_base.clone() }; + let mut back_cleared = themed_base.clone(); + back_cleared.overlay(&cleared_slot.clone().minus(&themed_base)); + assert_eq!(back_cleared, cleared_slot); + } } diff --git a/crates/doc/src/props/char_props.rs b/crates/doc/src/props/char_props.rs index a4aaf88604..77a77ddec1 100644 --- a/crates/doc/src/props/char_props.rs +++ b/crates/doc/src/props/char_props.rs @@ -329,6 +329,10 @@ pub struct CharProps { /// inherit, then `font`. #[serde(skip_serializing_if = "Option::is_none")] pub font_ea: Option, + /// The theme font slot of the East Asian font (`w:rFonts/@w:eastAsiaTheme`: `minorEastAsia`, + /// `majorEastAsia`…), taking precedence over `font_ea` when set. + #[serde(skip_serializing_if = "Option::is_none")] + pub font_ea_theme: Option, /// Complex-script size, points (`w:szCs`). `None` leaves the inherited value unchanged. #[serde(skip_serializing_if = "Option::is_none")] pub size_cs: Option, @@ -450,6 +454,62 @@ impl CombineBrackets { } } +/// A theme font slot in `w:rFonts` (`ST_Theme`, ECMA-376 §17.18.96). +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum ThemeFont { + MajorEastAsia, + MajorBidi, + MajorAscii, + MajorHAnsi, + MinorEastAsia, + MinorBidi, + MinorAscii, + MinorHAnsi, +} + +impl ThemeFont { + const ALL: [ThemeFont; 8] = [ + ThemeFont::MajorEastAsia, + ThemeFont::MajorBidi, + ThemeFont::MajorAscii, + ThemeFont::MajorHAnsi, + ThemeFont::MinorEastAsia, + ThemeFont::MinorBidi, + ThemeFont::MinorAscii, + ThemeFont::MinorHAnsi, + ]; + + /// The OOXML `ST_Theme` value. + pub fn as_str(self) -> &'static str { + match self { + ThemeFont::MajorEastAsia => "majorEastAsia", + ThemeFont::MajorBidi => "majorBidi", + ThemeFont::MajorAscii => "majorAscii", + ThemeFont::MajorHAnsi => "majorHAnsi", + ThemeFont::MinorEastAsia => "minorEastAsia", + ThemeFont::MinorBidi => "minorBidi", + ThemeFont::MinorAscii => "minorAscii", + ThemeFont::MinorHAnsi => "minorHAnsi", + } + } + + /// Parse an OOXML `ST_Theme` value (`None` for any value outside the schema). + pub fn parse(s: &str) -> Option { + ThemeFont::ALL.into_iter().find(|t| t.as_str() == s) + } + + /// Whether this slot picks the theme's major (heading) font rather than minor (body). + pub fn is_major(self) -> bool { + matches!(self, ThemeFont::MajorEastAsia | ThemeFont::MajorBidi | ThemeFont::MajorAscii | ThemeFont::MajorHAnsi) + } + + /// Whether this is one of the Latin theme slots (`ascii` / `hAnsi`). + pub fn is_latin(self) -> bool { + matches!(self, ThemeFont::MajorAscii | ThemeFont::MajorHAnsi | ThemeFont::MinorAscii | ThemeFont::MinorHAnsi) + } +} + /// A tracked formatting change (ECMA-376 §17.13.5: `w:rPrChange`, `w:pPrChange`, /// `w:tblPrChange`, `w:trPrChange`, `w:tcPrChange`, `w:sectPrChange`): the properties as they /// were before the change, and the revision (author, date) that made it. @@ -509,7 +569,16 @@ impl CharProps { } fn minus_script_style(&mut self, base: &CharProps) { - drop_same_fields!(self, base; cs, font_cs, font_ea, size_cs, bold_cs, italic_cs, lang_bidi, lang_ea, east_asian_layout); + // A theme slot stays while its named font does; a same font stays when its slot differs. + let keep = self.font_ea_theme; + let ea = self.font_ea.clone(); + drop_same_fields!(self, base; cs, font_cs, font_ea, font_ea_theme, size_cs, bold_cs, italic_cs, lang_bidi, lang_ea, east_asian_layout); + if self.font_ea.is_none() && keep != base.font_ea_theme { + self.font_ea = ea; + } + if self.font_ea.is_some() { + self.font_ea_theme = keep; + } } fn minus_document_marks(&mut self, base: &CharProps) { @@ -540,7 +609,12 @@ impl CharProps { } fn overlay_script_style(&mut self, patch: &CharProps) { - overlay_fields!(self, patch; cs, font_cs, font_ea, size_cs, bold_cs, italic_cs, lang_bidi, lang_ea, east_asian_layout); + // A named East Asian font without a theme slot replaces the slot too: Word gives the slot + // precedence over the named font, so keeping it would hide the font just chosen. + if patch.font_ea.is_some() && patch.font_ea_theme.is_none() { + self.font_ea_theme = None; + } + overlay_fields!(self, patch; cs, font_cs, font_ea, font_ea_theme, size_cs, bold_cs, italic_cs, lang_bidi, lang_ea, east_asian_layout); } fn overlay_document_marks(&mut self, patch: &CharProps) { diff --git a/crates/doc/src/props/para_props.rs b/crates/doc/src/props/para_props.rs index a48540248e..619f13e917 100644 --- a/crates/doc/src/props/para_props.rs +++ b/crates/doc/src/props/para_props.rs @@ -506,6 +506,11 @@ pub struct ParaProps { /// file (not laid out yet); Word sizes a line by it, so dropping it changes Word's pages. #[serde(skip_serializing_if = "Option::is_none")] pub text_alignment: Option, + /// A list item's paragraph after its first (or a list header's), with no number of its own, + /// at this list level (0..=8): formats with list items (ODT, HTML, Markdown) keep it in the + /// item. Set only directly, never by a style. + #[serde(skip_serializing_if = "Option::is_none")] + pub list_item: Option, } impl ParaProps { diff --git a/crates/doc/src/resolve.rs b/crates/doc/src/resolve.rs index 0a2e264de6..79278a53e1 100644 --- a/crates/doc/src/resolve.rs +++ b/crates/doc/src/resolve.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use crate::props::{ - Align, Border, Borders, CharProps, Highlight, LineSpacing, NumRef, ParaProps, Rgb, TabAlign, TabStop, TextColor, Underline, VertAlign, + Align, Border, Borders, CharProps, Highlight, LineSpacing, NumRef, ParaProps, Rgb, TabAlign, TabStop, TextColor, ThemeFont, Underline, VertAlign, }; use crate::styles::{StyleKind, StyleSheet}; @@ -71,6 +71,10 @@ pub struct ResolvedChar { /// East Asian font (Chinese, Japanese and Korean text), when one is set. #[serde(skip_serializing_if = "Option::is_none")] pub font_ea: Option, + /// Theme font slot for the East Asian font (`w:eastAsiaTheme`), taking precedence over + /// `font_ea` when set. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub font_ea_theme: Option, pub size_cs: f32, pub bold_cs: bool, pub italic_cs: bool, @@ -117,6 +121,7 @@ impl ResolvedChar { cs: c.cs.unwrap_or(false), font_cs: c.font_cs.clone().or_else(|| c.font.clone()).unwrap_or_else(|| crate::styles::BODY_FONT.to_string()), font_ea: c.font_ea.clone(), + font_ea_theme: c.font_ea_theme, size_cs: c.size_cs.or(c.size).unwrap_or(crate::props::DEFAULT_FONT_SIZE).clamp(1.0, 1638.0), // A run marked complex script (`w:cs`) is bold and italic only by `w:bCs` and `w:iCs`: // Word draws Thai with `` and no `w:bCs` upright and plain (measured in diff --git a/crates/doc/src/review.rs b/crates/doc/src/review.rs index 5a0b96820a..949f55dbd5 100644 --- a/crates/doc/src/review.rs +++ b/crates/doc/src/review.rs @@ -42,11 +42,27 @@ pub struct Revision { /// insertion or deletion. #[serde(skip_serializing_if = "Option::is_none")] pub move_name: Option, + /// The change's UTC timestamp: from the file (`w16du:dateUtc`, where `date` is the local time + /// Word writes in `w:date`), or the time WordCraft stamped the change with. `None` when the + /// file doesn't give it. + #[serde(skip_serializing_if = "Option::is_none")] + pub date_utc: Option, } impl Revision { pub fn new(kind: RevisionKind, author: impl Into, date: impl Into) -> Revision { - Revision { kind, author: author.into(), date: date.into(), move_name: None } + Revision { kind, author: author.into(), date: date.into(), move_name: None, date_utc: None } + } + + /// A change made here: `date` is the local wall-clock time it was made at, as Word writes + /// `w:date`, and `date_utc` the same instant in UTC. + pub fn made_at(kind: RevisionKind, author: impl Into, date: impl Into, utc: impl Into) -> Revision { + Revision { kind, author: author.into(), date: date.into(), move_name: None, date_utc: Some(utc.into()) } + } + + /// The instant changes are grouped by: the UTC time when it is known, else `date`. + pub fn instant(&self) -> &str { + self.date_utc.as_deref().unwrap_or(&self.date) } } diff --git a/crates/doc/src/section.rs b/crates/doc/src/section.rs index 0918cb961c..59138a4d55 100644 --- a/crates/doc/src/section.rs +++ b/crates/doc/src/section.rs @@ -296,6 +296,7 @@ impl NumFormat { use crate::cjk_numbers as cjk; match self { NumFormat::DecimalZero => format!("{n:02}"), + NumFormat::Hex => format!("{n:X}"), NumFormat::ThaiNumbers => thai_digits(n), NumFormat::UpperRoman => roman(n).to_uppercase(), NumFormat::LowerRoman => roman(n), @@ -341,7 +342,6 @@ impl NumFormat { NumFormat::Chosung => cjk::chosung(n), NumFormat::Decimal | NumFormat::DecimalHalfWidth - | NumFormat::Hex | NumFormat::VietnameseCounting | NumFormat::Hebrew1 | NumFormat::Hebrew2 @@ -496,13 +496,21 @@ pub fn cardinal_text(n: u32) -> String { let h = format!("{} hundred", words(n / 100)); if n.is_multiple_of(100) { h } else { format!("{h} {}", words(n % 100)) } } - _ => { + 1_000..=999_999 => { let th = format!("{} thousand", words(n / 1000)); if n.is_multiple_of(1000) { th } else { format!("{th} {}", words(n % 1000)) } } + 1_000_000..=999_999_999 => { + let m = format!("{} million", words(n / 1_000_000)); + if n.is_multiple_of(1_000_000) { m } else { format!("{m} {}", words(n % 1_000_000)) } + } + _ => { + let b = format!("{} billion", words(n / 1_000_000_000)); + if n.is_multiple_of(1_000_000_000) { b } else { format!("{b} {}", words(n % 1_000_000_000)) } + } } } - capitalize(&words(n.min(999_999))) + capitalize(&words(n)) } /// English ordinal words (`Twenty-First`). @@ -1004,6 +1012,17 @@ mod tests { assert_eq!(NumFormat::from_ooxml("klingon"), NumFormat::Decimal, "unknown formats are decimal"); } + #[test] + fn hex_and_large_number_text() { + assert_eq!(NumFormat::Hex.format(10), "A"); + assert_eq!(NumFormat::Hex.format(15), "F"); + assert_eq!(NumFormat::Hex.format(16), "10"); + assert_eq!(NumFormat::Hex.format(255), "FF"); + assert_eq!(NumFormat::CardinalText.format(1_000_000), "One Million"); + assert_eq!(NumFormat::OrdinalText.format(1_000_000), "One Millionth"); + assert_eq!(NumFormat::CardinalText.format(2_000_000_000), "Two Billion"); + } + /// #5757: Thai numbers are the decimal number in Thai digits, every digit, at any length. #[test] fn thai_numbers_use_thai_digits() { diff --git a/crates/doc/src/settings.rs b/crates/doc/src/settings.rs index 1fd4e598dd..dee3ac282b 100644 --- a/crates/doc/src/settings.rs +++ b/crates/doc/src/settings.rs @@ -183,6 +183,13 @@ pub struct Settings { /// comments and tracked changes are saved without `w:date`. #[serde(skip_serializing_if = "std::ops::Not::not")] pub remove_date_time: bool, + /// Hide spelling errors in this document only (`w:hideSpellingErrors`): no squiggles under + /// misspelled words. + #[serde(skip_serializing_if = "std::ops::Not::not")] + pub hide_spelling_errors: bool, + /// Hide grammar errors in this document only (`w:hideGrammaticalErrors`). + #[serde(skip_serializing_if = "std::ops::Not::not")] + pub hide_grammar_errors: bool, /// The document was opened from ODF: the standard's rules that differ from Word's apply as /// it is laid out. #[serde(skip_serializing_if = "Option::is_none")] @@ -349,6 +356,8 @@ impl Default for Settings { zoom: None, remove_personal_info: false, remove_date_time: false, + hide_spelling_errors: false, + hide_grammar_errors: false, odf: None, } } diff --git a/crates/doc/src/table.rs b/crates/doc/src/table.rs index bb951aa672..00f3ee59d0 100644 --- a/crates/doc/src/table.rs +++ b/crates/doc/src/table.rs @@ -221,6 +221,17 @@ impl Table { } row.cells.push(nc); } + // #6326: text typed into a new cell gets the font formatting of the cell it was copied + // from, as in Word: that of the first character of the source cell's first paragraph (its + // mark when it's empty), never a link, revision mark or symbol's own font. + for (nc, c) in row.cells.iter_mut().zip(&src.cells) { + let mark = c.blocks.iter().find_map(|b| b.as_para()).map(|p| p.props_at(0).formatting().without_symbol()); + if let Some(mark) = mark + && let Some(crate::Block::Para(p)) = nc.blocks.first_mut().map(std::sync::Arc::make_mut) + { + p.mark = mark; + } + } self.rows.insert(at.min(self.rows.len()), row); } @@ -744,6 +755,38 @@ mod tests { t.delete_col(99); } + /// #6326: a new row's empty cells type in the font formatting of the cells it was copied + /// from, as in Word: that of the first character of the source cell's first paragraph (not + /// its mark), or the mark of an empty one; never its link or revision marks. + #[test] + fn insert_row_types_in_the_source_cells_font() { + let courier = crate::CharProps { + font: Some("Courier New".into()), + size: Some(16.0), + bold: Some(true), + link: Some("https://example.com".into()), + ins: Some(0), + ..Default::default() + }; + let mut p = Paragraph::with_text("A", courier.clone()); + p.insert_text(1, "B", &crate::CharProps { font: Some("Georgia".into()), ..Default::default() }).unwrap(); + p.mark = crate::CharProps { font: Some("Arial".into()), ..Default::default() }; + let mut empty = Paragraph::new(); + empty.mark = crate::CharProps { italic: Some(true), size: Some(20.0), ..Default::default() }; + let mut t = Table::new(2, 2, 200.0); + t.rows[0].cells[0].blocks = vec![para_block(p)]; + t.rows[0].cells[1].blocks = vec![para_block(empty)]; + t.insert_row(1, 0); + t.insert_row(0, 0); + let want = crate::CharProps { link: None, ins: None, ..courier }; + let italic = crate::CharProps { italic: Some(true), size: Some(20.0), ..Default::default() }; + for r in [0, 2] { + let mark = |c: usize| t.rows[r].cells[c].blocks[0].as_para().map(|p| (p.text.clone(), p.mark.clone())); + assert_eq!(mark(0), Some((String::new(), want.clone())), "row {r}"); + assert_eq!(mark(1), Some((String::new(), italic.clone())), "row {r}"); + } + } + /// #3637: a `.json` file can give a cell any span; inserting a column through it, merging it /// or deleting a column under it doesn't overflow, and the span it gets is in 1..=MAX_COLS. #[test] diff --git a/crates/doc/src/tests.rs b/crates/doc/src/tests.rs index 43cdedcb44..e7f9501652 100644 --- a/crates/doc/src/tests.rs +++ b/crates/doc/src/tests.rs @@ -440,6 +440,116 @@ fn prune_text_boxes_drops_only_unshown_ones() { assert_eq!(d.prune_text_boxes(), 0); } +/// A text-box shape (`story: Some(id)`) or plain shape (`story: None`) for nested-group tests. +fn test_shape(story: Option) -> InlineObject { + InlineObject::Shape { + kind: para::ShapeKind::TextBox, + w: 50.0, + h: 20.0, + fill: None, + stroke: None, + stroke_width: 0.0, + float: Default::default(), + story, + freeform: None, + effects: Default::default(), + extra: Default::default(), + } +} + +/// A group holding `children`. +fn test_group(children: Vec) -> InlineObject { + InlineObject::Group { + w: 100.0, + h: 100.0, + float: Default::default(), + ch_w: 100.0, + ch_h: 100.0, + children: children.into_iter().map(|obj| para::GroupChild { x: 0.0, y: 0.0, obj }).collect(), + canvas: None, + } +} + +/// `obj` wrapped inside `levels` nested [`InlineObject::Group`]s. +fn nested_group(levels: usize, obj: InlineObject) -> InlineObject { + (0..levels).fold(obj, |inner, _| test_group(vec![inner])) +} + +#[test] +fn nested_group_text_boxes_are_collected_and_slots_repointed_in_order() { + let mut outer = test_group(vec![ + test_shape(Some(1)), + test_shape(None), + nested_group(1, test_shape(Some(2))), // depth 2 from outer + test_group(vec![nested_group(1, test_shape(Some(3))), test_shape(Some(4))]), // depth 3 and depth 2 + nested_group(39, test_shape(Some(5))), // depth 40 from outer + ]); + assert_eq!(outer.text_boxes(), vec![1, 2, 3, 4, 5]); + let slots = outer.text_box_slots(); + assert_eq!(slots.len(), 6); + for id in slots.into_iter().flatten() { + *id += 100; + } + assert_eq!(outer.text_boxes(), vec![101, 102, 103, 104, 105]); +} + +#[test] +fn prune_text_boxes_keeps_nested_group_boxes_and_drops_unreachable() { + let para_of = |t: &str| vec![para_block(Paragraph::with_text(t, CharProps::default()))]; + let mut d = Document::from_text("body"); + let depth2 = d.add_part(PartKind::TextBox, para_of("depth 2")); + let depth3 = d.add_part(PartKind::TextBox, para_of("depth 3")); + let deep = d.add_part(PartKind::TextBox, para_of("depth 40")); + let linked_live = d.add_part(PartKind::TextBox, para_of("linked follower")); + let orphan = d.add_part(PartKind::TextBox, para_of("unreachable")); + let orphan_nested = d.add_part(PartKind::TextBox, para_of("inside unreachable")); + + // Live link between two nested-group boxes and a dangling link to an unreachable box. + d.parts.get_mut(&depth2).unwrap().body.next = Some(linked_live); + d.parts.get_mut(&depth3).unwrap().body.next = Some(orphan); + + d.insert_object(&Pos::body(0, 0), nested_group(2, test_shape(Some(depth2))), &CharProps::default()).unwrap(); + d.insert_object(&Pos::body(0, 0), nested_group(3, test_shape(Some(depth3))), &CharProps::default()).unwrap(); + d.insert_object(&Pos::body(0, 0), nested_group(40, test_shape(Some(deep))), &CharProps::default()).unwrap(); + d.insert_object(&Pos::body(0, 0), nested_group(2, test_shape(Some(linked_live))), &CharProps::default()).unwrap(); + let at_orphan = Pos { story: StoryRef::Part(orphan), path: Path::top(0), off: 0 }; + d.insert_object(&at_orphan, nested_group(2, test_shape(Some(orphan_nested))), &CharProps::default()).unwrap(); + + assert_eq!(d.prune_text_boxes(), 2); + let kept: Vec = d.parts.keys().copied().collect(); + assert_eq!(kept, vec![depth2, depth3, deep, linked_live]); + assert_eq!(d.plain_text(StoryRef::Part(depth2)), "depth 2"); + assert_eq!(d.plain_text(StoryRef::Part(depth3)), "depth 3"); + assert_eq!(d.plain_text(StoryRef::Part(deep)), "depth 40"); + assert_eq!(d.parts.get(&depth2).unwrap().body.next, Some(linked_live), "live chain link stays"); + assert_eq!(d.parts.get(&depth3).unwrap().body.next, None, "dangling chain link is cleared"); + assert_eq!(d.prune_text_boxes(), 0); +} + +#[test] +fn prune_text_boxes_terminates_on_cyclic_nested_group_stories() { + let para_of = |t: &str| vec![para_block(Paragraph::with_text(t, CharProps::default()))]; + let mut d = Document::from_text("body"); + let a = d.add_part(PartKind::TextBox, para_of("a")); + let b = d.add_part(PartKind::TextBox, para_of("b")); + let dead_c = d.add_part(PartKind::TextBox, para_of("dead c")); + let dead_d = d.add_part(PartKind::TextBox, para_of("dead d")); + + let at = |id| Pos { story: StoryRef::Part(id), path: Path::top(0), off: 0 }; + // Reachable cycle: body -> nested group -> a -> nested group -> b -> nested group -> (a, b). + d.insert_object(&Pos::body(0, 0), nested_group(2, test_shape(Some(a))), &CharProps::default()).unwrap(); + d.insert_object(&at(a), nested_group(2, test_shape(Some(b))), &CharProps::default()).unwrap(); + d.insert_object(&at(b), nested_group(2, test_group(vec![test_shape(Some(a)), test_shape(Some(b))])), &CharProps::default()).unwrap(); + // Unreachable cycle: dead_c <-> dead_d through nested groups. + d.insert_object(&at(dead_c), nested_group(2, test_shape(Some(dead_d))), &CharProps::default()).unwrap(); + d.insert_object(&at(dead_d), nested_group(2, test_shape(Some(dead_c))), &CharProps::default()).unwrap(); + + assert_eq!(d.prune_text_boxes(), 2); + let kept: Vec = d.parts.keys().copied().collect(); + assert_eq!(kept, vec![a, b]); + assert_eq!(d.counted_stories(), vec![StoryRef::Body, StoryRef::Part(a), StoryRef::Part(b)]); +} + /// `blocks` in the only cell of `levels` tables, each nested in the next. fn nested_tables(levels: usize, blocks: Blocks) -> Blocks { (0..levels).fold(blocks, |inner, _| { @@ -818,3 +928,302 @@ fn missing_pictures_are_capped_deduplicated_and_not_content() { assert!(!serde_json::to_string(&d).unwrap().contains("p0")); assert_eq!(MissingPictureReason::ExternalTarget.label(), "external target"); } + +#[test] +fn normalize_runs_reconciles_objects_with_markers() { + let c = CharProps::default(); + let markers = |p: &Paragraph| p.text.chars().filter(|ch| *ch == '\u{FFFC}').count(); + let build = || { + let mut d = Document::from_text("abc"); + let p = d.para_mut(StoryRef::Body, &Path::top(0)).unwrap(); + p.insert_object(1, fs("A"), &c).unwrap(); + p.insert_object(5, fs("B"), &c).unwrap(); + d + }; + // More objects than markers (as a hand-edited .json can say): the surplus goes. + let mut d = build(); + d.para_mut(StoryRef::Body, &Path::top(0)).unwrap().objects.push(fs("C")); + d.normalize_runs(); + let p = d.para(StoryRef::Body, &Path::top(0)).unwrap(); + assert_eq!((markers(p), p.objects.len()), (2, 2)); + assert_eq!(p.objects, vec![fs("A"), fs("B")]); + // More markers than objects: the unmatched marker goes, runs still cover the text. + let mut d = build(); + let p = d.para_mut(StoryRef::Body, &Path::top(0)).unwrap(); + p.text.push('\u{FFFC}'); + p.runs[0].len += 3; + d.normalize_runs(); + let p = d.para_mut(StoryRef::Body, &Path::top(0)).unwrap(); + assert_eq!((markers(p), p.objects.len()), (2, 2)); + assert_eq!(p.runs.iter().map(|r| r.len).sum::(), p.text.len()); + // Deleting the first marker keeps B on the second. + p.delete(1, 4).unwrap(); + assert_eq!(p.objects, vec![fs("B")]); + // The cost is linear: the markers and runs `reconcile_objects` walks (`crate::work`), not a + // timing. 8x the unmatched markers cost about 8x the steps, far more if each removal rescans. + let reconcile = |extra: usize| { + let mut p = Paragraph::default(); + p.objects = vec![fs("A")]; + p.text = format!("\u{FFFC}{}x", "\u{FFFC}".repeat(extra)); + p.runs = vec![Run { len: p.text.len(), props: c.clone() }]; + crate::work::count(|| { + p.reconcile_objects(); + assert_eq!(p.text, "\u{FFFC}x"); + std::hint::black_box(&p); + }) + }; + let (s1, s8) = (reconcile(2_000), reconcile(16_000)); + assert!(s1 > 0, "no steps counted, so the walk this test watches no longer counts them (crate::work)"); + let ratio = s8 as f64 / s1 as f64; + assert!(ratio <= 12.0, "8x the markers cost {ratio:.1}x the steps ({s1} -> {s8})"); +} + +#[test] +fn reconcile_objects_drops_many_unmatched_markers_in_one_pass() { + let c = CharProps::default(); + let mut d = Document::from_text(""); + let p = d.para_mut(StoryRef::Body, &Path::top(0)).unwrap(); + p.insert_object(0, fs("A"), &c).unwrap(); + p.insert_object(p.text.len(), fs("B"), &c).unwrap(); + let extra = 50_000; + // "x" followed by many unmatched markers around more text, in one run. + p.text = format!("\u{FFFC}x\u{FFFC}{}y{}z", "\u{FFFC}".repeat(extra), "\u{FFFC}".repeat(extra)); + p.runs = vec![Run { len: p.text.len(), props: c.clone() }]; + p.reconcile_objects(); + assert_eq!(p.text, "\u{FFFC}x\u{FFFC}yz"); + assert_eq!(p.objects, vec![fs("A"), fs("B")]); + assert_eq!(p.runs.iter().map(|r| r.len).sum::(), p.text.len()); +} + +#[test] +fn reconcile_objects_keeps_every_matched_object() { + let c = CharProps::default(); + let n = 100_050; + let mut d = Document::from_text(""); + let p = d.para_mut(StoryRef::Body, &Path::top(0)).unwrap(); + p.text = "\u{FFFC}".repeat(n); + p.objects = (0..n).map(|_| fs("A")).collect(); + p.runs = vec![Run { len: p.text.len(), props: c }]; + p.reconcile_objects(); + assert_eq!(p.objects.len(), n); + assert_eq!(p.text.matches('\u{FFFC}').count(), n); + assert_eq!(p.runs.iter().map(|r| r.len).sum::(), p.text.len()); +} + +#[test] +fn reconcile_objects_keeps_run_props_across_several_runs() { + let (plain, bold) = (CharProps::default(), CharProps { bold: Some(true), ..CharProps::default() }); + let italic = CharProps { italic: Some(true), ..CharProps::default() }; + let mut d = Document::from_text(""); + let p = d.para_mut(StoryRef::Body, &Path::top(0)).unwrap(); + p.objects = vec![fs("A")]; + // Runs: plain "ab" | bold "" (only unmatched, becomes empty) | italic "c" | plain "d". + let x = "\u{FFFC}"; + let parts = [ + (format!("a\u{FFFC}b{x}"), plain.clone()), + (format!("{x}{x}"), bold), + (format!("{x}c{x}"), italic.clone()), + ("d".to_string(), plain.clone()), + ]; + p.text = parts.iter().map(|(t, _)| t.as_str()).collect(); + p.runs = parts.iter().map(|(t, c)| Run { len: t.len(), props: c.clone() }).collect(); + p.reconcile_objects(); + assert_eq!(p.text, "a\u{FFFC}bcd"); + assert_eq!(p.objects, vec![fs("A")]); + let got: Vec<(usize, CharProps)> = p.runs.iter().map(|r| (r.len, r.props.clone())).collect(); + // "ab" plain (5 bytes: 1 + 3 + 1), "c" italic, "d" plain. + assert_eq!(got, vec![(5, plain.clone()), (1, italic), (1, plain)]); +} + +#[test] +fn reconcile_objects_marker_on_run_boundary_shrinks_the_right_run() { + let (plain, bold) = (CharProps::default(), CharProps { bold: Some(true), ..CharProps::default() }); + let mut d = Document::from_text(""); + let p = d.para_mut(StoryRef::Body, &Path::top(0)).unwrap(); + let x = "\u{FFFC}"; + // plain "ab" | bold "cd" : the marker is the first byte of the second run. + p.text = format!("ab{x}cd"); + p.runs = vec![Run { len: 2, props: plain.clone() }, Run { len: 2 + x.len(), props: bold.clone() }]; + p.reconcile_objects(); + assert_eq!(p.text, "abcd"); + let got: Vec<(usize, CharProps)> = p.runs.iter().map(|r| (r.len, r.props.clone())).collect(); + assert_eq!(got, vec![(2, plain), (2, bold)]); +} + +#[test] +fn reconcile_objects_all_unmatched_markers_empties_the_paragraph() { + let bold = CharProps { bold: Some(true), ..CharProps::default() }; + let mut d = Document::from_text(""); + let p = d.para_mut(StoryRef::Body, &Path::top(0)).unwrap(); + p.text = "\u{FFFC}".repeat(3); + p.runs = vec![Run { len: p.text.len(), props: bold.clone() }]; + p.mark = CharProps { ins: Some(7), ..CharProps::default() }; + p.reconcile_objects(); + assert_eq!(p.text, ""); + assert!(p.objects.is_empty()); + assert!(p.runs.is_empty()); + // The mark takes the deleted formatting but keeps its own revision. + assert_eq!(p.mark, CharProps { bold: Some(true), ins: Some(7), ..CharProps::default() }); +} + +fn shape_with_id(id: u32, story: Option) -> InlineObject { + InlineObject::Shape { + kind: para::ShapeKind::Rectangle, + w: 50.0, + h: 20.0, + fill: None, + stroke: None, + stroke_width: 0.0, + float: Default::default(), + story, + freeform: None, + effects: Default::default(), + extra: connector::ShapeExtra { id, ..Default::default() }, + } +} + +fn group_of(children: Vec) -> InlineObject { + InlineObject::Group { + w: 100.0, + h: 100.0, + float: Default::default(), + ch_w: 100.0, + ch_h: 100.0, + children: children.into_iter().map(|obj| para::GroupChild { x: 0.0, y: 0.0, obj }).collect(), + canvas: None, + } +} + +fn nested_group_of(depth: usize, leaf: InlineObject) -> InlineObject { + (0..depth).fold(leaf, |inner, _| group_of(vec![inner])) +} + +#[test] +fn next_shape_id_accounts_for_shapes_in_nested_groups() { + // Doubly-nested group carrying shape id 1: must not reissue id 1. + let mut d = Document::from_text("body"); + d.insert_object(&Pos::body(0, 0), nested_group_of(2, shape_with_id(1, None)), &CharProps::default()).unwrap(); + assert_eq!(d.next_shape_id(), 2); + + // Deeper nesting (5-level and 40-level groups) with mixed siblings. + d.insert_object( + &Pos::body(0, 0), + nested_group_of(5, group_of(vec![shape_with_id(42, None), nested_group_of(35, shape_with_id(99, None))])), + &CharProps::default(), + ) + .unwrap(); + assert_eq!(d.next_shape_id(), 100); + + // Nested group inside a secondary story (part). + let hdr = d.add_part(PartKind::Header, vec![para_block(Paragraph::with_text("hdr", CharProps::default()))]); + let at_hdr = Pos { story: StoryRef::Part(hdr), path: Path::top(0), off: 0 }; + d.insert_object(&at_hdr, nested_group_of(3, shape_with_id(150, None)), &CharProps::default()).unwrap(); + assert_eq!(d.next_shape_id(), 151); +} + +#[test] +fn next_shape_id_preserves_flat_group_and_ungrouped_allocation() { + let mut d = Document::from_text("body"); + assert_eq!(d.next_shape_id(), 1); + + // Ungrouped shapes (including id 0). + d.insert_object(&Pos::body(0, 0), shape_with_id(0, None), &CharProps::default()).unwrap(); + assert_eq!(d.next_shape_id(), 1); + d.insert_object(&Pos::body(0, 0), shape_with_id(3, None), &CharProps::default()).unwrap(); + d.insert_object(&Pos::body(0, 0), shape_with_id(7, None), &CharProps::default()).unwrap(); + assert_eq!(d.next_shape_id(), 8); + + // Flat (1-level) group. + d.insert_object(&Pos::body(0, 0), group_of(vec![shape_with_id(12, None), shape_with_id(4, None)]), &CharProps::default()).unwrap(); + assert_eq!(d.next_shape_id(), 13); + + // At u32::MAX, overflow falls back to an unused non-zero id rather than reissuing u32::MAX. + d.insert_object(&Pos::body(0, 0), nested_group_of(2, shape_with_id(u32::MAX, None)), &CharProps::default()).unwrap(); + let id = d.next_shape_id(); + assert_ne!(id, 0); + for used in [3, 4, 7, 12, u32::MAX] { + assert_ne!(id, used); + } + assert_eq!(id, 1); +} + +#[test] +fn next_shape_id_avoids_reissuing_u32_max_on_overflow() { + // Non-overflow boundary: u32::MAX - 1 still advances to u32::MAX. + let mut d = Document::from_text("body"); + d.insert_object(&Pos::body(0, 0), shape_with_id(u32::MAX - 1, None), &CharProps::default()).unwrap(); + assert_eq!(d.next_shape_id(), u32::MAX); + + // Once u32::MAX is in use inside a nested group, allocator must not reissue any in-use id. + let hdr = d.add_part(PartKind::Header, vec![para_block(Paragraph::with_text("hdr", CharProps::default()))]); + let at_hdr = Pos { story: StoryRef::Part(hdr), path: Path::top(0), off: 0 }; + d.insert_object(&Pos::body(0, 0), shape_with_id(1, None), &CharProps::default()).unwrap(); + d.insert_object(&at_hdr, nested_group_of(2, shape_with_id(2, None)), &CharProps::default()).unwrap(); + d.insert_object(&Pos::body(0, 0), nested_group_of(3, shape_with_id(u32::MAX, None)), &CharProps::default()).unwrap(); + + let in_use = [1, 2, u32::MAX - 1, u32::MAX]; + let first = d.next_shape_id(); + assert_ne!(first, 0); + assert!(!in_use.contains(&first), "reissued in-use shape id {first}"); + assert_eq!(first, 3); + + // Using the returned id advances to the next unused id rather than repeating it. + d.insert_object(&Pos::body(0, 0), nested_group_of(2, shape_with_id(first, None)), &CharProps::default()).unwrap(); + let second = d.next_shape_id(); + assert_ne!(second, 0); + assert_ne!(second, first); + assert!(!in_use.contains(&second), "reissued in-use shape id {second}"); + assert_eq!(second, 4); +} + +#[test] +fn next_shape_id_terminates_on_cyclic_nested_group_stories() { + // InlineObject::Group owns Vec by value (and unsafe is forbidden), so a cyclic + // in-memory Group tree cannot be constructed in safe Rust; mirror #8068 by constructing a + // cyclic text-box story graph through nested groups instead. + let para_of = |t: &str| vec![para_block(Paragraph::with_text(t, CharProps::default()))]; + let mut d = Document::from_text("body"); + let a = d.add_part(PartKind::TextBox, para_of("a")); + let b = d.add_part(PartKind::TextBox, para_of("b")); + let at = |id| Pos { story: StoryRef::Part(id), path: Path::top(0), off: 0 }; + + d.insert_object(&Pos::body(0, 0), nested_group_of(2, shape_with_id(5, Some(a))), &CharProps::default()).unwrap(); + d.insert_object(&at(a), nested_group_of(2, shape_with_id(10, Some(b))), &CharProps::default()).unwrap(); + d.insert_object(&at(b), nested_group_of(2, shape_with_id(25, Some(a))), &CharProps::default()).unwrap(); + + assert_eq!(d.next_shape_id(), 26); +} + +#[test] +fn next_shape_id_accounts_for_shapes_in_note_separators() { + let blocks_with = |obj: InlineObject| -> Blocks { + let mut p = Paragraph::with_text("sep", CharProps::default()); + p.insert_object(0, obj, &CharProps::default()).unwrap(); + vec![para_block(p)] + }; + + // A shape ID used only in a footnote separator story must not be reissued. + let mut d = Document::from_text("body"); + d.footnote_separators.separator = Some(blocks_with(shape_with_id(1, None))); + assert_eq!(d.next_shape_id(), 2); + + // Every footnote and endnote separator slot is walked, including nested groups and tables. + d.footnote_separators.continuation_separator = Some(blocks_with(nested_group_of(2, shape_with_id(2, None)))); + d.footnote_separators.continuation_notice = Some(nested_tables(1, blocks_with(shape_with_id(5, None)))); + assert_eq!(d.next_shape_id(), 6); + + d.endnote_separators.separator = Some(blocks_with(shape_with_id(9, None))); + assert_eq!(d.next_shape_id(), 10); + + d.endnote_separators.continuation_separator = Some(blocks_with(nested_group_of(3, shape_with_id(14, None)))); + assert_eq!(d.next_shape_id(), 15); + + // Overflow fallback also respects IDs held exclusively in note-separator stories. + d.endnote_separators.continuation_notice = Some(blocks_with(nested_group_of(2, shape_with_id(u32::MAX, None)))); + let allocated = d.next_shape_id(); + assert_ne!(allocated, 0); + for used in [1, 2, 5, 9, 14, u32::MAX] { + assert_ne!(allocated, used); + } + assert_eq!(allocated, 3); +} diff --git a/crates/docbin/src/model_bridge.rs b/crates/docbin/src/model_bridge.rs index bd08055223..52d316d3b1 100644 --- a/crates/docbin/src/model_bridge.rs +++ b/crates/docbin/src/model_bridge.rs @@ -175,6 +175,7 @@ mod tests { ch_w: 64.0, ch_h: 48.0, children: vec![craft_wordmodel::para::GroupChild { + link: None, x: 4.0, y: 6.0, obj: craft_wordmodel::para::InlineObject::Field { @@ -202,7 +203,7 @@ mod tests { ..Default::default() }, ); - source.settings.compat_mode = 11; + source.settings.compat_mode = Some(11); let image = Arc::new(vec![0x5a; 1 << 20]); source.media.insert("image1.png".into(), image.clone()); diff --git a/crates/docx/src/model_bridge.rs b/crates/docx/src/model_bridge.rs index 92088d2210..c2a4828706 100644 --- a/crates/docx/src/model_bridge.rs +++ b/crates/docx/src/model_bridge.rs @@ -100,18 +100,35 @@ fn object_value_from_shared( float: convert(float)?, ch_w, ch_h, - children: children.into_iter().map(|c| group_child_value_from_shared(c, graphics)).collect::>()?, + children: group_children_from_shared(children, graphics)?, canvas: canvas.map(convert).transpose()?, }), other => convert(other), } } -fn group_child_value_from_shared( - source: craft_wordmodel::para::GroupChild, +/// A group's members. The shared reader keeps a hyperlinked nested group whole; WordCraft's +/// text box, layout and edit code looks one level deep, so lift its members into this group +/// (their offsets composed, scaled from the nested group's child space), as the reader does for +/// an unlinked one. The nested group's own link is dropped. +// lean: nested groups are flattened until WordCraft supports them (follow-up issue). +fn group_children_from_shared( + children: Vec, graphics: &mut GraphicCache, -) -> Result { - Ok(wordcraft_doc::para::GroupChild { x: source.x, y: source.y, obj: object_value_from_shared(source.obj, graphics)? }) +) -> Result, DocxError> { + let mut out = Vec::with_capacity(children.len()); + for c in children { + let (x, y) = (c.x, c.y); + match object_value_from_shared(c.obj, graphics)? { + wordcraft_doc::para::InlineObject::Group { w, h, ch_w, ch_h, children, .. } => { + let (kx, ky) = (if ch_w > 0.0 { w / ch_w } else { 1.0 }, if ch_h > 0.0 { h / ch_h } else { 1.0 }); + // `children` is already flat: the recursion converted the nested group first. + out.extend(children.into_iter().map(|m| wordcraft_doc::para::GroupChild { x: x + m.x * kx, y: y + m.y * ky, obj: m.obj })); + } + obj => out.push(wordcraft_doc::para::GroupChild { x, y, obj }), + } + } + Ok(out) } fn table_value_from_shared(source: craft_wordmodel::table::Table, graphics: &mut GraphicCache) -> Result { @@ -160,6 +177,19 @@ fn glossary_value_from_shared( }) } +fn note_separators_from_shared( + source: craft_wordmodel::NoteSeparators, + graphics: &mut GraphicCache, +) -> Result { + let craft_wordmodel::NoteSeparators { separator, continuation_separator, continuation_notice } = source; + let mut blocks = |b: Option| b.map(|b| blocks_from_shared(b, graphics)).transpose(); + Ok(wordcraft_doc::NoteSeparators { + separator: blocks(separator)?, + continuation_separator: blocks(continuation_separator)?, + continuation_notice: blocks(continuation_notice)?, + }) +} + fn missing_pictures_from_shared(source: craft_wordmodel::MissingPictures) -> Result { let mut target = wordcraft_doc::MissingPictures::default(); target.truncated = source.truncated; @@ -215,12 +245,15 @@ pub fn from_shared_model(mut source: craft_wordmodel::Document) -> Result>()?; @@ -321,7 +354,7 @@ fn object_value_to_shared(source: &wordcraft_doc::para::InlineObject) -> Result< } fn group_child_value_to_shared(source: &wordcraft_doc::para::GroupChild) -> Result { - Ok(craft_wordmodel::para::GroupChild { x: source.x, y: source.y, obj: object_value_to_shared(&source.obj)? }) + Ok(craft_wordmodel::para::GroupChild { link: None, x: source.x, y: source.y, obj: object_value_to_shared(&source.obj)? }) } fn table_value_to_shared(source: &wordcraft_doc::table::Table) -> Result { @@ -558,6 +591,7 @@ mod tests { ch_w: 64.0, ch_h: 48.0, children: vec![craft_wordmodel::para::GroupChild { + link: None, x: 4.0, y: 6.0, obj: craft_wordmodel::para::InlineObject::Field { @@ -585,7 +619,7 @@ mod tests { ..Default::default() }, ); - source.settings.compat_mode = 11; + source.settings.compat_mode = Some(11); let image = Arc::new(vec![0x5a; 1 << 16]); source.media.insert("image1.png".into(), image.clone()); diff --git a/crates/docx/tests/it/fixtures.rs b/crates/docx/tests/it/fixtures.rs index 37de5afb9f..8511ea8872 100644 --- a/crates/docx/tests/it/fixtures.rs +++ b/crates/docx/tests/it/fixtures.rs @@ -1330,6 +1330,8 @@ fn hinted_east_asian_or_cs_font_does_not_replace_the_latin_font() { assert_eq!((ea.font.as_str(), ea.font_ea.as_deref()), ("Times New Roman", Some("宋体"))); let cs = d.styles.resolve_char(p.props.style.as_deref(), &p.runs[1].props); assert_eq!((cs.font.as_str(), cs.font_cs.as_str()), ("Times New Roman", "Arial")); + assert_eq!(ea.font_ea_theme, None, "named w:eastAsia replaces Heading2's w:eastAsiaTheme"); + assert_eq!(cs.font_ea_theme, Some(wordcraft_doc::props::ThemeFont::MajorEastAsia)); } #[test] @@ -2444,6 +2446,54 @@ fn note_separators_and_continuation_notice_round_trip() { check(&wordcraft_docx::read(&out).unwrap()); } +/// A hyperlinked nested group in a footnote or endnote separator is flattened through the block +/// mapping just as it is in the document body. +#[test] +fn linked_nested_group_in_a_note_separator_is_flattened() { + let inner = r#""#; + let group = format!( + r#"{inner}"# + ); + let notes = |root: &str, item: &str| { + format!(r#"{group}"#) + }; + let footnotes = notes("footnotes", "footnote"); + let endnotes = notes("endnotes", "endnote"); + let link_rels = rels(&[("rId9", "hyperlink", "https://example.com/")]); + let bytes = docx( + &format!("{group}"), + &[("rId1", "footnotes", "footnotes.xml"), ("rId2", "endnotes", "endnotes.xml"), ("rId9", "hyperlink", "https://example.com/")], + &[ + ("word/footnotes.xml", &footnotes), + ("word/_rels/footnotes.xml.rels", &link_rels), + ("word/endnotes.xml", &endnotes), + ("word/_rels/endnotes.xml.rels", &link_rels), + ], + ); + let d = wordcraft_docx::read(&bytes).unwrap(); + let flattened = |p: &Paragraph| -> Vec<(f32, f32, ShapeKind, f32)> { + let Some(children) = p.objects.iter().find_map(|o| match o { + InlineObject::Group { children, .. } => Some(children), + _ => None, + }) else { + panic!("{:?}", p.objects); + }; + children + .iter() + .map(|c| match &c.obj { + InlineObject::Shape { kind, w, .. } => (c.x, c.y, *kind, *w), + other => panic!("{other:?}"), + }) + .collect() + }; + let in_body = flattened(d.body[0].as_para().unwrap()); + assert_eq!(in_body, [(50.0, 0.0, ShapeKind::Frame, 50.0)]); + for separators in [&d.footnote_separators, &d.endnote_separators] { + let sep = separators.separator.as_ref().unwrap()[0].as_para().unwrap(); + assert_eq!(flattened(sep), in_body); + } +} + /// Issue #534: East Asian number formats are read, labelled and written back as they were; a /// value the format doesn't define is decimal, and a level without `w:ind` has no indent. #[test] @@ -4781,3 +4831,20 @@ fn vml_horizontal_rules_are_read_and_kept() { let d = read_body(&body); assert_eq!(rules(&d).iter().map(|r| r.0).collect::>(), [None, None]); } + +#[test] +fn hide_spelling_and_grammar_errors_survive_a_save() { + let settings_xml = |d: &Document| { + let bytes = wordcraft_docx::write(d).unwrap(); + let mut z = craft_zip::Archive::open(&bytes, craft_zip::Limits { max_entries: 10_000, max_total_bytes: 64 << 20 }).unwrap(); + String::from_utf8(z.read("word/settings.xml", 16 << 20).unwrap().unwrap()).unwrap() + }; + let d = with_settings(Some("")); + let saved = settings_xml(&d); + assert!(saved.contains(" BTreeMap> { } const SETTINGS: &str = r#" -"#; +"#; fn pos(s: &str, needle: &str) -> usize { s.find(needle).unwrap_or_else(|| panic!("{needle} missing from {s}")) diff --git a/crates/docx/tests/it/roundtrip.rs b/crates/docx/tests/it/roundtrip.rs index 649d70e66f..aaa4656c9d 100644 --- a/crates/docx/tests/it/roundtrip.rs +++ b/crates/docx/tests/it/roundtrip.rs @@ -132,6 +132,7 @@ fn every_char_prop_round_trips() { cs: Some(true), font_cs: Some("B Nazanin".into()), font_ea: Some("宋体".into()), + font_ea_theme: Some(wordcraft_doc::props::ThemeFont::MinorEastAsia), size_cs: Some(13.0), bold_cs: Some(false), italic_cs: Some(true), @@ -229,6 +230,7 @@ fn every_para_prop_round_trips() { fmt_change: None, snap_to_grid: Some(false), text_alignment: Some(TextAlignment::Top), + list_item: None, // not a DOCX property }; let variants = [ ParaProps { line_spacing: Some(LineSpacing::AtLeast(14.0)), indent_first: Some(24.0), align: Some(Align::Center), ..Default::default() }, @@ -315,7 +317,13 @@ fn styles_and_lists_round_trip() { #[test] fn tracked_style_definition_change_round_trips() { let mut d = Document::new(); - d.revisions.push(Revision { kind: RevisionKind::Format, author: "Ana".into(), date: "2026-10-17T10:00:00Z".into(), move_name: None }); + d.revisions.push(Revision { + kind: RevisionKind::Format, + author: "Ana".into(), + date: "2026-10-17T10:00:00Z".into(), + move_name: None, + date_utc: None, + }); std::sync::Arc::make_mut(&mut d.styles).upsert(Style { id: "Mine".into(), name: "Mine".into(), @@ -1004,8 +1012,20 @@ fn toc_field_skips_nested_stories() { #[test] fn tracked_changes_round_trip() { let mut d = Document::new(); - d.revisions.push(Revision { kind: RevisionKind::Insert, author: "Alice".into(), date: "2026-05-01T10:00:00Z".into(), move_name: None }); - d.revisions.push(Revision { kind: RevisionKind::Delete, author: "Bob".into(), date: "2026-05-02T10:00:00Z".into(), move_name: None }); + d.revisions.push(Revision { + kind: RevisionKind::Insert, + author: "Alice".into(), + date: "2026-05-01T10:00:00Z".into(), + move_name: None, + date_utc: None, + }); + d.revisions.push(Revision { + kind: RevisionKind::Delete, + author: "Bob".into(), + date: "2026-05-02T10:00:00Z".into(), + move_name: None, + date_utc: None, + }); d.settings.track_changes = true; let ins = CharProps { ins: Some(0), ..Default::default() }; let del = CharProps { del: Some(1), bold: Some(true), ..Default::default() }; @@ -1033,8 +1053,20 @@ fn tracked_changes_round_trip() { fn tracked_equations_round_trip() { // Issue #6011: equations saved with tracked revision marks (w:ins / w:del) around math. let mut d = Document::new(); - d.revisions.push(Revision { kind: RevisionKind::Insert, author: "Alice".into(), date: "2026-05-01T10:00:00Z".into(), move_name: None }); - d.revisions.push(Revision { kind: RevisionKind::Delete, author: "Bob".into(), date: "2026-05-02T10:00:00Z".into(), move_name: None }); + d.revisions.push(Revision { + kind: RevisionKind::Insert, + author: "Alice".into(), + date: "2026-05-01T10:00:00Z".into(), + move_name: None, + date_utc: None, + }); + d.revisions.push(Revision { + kind: RevisionKind::Delete, + author: "Bob".into(), + date: "2026-05-02T10:00:00Z".into(), + move_name: None, + date_utc: None, + }); d.settings.track_changes = true; let ins = CharProps { ins: Some(0), ..Default::default() }; let del = CharProps { del: Some(1), ..Default::default() }; @@ -1088,8 +1120,20 @@ fn tracked_equations_round_trip() { fn nested_omath_para_revisions_read() { // Defensive reader check: w:ins and w:del nested inside m:oMathPara. let mut d = Document::new(); - d.revisions.push(Revision { kind: RevisionKind::Insert, author: "Ada".into(), date: "2026-05-01T10:00:00Z".into(), move_name: None }); - d.revisions.push(Revision { kind: RevisionKind::Delete, author: "Charles".into(), date: "2026-05-02T10:00:00Z".into(), move_name: None }); + d.revisions.push(Revision { + kind: RevisionKind::Insert, + author: "Ada".into(), + date: "2026-05-01T10:00:00Z".into(), + move_name: None, + date_utc: None, + }); + d.revisions.push(Revision { + kind: RevisionKind::Delete, + author: "Charles".into(), + date: "2026-05-02T10:00:00Z".into(), + move_name: None, + date_utc: None, + }); let doc_xml = r#"x+1y-1"#; let base = wordcraft_docx::write(&d).unwrap(); let bytes = replace_part(&base, "word/document.xml", doc_xml.as_bytes()); @@ -1107,8 +1151,20 @@ fn tracked_paragraph_marks_round_trip() { // Issue #229: an inserted / deleted paragraph mark is `w:ins` / `w:del` in the mark's // `w:rPr` (ECMA-376 §17.13.5.16, §17.13.5.15), alone or with mark formatting. let mut d = Document::new(); - d.revisions.push(Revision { kind: RevisionKind::Insert, author: "Alice".into(), date: "2026-05-01T10:00:00Z".into(), move_name: None }); - d.revisions.push(Revision { kind: RevisionKind::Delete, author: "Bob".into(), date: "2026-05-02T10:00:00Z".into(), move_name: None }); + d.revisions.push(Revision { + kind: RevisionKind::Insert, + author: "Alice".into(), + date: "2026-05-01T10:00:00Z".into(), + move_name: None, + date_utc: None, + }); + d.revisions.push(Revision { + kind: RevisionKind::Delete, + author: "Bob".into(), + date: "2026-05-02T10:00:00Z".into(), + move_name: None, + date_utc: None, + }); let mut split = Paragraph::with_text("Owned ALPHA ", CharProps::default()); split.mark.ins = Some(0); let mut joined = Paragraph::with_text("Owned BETA", CharProps::default()); @@ -1862,7 +1918,7 @@ fn kitchen_sink() -> Document { let f = d.add_part(PartKind::Footnote, vec![para_block(Paragraph::with_text("Note", CharProps::default()))]); let c = d.add_part(PartKind::Comment, vec![para_block(Paragraph::with_text("Comment", CharProps::default()))]); d.comments.insert(3, Comment { author: "X".into(), part: c, ..Default::default() }); - d.revisions.push(Revision { kind: RevisionKind::Insert, author: "A".into(), date: String::new(), move_name: None }); + d.revisions.push(Revision { kind: RevisionKind::Insert, author: "A".into(), date: String::new(), move_name: None, date_utc: None }); d.last_section.headers.default = Some(h); let mut blocks: Blocks = Vec::new(); let mut p = para_runs(&[ diff --git a/crates/docx/tests/it/section_metadata_preservation.rs b/crates/docx/tests/it/section_metadata_preservation.rs index 6871703e9f..a55edb73fd 100644 --- a/crates/docx/tests/it/section_metadata_preservation.rs +++ b/crates/docx/tests/it/section_metadata_preservation.rs @@ -37,7 +37,7 @@ fn section_metadata_survives_native_json_and_two_docx_save_reopen_cycles() { assert!(xml.contains(r#""#), "cycle {cycle}: {xml}"); assert!(xml.contains(r#"w:chapStyle="1" w:chapSep="hyphen""#), "cycle {cycle}: {xml}"); assert!(xml.contains(r#"w:chapStyle="10" w:chapSep="colon""#), "cycle {cycle}: {xml}"); - assert!(xml.contains("xmlns:w15=") && xml.contains("mc:Ignorable=\"w14 w15 wp14\""), "cycle {cycle}: {xml}"); + assert!(xml.contains("xmlns:w15=") && xml.contains("mc:Ignorable=\"w14 w15 wp14 w16du\""), "cycle {cycle}: {xml}"); document = wordcraft_docx::read(&bytes).unwrap(); let json = serde_json::to_vec(&document).unwrap(); document = serde_json::from_slice(&json).unwrap(); diff --git a/crates/docx/tests/it/settings_merge.rs b/crates/docx/tests/it/settings_merge.rs index a69c3aa525..b435d77d91 100644 --- a/crates/docx/tests/it/settings_merge.rs +++ b/crates/docx/tests/it/settings_merge.rs @@ -66,7 +66,15 @@ const SETTINGS: &str = r#""#; fn with_settings(settings: &str) -> Vec { - package("Text", &[("rId1", &format!("{REL}/settings"), "settings.xml")], &[], &[("word/settings.xml", settings)]) + let sources = format!( + r#""# + ); + package( + "Text", + &[("rId1", &format!("{REL}/settings"), "settings.xml")], + &[], + &[("word/settings.xml", settings), ("word/_rels/settings.xml.rels", &sources)], + ) } fn pos(s: &str, needle: &str) -> usize { @@ -97,11 +105,22 @@ fn unmodelled_settings_survive_a_save_and_owned_ones_follow_the_model() { ] { assert!(s.contains(kept), "{kept} lost: {s}"); } - // Owned: Track Changes was turned off; one compatibility mode; the mail merge source (a - // relationship that isn't carried) is dropped rather than left dangling. + // Owned: Track Changes was turned off; one compatibility mode. Mail merge keeps its external + // source relationship. assert!(!s.contains("trackRevisions"), "{s}"); assert_eq!(s.matches("compatibilityMode").count(), 1, "{s}"); - assert!(!s.contains("mailMerge") && !s.contains("rId9"), "{s}"); + assert!(s.contains("mailMerge"), "{s}"); + let rel_id = s + .split(""# + ); + assert!(rels.contains(&expected_rel), "missing matching relationship for {rel_id}: {rels}"); // The privacy options are the model's (#1062): written once each, and gone when turned off. assert_eq!(s.matches("removePersonalInformation").count(), 1, "{s}"); assert_eq!(s.matches("removeDateAndTime").count(), 1, "{s}"); @@ -123,6 +142,37 @@ fn unmodelled_settings_survive_a_save_and_owned_ones_follow_the_model() { assert_eq!(text(&save(&again), "word/settings.xml"), s); } +#[test] +fn changed_zoom_survives_merged_settings_and_reads_back_as_page_width() { + let old_zoom = r#""#; + let updated_zoom = r#""#; + for original in [SETTINGS.to_string(), SETTINGS.replace(old_zoom, "")] { + let mut doc = wordcraft_docx::read(&with_settings(&original)).unwrap(); + assert!(doc.passthrough.contains_key("wordcraft:settings.orig")); + doc.settings.zoom = Some(wordcraft_doc::Zoom { percent: 145, fit: Some(wordcraft_doc::ZoomFit::PageWidth) }); + let bytes = wordcraft_docx::write(&doc).unwrap(); + let settings = text(&unzip(&bytes), "word/settings.xml"); + assert_eq!(settings.matches(""#, + r#""#, + r#""#, + ] { + assert!(settings.contains(kept), "{kept} lost: {settings}"); + } + assert!(pos(&settings, "Inside"#; + let doc = format!( + r#"{inner}"# + ); + let rels = br#""#; + let doc_rels = br#""#; + let bytes = zip(&[("_rels/.rels", rels), ("word/document.xml", doc.as_bytes()), ("word/_rels/document.xml.rels", doc_rels)]); + let mut d = wordcraft_docx::read(&bytes).unwrap(); + assert_eq!(boxes(&d).len(), 1); + // What every mutating command does after it runs. + d.prune_text_boxes(); + assert_eq!(boxes(&d).len(), 1, "the nested box lost its story"); + let xml = document_xml(&wordcraft_docx::write(&d).unwrap()); + assert!(xml.contains("Inside"), "{xml}"); +} diff --git a/crates/docx/tests/it/wordml2003_write.rs b/crates/docx/tests/it/wordml2003_write.rs index 848bac3ab0..0695e1a278 100644 --- a/crates/docx/tests/it/wordml2003_write.rs +++ b/crates/docx/tests/it/wordml2003_write.rs @@ -41,7 +41,7 @@ fn sample() -> Document { let foot = d.add_part(PartKind::Footnote, vec![para_block(Paragraph::with_text("Sown in May.", CharProps::default()))]); let com = d.add_part(PartKind::Comment, vec![para_block(Paragraph::with_text("Too short?", CharProps::default()))]); d.comments.insert(3, Comment { author: "Bo".into(), part: com, ..Default::default() }); - d.revisions.push(Revision { kind: RevisionKind::Insert, author: "Ada".into(), date: String::new(), move_name: None }); + d.revisions.push(Revision { kind: RevisionKind::Insert, author: "Ada".into(), date: String::new(), move_name: None, date_utc: None }); d.last_section.headers.default = Some(head); let mut p = Paragraph::new(); diff --git a/crates/engine/src/catalog.rs b/crates/engine/src/catalog.rs index 69564e6ea0..0e6c1f8bfd 100644 --- a/crates/engine/src/catalog.rs +++ b/crates/engine/src/catalog.rs @@ -298,6 +298,8 @@ Review|Language|Translate|review.translate Review|Language|Language|review.language Review|Comments|New Comment|review.newComment Review|Comments|Delete|review.deleteComment +Review|Comments|Delete All Comments in Document|review.deleteComment +Review|Comments|Delete All Resolved Comments|review.deleteComment Review|Comments|Previous|review.previousComment Review|Comments|Next|review.nextComment Review|Comments|Show Comments|review.comments @@ -532,6 +534,98 @@ Tools|Templates|Templates and Add-ins|tools.templates Tools|Views|Full Screen View|view.fullScreenView "; +/// RFC-0052 hand marks for catalog features with no engine command: `id|headless|reach|why`. +/// +/// `headless` is `no` or `partial`, `reach` is `window` (needs a desktop window, dialog or +/// pointer), `os` (needs an OS or online service the engine doesn't wrap) or `engine-gap` (could +/// be an engine command, isn't one yet). `yes` is never written here: a feature is `yes` only when +/// its id is in the engine registry that `wordcraft-cli` and the MCP server load, and a mark on such +/// an id is stale (`headless_errors`). A missing feature with no mark is `unknown`. +pub const HEADLESS: &str = "\ +tools.dictate|no|os|speech recognition service +insert.onlinePicture|no|os|online image search service +insert.model3d|no|engine-gap|3-D model files could be inserted by a command +insert.screenshot|no|os|screen capture of other windows +addins.get|no|os|add-in store service +insert.video|no|os|online video service +insert.inkEquation|no|window|drawn with a pen or pointer +draw.inkToMath|no|os|handwriting recognition service +review.translate|no|os|online translation service +review.blockAuthors|no|os|co-authoring service +view.readLayout|no|window|Read Mode window layout +"; + +/// One feature's RFC-0052 `headless:` value and, for `no`/`partial`, its `reach:` and reason. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Headless { + pub value: &'static str, + pub reach: Option<&'static str>, + pub why: &'static str, +} + +const REACHES: [&str; 3] = ["window", "os", "engine-gap"]; + +/// Parsed `HEADLESS`-format marks: (id, value, reach, why). A malformed line is an error. +pub fn headless_marks(src: &'static str) -> Result, String> { + let mut out = Vec::new(); + for line in src.lines().filter(|l| !l.trim().is_empty()) { + let f: Vec<&'static str> = line.splitn(4, '|').collect(); + let [id, value, reach, why] = f[..] else { + return Err(format!("headless mark `{line}`: want `id|headless|reach|why`")); + }; + if !matches!(value, "no" | "partial") { + return Err(format!("headless mark `{id}`: `{value}` is not `no` or `partial` (`yes` comes from the registry)")); + } + if !REACHES.contains(&reach) { + return Err(format!("headless mark `{id}`: reach `{reach}` is not window, os or engine-gap")); + } + if out.iter().any(|(m, _)| *m == id) { + return Err(format!("headless mark `{id}` is written twice")); + } + out.push((id, Headless { value, reach: Some(reach), why })); + } + Ok(out) +} + +/// The `headless:` value of a catalog feature: `yes` when the engine registry has its id, else its +/// hand mark, else `unknown`. +pub fn headless_of(id: &str, live: bool, marks: &[(&'static str, Headless)]) -> Headless { + if live { + return Headless { value: "yes", reach: None, why: "" }; + } + marks.iter().find(|(m, _)| *m == id).map(|(_, h)| *h).unwrap_or(Headless { value: "unknown", reach: None, why: "" }) +} + +/// Problems with the marks against the catalog and the registry's ids: unknown ids, and marks on +/// ids the engine registry has (they would hide a `yes`). +pub fn headless_errors(src: &'static str, catalog: &[(&str, &str, &str, &str)], live: impl Fn(&str) -> bool) -> Vec { + let marks = match headless_marks(src) { + Ok(m) => m, + Err(e) => return vec![e], + }; + let mut errs = Vec::new(); + for (id, _) in &marks { + if !catalog.iter().any(|e| e.3 == *id) { + errs.push(format!("headless mark `{id}` is not a catalog id")); + } else if live(id) { + errs.push(format!("headless mark `{id}` is stale: the engine registry has it, so it is `yes`")); + } + } + errs +} + +/// Headless counts in the RFC-0052 summary shape. +fn headless_summary(values: &[Headless]) -> Value { + let count = |v: &str| values.iter().filter(|h| h.value == v).count(); + let no = |r: &str| values.iter().filter(|h| h.value == "no" && h.reach == Some(r)).count(); + json!({ + "yes": count("yes"), + "no": {"window": no("window"), "os": no("os"), "engine-gap": no("engine-gap")}, + "partial": count("partial"), + "unknown": count("unknown"), + }) +} + /// Catalog entries: (tab, group, feature, id). pub fn entries() -> Vec<(&'static str, &'static str, &'static str, &'static str)> { CATALOG @@ -546,9 +640,13 @@ pub fn entries() -> Vec<(&'static str, &'static str, &'static str, &'static str) /// Parity summary: per tab and overall, with the missing features. pub fn parity(reg: &Registry) -> Value { let e = entries(); + let marks = headless_marks(HEADLESS).unwrap_or_default(); + let mut values = Vec::with_capacity(e.len()); let mut tabs: Vec<(&str, usize, usize, Vec)> = Vec::new(); for (tab, group, label, id) in &e { let have = reg.get(id).is_some(); + let h = headless_of(id, have, &marks); + values.push(h); let t = match tabs.iter_mut().find(|t| t.0 == *tab) { Some(t) => t, None => { @@ -564,7 +662,8 @@ pub fn parity(reg: &Registry) -> Value { if have { t.1 += 1; } else { - t.3.push(format!("{group} › {label} (`{id}`)")); + let reach = h.reach.map(|r| format!(", reach: {r} ({})", h.why)).unwrap_or_default(); + t.3.push(format!("{group} › {label} (`{id}`): headless: {}{reach}", h.value)); } } let live = tabs.iter().map(|t| t.1).sum::(); @@ -573,6 +672,7 @@ pub fn parity(reg: &Registry) -> Value { "live": live, "total": total, "percent": if total == 0 { 0.0 } else { (live as f64 * 1000.0 / total as f64).round() / 10.0 }, + "headless": headless_summary(&values), "tabs": tabs.iter().map(|t| json!({"tab": t.0, "live": t.1, "total": t.2, "missing": t.3})).collect::>(), }) } @@ -597,6 +697,44 @@ mod tests { assert!(pct >= 90.4, "parity {pct}%"); } + #[test] + fn headless_marks_are_current() { + let reg = crate::cmd::registry(); + let errs = headless_errors(HEADLESS, &entries(), |id| reg.get(id).is_some()); + assert!(errs.is_empty(), "{errs:?}"); + } + + #[test] + fn headless_yes_comes_only_from_the_registry() { + let marks = headless_marks("a.b|no|window|pointer\n").unwrap(); + assert_eq!(headless_of("a.b", true, &marks).value, "yes", "a live id is yes whatever the mark says"); + assert_eq!(headless_of("a.b", false, &marks).reach, Some("window")); + assert_eq!(headless_of("c.d", false, &marks).value, "unknown"); + assert!(headless_marks("a.b|yes|window|x\n").is_err(), "a hand-written yes is refused"); + assert!(headless_marks("a.b|no|desk|x\n").is_err(), "reach must be window, os or engine-gap"); + assert!(headless_marks("a.b|no\n").is_err()); + assert!(headless_marks("a.b|no|os|x\na.b|partial|os|y\n").is_err(), "one mark per id"); + } + + #[test] + fn headless_errors_flag_stale_and_unknown_marks() { + let cat = [("T", "G", "F", "a.b"), ("T", "G", "H", "c.d")]; + let errs = headless_errors("a.b|no|os|x\nz.z|no|os|y\n", &cat, |id| id == "a.b"); + assert!(errs.iter().any(|e| e.contains("`a.b` is stale")), "{errs:?}"); + assert!(errs.iter().any(|e| e.contains("`z.z` is not a catalog id")), "{errs:?}"); + assert!(headless_errors("bad\n", &cat, |_| false).len() == 1); + } + + #[test] + fn parity_counts_every_feature_once_in_the_headless_summary() { + let p = parity(&crate::cmd::registry()); + let h = &p["headless"]; + let n = |v: &Value| v.as_u64().unwrap_or(0); + let no = n(&h["no"]["window"]) + n(&h["no"]["os"]) + n(&h["no"]["engine-gap"]); + assert_eq!(n(&h["yes"]) + no + n(&h["partial"]) + n(&h["unknown"]), n(&p["total"])); + assert_eq!(n(&h["yes"]), n(&p["live"]), "every live feature is an engine command here"); + } + #[test] fn read_mode_view_menu_is_catalogued() { let e = entries(); diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index dba3eb994d..dadf831c59 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -33,6 +33,7 @@ pub mod packs; pub mod page; pub mod para; pub mod paste; +pub mod paste_cells; pub mod phonetic; pub mod protect; pub mod references; @@ -209,14 +210,21 @@ pub fn new_revision(s: &mut Session, kind: RevisionKind) -> u32 { .iter() .enumerate() .rev() - .find(|(i, r)| r.kind == kind && r.author == s.author && r.date == date && r.move_name.is_none() && held != Some(*i as u32)) + .find(|(i, r)| r.kind == kind && r.author == s.author && r.instant() == date && r.move_name.is_none() && held != Some(*i as u32)) { return i as u32; } - s.doc.revisions.push(Revision { kind, author: s.author.clone(), date, move_name: None }); + s.doc.revisions.push(made_revision(kind, s.author.clone(), date)); (s.doc.revisions.len() - 1) as u32 } +/// A revision record for a change made at `utc` (ISO 8601, UTC): dated in local wall-clock time, +/// as Word writes `w:date`, with the UTC time beside it, so a save writes it as it is (#6851). +pub fn made_revision(kind: RevisionKind, author: String, utc: String) -> Revision { + let date = crate::io_ext::word_date(&utc, local_offset_secs).unwrap_or_else(|| utc.clone()); + Revision::made_at(kind, author, date, utc) +} + /// Whether the paragraph at `path` is followed by another paragraph in the same container (so /// its paragraph mark can be removed by joining the two). pub fn has_next_para(s: &Session, story: StoryRef, path: &wordcraft_doc::Path) -> bool { @@ -555,6 +563,10 @@ pub fn iso_from_unix_secs(secs: u64) -> String { /// Seconds since the Unix epoch (UTC): the system clock, or the browser's on the web. pub fn now_unix() -> u64 { + #[cfg(test)] + if let Some(now) = TEST_NOW.with(std::cell::Cell::get) { + return now; + } #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] { std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) @@ -576,9 +588,23 @@ pub fn now_iso() -> String { /// The local time zone's offset from UTC in seconds (east positive) at `unix`, daylight saving /// included: the system's zone, or the browser's on the web. 0 (UTC) when it can't be found. pub fn local_offset_secs(unix: u64) -> i64 { + #[cfg(test)] + if let Some(zone) = TEST_ZONE.with(std::cell::Cell::get) { + return zone(unix); + } system_offset_secs(unix).clamp(-26 * 3600, 26 * 3600) } +#[cfg(test)] +thread_local! { + /// The clock [`now_unix`] reads on this thread in place of the system's, so a test can make + /// edits at the instants it needs. + pub static TEST_NOW: std::cell::Cell> = const { std::cell::Cell::new(None) }; + /// The zone [`local_offset_secs`] gives on this thread in place of the system's. CI runs on + /// UTC, where local time is UTC, so a test sets a zone that isn't to tell them apart. + pub static TEST_ZONE: std::cell::Cell i64>> = const { std::cell::Cell::new(None) }; +} + #[cfg(not(target_arch = "wasm32"))] fn system_offset_secs(unix: u64) -> i64 { use chrono::Offset; diff --git a/crates/engine/src/cmd/canvas.rs b/crates/engine/src/cmd/canvas.rs index 021fe9b9dc..8124420ae5 100644 --- a/crates/engine/src/cmd/canvas.rs +++ b/crates/engine/src/cmd/canvas.rs @@ -35,6 +35,32 @@ pub fn selected_member(s: &Session) -> Option<(Pos, usize, &InlineObject)> { Some((pos, m.index, &c.obj)) } +/// The canvas member whose text box story the caret is in (when no inner object is selected): +/// the canvas's position, the member's index and the member. +pub fn text_box_member(s: &Session) -> Option<(Pos, usize, &InlineObject)> { + if super::objects::selected(s).is_some() { + return None; + } + let StoryRef::Part(id) = s.sel.focus.story else { return None }; + if !s.doc.parts.get(&id).is_some_and(|p| p.kind == PartKind::TextBox) { + return None; + } + let after = s.doc.text_box_anchor(id)?; + let pos = Pos { off: after.off.checked_sub(wordcraft_doc::para::OBJ.len_utf8())?, ..after }; + let InlineObject::Group { children, canvas: Some(_), .. } = s.doc.para_at(&pos)?.object_at(pos.off)? else { + return None; + }; + let (index, c) = + children.iter().enumerate().find(|(_, c)| pickable(c) && matches!(&c.obj, InlineObject::Shape { story: Some(sid), .. } if *sid == id))?; + Some((pos, index, &c.obj)) +} + +/// The canvas member object commands act on: one picked with `select.member`, or the text box +/// member whose text the caret is in. +pub(crate) fn active_member(s: &Session) -> Option<(Pos, usize, &InlineObject)> { + selected_member(s).or_else(|| text_box_member(s)) +} + /// Whether a member can be picked on its own: a picture, shape or text box that is drawn (a /// group inside a canvas isn't, nor a hidden member). pub fn pickable(c: &GroupChild) -> bool { @@ -295,7 +321,13 @@ pub(crate) fn member_command(s: &mut Session, id: &str, _: &Value) -> Option CmdResult { if !copied { return Err(CmdError::Failed("the member vanished".into())); } - s.clipboard_text = f.clipboard_text(); - s.clip_history.push(&f, &s.clipboard_text); - s.clipboard = Some(f); - Ok(super::edit::copy_result(s)) + let text = f.clipboard_text(); + let r = super::edit::copy_result(s, &f, &text)?; + s.clip_history.push(&f, &text); + Ok(r) } /// Take member `index` out of the canvas at `pos`; the canvas stays selected. @@ -350,7 +382,7 @@ fn remove_member(s: &mut Session, pos: &Pos, index: usize) -> Result<(), CmdErro /// Move or Resize with a member picked: `x`/`y` (the page point of its top-left, as dragging its /// frame gives it) and the size become its place and size in the canvas. `None`: no member. pub(crate) fn member_bounds(s: &mut Session, v: &Value) -> Option { - let (pos, index, obj) = selected_member(s)?; + let (pos, index, obj) = active_member(s)?; let (w0, h0, _) = obj.frame()?; let min = super::objects::min_size(obj); let to = match (p::f32(v, "x"), p::f32(v, "y")) { @@ -381,7 +413,7 @@ pub(crate) fn member_bounds(s: &mut Session, v: &Value) -> Option { /// Nudge with a member picked: it moves inside the canvas. `None`: no member. pub(crate) fn member_nudge(s: &mut Session, dx: f32, dy: f32) -> Option { - let (pos, index, _) = selected_member(s)?; + let (pos, index, _) = active_member(s)?; Some(edit_member(s, &pos, index, |_, (sx, sy), c| { c.x = (c.x + dx / sx).clamp(-MAX_SIDE, MAX_SIDE); c.y = (c.y + dy / sy).clamp(-MAX_SIDE, MAX_SIDE); @@ -406,10 +438,10 @@ fn edit_member(s: &mut Session, pos: &Pos, index: usize, f: impl FnOnce(wordcraf Ok(json!({"object": member, "pos": super::pos_json(pos), "member": index})) } -/// Change the picked member's own object (Shape Format, Size, Rotate, Alt Text) when `pos` is its -/// canvas. `None`: no member picked there. +/// Change the active member's own object (Shape Format, Size, Rotate, Alt Text) when `pos` is its +/// canvas. `None`: no active member there. pub(crate) fn edit_member_object(s: &mut Session, pos: &Pos, f: impl Fn(&mut InlineObject)) -> Option> { - let (at, index, _) = selected_member(s).filter(|(at, ..)| at == pos)?; + let (at, index, _) = active_member(s).filter(|(at, ..)| at == pos)?; let mut out = None; let r = edit_canvas(s, &at, |_, _, children| { if let Some(c) = children.get_mut(index) { diff --git a/crates/engine/src/cmd/caret.rs b/crates/engine/src/cmd/caret.rs index c519c9e060..a95fc6b5d1 100644 --- a/crates/engine/src/cmd/caret.rs +++ b/crates/engine/src/cmd/caret.rs @@ -1,7 +1,9 @@ //! Caret movement and selection. use serde_json::Value; -use wordcraft_doc::{Pos, StoryRef}; +use wordcraft_doc::math_edit::MathPos; +use wordcraft_doc::para::OBJ; +use wordcraft_doc::{InlineObject, Paragraph, Pos, StoryRef}; use wordcraft_layout::ViewMode; use super::{parse_pos, sel_result}; @@ -108,7 +110,8 @@ fn bidi_para(s: &Session) -> bool { /// Left/Right: with a selection and no Shift, collapse to its edge. fn lr(s: &mut Session, v: &Value, is_left: bool) -> CmdResult { - if !extend(v) && !s.sel.is_collapsed() { + let ext = extend(v); + if !ext && !s.sel.is_collapsed() { let (a, b) = s.sel.ordered(); // The left edge of a selection in right-to-left text is its logical end. let to_start = is_left != rtl_para(s); @@ -119,7 +122,35 @@ fn lr(s: &mut Session, v: &Value, is_left: bool) -> CmdResult { if bidi_para(s) { return visual_lr(s, v, is_left); } - mv(s, v, if is_left { left } else { right }) + let from = s.sel.focus.clone(); + // Equation entry and the grapheme step start at the same visible edge. + let edge = logical_edge(s, &from, is_left); + if !ext + && !s.math_left + && let Some(r) = into_equation(s, &from, edge, is_left) + { + return r; + } + s.goal_x = None; + let to = step_from_edge(s, &from, edge, is_left); + apply(s, to, ext); + sel_result(s) +} + +/// Left/Right onto an equation opens it, at its end from the right and at its start from the +/// 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) -> Option { + 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 { .. })) || (!s.view.show_markup && para.props_of_char(off).del.is_some()) { + return None; + } + s.sel = Selection::caret(Pos { off, ..from.clone() }); + s.goal_x = None; + s.pending = None; + Some(super::equation::edit_at(s, (!is_left).then(MathPos::default))) } /// Left/Right in bidirectional text: one caret position to the left or right on the screen. @@ -135,62 +166,86 @@ fn visual_lr(s: &mut Session, v: &Value, is_left: bool) -> CmdResult { Some(wordcraft_layout::VisualStep::Edge { start, stop, last_line, rtl }) => { let at = |off| Pos { off, ..from.clone() }; if is_left != rtl { - match s.doc.para_at(&from) { - Some(para) if start > 0 => at(para.prev_boundary(start)), - _ => left(s, &at(0)), - } + logical_step(s, &at(start), true) } else if !last_line { at(stop) } else { let len = s.doc.para_at(&from).map_or(stop, |p| p.len()); - right(s, &at(len)) + logical_step(s, &at(len), false) } } - None if is_left => left(s, &from), - None => right(s, &from), + None => logical_step(s, &from, is_left), }; apply(s, to, ext); sel_result(s) } -fn left(s: &mut Session, p: &Pos) -> Pos { - if let Some(para) = s.doc.para_at(p) - && p.off > 0 - { - return Pos { off: para.prev_boundary(p.off), ..p.clone() }; +/// 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) -> 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. + let found = if byte < para.len() / 2 { + para.run_ranges().enumerate().find_map(|(i, (range, _))| range.contains(&byte).then_some((i, range))) + } else { + let mut end = para.len(); + para.runs.iter().enumerate().rev().find_map(|(i, run)| { + let range = end - run.len..end; + end = range.start; + range.contains(&byte).then_some((i, range)) + }) + }; + let Some((i, range)) = found else { return off }; + if para.runs[i].props.del.is_none() { + return off; } - match s.doc.prev_para(p.story, &p.path) { - Some(q) => { - let off = s.doc.para(p.story, &q).map(|x| x.len()).unwrap_or(0); - Pos { story: p.story, path: q, off } - } - None => p.clone(), + if is_left { + range.start - para.runs[..i].iter().rev().take_while(|run| run.props.del.is_some()).map(|run| run.len).sum::() + } else { + range.end + para.runs[i + 1..].iter().take_while(|run| run.props.del.is_some()).map(|run| run.len).sum::() } } -fn right(s: &mut Session, p: &Pos) -> Pos { - if let Some(para) = s.doc.para_at(p) - && p.off < para.len() +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 Pos { off: para.next_boundary(p.off), ..p.clone() }; + return hidden_deletion_edge(para, from.off, is_left); } - match s.doc.next_para(p.story, &p.path) { - Some(q) => Pos { story: p.story, path: q, off: 0 }, - None => p.clone(), + from.off +} + +fn logical_step(s: &Session, from: &Pos, is_left: bool) -> Pos { + 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 { + if let Some(para) = s.doc.para_at(from) { + if is_left && edge > 0 { + return Pos { off: para.prev_boundary(edge), ..from.clone() }; + } + if !is_left && edge < para.len() { + return Pos { off: para.next_boundary(edge), ..from.clone() }; + } } + 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() }, - _ => left(s, p), + _ => 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() }, - _ => right(s, p), + _ => logical_step(s, p, false), } } @@ -276,7 +331,11 @@ fn page(s: &mut Session, v: &Value, dir: i32) -> CmdResult { } let Some(c) = l.caret_on(&from, s.page_hint) else { return sel_result(s) }; let np = if dir < 0 { c.page.saturating_sub(1) } else { (c.page + 1).min(l.pages.len().saturating_sub(1)) }; - let to = l.hit(np, c.x, c.top + 1.0, from.story).unwrap_or(from); + let to = if np == c.page { + if dir < 0 { s.doc.start_of(from.story) } else { s.doc.end_of(from.story) } + } else { + l.hit(np, c.x, c.top + 1.0, from.story).unwrap_or(from) + }; s.page_hint = np; apply(s, to, ext); sel_result(s) @@ -477,7 +536,7 @@ fn drag_unit(s: &mut Session, v: &Value) -> CmdResult { /// Select the n-th occurrence of `text` in the body (agents: "select the word X"). fn select_text(s: &mut Session, v: &Value) -> CmdResult { let needle = p::req_str(v, "text")?; - let n = p::u64(v, "occurrence").unwrap_or(1).max(1) as usize; + let n = p::u64(v, "occurrence").unwrap_or(1).max(1); if needle.is_empty() { return Err(CmdError::Params("`text` is empty".into())); } diff --git a/crates/engine/src/cmd/citations.rs b/crates/engine/src/cmd/citations.rs index f889790a56..ccdc826e3d 100644 --- a/crates/engine/src/cmd/citations.rs +++ b/crates/engine/src/cmd/citations.rs @@ -35,7 +35,7 @@ pub fn specs() -> Vec { vec![ CommandSpec::new("references.sources", "Manage Sources", "References › Citations & Bibliography", sources) .params(r#"{"add"?: Source, "remove"?: tag, "import"?: path (a Word bibliography file, `b:Sources` / `Sources.xml`)} → list"#), - CommandSpec::new("references.citation", "Insert Citation", "References › Citations & Bibliography", citation).params(r#"{"tag"?: string, "source"?: Source (added if new), "pages"?: string}"#), + CommandSpec::new("references.citation", "Insert Citation", "References › Citations & Bibliography", citation).params(r#"{"tag"?: string, "source"?: Source (added, or edited when its tag exists, and cited when no tag is given), "pages"?: string}"#), CommandSpec::new("references.citationStyle", "Style", "References › Citations & Bibliography", |s, v| { let st = p::str(v, "style").unwrap_or("APA"); let st = find_style(st).ok_or_else(|| { diff --git a/crates/engine/src/cmd/citations/sources.rs b/crates/engine/src/cmd/citations/sources.rs index 8cc68bd0bd..78ae48339c 100644 --- a/crates/engine/src/cmd/citations/sources.rs +++ b/crates/engine/src/cmd/citations/sources.rs @@ -37,22 +37,7 @@ fn auto_tag_base(src: &Source) -> String { /// document's sources. `import` reads a Word bibliography file (`b:Sources`, #2640). pub(super) fn sources(s: &mut Session, v: &Value) -> CmdResult { if let Some(a) = v.get("add") { - let mut src: Source = serde_json::from_value(a.clone()).map_err(|e| CmdError::Params(e.to_string()))?; - // A new source's tag is made from its author and year; an edit keeps the tag it has. - if src.tag.is_empty() { - src.tag = auto_tag(&s.doc, &src); - } - // Edit Source keeps the source's place in the list and refreshes its citations. - match s.doc.sources.iter().position(|x| x.tag == src.tag) { - Some(i) => { - if let Some(x) = s.doc.sources.get_mut(i) { - *x = src; - } - update_citations(s)?; - } - None => s.doc.sources.push(src), - } - s.touch(); + add_source(s, a)?; } if let Some(t) = p::str(v, "remove") { s.doc.sources.retain(|x| x.tag != t); @@ -63,6 +48,28 @@ pub(super) fn sources(s: &mut Session, v: &Value) -> CmdResult { Ok(serde_json::to_value(&s.doc.sources).unwrap_or(Value::Null)) } +/// Adds a source, or edits the one with its tag, and returns that tag (#7443). +fn add_source(s: &mut Session, a: &Value) -> Result { + let mut src: Source = serde_json::from_value(a.clone()).map_err(|e| CmdError::Params(e.to_string()))?; + // A new source's tag is made from its author and year; an edit keeps the tag it has. + if src.tag.is_empty() { + src.tag = auto_tag(&s.doc, &src); + } + let tag = src.tag.clone(); + // Edit Source keeps the source's place in the list and refreshes its citations. + match s.doc.sources.iter().position(|x| x.tag == src.tag) { + Some(i) => { + if let Some(x) = s.doc.sources.get_mut(i) { + *x = src; + } + update_citations(s)?; + } + None => s.doc.sources.push(src), + } + s.touch(); + Ok(tag) +} + /// The largest bibliography sources file imported from disk. #[cfg(not(target_arch = "wasm32"))] const MAX_SOURCES_FILE: u64 = 32 << 20; @@ -126,15 +133,16 @@ fn import_sources(s: &mut Session, path: &str) -> Result<(), CmdError> { } pub(super) fn citation(s: &mut Session, v: &Value) -> CmdResult { - if v.get("source").is_some() { - sources(s, &json!({"add": v.get("source")}))?; - } - let tag = match p::str(v, "tag") { - Some(t) => t.to_string(), - None => match v.get("source") { - Some(_) => s.doc.sources.last().map(|x| x.tag.clone()).unwrap_or_default(), - None => return Err(CmdError::Params("give `tag` or `source`".into())), - }, + // The source just added or edited is the one cited when no `tag` is given, wherever it sits + // in the list (#7443). + let added = match v.get("source") { + Some(a) => Some(add_source(s, a)?), + None => None, + }; + let tag = match (p::str(v, "tag"), added) { + (Some(t), _) => t.to_string(), + (None, Some(t)) => t, + (None, None) => return Err(CmdError::Params("give `tag` or `source`".into())), }; let src = s.doc.sources.iter().find(|x| x.tag == tag).cloned().ok_or_else(|| CmdError::Params(format!("no source `{tag}`")))?; let pages = p::str(v, "pages").unwrap_or("").to_string(); diff --git a/crates/engine/src/cmd/citations/tests.rs b/crates/engine/src/cmd/citations/tests.rs index b1fcdfede0..b9ba37ff19 100644 --- a/crates/engine/src/cmd/citations/tests.rs +++ b/crates/engine/src/cmd/citations/tests.rs @@ -597,6 +597,22 @@ fn editing_author_and_year_keeps_the_tag_and_updates_the_citation_text() { assert!(f[0].1.contains("Jones") && f[0].1.contains("2021"), "{:?}", f[0].1); } +#[test] +fn citing_an_edited_source_that_is_not_last_cites_that_source() { + let mut s = Session::new(wordcraft_doc::Document::new()); + s.run("references.sources", &json!({"add": src_of("Alice, Ann", "2000")})).unwrap(); + s.run("references.sources", &json!({"add": src_of("Bob, Ben", "2001")})).unwrap(); + let mut edited = src_of("Alice Edited, Ann", "2000"); + edited["tag"] = json!("Ali00"); + let r = s.run("references.citation", &json!({"source": edited})).unwrap(); + assert_eq!(r["tag"], "Ali00"); + let tags: Vec<_> = s.doc.sources.iter().map(|x| x.tag.as_str()).collect(); + assert_eq!(tags, ["Ali00", "Bob01"]); + let f = fields(&s); + assert_eq!(f[0].0, "CITATION Ali00"); + assert!(f[0].1.contains("Alice Edited") && f[0].1.contains("2000"), "{:?}", f[0].1); +} + #[test] fn a_new_sources_tag_is_three_letters_and_two_year_digits() { let mut s = Session::new(wordcraft_doc::Document::new()); diff --git a/crates/engine/src/cmd/column.rs b/crates/engine/src/cmd/column.rs index 8801d2d9e7..403b184e20 100644 --- a/crates/engine/src/cmd/column.rs +++ b/crates/engine/src/cmd/column.rs @@ -182,6 +182,9 @@ pub(crate) fn dispatch(s: &mut Session, id: &str, mutates: bool, run: fn(&mut Se _ if cells && (id.starts_with("table.") || matches!(id, "text.tab" | "text.backTab")) => run(s, v), // Copy and Cut of whole cells take a table of them (#1744). "edit.copy" | "edit.cut" if cells => run(s, v), + // Paste can lay a copied table over the selected cells. Let it inspect the selection + // before the ordinary column replacement deletes it. + "edit.paste" if cells => run(s, v), "edit.copy" => copy(s, &segs), "edit.cut" => { let r = copy(s, &segs)?; @@ -209,6 +212,16 @@ pub(crate) fn dispatch(s: &mut Session, id: &str, mutates: bool, run: fn(&mut Se } } +/// Delete the pieces of a selected cell rectangle for an ordinary Paste replacement. +pub(super) fn delete_cell_segments(s: &mut Session) -> Result<(), CmdError> { + if s.cell_range().is_some() + && let Some(segments) = s.column_segments().map(<[(Pos, Pos)]>::to_vec) + { + delete(s, &segments)?; + } + Ok(()) +} + /// Copy: one paragraph per block row (formatting kept); the plain text joins rows with newlines. fn copy(s: &mut Session, segs: &[(Pos, Pos)]) -> CmdResult { let mut blocks = Vec::new(); @@ -231,10 +244,10 @@ fn copy(s: &mut Session, segs: &[(Pos, Pos)]) -> CmdResult { rows.push(row_text(s, &a, &b)); blocks.push(Block::Para(para)); } - s.clipboard_text = rows.join("\n"); + let text = rows.join("\n"); let media = s.doc.media_of_blocks(&blocks); - s.clipboard = Some(Fragment { blocks, parts, media }); - Ok(super::edit::copy_result(s)) + let f = Fragment { blocks, parts, media }; + super::edit::copy_result(s, &f, &text) } /// Delete each row's piece (bottom up, so earlier positions stay valid) and leave the caret at diff --git a/crates/engine/src/cmd/controls.rs b/crates/engine/src/cmd/controls.rs index 8af16c9422..d7e5ef5404 100644 --- a/crates/engine/src/cmd/controls.rs +++ b/crates/engine/src/cmd/controls.rs @@ -279,6 +279,22 @@ fn content_base(s: &Session, r: &ControlRange) -> CharProps { content_props(&s.doc, &props) } +/// The formatting of what replaces a control's content: typed text, a list entry, a date or a +/// check box's mark. In place of the placeholder, that is the control's own run properties +/// (ECMA-376 §17.5.2.27), else the content's formatting without the placeholder style: the +/// showing placeholder's own character style is that style, whatever a producer called it (Word +/// localizes only the id; another program may localize the name too). In place of a value, it is +/// that value's formatting. +fn replacement_props(s: &Session, r: &ControlRange) -> CharProps { + if !r.control.showing_placeholder { + return content_base(s, r); + } + match &r.control.run_props { + Some(rp) => content_props(&s.doc, rp), + None => CharProps { style: None, ..content_base(s, r) }, + } +} + // --------------------------------------------------------------------------------------------- // Rules for typing and deleting @@ -327,14 +343,8 @@ pub fn prepare_edit(s: &mut Session) -> Result, CmdError> { if !r.control.showing_placeholder || !r.contains(&b) { return Ok(None); } - // Text typed in place of the placeholder takes the control's own run properties (Word, and - // ECMA-376 §17.5.2.27), else the content's formatting without the placeholder style. The - // showing placeholder's own character style is that style, whatever a producer called it - // (Word localizes only the id; another program may localize the name too). - let props = match &r.control.run_props { - Some(rp) => content_props(&s.doc, rp), - None => CharProps { style: None, ..content_base(s, &r) }, - }; + // Text typed in place of the placeholder takes the control's own run properties, as in Word. + let props = replacement_props(s, &r); s.sel = Selection { anchor: r.content_start(), focus: r.end.clone() }; if let Some(c) = s.doc.control_mut(&r.start) { c.showing_placeholder = false; @@ -666,7 +676,7 @@ fn toggle_check_box(s: &mut Session, v: &Value) -> CmdResult { } let now = p::bool(v, "value").unwrap_or(!checked); let (ch, font) = if now { (*checked_char, checked_font) } else { (*unchecked_char, unchecked_font) }; - let mut props = content_base(s, &r); + let mut props = replacement_props(s, &r); if !font.is_empty() { props.font = Some(font.clone()); } @@ -696,7 +706,7 @@ fn choose_item(s: &mut Session, v: &Value) -> CmdResult { return Err(CmdError::Params("give index, value or text".into())); }; let Some(item) = item.cloned() else { return Err(CmdError::Params("no such entry".into())) }; - let props = content_base(s, &r); + let props = replacement_props(s, &r); let end = set_content(s, &r, &item.display, &props)?; if let Some(c) = s.doc.control_mut(&r.start) { if let ControlKind::ComboBox { last_value, .. } | ControlKind::DropDown { last_value, .. } = &mut c.kind { @@ -716,7 +726,7 @@ fn set_date(s: &mut Session, v: &Value) -> CmdResult { } let (y, m, d) = p::str(v, "date").and_then(parse_date).ok_or_else(|| CmdError::Params("date: YYYY-MM-DD".into()))?; let text = format_date_value(format, y, m, d); - let props = content_base(s, &r); + let props = replacement_props(s, &r); let end = set_content(s, &r, &text, &props)?; if let Some(c) = s.doc.control_mut(&r.start) { if let ControlKind::Date { full_date, .. } = &mut c.kind { diff --git a/crates/engine/src/cmd/design.rs b/crates/engine/src/cmd/design.rs index 374661533c..c0b4ab3f1c 100644 --- a/crates/engine/src/cmd/design.rs +++ b/crates/engine/src/cmd/design.rs @@ -3,7 +3,7 @@ use serde_json::{Value, json}; use std::sync::Arc; use wordcraft_doc::props::{Border, BorderStyle, Borders, CharProps, LineSpacing, Rgb, TextColor}; -use wordcraft_doc::{Watermark, styles}; +use wordcraft_doc::{StyleKind, Watermark, styles}; use super::sel_result; use crate::{CmdError, CmdResult, CommandSpec, Session, p}; @@ -209,9 +209,16 @@ fn para_spacing(s: &mut Session, v: &Value) -> CmdResult { "double" => (0.0, 8.0, 2.0), _ => (0.0, 8.0, 1.15), }; - Arc::make_mut(&mut s.doc.styles).default_para.space_before = Some(before); - Arc::make_mut(&mut s.doc.styles).default_para.space_after = Some(after); - Arc::make_mut(&mut s.doc.styles).default_para.line_spacing = Some(LineSpacing::Multiple(line)); + let st = Arc::make_mut(&mut s.doc.styles); + let apply = |p: &mut wordcraft_doc::props::ParaProps| { + p.space_before = Some(before); + p.space_after = Some(after); + p.line_spacing = Some(LineSpacing::Multiple(line)); + }; + apply(&mut st.default_para); + for style in st.styles.iter_mut().filter(|style| style.builtin && style.kind == StyleKind::Paragraph) { + apply(&mut style.para); + } sel_result(s) } @@ -287,7 +294,7 @@ fn page_borders(s: &mut Session, v: &Value) -> CmdResult { }; let blocks: Vec = match p::str(v, "applyTo") { Some("document") => s.doc.sections().iter().map(|(end, _)| *end).collect(), - Some("section") | None => vec![s.sel.focus.path.0.first().copied().unwrap_or(0) as usize], + Some("section") | None => vec![super::page::section_end_of_focus(s)], Some(x) => return Err(CmdError::Params(format!("unknown `applyTo` `{x}`"))), }; for block in blocks { @@ -295,3 +302,34 @@ fn page_borders(s: &mut Session, v: &Value) -> CmdResult { } sel_result(s) } + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::json; + use wordcraft_doc::{Document, Style}; + + #[test] + fn paragraph_spacing_preset_updates_builtin_styles_and_keeps_custom_styles() { + let mut s = Session::new(Document::new()); + Arc::make_mut(&mut s.doc.styles).styles.push(Style { + id: "CustomSpacing".into(), + name: "Custom Spacing".into(), + kind: StyleKind::Paragraph, + builtin: false, + para: wordcraft_doc::props::ParaProps { space_after: Some(24.0), ..Default::default() }, + ..Default::default() + }); + + s.run("design.paragraphSpacing", &json!({"value": "double"})).unwrap(); + + let normal = s.doc.styles.get("Normal").unwrap(); + assert_eq!(normal.para.line_spacing, Some(LineSpacing::Multiple(2.0))); + let heading = s.doc.styles.get("Heading1").unwrap(); + assert_eq!((heading.para.space_before, heading.para.space_after), (Some(0.0), Some(8.0))); + assert_eq!(heading.para.line_spacing, Some(LineSpacing::Multiple(2.0))); + let custom = s.doc.styles.get("CustomSpacing").unwrap(); + assert_eq!(custom.para.space_after, Some(24.0)); + assert_eq!(custom.para.line_spacing, None); + } +} diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index dd88ed571f..f8a6dd2f50 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -39,7 +39,7 @@ fn has_text_sel(s: &Session) -> Option<&'static str> { if s.sel.is_collapsed() { Some("nothing is selected") } else { None } } -/// Something to cut: text, or whole table cells (an empty cell's selection has no length, #1744). +/// Something to cut: text, an object, or whole table cells (an empty cell's selection has no length, #1744). fn has_sel(s: &Session) -> Option<&'static str> { if s.sel.is_collapsed() && s.cell_range().is_none() { Some("nothing is selected") } else { None } } @@ -73,7 +73,7 @@ pub fn specs() -> Vec { .key("Mod+Y / Mod+Shift+Z") .pure(), CommandSpec::new("edit.cut", "Cut", "Home › Clipboard", cut).key("Mod+X").when(has_sel), - CommandSpec::new("edit.copy", "Copy", "Home › Clipboard", copy).key("Mod+C / Mod+Insert").pure(), + CommandSpec::new("edit.copy", "Copy", "Home › Clipboard", copy).key("Mod+C / Mod+Insert").pure().when(has_sel), // Word's Spike (Ctrl+F3, Ctrl+Shift+F3; ⌘ on the Mac): the AutoText entry "Spike", so Quick // Parts and AutoText insert it without emptying it, as in Word. CommandSpec::new("edit.spike", "Spike", "Editing", spike).key("Mod+F3").when(has_text_sel), @@ -89,6 +89,8 @@ pub fn specs() -> Vec { CommandSpec::new("edit.paste", "Paste", "Home › Clipboard", paste) .key("Mod+V / Shift+Insert") .params(r#"{"text"?: string, "html"?: string, "rtf"?: string, "privateClipboard"?: bool}"#), + CommandSpec::new("edit.pasteNestedTable", "Paste as Nested Table", "Home › Clipboard › Paste", paste_nested) + .params(r#"{"text"?: string, "html"?: string, "rtf"?: string, "privateClipboard"?: bool} (a copied table with the caret in a table cell nests in that cell; Paste instead inserts its rows or overwrites the cells from the caret's)"#), CommandSpec::new("edit.pasteText", "Paste: Keep Text Only", "Home › Clipboard › Paste", paste_text) .params(r#"{"text"?: string}"#) .key("Mod+Shift+Alt+V"), @@ -159,7 +161,7 @@ pub fn specs() -> Vec { .params(r#"{"tab"?: "find|replace|goto" (default replace)}"#) .pure(), CommandSpec::new("edit.replaceAll", "Replace All", "Home › Editing › Replace", replace_all) - .params(r#"{"text": string, "with": string (^p ^t ^& ^c …; \\1 with wildcards; with regex also $1 ${n} ${name} $0 $$ \\1 \\n (paragraph mark) \\t), …options of edit.find}"#), + .params(r#"{"text": string, "with": string (^p ^t ^& ^c …; \\1 with wildcards; with regex also $1 ${n} ${name} $0 $$ \\1 \\n (paragraph mark) \\t), …options of edit.find} (with AutoFormat's smart quotes on, a " or ' typed in `with` goes in curly by the character before it, as typing does, except with regex or special: false (taken as written); ^034 and ^039 stay straight; a match that already reads so, curled the same kind, is left and not counted)"#), CommandSpec::new("edit.goto", "Go To", "Home › Editing › Find", goto) .key("Mod+Alt+G / F5") .params(r#"{"page"?: n, "pageBy"?: int (pages forward, negative back, from the caret's page), "bookmark"?: string (selects its text), "paragraph"?: n}; none opens Find and Replace on its Go To tab"#) @@ -185,6 +187,7 @@ pub fn specs() -> Vec { ] } +/// Copy the selected text, object, or table cells to the clipboard. fn copy(s: &mut Session, _: &Value) -> CmdResult { let whole = super::table::selected_table(s); copy_with(s, whole.as_ref()) @@ -205,28 +208,28 @@ fn copy_with(s: &mut Session, whole: Option<&Path>) -> CmdResult { None if a == b => return Ok(json!({"text": ""})), None => s.doc.copy_range(&a, &b), }; - s.clipboard_text = f.clipboard_text(); - s.clip_history.push(&f, &s.clipboard_text); - s.clipboard = Some(f); - Ok(copy_result(s)) + let text = f.clipboard_text(); + let r = copy_result(s, &f, &text)?; + s.clip_history.push(&f, &text); + Ok(r) } /// What Copy and Cut return: the clipboard's text, and the copy as HTML (equations as MathML, /// #816) and as RTF for the host to put on the system clipboard too, so other programs keep the /// formatting; and for a copy of one equation alone, its MathML (#1297). -pub(crate) fn copy_result(s: &mut Session) -> Value { - (s.clipboard_html, s.clipboard_rtf) = match &s.clipboard { - Some(f) => { - let mut d = f.to_document(); - if d.media.is_empty() { - d.media = s.doc.media.clone(); - } - (wordcraft_formats::html::export_fragment(&d), wordcraft_formats::rtf::export(&d)) - } - None => (String::new(), String::new()), - }; - let mut r = json!({"text": s.clipboard_text}); - for (k, v) in [("html", &s.clipboard_html), ("rtf", &s.clipboard_rtf)] { +/// +/// The copy goes on the clipboard whole or not at all: a copy whose HTML or RTF cannot be made +/// is refused, and the clipboard keeps what it held. +pub(crate) fn copy_result(s: &mut Session, f: &Fragment, text: &str) -> CmdResult { + let mut d = f.to_document(); + d.styles = s.doc.styles.clone(); + if d.media.is_empty() { + d.media = s.doc.media.clone(); + } + let html = wordcraft_formats::html::export_fragment(&d).map_err(|e| CmdError::Failed(format!("the copy cannot be exported as HTML: {e}")))?; + let rtf = wordcraft_formats::rtf::export(&d).map_err(|e| CmdError::Failed(format!("the copy cannot be exported as RTF: {e}")))?; + let mut r = json!({"text": text}); + for (k, v) in [("html", &html), ("rtf", &rtf)] { if !v.is_empty() { r[k] = json!(v); } @@ -235,12 +238,19 @@ pub(crate) fn copy_result(s: &mut Session) -> Value { // ("MathML" on Windows, `public.mathml.presentation` on macOS; #1297). Word looks for them // before anything else when it pastes; a copy with text around the equation doesn't offer // them, so pasting it keeps the text. - if let Some((linear, display)) = s.clipboard.as_ref().and_then(|f| f.sole_equation()) { + if let Some((linear, display)) = f.sole_equation() { r["mathml"] = json!(wordcraft_formats::mathml::linear_to_mathml(linear, display)); } - r + // The copy is on the clipboard now: its text, its fragment and its HTML and RTF flavours, + // all at once. + s.clipboard_text = text.to_string(); + s.clipboard = Some(f.clone()); + s.clipboard_html = html; + s.clipboard_rtf = rtf; + Ok(r) } +/// Cut the selection, selected object, or whole table cells to the clipboard and remove it from the document. fn cut(s: &mut Session, _: &Value) -> CmdResult { let whole = super::table::selected_table(s); let r = copy_with(s, whole.as_ref())?; @@ -301,13 +311,30 @@ fn insert_spike(s: &mut Session, _: &Value) -> CmdResult { /// else another program's HTML or RTF (#687). The system clipboard's text has none, so it pastes /// as Keep Text Only does. fn paste(s: &mut Session, v: &Value) -> CmdResult { - match super::paste::paste_content(s, v)? { + let pasted = super::paste::paste_content(s, v)?; + if let super::paste::Pasted::Fragment(frag) = &pasted + && super::paste_cells::paste_over_selection(s, frag)? + { + return sel_result(s); + } + super::column::delete_cell_segments(s)?; + match pasted { super::paste::Pasted::Fragment(frag) => super::paste::insert(s, frag)?, super::paste::Pasted::Text(text) => super::paste::insert_text(s, &text)?, } sel_result(s) } +/// Paste as Nested Table: like Paste, but a copied table goes inside the cell the caret is in +/// instead of laying its rows or cells over the table (#6739). +fn paste_nested(s: &mut Session, v: &Value) -> CmdResult { + match super::paste::paste_content(s, v)? { + super::paste::Pasted::Fragment(frag) => super::paste::insert_as_is(s, frag)?, + super::paste::Pasted::Text(text) => super::paste::insert_text(s, &text)?, + } + sel_result(s) +} + /// Merge Formatting: the pasted text takes the destination's formatting, keeping its emphasis. fn paste_merge(s: &mut Session, v: &Value) -> CmdResult { let mut frag = super::paste::paste_fragment(s, v)?; @@ -444,11 +471,17 @@ fn paste_clip_item(s: &mut Session, v: &Value) -> CmdResult { /// Every collected item, in the order they were copied (one undo step). fn paste_all_clips(s: &mut Session, _: &Value) -> CmdResult { let all: Vec = s.clip_history.items.iter().rev().map(|x| x.fragment.clone()).collect(); - let mut r = sel_result(s)?; + let multiple = all.len() > 1; for f in all { - r = paste_clip(s, f)?; + if multiple { + // Insert each item at the end of the last one. Cell paste can overwrite a + // previous item or insert rows ahead of it. + super::paste::insert_as_is(s, f)?; + } else { + return paste_clip(s, f); + } } - Ok(r) + sel_result(s) } fn paste_text(s: &mut Session, v: &Value) -> CmdResult { @@ -468,6 +501,9 @@ pub(crate) struct Found { pub a: Pos, pub b: Pos, pub rep: Option, + /// With smart quotes on, the match already is its replacement with the quotes curled the + /// same kind (a curly apostrophe a typed `'` found): Replace leaves it and doesn't count it. + pub keep: bool, } /// A stretch of searched text: `len` bytes from `hay` are paragraph `para`'s bytes from `raw`. @@ -507,6 +543,13 @@ fn find_opts(f: &crate::session::FindState) -> find_pattern::Opts { /// wildcard groups). A pattern that can match a paragraph mark (`^p`) reads runs of sibling /// paragraphs as one text with a mark between them; otherwise each paragraph is read alone. pub(crate) fn search_full(s: &Session, story: StoryRef, with_rep: bool) -> Result, CmdError> { + search_matches(s, story, with_rep, false) +} + +/// [`search_full`]. With `chain` (Replace All, which replaces every match), a quote typed in +/// Replace with curls by the previous match's replacement when the two touch; without it, by the +/// text as it is, since Replace changes only the selected match (#7307). +fn search_matches(s: &Session, story: StoryRef, with_rep: bool, chain: bool) -> Result, CmdError> { use regex_automata::{Input, meta, util::syntax}; let f = &s.find; if f.query.is_empty() { @@ -523,6 +566,9 @@ pub(crate) fn search_full(s: &Session, story: StoryRef, with_rep: bool) -> Resul let index = |name: &str| re.group_info().to_index(regex_automata::PatternID::ZERO, name); find_pattern::resolve_names(find_pattern::parse_replace(&f.replace, &opts), &index) }); + // "Straight quotes with smart quotes" curls a quote typed in Replace with (#7307). + let ac = &s.prefs.autocorrect; + let smart = ac.enabled && ac.smart_quotes && pieces.as_deref().is_some_and(find_pattern::has_typed_quote); let paths = s.doc.para_paths(story); // Paragraphs read as one text: consecutive siblings when the pattern spans paragraphs. let mut chunks: Vec> = Vec::new(); @@ -585,6 +631,8 @@ pub(crate) fn search_full(s: &Session, story: StoryRef, with_rep: bool) -> Resul }; cuts.push(hay.len()); let mut from = 0; + // Where the last match ends and the character that stands there once it is replaced. + let mut last: Option<(usize, Option)> = None; for cut in cuts { if cut <= from { continue; @@ -608,11 +656,24 @@ pub(crate) fn search_full(s: &Session, story: StoryRef, with_rep: bool) -> Resul continue; } let (Some(a), Some(b)) = (pos_of(m.start(), false), pos_of(m.end(), true)) else { continue }; + let found = hay.get(m.range()).unwrap_or(""); + // A quote curls by the character in front of the match as it will read: with + // `chain`, the previous match's replacement when the two touch. A section mark + // starts a paragraph. + let before = match last { + Some((end, c)) if chain && end == m.start() => c, + _ => hay.get(..m.start()).and_then(|t| t.chars().next_back()), + } + .filter(|c| *c != find_pattern::SECT_MARK); + let quotes = if smart { find_pattern::Quotes::Smart { before } } else { find_pattern::Quotes::Straight }; let rep = pieces.as_ref().map(|pc| { let group = |n: usize| caps.get_group(n).and_then(|g| hay.get(g.range())).map(str::to_string); - find_pattern::expand(pc, hay.get(m.range()).unwrap_or(""), &group, &s.clipboard_text) + find_pattern::expand(pc, found, &group, &s.clipboard_text, quotes) }); - out.push(Found { a, b, rep }); + let keep = smart && rep.as_deref().is_some_and(|r| find_pattern::already_curled(found, r)); + let stays = if keep { found } else { rep.as_deref().unwrap_or(found) }; + last = Some((m.end(), stays.chars().next_back().or(before))); + out.push(Found { a, b, rep, keep }); if out.len() >= 100_000 { return Ok(out); } @@ -751,7 +812,8 @@ fn replace(s: &mut Session, v: &Value) -> CmdResult { // Replace the current match if selected, then move to the next. The result says which // happened (#6877): a first call that only selects a match reads as `replaced: 0`. let mut replaced = 0; - if let Some(f) = results.into_iter().find(|f| f.a == a && f.b == b) { + // A match already curled as the replacement would curl it is left as it is (#7307). + if let Some(f) = results.into_iter().find(|f| f.a == a && f.b == b && !f.keep) { super::paste_text(s, &f.rep.unwrap_or_default())?; replaced = 1; } @@ -771,10 +833,11 @@ fn replace_all(s: &mut Session, v: &Value) -> CmdResult { need_query(s, v)?; read_opts(s, v); let story = s.sel.focus.story; - let results = search_full(s, story, true)?; + // Matches already curled as the replacement would curl them are left and not counted (#7307). + let results: Vec = search_matches(s, story, true, true)?.into_iter().filter(|f| !f.keep).collect(); let n = results.len(); super::controls::check_deletions(s, story, results.iter().map(|f| (&f.a, &f.b)))?; - for Found { a, b, rep } in results.into_iter().rev() { + for Found { a, b, rep, .. } in results.into_iter().rev() { let with = rep.unwrap_or_default(); if s.doc.settings.track_changes { // Same path as a single replace, so the change is a reviewable revision. @@ -927,4 +990,32 @@ mod shortcut_tests { } } } + + #[test] + fn copy_format_web_alias_respects_user_removal_and_reassignment() { + use craft_keymap::{Binding, Chord, CommandRef, Overrides, Policy}; + + let mut commands = super::super::registry().all().to_vec(); + commands.iter_mut().find(|c| c.id == "edit.copyFormat").unwrap().shortcut = copy_format_shortcut(true); + let registry = Registry::new(commands); + + let mut keymap = crate::keymap::registry_keymap(®istry, &Overrides::default()); + let copy_cmd = CommandRef::new("edit.copyFormat"); + let bold_cmd = CommandRef::new("format.bold"); + let chord = Chord::parse("Mod+Alt+Shift+C").unwrap(); + let binding = Binding::parse("Mod+Alt+Shift+C").unwrap(); + + assert!(keymap.bindings(©_cmd).iter().any(|b| b.trigger.chord == chord)); + assert!(keymap.remove(©_cmd, &binding)); + assert_eq!(keymap.holder(&chord), None); + + keymap.assign(&bold_cmd, binding, Policy::Steal).unwrap(); + assert_eq!(keymap.holder(&chord).as_ref().map(|c| c.id.as_str()), Some("format.bold")); + assert_eq!(keymap.holder(&Chord::parse("Mod+Shift+C").unwrap()).as_ref().map(|c| c.id.as_str()), Some("edit.copyFormat")); + + let overrides = keymap.overrides().clone(); + let restored = crate::keymap::registry_keymap(®istry, &overrides); + assert_eq!(restored.holder(&chord).as_ref().map(|c| c.id.as_str()), Some("format.bold")); + assert_eq!(restored.holder(&Chord::parse("Mod+Shift+C").unwrap()).as_ref().map(|c| c.id.as_str()), Some("edit.copyFormat")); + } } diff --git a/crates/engine/src/cmd/equation.rs b/crates/engine/src/cmd/equation.rs index eabab36848..f47964c1cd 100644 --- a/crates/engine/src/cmd/equation.rs +++ b/crates/engine/src/cmd/equation.rs @@ -261,6 +261,11 @@ fn insert_nodes_as_equation(s: &mut Session, nodes: Arg, v: &Value) -> CmdResult /// Starts editing the equation at the caret, materializing lazy nodes and clamping the requested /// position, and returns the equation and caret. fn edit(s: &mut Session, v: &Value) -> CmdResult { + edit_at(s, v.get("pos").and_then(|p| serde_json::from_value::(p.clone()).ok())) +} + +/// [`edit`] at `pos` in the equation, or at its end without one. +pub(super) fn edit_at(s: &mut Session, pos: Option) -> CmdResult { let at = equation_at_caret(s).ok_or_else(|| CmdError::Disabled("no equation at the caret".into()))?; let nodes = match s.doc.para_at(&at).and_then(|p| p.object_at(at.off)) { Some(InlineObject::Equation { math, linear, .. }) => { @@ -272,8 +277,7 @@ fn edit(s: &mut Session, v: &Value) -> CmdResult { } _ => return Err(CmdError::Failed("no equation there".into())), }; - let pos = - v.get("pos").and_then(|p| serde_json::from_value::(p.clone()).ok()).unwrap_or_else(|| MathPos::new(Vec::new(), me::units(&nodes))); + let pos = pos.unwrap_or_else(|| MathPos::new(Vec::new(), me::units(&nodes))); let Some(session) = crate::next_math_session() else { return Err(CmdError::Failed("no equation editing session available".into())); }; diff --git a/crates/engine/src/cmd/equation/tests.rs b/crates/engine/src/cmd/equation/tests.rs index e3eb384087..fda8e84522 100644 --- a/crates/engine/src/cmd/equation/tests.rs +++ b/crates/engine/src/cmd/equation/tests.rs @@ -59,6 +59,74 @@ fn structures_symbols_and_navigation() { assert!(s.math.is_none()); } +#[test] +fn left_and_right_step_into_an_equation_next_to_the_caret() { + let mut s = session(); + s.run("document.setText", &json!({"text": "ab\ncd"})).unwrap(); + let p0 = s.doc.start_of(s.sel.focus.story); + let p1 = Pos { path: s.doc.next_para(p0.story, &p0.path).unwrap(), ..p0.clone() }; + // An equation between "a" and "b", and another one between "c" and "d". + for p in [&p0, &p1] { + s.run("caret.set", &json!({"pos": Pos { off: 1, ..p.clone() }})).unwrap(); + s.run("insert.equation", &json!({"linear": "x+y", "edit": false})).unwrap(); + } + let after = 1 + OBJ.len_utf8(); + let editing = |s: &Session| s.math.as_ref().map(|m| (m.at.path.clone(), m.at.off, m.pos.clone())); + + // Right from "a|" enters the equation at its start. + s.run("caret.set", &json!({"pos": Pos { off: 1, ..p0.clone() }})).unwrap(); + s.run("caret.right", &json!({})).unwrap(); + assert_eq!(editing(&s), Some((p0.path.clone(), 1, MathPos::default()))); + // Leaving it to the right, the next Right goes on to the text, not back in. + for _ in 0..10 { + if s.math.is_none() { + break; + } + s.run("equation.move", &json!({"dir": "right"})).unwrap(); + } + assert_eq!((s.math.is_none(), s.sel.focus.off), (true, after)); + s.run("caret.right", &json!({})).unwrap(); + assert_eq!((s.math.is_none(), s.sel.focus.off), (true, after + 1)); + + // Left from just after the equation in the second paragraph enters it at its end. + s.run("caret.set", &json!({"pos": Pos { off: after, ..p1.clone() }})).unwrap(); + s.run("caret.left", &json!({})).unwrap(); + let end = MathPos::new(Vec::new(), me::units(&nodes_of(&s, &Pos { off: 1, ..p1.clone() }).unwrap())); + assert_eq!(editing(&s), Some((p1.path.clone(), 1, end))); + for _ in 0..10 { + if s.math.is_none() { + break; + } + s.run("equation.move", &json!({"dir": "left"})).unwrap(); + } + assert_eq!((s.math.is_none(), s.sel.focus.off), (true, 1)); + s.run("caret.left", &json!({})).unwrap(); + assert_eq!((s.math.is_none(), s.sel.focus.off), (true, 0)); + + // Shift+Right selects over the equation, as before. + s.run("caret.set", &json!({"pos": Pos { off: 1, ..p0.clone() }})).unwrap(); + s.run("caret.right", &json!({"extend": true})).unwrap(); + assert_eq!((s.math.is_none(), s.sel.anchor.off, s.sel.focus.off), (true, 1, after)); + + // caret.left/right sent while editing (the arrow keys go to equation.move instead) leave + // the equation and move on, as before, rather than opening the equation they land next to. + s.run("caret.set", &json!({"pos": Pos { off: after, ..p0.clone() }})).unwrap(); + s.run("equation.edit", &json!({})).unwrap(); + s.run("caret.left", &json!({})).unwrap(); + assert_eq!((s.math.is_none(), s.sel.focus.off), (true, 1)); + // With two equations side by side, Right from the first goes on past the second. + s.run("caret.set", &json!({"pos": Pos { off: after, ..p1.clone() }})).unwrap(); + s.run("insert.equation", &json!({"linear": "z", "edit": false})).unwrap(); + s.run("caret.set", &json!({"pos": Pos { off: 1, ..p1.clone() }})).unwrap(); + s.run("equation.edit", &json!({})).unwrap(); + s.run("caret.right", &json!({})).unwrap(); + assert_eq!((s.math.is_none(), s.sel.focus.off), (true, after + OBJ.len_utf8())); + // That holds only for the command that left the equation: the next Right opens one again. + s.run("caret.set", &json!({"pos": Pos { off: 1, ..p0.clone() }})).unwrap(); + s.run("caret.right", &json!({})).unwrap(); + assert_eq!(editing(&s), Some((p0.path.clone(), 1, MathPos::default()))); +} + #[test] fn numbering_conversion_and_display() { let mut s = session(); @@ -635,3 +703,24 @@ fn a_math_name_is_corrected_by_any_character_that_cannot_continue_it() { s.run("equation.type", &json!({"text": r"\alpha+"})).unwrap(); assert_eq!(linear(&s), r"\alpha+"); } + +/// Paste Formatting keeps an open equation open (matching other formatting commands and +/// `cmd::column`), whereas content-pasting commands leave the equation first. +#[test] +fn paste_formatting_keeps_an_open_equation_open() { + let mut s = session(); + s.run("text.insert", &json!({"text": "source "})).unwrap(); + s.run("select.text", &json!({"text": "source"})).unwrap(); + s.run("format.bold", &json!({})).unwrap(); + s.run("edit.copyFormat", &json!({})).unwrap(); + s.run("caret.docEnd", &json!({})).unwrap(); + s.run("insert.equation", &json!({"linear": "x"})).unwrap(); + let before = s.math.clone(); + assert!(before.is_some()); + + s.run("edit.pasteFormat", &json!({})).unwrap(); + assert_eq!(s.math, before, "edit.pasteFormat keeps the open equation open"); + + s.run("edit.pasteText", &json!({"text": "y"})).unwrap(); + assert!(s.math.is_none(), "edit.pasteText closes the open equation"); +} diff --git a/crates/engine/src/cmd/fields.rs b/crates/engine/src/cmd/fields.rs index e5c4201183..41dbed4e2e 100644 --- a/crates/engine/src/cmd/fields.rs +++ b/crates/engine/src/cmd/fields.rs @@ -398,6 +398,28 @@ mod tests { assert!(!page_text(&mut s).contains("{ AUTHOR }")); } + /// #980: F11 is full screen, as people expect of a desktop app; the field walk keeps Word's + /// other keys, Alt+F1 and Alt+Shift+F1 (and Shift+F11). + #[test] + fn f11_is_full_screen_and_alt_f1_walks_fields() { + let s = Session::new(wordcraft_doc::Document::new()); + let keymap = crate::keymap::registry_keymap(&s.registry, s.keymap()); + let chord = |c: &str| craft_keymap::Chord::parse(c).unwrap(); + let key = |k: &str| keymap.holder(&chord(k)).map(|c| c.id); + assert_eq!(key("F11").as_deref(), Some("view.fullScreen")); + assert_eq!(key("Alt+F1").as_deref(), Some("fields.next")); + assert_eq!(key("Alt+Shift+F1").as_deref(), Some("fields.previous")); + assert_eq!(key("Shift+F11").as_deref(), Some("fields.previous")); + assert_eq!(key("Mod+F11").as_deref(), Some("fields.lock")); + let shortcut = s.registry.get("view.fullScreen").map(|c| c.shortcut); + if cfg!(target_os = "macos") { + assert_eq!(shortcut, Some("Mod+Ctrl+F / F11")); + assert_eq!(key("Mod+Ctrl+F").as_deref(), Some("view.fullScreen")); + } else { + assert_eq!(shortcut, Some("F11")); + } + } + /// Editing a code changes the instruction and the result; lock keeps a result through updates; /// unlink turns the field into its text in one undo step; Alt+F1/Shift+F11 walk the fields. #[test] diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index 35d5ceb180..8521558970 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -20,7 +20,7 @@ pub const MAX_AUTHOR_CHARS: usize = 255; /// carry an author. pub fn normalize_author(name: &str) -> Result { let name: String = name.trim().chars().filter(|c| !c.is_control()).take(MAX_AUTHOR_CHARS).collect(); - let name = name.trim_end(); + let name = name.trim(); if name.is_empty() { return Err(CmdError::Params("`name` must not be blank".into())); } @@ -94,9 +94,9 @@ pub fn specs() -> Vec { .pure(), CommandSpec::new("file.save", "Save", "File", save) .key("Mod+S / Shift+F12 / Alt+Shift+F2") - .params(r#"{"path"?: string, "password"?: string (encrypt this and later saves with it, as file.encrypt does), "markup"?: bool (Print Markup for a PDF, PNG, HTML, Markdown or text copy: comments shown; default file.printMarkup), "format"?: "wordml2003" (an .xml file as a Word 2003 XML Document) | "flatopc" (as a Word XML Document, the default; saving over a Word 2003 XML file keeps that format), "strict"?: bool (a .pdf or .png only: refuse, writing nothing, if a character can't be drawn or a picture is missing; see file.strictReport)}"#) + .params(r#"{"path"?: string (required with `copy`), "password"?: string (encrypt this and later saves with it, as file.encrypt does), "markup"?: bool (Print Markup for a PDF, PNG, HTML, Markdown or text copy: comments shown; default file.printMarkup), "format"?: "wordml2003" (an .xml file as a Word 2003 XML Document) | "flatopc" (as a Word XML Document, the default; saving over a Word 2003 XML file keeps that format), "strict"?: bool (a .pdf or .png only: refuse, writing nothing, if a character can't be drawn or a picture is missing; see file.strictReport), "copy"?: bool (write a copy at `path`, as File › Export does: the document keeps its own file, unsaved changes and save stamps; not with `password`)}"#) .pure(), - CommandSpec::new("file.saveAs", "Save As", "File", save_as).key(super::mac_or("F12 / Mod+Shift+S", "F12 / Alt+F2")).params(r#"{"path": string, "password"?: string, "markup"?: bool, "format"?: string (as file.save), "strict"?: bool (as file.save)}"#).pure(), + CommandSpec::new("file.saveAs", "Save As", "File", save_as).key(super::mac_or("F12 / Mod+Shift+S", "F12 / Alt+F2")).params(r#"{"path": string, "password"?: string, "markup"?: bool, "format"?: string (as file.save), "strict"?: bool (as file.save), "copy"?: bool (as file.save)}"#).pure(), // Pure: the password must not land in Repeat or a recorded macro, and it isn't an edit // to undo; it marks the document as changed itself. CommandSpec::new("file.encrypt", "Encrypt with Password", "File › Info › Protect Document", encrypt) @@ -145,7 +145,7 @@ pub fn specs() -> Vec { sel_result(s) }) .key("Mod+W / Mod+F4") - .params(r#"{"force"?: bool (desktop app's control channel and MCP bridge only: without it a document with unsaved changes is an error and stays open; with it the changes are discarded. Headless sessions never ask; file.closeDocument closes a document there)}"#) + .params(r#"{"save"?: bool (desktop app's control channel and MCP bridge only: save the shown document, then close it; it does not apply to a background `doc`, which needs force or its own save first), "force"?: bool (desktop app's control channel and MCP bridge only: without save or force a document with unsaved changes is an error and stays open; with force the changes are discarded. Headless sessions never ask; file.closeDocument closes a document there)}"#) .pure(), CommandSpec::new("file.closeDocument", "Close Document", "Agents", close_document) .params(r#"{"id"?: n (an open document, see view.switchWindows; default the active one), "force"?: bool (discard unsaved changes; without it a document with unsaved changes is an error and stays open)} → {"closed": id, "active": id, "documents": [{"id", "title", "path", "dirty", "active"}]}; closing the last document leaves a new blank one"#) @@ -342,6 +342,8 @@ pub(crate) fn new_from_template(s: &mut Session, v: &Value) -> CmdResult { let path = p::req_str(v, "path")?; let (mut doc, _) = read_document(s, path, v)?; doc.settings.attached_template = Some(path.to_string()); + // A new document: not created when the template was. Saving stamps its creation date. + doc.core.created.clear(); if p::bool(v, "replaceBlank") == Some(true) && s.used_because().is_none() { s.set_document(doc); } else { @@ -393,6 +395,14 @@ fn encrypt(s: &mut Session, v: &Value) -> CmdResult { /// Executes `file.save`: writes the document or text to disk, preserving exact file text for /// unedited Markdown files, and updating session path and dirty state. fn save(s: &mut Session, v: &Value) -> CmdResult { + // A copy (File › Export, #6131) is written and nothing else: the document keeps its own file, + // its unsaved changes and its save stamps, so the next Save still goes to the original. + // It never falls back to the document's own file or opens the Save As picker (whose answer is + // an ordinary save that adopts the file). + let as_copy = p::bool(v, "copy") == Some(true); + if as_copy && p::str(v, "path").is_none() { + return Err(CmdError::Params("`copy` needs a `path`: the copy has to go somewhere".into())); + } let path = match p::str(v, "path").map(std::path::PathBuf::from).or_else(|| s.path.clone()) { Some(p) => p, None => { @@ -401,6 +411,9 @@ fn save(s: &mut Session, v: &Value) -> CmdResult { } }; check_strict_output(p::bool(v, "strict").unwrap_or(false), &path.to_string_lossy())?; + if as_copy && v.get("password").is_some_and(|pw| !pw.is_null()) { + return Err(CmdError::Params("`password` changes the document's own saves, so it can't come with `copy` (use file.encrypt)".into())); + } if let Some(pw) = v.get("password").filter(|pw| !pw.is_null()) { let Some(pw) = pw.as_str().filter(|pw| !pw.is_empty()) else { return Err(CmdError::Params("`password` must be a non-empty string (file.encrypt removes a password)".into())); @@ -443,11 +456,14 @@ fn save(s: &mut Session, v: &Value) -> CmdResult { Some(text) => crate::io::save_text_path(&path, text), None => crate::io::save_path_with(&path, copy.as_ref().unwrap_or(&s.doc), password, &opts), }; - if let Err(e) = written { - (s.doc.settings.zoom, s.doc.core.last_modified_by, s.doc.core.created, s.doc.core.modified, s.doc.core.revision) = before_stamp; - return Err(CmdError::Failed(e)); - } let encrypted = password.is_some() && crate::io::can_encrypt(&path.to_string_lossy()); + if written.is_err() || as_copy { + (s.doc.settings.zoom, s.doc.core.last_modified_by, s.doc.core.created, s.doc.core.modified, s.doc.core.revision) = before_stamp; + } + written.map_err(CmdError::Failed)?; + if as_copy { + return Ok(json!({"saved": true, "path": path.to_string_lossy(), "encrypted": encrypted, "copy": true})); + } // A save in a format that doesn't keep everything (plain text, Markdown, a page image) is a // copy, except over the document's own file: a note.txt opened and saved is saved (#2376). // A Markdown file saved as another one loses nothing its own save wouldn't: it moves there. diff --git a/crates/engine/src/cmd/find_pattern.rs b/crates/engine/src/cmd/find_pattern.rs index 7ce4815cdc..856dc479b9 100644 --- a/crates/engine/src/cmd/find_pattern.rs +++ b/crates/engine/src/cmd/find_pattern.rs @@ -359,6 +359,20 @@ pub enum Piece { Named(String), /// `^c`: the clipboard. Clip, + /// A straight `"` or `'` typed as itself (not a regex, not with special characters off, which + /// takes the text as written, and not given by its code such as `^034`): curled with smart + /// quotes on, as typing curls it ([`Quotes`]). + Quote(char), +} + +/// How a quote typed in Replace with goes in (#7307). +#[derive(Clone, Copy, Debug)] +pub enum Quotes { + /// As typed. + Straight, + /// Curled by the typing rule ("straight quotes with smart quotes"): `before` is the character + /// in front of the match, `None` at a paragraph's start. + Smart { before: Option }, } /// Read Replace with text: `^` codes (unless `literal`), `\1`–`\9` with wildcards, and with a @@ -438,6 +452,11 @@ pub fn parse_replace(with: &str, o: &Opts) -> Vec { i += used; continue; } + if matches!(c, '"' | '\'') && !o.regex { + flush_literal(&mut cur, &mut out); + out.push(Piece::Quote(c)); + continue; + } cur.push(c); } flush_literal(&mut cur, &mut out); @@ -511,7 +530,8 @@ fn as_inserted(s: &str) -> String { } /// Fill in Replace with text for one match: `found` is the matched text, `group(n)` a group's. -pub fn expand(pieces: &[Piece], found: &str, group: &dyn Fn(usize) -> Option, clip: &str) -> String { +/// A typed quote is curled by what goes in before it: the replacement so far, else `before`. +pub fn expand(pieces: &[Piece], found: &str, group: &dyn Fn(usize) -> Option, clip: &str, quotes: Quotes) -> String { let mut out = String::new(); for p in pieces { match p { @@ -520,11 +540,39 @@ pub fn expand(pieces: &[Piece], found: &str, group: &dyn Fn(usize) -> Option out.push_str(&as_inserted(&group(*n).unwrap_or_default())), Piece::Clip => out.push_str(&clip.replace("\r\n", "\r").replace('\n', "\r")), Piece::Named(_) => {} + Piece::Quote(q) => { + let curly = match quotes { + Quotes::Smart { before } => super::text::smart_quote(out.chars().next_back().or(before), *q), + Quotes::Straight => None, + }; + match curly { + Some(c) => out.push_str(c), + None => out.push(*q), + } + } } } out } +/// Whether Replace with has a quote typed as itself, which smart quotes curl. +pub fn has_typed_quote(pieces: &[Piece]) -> bool { + pieces.iter().any(|p| matches!(p, Piece::Quote(_))) +} + +/// The match already reads as its replacement: the same text, with a curly quote of the same +/// kind (single or double) wherever the replacement has a curly one. Replace leaves such a match +/// alone and doesn't count it (#7307), so a typed `'` that also finds curly apostrophes keeps one +/// set the other way on purpose (’90s). +pub fn already_curled(found: &str, rep: &str) -> bool { + let kind = |c: char| match c { + '\u{2018}' | '\u{2019}' => Some('\''), + '\u{201C}' | '\u{201D}' => Some('"'), + _ => None, + }; + found.chars().count() == rep.chars().count() && found.chars().zip(rep.chars()).all(|(f, r)| f == r || (kind(f).is_some() && kind(f) == kind(r))) +} + #[cfg(test)] mod tests { use super::*; @@ -535,7 +583,45 @@ mod tests { } fn replaced(with: &str) -> String { - expand(&parse_replace(with, &Opts::default()), "", &|_| None, "") + expand(&parse_replace(with, &Opts::default()), "", &|_| None, "", Quotes::Straight) + } + + fn curled(with: &str, o: &Opts, before: Option) -> String { + expand(&parse_replace(with, o), "", &|_| None, "", Quotes::Smart { before }) + } + + #[test] + fn a_typed_quote_curls_by_what_goes_before_it_and_a_coded_one_stays_straight() { + let o = Opts::default(); + // Opening at a paragraph's start or after a space, closing after a letter. + assert_eq!(curled("\"", &o, None), "\u{201C}"); + assert_eq!(curled("\"", &o, Some(' ')), "\u{201C}"); + assert_eq!(curled("\"", &o, Some('d')), "\u{201D}"); + assert_eq!(curled("'", &o, Some('n')), "\u{2019}"); + // Inside the replacement, the text before it decides. + assert_eq!(curled("\"quoted\"", &o, Some(' ')), "\u{201C}quoted\u{201D}"); + assert_eq!(curled(" 'a'", &o, Some('x')), " \u{2018}a\u{2019}"); + assert_eq!(curled("^p\"", &o, Some('x')), "\r\u{201C}"); + // Given by its code, a quote stays straight; with smart quotes off, typed ones do too. + for code in ["^034", "^039", "^u34", "^0039"] { + let straight = if code.ends_with("34") { "\"" } else { "'" }; + assert_eq!(curled(code, &o, Some('x')), straight, "{code}"); + } + assert_eq!(replaced("\"a'"), "\"a'"); + // A regex replacement and an escaped wildcard one are taken as written. + assert_eq!(curled("\"", &Opts { regex: true, ..o }, None), "\""); + assert_eq!(curled("\\\"", &Opts { wildcards: true, ..o }, None), "\""); + assert_eq!(curled("\"", &Opts { wildcards: true, ..o }, None), "\u{201C}"); + } + + #[test] + fn a_match_already_curled_the_same_kind_reads_as_its_replacement() { + assert!(already_curled("\u{2019}", "\u{2018}")); + assert!(already_curled("don\u{2019}t", "don\u{2019}t")); + assert!(already_curled("\u{201C}", "\u{201D}")); + assert!(!already_curled("'", "\u{2019}"), "a straight quote is curled"); + assert!(!already_curled("\u{2019}", "\u{201D}"), "a single quote isn't a double one"); + assert!(!already_curled("dont", "don\u{2019}t")); } #[test] diff --git a/crates/engine/src/cmd/fmt_revisions.rs b/crates/engine/src/cmd/fmt_revisions.rs index 6da100825c..a8aa1bfd29 100644 --- a/crates/engine/src/cmd/fmt_revisions.rs +++ b/crates/engine/src/cmd/fmt_revisions.rs @@ -53,11 +53,11 @@ impl Recorder<'_> { if let Some(r) = self.rid { return r; } - let found = self.revisions.iter().rposition(|r| r.kind == RevisionKind::Format && r.author == self.author && r.date == self.date); + let found = self.revisions.iter().rposition(|r| r.kind == RevisionKind::Format && r.author == self.author && r.instant() == self.date); let r = match found { Some(i) => i as u32, None => { - self.revisions.push(Revision { kind: RevisionKind::Format, author: self.author.clone(), date: self.date.clone(), move_name: None }); + self.revisions.push(crate::cmd::made_revision(RevisionKind::Format, self.author.clone(), self.date.clone())); self.revisions.len().saturating_sub(1) as u32 } }; diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index cfccc3be40..17baf976a8 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -1,5 +1,7 @@ //! Character formatting (Home › Font). +use std::sync::{Arc, PoisonError}; + use serde_json::{Value, json}; use wordcraft_doc::eq::{EncloseShape, EncloseStyle, Enclosure}; use wordcraft_doc::props::{Border, CharProps, Highlight, Rgb, TextColor, Underline, VertAlign}; @@ -8,8 +10,44 @@ use wordcraft_doc::{InlineObject, PartKind, Pos, RevisionKind, StoryRef}; use super::sel_result; use super::tools::{is_turkic, lower_char, upper_char}; +use crate::doc_state::{ColumnBlock, Selection}; use crate::{CmdError, CmdResult, CommandSpec, Session, p}; +#[derive(Clone, PartialEq)] +struct StateKey { + document_id: u64, + rev: u64, + sel: Selection, + pending: Option, + pending_at: Option, + column: Option, + font_gen: u64, +} + +/// Cached result of [`cached_state`] and the session inputs it depends on. +pub(crate) struct StateCache { + key: StateKey, + value: Arc, +} + +impl StateCache { + pub(crate) fn rev(&self) -> u64 { + self.key.rev + } +} + +fn state_key(s: &Session) -> StateKey { + StateKey { + document_id: s.document_id(), + rev: s.rev(), + sel: s.sel.clone(), + pending: s.pending.clone(), + pending_at: s.pending_at.clone(), + column: s.column.clone(), + font_gen: wordcraft_fonts::FontDb::global().generation(), + } +} + /// Word's font size list. pub const SIZES: [f32; 17] = [8.0, 9.0, 10.0, 10.5, 11.0, 12.0, 14.0, 16.0, 18.0, 20.0, 22.0, 24.0, 26.0, 28.0, 36.0, 48.0, 72.0]; @@ -171,7 +209,8 @@ fn target(s: &Session) -> Option<(Pos, Pos)> { return Some((a, b)); } let p = s.doc.para_at(&a)?; - let is_w = |c: char| c.is_alphanumeric() || c == '\'' || c == '_'; + // Word takes a typographic apostrophe (’) like `'` here (#6517). + let is_w = |c: char| c.is_alphanumeric() || matches!(c, '\'' | '’' | '_'); let before = p.text.get(..a.off)?.chars().next_back(); let after = p.text.get(a.off..)?.chars().next(); if before.is_some_and(is_w) && after.is_some_and(is_w) { @@ -313,6 +352,19 @@ fn resolved(s: &Session) -> Vec { out } +/// Whether a toggle without a `value` turns its format on. A selection (including a selected +/// text box or a non-empty column block, whose `sel` is non-collapsed) follows its first +/// character in document order, as Word does: one that starts formatted loses the format, all of +/// it (#6516). A collapsed caret (including an empty column block) requires the whole word to +/// carry the format before toggling it off. +fn turns_on(s: &Session, has: impl Fn(&ResolvedChar) -> bool) -> bool { + let chars = resolved(s); + if !s.sel.is_collapsed() { + return !chars.first().is_some_and(has); + } + !chars.iter().all(has) +} + /// Bold as drawn: a run marked complex script (`w:cs`) or right to left (`w:rtl`) shows its /// complex-script bold. fn shown_bold(r: &ResolvedChar) -> bool { @@ -328,7 +380,7 @@ fn shown_italic(r: &ResolvedChar) -> bool { fn toggle(s: &mut Session, v: &Value, get: fn(&ResolvedChar) -> bool, set: fn(&mut CharProps, bool)) -> CmdResult { let on = match p::bool(v, "value") { Some(b) => b, - None => !resolved(s).iter().all(get), + None => turns_on(s, get), }; apply(s, &|c| set(c, on)) } @@ -338,7 +390,7 @@ fn underline(s: &mut Session, v: &Value) -> CmdResult { let on = match (p::bool(v, "value"), style) { (Some(b), _) => b, (None, Some(_)) => true, - (None, None) => !resolved(s).iter().all(|r| r.underline != Underline::None), + (None, None) => turns_on(s, |r| r.underline != Underline::None), }; let u = if on { style.unwrap_or(Underline::Single) } else { Underline::None }; apply(s, &|c| c.underline = Some(u)) @@ -375,6 +427,7 @@ fn font(s: &mut Session, v: &Value) -> CmdResult { } if let Some(n) = &ea { c.font_ea = Some(n.clone()); + c.font_ea_theme = None; } }) } @@ -879,8 +932,30 @@ fn set(s: &mut Session, v: &Value) -> CmdResult { apply(s, &|c| c.overlay(&props)) } +/// What the ribbon shows: the formatting at the selection (mixed values are null), cached per +/// document revision, selection, pending caret state, column selection, and font generation. +pub fn cached_state(s: &Session) -> Arc { + let key = state_key(s); + { + let cache = s.format_state.lock().unwrap_or_else(PoisonError::into_inner); + if let Some(cached) = cache.as_ref() + && cached.key == key + { + return Arc::clone(&cached.value); + } + } + let value = Arc::new(compute_state(s)); + let mut cache = s.format_state.lock().unwrap_or_else(PoisonError::into_inner); + *cache = Some(StateCache { key, value: Arc::clone(&value) }); + value +} + /// What the ribbon shows: the formatting at the selection (mixed values are null). pub fn state(s: &Session) -> Value { + (*cached_state(s)).clone() +} + +fn compute_state(s: &Session) -> Value { let all = resolved(s); let first = all.first().cloned(); let same = |f: &dyn Fn(&ResolvedChar) -> Value| -> Value { @@ -906,6 +981,7 @@ pub fn state(s: &Session) -> Value { "italic": all.iter().all(shown_italic), "underline": all.iter().all(|r| r.underline != Underline::None), "underlineColor": same(&|r| json!(r.underline_color.map_or_else(|| "auto".to_string(), |c| c.hex()))), + "shading": same(&|r| json!(r.shading.map(|c| c.hex()))), "strike": all.iter().all(|r| r.strike), "border": all.iter().all(|r| r.border.is_some()), "subscript": all.iter().all(|r| r.vert_align == VertAlign::Subscript), @@ -927,6 +1003,14 @@ pub fn state(s: &Session) -> Value { }) } +/// The selection's uniform highlight colour (`Some(None)` when uniformly unhighlighted), or `None` +/// when the selection is mixed or empty. +pub fn uniform_highlight(s: &Session) -> Option> { + let all = resolved(s); + let first = all.first()?.highlight; + all.iter().all(|r| r.highlight == first).then_some(first) +} + /// What Enclose Characters works on: the selected text (one full-width or up to two half-width /// characters), or enclosed characters already there (selected, or beside the caret). #[derive(Clone, Debug, PartialEq)] @@ -1054,4 +1138,30 @@ mod tests { assert_eq!(convert("one 3.14 apples and two 2.5 pears.", "sentence", true), "One 3.14 apples and two 2.5 pears."); assert_eq!(convert("pi is 3.14. next sentence.", "sentence", true), "Pi is 3.14. Next sentence."); } + + #[test] + fn cached_state_hits_until_selection_format_or_pending_changes() { + use serde_json::json; + use std::sync::Arc; + + let mut s = crate::Session::new(wordcraft_doc::Document::new()); + let a = super::cached_state(&s); + let b = super::cached_state(&s); + assert!(Arc::ptr_eq(&a, &b), "unchanged session should reuse cached format state Arc"); + + s.run("text.insert", &json!({"text": "hello world"})).unwrap(); + let c = super::cached_state(&s); + assert!(!Arc::ptr_eq(&b, &c), "text edit bumps rev and invalidates cache"); + + s.run("format.bold", &json!({})).unwrap(); + let d = super::cached_state(&s); + assert!(!Arc::ptr_eq(&c, &d), "pending bold changes caret formatting"); + assert_eq!(d["bold"], json!(true)); + assert!(Arc::ptr_eq(&d, &super::cached_state(&s))); + + s.run("select.text", &json!({"text": "hello"})).unwrap(); + let e = super::cached_state(&s); + assert!(!Arc::ptr_eq(&d, &e), "selection change updates format state"); + assert_eq!(e["bold"], json!(false)); + } } diff --git a/crates/engine/src/cmd/index.rs b/crates/engine/src/cmd/index.rs index 17b62cbbe1..9864fab8ba 100644 --- a/crates/engine/src/cmd/index.rs +++ b/crates/engine/src/cmd/index.rs @@ -27,6 +27,7 @@ pub fn specs() -> Vec { r#"{"type"?: "indented|runIn", "columns"?: 1-4, "rightAlign"?: bool, "tabLeader"?: "dot|hyphen|underscore|none", "headings"?: bool (letter headings)} (replaces an existing index's settings)"#, ), CommandSpec::new("references.updateIndex", "Update Index", "References › Index", |s, _| { + check_index_reachable(s)?; super::citations::update_generated(s)?; sel_result(s) }), @@ -135,8 +136,67 @@ fn index_field(s: &Session) -> Option<(usize, String)> { }) } +/// Whether an INDEX field (a plain one or a range field, as Word files hold it) sits in the main +/// text's own paragraphs (`main`), or anywhere else a reader sees: a table cell, a text box, a +/// header or a footer in use. Stored headers and footers no page shows (a first-page header +/// while Different First Page is off) don't count. Only an index in the main text is rebuilt. +fn has_index(s: &Session, main: bool) -> bool { + s.doc.shown_stories().into_iter().any(|story| { + s.doc + .para_paths(story) + .iter() + .filter(|path| (story == StoryRef::Body && path.depth() == 0) == main) + .filter_map(|path| s.doc.para(story, path)) + .any(|p| { + p.objects.iter().any(|o| { + matches!(o, InlineObject::Field { instr, .. } | InlineObject::FieldStart { instr, .. } if FieldCode::parse(instr).name == "INDEX") + }) + }) + }) +} + +/// Refuses Insert and Update Index when the document has an index they can't rebuild, even beside +/// one in the main text, rather than adding a second index or reporting an update that left it +/// unchanged. +fn check_index_reachable(s: &Session) -> Result<(), CmdError> { + if has_index(s, false) { + return Err(CmdError::Failed( + "the index is in a table, text box, header or footer, where it can't be updated; move it into the main text, then use Update Index" + .into(), + )); + } + // A range-field index after text in its paragraph is not rebuilt either: Update Index only + // takes one that starts its paragraph. + if range_index_after_text(s) { + return Err(CmdError::Failed( + "the index follows text in its paragraph, where it can't be updated; put it at the start of its own paragraph in the main text".into(), + )); + } + Ok(()) +} + +/// Whether a main-text range-field INDEX has text before it in its paragraph. +fn range_index_after_text(s: &Session) -> bool { + s.doc.body.iter().filter_map(|b| b.as_para()).any(|p| { + p.objects_with_offsets().any(|(off, o)| { + matches!(o, InlineObject::FieldStart { instr, .. } if FieldCode::parse(instr).name == "INDEX") + && !p.text.get(..off).is_some_and(|t| t.chars().all(|c| c.is_whitespace() || c == wordcraft_doc::para::OBJ)) + }) + }) +} + fn insert_index(s: &mut Session, v: &Value) -> CmdResult { let instr = index_instr(v); + check_index_reachable(s)?; + // An index Word wrote as a range field is first made a plain field in its own paragraph, as + // Update Index makes it, so it takes the new settings rather than a second index being added + // beside it (#8034). + if index_field(s).is_none() && has_index(s, true) { + super::citations::update_generated(s)?; + if index_field(s).is_none() { + return Err(CmdError::Failed("the document already has an index; use Update Index to rebuild it".into())); + } + } match index_field(s) { Some((i, _)) => { // Settings for the index that is there: a new field code, then rebuild it. @@ -484,4 +544,157 @@ mod tests { let (i, _) = index_field(&s).unwrap(); assert_eq!(s.doc.body[i + 2].as_para().unwrap().props.tabs.as_ref().unwrap()[0].leader, TabLeader::Hyphen); } + + /// #3670: an index in a table cell or a text box (as imported documents have it) can't be + /// rebuilt where it is, so Insert and Update Index say so, and Insert Index doesn't add a + /// second index at the caret. + #[test] + fn an_index_outside_the_main_text_is_refused_not_doubled() { + let indexes = |s: &Session| { + std::iter::once(StoryRef::Body) + .chain(s.doc.parts.keys().map(|k| StoryRef::Part(*k))) + .flat_map(|story| s.doc.para_paths(story).into_iter().filter_map(move |path| s.doc.para(story, &path).cloned())) + .flat_map(|p| p.objects) + .filter(|o| matches!(o, InlineObject::Field { instr, .. } | InlineObject::FieldStart { instr, .. } if FieldCode::parse(instr).name == "INDEX")) + .count() + }; + for in_box in [false, true] { + let mut s = Session::new(wordcraft_doc::Document::from_text( + "Kilns are hot. +End.", + )); + s.run("select.text", &json!({"text": "Kilns"})).unwrap(); + s.run("references.markEntry", &json!({})).unwrap(); + s.run("caret.docEnd", &json!({})).unwrap(); + let at = if in_box { + s.run("insert.textBox", &json!({"text": "Box"})).unwrap(); + let id = s.doc.parts.iter().find(|(_, p)| p.kind == wordcraft_doc::PartKind::TextBox).map(|(id, _)| *id).unwrap(); + Pos { story: StoryRef::Part(id), path: Path::top(0), off: 0 } + } else { + s.run("insert.table", &json!({"rows": 1, "cols": 1})).unwrap(); + let cell = s.doc.para_paths(StoryRef::Body).into_iter().find(|path| path.depth() > 0).unwrap(); + Pos { story: StoryRef::Body, path: cell, off: 0 } + }; + // A range field, as a Word file holds its index. + let p = s.doc.para_mut(at.story, &at.path).unwrap(); + p.insert_object(0, InlineObject::FieldEnd, &CharProps::default()).unwrap(); + p.insert_object(0, InlineObject::FieldStart { instr: r#"INDEX \h "A""#.into(), locked: false, dirty: false }, &CharProps::default()) + .unwrap(); + s.run("caret.docEnd", &json!({})).unwrap(); + let r = s.run("references.index", &json!({"columns": 2})); + assert!(r.is_err(), "Insert Index with the index in a {}: {r:?}", if in_box { "text box" } else { "table" }); + assert_eq!(indexes(&s), 1, "INDEX fields after Insert Index"); + assert!(s.run("references.updateIndex", &json!({})).is_err(), "Update Index reports the index it can't rebuild"); + } + } + + /// #3670: an index in a table is refused even when the main text also has one, so the update + /// can't report success and leave the table's index as it was. + #[test] + fn an_index_in_a_table_is_refused_beside_one_in_the_main_text() { + let mut s = Session::new(wordcraft_doc::Document::from_text("Kilns are hot.")); + s.run("select.text", &json!({"text": "Kilns"})).unwrap(); + s.run("references.markEntry", &json!({})).unwrap(); + s.run("caret.docEnd", &json!({})).unwrap(); + s.run("references.index", &json!({})).unwrap(); + s.run("insert.table", &json!({"rows": 1, "cols": 1})).unwrap(); + let cell = s.doc.para_paths(StoryRef::Body).into_iter().find(|path| path.depth() > 0).unwrap(); + let p = s.doc.para_mut(StoryRef::Body, &cell).unwrap(); + p.insert_object(0, InlineObject::FieldEnd, &CharProps::default()).unwrap(); + p.insert_object(0, InlineObject::FieldStart { instr: r#"INDEX \h "A""#.into(), locked: false, dirty: false }, &CharProps::default()).unwrap(); + assert!(s.run("references.index", &json!({"columns": 2})).is_err()); + assert!(s.run("references.updateIndex", &json!({})).is_err()); + } + + /// #3670: only the headers a page shows count. An INDEX in a first-page header is out of + /// reach while Different First Page is on, and doesn't block Insert Index while it is off. + #[test] + fn an_index_in_a_header_blocks_insert_only_while_the_header_is_shown() { + let with_header_index = |first: bool, title_page: bool| { + let mut d = wordcraft_doc::Document::from_text("Kilns are hot."); + let mut p = wordcraft_doc::Paragraph::new(); + p.insert_object(0, InlineObject::FieldEnd, &CharProps::default()).unwrap(); + p.insert_object(0, InlineObject::FieldStart { instr: r#"INDEX \h "A""#.into(), locked: false, dirty: false }, &CharProps::default()) + .unwrap(); + let id = d.add_part(wordcraft_doc::PartKind::Header, vec![std::sync::Arc::new(wordcraft_doc::Block::Para(p))]); + if first { + d.last_section.headers.first = Some(id); + } else { + d.last_section.headers.default = Some(id); + } + d.last_section.title_page = title_page; + let mut s = Session::new(d); + s.run("select.text", &json!({"text": "Kilns"})).unwrap(); + s.run("references.markEntry", &json!({})).unwrap(); + s.run("caret.docEnd", &json!({})).unwrap(); + s + }; + let body_has_index = |s: &Session| index_field(s).is_some(); + // Linked (default) header: shown, so Insert Index is refused. + let mut s = with_header_index(false, false); + assert!(s.run("references.index", &json!({})).is_err()); + assert!(!body_has_index(&s)); + // First-page header with Different First Page off: hidden, so the body gets its index. + let mut s = with_header_index(true, false); + s.run("references.index", &json!({})).unwrap(); + assert!(body_has_index(&s)); + // The same header with Different First Page on is shown again. + let mut s = with_header_index(true, true); + assert!(s.run("references.index", &json!({})).is_err()); + assert!(!body_has_index(&s)); + } + + /// An index Word wrote as a range field in the main text takes Insert Index's settings and is + /// rebuilt, rather than a second index being added at the caret (#8034). + #[test] + fn insert_index_gives_a_range_field_index_in_the_main_text_its_settings() { + let mut s = Session::new(wordcraft_doc::Document::from_text("Kilns are hot.")); + s.run("select.text", &json!({"text": "Kilns"})).unwrap(); + s.run("references.markEntry", &json!({})).unwrap(); + s.run("caret.docEnd", &json!({})).unwrap(); + let at = s.doc.body.len(); + let mut para = wordcraft_doc::para::Paragraph::new(); + para.insert_object(0, InlineObject::FieldEnd, &CharProps::default()).unwrap(); + para.insert_object(0, InlineObject::FieldStart { instr: r#"INDEX \h "A""#.into(), locked: false, dirty: false }, &CharProps::default()) + .unwrap(); + s.doc.insert_block(StoryRef::Body, &Path::top(at), wordcraft_doc::Block::Para(para)).unwrap(); + s.run("caret.docEnd", &json!({})).unwrap(); + s.run("references.index", &json!({"columns": 2})).unwrap(); + let instrs: Vec = s + .doc + .body + .iter() + .filter_map(|b| b.as_para()) + .flat_map(|p| p.objects.iter()) + .filter_map(|o| match o { + InlineObject::Field { instr, .. } | InlineObject::FieldStart { instr, .. } if FieldCode::parse(instr).name == "INDEX" => { + Some(instr.clone()) + } + _ => None, + }) + .collect(); + assert_eq!(instrs.len(), 1, "one index, not a second beside it: {instrs:?}"); + assert!(FieldCode::parse(&instrs[0]).arg('c').is_some(), "the index took the new columns setting: {instrs:?}"); + let text: String = + s.doc.body.iter().filter_map(|b| b.as_para()).map(|p| p.text.replace(wordcraft_doc::para::OBJ, "")).collect::>().join( + " +", + ); + assert!(text.contains("Kilns are hot."), "the text before the index survives: {text:?}"); + assert!(text.contains("Kilns, 1"), "Update Index generated an entry: {text:?}"); + } + + #[test] + fn a_range_field_index_after_text_is_refused_not_reported_updated() { + let mut s = Session::new(wordcraft_doc::Document::from_text("Kilns are hot.")); + s.run("select.text", &json!({"text": "Kilns"})).unwrap(); + s.run("references.markEntry", &json!({})).unwrap(); + let p = s.doc.para_mut(StoryRef::Body, &Path::top(0)).unwrap(); + let end = p.len(); + p.insert_object(end, InlineObject::FieldEnd, &CharProps::default()).unwrap(); + p.insert_object(end, InlineObject::FieldStart { instr: r#"INDEX \h "A""#.into(), locked: false, dirty: false }, &CharProps::default()) + .unwrap(); + assert!(s.run("references.updateIndex", &json!({})).is_err()); + assert!(s.run("references.index", &json!({})).is_err()); + } } diff --git a/crates/engine/src/cmd/insert.rs b/crates/engine/src/cmd/insert.rs index c80082c82d..10a626979c 100644 --- a/crates/engine/src/cmd/insert.rs +++ b/crates/engine/src/cmd/insert.rs @@ -16,12 +16,13 @@ mod objects; pub(crate) use header_footer::saved_copy; use header_footer::{create_hf, edit_hf, header_footer, new_empty_headers, strip_headers}; pub use items::{ - DropCapState, default_date_picture, drop_cap_state, format_date, format_date_at, format_date_in, format_date_parts, format_date_parts_in, + DropCapState, default_date_picture, drop_cap_state, format_date, format_date_at, format_date_at_in, format_date_in, format_date_parts, + format_date_parts_in, }; use items::{cover_page, date_time, drop_cap, drop_cap_off, field, page_number, symbol}; use links::{bookmark, delete_bookmark, link, link_targets}; -pub use links::{bookmark_name_ok, bookmark_range, bookmark_span}; -pub use objects::{base64_decode, base64_encode}; +pub use links::{bookmark_name_ok, bookmark_range, bookmark_span, selection_is_one_line}; +pub use objects::{MAX_TABLE_ROWS, base64_decode, base64_encode}; use objects::{icon, shape, table, text_box}; pub(crate) use objects::{image_ext, picture}; diff --git a/crates/engine/src/cmd/insert/header_footer.rs b/crates/engine/src/cmd/insert/header_footer.rs index 2bdbeb5ce7..65dc23b84c 100644 --- a/crates/engine/src/cmd/insert/header_footer.rs +++ b/crates/engine/src/cmd/insert/header_footer.rs @@ -7,7 +7,7 @@ use super::{ /// even page or the default), made when there is none: with Different First Page on, a header /// inserted on page 1 is the one page 1 shows (#2826). pub(super) fn hf_part(s: &mut Session, header: bool) -> u32 { - let block = s.sel.focus.path.0.first().copied().unwrap_or(0) as usize; + let block = crate::cmd::page::section_end_of_focus(s); let layout = s.layout(); let page = if s.sel.focus.story == StoryRef::Body { layout.page_of(&s.sel.focus) } else { Some(s.page_hint) }; let slot = page.and_then(|pg| layout.pages.get(pg)).map(|pg| pg.hf_slot).unwrap_or_default(); @@ -98,15 +98,12 @@ pub(super) fn edit_hf(s: &mut Session, v: &Value, header: bool) -> CmdResult { let shown = match page { Some(page) => shown_hf(s, page, header)?, None => { - let block = s.sel.focus.path.0.first().copied().unwrap_or(0) as usize; - let set = s - .doc - .sections() - .into_iter() - .find(|(end, _)| block <= *end) - .or_else(|| s.doc.sections().pop()) - .map(|(_, sp)| if header { sp.headers.default } else { sp.footers.default }); - set.flatten().filter(|id| s.doc.parts.contains_key(id)) + // The caret's section's own, else the one it is linked to from a section before it, as + // layout shows it (#3639): editing that one keeps the link. + let section = crate::cmd::page::hf_section_of_focus(s); + let sections = s.doc.sections(); + let set = sections.iter().take(section + 1).rev().find_map(|(_, sp)| if header { sp.headers.default } else { sp.footers.default }); + set.filter(|id| s.doc.parts.contains_key(id)) } }; let Some(id) = shown else { diff --git a/crates/engine/src/cmd/insert/items.rs b/crates/engine/src/cmd/insert/items.rs index 5343437592..1a89580dcf 100644 --- a/crates/engine/src/cmd/insert/items.rs +++ b/crates/engine/src/cmd/insert/items.rs @@ -205,21 +205,26 @@ pub fn format_date_at_in(fmt: &str, lang: Option<&str>, unix: u64, offset_secs: format_date_parts_in(fmt, lang, y, m as usize, d, hms, days) } -/// Month and weekday names of a language, as Word writes them in date fields: full names, the -/// three-letter forms (`MMM`, `ddd`) being their first three letters, without a full stop. -/// Weekdays start on Thursday (1970-01-01). +/// Month and weekday names of a language, as Word writes them in date fields: full names and the +/// abbreviations used by `MMM` and `ddd`. Weekdays start on Thursday (1970-01-01). struct DateNames { /// Full month names (January through December). months: [&'static str; 12], + /// Abbreviated month names for `MMM` (January through December). + months_short: [&'static str; 12], /// Weekday names starting on Thursday (1970-01-01). days: [&'static str; 7], + /// Abbreviated weekday names for `ddd`, starting on Thursday (1970-01-01). + days_short: [&'static str; 7], /// The picture of a `DATE` field without `\@`. default: &'static str, } const ENGLISH: DateNames = DateNames { months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + months_short: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], days: ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"], + days_short: ["Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed"], default: "M/d/yyyy", }; @@ -227,14 +232,46 @@ const ENGLISH: DateNames = DateNames { /// `ddd` = `qui`, and `dd/MM/yyyy` for a field without a picture. const PORTUGUESE: DateNames = DateNames { months: ["janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"], + months_short: ["jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez"], days: ["quinta-feira", "sexta-feira", "sábado", "domingo", "segunda-feira", "terça-feira", "quarta-feira"], + days_short: ["qui", "sex", "sáb", "dom", "seg", "ter", "qua"], default: "dd/MM/yyyy", }; -/// Choose month and weekday names according to the primary language subtag. +/// German (Word's Windows NLS forms): `MMMM` = `März`, `MMM` = `Mrz`, `ddd` = `Fr` (two +/// letters), and `dd.MM.yyyy` for a field without a picture. Covers de-DE, de-CH and bare `de`. +const GERMAN: DateNames = DateNames { + months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], + months_short: ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], + days: ["Donnerstag", "Freitag", "Samstag", "Sonntag", "Montag", "Dienstag", "Mittwoch"], + days_short: ["Do", "Fr", "Sa", "So", "Mo", "Di", "Mi"], + default: "dd.MM.yyyy", +}; + +/// Austrian Standard German: January is `Jänner`, abbreviated `Jän` (Österreichisches +/// Wörterbuch; Windows NLS `de-AT`). Every other month and weekday matches [`GERMAN`]. +const GERMAN_AUSTRIA: DateNames = DateNames { + months: ["Jänner", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], + months_short: ["Jän", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], + days: ["Donnerstag", "Freitag", "Samstag", "Sonntag", "Montag", "Dienstag", "Mittwoch"], + days_short: ["Do", "Fr", "Sa", "So", "Mo", "Di", "Mi"], + default: "dd.MM.yyyy", +}; + +/// Choose month and weekday names from the language tag: the primary subtag picks the language, +/// and a region subtag refines it (`de-AT` writes `Jänner`). Tags compare case-insensitively, as +/// `w:lang` values do. fn date_names(lang: Option<&str>) -> &'static DateNames { - let primary = lang.and_then(|l| l.trim().split(['-', '_']).next()).unwrap_or(""); - if primary.eq_ignore_ascii_case("pt") { &PORTUGUESE } else { &ENGLISH } + let mut subtags = lang.unwrap_or("").trim().split(['-', '_']); + let primary = subtags.next().unwrap_or(""); + if primary.eq_ignore_ascii_case("pt") { + &PORTUGUESE + } else if primary.eq_ignore_ascii_case("de") { + // Austria keeps `Jänner` / `Jän`; Germany and Switzerland keep `Januar` / `Jan`. + if subtags.any(|region| region.eq_ignore_ascii_case("AT")) { &GERMAN_AUSTRIA } else { &GERMAN } + } else { + &ENGLISH + } } /// The picture Word gives a `DATE` field that has no `\@` switch, in the field's language. @@ -252,9 +289,12 @@ pub fn format_date_parts(fmt: &str, y: i64, m: usize, d: u32, hms: (u32, u32, u3 #[allow(clippy::too_many_arguments)] pub fn format_date_parts_in(fmt: &str, lang: Option<&str>, y: i64, m: usize, d: u32, (hh, mm, ss): (u32, u32, u32), days_since: i64) -> String { let names = date_names(lang); - let month = names.months.get(m.saturating_sub(1)).copied().unwrap_or(names.months[0]); - let day = names.days.get(days_since.rem_euclid(7) as usize).copied().unwrap_or(names.days[0]); - let three = |s: &str| -> String { s.chars().take(3).collect() }; + let mi = m.saturating_sub(1); + let di = days_since.rem_euclid(7) as usize; + let month = names.months.get(mi).copied().unwrap_or(names.months[0]); + let month_short = names.months_short.get(mi).copied().unwrap_or(names.months_short[0]); + let day = names.days.get(di).copied().unwrap_or(names.days[0]); + let day_short = names.days_short.get(di).copied().unwrap_or(names.days_short[0]); let mut out = String::new(); let chars: Vec = fmt.chars().collect(); let mut i = 0; @@ -296,11 +336,11 @@ pub fn format_date_parts_in(fmt: &str, lang: Option<&str>, y: i64, m: usize, d: ('y' | 'Y', 4..) => out.push_str(&format!("{y:04}")), ('y' | 'Y', _) => out.push_str(&format!("{:02}", y % 100)), ('M', 4..) => out.push_str(month), - ('M', 3) => out.push_str(&three(month)), + ('M', 3) => out.push_str(month_short), ('M', 2) => out.push_str(&format!("{m:02}")), ('M', 1) => out.push_str(&m.to_string()), ('d' | 'D', 4..) => out.push_str(day), - ('d' | 'D', 3) => out.push_str(&three(day)), + ('d' | 'D', 3) => out.push_str(day_short), ('d' | 'D', 2) => out.push_str(&format!("{d:02}")), ('d' | 'D', 1) => out.push_str(&d.to_string()), ('H', 2..) => out.push_str(&format!("{hh:02}")), @@ -311,7 +351,7 @@ pub fn format_date_parts_in(fmt: &str, lang: Option<&str>, y: i64, m: usize, d: ('m', _) => out.push_str(&mm.to_string()), ('s', 2..) => out.push_str(&format!("{ss:02}")), ('s', _) => out.push_str(&ss.to_string()), - ('a' | 'A', _) => out.push_str(if hh < 12 { "AM" } else { "PM" }), + // Bare `a`/`A` is literal; AM/PM is the `am/pm` token (#3488). _ => { for _ in 0..n { out.push(c); @@ -574,6 +614,43 @@ mod date_time_locale_tests { assert_eq!(format("MMMM", 20), "outubro"); } + /// German month and weekday names, and the default picture, are chosen by the language tag + /// (de-DE, de-AT, de-CH), as in Word (#7146). + #[test] + fn german_date_names_render_for_de() { + assert_eq!(format_date_parts_in("dddd, d. MMMM yyyy", Some("de-DE"), 2026, 11, 21, (12, 0, 0), 2), "Samstag, 21. November 2026"); + assert_eq!(default_date_picture(Some("de-CH")), "dd.MM.yyyy"); + } + + /// Windows NLS short forms: two-letter weekdays (`Mo`, `Di`…) and `Mrz` for March, with no + /// trailing full stop (#7146). + #[test] + fn german_short_names_match_windows_nls() { + let format = |pic| format_date_parts_in(pic, Some("de-DE"), 2026, 3, 15, (12, 0, 0), 3); + assert_eq!(format("ddd, d. MMM yyyy"), "So, 15. Mrz 2026"); + assert_eq!(format("dddd"), "Sonntag"); + assert_eq!(format("MMM"), "Mrz"); + } + + /// Austrian Standard German writes January as `Jänner` (`Jän`), while Germany, Switzerland + /// and bare `de` keep `Januar` (`Jan`); every other name is shared (#7146). + #[test] + fn austrian_german_january_is_jaenner() { + let january = |lang, pic| format_date_parts_in(pic, Some(lang), 2026, 1, 15, (12, 0, 0), 0); + assert_eq!(january("de-AT", "MMMM"), "Jänner"); + assert_eq!(january("de-AT", "MMM"), "Jän"); + assert_eq!(january("de_at", "MMMM"), "Jänner", "region subtags compare case-insensitively"); + for lang in ["de-DE", "de-CH", "de"] { + assert_eq!(january(lang, "MMMM"), "Januar", "{lang}"); + assert_eq!(january(lang, "MMM"), "Jan", "{lang}"); + } + // Only January differs: February and March read the same in Austria and Germany. + for month in [2, 3] { + let names = |lang| format_date_parts_in("MMMM MMM", Some(lang), 2026, month, 1, (12, 0, 0), 0); + assert_eq!(names("de-AT"), names("de-DE")); + } + } + /// A pt-BR dynamic field keeps its result after DOCX round-trip and refresh. #[test] fn pt_br_date_time_dialog_inserts_dynamic_field() { diff --git a/crates/engine/src/cmd/insert/links.rs b/crates/engine/src/cmd/insert/links.rs index f383365134..ea97903fd7 100644 --- a/crates/engine/src/cmd/insert/links.rs +++ b/crates/engine/src/cmd/insert/links.rs @@ -84,25 +84,45 @@ pub(super) fn link(s: &mut Session, v: &Value) -> CmdResult { sel_result(s) } -/// The `text` to retype a selection with before linking it: only when it differs from the selected -/// text and both fit in one line of one paragraph without pictures or fields, outside any field's -/// result. Otherwise (as Word shows `<>`) the selection keeps its text. -fn retyped_text(s: &Session, v: &Value) -> Option { +/// What can't stand in one line of text: breaks, and pictures or fields. +const NOT_ONE_LINE: [char; 7] = { use wordcraft_doc::para::{COLUMN_BREAK, LINE_BREAK, OBJ, PAGE_BREAK}; - /// What can't stand in one line of text: breaks, and pictures or fields. - const NOT_ONE_LINE: [char; 7] = [LINE_BREAK, '\r', '\u{2029}', '\u{b}', PAGE_BREAK, COLUMN_BREAK, OBJ]; - let text = p::str(v, "text").filter(|t| !t.is_empty() && t.len() <= 4096)?; - if text.contains(NOT_ONE_LINE) { + [LINE_BREAK, '\r', '\u{2029}', '\u{b}', PAGE_BREAK, COLUMN_BREAK, OBJ] +}; + +/// The raw text of the selection when it is one run of one paragraph without breaks, pictures or fields. +fn one_line_selection(s: &Session) -> Option<&str> { + // A column (block) selection has both ends in one paragraph but holds a piece of each line it + // covers: it isn't one line of text (#8581). + if s.column_segments().is_some_and(|segs| !segs.is_empty()) { return None; } let (a, b) = s.sel.ordered(); if a.story != b.story || a.path != b.path { return None; } - let shown = s.doc.para(a.story, &a.path)?.text.get(a.off..b.off)?; - if shown.contains(NOT_ONE_LINE) || shown == text { + s.doc.para(a.story, &a.path)?.text.get(a.off..b.off).filter(|t| !t.contains(NOT_ONE_LINE)) +} + +/// Whether the selection is plain text in one line of one paragraph: otherwise (as Word shows +/// `<>`) Text to display can't show it and linking keeps its content (#8286). +pub fn selection_is_one_line(s: &Session) -> bool { + one_line_selection(s).is_some() +} + +/// The `text` to retype a selection with before linking it: only when it differs from the selected +/// text and both fit in one line of one paragraph without pictures or fields, outside any field's +/// result. Otherwise (as Word shows `<>`) the selection keeps its text. +fn retyped_text(s: &Session, v: &Value) -> Option { + let text = p::str(v, "text").filter(|t| !t.is_empty() && t.len() <= 4096)?; + if text.contains(NOT_ONE_LINE) { return None; } + let shown = one_line_selection(s)?; + if shown == text { + return None; + } + let (a, b) = s.sel.ordered(); // A selection in a field's result (between its markers, which it doesn't hold) is retyped by // the next update of the field, not here. if s.doc.field_ranges(a.story).iter().any(|r| r.start < b && a <= r.end) { diff --git a/crates/engine/src/cmd/insert/objects.rs b/crates/engine/src/cmd/insert/objects.rs index 1b59440028..09b24f6fea 100644 --- a/crates/engine/src/cmd/insert/objects.rs +++ b/crates/engine/src/cmd/insert/objects.rs @@ -23,8 +23,13 @@ fn insert_block_at_caret(s: &mut Session, block: Block) -> Result CmdResult { - let rows = p::u64(v, "rows").unwrap_or(2).clamp(1, 1000) as usize; + let rows = p::u64(v, "rows").unwrap_or(2).clamp(1, MAX_TABLE_ROWS as u64) as usize; let cols = p::u64(v, "cols").unwrap_or(2).clamp(1, 63) as usize; let width = s.doc.sections().first().map(|(_, sp)| sp.text_width()).unwrap_or(468.0); let mut t = Table::new(rows, cols, width); @@ -37,6 +42,7 @@ pub(super) fn table(s: &mut Session, v: &Value) -> CmdResult { if s.doc.para_at(&s.sel.focus).is_some_and(|p| s.doc.styles.resolve_para(&p.props).bidi) { t.props.bidi_visual = true; } + cells_in_language(&mut t, &s.typing_props()); let story = s.sel.focus.story; let path = insert_block_at_caret(s, Block::Table(t))?; let mut first = path.0.clone(); @@ -45,6 +51,27 @@ pub(super) fn table(s: &mut Session, v: &Value) -> CmdResult { Ok(json!({"table": path.0})) } +/// Like Word, a new table is in the language of the text it is inserted in (#6013): each cell's +/// paragraph mark takes `at`'s languages and Do not check spelling, so what is typed in the cells +/// is proofed in that language rather than the document's default. Unset ones stay unset. +fn cells_in_language(t: &mut Table, at: &CharProps) { + for cell in t.rows.iter_mut().flat_map(|r| r.cells.iter_mut()) { + for b in &mut cell.blocks { + if let Block::Para(p) = std::sync::Arc::make_mut(b) { + let mark = &mut p.mark; + for (to, from) in [(&mut mark.lang, &at.lang), (&mut mark.lang_ea, &at.lang_ea), (&mut mark.lang_bidi, &at.lang_bidi)] { + if from.is_some() { + to.clone_from(from); + } + } + if at.no_proof.is_some() { + mark.no_proof = at.no_proof; + } + } + } + } +} + /// Minimal base64 (standard alphabet, padding optional, whitespace ignored). pub fn base64_decode(s: &str) -> Option> { let mut out = Vec::with_capacity(s.len() * 3 / 4); @@ -117,9 +144,9 @@ fn place_picture(s: &mut Session, bytes: Vec, width: Option, alt: &str) None => return Err(CmdError::Failed("not a supported image (PNG, JPEG, GIF, WebP, BMP, TIFF, WMF, EMF)".into())), }, }; + // Fitted to the room where it goes: the table cell, the column, its own section (#5428). + let max_w = s.room_at(&s.sel.ordered().0); let key = s.doc.add_media(bytes, ext); - // Fitted to the text width. - let max_w = s.doc.sections().first().map(|(_, sp)| sp.text_width()).unwrap_or(468.0); let (mut w, mut h) = (natural_w, natural_h); if let Some(want) = width { // At most 22 inches, as for icons: a huge width made the height of a tall picture infinite. diff --git a/crates/engine/src/cmd/insert/tests.rs b/crates/engine/src/cmd/insert/tests.rs index de38fe91fa..9f4c5165e9 100644 --- a/crates/engine/src/cmd/insert/tests.rs +++ b/crates/engine/src/cmd/insert/tests.rs @@ -358,6 +358,8 @@ fn date_pictures_keep_quoted_text() { // Two quotes outside quoted text are one too (an apostrophe), not an empty quoted text. assert_eq!(format_date_parts("yyyy '' MM", 2026, 10, 21, (0, 0, 0), 0), "2026 ' 10"); assert_eq!(format_date_parts("d''MM", 2026, 10, 21, (0, 0, 0), 0), "21'10"); + // Bare `a` is literal, not AM/PM (#3488). + assert_eq!(format_date_parts("yyyy a", 2026, 10, 21, (14, 30, 0), 0), "2026 a"); } #[test] diff --git a/crates/engine/src/cmd/mailings.rs b/crates/engine/src/cmd/mailings.rs index fa109031a6..49efc35eba 100644 --- a/crates/engine/src/cmd/mailings.rs +++ b/crates/engine/src/cmd/mailings.rs @@ -27,7 +27,7 @@ pub use merge::{merge_range, refresh}; #[cfg(test)] use merge::{mergefield_name, placeholder}; use recipients::recipients; -pub use recipients::{RECIPIENT_EXTENSIONS, is_spreadsheet_name, parse_csv}; +pub use recipients::{CsvLimits, MAX_CELLS, MAX_FIELDS, MAX_TEXT_BYTES, RECIPIENT_EXTENSIONS, RECIPIENT_LIMITS, is_spreadsheet_name, parse_csv}; /// The mail-merge data source and preview state (lives in the session, not the document). #[derive(Clone, Debug, Default)] diff --git a/crates/engine/src/cmd/mailings/recipients.rs b/crates/engine/src/cmd/mailings/recipients.rs index e9be3faf37..0233038779 100644 --- a/crates/engine/src/cmd/mailings/recipients.rs +++ b/crates/engine/src/cmd/mailings/recipients.rs @@ -19,22 +19,32 @@ fn csv_separator(text: &str) -> char { [',', ';', '\t'].into_iter().max_by_key(|c| unquoted.matches(*c).count()).unwrap_or(',') } -/// Ends the current row: kept when it has any non-empty field, otherwise dropped. -fn push_csv_row(rows: &mut Vec>, row: &mut Vec) { - if row.iter().any(|x| !x.is_empty()) { - rows.push(std::mem::take(row)); - } else { - row.clear(); - } +/// What a CSV may hold while it is read: the parser refuses a list that is over these, so a +/// hostile file is never built and then cut. +#[derive(Clone, Copy)] +pub struct CsvLimits { + /// Most columns in a record. + pub fields: usize, + /// Most cells in the list: its records times its widest record. + pub cells: usize, + /// Most bytes of cell text in all. + pub text: usize, } /// Parse CSV (RFC 4180-ish: quotes, doubled quotes, commas/semicolons/tabs). -pub fn parse_csv(text: &str) -> Vec> { +/// +/// The limits are kept while the list is read, not after it: a record wider than +/// `limits.fields`, a list of more than `limits.cells` cells, or more than `limits.text` bytes +/// of cell text is refused, rather than built and then cut. +pub fn parse_csv(text: &str, limits: &CsvLimits) -> Result>, CmdError> { let sep = csv_separator(text); let mut rows = Vec::new(); let mut row = Vec::new(); let mut cell = String::new(); let mut q = false; + // The widest record read so far, and the bytes of cell text read so far. + let mut widest = 0usize; + let mut text_bytes = 0usize; let mut chars = text.chars().peekable(); while let Some(c) = chars.next() { if q { @@ -51,29 +61,75 @@ pub fn parse_csv(text: &str) -> Vec> { } else if c == '"' { q = true; } else if c == sep { - row.push(std::mem::take(&mut cell)); + end_cell(&mut row, &mut cell, &mut text_bytes, limits)?; } else if c == '\n' || c == '\r' { if c == '\r' && chars.peek() == Some(&'\n') { chars.next(); } - row.push(std::mem::take(&mut cell)); - push_csv_row(&mut rows, &mut row); + end_cell(&mut row, &mut cell, &mut text_bytes, limits)?; + end_row(&mut rows, &mut row, &mut widest, limits)?; } else { cell.push(c); } + // The text read so far: the finished cells and the one being read. + if text_bytes.saturating_add(cell.len()) > limits.text { + return Err(CmdError::Failed(format!("the CSV can't have more than {} of text", text_size(limits.text)))); + } if rows.len() > 100_000 { break; } } - row.push(cell); - push_csv_row(&mut rows, &mut row); - rows + // The last cell, when the file doesn't end with a line break. + end_cell(&mut row, &mut cell, &mut text_bytes, limits)?; + end_row(&mut rows, &mut row, &mut widest, limits)?; + Ok(rows) +} + +/// A finished cell joins the record: the record's width stays inside the limit. +fn end_cell(row: &mut Vec, cell: &mut String, text_bytes: &mut usize, limits: &CsvLimits) -> Result<(), CmdError> { + *text_bytes = text_bytes.saturating_add(cell.len()); + row.push(std::mem::take(cell)); + if row.len() > limits.fields { + return Err(CmdError::Failed(format!("the CSV can't have more than {} columns", limits.fields))); + } + Ok(()) +} + +/// A finished record joins the list (an empty one is dropped). The list costs its records times +/// its widest record — a recipient list pads every record to the header's width — so a list +/// over the limit is refused here, while it is read. +fn end_row(rows: &mut Vec>, row: &mut Vec, widest: &mut usize, limits: &CsvLimits) -> Result<(), CmdError> { + if row.iter().any(|x| !x.is_empty()) { + *widest = (*widest).max(row.len()); + rows.push(std::mem::take(row)); + } else { + row.clear(); + } + if rows.len().saturating_mul(*widest) > limits.cells { + return Err(CmdError::Failed(format!("the CSV can't have more than {} cells (its records times its widest record)", limits.cells))); + } + Ok(()) +} + +/// A byte budget, said the way a reader says it. +fn text_size(bytes: usize) -> String { + if bytes >= 1 << 20 { format!("{} MB", bytes >> 20) } else { format!("{bytes} bytes") } } /// Most records and fields a recipient list keeps. const MAX_RECORDS: usize = 100_000; -const MAX_FIELDS: usize = 1_000; +pub const MAX_FIELDS: usize = 1_000; + +/// Most cells a recipient list keeps: its records times its fields. A recipient list pads every +/// record to the header's width, so this is what a list costs, not how many values it says. +pub const MAX_CELLS: usize = 2_000_000; + +/// Most bytes of cell text a recipient list keeps. The table path keeps the same budget. +pub const MAX_TEXT_BYTES: usize = 64 << 20; + +/// The limits a recipient list keeps. +pub const RECIPIENT_LIMITS: CsvLimits = CsvLimits { fields: MAX_FIELDS, cells: MAX_CELLS, text: MAX_TEXT_BYTES }; pub(super) fn cell(x: &Value) -> String { match x { @@ -117,12 +173,12 @@ fn table_from_rows(fields: Option<&Vec>, arr: &[Value]) -> Result<(Vec Vec> { +fn recipient_csv(text: &str, headers: bool) -> Result>, CmdError> { let prefix = text .split_inclusive(['\n', '\r']) .take_while(|line| headers && line.trim().is_empty()) .fold(0_usize, |bytes, line| bytes.saturating_add(line.len())); - parse_csv(text.get(prefix..).unwrap_or_default()) + parse_csv(text.get(prefix..).unwrap_or_default(), &RECIPIENT_LIMITS) } pub(super) fn recipients(s: &mut Session, v: &Value) -> CmdResult { @@ -131,7 +187,7 @@ pub(super) fn recipients(s: &mut Session, v: &Value) -> CmdResult { table_from_rows(v.get("fields").and_then(Value::as_array), arr)? } else { let all = if let Some(c) = p::str(v, "csv") { - recipient_csv(c, p::bool(v, "headers").unwrap_or(true)) + recipient_csv(c, p::bool(v, "headers").unwrap_or(true))? } else { let (bytes, ext) = if let Some(d) = p::str(v, "data") { let b = crate::cmd::insert::base64_decode(d.trim()).ok_or_else(|| CmdError::Params("`data` isn't valid base64".into()))?; @@ -176,7 +232,7 @@ pub(super) fn recipients(s: &mut Session, v: &Value) -> CmdResult { } Pick::Index(0) } - Some(_) => return Err(CmdError::Params("`sheet` must be a sheet name or number".into())), + Some(_) => return Err(CmdError::Params("`sheet` must be a sheet name or positive integer (1 = the first sheet)".into())), }; let (names, rows) = read_rows(&bytes, pick).map_err(CmdError::Failed)?; let chosen = match pick { @@ -188,7 +244,7 @@ pub(super) fn recipients(s: &mut Session, v: &Value) -> CmdResult { sheet = json!(chosen); rows } else { - recipient_csv(&decode(&bytes, v)?, p::bool(v, "headers").unwrap_or(true)) + recipient_csv(&decode(&bytes, v)?, p::bool(v, "headers").unwrap_or(true))? } }; header_split(all, p::bool(v, "headers").unwrap_or(true))? diff --git a/crates/engine/src/cmd/mailings/tests.rs b/crates/engine/src/cmd/mailings/tests.rs index 013200681e..6e60fdcbf9 100644 --- a/crates/engine/src/cmd/mailings/tests.rs +++ b/crates/engine/src/cmd/mailings/tests.rs @@ -2,9 +2,54 @@ use super::*; #[test] fn csv_parsing() { - let r = parse_csv("Name,City\n\"Smith, Ann\",Paris\r\nBo,\"Oslo \"\"N\"\"\"\n\n"); + let r = parse_csv("Name,City\n\"Smith, Ann\",Paris\r\nBo,\"Oslo \"\"N\"\"\"\n\n", &RECIPIENT_LIMITS).unwrap(); assert_eq!(r, vec![vec!["Name", "City"], vec!["Smith, Ann", "Paris"], vec!["Bo", "Oslo \"N\""]]); - assert_eq!(parse_csv("a;b\n1;2")[1], vec!["1", "2"]); + assert_eq!(parse_csv("a;b\n1;2", &RECIPIENT_LIMITS).unwrap()[1], vec!["1", "2"]); +} + +/// The parser keeps its limits while it reads the list, so a hostile list is refused +/// instead of being built and then cut. +#[test] +fn csv_parsing_refuses_a_list_over_its_limits() { + // A record wider than the limit. + let e = parse_csv("a,b,c,d,e", &CsvLimits { fields: 4, cells: 100, text: 1_000 }).unwrap_err(); + assert!(e.to_string().contains("4 columns"), "{e}"); + // More cells than the list keeps. + let e = parse_csv("a,b\nc,d\ne,f\ng,h\ni,j\nk,l", &CsvLimits { fields: 10, cells: 10, text: 1_000 }).unwrap_err(); + assert!(e.to_string().contains("10 cells"), "{e}"); + // More text than the list keeps. + let e = parse_csv("abcdefghij", &CsvLimits { fields: 10, cells: 100, text: 8 }).unwrap_err(); + assert!(e.to_string().contains("of text"), "{e}"); + // A list inside the limits still parses. + let limits = CsvLimits { fields: 4, cells: 10, text: 1_000 }; + assert_eq!(parse_csv("a,b\nc,d", &limits).unwrap(), vec![vec!["a", "b"], vec!["c", "d"]]); +} + +/// A recipient list over its limits is refused, not built. +#[test] +fn a_recipient_list_over_its_limits_is_refused() { + // A record wider than the list's fields. + let wide = format!("{}\nvalue", "f,".repeat(MAX_FIELDS + 1)); + let e = parse_csv(&wide, &RECIPIENT_LIMITS).unwrap_err(); + assert!(e.to_string().contains(&format!("{MAX_FIELDS} columns")), "{e}"); + + // A record of exactly the limit's width is kept. + let exact = format!("{}\nvalue", "f,".repeat(MAX_FIELDS - 1)); + assert_eq!(parse_csv(&exact, &RECIPIENT_LIMITS).unwrap()[0].len(), MAX_FIELDS); + + // A wide header over many records: the list would cost more cells than it keeps, and + // every record is padded to the header's width. + let mut csv = format!("{}\n", (0..MAX_FIELDS).map(|i| format!("f{i}")).collect::>().join(",")); + for _ in 0..=MAX_CELLS / MAX_FIELDS { + csv.push_str("value\n"); + } + let e = parse_csv(&csv, &RECIPIENT_LIMITS).unwrap_err(); + assert!(e.to_string().contains(&format!("{MAX_CELLS} cells")), "{e}"); + + // The command refuses it too, with a message of its own. + let mut s = Session::new(Document::new()); + let e = s.run("mailings.recipients", &json!({"csv": wide})).unwrap_err(); + assert!(e.to_string().contains("columns"), "{e}"); } /// #4001: finishing a merge opens a new document, with a new undo history. It is not an @@ -56,13 +101,16 @@ fn csv_delimiter_reads_complete_header_record() { let quoted = header.replace('"', "\"\""); let text = format!("\"{quoted}\"{sep}City{sep}{sep}\r\nAda{sep}Paris{sep}{sep}\nBo{sep}Oslo{sep}{sep}"); assert_eq!( - parse_csv(&text), + parse_csv(&text, &RECIPIENT_LIMITS).unwrap(), vec![vec![header.as_str(), "City", "", ""], vec!["Ada", "Paris", "", ""], vec!["Bo", "Oslo", "", ""]], "separator {sep:?}, embedded newline {newline:?}" ); // A multiline field after an ordinary column must not end detection either. let text = format!("ID{sep}\"{quoted}\"{sep}City\n1{sep}Ada{sep}Paris\n2{sep}Bo{sep}Oslo"); - assert_eq!(parse_csv(&text), vec![vec!["ID", header.as_str(), "City"], vec!["1", "Ada", "Paris"], vec!["2", "Bo", "Oslo"]]); + assert_eq!( + parse_csv(&text, &RECIPIENT_LIMITS).unwrap(), + vec![vec!["ID", header.as_str(), "City"], vec!["1", "Ada", "Paris"], vec!["2", "Bo", "Oslo"]] + ); } } } @@ -74,7 +122,7 @@ fn csv_delimiter_reads_multiline_headers_after_blank_lines() { let header = format!("Given{newline}Family"); for prefix in ["\n\r\n", "\r", "\r\r"] { let text = format!("{prefix}\"{header}\"{sep}City\rAda{sep}Paris"); - assert_eq!(parse_csv(&text), vec![vec![header.as_str(), "City"], vec!["Ada", "Paris"]]); + assert_eq!(parse_csv(&text, &RECIPIENT_LIMITS).unwrap(), vec![vec![header.as_str(), "City"], vec!["Ada", "Paris"]]); } } } @@ -99,34 +147,41 @@ fn recipient_csv_blank_prefix_keeps_columns_without_dropping_literal_records() { let rows = s.merge.rows.clone(); assert!(s.run("mailings.recipients", &json!({"csv": " \t\r\n \r"})).is_err()); assert_eq!(s.merge.rows, rows, "an empty headered list must not replace existing recipients"); - assert_eq!(parse_csv(" \nName,Email\nAda,ada@example.com")[0], vec![" "], "the shared CSV reader keeps literal whitespace rows"); + assert_eq!( + parse_csv(" \nName,Email\nAda,ada@example.com", &RECIPIENT_LIMITS).unwrap()[0], + vec![" "], + "the shared CSV reader keeps literal whitespace rows" + ); } #[test] fn csv_delimiter_keeps_record_boundaries_and_ties() { // Later records cannot choose the header's delimiter. - assert_eq!(parse_csv("Name;City\rAda;Paris,,,,\rBo;Oslo"), vec![vec!["Name", "City"], vec!["Ada", "Paris,,,,"], vec!["Bo", "Oslo"]]); + assert_eq!( + parse_csv("Name;City\rAda;Paris,,,,\rBo;Oslo", &RECIPIENT_LIMITS).unwrap(), + vec![vec!["Name", "City"], vec!["Ada", "Paris,,,,"], vec!["Bo", "Oslo"]] + ); // Existing ties prefer tab, then semicolon, then comma. - assert_eq!(parse_csv("A,B;C\n1,2;3"), vec![vec!["A,B", "C"], vec!["1,2", "3"]]); - assert_eq!(parse_csv("A;B\tC\n1;2\t3"), vec![vec!["A;B", "C"], vec!["1;2", "3"]]); - assert_eq!(parse_csv("Name\nAda,Paris;Oslo"), vec![vec!["Name"], vec!["Ada,Paris;Oslo"]]); - assert!(parse_csv("").is_empty()); - assert_eq!(parse_csv("\nName\nAda"), vec![vec!["Name"], vec!["Ada"]]); + assert_eq!(parse_csv("A,B;C\n1,2;3", &RECIPIENT_LIMITS).unwrap(), vec![vec!["A,B", "C"], vec!["1,2", "3"]]); + assert_eq!(parse_csv("A;B\tC\n1;2\t3", &RECIPIENT_LIMITS).unwrap(), vec![vec!["A;B", "C"], vec!["1;2", "3"]]); + assert_eq!(parse_csv("Name\nAda,Paris;Oslo", &RECIPIENT_LIMITS).unwrap(), vec![vec!["Name"], vec!["Ada,Paris;Oslo"]]); + assert!(parse_csv("", &RECIPIENT_LIMITS).unwrap().is_empty()); + assert_eq!(parse_csv("\nName\nAda", &RECIPIENT_LIMITS).unwrap(), vec![vec!["Name"], vec!["Ada"]]); // The reader remains permissive about an unterminated quoted cell. - assert_eq!(parse_csv("Name,City\nAda,\"Paris\nOslo"), vec![vec!["Name", "City"], vec!["Ada", "Paris\nOslo"]]); + assert_eq!(parse_csv("Name,City\nAda,\"Paris\nOslo", &RECIPIENT_LIMITS).unwrap(), vec![vec!["Name", "City"], vec!["Ada", "Paris\nOslo"]]); } #[test] fn csv_delimiter_ignores_quoted_text() { - let r = parse_csv("\"Name, first, last\";City\nAnn;Paris\n"); + let r = parse_csv("\"Name, first, last\";City\nAnn;Paris\n", &RECIPIENT_LIMITS).unwrap(); assert_eq!(r, vec![vec!["Name, first, last", "City"], vec!["Ann", "Paris"]]); } #[test] fn csv_delimiter_skips_leading_blank_lines() { let want = vec![vec!["Name", "Email"], vec!["Ann", "ann@x.org"]]; - assert_eq!(parse_csv("\nName,Email\nAnn,ann@x.org\n"), want); - assert_eq!(parse_csv("\r\n\r\nName;Email\r\nAnn;ann@x.org"), want); + assert_eq!(parse_csv("\nName,Email\nAnn,ann@x.org\n", &RECIPIENT_LIMITS).unwrap(), want); + assert_eq!(parse_csv("\r\n\r\nName;Email\r\nAnn;ann@x.org", &RECIPIENT_LIMITS).unwrap(), want); } /// Field types ignore case (ECMA-376 Part 1, 17.16.1), and `MERGEFIELDX` is another field. @@ -242,7 +297,10 @@ fn recipients_from_a_workbook_ask_for_the_sheet_when_there_are_several() { assert_eq!(r["fields"], json!(["Column 1", "Column 2", "Column 3"])); assert_eq!(r["records"], 3); assert!(s.run("mailings.recipients", &json!({"data": data, "sheet": 3})).is_err()); - assert!(s.run("mailings.recipients", &json!({"data": data, "sheet": 0})).is_err()); + assert!(matches!( + s.run("mailings.recipients", &json!({"data": data, "sheet": 0})), + Err(CmdError::Params(message)) if message == "`sheet` must be a sheet name or positive integer (1 = the first sheet)" + )); assert!(s.run("mailings.recipients", &json!({"data": "%%%"})).is_err()); } diff --git a/crates/engine/src/cmd/md_source.rs b/crates/engine/src/cmd/md_source.rs index 6d73496124..b302e0a969 100644 --- a/crates/engine/src/cmd/md_source.rs +++ b/crates/engine/src/cmd/md_source.rs @@ -103,7 +103,7 @@ fn exact_text(s: &Session) -> Option { return res.clone(); } let kept = [s.md_file.latest.as_deref(), s.md_file.saved.as_deref()]; - let res = kept.into_iter().flatten().find(|text| parse(&s.doc, text).same_content(&s.doc)).map(str::to_string); + let res = kept.into_iter().flatten().find(|text| parse(&s.doc, text).is_ok_and(|d| d.same_content(&s.doc))).map(str::to_string); *s.md_file.cached_exact.borrow_mut() = Some((s.rev(), res.clone())); res } @@ -216,15 +216,16 @@ fn enter(s: &mut Session) -> Result<(), CmdError> { // The file's own text when it still says what the document holds, so nothing is lost. let (text, loses_content, block_lines) = match exact_text(s) { Some(text) => { - let (_, lines) = parse_with_lines(&s.doc, &text); + let (_, lines) = parse_with_lines(&s.doc, &text)?; (text, false, lines) } None => { - let text = wordcraft_formats::markdown::export(&s.doc); + let text = wordcraft_formats::markdown::export(&s.doc) + .map_err(|e| CmdError::Failed(format!("the document cannot be written as Markdown: {e}")))?; if text.len() > MAX_SOURCE_BYTES { return Err(CmdError::Failed(too_long())); } - let (doc, lines) = parse_with_lines(&s.doc, &text); + let (doc, lines) = parse_with_lines(&s.doc, &text)?; let loses_content = !doc.same_content(&s.doc); (text, loses_content, lines) } @@ -289,7 +290,19 @@ pub fn apply(s: &mut Session) { } (src.text.clone(), src.entry_text.clone(), src.entry_doc.clone(), src.has_step, src.entry_lines.clone()) }; - let (doc, lines) = if text == *entry_text { ((*entry_doc).clone(), entry_lines) } else { parse_with_lines(&s.doc, &text) }; + let (doc, lines) = if text == *entry_text { + ((*entry_doc).clone(), entry_lines) + } else { + // The text cannot be read as Markdown: the document stays as it is, rather than + // becoming an empty one. + match parse_with_lines(&s.doc, &text) { + Ok(v) => v, + Err(e) => { + s.status = e.to_string(); + return; + } + } + }; let step = if !has_step { s.checkpoint(LABEL); Some(s.undo_mark()) @@ -313,19 +326,20 @@ pub fn apply(s: &mut Session) { /// `text` as a document and block lines, with what isn't in Markdown from `current`: its page, settings, /// properties and language, as opening the file gave it. -fn parse_with_lines(current: &Document, text: &str) -> (Document, Vec) { - let (mut doc, lines) = wordcraft_formats::markdown::import_on_with_lines(text, ¤t.last_section); +fn parse_with_lines(current: &Document, text: &str) -> Result<(Document, Vec), CmdError> { + let (mut doc, lines) = wordcraft_formats::markdown::import_on_with_lines(text, ¤t.last_section) + .map_err(|e| CmdError::Failed(format!("the Markdown cannot be read: {e}")))?; doc.ensure_nonempty(); doc.settings = current.settings.clone(); doc.core = current.core.clone(); Arc::make_mut(&mut doc.styles).default_chr.lang = current.styles.default_chr.lang.clone(); - (doc, lines) + Ok((doc, lines)) } /// `text` as a document, with what isn't in Markdown from `current`: its page, settings, /// properties and language, as opening the file gave it. -fn parse(current: &Document, text: &str) -> Document { - parse_with_lines(current, text).0 +fn parse(current: &Document, text: &str) -> Result { + parse_with_lines(current, text).map(|(doc, _)| doc) } /// The byte offset where `line` starts, or the end of a text with fewer lines. @@ -894,4 +908,29 @@ mod tests { let spec = s.registry.get(TEXT).unwrap(); assert!(spec.mutates, "view.markdownSourceText mutates session and dirty state"); } + + /// Verifies entering and applying Markdown Source keep the document intact and report errors + /// when Markdown conversion fails. + #[test] + fn failed_markdown_conversion_keeps_document_and_reports_error() { + let mut s = session(SAMPLE); + s.md_file = FileText::default(); + let err = wordcraft_formats::with_shared_conversion_error("bridge failed", || s.run(TOGGLE, &json!({}))).unwrap_err(); + assert!(err.to_string().contains("bridge failed"), "{err}"); + assert!(s.md_source.is_none()); + + for skip in [1, 2] { + let err = wordcraft_formats::with_shared_conversion_error_after(skip, "bridge failed", || s.run(TOGGLE, &json!({}))).unwrap_err(); + assert!(err.to_string().contains("bridge failed"), "skip={skip}: {err}"); + assert!(s.md_source.is_none()); + } + + let mut s = session(SAMPLE); + s.run(TOGGLE, &json!({})).unwrap(); + let before = body_text(&s); + set_text(&mut s, "# Replaced\n"); + wordcraft_formats::with_shared_conversion_error("bridge failed", || apply(&mut s)); + assert_eq!(body_text(&s), before, "failed apply leaves the document intact"); + assert!(s.status.contains("bridge failed"), "{}", s.status); + } } diff --git a/crates/engine/src/cmd/moves.rs b/crates/engine/src/cmd/moves.rs index e0d1da2a39..33683a1e1b 100644 --- a/crates/engine/src/cmd/moves.rs +++ b/crates/engine/src/cmd/moves.rs @@ -56,7 +56,7 @@ pub fn cut_tracked(s: &mut Session) -> Result { if !s.doc.settings.track_changes || !s.doc.settings.track_moves || a == b || a.story != b.story || !move_sized(&s.clipboard_text) { return Ok(false); } - s.doc.revisions.push(Revision::new(RevisionKind::Delete, s.author.clone(), now_iso())); + s.doc.revisions.push(crate::cmd::made_revision(RevisionKind::Delete, s.author.clone(), now_iso())); let rid = (s.doc.revisions.len() - 1) as u32; let at = track_delete_as(s, &a, &b, rid)?.at; s.sel = Selection::caret(at); @@ -75,13 +75,13 @@ pub fn take_paste(s: &mut Session, frag: &Fragment) -> Option { return None; } let src = s.doc.revisions.get(m.rev as usize).filter(|r| r.kind == RevisionKind::Delete && r.move_name.is_none())?; - let date = src.date.clone(); + let (date, date_utc) = (src.date.clone(), src.date_utc.clone()); let taken: BTreeSet<&str> = s.doc.revisions.iter().filter_map(|r| r.move_name.as_deref()).collect(); let name = (1..).map(|n: u64| format!("move{n}")).find(|n| !taken.contains(n.as_str()))?; if let Some(r) = s.doc.revisions.get_mut(m.rev as usize) { r.move_name = Some(name.clone()); } - s.doc.revisions.push(Revision { kind: RevisionKind::Insert, author: s.author.clone(), date, move_name: Some(name) }); + s.doc.revisions.push(Revision { kind: RevisionKind::Insert, author: s.author.clone(), date, move_name: Some(name), date_utc }); Some((s.doc.revisions.len() - 1) as u32) } @@ -278,4 +278,23 @@ mod tests { assert_eq!(texts(&s), ["First one.", "Second one.", "Third one."]); assert!(kinds(&mut s).is_empty()); } + + /// A command that fails between a tracked cut and its paste changed nothing, so the move + /// the cut recorded is still there: the paste is a move, as it was before the command. + #[test] + fn a_failed_command_between_a_tracked_cut_and_its_paste_leaves_the_move() { + let mut s = Session::new(Document::new()); + s.run("document.setText", &json!({"text": "First one.\nSecond one.\nThird one."})).unwrap(); + s.run("file.setAuthor", &json!({"name": "Ana"})).unwrap(); + s.run("review.trackChanges", &json!({"value": true})).unwrap(); + s.run("select.range", &json!({"anchor": {"block": 1, "off": 0}, "focus": {"block": 2, "off": 0}})).unwrap(); + s.run("edit.cut", &json!({})).unwrap(); + // A command that fails: there is no such character style. + assert!(s.run("format.charStyle", &json!({"style": "NoSuchStyle"})).is_err()); + s.run("caret.set", &json!({"pos": {"block": 0, "off": 0}})).unwrap(); + s.run("edit.paste", &json!({})).unwrap(); + let k = kinds(&mut s); + assert!(k.iter().any(|(k, m)| k == "moveTo" && m == "move1"), "{k:?}"); + assert!(k.iter().any(|(k, m)| k == "moveFrom" && m == "move1"), "{k:?}"); + } } diff --git a/crates/engine/src/cmd/objects.rs b/crates/engine/src/cmd/objects.rs index 377260160a..8b5c2e7989 100644 --- a/crates/engine/src/cmd/objects.rs +++ b/crates/engine/src/cmd/objects.rs @@ -29,14 +29,15 @@ pub use picture::{OriginalSize, PictureLook, cropped_original_size, fit_size, or use picture::{clear_background, grown, picture_style}; #[cfg(test)] pub(crate) use select::all_objects; +pub(crate) use select::select_object; pub(crate) use select::{edit_obj, has_shape_or_canvas}; #[cfg(test)] use select::{has_group, holds_ink, obj_size, with_obj}; -pub use select::{min_size, object_selection, picked_objects, selected, selected_all}; +pub use select::{min_size, object_selection, picked_objects, selected, selected_all, selected_or_text_box, target_objects}; #[cfg(test)] use shape::can_link; pub(crate) use shape::set_text_body; -pub use shape::text_box_target; +pub use shape::{text_box_target, text_box_targets}; pub use specs::specs; #[cfg(test)] diff --git a/crates/engine/src/cmd/objects/arrange.rs b/crates/engine/src/cmd/objects/arrange.rs index 90fd2aa88d..4453975168 100644 --- a/crates/engine/src/cmd/objects/arrange.rs +++ b/crates/engine/src/cmd/objects/arrange.rs @@ -1,4 +1,4 @@ -use super::select::{edit_float, min_size, movable_story, obj_size, select_object, selected, with_obj}; +use super::select::{edit_float, min_size, movable_story, obj_size, select_object, selected_or_text_box, with_obj}; use super::{CmdError, CmdResult, Float, InlineObject, Pos, Selection, Session, StoryRef, Value, Wrap, json, p}; /// Largest object offset or move, points. @@ -9,7 +9,7 @@ pub(super) fn bounds(s: &mut Session, v: &Value) -> CmdResult { if let Some(r) = crate::cmd::canvas::member_bounds(s, v) { return r; } - let (pos, obj) = selected(s).ok_or_else(|| CmdError::Disabled("no picture or shape selected".into()))?; + let (pos, obj) = selected_or_text_box(s).ok_or_else(|| CmdError::Disabled("no picture or shape selected".into()))?; let to = match (p::f32(v, "x"), p::f32(v, "y")) { (Some(x), Some(y)) => Some((x, y)), (None, None) => None, @@ -88,7 +88,7 @@ fn move_in_text(s: &mut Session, pos: Pos, to: &Pos) -> Result { /// (x, y), or for an In Line with Text object put it at the text position `to`, leaving the /// original in place and the clipboard alone. The copy is selected. pub(super) fn copy_to(s: &mut Session, v: &Value) -> CmdResult { - let (pos, obj) = selected(s).ok_or_else(|| CmdError::Disabled("no picture or shape selected".into()))?; + let (pos, obj) = selected_or_text_box(s).ok_or_else(|| CmdError::Disabled("no picture or shape selected".into()))?; let len = wordcraft_doc::para::OBJ.len_utf8(); let end = Pos { off: pos.off + len, ..pos.clone() }; if let Some(to) = text_target(v, &obj)? { @@ -219,7 +219,7 @@ fn move_object_once(s: &mut Session, pos: &Pos, page: usize, x: f32, y: f32, (w, /// 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> { use wordcraft_doc::para::Anchor; - let (pos, obj) = selected(s).ok_or_else(|| CmdError::Disabled("no picture or shape selected".into()))?; + let (pos, obj) = selected_or_text_box(s).ok_or_else(|| CmdError::Disabled("no picture or shape selected".into()))?; let Some((_, _, float)) = obj.frame() else { return Ok(()) }; if float.h_align.is_none() && float.v_align.is_none() { return Ok(()); @@ -260,7 +260,7 @@ pub fn moves_with_text(f: &Float) -> bool { /// object's vertical position to its paragraph or to the page, keeping it where it is now. pub(super) fn move_with_text(s: &mut Session, with_text: bool) -> CmdResult { use wordcraft_doc::para::Anchor; - let (pos, obj) = selected(s).ok_or_else(|| CmdError::Disabled("no picture or shape selected".into()))?; + let (pos, obj) = selected_or_text_box(s).ok_or_else(|| CmdError::Disabled("no picture or shape selected".into()))?; let Some((_, _, float)) = obj.frame() else { return Err(CmdError::Disabled("select a floating picture or shape first".into())) }; if moves_with_text(float) == with_text { return Ok(json!({"object": serde_json::to_value(&obj).unwrap_or(Value::Null)})); diff --git a/crates/engine/src/cmd/objects/picture.rs b/crates/engine/src/cmd/objects/picture.rs index 65f0f0386b..8e2ad2ea78 100644 --- a/crates/engine/src/cmd/objects/picture.rs +++ b/crates/engine/src/cmd/objects/picture.rs @@ -1,5 +1,5 @@ -use super::select::{obj_size, selected, with_obj}; -use super::{CmdError, CmdResult, InlineObject, Rgb, Session, Value, Wrap, p}; +use super::select::{edit_obj, is_shape_or_canvas, obj_size, selected, target_objects, with_obj}; +use super::{CmdError, CmdResult, InlineObject, Pos, Rgb, Session, Value, Wrap, json, p}; use wordcraft_doc::picfx::PicFx; /// `picture.crop`: the crop, and optionally the new display size, as one edit. With a size, a @@ -70,19 +70,15 @@ pub fn cropped_original_size(s: &Session, o: &InlineObject) -> Option<(f32, f32) Some((orig.w * part(crop[0], crop[2]), orig.h * part(crop[1], crop[3]))) } -/// Size: `scale` is a percentage of the current size, or with `original` of what the crop leaves -/// of the original size (`original` alone gives that back: the Size dialog's Reset); then `width` -/// and `height`, where one alone keeps the proportions unless `lockAspect` is false. -pub(super) fn size(s: &mut Session, v: &Value) -> CmdResult { - let (_, o) = selected(s).ok_or_else(|| CmdError::Disabled("no object".into()))?; +fn planned_size(s: &Session, o: &InlineObject, v: &Value) -> Result<(f32, f32), CmdError> { let lock = p::bool(v, "lockAspect").unwrap_or(true); - let (w0, h0) = obj_size(&o); + let (w0, h0) = obj_size(o); let (mut w, mut h) = (w0, h0); let scale = p::f32(v, "scale"); let original = p::bool(v, "original").unwrap_or(false); if original { let (ow, oh) = - cropped_original_size(s, &o).ok_or_else(|| CmdError::Disabled("only a picture whose image can be read has an original size".into()))?; + cropped_original_size(s, o).ok_or_else(|| CmdError::Disabled("only a picture whose image can be read has an original size".into()))?; let k = scale.unwrap_or(100.0) / 100.0; (w, h) = (ow * k, oh * k); } else if let Some(sc) = scale { @@ -118,21 +114,55 @@ pub(super) fn size(s: &mut Session, v: &Value) -> CmdResult { // Sides set in proportion (from the original, or from a size whose sides both have a length) // fit the limits together. Otherwise each side the call sets fits on its own, and a side it // leaves as it was keeps its size, a straight line's 0 too. - let (w, h) = if keep && (original || (w0 > 0.0 && h0 > 0.0 && (w, h) != (w0, h0))) { - fit_size(w, h, true) + if keep && (original || (w0 > 0.0 && h0 > 0.0 && (w, h) != (w0, h0))) { + Ok(fit_size(w, h, true)) } else { let (fw, fh) = fit_size(w, h, false); let left = |new: f32, old: f32| !original && new == old; - (if left(w, w0) { w } else { fw }, if left(h, h0) { h } else { fh }) - }; + Ok((if left(w, w0) { w } else { fw }, if left(h, h0) { h } else { fh })) + } +} + +fn size_matching(s: &mut Session, v: &Value, pred: impl Fn(&InlineObject) -> bool, empty_msg: &str) -> CmdResult { + let targets = target_objects(s, pred); + if targets.is_empty() { + return Err(CmdError::Disabled(empty_msg.into())); + } + let planned: Vec<(Pos, f32, f32)> = + targets.into_iter().map(|(pos, o)| planned_size(s, &o, v).map(|(w, h)| (pos, w, h))).collect::, _>>()?; // Any drawing: a group's members scale with its frame (its child space is kept); a chart or // SmartArt graphic lays itself out again at the new size. let theme = s.doc.settings.theme_colors.clone(); - with_obj(s, |o| { - o.set_size(w, h); - crate::cmd::chart::redraw(o, &theme); - crate::cmd::smart_art::redraw(o, &theme); - }) + let mut last = Value::Null; + for (pos, w, h) in &planned { + let o = edit_obj(s, pos, |o| { + o.set_size(*w, *h); + crate::cmd::chart::redraw(o, &theme); + crate::cmd::smart_art::redraw(o, &theme); + })?; + last = serde_json::to_value(o).unwrap_or(Value::Null); + } + Ok(json!({"object": last, "count": planned.len()})) +} + +/// Size: `scale` is a percentage of the current size, or with `original` of what the crop leaves +/// of the original size (`original` alone gives that back: the Size dialog's Reset); then `width` +/// and `height`, where one alone keeps the proportions unless `lockAspect` is false. +pub(super) fn size(s: &mut Session, v: &Value) -> CmdResult { + size_matching( + s, + v, + |o| match o { + InlineObject::Graphic { graphic, .. } => graphic.chart.is_some() || graphic.smart_art.is_some(), + _ => o.is_drawing(), + }, + "no object", + ) +} + +/// Shape Size: resizes only selected shapes, text boxes, and drawing canvases (or the active text box). +pub(super) fn shape_size(s: &mut Session, v: &Value) -> CmdResult { + size_matching(s, v, is_shape_or_canvas, "no shape selected") } /// An object size within 1–4000 pt. With `keep`, both sides scale by one factor, the one nearest diff --git a/crates/engine/src/cmd/objects/select.rs b/crates/engine/src/cmd/objects/select.rs index 435bfcb8a2..9404804964 100644 --- a/crates/engine/src/cmd/objects/select.rs +++ b/crates/engine/src/cmd/objects/select.rs @@ -7,16 +7,18 @@ pub(super) fn has_picture(s: &Session) -> Option<&'static str> { } } +/// Guard returning `None` when a picture, shape, or active text box is selected. pub(super) fn has_object(s: &Session) -> Option<&'static str> { - if selected(s).is_some() { None } else { Some("select a picture or shape first") } + if selected_or_text_box(s).is_some() { None } else { Some("select a picture or shape first") } } +/// Guard returning `None` when a floating picture, shape, or active text box is selected. pub(super) fn has_floating(s: &Session) -> Option<&'static str> { // A canvas member moves inside its canvas. - if crate::cmd::canvas::selected_member(s).is_some() { + if crate::cmd::canvas::active_member(s).is_some() { return None; } - match selected(s) { + match selected_or_text_box(s) { Some((_, InlineObject::Graphic { .. })) => Some(FROZEN), Some((_, o)) if o.is_floating() => None, _ => Some("select a floating picture or shape first"), @@ -55,10 +57,18 @@ pub(super) fn has_movable(s: &Session) -> Option<&'static str> { } } +/// Guard returning `None` when at least one selected target (or active text box) is movable. +pub(super) fn has_any_movable(s: &Session) -> Option<&'static str> { + if !target_objects(s, |o| !matches!(o, InlineObject::Graphic { .. }) && o.is_drawing()).is_empty() { + return None; + } + has_movable(s) +} + /// `has_movable` for what places an object in the text (wrapping, position, alignment, Move with -/// Text): not for a member picked inside a drawing canvas, which the canvas places. +/// Text): not for a member inside a drawing canvas, which the canvas places. pub(super) fn has_placeable(s: &Session) -> Option<&'static str> { - if crate::cmd::canvas::selected_member(s).is_some() { + if crate::cmd::canvas::active_member(s).is_some() { return Some("a shape inside a drawing canvas is placed by the canvas"); } has_movable(s) @@ -82,25 +92,33 @@ pub(super) fn has_group(s: &Session) -> Option<&'static str> { } } -/// Shape Fill and Shape Outline: a shape, or a Drawing Canvas's background and border. +/// Whether `o` is a shape, text box, or drawing canvas. +pub(crate) fn is_shape_or_canvas(o: &InlineObject) -> bool { + matches!(o, InlineObject::Shape { .. }) || o.is_canvas() +} + +/// Shape Fill and Shape Outline: any selected shape or Drawing Canvas, or the active text box. pub(crate) fn has_shape_or_canvas(s: &Session) -> Option<&'static str> { - match selected(s) { - Some((_, o)) if o.is_canvas() => None, - _ => has_shape(s), - } + if target_objects(s, is_shape_or_canvas).is_empty() { Some("select a shape first") } else { None } } pub(super) fn can_group(s: &Session) -> Option<&'static str> { if picked_objects(s).len() >= 2 { None } else { Some("select two or more pictures or shapes first (Shift+click)") } } +/// Guard returning `None` when a shape or active text box is selected. pub(super) fn has_shape(s: &Session) -> Option<&'static str> { - match selected(s) { + match selected_or_text_box(s) { Some((_, InlineObject::Shape { .. })) => None, _ => Some("select a shape first"), } } +/// Guard returning `None` when any selected object (or the active text box) is a shape. +pub(super) fn has_any_shape(s: &Session) -> Option<&'static str> { + if target_objects(s, |o| matches!(o, InlineObject::Shape { .. })).is_empty() { Some("select a shape first") } else { None } +} + /// The selection when it is exactly one picture, shape or text box (its U+FFFC), rather than /// text: what clicking an object selects. pub fn object_selection(s: &Session) -> Option<(Pos, &InlineObject)> { @@ -158,7 +176,7 @@ pub fn min_size(o: &InlineObject) -> f32 { } /// Select the object whose character is at `pos`. -pub(super) fn select_object(s: &mut Session, pos: &Pos) { +pub(crate) fn select_object(s: &mut Session, pos: &Pos) { s.sel = Selection { anchor: pos.clone(), focus: Pos { off: pos.off + wordcraft_doc::para::OBJ.len_utf8(), ..pos.clone() } }; } @@ -187,8 +205,51 @@ pub(super) fn alt_text(s: &mut Session, v: &Value) -> CmdResult { }) } +/// Returns the selected inline object, or the active text box containing the caret (including +/// a text box member inside a Drawing Canvas; never an enclosing group or canvas). +pub fn selected_or_text_box(s: &Session) -> Option<(Pos, InlineObject)> { + if let Some((pos, o)) = selected(s) { + return Some((pos, o)); + } + if let Some((pos, _, member)) = crate::cmd::canvas::text_box_member(s) { + return Some((pos, member.clone())); + } + let (pos, id) = super::shape::text_box_target(s)?; + let o = s.doc.para_at(&pos)?.object_at(pos.off)?; + matches!(o, InlineObject::Shape { story: Some(sid), .. } if *sid == id).then(|| (pos, o.clone())) +} + +/// Most objects one multi-object command changes. +pub(crate) const MAX_TARGET_OBJECTS: usize = 10_000; + +/// Selected objects matching `pred` (in the selection range or added with `select.addObject`), +/// or — when nothing is selected — the active text box containing the caret if it matches `pred`. +pub fn target_objects(s: &Session, pred: impl Fn(&InlineObject) -> bool) -> Vec<(Pos, InlineObject)> { + if let Some((pos, _, member)) = crate::cmd::canvas::active_member(s) { + return if pred(member) { vec![(pos, member.clone())] } else { Vec::new() }; + } + let mut out: Vec<(Pos, InlineObject)> = selected_all(s, MAX_TARGET_OBJECTS).into_iter().filter(|(_, o)| pred(o)).collect(); + for pos in picked_objects(s) { + if !out.iter().any(|(p, _)| p == &pos) + && let Some(o) = s.doc.para_at(&pos).and_then(|q| q.object_at(pos.off)) + && pred(o) + { + out.push((pos, o.clone())); + } + } + if out.is_empty() + && selected(s).is_none() + && let Some((pos, o)) = selected_or_text_box(s) + && pred(&o) + { + out.push((pos, o)); + } + out +} + +/// Mutates the selected picture or shape, or the active text box containing the caret. pub(super) fn with_obj(s: &mut Session, f: impl Fn(&mut InlineObject)) -> CmdResult { - let (pos, _) = selected(s).ok_or_else(|| CmdError::Disabled("no picture or shape selected".into()))?; + let (pos, _) = selected_or_text_box(s).ok_or_else(|| CmdError::Disabled("no picture or shape selected".into()))?; let o = edit_obj(s, &pos, f)?; Ok(json!({"object": serde_json::to_value(o).unwrap_or(Value::Null)})) } @@ -215,17 +276,38 @@ pub(super) fn edit_float(s: &mut Session, pos: &Pos, f: impl Fn(&mut Float)) -> }) } -pub(super) fn with_float(s: &mut Session, f: impl Fn(&mut Float)) -> CmdResult { - with_obj(s, |o| { - if let Some(float) = o.float_mut() { - let was_inline = float.wrap == Wrap::Inline; - f(float); - // Word's distance from text for a newly wrapped object: 0.125" at the sides. - if was_inline && float.wrap != Wrap::Inline && float.dist == 0.0 { - float.dist = 9.0; - } +fn apply_float(o: &mut InlineObject, f: impl Fn(&mut Float)) { + if let Some(float) = o.float_mut() { + let was_inline = float.wrap == Wrap::Inline; + f(float); + // Word's distance from text for a newly wrapped object: 0.125" at the sides. + if was_inline && float.wrap != Wrap::Inline && float.dist == 0.0 { + float.dist = 9.0; } - }) + } +} + +pub(super) fn with_float(s: &mut Session, f: impl Fn(&mut Float)) -> CmdResult { + with_obj(s, |o| apply_float(o, &f)) +} + +/// Mutates `Float` on all selected targets matching `pred` (or the active text box if it matches). +pub(super) fn with_floats_matching(s: &mut Session, pred: impl Fn(&InlineObject) -> bool, f: impl Fn(&mut Float)) -> CmdResult { + let targets = target_objects(s, pred); + if targets.is_empty() { + return Err(CmdError::Disabled("no picture or shape selected".into())); + } + let mut last = Value::Null; + for (pos, _) in &targets { + let o = edit_obj(s, pos, |o| apply_float(o, &f))?; + last = serde_json::to_value(o).unwrap_or(Value::Null); + } + Ok(json!({"object": last, "count": targets.len()})) +} + +/// Mutates `Float` on all selected movable objects (or the active text box). +pub(super) fn with_movable_floats(s: &mut Session, f: impl Fn(&mut Float)) -> CmdResult { + with_floats_matching(s, |o| !matches!(o, InlineObject::Graphic { .. }) && o.is_drawing(), f) } /// The selected pictures, shapes, text boxes and groups: the one the selection holds, then diff --git a/crates/engine/src/cmd/objects/shape.rs b/crates/engine/src/cmd/objects/shape.rs index afb196875f..d60b94e022 100644 --- a/crates/engine/src/cmd/objects/shape.rs +++ b/crates/engine/src/cmd/objects/shape.rs @@ -1,16 +1,37 @@ -use super::select::{all_objects, edit_obj, picked_objects, selected, selected_all}; +use super::select::{all_objects, edit_obj, picked_objects, selected, target_objects}; use super::{CmdError, CmdResult, InlineObject, Pos, Rgb, Session, StoryRef, TextBody, Value, json, p}; pub(super) const NO_TEXT_BOX: &str = "select a text box first"; pub(super) fn has_text_box(s: &Session) -> Option<&'static str> { - if text_box_target(s).is_some() { None } else { Some(NO_TEXT_BOX) } + if text_box_targets(s).is_empty() { Some(NO_TEXT_BOX) } else { None } } fn is_text_box(s: &Session, id: u32) -> bool { s.doc.parts.get(&id).is_some_and(|p| p.kind == wordcraft_doc::PartKind::TextBox) } +/// Target text boxes for Shape Format › Text commands: all selected text boxes (including +/// those added with `select.addObject` or the active canvas text box member), falling back +/// to the text box containing the caret when no object is selected. +pub fn text_box_targets(s: &Session) -> Vec<(Pos, u32)> { + let mut targets: Vec<(Pos, u32)> = target_objects(s, |o| matches!(o, InlineObject::Shape { story: Some(id), .. } if is_text_box(s, *id))) + .into_iter() + .filter_map(|(pos, o)| match o { + InlineObject::Shape { story: Some(id), .. } => Some((pos, id)), + _ => None, + }) + .collect(); + if targets.is_empty() + && selected(s).is_none() + && picked_objects(s).is_empty() + && let Some(t) = text_box_target(s) + { + targets.push(t); + } + targets +} + /// The text box the Shape Format › Text commands work on: the selected one, or the one whose /// text the caret is in. Its U+FFFC's position and its story. pub fn text_box_target(s: &Session) -> Option<(Pos, u32)> { @@ -28,15 +49,22 @@ pub fn text_box_target(s: &Session) -> Option<(Pos, u32)> { Some((Pos { off, ..after }, id)) } -/// Change the target text box's text direction, alignment or link. +/// Change the target text boxes' text direction, alignment or link. pub(crate) fn set_text_body(s: &mut Session, f: impl Fn(&mut TextBody)) -> CmdResult { - let (pos, id) = text_box_target(s).ok_or_else(|| CmdError::Disabled(NO_TEXT_BOX.into()))?; - let part = s.doc.parts.get_mut(&id).ok_or_else(|| CmdError::Failed("text box vanished".into()))?; - f(&mut part.body); - let body = part.body; - // Its paragraph is laid out again. - edit_obj(s, &pos, |_| {})?; - Ok(json!({"textBox": id, "body": body})) + let targets = text_box_targets(s); + if targets.is_empty() { + return Err(CmdError::Disabled(NO_TEXT_BOX.into())); + } + let mut last_id = 0; + let mut last_body = TextBody::default(); + for (pos, id) in targets { + let part = s.doc.parts.get_mut(&id).ok_or_else(|| CmdError::Failed("text box vanished".into()))?; + f(&mut part.body); + (last_id, last_body) = (id, part.body); + // Its paragraph is laid out again. + edit_obj(s, &pos, |_| {})?; + } + Ok(json!({"textBox": last_id, "body": last_body})) } pub(super) fn can_link(s: &Session) -> Option<&'static str> { @@ -81,9 +109,6 @@ pub(super) fn link_text_box(s: &mut Session, v: &Value) -> CmdResult { Ok(json!({"textBox": from, "next": to})) } -/// Most shapes one `shape.effects` changes. -const MAX_EFFECT_SHAPES: usize = 10_000; - /// `shape.effects`: set or clear the shadow, glow and soft edges of the selected shapes. pub(super) fn shape_effects(s: &mut Session, v: &Value) -> CmdResult { use wordcraft_doc::effects::{Glow, Shadow, ShapeEffects}; @@ -133,19 +158,13 @@ pub(super) fn shape_effects(s: &mut Session, v: &Value) -> CmdResult { Some(n @ Value::Number(_)) => Some(n.as_f64().map(|x| x as f32)), Some(_) => return Err(CmdError::Params("`softEdge`: a radius in points or null".into())), }; - // The shapes in the selection and those added to it (Shift+click). - let mut targets: Vec = - selected_all(s, MAX_EFFECT_SHAPES).into_iter().filter(|(_, o)| matches!(o, InlineObject::Shape { .. })).map(|(pos, _)| pos).collect(); - for pos in picked_objects(s) { - if !targets.contains(&pos) && matches!(s.doc.para_at(&pos).and_then(|q| q.object_at(pos.off)), Some(InlineObject::Shape { .. })) { - targets.push(pos); - } - } + // The shapes in the selection, those added with `select.addObject`, or the active text box. + let targets = target_objects(s, |o| matches!(o, InlineObject::Shape { .. })); if targets.is_empty() { return Err(CmdError::Disabled("no shape selected".into())); } let mut last = ShapeEffects::default(); - for pos in &targets { + for (pos, _) in &targets { let o = edit_obj(s, pos, |o| { if let InlineObject::Shape { effects, float, .. } = o { let mut e = *effects; diff --git a/crates/engine/src/cmd/objects/specs.rs b/crates/engine/src/cmd/objects/specs.rs index 11967ed4e5..e921ed9421 100644 --- a/crates/engine/src/cmd/objects/specs.rs +++ b/crates/engine/src/cmd/objects/specs.rs @@ -1,14 +1,40 @@ use super::arrange::{MAX_OFFSET, bounds, copy_to, move_with_text, unalign}; use super::group::{add_object, group, ungroup}; -use super::picture::{adjust, adjust_media, clear_lum, crop, original_media, recolor, relook, remove_background, reset, size}; +use super::picture::{adjust, adjust_media, clear_lum, crop, original_media, recolor, relook, remove_background, reset, shape_size, size}; use super::select::{ - all_objects, alt_text, can_group, edit_obj, has_floating, has_group, has_movable, has_object, has_picture, has_placeable, has_shape, - has_shape_or_canvas, has_sizable, obj_size, objects_list, selected, with_float, with_obj, + all_objects, alt_text, can_group, edit_obj, has_any_movable, has_any_shape, has_floating, has_group, has_movable, has_object, has_picture, + has_placeable, has_shape, has_shape_or_canvas, has_sizable, is_shape_or_canvas, obj_size, objects_list, selected_or_text_box, target_objects, + with_float, with_floats_matching, with_movable_floats, with_obj, }; use super::shape::{NO_TEXT_BOX, can_link, has_text_box, link_text_box, set_text_body, shape_effects, text_box_target}; use super::{CmdError, CommandSpec, InlineObject, Pos, Rgb, Selection, Spin, TextVert, VAlign, Wrap, WrapText, json, p, sel_result}; use wordcraft_doc::picfx::PicFx; +fn run_rotation(s: &mut crate::Session, v: &serde_json::Value, pred: impl Fn(&InlineObject) -> bool) -> crate::CmdResult { + let deg = p::req_f32(v, "degrees")?; + let (fh, fv) = (p::bool(v, "flipH"), p::bool(v, "flipV")); + with_floats_matching(s, pred, |f| { + let cur = f.spin(); + f.set_spin(Spin::new(deg, fh.unwrap_or(cur.flip_h), fv.unwrap_or(cur.flip_v))); + }) +} + +/// Returns the section properties of the target object's anchor story (including text boxes anchored +/// in a later body section or header/footer), falling back to `page::sect`. +fn target_sect(s: &crate::Session) -> wordcraft_doc::SectionProps { + if let Some((pos, _)) = selected_or_text_box(s) { + let i = match pos.story { + wordcraft_doc::StoryRef::Body => s.doc.section_index_of(pos.path.0.first().copied().unwrap_or(0) as usize), + wordcraft_doc::StoryRef::Part(id) => crate::cmd::page::section_of_part(s, id), + }; + if let Some((_, sp)) = s.doc.sections().get(i) { + return (*sp).clone(); + } + } + crate::cmd::page::sect(s) +} + +/// Returns all command specifications for objects (pictures, shapes, text boxes, and drawing canvases). pub fn specs() -> Vec { vec![ CommandSpec::new("picture.size", "Size", "Picture Format › Size", size) @@ -186,20 +212,15 @@ pub fn specs() -> Vec { "right" => Spin::new(90.0, false, false), other => return Err(CmdError::Params(format!("unknown direction `{other}`"))), }; - with_float(s, |f| f.set_spin(f.spin().within(by))) + with_movable_floats(s, |f| f.set_spin(f.spin().within(by))) }) .params(r#"{"direction": "right|left|flipVertical|flipHorizontal"} (turns 90° or mirrors the selected picture, shape or text box; its pixels are kept)"#) - .when(has_movable), + .when(has_any_movable), CommandSpec::new("arrange.rotation", "Rotation", "Layout › Arrange", |s, v| { - let deg = p::req_f32(v, "degrees")?; - let (fh, fv) = (p::bool(v, "flipH"), p::bool(v, "flipV")); - with_float(s, |f| { - let cur = f.spin(); - f.set_spin(Spin::new(deg, fh.unwrap_or(cur.flip_h), fv.unwrap_or(cur.flip_v))); - }) + run_rotation(s, v, |o| !matches!(o, InlineObject::Graphic { .. }) && o.is_drawing()) }) .params(r#"{"degrees": number, "flipH"?: bool, "flipV"?: bool} (the exact angle, clockwise, of the selected picture, shape or text box; normalised to 0–360)"#) - .when(has_movable), + .when(has_any_movable), CommandSpec::new("arrange.wrap", "Wrap Text", "Layout › Arrange", |s, v| { let wrap: Wrap = serde_json::from_value(v.get("wrap").cloned().unwrap_or(json!("square"))).map_err(|e| CmdError::Params(e.to_string()))?; with_float(s, |f| f.wrap = wrap) @@ -219,8 +240,8 @@ pub fn specs() -> Vec { CommandSpec::new("arrange.position", "Position", "Layout › Arrange", |s, v| { let preset = p::str(v, "preset").unwrap_or("middleCenter").to_string(); let (x, y) = (p::f32(v, "x"), p::f32(v, "y")); - let sect = crate::cmd::page::sect(s); - let size = selected(s).map(|(_, o)| obj_size(&o)).unwrap_or((72.0, 72.0)); + let sect = target_sect(s); + let size = selected_or_text_box(s).map(|(_, o)| obj_size(&o)).unwrap_or((72.0, 72.0)); with_float(s, |f| { if f.wrap == Wrap::Inline { f.wrap = Wrap::Square; @@ -241,8 +262,8 @@ pub fn specs() -> Vec { CommandSpec::new("arrange.sendBackward", "Send Backward", "Layout › Arrange", |s, _| with_float(s, |f| f.wrap = Wrap::BehindText)).when(has_placeable), CommandSpec::new("arrange.align", "Align", "Layout › Arrange", |s, v| { let h = p::str(v, "value").unwrap_or("center").to_string(); - let tw = crate::cmd::page::sect(s).text_width(); - let w = selected(s).map(|(_, o)| obj_size(&o).0).unwrap_or(72.0); + let tw = target_sect(s).text_width(); + let w = selected_or_text_box(s).map(|(_, o)| obj_size(&o).0).unwrap_or(72.0); with_float(s, |f| { if f.wrap == Wrap::Inline { f.wrap = Wrap::Square; @@ -297,31 +318,91 @@ pub fn specs() -> Vec { .params(r#"{"index"?: n}"#) .pure(), CommandSpec::new("shape.outline", "Shape Outline", "Shape Format › Shape Styles", |s, v| { - let c = p::str(v, "color").and_then(Rgb::parse); - let w = p::f32(v, "width").map(|w| w.clamp(0.0, 72.0)); - with_obj(s, |o| { - if let InlineObject::Shape { stroke, stroke_width, extra, .. } = o { - *stroke = c; - // A colour chosen here replaces an outline gradient from a file. - extra.outline_fill = None; - if let Some(w) = w { - *stroke_width = w; - } - } else if let Some(style) = crate::cmd::canvas::style_mut(o) { - style.stroke = c; - if let Some(w) = w { - style.stroke_width = w; - } + let color = match v.get("color") { + None => None, + Some(serde_json::Value::Null) => Some(None), + Some(_) => { + let hex = p::str(v, "color") + .and_then(Rgb::parse) + .ok_or_else(|| CmdError::Params("`color`: \"RRGGBB\" or null".into()))?; + Some(Some(hex)) } - }) + }; + let w = p::f32(v, "width").map(|w| w.clamp(0.0, 72.0)); + let dash = match v.get("dash") { + None => None, + Some(val) => { + let d = val.as_str().ok_or_else(|| { + CmdError::Params( + "`dash`: \"solid|dot|dash|lgDash|dashDot|lgDashDot|lgDashDotDot|sysDash|sysDot|sysDashDot|sysDashDotDot\"".into(), + ) + })?; + let parsed = wordcraft_doc::line_dash::LineDash::from_ooxml(d); + if d != "solid" && parsed.is_solid() { + return Err(CmdError::Params(format!("unknown `dash` preset `{d}`"))); + } + Some(parsed) + } + }; + let cap = match v.get("cap") { + None => None, + Some(val) => { + let c = val.as_str().ok_or_else(|| CmdError::Params("`cap`: \"flat|rnd|sq\"".into()))?; + let parsed = wordcraft_doc::connector::LineCap::from_ooxml(c); + if c != "flat" && parsed.is_flat() { + return Err(CmdError::Params(format!("unknown `cap` style `{c}`"))); + } + Some(parsed) + } + }; + let targets = target_objects(s, is_shape_or_canvas); + if targets.is_empty() { + return Err(CmdError::Disabled("no shape selected".into())); + } + let mut last = serde_json::Value::Null; + for (pos, _) in &targets { + let o = edit_obj(s, pos, |o| { + if let InlineObject::Shape { stroke, stroke_width, extra, .. } = o { + if let Some(c) = color { + *stroke = c; + // A colour chosen here replaces an outline gradient from a file. + extra.outline_fill = None; + } + if let Some(w) = w { + *stroke_width = w; + } + if let Some(d) = dash.clone() { + extra.dash = d; + } + if let Some(cp) = cap { + extra.cap = cp; + } + } else if let Some(style) = crate::cmd::canvas::style_mut(o) { + if let Some(c) = color { + style.stroke = c; + } + if let Some(w) = w { + style.stroke_width = w; + } + } + })?; + last = serde_json::to_value(o).unwrap_or(serde_json::Value::Null); + } + Ok(json!({"object": last, "count": targets.len()})) }) - .params(r#"{"color": "RRGGBB" | null, "width"?: pt} (a selected drawing canvas: its border)"#) + .params(r#"{"color"?: "RRGGBB" | null, "width"?: pt, "dash"?: "solid|dot|dash|lgDash|dashDot|lgDashDot|lgDashDotDot|sysDash|sysDot|sysDashDot|sysDashDotDot", "cap"?: "flat|rnd|sq"} (a selected drawing canvas: its border)"#) .when(has_shape_or_canvas), + CommandSpec::new("shape.size", "Size", "Shape Format › Size", shape_size) + .params(r#"{"width"?: pt, "height"?: pt, "lockAspect"?: bool, "scale"?: percent} (resizes the selected shapes, text boxes, and drawing canvases, or the active text box)"#) + .when(has_shape_or_canvas), + CommandSpec::new("shape.rotation", "Rotation", "Shape Format › Arrange", |s, v| run_rotation(s, v, is_shape_or_canvas)) + .params(r#"{"degrees": number, "flipH"?: bool, "flipV"?: bool} (rotates the selected shapes, text boxes, and drawing canvases, or the active text box)"#) + .when(has_shape_or_canvas), CommandSpec::new("shape.effects", "Shape Effects", "Shape Format › Shape Styles", shape_effects) .params( r#"{"shadow"?: preset|{"preset"?, "color"?: "RRGGBB", "transparency"?: %, "blur"?: pt, "distance"?: pt, "angle"?: deg}|null, "glow"?: pt|{"color"?: "RRGGBB", "size"?: pt, "transparency"?: %}|null, "softEdge"?: pt|null} (shadow presets: offsetBottomRight, offsetBottom, offsetBottomLeft, offsetRight, offsetCenter, offsetLeft, offsetTopRight, offsetTop, offsetTopLeft; an omitted key is left as it is; applies to every shape in the selection)"#, ) - .when(has_shape), + .when(has_any_shape), CommandSpec::new("shape.change", "Change Shape", "Shape Format › Insert Shapes", |s, v| { let kind: wordcraft_doc::para::ShapeKind = serde_json::from_value(v.get("kind").cloned().unwrap_or(json!("rectangle"))).map_err(|e| CmdError::Params(e.to_string()))?; with_obj(s, |o| { diff --git a/crates/engine/src/cmd/objects/tests.rs b/crates/engine/src/cmd/objects/tests.rs index 86a2018a98..e02555df8a 100644 --- a/crates/engine/src/cmd/objects/tests.rs +++ b/crates/engine/src/cmd/objects/tests.rs @@ -1797,3 +1797,451 @@ fn only_ink_members_pin_a_group() { } assert!(!holds_ink(&group), "a group of charts is not pinned"); } + +/// Issue #5896: shape.outline can remove the frame (color: null), change width without +/// erasing stroke color, set dash and cap, and acts on a text box while typing inside it. +#[test] +fn shape_outline_and_fill_on_text_box() { + let mut s = Session::new(wordcraft_doc::Document::new()); + s.run("insert.textBox", &json!({"text": "A text box with a frame"})).unwrap(); + // While typing inside the text box: + // 1. shape.outline with {"color": null} removes the frame (stroke is None). + s.run("shape.outline", &json!({"color": null})).unwrap(); + let (pos, _id) = text_box_target(&s).unwrap(); + let o = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let InlineObject::Shape { stroke, .. } = o else { panic!("{o:?}") }; + assert_eq!(*stroke, None, "frame removed"); + + // 2. shape.outline can restore the frame with color, width, dash and cap: + s.run("shape.outline", &json!({"color": "156082", "width": 1.5, "dash": "dash", "cap": "rnd"})).unwrap(); + let o = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let InlineObject::Shape { stroke, stroke_width, extra, .. } = o else { panic!("{o:?}") }; + assert_eq!(*stroke, Some(Rgb(0x15, 0x60, 0x82))); + assert_eq!(*stroke_width, 1.5); + assert_eq!(extra.dash, wordcraft_doc::line_dash::LineDash::Dash); + assert_eq!(extra.cap, wordcraft_doc::connector::LineCap::Round); + + // 3. Changing only the width preserves the stroke color: + s.run("shape.outline", &json!({"width": 3.0})).unwrap(); + let o = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let InlineObject::Shape { stroke, stroke_width, .. } = o else { panic!("{o:?}") }; + assert_eq!(*stroke, Some(Rgb(0x15, 0x60, 0x82)), "color kept when width changed"); + assert_eq!(*stroke_width, 3.0); + + // 4. Malformed non-null colors are rejected before mutation: + assert!(matches!(s.run("shape.outline", &json!({"color": 123})), Err(CmdError::Params(_)))); + assert!(matches!(s.run("shape.outline", &json!({"color": "not-a-hex"})), Err(CmdError::Params(_)))); + let o = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let InlineObject::Shape { stroke, .. } = o else { panic!("{o:?}") }; + assert_eq!(*stroke, Some(Rgb(0x15, 0x60, 0x82)), "color preserved on error"); + + // 5. Unlocked size edits preserve the other dimension: + s.run("picture.size", &json!({"width": 100.0, "height": 80.0, "lockAspect": false})).unwrap(); + s.run("picture.size", &json!({"width": 250.0, "lockAspect": false})).unwrap(); + let o = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let (w, h) = obj_size(o); + assert_eq!((w, h), (250.0, 80.0), "height preserved on width edit"); + + s.run("picture.size", &json!({"height": 150.0, "lockAspect": false})).unwrap(); + let o = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let (w, h) = obj_size(o); + assert_eq!((w, h), (250.0, 150.0), "width preserved on height edit"); + + // 6. shape.effects targets the active text box when typing inside it: + s.run("shape.effects", &json!({"shadow": "offsetBottomRight"})).unwrap(); + let o = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let InlineObject::Shape { effects, .. } = o else { panic!("{o:?}") }; + assert!(effects.shadow.is_some(), "shadow applied to text box"); + + // 7. arrange.bounds targets the active text box when typing inside it: + let caret_sel = s.sel.clone(); + s.run("arrange.bounds", &json!({"width": 300.0, "height": 180.0})).unwrap(); + let o = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let (w, h) = obj_size(o); + assert_eq!((w, h), (300.0, 180.0), "bounds applied to active text box"); + + // Restore typing caret inside text box so selected(&s) is None: + s.sel = caret_sel.clone(); + assert!(selected(&s).is_none(), "caret is inside text box, no outer object selected"); + + // arrange.moveWithText targets the active text box once it is floating: + assert!(s.run("arrange.moveWithText", &json!({"value": true})).is_err(), "inline text box cannot move with text"); + s.run("arrange.wrap", &json!({"wrap": "square"})).unwrap(); + s.sel = caret_sel; + assert!(selected(&s).is_none(), "caret restored inside text box"); + s.run("arrange.moveWithText", &json!({"value": false})).unwrap(); + let o = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let (_, _, float) = o.frame().unwrap(); + assert_eq!(float.v_rel, wordcraft_doc::para::Anchor::Page, "moveWithText targets active floating text box"); + + // 8. When a picture is selected, shape.fill, shape.effects, and shape.outline do not target the text box: + let data = super::super::insert::base64_encode(&png(10, 10)); + s.run("insert.picture", &json!({"data": data})).unwrap(); + assert!(matches!(s.run("shape.fill", &json!({"color": "FF0000"})), Err(CmdError::Disabled(_)))); + assert!(matches!(s.run("shape.effects", &json!({"shadow": "none"})), Err(CmdError::Disabled(_)))); + assert!(matches!(s.run("shape.outline", &json!({"color": "FF0000"})), Err(CmdError::Disabled(_)))); + + // 9. fit_size normalizes NaN and clamps below 1 pt to 1 pt: + assert_eq!(super::picture::fit_size(f32::NAN, 0.0, false), (1.0, 1.0)); + assert_eq!(super::picture::fit_size(-50.0, 0.0, false), (1.0, 1.0)); +} + +/// Issue #5896: `arrange.align` and `arrange.position` use the active text box's own +/// dimensions when invoked from a typing caret inside it, matching explicit object selection. +#[test] +fn arrange_align_and_position_on_active_text_box() { + let mut s = Session::new(wordcraft_doc::Document::new()); + s.run("insert.textBox", &json!({"text": "Sized text box"})).unwrap(); + let caret_sel = s.sel.clone(); + let (pos, _) = text_box_target(&s).unwrap(); + s.run("picture.size", &json!({"width": 250.0, "height": 140.0, "lockAspect": false})).unwrap(); + + let float_xy = |s: &Session| { + let o = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let (_, _, f) = o.frame().unwrap(); + (f.x, f.y) + }; + + for value in ["center", "right"] { + s.run("select.objects", &json!({"index": 0})).unwrap(); + s.run("arrange.align", &json!({"value": "left"})).unwrap(); + s.run("arrange.align", &json!({"value": value})).unwrap(); + let from_selected = float_xy(&s).0; + + s.sel = caret_sel.clone(); + assert!(selected(&s).is_none(), "caret inside text box for align {value}"); + s.run("arrange.align", &json!({"value": "left"})).unwrap(); + s.run("arrange.align", &json!({"value": value})).unwrap(); + let from_caret = float_xy(&s).0; + assert_eq!(from_caret, from_selected, "align {value} matches explicit selection"); + } + + for preset in ["middleCenter", "bottomRight"] { + s.run("select.objects", &json!({"index": 0})).unwrap(); + s.run("arrange.position", &json!({"preset": "topLeft"})).unwrap(); + s.run("arrange.position", &json!({"preset": preset})).unwrap(); + let from_selected = float_xy(&s); + + s.sel = caret_sel.clone(); + assert!(selected(&s).is_none(), "caret inside text box for position {preset}"); + s.run("arrange.position", &json!({"preset": "topLeft"})).unwrap(); + s.run("arrange.position", &json!({"preset": preset})).unwrap(); + let from_caret = float_xy(&s); + assert_eq!(from_caret, from_selected, "position {preset} matches explicit selection"); + } +} + +/// Issue #5896 P2: typing inside a canvas text box routes Fill, Outline, Effects, Size, and +/// Rotation to that text box member (leaving the canvas and siblings untouched), keeps +/// canvas-owned placement commands disabled, and keeps commands disabled inside a regular group. +#[test] +fn typing_in_canvas_text_box_formats_member_not_canvas() { + let mut s = Session::new(wordcraft_doc::Document::new()); + s.run("insert.canvas", &json!({"width": 400, "height": 300, "fill": "FFF2CC", "outline": "1F4E79"})).unwrap(); + s.run("insert.shape", &json!({"kind": "rectangle", "width": 100, "height": 40})).unwrap(); + s.run("select.objects", &json!({"index": 0})).unwrap(); + let tb_res = s.run("insert.textBox", &json!({"text": "Canvas note"})).unwrap(); + let tb_id = tb_res["story"].as_u64().unwrap() as u32; + assert_eq!(s.sel.focus.story, StoryRef::Part(tb_id)); + assert!(selected(&s).is_none()); + assert!(crate::cmd::canvas::selected_member(&s).is_none()); + + s.run("shape.fill", &json!({"color": "FF0000"})).unwrap(); + s.run("shape.outline", &json!({"color": null})).unwrap(); + let canvas_mid = all_objects(&s).into_iter().next().unwrap().1; + let InlineObject::Group { children: mid_children, .. } = &canvas_mid else { panic!("{canvas_mid:?}") }; + assert!(matches!(&mid_children[1].obj, InlineObject::Shape { stroke: None, .. })); + assert_eq!(canvas_mid.canvas_style().and_then(|st| st.stroke), Rgb::parse("1F4E79")); + + s.run("shape.outline", &json!({"color": "00AA00", "width": 2.0, "dash": "dash", "cap": "rnd"})).unwrap(); + s.run("shape.effects", &json!({"shadow": "offsetBottomRight"})).unwrap(); + s.run("picture.size", &json!({"width": 180.0, "height": 90.0, "lockAspect": false})).unwrap(); + s.run("arrange.rotation", &json!({"degrees": 15.0})).unwrap(); + + let canvas = all_objects(&s).into_iter().next().unwrap().1; + let InlineObject::Group { w: cw, h: ch, float: cf, children, canvas: Some(style), .. } = &canvas else { + panic!("expected canvas: {canvas:?}"); + }; + assert_eq!((*cw, *ch, cf.spin().deg), (400.0, 300.0, 0.0)); + assert_eq!(style.fill, Rgb::parse("FFF2CC").map(wordcraft_doc::fill::Fill::solid)); + assert_eq!(style.stroke, Rgb::parse("1F4E79")); + assert_eq!(style.stroke_width, 0.75); + + assert_eq!(obj_size(&children[0].obj), (100.0, 40.0), "sibling shape size untouched"); + let InlineObject::Shape { effects: sib_fx, .. } = &children[0].obj else { panic!() }; + assert!(sib_fx.shadow.is_none(), "sibling shape effects untouched"); + + let InlineObject::Shape { w, h, fill, stroke, stroke_width, float, effects, extra, story, .. } = &children[1].obj else { + panic!("expected text box member"); + }; + assert_eq!(*story, Some(tb_id)); + assert_eq!((*w, *h), (180.0, 90.0)); + assert_eq!(*fill, Rgb::parse("FF0000").map(wordcraft_doc::fill::Fill::solid)); + assert_eq!(*stroke, Rgb::parse("00AA00")); + assert_eq!(*stroke_width, 2.0); + assert_eq!(extra.dash, wordcraft_doc::line_dash::LineDash::Dash); + assert_eq!(extra.cap, wordcraft_doc::connector::LineCap::Round); + assert!(effects.shadow.is_some()); + assert_eq!(float.spin().deg, 15.0); + + for (cmd, params) in [ + ("arrange.wrap", json!({"wrap": "square"})), + ("arrange.align", json!({"value": "center"})), + ("arrange.position", json!({"preset": "middleCenter"})), + ("arrange.moveWithText", json!({"value": true})), + ("arrange.copyTo", json!({"x": 50.0, "y": 50.0})), + ] { + assert!(matches!(s.run(cmd, ¶ms), Err(CmdError::Disabled(_))), "{cmd} stays disabled for canvas member"); + } + + // Regular group: typing inside a grouped text box leaves shape commands disabled without modifying the group. + let mut g = Session::new(wordcraft_doc::Document::new()); + g.run("insert.shape", &json!({"kind": "rectangle"})).unwrap(); + g.run("arrange.wrap", &json!({"wrap": "square"})).unwrap(); + g.sel = Selection::caret(g.doc.end_of(StoryRef::Body)); + let grouped_tb_id = g.run("insert.textBox", &json!({"text": "Grouped note"})).unwrap()["story"].as_u64().unwrap() as u32; + g.run("arrange.wrap", &json!({"wrap": "square"})).unwrap(); + g.run("select.objects", &json!({"index": 0})).unwrap(); + g.run("select.addObject", &json!({"index": 1})).unwrap(); + g.run("arrange.group", &json!({})).unwrap(); + g.sel = Selection::caret(g.doc.end_of(StoryRef::Part(grouped_tb_id))); + let before_group = all_objects(&g).into_iter().next().unwrap().1; + for (cmd, params) in [ + ("shape.fill", json!({"color": "FF0000"})), + ("shape.outline", json!({"color": null})), + ("shape.effects", json!({"shadow": "offsetBottomRight"})), + ("picture.size", json!({"width": 180.0, "lockAspect": false})), + ("arrange.rotation", json!({"degrees": 15.0})), + ] { + assert!(matches!(g.run(cmd, ¶ms), Err(CmdError::Disabled(_))), "{cmd} disabled inside regular group"); + } + assert_eq!(all_objects(&g).into_iter().next().unwrap().1, before_group); +} + +/// Issue #5896: `shape.outline` rejects unknown or non-string `dash` and `cap` parameters +/// instead of silently falling back to Solid / Flat. +#[test] +fn shape_outline_rejects_unknown_dash_and_cap() { + let mut s = Session::new(wordcraft_doc::Document::new()); + s.run("insert.shape", &json!({"kind": "rectangle"})).unwrap(); + s.run("shape.outline", &json!({"color": "156082", "width": 2.0, "dash": "dash", "cap": "rnd"})).unwrap(); + + for bad in + [json!({"cap": "round"}), json!({"dash": "dotted"}), json!({"cap": 42}), json!({"dash": false}), json!({"dash": null}), json!({"cap": null})] + { + assert!(matches!(s.run("shape.outline", &bad), Err(CmdError::Params(_))), "expected Params error for {bad}"); + } + + let (_, o) = selected(&s).unwrap(); + let InlineObject::Shape { stroke, stroke_width, extra, .. } = o else { panic!("{o:?}") }; + assert_eq!(stroke, Rgb::parse("156082")); + assert_eq!(stroke_width, 2.0); + assert_eq!(extra.dash, wordcraft_doc::line_dash::LineDash::Dash); + assert_eq!(extra.cap, wordcraft_doc::connector::LineCap::Round); +} + +/// Issue #5896: with multiple shapes selected, Line and Layout commands update every selected target. +#[test] +fn multi_shape_selection_updates_outline_and_layout_on_all() { + let mut s = Session::new(wordcraft_doc::Document::new()); + let id0 = s.run("insert.textBox", &json!({"text": "First", "width": 120.0, "height": 60.0})).unwrap()["story"].as_u64().unwrap() as u32; + s.run("arrange.wrap", &json!({"wrap": "square"})).unwrap(); + s.sel = Selection::caret(s.doc.end_of(StoryRef::Body)); + let id1 = s.run("insert.textBox", &json!({"text": "Second", "width": 200.0, "height": 90.0})).unwrap()["story"].as_u64().unwrap() as u32; + s.run("arrange.wrap", &json!({"wrap": "square"})).unwrap(); + + s.run("select.objects", &json!({"index": 0})).unwrap(); + s.run("select.addObject", &json!({"index": 1})).unwrap(); + + s.run("shape.outline", &json!({"color": "156082", "width": 2.5, "dash": "lgDash", "cap": "sq"})).unwrap(); + s.run("picture.size", &json!({"width": 160.0, "lockAspect": false})).unwrap(); + s.run("arrange.rotation", &json!({"degrees": 30.0})).unwrap(); + s.run("shape.alignText", &json!({"anchor": "ctr"})).unwrap(); + s.run("shape.textDirection", &json!({"dir": "vert"})).unwrap(); + assert_eq!(picked_objects(&s).len(), 2, "multi-selection preserved across formatting and layout"); + + let objs = all_objects(&s); + assert_eq!(objs.len(), 2); + for (idx, ((_, o), expected_h)) in objs.iter().zip([60.0, 90.0]).enumerate() { + let InlineObject::Shape { w, h, stroke, stroke_width, float, extra, .. } = o else { panic!("{o:?}") }; + assert_eq!((*w, *h), (160.0, expected_h), "box {idx} kept its own height"); + assert_eq!(*stroke, Rgb::parse("156082"), "box {idx} stroke"); + assert_eq!(*stroke_width, 2.5, "box {idx} stroke width"); + assert_eq!(extra.dash, wordcraft_doc::line_dash::LineDash::LongDash, "box {idx} dash"); + assert_eq!(extra.cap, wordcraft_doc::connector::LineCap::Square, "box {idx} cap"); + assert_eq!(float.spin().deg, 30.0, "box {idx} rotation"); + } + for id in [id0, id1] { + let body = s.doc.parts.get(&id).unwrap().body; + assert_eq!(body.anchor, VAlign::Center); + assert_eq!(body.vert, TextVert::Vert); + } + + s.run("shape.outline", &json!({"color": null})).unwrap(); + for (_, o) in all_objects(&s) { + let InlineObject::Shape { stroke, .. } = o else { panic!("{o:?}") }; + assert_eq!(stroke, None); + } +} + +/// Issue #5896: "No line", dash preset, and line cap set via `shape.outline` survive a DOCX save/open round trip. +#[test] +fn shape_outline_no_line_dash_and_cap_round_trip_docx() { + let mut s = Session::new(wordcraft_doc::Document::new()); + s.run("insert.textBox", &json!({"text": "Borderless"})).unwrap(); + s.run("shape.outline", &json!({"color": null})).unwrap(); + + s.sel = Selection::caret(s.doc.end_of(StoryRef::Body)); + s.run("insert.shape", &json!({"kind": "rectangle"})).unwrap(); + s.run("shape.outline", &json!({"color": "156082", "width": 2.25, "dash": "dashDot", "cap": "rnd"})).unwrap(); + + s.sel = Selection::caret(s.doc.end_of(StoryRef::Body)); + s.run("insert.shape", &json!({"kind": "ellipse"})).unwrap(); + s.run("shape.outline", &json!({"color": "C00000", "width": 1.5, "dash": "sysDot", "cap": "sq"})).unwrap(); + + let bytes = crate::io::save_bytes("out.docx", &s.doc).unwrap(); + let mut s2 = Session::new(wordcraft_doc::Document::new()); + s2.run("file.open", &json!({"path": "out.docx", "data": crate::cmd::insert::base64_encode(&bytes)})).unwrap(); + + let objs = all_objects(&s2); + assert_eq!(objs.len(), 3); + let InlineObject::Shape { stroke: tb_stroke, story, .. } = &objs[0].1 else { panic!("{:?}", objs[0]) }; + assert!(story.is_some()); + assert_eq!(*tb_stroke, None, "No line preserved through DOCX round trip"); + + let InlineObject::Shape { stroke, stroke_width, extra, .. } = &objs[1].1 else { panic!("{:?}", objs[1]) }; + assert_eq!(*stroke, Rgb::parse("156082")); + assert!((*stroke_width - 2.25).abs() < 0.05, "width {stroke_width}"); + assert_eq!(extra.dash, wordcraft_doc::line_dash::LineDash::DashDot); + assert_eq!(extra.cap, wordcraft_doc::connector::LineCap::Round); + + let InlineObject::Shape { stroke, stroke_width, extra, .. } = &objs[2].1 else { panic!("{:?}", objs[2]) }; + assert_eq!(*stroke, Rgb::parse("C00000")); + assert!((*stroke_width - 1.5).abs() < 0.05, "width {stroke_width}"); + assert_eq!(extra.dash, wordcraft_doc::line_dash::LineDash::SystemDot); + assert_eq!(extra.cap, wordcraft_doc::connector::LineCap::Square); +} + +/// Issue #5896: mixed multi-selections enable `shape.fill`, `shape.outline`, `shape.effects`, +/// `shape.alignText`, and `shape.textDirection` whenever at least one selected target matches. +#[test] +fn mixed_object_multi_selection_enables_shape_and_text_box_commands() { + // Picture selected first + rectangle added via select.addObject. + let mut s = Session::new(wordcraft_doc::Document::new()); + let data = super::super::insert::base64_encode(&png(12, 12)); + s.run("insert.picture", &json!({"data": data, "width": 60})).unwrap(); + s.sel = Selection::caret(s.doc.end_of(StoryRef::Body)); + s.run("insert.shape", &json!({"kind": "rectangle"})).unwrap(); + s.run("select.objects", &json!({"index": 0})).unwrap(); + s.run("select.addObject", &json!({"index": 1})).unwrap(); + + s.run("shape.fill", &json!({"color": "00AA00"})).unwrap(); + s.run("shape.outline", &json!({"color": "FF0000", "dash": "dash"})).unwrap(); + s.run("shape.effects", &json!({"shadow": "offsetBottomRight"})).unwrap(); + assert!(matches!(s.run("shape.alignText", &json!({"anchor": "b"})), Err(CmdError::Disabled(_)))); + assert!(matches!(s.run("shape.textDirection", &json!({"dir": "vert"})), Err(CmdError::Disabled(_)))); + + let objs = all_objects(&s); + assert!(matches!(&objs[0].1, InlineObject::Image { .. })); + let InlineObject::Shape { fill, stroke, effects, extra, .. } = &objs[1].1 else { panic!("{:?}", objs[1]) }; + assert_eq!(*fill, Rgb::parse("00AA00").map(wordcraft_doc::fill::Fill::solid)); + assert_eq!(*stroke, Rgb::parse("FF0000")); + assert_eq!(extra.dash, wordcraft_doc::line_dash::LineDash::Dash); + assert!(effects.shadow.is_some()); + + // Plain shape selected first + text box added via select.addObject. + let mut s2 = Session::new(wordcraft_doc::Document::new()); + s2.run("insert.shape", &json!({"kind": "rectangle"})).unwrap(); + s2.sel = Selection::caret(s2.doc.end_of(StoryRef::Body)); + let tb_id = s2.run("insert.textBox", &json!({"text": "Mixed box"})).unwrap()["story"].as_u64().unwrap() as u32; + s2.run("select.objects", &json!({"index": 0})).unwrap(); + s2.run("select.addObject", &json!({"index": 1})).unwrap(); + + s2.run("shape.alignText", &json!({"anchor": "b"})).unwrap(); + s2.run("shape.textDirection", &json!({"dir": "vert270"})).unwrap(); + let body = s2.doc.parts.get(&tb_id).unwrap().body; + assert_eq!(body.anchor, VAlign::Bottom); + assert_eq!(body.vert, TextVert::Vert270); +} + +/// Issue #5896: `arrange.align` and `arrange.position` inside an active text box anchored in +/// a later section use that anchor section's margins rather than section 0's. +#[test] +fn arrange_align_and_position_use_text_box_anchor_section() { + let mut s = Session::new(wordcraft_doc::Document::new()); + s.run("layout.break", &json!({"kind": "nextPage"})).unwrap(); + s.run("layout.margins", &json!({"left": 144.0, "right": 144.0})).unwrap(); + let sect1_tw = crate::cmd::page::sect(&s).text_width(); + let sect0_tw = s.doc.sections()[0].1.text_width(); + assert!(sect1_tw < sect0_tw, "section 1 has narrower text area"); + + s.run("insert.textBox", &json!({"text": "Section 1 box", "width": 100.0, "height": 50.0})).unwrap(); + s.run("arrange.align", &json!({"value": "right"})).unwrap(); + let (pos, o) = selected_or_text_box(&s).unwrap(); + let (_, _, f) = o.frame().unwrap(); + assert!((f.x - (sect1_tw - 100.0)).abs() < 0.01, "aligned to section 1 right margin ({} vs {})", f.x, sect1_tw - 100.0); + + s.run("arrange.position", &json!({"preset": "topRight"})).unwrap(); + let o2 = s.doc.para_at(&pos).unwrap().object_at(pos.off).unwrap(); + let (_, _, f2) = o2.frame().unwrap(); + assert!((f2.x - (sect1_tw - 100.0)).abs() < 0.01, "positioned to section 1 right margin ({} vs {})", f2.x, sect1_tw - 100.0); +} + +/// Issue #5896: bulk rotation commands stay enabled when a chart is primary selection and a +/// movable shape is added via `select.addObject`. +#[test] +fn chart_primary_with_added_shape_allows_rotation() { + let mut s = Session::new(wordcraft_doc::Document::new()); + s.run("insert.chart", &json!({"type": "column"})).unwrap(); + s.sel = Selection::caret(s.doc.end_of(StoryRef::Body)); + s.run("insert.shape", &json!({"kind": "rectangle"})).unwrap(); + s.run("select.objects", &json!({"index": 0})).unwrap(); + s.run("select.addObject", &json!({"index": 1})).unwrap(); + + s.run("arrange.rotation", &json!({"degrees": 45.0})).unwrap(); + s.run("arrange.rotate", &json!({"direction": "right"})).unwrap(); + let objs = all_objects(&s); + let (_, _, chart_f) = objs[0].1.frame().unwrap(); + let (_, _, shape_f) = objs[1].1.frame().unwrap(); + assert_eq!(chart_f.spin().deg, 0.0); + assert_eq!(shape_f.spin().deg, 135.0); +} + +/// Issue #5896: `shape.size` and `shape.rotation` only change shapes/canvases in a mixed +/// Picture + Chart + Shape selection, while generic `picture.size` keeps resizing all targets. +#[test] +fn shape_size_and_rotation_only_affect_shapes_in_mixed_selection() { + let mut s = Session::new(wordcraft_doc::Document::new()); + let data = super::super::insert::base64_encode(&png(12, 12)); + s.run("insert.picture", &json!({"data": data})).unwrap(); + s.run("picture.size", &json!({"width": 60.0, "height": 40.0, "lockAspect": false})).unwrap(); + s.run("arrange.rotation", &json!({"degrees": 10.0})).unwrap(); + s.sel = Selection::caret(s.doc.end_of(StoryRef::Body)); + s.run("insert.chart", &json!({"type": "column"})).unwrap(); + let (chart_w0, chart_h0, _) = all_objects(&s)[1].1.frame().unwrap(); + s.sel = Selection::caret(s.doc.end_of(StoryRef::Body)); + s.run("insert.shape", &json!({"kind": "rectangle", "width": 150.0, "height": 80.0})).unwrap(); + + s.run("select.objects", &json!({"index": 0})).unwrap(); + s.run("select.addObject", &json!({"index": 1})).unwrap(); + s.run("select.addObject", &json!({"index": 2})).unwrap(); + + s.run("shape.size", &json!({"width": 210.0, "lockAspect": false})).unwrap(); + s.run("shape.rotation", &json!({"degrees": 45.0})).unwrap(); + assert_eq!(picked_objects(&s).len(), 3, "multi-selection preserved across shape.size and shape.rotation"); + + let objs = all_objects(&s); + let (pw, ph, pf) = objs[0].1.frame().unwrap(); + assert_eq!((pw, ph, pf.spin().deg), (60.0, 40.0, 10.0), "picture untouched by shape.size/rotation"); + let (cw, ch, _) = objs[1].1.frame().unwrap(); + assert_eq!((cw, ch), (chart_w0, chart_h0), "chart untouched by shape.size"); + let (sw, sh, sf) = objs[2].1.frame().unwrap(); + assert_eq!((sw, sh, sf.spin().deg), (210.0, 80.0, 45.0), "shape updated"); + + // Generic picture.size continues to resize every sizable object in the selection. + s.run("picture.size", &json!({"width": 180.0, "lockAspect": false})).unwrap(); + let objs2 = all_objects(&s); + assert_eq!(objs2[0].1.frame().unwrap().0, 180.0); + assert_eq!(objs2[1].1.frame().unwrap().0, 180.0); + assert_eq!(objs2[2].1.frame().unwrap().0, 180.0); +} diff --git a/crates/engine/src/cmd/page.rs b/crates/engine/src/cmd/page.rs index 29bbc37765..87f766869e 100644 --- a/crates/engine/src/cmd/page.rs +++ b/crates/engine/src/cmd/page.rs @@ -224,7 +224,7 @@ fn manual_hyphenation(s: &mut Session, v: &Value) -> CmdResult { Ok(best.map(|(_, v)| v).unwrap_or_else(|| json!({"done": true}))) } -fn section_of_part(s: &Session, id: u32) -> usize { +pub(crate) fn section_of_part(s: &Session, id: u32) -> usize { let sections = s.doc.sections(); for (i, (_, sp)) in sections.iter().enumerate() { if [sp.headers.default, sp.headers.first, sp.headers.even, sp.footers.default, sp.footers.first, sp.footers.even].contains(&Some(id)) { @@ -250,6 +250,26 @@ pub fn section_index_of_focus(s: &Session) -> usize { } } +/// The caret's section, for the header and footer commands. In a header or footer it is the +/// section of the caret's page when that page shows it: a section linked to the previous one +/// shows that section's header, so the header alone names the earlier section (#3639). +pub fn hf_section_of_focus(s: &mut Session) -> usize { + let wordcraft_doc::StoryRef::Part(id) = s.sel.focus.story else { return section_index_of_focus(s) }; + let layout = s.layout(); + match layout.pages.get(s.page_hint) { + Some(pg) if pg.header_story == Some(id) || pg.footer_story == Some(id) => pg.section, + _ => section_of_part(s, id), + } +} + +/// The last body block of the caret's section ([`hf_section_of_focus`]), the block +/// [`wordcraft_doc::Document::section_mut`] takes. In a header or footer the caret's block index +/// counts that story's paragraphs, not the body's, so it would name another section (#3639). +pub fn section_end_of_focus(s: &mut Session) -> usize { + let i = hf_section_of_focus(s); + s.doc.sections().get(i).map(|(end, _)| *end).unwrap_or(0) +} + pub fn sect(s: &Session) -> SectionProps { let i = section_index_of_focus(s); s.doc.sections().get(i).map(|(_, x)| (*x).clone()).unwrap_or_default() diff --git a/crates/engine/src/cmd/para.rs b/crates/engine/src/cmd/para.rs index 2f60046cad..1feecb1bda 100644 --- a/crates/engine/src/cmd/para.rs +++ b/crates/engine/src/cmd/para.rs @@ -200,7 +200,7 @@ pub fn specs() -> Vec { r#"{"color": "RRGGBB" | null, "paragraph"?: bool} (text selected inside one paragraph is shaded itself, as in Word; `paragraph: true` shades the paragraphs instead, as Borders and Shading › Apply to: Paragraph)"#, ), CommandSpec::new("para.borders", "Borders", "Home › Paragraph", borders).params( - r#"{"kind": "bottom|top|left|right|none|all|outside|inside|horizontalLine", "width"?: pt, "color"?: "RRGGBB", "style"?: "single|double|dotted|dashed|thick|triple|dotDash|wave", "sides"?: Sides} where Sides = {"top"|"left"|"bottom"|"right"|"between": {"style"?, "width"?: pt, "color"?: "RRGGBB"} | null}: exactly these sides (others off), instead of `kind`"#, + r#"{"kind": "bottom|top|left|right|none|all|outside|inside|horizontalLine", "width"?: pt, "color"?: "RRGGBB", "style"?: "single|double|dotted|dashed|thick|triple|dotDash|wave", "sides"?: Sides} where Sides = {"top"|"left"|"bottom"|"right"|"between": {"style"?, "width"?: pt, "color"?: "RRGGBB"} | null}: exactly these sides (others off), instead of `kind` (with whole table cells selected, `kind` borders the cells as a block instead of their paragraphs)"#, ), CommandSpec::new("para.sort", "Sort", "Home › Paragraph", sort).params(r#"{"descending"?: bool}"#), CommandSpec::new("para.keepNext", "Keep with Next", "Home › Paragraph › Line and Page Breaks", |s, v| tog(s, v, |p| p.keep_next, |p, b| p.keep_next = Some(b))) @@ -304,7 +304,7 @@ pub fn specs() -> Vec { /// start, so all of a paragraph's text is still text, except in the last paragraph of its story, /// cell or box, where it stands for the paragraph with its mark. A selected picture, shape or text /// box is its object character, not text (a field's object character is). -fn shades_text(s: &Session) -> bool { +pub fn shades_text(s: &Session) -> bool { let (a, b) = s.sel.ordered(); if a == b || a.story != b.story || a.path != b.path { return false; diff --git a/crates/engine/src/cmd/para/format.rs b/crates/engine/src/cmd/para/format.rs index bddf6bf73c..51c5a4600c 100644 --- a/crates/engine/src/cmd/para/format.rs +++ b/crates/engine/src/cmd/para/format.rs @@ -144,6 +144,21 @@ pub(super) fn set_props(s: &mut Session, v: &Value) -> CmdResult { para.props.indent_right = Some(x); } para.touch(); + // An indent given in points wins over one in characters, the paragraph's own or its + // style's, unless `props` gives the characters too: Word's dialog writes + // `w:firstLineChars="0"` (and the like) for it. Paragraphs without one stay as they are. + let points = |pt: bool, chars: Option| pt && chars.is_none(); + let set = [ + points(props.indent_left.is_some() || start.is_some(), props.indent_left_chars), + points(props.indent_right.is_some() || end.is_some(), props.indent_right_chars), + points(props.indent_first.is_some(), props.indent_first_chars), + ]; + let Some(para) = s.doc.para(story, &path) else { continue }; + let chars = s.doc.styles.resolve_para(¶.props).indent_chars; + let [l, r, f] = [0, 1, 2].map(|i| set[i] && chars[i] != 0.0); + if l || r || f { + s.doc.para_mut(story, &path)?.props.cancel_char_indents(l, r, f); + } } sel_result(s) } diff --git a/crates/engine/src/cmd/para/styles.rs b/crates/engine/src/cmd/para/styles.rs index 95ea290340..d26137f7be 100644 --- a/crates/engine/src/cmd/para/styles.rs +++ b/crates/engine/src/cmd/para/styles.rs @@ -29,7 +29,6 @@ pub(super) fn apply_style(s: &mut Session, v: &Value) -> CmdResult { if kind == StyleKind::Character { return crate::cmd::format::apply(s, &|c| c.style = Some(id.clone())); } - let (a, b) = s.sel.ordered(); // A style linked to a list level (a heading in a numbered-headings list) brings its number. let numbered = s.doc.styles.resolve_para(&ParaProps { style: Some(id.clone()), ..Default::default() }).numbering.is_some(); fmt(s, &|p| { @@ -40,33 +39,114 @@ pub(super) fn apply_style(s: &mut Session, v: &Value) -> CmdResult { p.numbering = None; } })?; - // A paragraph style resets direct character formatting that matches nothing (Word keeps - // direct formatting unless it covers most of the paragraph; we clear font/size/colour). - if a.path == b.path || a == b { - let paths = s.doc.paths_between(&a, &b); - for path in paths { - let para = s.doc.para_mut(a.story, &path)?; - let len = para.len(); - para.format(0, len, &|c| { - c.font = None; - c.font_cs = None; - c.font_ea = None; - c.size = None; - c.size_cs = None; - c.color = None; - })?; - para.mark.font = None; - para.mark.font_cs = None; - para.mark.font_ea = None; - para.mark.size = None; - para.mark.size_cs = None; - para.mark.color = None; - } - } + reset_direct_formatting(s)?; s.pending = None; sel_result(s) } +/// A character property a paragraph style can reset: whether a run sets it directly, and how to +/// clear it. +type Reset = (fn(&CharProps) -> bool, fn(&mut CharProps)); + +/// The direct character formatting applying a paragraph style can reset, as observed in Word. +/// Word keeps highlight, superscript and subscript, scale, shading, borders, the underline's +/// colour, language, no-proof and the character style whatever they cover, so they are not here. +const RESETS: [Reset; 24] = [ + (|c| c.font.is_some(), |c| c.font = None), + (|c| c.font_cs.is_some(), |c| c.font_cs = None), + ( + |c| c.font_ea.is_some() || c.font_ea_theme.is_some(), + |c| { + c.font_ea = None; + c.font_ea_theme = None; + }, + ), + (|c| c.size.is_some(), |c| c.size = None), + (|c| c.size_cs.is_some(), |c| c.size_cs = None), + (|c| c.color.is_some(), |c| c.color = None), + (|c| c.bold.is_some(), |c| c.bold = None), + (|c| c.bold_cs.is_some(), |c| c.bold_cs = None), + (|c| c.italic.is_some(), |c| c.italic = None), + (|c| c.italic_cs.is_some(), |c| c.italic_cs = None), + (|c| c.underline.is_some(), |c| c.underline = None), + (|c| c.strike.is_some(), |c| c.strike = None), + (|c| c.double_strike.is_some(), |c| c.double_strike = None), + (|c| c.caps.is_some(), |c| c.caps = None), + (|c| c.small_caps.is_some(), |c| c.small_caps = None), + (|c| c.spacing.is_some(), |c| c.spacing = None), + (|c| c.position.is_some(), |c| c.position = None), + (|c| c.kern.is_some(), |c| c.kern = None), + (|c| c.hidden.is_some(), |c| c.hidden = None), + (|c| c.emboss.is_some(), |c| c.emboss = None), + (|c| c.engrave.is_some(), |c| c.engrave = None), + (|c| c.outline.is_some(), |c| c.outline = None), + (|c| c.shadow.is_some(), |c| c.shadow = None), + (|c| c.emphasis.is_some(), |c| c.emphasis = None), +]; + +/// Clear `resets` in `a..b` of `para` (bytes), and in its mark when `mark`. +fn clear_resets(para: &mut wordcraft_doc::Paragraph, a: usize, b: usize, mark: bool, resets: &[fn(&mut CharProps)]) -> Result<(), CmdError> { + if resets.is_empty() { + return Ok(()); + } + let reset = |c: &mut CharProps| { + for f in resets { + f(c); + } + }; + para.format(a, b, &reset)?; + if mark { + reset(&mut para.mark); + } + para.touch(); + Ok(()) +} + +/// What applying a paragraph style does to direct character formatting, as observed in Word: +/// - A caret, or a selection of a whole paragraph or of several paragraphs: the selection from its +/// start to the end of its first paragraph decides, the paragraph mark counted as one character +/// (the whole paragraph for a caret). Each property in [`RESETS`] set directly on at least half +/// of those characters is reset in every selected paragraph, text and mark. One set on less +/// stays everywhere, even where it covers a whole later paragraph. +/// - A selection inside one paragraph: only the selection loses that formatting. Outside it, +/// nothing changes, however much of the paragraph it covers. +fn reset_direct_formatting(s: &mut Session) -> Result<(), CmdError> { + let story = s.sel.focus.story; + let (a, b) = s.sel.ordered(); + let paths = crate::cmd::selected_paths(s); + let Some(first) = paths.first() else { return Ok(()) }; + let all: Vec = RESETS.iter().map(|(_, clear)| *clear).collect(); + if a != b && a.path == b.path && paths.len() == 1 { + let para = s.doc.para_mut(story, first)?; + let (from, to) = (para.clamp(a.off), para.clamp(b.off)); + if from > 0 || to < para.len() { + return clear_resets(para, from, to, false, &all); + } + } + // Characters of the first paragraph from `start`, the mark included, and how many of them set + // each property. + let para = s.doc.para(story, first).ok_or_else(|| CmdError::Failed("the selected paragraph is gone".into()))?; + let start = if a != b && a.path == *first { para.clamp(a.off) } else { 0 }; + let total = para.text.get(start..).map_or(0, |t| t.chars().count()).saturating_add(1); + let mut set = [0usize; RESETS.len()]; + let runs = para.run_ranges().map(|(r, c)| (para.text.get(r.start.max(start)..r.end.max(start)).map_or(0, |t| t.chars().count()), c)); + for (n, c) in runs.chain(std::iter::once((1, ¶.mark))) { + for (count, (has, _)) in set.iter_mut().zip(RESETS.iter()) { + if has(c) { + *count = count.saturating_add(n); + } + } + } + let reset: Vec = + set.iter().zip(RESETS.iter()).filter(|(count, _)| count.saturating_mul(2) >= total).map(|(_, (_, clear))| *clear).collect(); + for path in &paths { + let para = s.doc.para_mut(story, path)?; + let len = para.len(); + clear_resets(para, 0, len, true, &reset)?; + } + Ok(()) +} + pub(super) fn create_style(s: &mut Session, v: &Value) -> CmdResult { let name = p::req_str(v, "name")?.trim().to_string(); if name.is_empty() { diff --git a/crates/engine/src/cmd/para/tabs_borders.rs b/crates/engine/src/cmd/para/tabs_borders.rs index f4fb30e756..02405ea1b1 100644 --- a/crates/engine/src/cmd/para/tabs_borders.rs +++ b/crates/engine/src/cmd/para/tabs_borders.rs @@ -102,6 +102,10 @@ pub(super) fn borders(s: &mut Session, v: &Value) -> CmdResult { // A paragraph with a bottom border, like Word's Horizontal Line. return fmt(s, &|p| p.borders = Some(Borders { bottom: Some(Border { width: 1.5, ..b }), ..Default::default() })); } + // Whole table cells selected: the border goes on the cells, not their paragraphs (#7874). + if let Some(range) = s.cell_range().cloned() { + return crate::cmd::table::cell_block_borders(s, &range, kind, b); + } fmt(s, &|p| { let mut cur = p.borders.unwrap_or_default(); match kind { diff --git a/crates/engine/src/cmd/paste.rs b/crates/engine/src/cmd/paste.rs index 7a17688630..92024f6233 100644 --- a/crates/engine/src/cmd/paste.rs +++ b/crates/engine/src/cmd/paste.rs @@ -49,10 +49,12 @@ fn clip_text(s: &Session, v: &Value) -> Option { } } +/// Whether the string starts with an RTF file header. fn looks_like_rtf(t: &str) -> bool { t.trim_start().starts_with("{\\rtf") } +/// Whether the string looks like an HTML fragment. fn looks_like_html(t: &str) -> bool { let t = t.trim_start(); t.starts_with('<') && (t.contains("")) @@ -65,18 +67,53 @@ fn owns_clipboard(v: &Value) -> bool { p::bool(v, "privateClipboard").unwrap_or(true) } +/// Accommodate macOS arboard wrapping: `......`. +fn extract_body(html: &str) -> Option<&str> { + let lower = html.to_ascii_lowercase(); + let body_start = lower.find("')?; + let tag_end = body_start.checked_add(tag_end_rel)?.checked_add(1)?; + let end = lower.rfind("")?; + if tag_end <= end { html.get(tag_end..end) } else { None } +} + +/// Whether the supplied HTML string matches WordCraft's session clipboard HTML, +/// accounting for macOS arboard wrapping. +fn html_matches_clipboard(h: &str, clip: &str) -> bool { + if h == clip { + return true; + } + if clip.is_empty() { + return false; + } + extract_body(h).is_some_and(|body| body == clip || body.trim() == clip.trim()) +} + +/// Whether the clipboard payload matches WordCraft's session clipboard copy, so the session's +/// formatted fragment can be used. +pub(crate) fn matches_session_clipboard(s: &Session, v: &Value) -> bool { + let text = p::str(v, "text").map(|t| t.replace("\r\n", "\n")); + let html = p::str(v, "html"); + let rtf = p::str(v, "rtf"); + let has_rich = html.is_some_and(|h| !h.is_empty()) || rtf.is_some_and(|r| !r.is_empty()); + let html_matches = html.is_none_or(|h| html_matches_clipboard(h, &s.clipboard_html)); + let rtf_matches = rtf.is_none_or(|r| r == s.clipboard_rtf); + + owns_clipboard(v) + && s.clipboard.as_ref().is_some_and(|f| { + text.as_ref().is_none_or(|t| f.clipboard_text() == *t || (t.is_empty() && has_rich)) + && html_matches + && rtf_matches + && (text.is_some() || has_rich || (html.is_none() && rtf.is_none())) + }) +} + /// The source for a format, if the clipboard has it. fn source(s: &Session, v: &Value, fmt: &str) -> Option { let non_empty = |t: String| if t.is_empty() { None } else { Some(t) }; match fmt { - "formatted" if owns_clipboard(v) => { - let f = s.clipboard.as_ref()?; - // System clipboard text that isn't our own copy means someone else copied since. - match p::str(v, "text") { - Some(t) if f.clipboard_text() != t.replace("\r\n", "\n") => None, - _ => Some(String::new()), - } - } + "formatted" if matches_session_clipboard(s, v) => Some(String::new()), "formatted" => None, "rtf" => p::str(v, "rtf").map(str::to_string).or_else(|| clip_text(s, v).filter(|t| looks_like_rtf(t))).and_then(non_empty), "html" => p::str(v, "html").map(str::to_string).or_else(|| clip_text(s, v).filter(|t| looks_like_html(t))).and_then(non_empty), @@ -150,7 +187,7 @@ fn paste_special(s: &mut Session, v: &Value) -> CmdResult { return Ok(r); } "formatted" => s.clipboard.clone().ok_or_else(|| CmdError::Failed("the clipboard is empty".into()))?, - "html" => adopt(s, import_html(&src)), + "html" => adopt(s, import_html(&src).map_err(|e| CmdError::Failed(format!("bad HTML: {e}")))?), _ => adopt(s, wordcraft_formats::rtf::import(src.as_bytes()).map_err(|e| CmdError::Failed(format!("bad RTF: {e}")))?), }; insert(s, frag)?; @@ -167,8 +204,8 @@ const BLOCKQUOTE_INDENT: f32 = 36.0; /// (#1270): it pastes as a Normal paragraph indented by the page's `blockquote` margins, else half /// an inch each side, rather than in the (centred, italic) Quote style. Opening an .html file keeps /// `
` as Quote, so HTML round-trips. -fn import_html(html: &str) -> Document { - let mut doc = wordcraft_formats::html::import(html_fragment(html)); +fn import_html(html: &str) -> Result { + let mut doc = wordcraft_formats::html::import(html_fragment(html))?; let (left, right) = blockquote_margins(html); for b in &mut doc.body { each_para(Arc::make_mut(b), 0, &mut |p| { @@ -180,7 +217,7 @@ fn import_html(html: &str) -> Document { } }); } - doc + Ok(doc) } /// The left and right margins (points) the payload's `