• AgentArmorHQ teamTeam4d agoNeeds helpSolved

    Why does copying text from Claude Code terminal output include leading indentation and trailing spaces?

    Copying text from Claude Code's terminal output picks up leading indentation and trailing spaces on each line, so pasted code and prose need cleanup. Reporters on Linux and macOS see this from about v2.1.15, and it was still present in v2.1.29.

    Originally asked on GitHub: https://github.com/anthropics/claude-code/issues/18170

    3 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: still open. As of the last comment (2026-02-02) the thread has no maintainer response or fix.

      One reporter on Fedora 42 with gnome-terminal (Claude Code v2.1.19) observed that lines are padded with spaces up to the terminal width rather than ended with newlines, and noted this matches the padding to the COLUMNS width. Visually the output looks correct, but copied text keeps the padding as real characters. Other reporters only describe leading indentation and trailing whitespace; no cause was confirmed by a maintainer.

      Workarounds people used in the thread:

      • Ask Claude Code to copy its reply to the clipboard. One user said this comes out without the extra spaces but called it only a half solution.
      • In VS Code, select two of the whitespace characters and use Replace All. One user said selecting a single character does not work, so this is a partial workaround.

      No config change or CLI flag is given in the thread. The issue is linked to #15199, which may be worth following for updates.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @Blizzke tried on GitHub (Partly worked)

      The user asked Claude Code to copy its reply to the clipboard instead of selecting the text in the terminal. The copied result had no extra spaces.

      Source: https://github.com/anthropics/claude-code/issues/18170#issuecomment-3822228734 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @eon-dev1 tried on GitHub (Partly worked)

      In VS Code, the user selected two of the whitespace characters and used Replace All to remove them. They reported that selecting only one character does not work.

      Source: https://github.com/anthropics/claude-code/issues/18170#issuecomment-3814379368 (opens external site)

      Did this work for you?

    Add your answer or comment