Skip to content

feat: Support multi-line status line output #3211

@SoilGuo

Description

@SoilGuo

Is your feature request related to a problem?

The current status line is hardcoded to only use the first line of script output:

const trimmed = stdout.trim().split('\n')[0] || '';

This prevents users from displaying richer status information, such as:

  • Context usage with a visual progress bar
  • System metrics (CPU, memory) on separate rows
  • Rate limit countdown timers
  • Environment context (Node/Python versions)

Describe the solution you'd like

  1. Remove the split('\n')[0] hard limit — allow the full stdout to be used
  2. Track output line count — count how many lines the script produces
  3. Clear before re-render — use ANSI escape sequences to erase old lines before writing new ones:
    \x1b[N A   # cursor up N lines
    \x1b[J     # erase from cursor to end of screen
    
  4. Keep horizontal truncationwrap="truncate" should remain for long single lines

Reference implementation

This approach is already used in Claude Code's status line rendering (packages/core/src/bridge/bridgeUI.ts):

let statusLineCount = 0

function clearStatusLines() {
  if (statusLineCount <= 0) return
  write(`\x1b[${statusLineCount}A`)  // cursor up N lines
  write('\x1b[J')                     // erase to end of screen
  statusLineCount = 0
}

function writeStatus(text: string) {
  write(text)
  statusLineCount += countVisualLines(text)
}

Suggested approach for Qwen Code

const [lineCount, setLineCount] = useState(0)

function renderStatusLine(output: string) {
  if (lineCount > 0) {
    process.stdout.write(`\x1b[${lineCount}A`)
    process.stdout.write('\x1b[J')
  }

  const lines = output.split('\n').filter(Boolean)
  setLineCount(lines.length)
  lines.forEach(line => process.stdout.write(line + '\n'))
}

Additional context

The single-line limitation was added during the original PR review as a layout safeguard. Multi-line support would make the feature more flexible without breaking existing single-line scripts.

Willing to submit a PR? Yes, if maintainers are open to this direction.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions