Skip to content

Fix overflow text disappearing on horizontal scroll#69

Merged
hackerwins merged 1 commit into
mainfrom
fix/text-overflow-on-horizontal-scroll
Mar 23, 2026
Merged

Fix overflow text disappearing on horizontal scroll#69
hackerwins merged 1 commit into
mainfrom
fix/text-overflow-on-horizontal-scroll

Conversation

@hackerwins

@hackerwins hackerwins commented Mar 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 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
  • Extended overflow detection range 20 columns to the left of the viewport in buildTextOverflowRenderData
  • Added supplementary render pass (3b) that draws text from off-screen anchor cells whose overflow reaches into the visible area

Test plan

  • Enter long text in A1 that overflows into B1, C1
  • Scroll right until A1 is off-screen — verify overflowed text in B1/C1 still renders
  • Test with freeze panes active (frozen columns + horizontal scroll)
  • Verify pnpm verify:fast passes (confirmed)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved text overflow detection to identify overflow scenarios earlier in the rendering process.
    • Enhanced rendering of text that extends beyond cell boundaries, especially when originating from cells outside the currently visible area.

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]>
@coderabbitai

coderabbitai Bot commented Mar 22, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Modified 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

Cohort / File(s) Summary
Text Overflow Rendering Enhancement
packages/sheets/src/view/gridcanvas.ts
Extended text overflow detection by shifting column start calculation (overflowColStart = Math.max(1, colStart - 20)). Added Pass 3b render pass to draw overflow anchors positioned left of colStart when their computed endCol spans into the visible viewport. Calls renderCellContent with explicit overflowEndCol and mergeSpan parameters.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A canvas redrawn with care so keen,
Overflow text now perfectly seen,
Pass 3b hops where anchors hide left,
Viewport gaps filled, no detail bereft!
Thirty lines dancing, rendering refined. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix overflow text disappearing on horizontal scroll' clearly and directly summarizes the main bug fix in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/text-overflow-on-horizontal-scroll

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

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

@github-actions

github-actions Bot commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Verification: verify:self

Result: ✅ PASS in 88.9s

Lane Status Duration
sheets:build ✅ pass 12.6s
verify:fast ✅ pass 43.8s
frontend:build ✅ pass 12.1s
verify:frontend:chunks ✅ pass 0.3s
backend:build ✅ pass 4.0s
cli:build ✅ pass 1.6s
verify:entropy ✅ pass 14.5s

Verification: verify:integration

Result: ✅ PASS

@coderabbitai coderabbitai 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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 999540b and a3f4c58.

📒 Files selected for processing (1)
  • packages/sheets/src/view/gridcanvas.ts

Comment on lines +485 to 493
// 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.

@hackerwins
hackerwins merged commit cf0e97f into main Mar 23, 2026
3 checks passed
@hackerwins
hackerwins deleted the fix/text-overflow-on-horizontal-scroll branch March 23, 2026 23:50
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