fix(mobile): wrap Android source files when Word break is on - #10808
fix(mobile): wrap Android source files when Word break is on#10808siure wants to merge 3 commits into
Conversation
The native canvas cannot wrap, so Word break still clipped long lines. Fall back to the JS renderer and put flex-1 on a wrapping view so Android does not clip Text. Co-authored-by: Cursor <cursoragent@cursor.com>
Word break falls back to JavaScriptSourceFileSurface, which dropped onRefresh. Wire the same RefreshControl used by the native path. Co-authored-by: Cursor <cursoragent@cursor.com>
Wrapped lines cannot use getItemLayout, so scrollToIndex fails for targets outside the first window. Estimate an offset and retry. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe mobile source surface adds pull-to-refresh and scroll retry handling, updates highlighted-line layout, and routes word-break configurations to the JavaScript surface instead of the native surface. ChangesSource surface behavior
Priority: ⬇️ Low — Defer this Android source-file rendering fix because it narrowly improves word wrapping, refresh, and scroll retries in the mobile code viewer. Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Android source files with Word break enabled now use the wrapping JavaScript renderer, while refresh and line navigation behavior are retained. No concrete merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant RefreshControl
participant JavaScriptSourceFileSurface
participant onRefresh
RefreshControl->>JavaScriptSourceFileSurface: invoke handlePullToRefresh
JavaScriptSourceFileSurface->>onRefresh: await refresh callback
onRefresh-->>JavaScriptSourceFileSurface: resolve or reject
JavaScriptSourceFileSurface-->>RefreshControl: update isPullRefreshing
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Enabling Word break still clips long source lines on Android: current main selects the native canvas whenever it is available, even though it cannot wrap.
Use the JavaScript renderer when Word break is enabled and put the text inside a flexible View so Android wraps it correctly. Preserve pull-to-refresh and retry line jumps when wrapped rows have not been measured yet.
Replaces #6647, which was closed during the backlog sweep as already fixed. The fix is still missing from main; this branch is rebased onto current main.
Validation: the author confirmed wrapping works on their Android phone using a standalone APK with T3 Connect. Mobile typecheck and four focused source-file tests pass. The Android release build succeeded before the latest rebase; the source-viewer code is unchanged.
Before/after evidence from #6647:
Before: https://github.com/user-attachments/assets/acd9128e-f972-48a8-a773-985119fc44fe
Rebased and prepared with GPT-6 in Codex.
Summary by CodeRabbit
New Features
Bug Fixes