Skip to content

Show long code blocks in chat answers instead of hiding them behind an inner scroll - #33

Merged
devswha merged 1 commit into
devswha:mainfrom
Yoonwoo-Ha:fix/long-code-blocks
Sep 25, 2026
Merged

devswha merged 1 commit into
devswha:mainfrom
Yoonwoo-Ha:fix/long-code-blocks

Conversation

@Yoonwoo-Ha

Copy link
Copy Markdown
Contributor

Problem

A long Codex answer in the chat looked like it stopped halfway. All of the text had arrived (the
conversation API returns the answer whole). But a fenced code block was capped at about six rows
(.markdown-code pre { max-height: calc(var(--row-h) * 6); overflow: auto }). On a phone that
inner scroll has no visible scrollbar. A 40-line block on an iPhone 13 viewport showed 336 px of
its 744 px and gave no hint that more was there.

On one of my Codex panes, 12 of 795 final answers had a code block over 7 lines, and the longest
was 382 lines.

Change

  • Code blocks no longer have a height cap or an inner vertical scroll. Wide lines still scroll
    sideways.
  • A block longer than 30 lines opens at its first 20 lines, with a visible Show all N lines
    row. Show less folds it again and brings the block's top back into view, since that row
    sits at the bottom of a long block.
  • Copy still copies the whole block.
  • The fold rule is foldCode() in src/lib/markdown.ts, with unit tests.
  • Tool input and output inside an opened work row keep their compact scroll box. That is detail
    the reader opened on purpose, not the answer.

Verification

  • bun run typecheck, bun test (304 pass), bun scripts/ui-regression.ts (all PASS)
  • Headless Chrome with a stubbed conversation (a 40-line and a 12-line block), on an iPhone 13
    viewport and a 1280×900 desktop:
    • 12-line block: shown whole, nothing hidden
    • 40-line block: 20 lines plus "Show all 40 lines"; after the click, 40 lines and nothing
      hidden; after "Show less", 20 lines with the block's top in view

🤖 Generated with Claude Code

…er scroll

A fenced code block in an answer was capped at about six rows with
overflow: auto. On a phone that inner scroll has no visible scrollbar, so
a long answer looked like it stopped halfway even though all of its text
had arrived.

Blocks now show whole. A block longer than 30 lines opens at its first
20 lines with a visible "Show all N lines" row; "Show less" folds it again
and brings its top back into view. Wide lines still scroll sideways.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.

2 participants