Copying wrapped lines in cygwin can have a spurious space/newline between lines #7960

Closed
opened 2026-01-31 01:16:53 +00:00 by claunia · 6 comments
Owner

Originally created by @brendanmig on GitHub (May 6, 2020).

Environment

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.18363.0 Microsoft Windows NT 10.0.18363.0

Windows Terminal
Version: 0.11.1191.0

Steps to reproduce

Open a cygwin terminal and enter a long line that wraps the terminal. If you then select the entire wrapped line you see an extra space is selected where the line wraps. This does not occur in a normal cmd terminal. When you copy the long cygwin line it also copies the space, and the newline, into the clipboard, so when you paste you end up getting 2 lines with an extra space.

Expected behavior

Expected behaviour is that the text is copied as a single line without a spurious space.

Actual behavior

That it behave like in the cmd window. The extra space at the end of the line should not be selected. And when copied the space and newline should not be in the clipboard. This is a very annoying issue as copying and pasting commands from one terminal to another fails as it ends up pasting two lines which get run as two invalid commands.

Multiline selection in cygwin:
image

Notice the highlighted space at the end of the first line.

Multiline selection in CMD:
image

Notice how there is no highlighted space at the end of the first line.

Pasted text from both examples in Sublime Text:
image

Note how the cygwin text is over two lines whereas the CMD isn't.

Originally created by @brendanmig on GitHub (May 6, 2020). # Environment ```none Platform ServicePack Version VersionString -------- ----------- ------- ------------- Win32NT 10.0.18363.0 Microsoft Windows NT 10.0.18363.0 Windows Terminal Version: 0.11.1191.0 ``` # Steps to reproduce Open a cygwin terminal and enter a long line that wraps the terminal. If you then select the entire wrapped line you see an extra space is selected where the line wraps. This does not occur in a normal cmd terminal. When you copy the long cygwin line it also copies the space, and the newline, into the clipboard, so when you paste you end up getting 2 lines with an extra space. # Expected behavior Expected behaviour is that the text is copied as a single line without a spurious space. # Actual behavior That it behave like in the cmd window. The extra space at the end of the line should not be selected. And when copied the space and newline should not be in the clipboard. This is a very annoying issue as copying and pasting commands from one terminal to another fails as it ends up pasting two lines which get run as two invalid commands. Multiline selection in cygwin: ![image](https://user-images.githubusercontent.com/7307742/81127447-93b6b800-8f81-11ea-8ea1-e608944733d7.png) Notice the highlighted space at the end of the first line. Multiline selection in CMD: ![image](https://user-images.githubusercontent.com/7307742/81127466-a7621e80-8f81-11ea-95bf-f8bcd9f286b8.png) Notice how there is no highlighted space at the end of the first line. Pasted text from both examples in Sublime Text: ![image](https://user-images.githubusercontent.com/7307742/81127531-d6789000-8f81-11ea-9a40-b217fa07789c.png) Note how the cygwin text is over two lines whereas the CMD isn't.
Author
Owner

@zadjii-msft commented on GitHub (May 6, 2020):

@brendanmig What version of cygwin are you running?

@zadjii-msft commented on GitHub (May 6, 2020): @brendanmig What version of cygwin are you running?
Author
Owner

@brendanmig commented on GitHub (May 6, 2020):

It's an old one since I don't like updating cygwin :) I guess I should update to the latest though and try again. In any case it's:

bendy@eric ~
$ cygcheck -V
cygcheck (cygwin) 2.10.0
System Checker for Cygwin
Copyright (C) 1998 - 2018 Cygwin Authors
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bendy@eric ~
$ uname -a
CYGWIN_NT-10.0-WOW eric 2.10.0(0.325/5/3) 2018-02-02 15:21 i686 Cygwin
@brendanmig commented on GitHub (May 6, 2020): It's an old one since I don't like updating cygwin :) I guess I should update to the latest though and try again. In any case it's: ``` bendy@eric ~ $ cygcheck -V cygcheck (cygwin) 2.10.0 System Checker for Cygwin Copyright (C) 1998 - 2018 Cygwin Authors This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. bendy@eric ~ $ uname -a CYGWIN_NT-10.0-WOW eric 2.10.0(0.325/5/3) 2018-02-02 15:21 i686 Cygwin ```
Author
Owner

@DHowett-MSFT commented on GitHub (May 6, 2020):

so, I’ve got some bad news. This might be the same as explained in https://github.com/microsoft/terminal/issues/3367#issuecomment-600331472 — the MSYS runtime and the Cygwin runtime are one and the same. This is something an update might help with, but something Terminal is totally powerless to help.

@DHowett-MSFT commented on GitHub (May 6, 2020): so, I’ve got some bad news. This might be the same as explained in https://github.com/microsoft/terminal/issues/3367#issuecomment-600331472 — the MSYS runtime and the Cygwin runtime are one and the same. This is something an update might help with, but something Terminal is totally powerless to help.
Author
Owner

@brendanmig commented on GitHub (May 6, 2020):

Well I just updated to cygwin64 (3.1.4) and it seems to have solved the problem. I use this as the profile:

            {
                // Make changes here to the cmd.exe profile
                "guid": "{0caa0dad-35be-5f56-58ff-afceeeaa6102}",
                "name": "cygwin64",
                "commandline": "C:\\cygwin64\\bin\\bash --login -i",
                "startingDirectory": "c:\\cygwin64\\bin",
                "icon": "c:\\cygwin64\\Cygwin-Terminal.ico",
                "hidden": false
            }, 

Which is the same as the 32 bit one except cygwin64 instead of cygwin.

In a cygwin64 tab the multiline selection is fine. In a cygwin one it isn't. Maybe they fixed or updated something internally.

@brendanmig commented on GitHub (May 6, 2020): Well I just updated to cygwin64 (3.1.4) and it seems to have solved the problem. I use this as the profile: ``` { // Make changes here to the cmd.exe profile "guid": "{0caa0dad-35be-5f56-58ff-afceeeaa6102}", "name": "cygwin64", "commandline": "C:\\cygwin64\\bin\\bash --login -i", "startingDirectory": "c:\\cygwin64\\bin", "icon": "c:\\cygwin64\\Cygwin-Terminal.ico", "hidden": false }, ``` Which is the same as the 32 bit one except `cygwin64` instead of `cygwin`. In a cygwin64 tab the multiline selection is fine. In a cygwin one it isn't. Maybe they fixed or updated something internally.
Author
Owner

@DHowett-MSFT commented on GitHub (May 6, 2020):

I believe the runtime changes in 3.1 helped fix this. Thanks for confirming!

@DHowett-MSFT commented on GitHub (May 6, 2020): I believe the runtime changes in 3.1 helped fix this. Thanks for confirming!
Author
Owner

@brendanmig commented on GitHub (May 6, 2020):

Thanks for your fast response! This issue has been bugging me since I started using WT back in Jan, glad just a quick update could fix it.

@brendanmig commented on GitHub (May 6, 2020): Thanks for your fast response! This issue has been bugging me since I started using WT back in Jan, glad just a quick update could fix it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7960