Skip to content

TUI trailing spaces break copy in xterm.js terminals (VS Code) #6251

Description

@Dombo

What do you want to change?

Stop the renderer from appending trailing spaces, it already clears each line with \x1b[2K before writing so the trailing space serve no visual purpose they just pollute the clipboard.

Why?

Copying output from pi running in VS Code's integrated terminal includes trailing whitespace on every line, padding each line to the full terminal width.

xterm.js trims empty (unwritten) cells on copy but preserves real space characters. The TUI components (Markdown, Text, Box, TruncatedText) pad every rendered line to the terminal width with space characters. The renderer already clears each line with \x1b[2K before writing, so the trailing spaces serve no visual purpose — they just pollute the clipboard.

iTerm masks this with its own trim-on-copy. xterm.js-based terminals (VS Code, any Electron app) do not.

How? (optional)

Proposed Fix: #6248

Metadata

Metadata

Assignees

No one assigned

    Labels

    no-actionThis issue has been rejected after triage

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions