Permission prompt selected option wraps long text to multiple lines instead of scrolling/truncating

Resolved 💬 3 comments Opened Feb 23, 2026 by bugkill3r Closed Feb 26, 2026

Description

When navigating the permission prompt options ("Do you want to proceed?") with arrow keys, selecting a long option causes it to expand and wrap across multiple lines. Unselected options remain on a single truncated line. This makes the prompt jumpy and harder to read as the menu resizes on every scroll.

Steps to Reproduce

  1. Trigger a permission prompt with a long bash command (e.g., a compound mkdir -p ... && huggingface-cli download ... command)
  2. Use arrow keys to scroll between options in the select menu
  3. Observe the layout shift as the selected option wraps to multiple lines

Expected Behavior

The selected option should either:

  • Horizontally scroll to show the full text
  • Remain truncated with the full text available via a tooltip or separate display area
  • Wrap gracefully without causing layout shift

Actual Behavior

  • Selected option: Wraps to 4-5 lines (via j46() word-wrap with hard: true against a hardcoded 79-column width)
  • Unselected options: Stay on 1 line (truncated with ellipsis)
  • The menu resizes on every scroll, causing a jumpy/jarring experience

Technical Details

The root cause is in the permission prompt rendering (minified as eg() in cli.js):

  1. Hardcoded width: The prompt uses K6(79) — a hardcoded 79-column width that does not adapt to the actual terminal width
  2. Wrapping function: Selected items are passed through j46() (a word-wrap function) with {hard: true}, which forcefully breaks long text across multiple lines at the 79-column boundary
  3. Truncation for unselected: Unselected items use a truncation function (Aq8()) that keeps them on a single line

The wrapping logic in the relevant code path:

// Simplified from minified cli.js
if (mode === "wrap") return j46(text, width, { trim: false, hard: true });
if (mode.startsWith("truncate")) return Aq8(text, width, { position: "end" });

The mismatch between wrapping (selected) and truncating (unselected) causes the layout shift.

Environment

  • macOS, Claude Code CLI (terminal)
  • Claude Code version: 2.1.50

Related Issues

  • #7670 — Unexpected line breaks in terminal output rendering (same class of hardcoded-width wrapping bugs)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗