Skip to content

Copying wrapped long lines inserts real newlines at visual wrap boundaries #3197

@jpmorris

Description

@jpmorris

Describe the bug

Copying long wrapped lines from Copilot CLI output inserts real newline characters at visual wrap boundaries. This breaks pasted one-line shell commands and other long single-line text.

I can reproduce this in Copilot CLI even after disabling Copilot mouse capture with "mouse": false. The issue is not specific to tmux or kitty: I also reproduced it in xterm with no tmux. In the same environments, copying long lines from other sources (plain terminal output, neovim, Claude Code) works correctly.

Affected version

GitHub Copilot CLI 1.0.43

Steps to reproduce the behavior

  1. Run Copilot CLI in a terminal where output wraps (I reproduced in both of these setups):

    • kitty 0.46.2 + tmux 3.6a on Wayland
    • xterm 409 with no tmux
  2. Ask Copilot for a single very long one-line shell command, for example:

    printf '%s\n' START paste-wrap-test-0001 paste-wrap-test-0002 paste-wrap-test-0003 paste-wrap-test-0004 paste-wrap-test-0005 paste-wrap-test-0006 paste-wrap-test-0007 paste-wrap-test-0008 paste-wrap-test-0009 paste-wrap-test-0010 paste-wrap-test-0011 paste-wrap-test-0012 paste-wrap-test-0013 paste-wrap-test-0014 paste-wrap-test-0015 paste-wrap-test-0016 paste-wrap-test-0017 paste-wrap-test-0018 paste-wrap-test-0019 paste-wrap-test-0020 paste-wrap-test-0021 paste-wrap-test-0022 paste-wrap-test-0023 paste-wrap-test-0024 paste-wrap-test-0025 paste-wrap-test-0026 paste-wrap-test-0027 paste-wrap-test-0028 paste-wrap-test-0029 paste-wrap-test-0030 paste-wrap-test-0031 paste-wrap-test-0032 paste-wrap-test-0033 paste-wrap-test-0034 paste-wrap-test-0035 paste-wrap-test-0036 paste-wrap-test-0037 paste-wrap-test-0038 paste-wrap-test-0039 paste-wrap-test-0040 paste-wrap-test-0041 paste-wrap-test-0042 paste-wrap-test-0043 paste-wrap-test-0044 paste-wrap-test-0045 paste-wrap-test-0046 paste-wrap-test-0047 paste-wrap-test-0048 paste-wrap-test-0049 paste-wrap-test-0050 END
  3. Copy that command from Copilot's rendered output.

    • I saw this with Copilot's built-in copy action.
    • I also still see it when using terminal-native selection after setting ~/.copilot/settings.json to { "mouse": false }.
  4. Paste into a shell prompt.

Example of what happens after paste:

❯ printf '%s\n' START paste-wrap-test-0001 paste-wrap-test-0002
paste-wrap-test-0003 paste-wrap-test-0004 paste-wrap-test-0005
paste-wrap-test-0006 paste-wrap-test-0007 paste-wrap-test-0008
...
START
paste-wrap-test-0001
paste-wrap-test-0002
zsh: command not found: paste-wrap-test-0003
zsh: command not found: paste-wrap-test-0006
zsh: command not found: paste-wrap-test-0009

This shows the copied text contains real \n characters where the UI visually wrapped the line.

Expected behavior

Copying Copilot output should preserve the underlying logical text. Visual line wrapping should not be converted into real newline characters in the clipboard payload.

The pasted command should remain a single shell command no matter how it was visually wrapped in the UI.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:input-keyboardKeyboard shortcuts, keybindings, copy/paste, clipboard, mouse, and text inputarea:terminal-renderingDisplay and rendering: flickering, scrolling, line wrapping, output formatting

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions