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 from terminal should not retain new line characters for wrapped lines #23142

Closed
tomintaiga opened this issue Mar 24, 2017 · 4 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Milestone

Comments

@tomintaiga
Copy link

Steps to Reproduce:

  1. Create python script:
#!/bin/env python3

line = """ "{ \"package\": {\"type\": \"tcp\", \"total_length\" :0, \"header_length\": 0, \"body_length\": 0, \"TCP\": {\"source_port\": -1, \"dest_port\": -1, \"seq_num\": -1, \"ack_num\": -1, \"flag_urgent\": false, \"flag_ack\": false, \"flag_push\": false, \"flag_reset\": false, \"flag_sync\": false, \"flag_finish\": false, \"window\": -1, \"checksum\": -1, \"urgent_pointer\": -1 }}}" """

print(line.replace('\"', '"'))
  1. Right click->Run python file in terminal
  2. Copy data from terminal:
"{ "package": {"type": "tcp", "total_length" :0, "header_length": 0, "body_length": 0, "TCP": {"source
_port": -1, "dest_port": -1, "seq_num": -1, "ack_num": -1, "flag_urgent": false, "flag_ack": false, "fl
ag_push": false, "flag_reset": false, "flag_sync": false, "flag_finish": false, "window": -1, "checksum
": -1, "urgent_pointer": -1 }}}"

Words "source_port" and "flag_push" and quotes on ' "checksum" ' are changed. So when I copy this text to https://jsonformatter.curiousconcept.com/ I've got invalid json.

What words are broken, depends on VSCode window size. When I made it large or small, different words became corrupted.

@rmunn
Copy link
Contributor

rmunn commented Mar 27, 2017

I can also reproduce this behavior in F#, with the Ionide F# plugin. Looks like copying a wrapped line from the terminal (that is, a long line that was visually wrapped) ends up copying real LF or CR/LF characters from the terminal, when they were not present in the original line.

Related: if I print a long line to the terminal, then resize VS Code, the line does NOT re-wrap, because the terminal has already inserted linefeeds into the text it printed. This results in remarkably ugly terminal output: either some part of the long line is no longer visible, or there are huge sections of whitespace when the line is wrapped too early. Perhaps that should be tracked as a separate (but related) bug?

@Tyriar
Copy link
Member

Tyriar commented Mar 27, 2017

Upstream issue: xtermjs/xterm.js#443

Related: xtermjs/xterm.js#609

@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Mar 27, 2017
@Tyriar Tyriar changed the title Copy from terminal change text Copy from terminal should not retain new line characters for wrapped lines Mar 27, 2017
@Tyriar Tyriar added this to the June 2017 milestone Jun 13, 2017
@Tyriar
Copy link
Member

Tyriar commented Jun 13, 2017

Merged xtermjs/xterm.js#693 into release branch, fix should come in tomorrow's insiders.

@Tyriar Tyriar closed this as completed in 5e70c18 Jun 13, 2017
@dbaeumer
Copy link
Member

dbaeumer commented Jun 29, 2017

Verified to early and discovered that under Windows the newline is \n which doesn't let you paste into notepad. Opened #29856

@dbaeumer dbaeumer added verified Verification succeeded and removed verified Verification succeeded labels Jun 29, 2017
@Tyriar Tyriar added the verified Verification succeeded label Jun 29, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants