-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
When Copying, Line Wrapped Text Is Inconsistently Broken Into Multiple Lines #6901
Comments
Does this repro with an |
I've seen it directly in WSL, SSH from inside WSL, and most consistently from ssh.exe to a Linux host. The first two can be hit or miss in reproducing the bug. Even with the most consistent method I posted above it doesn't happen every time. But I did find that in a instance of the Windows Terminal where it happens it will happen consistently but closing out completely and relaunching can sometimes fix the behavior. |
Happens to me too. Inconsistent; I can't detect a pattern so far. |
Alright well, I could have sworn there was a dupe for the newer version of this, but I cannot find it. This is now the thread. I'm gonna link this up to #5800. Unfortunately without a consistent repro I'm not sure how we'll be able to investigate this, but hopefully by the end of #5800, then this will just go away on it's own. |
@vadimkantorov do you have a consistent repro for how to get the Terminal into this state? |
Unfortunately not. But I have this tab opened. If you can suggest how to dump some diagnostics info without restarting terminal, I can do that |
@vadimkantorov Unfortunately there's not really a good way to do that with the Terminal at the moment. If we did have a dump of both the There's also a good number of changes coming to this area as a part of #5800, so a part of me expects this issue to either go away as a part of that, or be much easier to repro. |
I can do a memory dump. I'll send it to you! Thanks for looking into this. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
i'm not sure if this is related, but i can reproduce the line break thing quite easily. let's get the details out of the way first
what is is exactly i can reproducepasting anything over 500 characters (found this number in another issue, but seems to be correct) will make the pasted text remove/add new lines and paste blocks randomly through each other. the exact location where these incorrect characters get inserted seems mostly random. pasting the same text in the same vi session sometimes appear at the same place, sometimes not. this problem only manifest when pasting into a cygwin terminal, when you copy text from a cygwin window running in windows terminal and paste in another application (either a wsl2 instance in another tab of the same terminal, or in notepad) the text pastes just fine. there are/were 2 profiles i could reproduce this:
i could not (or can't anymore with the versions i'm running now) reproduce this with:
how to reproducein a cygwin tab paste any text longer as 500 chars... that's it
the following did not matter
why not just stop using zsh/cygwin 😄 ?
and now for some files.
|
As a long-time Cygwin user myself I find it invaluable compared to WSL2 (although I do have it) and still use it as my main terminal. I don't use Terminal as I prefer mintty. Any time I call out to a Windows programme (and so uses ConPTY) I get this same issue, it's a nightmare. It's ConPTY at fault here as far as I can tell. |
probably worth mentioning the workaround of holding shift while selecting. |
I can reproduce, but in my case shift+select is not a workaround as it causes every newline to be removed, while what I'm copying is an ASCII rendered table that gets broken up by the incorrectly introduced newlines. I want to copy the table such that it preserves its table format. I'm attaching a file demonstrating what the layout of the table looks like. And if I copy this output, the extra newlines are preserved. What I'm expecting is that only the newlines that were in the output are preserved, so the copied version matches that in the file. For comparison in the legacy console app I can do this: |
I didn't have this issue when using the actual Windows Terminal, however I have this issue when using the integrated terminal in VS Code: microsoft/vscode#166247 The dev there said it is/was a WT bug since they use |
Huh. Just had this thread open and was curious if the #15567, #14936, #14874 work cleaned this up at all. Then noticed this interesting thing: The first paste into notepad, from Heck, that repros in And the So I think 1.18 fixed a bulk of "there's line breaks where there shouldn't be" issues. That brings us to the rest of the stuff linked in #6901 (comment):
|
Subjectively speaking, this commit makes 3 improvements: * Most importantly, it now would work with arbitrary Unicode text. (No more `IsGlyphFullWidth` or DBCS handling during reflow.) * Due to the simpler implementation it hopefully makes review of future changes and maintenance simpler. (~3x less LOC.) * It improves perf. by 1-2 orders of magnitude. (At 120x9001 with a full buffer I get 60ms -> 2ms.) Unfortunately, I'm not confident that the new code replicates the old code exactly, because I failed to understand it. During development I simply tried to match its behavior with what I think reflow should do. Closes #797 Closes #3088 Closes #4968 Closes #6546 Closes #6901 Closes #15964 Closes MSFT:19446208 Related to #5800 and #8000 ## Validation Steps Performed * Unit tests ✅ * Feature tests ✅ * Reflow with a scrollback ✅ * Reflowing the cursor cell causes a forced line-wrap ✅ (Even at the end of the buffer. ✅) * `color 8f` and reflowing retains the background color ✅ * Enter alt buffer, Resize window, Exit alt buffer ✅ (cherry picked from commit 7474839) Service-Card-Id: 90642727 Service-Version: 1.19
Hi @DHowett, a long stretch here but I think this has been a problem in Cygwin for some time and it's great to see a fix finally in. Cygwin uses conhost/conPTY for improving interfacing Windows native binaries to Cygwin and so the fixes here would be great to be seen there too. How does the conhost release process work if you'd not mind me asking. Is this something that's just wait for Windows Update to pick up a change to conhost and it'll magically fix itself once that update is out? |
Environment
Platform = Win32NT
Version = 10.0.19041.0
Version String = Microsoft Windows NT 10.0.19041.0
Windows Terminal Version = 1.0.1811.0
SSH Version = OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
WSL Version = 2
Steps to reproduce
more test.txt
to list the contents of the create file.The 'more' command was the easiest way to get a reproducible result but I have seen this behavior with many other Linux programs some inconsistently and some consistently.
Expected behavior
Pasted text should be a single line, for both steps 4 and 6, as the copied output was wrapped by the terminal and not broken into separate lines by the output program.
Actual behavior
For step 4, the single line gets broken into multiple lines depending on the size or your terminal and how many lines the text got wrapped into. Then on step 6, the line is correctly copied as a single line.
settings.json.txt
Possible related to #5113 but was directed to create new issuel.
The text was updated successfully, but these errors were encountered: