Copying text from CLI output includes trailing spaces to end of terminal width

Resolved 💬 4 comments Opened Feb 1, 2026 by roomi-fields Closed Mar 2, 2026

Description

When copying text from Claude Code CLI output, each line includes trailing spaces all the way to the terminal width, even after the last visible character. This makes the copied text difficult to manipulate in other applications.

Steps to Reproduce

  1. Run Claude Code in terminal
  2. Get some output (code, markdown, any text)
  3. Select and copy a portion of the output
  4. Paste into another application (text editor, browser, etc.)
  5. Observe that each line has trailing spaces padding it to the full terminal width

Expected Behavior

Copied text should only include the actual content, with no trailing whitespace after the last real character on each line.

Actual Behavior

Example - what gets copied (· represents space):

const foo = "bar";····················································
function test() {·····················································
  return true;························································
}·····································································

Environment

  • Claude Code version: 2.1.x
  • Platform: Windows 11 + WSL2
  • Terminal: VS Code integrated terminal / Windows Terminal

Impact

High - Every time you copy code or text from Claude Code output, you need to manually trim trailing whitespace before using it elsewhere. This is especially painful when:

  • Pasting into code editors (triggers whitespace linting errors)
  • Pasting into chat/email (formatting issues)
  • Pasting into forms or other applications
  • Doing further text processing

Workaround

Currently need to paste into an editor and run "trim trailing whitespace" command, or use a regex to clean up. Very tedious for frequent copy operations.

View original on GitHub ↗

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