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

Pasted text copied from an interactive terminal should retain colors #20813

Closed
daviwil opened this issue Feb 17, 2017 · 8 comments · Fixed by #144784
Closed

Pasted text copied from an interactive terminal should retain colors #20813

daviwil opened this issue Feb 17, 2017 · 8 comments · Fixed by #144784
Assignees
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders on-testplan terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream
Milestone

Comments

@daviwil
Copy link
Contributor

daviwil commented Feb 17, 2017

  • VSCode Version: VS Code Insiders from 2/17/17
  • OS Version: Windows 10

Steps to Reproduce:

  1. Copy text from an integrated terminal window which has colored output
  2. Paste it into Outlook
  3. Observe that the text is pasted without colorization

Now that copied text from an editor pane retains syntax highlighting when pasted into a rich editor, is it possible that we could get the same behavior for copying text from the integrated terminal? I'll understand if this isn't easy to accomplish, but I know that former users of PowerShell ISE will expect it since that editor provides this capability.

/cc @rebornix @Tyriar

@daviwil daviwil changed the title Pasting text copied from an interactive terminal should retain colors Pasted text copied from an interactive terminal should retain colors Feb 17, 2017
@Tyriar Tyriar added feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities terminal Integrated terminal issues labels Feb 17, 2017
@Tyriar Tyriar assigned Tyriar and unassigned Tyriar Feb 17, 2017
@Tyriar
Copy link
Member

Tyriar commented Feb 17, 2017

Opening this up for PRs. @rebornix any tips/links to help someone implement this would be useful.

@rebornix
Copy link
Member

It's all about setting a text/html entry to the clipboard along with text/plain. In Monaco, we bind a copy/paste handler to the textarea while in integrated terminal, we are relying on xterm.js to handle the copy and paste.

https://github.com/sourcelair/xterm.js/blob/3a6368ba6c8d5029e1b432f0e32845442d2f26d9/src/handlers/Clipboard.ts#L48 Here is where you can start to tweak.

@Tyriar
Copy link
Member

Tyriar commented Feb 18, 2017

@rebornix
Copy link
Member

rebornix commented Feb 18, 2017

@Tyriar we intercepts the key shortcuts but after running document.execCommand('copy');, the handler xterm.js binds to the dom finally gets the clipboard event. Remove this line https://github.com/sourcelair/xterm.js/blob/master/src/handlers/Clipboard.ts#L57 and you can paste content with colors correctly. The only thing that I don't know right now is why xterm.js handles the text content itself instead of delegating to browser.

@Tyriar Tyriar added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Dec 7, 2018
@Tyriar
Copy link
Member

Tyriar commented Dec 7, 2018

Supporting this now would need hooks from upstream due to canvas.

@Tyriar Tyriar removed the help wanted Issues identified as good community contribution opportunities label Dec 7, 2018
@Tyriar Tyriar self-assigned this Aug 14, 2019
@Tyriar
Copy link
Member

Tyriar commented Oct 10, 2019

xtermjs/xterm.js#1883

@Tyriar Tyriar added upstream-issue-linked This is an upstream issue that has been reported upstream and removed intergrated-terminal-xtermjs labels Oct 10, 2019
@rzhao271 rzhao271 added this to the Backlog milestone Nov 5, 2020
@LinoBarreca
Copy link

Any news about this? (or a workaround?) it's pretty annoying when you have to forward terminal output with colored build logs and you can't..
is there an extension that can do this?

@Tyriar Tyriar added the help wanted Issues identified as good community contribution opportunities label Aug 27, 2021
@Tyriar
Copy link
Member

Tyriar commented Aug 27, 2021

Added help wanted as this is blocked on contributions to xterm.js in xtermjs/xterm.js#1883

@Tyriar Tyriar modified the milestones: Backlog, February 2022 Feb 2, 2022
@Tyriar Tyriar removed the help wanted Issues identified as good community contribution opportunities label Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders on-testplan terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@daviwil @rebornix @LinoBarreca @Tyriar @rzhao271 @meganrogge and others