copy singleLine does not work with block select #19619

Closed
opened 2026-01-31 06:48:51 +00:00 by claunia · 4 comments
Owner

Originally created by @yellowtailfan on GitHub (Apr 3, 2023).

Windows Terminal version

1.16.10262.0

Windows build number

10.0.22621.1413

Other Software

No response

Steps to reproduce

I would like to be able to copy a column from a command listing output and feed it into another command as a sequence of command line arguments.

Here's a simple reproduction of the problem:

  1. Run Ubuntu Bash via WSL2 in Windows Terminal
  2. Type: ls -l and press Enter
  3. Hold down Alt and drag the mouse to select a column from the listing
  4. Command palette > Copy as single line (or use a keyboard shortcut assigned to copy singleLine=true)
  5. Type: echo but don't press Enter
  6. Paste
  7. Press Enter

Expected Behavior

The column should be pasted as a single line, and then printed as a single line by echo.

Actual Behavior

Only the first row in the column is pasted as a single line. echo prints the first row, then Bash receives the remaining rows as separate lines and tries to run each one.

If I use normal selection (not block selection) then Copy as single line does the expected behaviour.

The problem is not unique to pasting into Windows Terminal or Bash. The same behaviour happens if I paste into another app, e.g. into VS Code.

Originally created by @yellowtailfan on GitHub (Apr 3, 2023). ### Windows Terminal version 1.16.10262.0 ### Windows build number 10.0.22621.1413 ### Other Software _No response_ ### Steps to reproduce I would like to be able to copy a column from a command listing output and feed it into another command as a sequence of command line arguments. Here's a simple reproduction of the problem: 1. Run Ubuntu Bash via WSL2 in Windows Terminal 2. Type: `ls -l` and press Enter 3. Hold down Alt and drag the mouse to select a column from the listing 4. Command palette > Copy as single line (or use a keyboard shortcut assigned to copy singleLine=true) 5. Type: `echo ` but don't press Enter 6. Paste 7. Press Enter ### Expected Behavior The column should be pasted as a single line, and then printed as a single line by `echo`. ### Actual Behavior Only the first row in the column is pasted as a single line. `echo` prints the first row, then Bash receives the remaining rows as separate lines and tries to run each one. If I use normal selection (not block selection) then Copy as single line does the expected behaviour. The problem is not unique to pasting into Windows Terminal or Bash. The same behaviour happens if I paste into another app, e.g. into VS Code.
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 06:48:51 +00:00
Author
Owner

@yellowtailfan commented on GitHub (Apr 3, 2023):

A work around after the Copy as single line step above is to use the paste command:

  1. Type echo '
  2. Paste
  3. Type ' | paste -sd " " -
  4. The column is output on a single line
  5. Copy the single line
  6. Type the actual command you want to run
  7. Paste the single line as the arguments
@yellowtailfan commented on GitHub (Apr 3, 2023): A work around after the _Copy as single line_ step above is to use the `paste` command: 1. Type `echo '` 2. Paste 3. Type '` | paste -sd " " -` 4. The column is output on a single line 5. Copy the single line 6. Type the actual command you want to run 7. Paste the single line as the arguments
Author
Owner

@yellowtailfan commented on GitHub (Apr 3, 2023):

An even simpler work around using xargs to feed the column of values into <cmd>:

  1. Type echo ' and don't press Enter
  2. Paste
  3. Type ' | xargs <cmd>
  4. Press Enter
@yellowtailfan commented on GitHub (Apr 3, 2023): An even simpler work around using `xargs` to feed the column of values into `<cmd>`: 1. Type `echo '` and don't press Enter 2. Paste 3. Type `' | xargs <cmd>` 4. Press Enter
Author
Owner

@carlos-zamora commented on GitHub (Apr 26, 2023):

Thanks! Marking this as a /dup of #15153. @lhecker said he was going to rewrite this section of the code sometime soon.

@carlos-zamora commented on GitHub (Apr 26, 2023): Thanks! Marking this as a /dup of #15153. @lhecker said he was going to rewrite this section of the code sometime soon.
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Apr 26, 2023):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Apr 26, 2023): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19619