Proper handling of multiline copy paste #4777

Closed
opened 2026-01-30 23:56:18 +00:00 by claunia · 3 comments
Owner

Originally created by @testautomation on GitHub (Nov 2, 2019).

Description of the new feature/enhancement

As a user I want to be able to paste long commands that are spread over multiple lines where the linebreaks are escaped with \. Example below

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

ACTUAL

The actual behavior is that terminal tries to execute each line immediately . See example below

learn@DESKTOP-4FCRN5Q:~/projects$ sudo apt-get install \
>
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
learn@DESKTOP-4FCRN5Q:~/projects$     apt-transport-https \
>
apt-transport-https: command not found
learn@DESKTOP-4FCRN5Q:~/projects$     ca-certificates \
>
ca-certificates: command not found
learn@DESKTOP-4FCRN5Q:~/projects$     curl \
>
curl: try 'curl --help' or 'curl --manual' for more information
learn@DESKTOP-4FCRN5Q:~/projects$     gnupg-agent \
>
gnupg-agent: command not found

EXPECTED

The multiline command from above example is treated as on command and after being paste waits for the user to press ENTER before it is executed.

NOTE: The Ubuntu WSL is a good example of how it should behave correctly
image

Originally created by @testautomation on GitHub (Nov 2, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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! --> # Description of the new feature/enhancement As a user I want to be able to paste long commands that are spread over multiple lines where the linebreaks are escaped with `\`. Example below ```shell sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common ``` <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> ## ACTUAL The actual behavior is that terminal tries to execute each line immediately . See example below ``` learn@DESKTOP-4FCRN5Q:~/projects$ sudo apt-get install \ > Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. learn@DESKTOP-4FCRN5Q:~/projects$ apt-transport-https \ > apt-transport-https: command not found learn@DESKTOP-4FCRN5Q:~/projects$ ca-certificates \ > ca-certificates: command not found learn@DESKTOP-4FCRN5Q:~/projects$ curl \ > curl: try 'curl --help' or 'curl --manual' for more information learn@DESKTOP-4FCRN5Q:~/projects$ gnupg-agent \ > gnupg-agent: command not found ``` ## EXPECTED <!-- A clear and concise description of what you want to happen. --> The multiline command from above example is treated as on command and after being paste waits for the user to press ENTER before it is executed. > NOTE: The Ubuntu WSL is a good example of how it should behave correctly ![image](https://user-images.githubusercontent.com/38438046/68070038-c11f7080-fd68-11e9-8966-0b0623ecc226.png)
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-30 23:56:18 +00:00
Author
Owner

@Luuk34 commented on GitHub (Nov 2, 2019):

You should not copy the final end-of-line character. If you do than the final ENTER will not be pasted, and you will have the ability to do it yourself.

@Luuk34 commented on GitHub (Nov 2, 2019): You should not copy the final end-of-line character. If you do than the final ENTER will not be pasted, and you will have the ability to do it yourself.
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 3, 2019):

/dup #1091.

@DHowett-MSFT commented on GitHub (Nov 3, 2019): /dup #1091.
Author
Owner

@ghost commented on GitHub (Nov 3, 2019):

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!

@ghost commented on GitHub (Nov 3, 2019): 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#4777