Skip to content

fix(doc): preserve symbol checkbox states - #176

Open
HanZephyr wants to merge 1 commit into
firecrawl:mainfrom
HanZephyr:codex/fix-doc-symbol-checkboxes
Open

HanZephyr wants to merge 1 commit into
firecrawl:mainfrom
HanZephyr:codex/fix-doc-symbol-checkboxes

Conversation

@HanZephyr

@HanZephyr HanZephyr commented Sep 17, 2026

Copy link
Copy Markdown

Legacy DOC checkbox symbols stored as U+0028 plus sprmCSymbol currently become indistinguishable opening parentheses. Resolve the symbol font through SttbfFfn and emit Unicode unchecked/checked boxes for the supported Wingdings and Wingdings 2 glyphs. Character-run properties are applied before piece properties; unknown fonts or glyphs preserve the source character.

Eight synthetic in-memory DOC tests cover both fonts, private-use codes, ordinary Unicode/text, piece overrides, and malformed font tables. No application documents are included.

Validation: cargo fmt --all --check; workspace/all-target/all-feature Clippy; cargo test --locked (301 passed at initial run, plus the expanded 8-test symbol suite); Node build and 19 tests; Python wheel build and 11 tests; Wasm Clippy/build and 8 tests.

Format references: MS-DOC character properties, SttbfFfn.


Summary by cubic

Fixes legacy DOC symbol checkboxes so they no longer convert to plain parentheses. The converter now resolves the symbol font through SttbfFfn and emits Unicode □/☑ for supported Wingdings/Wingdings 2 glyphs; unsupported fonts or glyphs keep the original character.

Details

  • Piece symbol properties override character-run symbol properties.
  • Malformed or missing font tables fall back to the source text.
  • Synthetic DOC tests cover both fonts, private-use codes, overrides, and malformed tables.

Written for commit 6b6bd43. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Confidence score: 3/5

  • src/formats/doc/mod.rs: the symbol_at path skips symbols inherited from the active STSH or character style, leaving U+0028 unchanged and potentially producing incorrect document characters; resolve the style-chain symbol before applying CHPX and piece processing.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/formats/doc/mod.rs">

<violation number="1" location="src/formats/doc/mod.rs:799">
P2: When `sprmCSymbol` comes from the active STSH or character style, this branch leaves `U+0028` unchanged because `symbol_at` skips the style-chain symbol. Resolve the style-chain symbol before applying CHPX and piece properties.</violation>
</file>

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

Fix all with cubic | Re-trigger cubic

Comment thread src/formats/doc/mod.rs
c if c.is_control() => {}
c => {
let style = self.char_style(fc, i);
let c = if c == '(' { self.symbol_at(fc, i).unwrap_or(c) } else { c };

@cubic-dev-ai cubic-dev-ai Bot Sep 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: When sprmCSymbol comes from the active STSH or character style, this branch leaves U+0028 unchanged because symbol_at skips the style-chain symbol. Resolve the style-chain symbol before applying CHPX and piece properties.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/formats/doc/mod.rs, line 799:

<comment>When `sprmCSymbol` comes from the active STSH or character style, this branch leaves `U+0028` unchanged because `symbol_at` skips the style-chain symbol. Resolve the style-chain symbol before applying CHPX and piece properties.</comment>

<file context>
@@ -793,6 +796,7 @@ impl Assembler {
                 c if c.is_control() => {}
                 c => {
                     let style = self.char_style(fc, i);
+                    let c = if c == '(' { self.symbol_at(fc, i).unwrap_or(c) } else { c };
                     para.push_char(c, style);
                 }
</file context>
Fix with cubic

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing. I checked this against MS-DOC: section 2.9.336 prohibits UpxChpx from containing properties that are preserved across sprmCIstd. Section 2.6.1 explicitly includes the symbol state, font, and character code (sprmCSymbol) among those preserved properties. Therefore, a conforming paragraph or character style cannot define sprmCSymbol, and resolving it from CHPX followed by piece properties is intentional.

References:

Supporting a malformed document that places this property in a style would be a separate compatibility extension, rather than a missing step for conforming DOC files. I am leaving the implementation unchanged for this finding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant