Line breaks are ignored inconsistently when copying text in tmux copy mode #12333

Open
opened 2026-01-31 03:12:41 +00:00 by claunia · 0 comments
Owner

Originally created by @antoineco on GitHub (Jan 31, 2021).

Environment

Windows build number: 10.0.19042.746
Windows Terminal version: 1.6.10272.0 (current Preview version from Microsoft Store)

Ubuntu WSL distribution from the Microsoft Store: 2004.2020.812.0
tmux: 3.0a (from Ubuntu's APT package repo)

Steps to reproduce

1. Open a WSL terminal

2. Run a new tmux session:

$ tmux

3. Generate some output. Here a sample output from the command I ran while running into this, for your convenience

$ cat <<EOF
Install Kubernetes apps from helm charts or YAML files using the "install"
command.

You can also find the post-install message for each app with the "info"
command.

Usage:
  arkade install [flags]
  arkade install [command]

Aliases:
  install, i

Examples:
  arkade install
  arkade install openfaas  --gateways=2
  arkade install inlets-operator --token-file $HOME/do-token
EOF

4. Press Enter multiple times, until the output disappears from the current window.

5. Enter tmux's copy mode with Ctrl-B [

Note: first Ctrl-B, then [. Not simultaneously

6. Scroll up with arrow keys or PgUp

7. Copy the previously generated output.

8. (optional) Press q to exit tmux's copy mode.

image

Expected behavior

The copied text contains line breaks at the end of each line.

In this case, I'm expecting:

You can also find the post-install message for each app with the "info"
command.

Usage:
  arkade install [flags]
  arkade install [command]

Aliases:
  install, i

Actual behavior

This is the raw pasted text. Notice the spaces before "Aliases" instead of the new line (I can replicate the issue with any text, not only that one):

You can also find the post-install message for each app with the "info"
command.

Usage:
  arkade install [flags]
  arkade install [command]
                                                                                                                                                            Aliases:
  install, i

ℹ️ Important note: this happens only in tmux's copy mode. After pressing q, copying the same output will work as expected.

Originally created by @antoineco on GitHub (Jan 31, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment Windows build number: `10.0.19042.746` Windows Terminal version: `1.6.10272.0` (current Preview version from Microsoft Store) Ubuntu WSL distribution from the Microsoft Store: `2004.2020.812.0` tmux: `3.0a` (from Ubuntu's APT package repo) # Steps to reproduce 1\. Open a WSL terminal 2\. Run a new tmux session: ```console $ tmux ``` 3\. Generate some output. _Here a sample output from the command I ran while running into this, for your convenience_ ```console $ cat <<EOF Install Kubernetes apps from helm charts or YAML files using the "install" command. You can also find the post-install message for each app with the "info" command. Usage: arkade install [flags] arkade install [command] Aliases: install, i Examples: arkade install arkade install openfaas --gateways=2 arkade install inlets-operator --token-file $HOME/do-token EOF ``` 4\. Press `Enter` multiple times, until the output disappears from the current window. 5\. Enter tmux's copy mode with `Ctrl-B [` > Note: _first `Ctrl-B`, then `[`. Not simultaneously_ 6\. Scroll up with arrow keys or `PgUp` 7\. Copy the previously generated output. 8\. _(optional)_ Press `q` to exit tmux's copy mode. ![image](https://user-images.githubusercontent.com/3299086/106384071-8ec84d00-63c9-11eb-95fe-ba5337ed74e3.png) # Expected behavior The copied text contains line breaks at the end of each line. In this case, I'm expecting: ``` You can also find the post-install message for each app with the "info" command. Usage: arkade install [flags] arkade install [command] Aliases: install, i ``` # Actual behavior This is the raw pasted text. Notice the spaces before "Aliases" instead of the new line (I can replicate the issue with any text, not only that one): ``` You can also find the post-install message for each app with the "info" command. Usage: arkade install [flags] arkade install [command] Aliases: install, i ``` ℹ️ **Important note**: this happens only in tmux's copy mode. After pressing `q`, copying the same output will work as expected.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12333