Multi-line statusline truncated as if both lines are a single string

Resolved 💬 3 comments Opened Mar 20, 2026 by NubeBuster Closed Mar 20, 2026

Description

When a custom statusline script outputs two lines (via printf "%s\n"), line 2 is truncated at the wrong width. The truncation itself is correct behavior when line 2 exceeds terminal width — but the calculated truncation point is wrong: it uses terminal_width - len(line1) instead of terminal_width, as if both lines are concatenated into a single string for width calculation.

In 2.1.79, each line was independently width-limited to the terminal width. In 2.1.80, line 1's visible character count is subtracted from line 2's available width.

Expected behavior: Each statusline line should be independently width-limited to the terminal width. Line 2 should truncate at terminal_width, not terminal_width - len(line1).

Error Message and Logs

No error — line 2 is silently truncated at the wrong position. Visual comparison with identical content on both versions:

2.1.80 (broken): Line 2 truncated too early

153k/1000k [📁 ~/Scripts 🌐 main 32%(32m) 33%(19h32m)]
01:27:53 23d59d81 (opus) ▌▌▌▌ $11.58 📝 claude-no-osc-konsole-osc8-injection-sigtstp-fix-…

2.1.79 (working): Line 2 at full width

153k/1000k [📁 ~/Scripts 🌐 main 32%(32m) 33%(19h32m)]
01:27:53 23d59d81 (opus) ▌▌▌▌ $11.58 📝 claude-no-osc-konsole-osc8-injection-sigtstp-fix-posted

Same statusline output, same terminal width — only the Claude Code version differs.

Steps to Reproduce

  1. Configure a custom statusline script that outputs two lines separated by \n
  2. Line 2 must exceed terminal width on its own (if it fits, no truncation occurs and the bug is not visible)
  3. Observe that line 2 is truncated with at approximately terminal_width - line1_length characters instead of at terminal_width

Minimal reproduction statusline script:

#!/bin/bash
echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA first line padding"
echo "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB second line should not be truncated at wrong width"

Claude Code Version

2.1.80 (regression from 2.1.79)

System Environment

  • OS: Ubuntu 25.04 (Linux 6.17.0-19-generic)
  • Terminal: Antigravity (VS Code fork) integrated terminal
  • Shell: bash

Additional Context

The truncation does not occur when running in a real terminal (Konsole) via a wrapper — only in the IDE's integrated terminal where Claude Code's ink-based renderer handles the output. This suggests the ink renderer is concatenating both lines before applying its single-line width truncation logic.

Tested 12 different line separator methods (\n, \r\n, \r, \0, ANSI escapes, combinations) — none resolved the issue, confirming this is a renderer-side bug, not an output formatting issue.

View original on GitHub ↗

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