Skip to content

Column sums: a plus or minus per row, and ink beside the column (#277) - #291

Open
Joost-8 wants to merge 1 commit into
mainfrom
claude/issue-277-column-sum-99bb3d
Open

Joost-8 wants to merge 1 commit into
mainfrom
claude/issue-277-column-sum-99bb3d

Conversation

@Joost-8

@Joost-8 Joost-8 commented Nov 21, 2026

Copy link
Copy Markdown
Owner

For #277

What changed

Column sums (src/model/column-sum.ts) settle more of the layout by geometry before Grape reads a row:

  • Plus signs. A plus (a short dash crossed by a short upright stroke; off centre is fine, as real ones are) is taken out of the row before Grape reads it, whether it is the amount's first or last mark, just left of it, or on a line of its own. Before, "+13" was read as "+ 13" and the card showed "?", and "+17" was read as "-117".
  • Minus signs. A minus on a line of its own applies to the row under it. A minus may be up to 1.6 digits wide (the reporter's was 1.46; the old limit was 1.2).
  • Ink beside the column. Only ink over the line makes rows. Ink beside the column (another sum, names) becomes a row's label (never read) or is ignored, so it can no longer split the column or end it early.
  • Rows one per ruled line. A row that lines up with the one under it (right edges within a digit) may sit up to 2.5 digits higher (was 1.6). The reporter's 13 and 18 rows were 1.61 digits apart. The digit height is now measured from ink near the line, not from everything above it on the page.
  • parseAmount accepts a leading "+".

Evidence

  • New fixture tests/ink/fixtures/column-sum-277.json: the reporter's ink traced from the issue's screenshots, with real pluses from Joost's iPad and Oskar's eval lines, rounded to whole px as iPadOS 17 records it. tests/model/column-sum-277.test.ts covers all three reported cases plus variants; 8 of its 9 tests fail on main.
  • Plus rule on the 246 real eval lines: 100 of 114 labelled pluses found; extra hits are t/f/F crossbars in prose, never digits. On Joost's iPad page it finds both pluses and none of the crossed 7s.
  • CI gates pass locally: lint, lint:review, lint:css, typecheck, test (9916 passed), build.

Not proven on an iPad

  • Not run on a device. The fixtures are traced from screenshots, so stroke order and shapes are approximate (fine for layout, poor for Grape). Grape's readings of the new rows were not checked on real ink.
  • The wider 2.5-digit row gap could pull a right-aligned line just above a column into it; it was not seen in the tests.

How to test (iPad)

  1. Write a column 230 / + 13 with the "+" left of 13, draw a line under both: the card should show 243.
  2. Write 18 / +17 with the "+" close to 17: the card should show 35, not −99.
  3. Write a sum (230 − 13, line, 217) and, to its right, 230 / − 13 / 18, one number per ruled line, then a line under it: the card should show 235.
  4. Write a "+" on its own line above a column, and a "−" on its own line between two rows: the plus changes nothing, the minus subtracts the row under it.

🤖 Generated with Claude Code

- A plus (a dash crossed by a short stem, off centre as real ones are) as
  the amount's first or last marks, just left of it, or on a line of its
  own is taken out before Grape reads the row: "+13" read as "+ 13" gave
  "?", and "+17" read as "-117".
- A minus on a line of its own belongs to the row under it; a minus may be
  1.6 digits wide (the reporter's was 1.46).
- Only ink over the line makes rows; ink beside the column (another sum)
  joins a row as its label or is ignored, so it never splits or ends it.
- Rows one per ruled line in a small hand: a row that lines up with the
  one under it may stand 2.5 digits off (was 1.6; the reporter's 13 and
  18 stood 1.61 apart). The digit height comes from ink near the line.
- parseAmount takes a leading "+".

Fixtures: the reporter's ink traced from his screenshots, with real
pluses from Joost's iPad and Oskar's eval lines, whole px (iPadOS 17).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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