Commit Graph
3352 Commits
Author SHA1 Message Date
vangel76 2f46f194a1 render: count legacy effect copies past the glyph box, not the glyph's antialiasing
The grey band 120-136 also holds the glyph's own antialiasing pixels on
the vertical stem edges; on platforms with many of them (FreeBSD's
Mesa AA), their centroid sits at the glyph centre and hides the copy's
offset in x (0.95 instead of ~6). The copy is drawn fully past the
glyph's bounding box in its own direction, so count grey only outside
the box in the copy's quadrant. Fixes the FreeBSD failure of #2783.
2026-10-21 23:48:49 +02:00
Martin BallandClaude Opus 5.5 7d453e7217 #3243: File › Recover follows the app theme (#3435)
The Recover page forced a black fill and white text whatever the theme. It now uses the same fills and text colours as the other Backstage pages.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 17:47:38 -04:00
vangel76 a4572e5376 fmt: rustfmt equation array centring 2026-10-21 23:24:05 +02:00
vangel76 6bc7810c8c fmt: rustfmt backstage recent list 2026-10-21 23:23:44 +02:00
dmim2502-commitsandClaude Opus 5.5 40ae6ac08c proof: drop U+FE0F from FORBIDDENWORD and NOSUGGEST flags too
Review follow-up: the directives that name one flag read the same emoji
form, so they now skip the variation selector like PFX/SFX and stem flags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 16:21:24 -05:00
Dylan M. Taylor ba145e9405 security: enforce HTTPS on curl downloads (SonarCloud S6506)
Add --proto '=https' to curl invocations so redirects cannot downgrade to
plaintext HTTP. Resolves SonarCloud S6506 (shell/docker/githubactions).
2026-10-21 17:07:24 -04:00
Dylan M. Taylor 955d268dc9 ci: pin GitHub Actions to full commit SHA (SonarCloud githubactions:S7637)
Pin third-party actions to full-length commit SHAs (with version comments)
instead of mutable tags/branches to prevent supply-chain tampering via
retagged releases. Resolves SonarCloud rule githubactions:S7637.
2026-10-21 17:04:23 -04:00
Divyanshu Gupta f996654264 fix(engine): do not treat decimal points as sentence boundaries in Sentence case
In crates/engine/src/cmd/format.rs, convert_chars treated any period as a sentence boundary, causing numbers with decimal points (e.g. 3.14, 2.5) to capitalize the subsequent word in Sentence case.

Check if a period is surrounded by ASCII digits, and do not trigger uppercase capitalization when encountering a decimal point.

Closes #3485
2026-10-22 01:56:09 +05:30
Divyanshu Gupta 4f924ca518 fix(engine): allow leading underscore for hidden bookmarks in name validation 2026-10-22 01:49:33 +05:30
Dylan M. Taylor f7d7c0288c ci: add sonar-project.properties for CI-based analysis
Marks the project ineligible for SonarCloud Automatic Analysis, resolving the
CI-vs-automatic-analysis conflict so the SonarCloud workflow succeeds.
2026-10-21 16:00:51 -04:00
Dylan M. Taylor e65d188747 ci: add SonarCloud scan via shared reusable workflow
Calls storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main
with secrets: inherit. Adds SonarCloud badge to README where missing and
removes the redundant sonar-project.properties (config now passed by the
reusable workflow).
2026-10-21 15:47:09 -04:00
Divyanshu Gupta c5de19a287 fix(engine, layout): invalidate layout cache on filename change and unify untitled fallback 2026-10-22 01:01:54 +05:30
Divyanshu Gupta 05827d20fc fix(engine): validate bookmark names by character count and character classes
In bookmark_name_ok, validate length by Unicode character count (at most 40 characters) rather than byte count, require an initial alphabetic letter, and restrict characters to alphanumeric and underscore.

Closes #3491
2026-10-22 00:12:31 +05:30
vangel76andClaude Sonnet 5.5 d8f459e70c Equation arrays: a row without & wider than the aligned columns widens the array and never goes left of the origin
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 20:38:19 +02:00
vangel76andClaude Sonnet 5.5 852ae36d08 Reject of a style change restores only the recorded properties; reader takes the old id from the style
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 20:35:20 +02:00
Divyanshu Gupta 084b76d9de fix(engine): preserve existing table cell margins when side is omitted
In table.cellMargins, resolve existing margins from the table, its style, or defaults and only overwrite the sides explicitly provided in the command parameters.

Closes #3490
2026-10-22 00:04:20 +05:30
vangel76andClaude Sonnet 5.5 be26db3545 Restore ROADMAP.md; Romanian Undo reads Anulare acțiune
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 20:26:36 +02:00
vangel76andClaude Sonnet 5.5 f9c6ddba3a fix(ui): show the Remove x on a hovered recent row, not only on the x itself (#2716)
The x was painted only while the pointer was already on the 28 pt button, so a
hovered row gave no cue that a per-row Remove exists. Paint it dimmed when the
row (or the button) is hovered or focused, with the stronger fill only on the x.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 20:23:29 +02:00
Divyanshu Gupta 034e083f58 test(ui): restrict AltGr Ctrl+Alt+Q regression test to non-macOS platforms
On macOS, AltGr does not produce Ctrl+Alt and Command-Q is the native application close chord. Restrict the Windows/Linux AltGr Q regression test to non-macOS platforms as requested by review, preserving the existing macOS Command-Q close test coverage (#3424).
2026-10-21 23:34:15 +05:30
SlavenDj 6c26714802 Pad hh on the 12-hour date clock (#3487)
Word's lowercase hh instruction shows a leading zero, just like HH.
Single-digit 12-hour values now format as 05 rather than 5.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-10-21 20:01:04 +02:00
SlavenDj fb588fcd46 Accept uppercase D and Y in date pictures (#3486)
Word's date-time instructions accept either case for day and year.
Uppercase codes now format instead of being copied literally.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-10-21 19:56:50 +02:00
OPUZZLES 5886e12ac1 fix(engine): respect list levels and inherited styles (#3459) 2026-10-21 19:40:59 +02:00
dmim2502-commits fd91a78e71 contributors: add dmim2502-commits (display name Mulai) 2026-10-21 12:27:16 -05:00
dmim2502-commitsandClaude Opus 5.5 6328b25209 proof: emoji flags followed by U+FE0F load (RLA-ES Spanish)
RLA-ES, the Spanish Hunspell dictionaries in LibreOffice and most Linux
distributions, writes one flag as U+260E followed by U+FE0F, in the rules
(PFX ☎️ Y 3) and on stems (banco/S☎️). parse_aff rejected it as "not one
character", so the whole dictionary failed to load. The variation selector
is now dropped wherever flags are read, with a regression test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 12:27:06 -05:00
OPUZZLES f5d3ea818c fix(engine): toggle off style-inherited lists (#3459) 2026-10-21 19:08:16 +02:00
Sazid Al Bayazid a3a573cdd6 UI: the ribbon's font and size boxes say what they are to a screen reader (#3172)
The font name box and the font size box announced themselves as bare "edit"
controls, and the dropdown arrows beside them as bare "button" controls: a screen
reader had nothing to say about them.

The combo helper names its field with the hint it already shows, and its arrow
with the same "{name} options" the split buttons' arrow uses; the split button's
arrow now says whose options it opens. No new strings: every name is one the
widget already shows.

Measured the way #3172 measured it — every keyboard-focusable element of the
Home tab and its name: 43 of the 111 had no name before, 31 after.
2026-10-21 22:42:21 +06:00
Divyanshu Gupta 93dc6000f9 fix(engine, layout): evaluate FILENAME field and support \p switch
Fixes #3449
2026-10-21 22:10:54 +05:30
Divyanshu Gupta e9c0def9bf fix(ui): preserve Ctrl+Alt+Q and allow typing @ on German layout
Ensure Ctrl+Alt+Q (German shortcut for @, or AltGr+Q) is not treated as a command shortcut or default quit shortcut, preventing unexpected app closure and allowing the @ symbol to be typed.

Fixes #3424
2026-10-21 21:12:02 +05:30
Mat Strangeandopencode 63e794716b Pin the parts of the package too
The body of the document part is pinned, so the writer's output is compared
byte for byte; the parts of the package are pinned as well, so a part that is
added or lost shows up here too.

Co-Authored-By: opencode <noreply@opencode.ai>
2026-10-21 16:15:46 +01:00
Mat Strangeandopencode 658e13e9ca Pin the document body the writer writes, byte for byte
The test that the controls are written where they were counted the controls
and looked at the paragraphs they were in, so a change in the order or the
place of a control's markers inside a paragraph would have passed it.

The writer's output for a document with two inline controls in one paragraph
and a control around a paragraph is now pinned: the body of the document part,
byte for byte. The golden was taken from the writer before it was made faster,
so it says that the faster writer writes the same thing. It has teeth: a
writer that returns a paragraph's markers in the opposite order fails it.

Co-Authored-By: opencode <noreply@opencode.ai>
2026-10-21 16:06:16 +01:00
Divyanshu Gupta a8ba49e68b fix(docx): preserve East Asian language w:eastAsia on w:lang
Preserve w:lang/@w:eastAsia when reading and writing DOCX documents.
Previously, only w:val and w:bidi were handled, causing w:eastAsia to be
dropped on save.

Fixes #3457
2026-10-21 20:13:15 +05:30
Divyanshu Gupta bfb81b72eb fix(sheet/xls): track substream depth and support CONTINUE records on formula strings 2026-10-21 20:00:37 +05:30
Bortlesboat f6c69172cc contributors: add my name 2026-10-21 10:15:12 -04:00
Dominik StrebelandClaude Opus 5.5 318e7cc315 Layout: superscript and subscript lines are as tall as full-size text
Word sizes a superscript or subscript's line at the full font size and
leaves out the vertical alignment's raise or drop; a w:position raise or
lowering still grows the line. WordCraft added the drop to the line's
descent and used the shrunk size, so lines with a subscript came out taller
and lines of sub/superscript alone shorter than Word's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 16:14:45 +02:00
Midasdf 1678d93f54 #1681: ruby review follow-ups — tracked ODT ruby, HTML start space, docs
- ODT export reads the tracked insertion/deletion from a Ruby inline's formatting
  too (Item::marks and the paragraph's tracked check): an inserted or deleted
  phonetic guide keeps its change range around the base text instead of being
  written as untracked text.
- HTML export computes the paragraph-start state before the ruby's formatting tags,
  so a leading space in the base text becomes &nbsp; instead of a space HTML can
  collapse.
- docs/file-format-parity.md: restore main's format rows (the PR had replaced them
  with stale copies that lost ODT keep-with-next #2813, TXT #2853 and the HTML
  blockquote/MathML details) and add the ruby sentence to the retained .htm/.html
  row; restore the rolled-back header change list.
- docs/localization-parity.md: restore the header change list; date the new
  revision-history rows 2026-10-21.
- Tests: html_ruby_at_the_paragraph_start_keeps_a_leading_space and
  an_inserted_ruby_keeps_its_tracked_insertion.

Validation: cargo fmt --all -- --check; cargo clippy -p wordcraft-formats
--all-targets -- -D warnings; cargo test -p wordcraft-formats -> 204 passed,
0 failed (doctests 0).
2026-10-21 22:41:05 +09:00
Midasdf cc724045dd #1653: review follow-ups — BOM, streamed runs, consolidated docs
- Create the East Asian decoder without BOM handling: the code page is named by
  \ansicpg, \cpg or \fcharset, so a GBK/Big5/UHC run that starts EF BB BF is text,
  not a UTF-8 BOM that switches the rest of the document to UTF-8 (#2549 review).
- Decode raw 8-bit runs through the streaming decoder in one pass instead of one
  byte at a time: ASCII body text in a Japanese/Chinese/Korean document and picture
  hex skip the per-byte path, and a single \'hh byte decodes into a stack buffer
  (no String allocation per byte). Picture hex no longer goes through the code page
  decoder at all.
- Decode loop: decode_to_string writes only into spare capacity, so drain the stack
  buffer and keep decoding until the run is consumed (the old one-call version could
  truncate a run longer than the reserved capacity).
- docs/file-format-parity.md: keep main's format rows (the PR had replaced them with
  stale copies that lost ODT keep-with-next #2813, TXT #2853 and the HTML blockquote
  and MathML details), merge the East Asian sentence into the one RTF row — which also
  removes the duplicate RTF row main carries and restores "export writes every
  section" and the tracked paragraph-mark wording — restore the rolled-back header
  change list, and date the new revision row 2026-10-21.

Validation: cargo fmt --all -- --check; cargo clippy -p wordcraft-formats -p wordcraft-doc
--all-targets -- -D warnings; cargo test -p wordcraft-formats -p wordcraft-doc
→ 200 + 174 passed, 0 failed (doctests 0).
2026-10-21 22:38:07 +09:00
Bortlesboat 51c1847b61 Navigation pane: numbered headings show their list number (#3418) 2026-10-21 09:29:37 -04:00
Divyanshu Gupta 22ae9e8961 fix(docbin): preserve external URLs with sublocations in doc hyperlink fields 2026-10-21 18:59:30 +05:30
Divyanshu Gupta b333885228 fix(formats): support 4/8-digit hex, space-separated rgb and hsl in parse_color 2026-10-21 18:52:08 +05:30
Divyanshu Gupta c60d9df0c3 fix(formats): support table cell vertical alignment in rtf, html, and odt 2026-10-21 18:35:08 +05:30
SofiaAFigueredoandClaude Sonnet 5 56f56f4735 Test: a unique scratch dir, not a reused pid
CodeRabbit catch on PR #3434: a_failed_save_leaves_the_save_stamps_untouched
named its scratch directory by pid alone and removed it on a pre-existing
path, which (if that path somehow already existed) could delete content the
test never created. Matching the pid+nanos pattern already used elsewhere
(backstage.rs's recovery tests): the name is unique enough that there's
nothing to pre-clean, and `dir` itself stays uncreated, which is what makes
the write fail.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 09:54:12 -03:00
SofiaAFigueredoandClaude Sonnet 5 6b66f88f7c file.save: don't stamp the document when the write fails
CodeRabbit catch on PR #3434: stamp_save() ran before the fallible
save_path_with(), so a failed write (no permission, disk full, a bad
path) still bumped the document's modified time, revision, author and
zoom, as if it had actually been saved. A later successful save would
then persist those stale stamps for a write that never happened.

Snapshot the stamped fields before stamp_save() and restore them if
save_path_with() errors, before propagating the failure.

Added a_failed_save_leaves_the_save_stamps_untouched in
crates/engine/src/tests.rs. cargo test -p wordcraft-engine --lib: 789
passed. clippy -p wordcraft-engine --lib --tests -D warnings: clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 09:39:54 -03:00
Gabriel Matozo 37809cf380 List labels: a right-to-left label mirrors its brackets (#2916)
A list label is shaped with `Dir::Guess`, so a label of digits and brackets has
no run the shaper sees as right to left; the clusters were then reordered for
the right-to-left paragraph and the brackets drawn unmirrored, so "(%1)" came
out ")1(", as #2916 reports.

The label is shaped with the bidi levels of its own text now, as the paragraph
body and the atomic objects already are, so UAX #9 L4 mirrors the brackets of
the runs the levels report as right to left; the visual reorder the paragraph
direction asks for stays. A "1." label is unchanged.
2026-10-21 09:33:05 -03:00
SofiaAFigueredoandClaude Sonnet 5 83771b147e Test: a failed AutoSave-switch Save As stays silent-free too
CodeRabbit nitpick on PR #3434: the AutoSave switch's own Save As
(chrome.rs, clicked while blocked on Unsaved) runs the same
AfterPick::SaveAs arm under AfterSave::AutoSave instead of
AfterSave::Nothing, and had no coverage of its own — a regression
removing fail_save_as from that arm would have passed the suite.

Added a_failed_autosave_switch_save_as_says_so_and_leaves_autosave_off,
asserting the failure reaches status_msg and AutoSave stays off
(autosaves(), not the raw autosave flag, which defaults to true and
isn't by itself what governs coverage).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 09:20:13 -03:00
Mat Strangeandopencode 3944664035 Record the content-control save fix in the progress documents
The repository's convention is that landed work updates the gap document, the
parity document and the progress log, with each touched document's status line
and revision history bumped. This does that for the fix in the commit before:

- docs/file-format-parity.md: a section says what saving many content
  controls costs, with the measurement before and after (32,000 controls:
  3.6 s -> 0.1 s), and names the tests.
- docs/gaps.md: gap 20 (performance on large real-world documents) is
  narrowed by it.
- ROADMAP.md: the progress log and its revision history gain the entry.

Fixes #3437.

Co-Authored-By: opencode <noreply@opencode.ai>
2026-10-21 13:12:40 +01:00
Mat Strangeandopencode 7f77660e03 A document with many content controls saves in the time they take
Saving a document with many content controls was quadratic in the number of
controls: 32,000 of them took four seconds to save, and doubling that took
four times as long again.

Two loops in the writer cost that. The plan that decides where each control
is written collects the inline markers of every control in one set, and then,
for each paragraph, looks for that paragraph's markers by filtering the whole
set — so one paragraph's answer costs the size of the document's marker set,
and the save costs paragraphs times markers. And to find the block-level
controls that clash, every control was compared with every other control.

The markers are now grouped by paragraph once, so a paragraph's markers are a
lookup, and the block-level controls are grouped by the block they end in,
each group keeping the two earliest closes, which answers the clash question
the same way in one sweep.

What is written does not change: the packages written for ten shapes of
control nesting — inline, around paragraphs, chained, nested — are byte for
byte the same as before.

Tests: crates/docx/tests/content_control_save_cost.rs. The two timing tests
fail without the fix (16.1x and 13.0x the time for four times the controls,
against a bound of 8.0) and pass with it (4.6x).

Fixes #3437.

Co-Authored-By: opencode <noreply@opencode.ai>
2026-10-21 13:12:36 +01:00
SofiaAFigueredoandClaude Sonnet 5 c329a3be0e Show a failed Save As on the Save As page itself
CodeRabbit caught it on PR #3434: self.status(...) alone is invisible
while Backstage is open, since its render loop skips the status bar
(only backstage::show runs). A failed Save As (no permission, disk
full, a bad path) left the Save As page sitting there with a Browse…
button and no explanation, same silent failure as before, just moved.

fail_save_as now also stores the message in the egui temp data
save_as_page reads and renders inline, cleared once File closes or a
later attempt actually saves. Replaced the status_msg-only regression
test with one that drives the real UI (Save > Save As page > Browse…
> a write that fails) and asserts the same text is rendered on the
page, not just sitting in status_msg.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 08:58:21 -03:00
SofiaAFigueredoandClaude Sonnet 5 85c72c2862 Save As no longer swallows a failed save silently
Backstage's File > Save (unnamed document) > Save As page > Browse…
flow, and AutoSave's own Save As, discarded the write error when
file.save failed (no permission, disk full, a bad path): the page
just sat there with nothing to explain why, and the document stayed
unsaved with no visible cause. The Save Changes prompt's own Save As
already surfaced its error; this brings the same handling to the
plain Save As path.

Added a regression test for the silent failure, and one exercising
the full Backstage Save > Save As page > Browse… flow with an
asynchronous native dialog answer end to end.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 08:31:13 -03:00
Nghiathan13andClaude Opus 5.5 67d21b0a68 #3415: banded rows shade the same rows in Word and WordCraft
Word reads a table style without w:tblStyleRowBandSize / w:tblStyleColBandSize
as bands of zero and leaves its banded rows and columns unshaded (MS-OE376
§2.7.5.7, MS-OI29500 §17.7.6.5); ECMA-376 says one, which is what we did. Our
writer only wrote a size a style set, and our built-in styles set none, so a
table in Grid Table 4 saved by WordCraft had shaded rows here and none in Word.

- An unset or zero band size now means no bands, as in Word. PartSet::of_cell
  takes row and column band sizes; column bands get a size of their own
  (col_band_size).
- Our banded built-in styles and new table styles set both sizes to one, and
  the writer writes them (and zero), so Word bands them too.
- The reader reads both sizes, zero included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 18:21:49 +07:00
rabisandClaude Opus 5.5 bfb9ecf948 #1899: a picture's wrap outline is placed where its crop window is drawn
The renderers draw a crop window whose edges fall within pixels (crop
fractions are f32 too: 0.7 is 0.69999...). The outline stretched the
whole pixels it covered over the frame instead, so a narrow window came
out up to a pixel too wide at each edge (a 2.5-5.5 px window put pixel 2
over a quarter of the picture, not a sixth), and a crop of 0.7 took in
the neighbouring column. Grid points now map through the window itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 13:11:12 +02:00