Skip to content

fix(mobile): wrap Android source files when Word break is on - #10808

Open
siure wants to merge 3 commits into
pingdotgg:mainfrom
siure:fix/mobile-source-word-break
Open

fix(mobile): wrap Android source files when Word break is on#10808
siure wants to merge 3 commits into
pingdotgg:mainfrom
siure:fix/mobile-source-word-break

Conversation

@siure

@siure siure commented Sep 8, 2026

Copy link
Copy Markdown

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

After: long source lines wrap with Word break enabled

Rebased and prepared with GPT-6 in Codex.

Summary by CodeRabbit

  • New Features

    • Added pull-to-refresh support when viewing JavaScript source files.
    • Improved navigation to selected code lines by automatically retrying when scrolling initially fails.
  • Bug Fixes

    • Improved code readability with more reliable word wrapping and line alignment.
    • Ensured files use the appropriate viewer when word wrapping is enabled, providing a more consistent viewing experience.

siure and others added 3 commits September 8, 2026 16:29
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>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 8, 2026
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 7de1e568-2158-41b9-a13e-0fc21b179901

📥 Commits

Reviewing files that changed from the base of the PR and between 4664c57 and 0b490ec.

📒 Files selected for processing (1)
  • apps/mobile/src/features/files/SourceFileSurface.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The 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.

Changes

Source surface behavior

Layer / File(s) Summary
Highlighted line layout
apps/mobile/src/features/files/SourceFileSurface.tsx
Highlighted lines use start alignment and width constraints that differ for word-break and non-word-break layouts.
Refresh and scroll handling
apps/mobile/src/features/files/SourceFileSurface.tsx
The JavaScript surface supports pull-to-refresh and retries failed scrollToIndex operations up to five times.
Word-break surface selection
apps/mobile/src/features/files/SourceFileSurface.tsx
The JavaScript surface is selected when codeWordBreak is enabled, even when a native surface exists.

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 0b490

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
Loading

Suggested reviewers: juliusmarminge

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enabling wrapped Android source files when Word break is active.
Description check ✅ Passed The description explains what changed, why it changed, validation performed, and the UI result with before/after evidence. It does not use the template headings or include the checklist, but the requi…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant