Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy of a single wrapped line from bash introduces new-lines #14035

Closed
vadimkantorov opened this issue Sep 19, 2022 · 10 comments
Closed

Copy of a single wrapped line from bash introduces new-lines #14035

vadimkantorov opened this issue Sep 19, 2022 · 10 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@vadimkantorov
Copy link

vadimkantorov commented Sep 19, 2022

Windows Terminal version

1.14.2282.0

Windows build number

10.0.22000.978

Other Software

No response

Steps to reproduce

I have launched a long command in WSLv1 bash in Terminal, it looks like:

vadimkantorov@dell_de_vadim:/mnt/c/Users/vadim/$ python ..... my long arguments
long arguments wrapped by terminal window size but still a single line

When I copy these two lines (e.g. for pasting later in another terminal for launching a similar command in parallel), Terminal introduces a newline which was not there originally. This prevents from a proper paste and (probably another issue) - also executes the incomplete command immediately after the paste. It's possible that I entered this command by pressing Up on keyboard which brought this command from bash history.

This must have been reported before, but I could not find an earlier issue just about this. If it indeed is a duplicate, please feel free to close this.

Expected Behavior

No response

Actual Behavior

No newline is introduced and command is not executed immediately after the paste in another tab

@vadimkantorov vadimkantorov added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Sep 19, 2022
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Sep 19, 2022
@DHowett
Copy link
Member

DHowett commented Sep 19, 2022

This is a bit nuanced.

bash (more accurately, probably readline) implements its own hard wrapping. As a result, we can't totally tell that a line was intended to be a continuation instead of a physical line break.

When I type this:

image

Bash sends this:

reach the edge ABCDEFGHIJKL:M \nNOP
                             ^^^

That space and newline were produced by them. I'm at a loss as to exactly why they do this. ☹️

@vadimkantorov
Copy link
Author

probably the command is actually executed because of this newline too

@vadimkantorov
Copy link
Author

maybe could be hacked around by a context menu command "Paste without newlines", but it's not very satisfactory

@DHowett
Copy link
Member

DHowett commented Sep 19, 2022

Holding down Shift while you copy will force the entire selection to wrap onto a single line. It's not ideal because you won't necessarily know when to use it versus not use it, but it might be a good tactical solution for this specific issue. Sorry :/

@vadimkantorov
Copy link
Author

Until now, I've been relying on auto-copy on mouse selection. I wonder, if Terminal can at least provide some visual hints on copy or on paste if the text includes new-lines to educate about this option. Btw Ctrl+Shift+C is default on Gnome Terminal, will this shortcut in WT also just apply these newline removal? or only if Shift is used during mouse-selection?

@vadimkantorov
Copy link
Author

vadimkantorov commented Sep 19, 2022

That space and newline were produced by them. I'm at a loss as to exactly why they do this. ☹️

Yea, I wonder if there's somewhere a mailing list or bash/readline authors that could address this...

Does Mac's Terminals handle this somehow?

@vadimkantorov
Copy link
Author

Also, I don't know why but for me this problem doesn't happen every time, only occasionally. So there may be some other aspects

@zadjii-msft
Copy link
Member

zadjii-msft commented Nov 8, 2022

I think I'm gonna call this a /dupe of #6901. We should probably go through and de-dupe the rest of those too.

@ghost
Copy link

ghost commented Nov 8, 2022

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 ghost closed this as completed Nov 8, 2022
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Nov 8, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

3 participants