Skip to content

Fix cell line overlap and page-split text bleed#169

Merged
hackerwins merged 1 commit into
mainfrom
fix/cell-line-overlap-and-page-split-bleed
May 1, 2026
Merged

Fix cell line overlap and page-split text bleed#169
hackerwins merged 1 commit into
mainfrom
fix/cell-line-overlap-and-page-split-bleed

Conversation

@hackerwins

Copy link
Copy Markdown
Collaborator

Summary

Two rendering bugs that surfaced in DOCX-imported docs after #167 unified the cell paragraph layout with the body's layoutBlock. Both reproduce on the shared "지원서_양식" doc.

  • Cell line overlap. Cells store lineHeight: 0.7 for paragraphs imported from <w:spacing w:line="168"/> (docx-style-map divides by 240 unconditionally, ignoring lineRule). Unify cell paragraph layout with body layoutBlock #167 made cells honor block.style.lineHeight; with 0.7, line height drops below the font's pixel height and characters crash into the line below. Floor the multiplier at 1.0 in assignLineHeights. The DOCX lineRule mishandling is the deeper data bug — left as a follow-up.
  • Page-split text bleed. The cell text baseline used runLineY + line.height * 0.75. At tight line heights (≈ 1.0) that places the glyph ascent ~5% of fontSize above the line's declared top, so at a paginated row split the next page's first line bled a sliver into the previous page (and re-rendered fully on the next page). Switch to the centered baseline (line.height + fontSize * 0.8) / 2, matching the body path in doc-canvas and the list-marker path in the same file.

Test plan

  • pnpm verify:fast (627/627 tests pass, lint/typecheck clean)
  • New regression test floors cell paragraph lineHeight at 1.0 to prevent overlap
  • Visual: shared "지원서_양식" doc — "참고사항" cell shows each bullet on its own line
  • Visual: page 1 / page 2 boundary — lines no longer split or double-draw across the boundary

🤖 Generated with Claude Code

Two issues surfaced in DOCX-imported documents after #167 unified the
cell paragraph layout with the body's layoutBlock.

1. Cells with stored `lineHeight: 0.7` (planted by docx-style-map's
   unconditional `line / 240` mapping for `<w:spacing w:line=...>`
   regardless of `lineRule`) collapsed every line below the font's
   own pixel height once cells started honoring the value, so
   characters from adjacent lines overlapped. Floor the multiplier at
   1.0 inside `assignLineHeights` so a sub-1.0 value can never crash
   text into the line below. The DOCX `lineRule` mishandling is the
   underlying data bug; that import fix is left as a follow-up.

2. The cell text baseline used `runLineY + line.height * 0.75`, which
   places the glyph's ascent ~5% of the font size above the line's
   declared top whenever lineHeight is tight (≈ 1.0). At a paginated
   row split this leaked a sliver of the next page's first line into
   the previous page's clip region — the same line then rendered
   fully on the next page, producing a visible double-draw at the
   boundary. Switch to the centered formula already used by the body
   path in doc-canvas and the list-marker path in the same file:
   `(line.height + fontSize * 0.8) / 2`. The glyph ascent now sits
   inside the line box for any lineHeight ≥ 1.0, so the page-split
   clip cleanly excludes it.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@hackerwins has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 49 minutes and 50 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 826f7cca-d9cc-4b02-a3d7-40ee2ec2882f

📥 Commits

Reviewing files that changed from the base of the PR and between 5290548 and 14b61ef.

📒 Files selected for processing (3)
  • packages/docs/src/view/layout.ts
  • packages/docs/src/view/table-renderer.ts
  • packages/docs/test/view/table-layout.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cell-line-overlap-and-page-split-bleed

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 49 minutes and 50 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Verification: verify:self

Result: ✅ PASS in 121.6s

Lane Status Duration
sheets:build ✅ pass 13.1s
docs:build ✅ pass 8.3s
verify:fast ✅ pass 61.9s
frontend:build ✅ pass 15.8s
verify:frontend:chunks ✅ pass 0.3s
backend:build ✅ pass 4.8s
cli:build ✅ pass 1.8s
verify:entropy ✅ pass 15.6s

Verification: verify:integration

Result: ✅ PASS

@codecov

codecov Bot commented May 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hackerwins
hackerwins merged commit ea6acca into main May 1, 2026
4 checks passed
@hackerwins
hackerwins deleted the fix/cell-line-overlap-and-page-split-bleed branch May 1, 2026 04:13
@hackerwins hackerwins mentioned this pull request May 1, 2026
3 tasks
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