Skip to content

mobile: code blocks don't wrap, so reading them on a phone needs sideways scrolling #64406

Open

Description

@bobgoodson

Summary

In the OpenCode mobile app (iOS), fenced code blocks in assistant replies don't wrap. Each line runs off the right edge of the screen, so you have to scroll sideways, line by line, to read it. Ordinary prose wraps fine. On a phone this makes any reply that contains a plain-text block (a draft message, an email, a note to copy) close to unreadable.

Environment

  • opencode version: 2.3.0 (server on the Mac mini; the iPhone app is paired over Tailscale)
  • OS: iOS (iPhone), mobile app. Server on macOS (Darwin 25.6.0, arm64)
  • Terminal: n/a (mobile app)
  • Shell: /bin/zsh (server)
  • Install/channel: latest
  • Active plugins: one local plugin (unrelated to rendering)
  • Mobile app version: Unavailable (not captured)

Reproduction

  1. Open a session in the OpenCode mobile app on an iPhone.
  2. Ask for a reply that contains a fenced code block with long lines of prose, e.g. "Write a short note to the team inside a code block so I can copy it."
  3. Read the block.

Expected Behavior

On a phone-width screen, the text in a code block stays within the page margins like the rest of the message, so it can be read top to bottom without scrolling sideways.

Suggested approach:

  1. Soft-wrap code blocks on narrow screens (white-space: pre-wrap; overflow-wrap: anywhere or the native equivalent), at least for unlabelled and text / markdown fences. Wrapping doesn't change the text: copy still returns the original lines.
  2. Collapse very long blocks. If a block is taller than about one screen, show the first part with a "Show more" link that expands it in place. That keeps vertical scrolling through the conversation usable.
  3. Optionally, keep horizontal scrolling for real source code behind a per-block "Wrap" toggle, or a setting like the one proposed for Desktop in desktop: code blocks hide horizontal scrollbars and cannot wrap long lines #60143.

Actual Behavior

The block keeps each line on a single row and clips it at the right edge of the screen. The only way to read it is to scroll the block horizontally, and then back again for every line. In the screenshot, every line of the note is cut off part-way ("for th…", "what y…", "(@ope…").

Additional Context

  • Happens every time, with any code block that has lines longer than the screen width.
  • Related: desktop: code blocks hide horizontal scrollbars and cannot wrap long lines #60143 covers the same behaviour on Desktop/web (shared packages/session-ui/src/components/markdown.css: hidden scrollbars and no wrap option). On mobile it's worse, because the screen is narrow and sideways scrolling inside a vertically scrolling chat is awkward. If mobile uses the same styles, one fix might cover both.
  • Separate small issue in the same screenshot: an unlabelled fence containing English prose gets syntax-highlighted as if it were code (words like "Small", "Internally", "in", "this", "is" are coloured). Unlabelled fences should probably render as plain text.
  • Workaround: ask the agent not to use code blocks. That doesn't help when a code block is the right format, e.g. text meant to be copied.
  • Screenshot: iPhone screenshot attached in a comment below.

Activity

  1. opencodejr commented on Nov 17, 2026

    @opencodejr
    Contributor

    Thanks for the detailed write-up, and for the screenshot.

    Your request: in the iOS app, fenced code blocks should soft-wrap on a phone-width screen so they can be read without scrolling sideways, at least for unlabelled and text/markdown fences. You also suggest collapsing very long blocks behind "Show more" and adding a per-block "Wrap" toggle. A smaller second point: unlabelled fences with prose in them shouldn't be syntax-highlighted as code. I've filed this as a feature request for the mobile app. The maintainers will consider it, and someone on the team who works on the apps will take a look.

    Related:

  2. added
    type/feature
    version/v2
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mobileplatform/iosplatform/macostype/featureversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions