Fix overflow text disappearing on horizontal scroll#69
Conversation
When a cell contains long text that overflows into adjacent cells, scrolling right until the source cell leaves the viewport caused the overflowed text to vanish. The overflow detection loop only examined cells inside the visible column range, so off-screen anchors were never recorded. Extend the overflow scan 20 columns to the left of the viewport and add a supplementary render pass (3b) that draws text from off-screen anchor cells whose overflow reaches into the visible area. Co-Authored-By: Claude Opus 4.6 <[email protected]>
📝 WalkthroughWalkthroughModified text overflow detection in grid canvas rendering to start earlier horizontally and added a new render pass (Pass 3b) to handle overflow anchors positioned left of the visible viewport whose text spans into the displayed range. The change extends overflow text rendering logic while maintaining style resolution. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Verification: verify:selfResult: ✅ PASS in 88.9s
Verification: verify:integrationResult: ✅ PASS |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/sheets/src/view/gridcanvas.ts`:
- Around line 485-493: Replace the fixed 20-column lookback when computing
overflowColStart with a leftward scan from colStart - 1 until you hit the first
blocking anchor (a non-empty cell, a merged cell boundary, or a visible border)
and use that column as overflowColStart before calling
buildTextOverflowRenderData; update the logic in gridcanvas (around
overflowColStart / buildTextOverflowRenderData usage) to iterate leftward
checking cell content, merge metadata and border flags instead of using
Math.max(1, colStart - 20) so off-screen anchors are found correctly regardless
of column widths or hidden columns.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ef383dd1-0fbb-4fdd-af13-6608e06700b0
📒 Files selected for processing (1)
packages/sheets/src/view/gridcanvas.ts
| // Extend the overflow detection range to the left so that text from | ||
| // off-screen cells that overflows into the visible area is still drawn. | ||
| const overflowColStart = Math.max(1, colStart - 20); | ||
| const overflowData = this.buildTextOverflowRenderData( | ||
| ctx, | ||
| rowStart, | ||
| rowEnd, | ||
| colStart, | ||
| overflowColStart, | ||
| colEnd, |
There was a problem hiding this comment.
The 20-column lookback is still a correctness cap.
A value can legitimately overflow through more than 20 logical columns, especially with narrow or hidden columns, so anchors farther left will still disappear once scrolled past. Instead of a fixed lookback, consider walking left from colStart - 1 until you hit the first blocker (content, merge, or border) and using that as the only possible off-screen anchor.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/sheets/src/view/gridcanvas.ts` around lines 485 - 493, Replace the
fixed 20-column lookback when computing overflowColStart with a leftward scan
from colStart - 1 until you hit the first blocking anchor (a non-empty cell, a
merged cell boundary, or a visible border) and use that column as
overflowColStart before calling buildTextOverflowRenderData; update the logic in
gridcanvas (around overflowColStart / buildTextOverflowRenderData usage) to
iterate leftward checking cell content, merge metadata and border flags instead
of using Math.max(1, colStart - 20) so off-screen anchors are found correctly
regardless of column widths or hidden columns.
Summary
buildTextOverflowRenderDataTest plan
pnpm verify:fastpasses (confirmed)🤖 Generated with Claude Code
Summary by CodeRabbit