Add \cancel family (PR 2/2): render the strike overlay#260
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for strikeout and cancel styles (such as \cancel, \bcancel, \xcancel, and \sout) by introducing strikeStyle, strikeThickness, and strikeVerticalOffset properties to MTMathListDisplay. It implements the drawing logic for these strike styles in MTMathListDisplay's draw method, updates the typesetter to initialize these properties, and adds comprehensive unit tests to verify their metrics, edge cases, and drawing behavior. No review comments were provided, so there is no additional feedback to address.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
✅ Verification update: the PR 2 test suite has now been run green. All 8 cancel tests (5 new PR 2 tests + 3 PR 1 tests) pass on this branch with 0 failures: Command: targeted The "not verified locally" caveat in the PR description is now resolved — the earlier gap was purely a CI/subagent watchdog issue, not a code problem. |
Code review — PR 2/2: render the strike overlayReviewed by careful code-read against the plan ( Verdict: looks correct and merge-ready pending an actual green test run. No blocking issues found. Correctness — verified against LLD §3.4
Tests — should compile and pass
Non-blocking observations
Ask before mergeRun the five new tests ( Static review only; not an approval. |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dfedd5f to
048c957
Compare
The cancel-family draw path built its diagonal geometry inline in -draw:, so no test could assert the actual endpoints — a swapped forward/backward diagonal would pass testCancelDrawDoesNotCrash (XCTAssertNoThrow only). Extract the geometry into -strikeSegmentPoints (a flat pairwise list of absolute endpoints) and have -draw: build its path from it, so the drawn stroke and the tested geometry share one source of truth. Add testCancelStrokeDirection pinning the exact endpoints for forward/backward/ cross/horizontal. Verified by mutation: swapping the forward diagonal fails the new test on start.y/end.y. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Goal
MTMathBoxDisplaydraws the selected stroke(s) over the child in the current text color at the fraction-bar thickness, adding no width/ascent/descent. The typesetter passes the two font-derived scalars (strikeThickness = fractionRuleThickness,strikeVerticalOffset = 0.55·accentBaseHeight). Metrics of a cancel equal its bare argument.This is PR 2 of 2, stacked on PR 1 (#259).
Commits
[item 4]Draw cancel-family strike overlay inMTMathBoxDisplay(initializer params + stores,-draw:overlay for all four strike styles, typesetter call site)[item 5]Add cancel-family edge-case and draw-path testsStack
Design docs
docs/plans/2026-07-12-cancel.mddocs/lld/2026-07-04-cancel.mdThe implementation matches the plan exactly and builds on PR 1's model/parse layer (which passed the full 369-test suite). However, the PR 2 test suite could not be run locally: four verification subagents failed on environment issues (xcodebuild's silent build phase repeatedly tripped a 600s no-progress watchdog; SPM/connection also dropped). The two commits were finalized by the orchestrator from plan-exact work-in-progress, but the five new tests (
testCancelStrikeDisplay,testCancelMetricsMatchArgument,testCancelScriptsCompose,testCancelEdgeCases,testCancelDrawDoesNotCrash) have not been executed green. Please verify via CI or a localxcodebuild test/swift testrun before merging.🤖 Generated with Claude Code