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/paste with another theme #20837

Closed
chrisdias opened this issue Feb 18, 2017 · 26 comments
Closed

copy/paste with another theme #20837

chrisdias opened this issue Feb 18, 2017 · 26 comments
Assignees
Labels
editor-clipboard Editor clipboard issues feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code
Milestone

Comments

@chrisdias
Copy link
Member

image

Turn on default dark them
edit a markdown file
copy, paste text into email

result: the black background of the text is also pasted into the email. I just want the text...

image

I turned on the dark theme in Visual Studio, copy/pasted some code, and here are the results. the first block of code is the copy/paste from VS, the second is the copy/paste from VS Code:

image

@chrisdias chrisdias added this to the February 2017 milestone Feb 18, 2017
@Ikuyadeu
Copy link
Contributor

Is this related #20811?

@rebornix rebornix added editor feature-request Request for new features or functionality labels Feb 21, 2017
@rebornix
Copy link
Member

Firstly, we can't just copy the colored text without background as in Dark theme, the font color is light (sometimes just white) so copying white text with no background is not reasonable. You can hardly see anything when pasting it to a light themed application.

Visual Studio has three built-in themes, even if you are in Dark theme, the content is always copied with the light theme. So this feature request is actually similar to Copy text with Syntax Highlighting in another specific theme. It's easy to do so as VS gets all ideas about the light theme but for us, as we support third party themes, we cannot decide what theme to use when copy/paste so right now we choose the one users are using at the moment.

For short, temporary workaround is switching to the ideal theme you want to copy/paste. In the long term, we can provide an option for users to configure what theme they want to use for copy/paste. But users need to pay the price of this feature: we have to render all lines with correct CSS class/styles if you choose any theme other than the one you are using, it might take a while.

@rebornix rebornix changed the title copy/paste should not copy background color of editor... copy/paste with another theme Feb 21, 2017
@rebornix rebornix modified the milestones: Backlog, February 2017 Feb 21, 2017
@vscpp
Copy link

vscpp commented Apr 13, 2017

Strong request to improve this feature.
Copy the text to Outlook, there is a large black with background color.
But copy to Micorsoft Lync, no background color, it's difficult to read text as below picture.
untitled

Very thanks for your effort.

@wyckster
Copy link

I think the feature should be that you can set one theme for display, and a separate theme for copy/paste.
I'd like to set my display theme to Dark+ (default dark), but when I copy and paste to another application with formatting, I want the theme to be Light+ (default light). So there should be a way of selecting those two themes separately.

If nothing else, perhaps there should be a user setting where I can override the theme to apply to copied text.

@rebornix rebornix added the editor-clipboard Editor clipboard issues label Jun 7, 2017
@jackhorton
Copy link
Member

I would like to voice my support here -- while I prefer to write code with a dark background, any time I copy/paste it to another app, itll be going against a white background. Neither paste-with-background or paste-without-background are good options, there, and it would really be best to simply copy as if i were using a light theme.

@oxydron
Copy link

oxydron commented Jan 15, 2018

Copy command should be neutral, copy only text and nothing else more.
I need to open my stuff on another editor just to copy text neutral.

@fungos
Copy link

fungos commented Jan 26, 2018

This is becoming too annoying that I'm considering getting back to sublime only because of this tiny issue. Let it be at least configurable like: copyRawTextOnly or something.

There are times where we want to copy/paste with language syntax highlight, that is fine. But if the text is ie. Markdown, a .txt file or just a opened unsaved buffer, then it is raw text and nothing else, so avoid styles and coloring in these situation please.

@oxydron
Copy link

oxydron commented Jan 31, 2018

@fungos and moreover, most text editors I record, do copy/cut operations neutral. To copy stuff with themes, colors, etc, should be a special feature, not the standard option, different from most text editors.

@NorthboundTrain
Copy link

A simple solution would be to have two capabilities, copy with formatting and copy without formatting, and then let the users decide which one is used when Edit -> Copy is chosen; they can put the other on a different key combination, if desired.

@oxydron
Copy link

oxydron commented Feb 26, 2018

The summary then:

  • ctrl+c (or copy) should copy only text
  • Provide a copy with formatting option
  • Provide a different shortcut for it like ctrl+shift+c

@stephen-mathew
Copy link

VSCode really lags behind with this feature. Really wish this was present - maybe as someone suggested, that copy+paste works on a default theme always and display has a different theme.

@amccaugh
Copy link

amccaugh commented Mar 8, 2018

Adding my voice to the mix, I agree with @oxydron it should be

  • ctrl+c (or copy) should copy only text
  • Provide a copy with formatting option
  • Provide a different shortcut for it like ctrl+shift+c

Text editors that copy plaintext with ctrl-c:

  • SublimeText
  • Atom
  • Notepad++
  • BBEdit
  • EditPlus
  • Notepad
  • Eclipse
  • Kedit
  • TextEdit

Editors that copy with theme formatting with ctrl-c:

  • VS Code

@jeremychone
Copy link

This is a big productivity breaker. Copy/Paste into a Gmail email has become very cumbersome. Somehow, I did not notice that until a few months ago.

My workaround right now is to paste it into an empty sublime text tab and then copy paste it back to gmail. I really love VSCode, and I am 99% migrated to VSCode, but for this "feature".

I think the default should be without style, but even if the default is with style, we should have at least a way to copy text only.

@gregolai
Copy link

Plain text copying should be the default.

@davydden
Copy link

davydden commented Jun 12, 2018

@rebornix

For short, temporary workaround is switching to the ideal theme you want to copy/paste. In the long term, we can provide an option for users to configure what theme they want to use for copy/paste.

why not providing an option to use text copying by default?

From #21071 (comment)

Make this a user setting like "editor.copyWithFormatting" and with the options true/false.

p.s. I use dark theme but I usually copy-paste the code as plain text. It's very inconvenient right now and I have to open some other editor and first paste the code there...

@C0FF33
Copy link

C0FF33 commented Jul 3, 2018

+1 This really is a no-brainer user setting to add, in fact, if nothing else, it should be turned off by default.

@Monolith-681
Copy link

+1. This is a necessity.

@pragdave
Copy link

pragdave commented Sep 2, 2018

While waiting for a fix, I hacked up an ugly bit of Swift (my first time coding Swift) that removes the background color on OS X.

https://gist.github.com/pragdave/6fc95ff2420dea51842717a5da7a98ff

@rednevals
Copy link

Is anyone working on this? It's very annoying. It's hard to believe that this is not bothering more people, ;)

@rebornix
Copy link
Member

In latest Insiders, you can disable copy with syntax highlighting by setting editor.copyWithSyntaxHighlighting to false and command "Copy with syntax highlighting" still works as expected.

Right now, we don't have plan to support copying with another theme in the near term.

@rebornix rebornix added the *out-of-scope Posted issue is not in scope of VS Code label Sep 11, 2018
@vscodebot
Copy link

vscodebot bot commented Sep 11, 2018

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@platy
Copy link

platy commented Mar 29, 2019

The config setting which allows switching to a plain text copy editor.copyWithSyntaxHighlighting pointed out by @rebornix above is available in the stable release now (possibly since some time ago).

@jihu
Copy link

jihu commented Mar 1, 2021

The config setting which allows switching to a plain text copy editor.copyWithSyntaxHighlighting pointed out by @rebornix above is available in the stable release now (possibly since some time ago).

This is not correct, sadly. I just tested this, copying an xml attribute that is styled as bold and blue. Setting copyWithSyntaxHighlighting to true removes the blue color from the copied text, but the bold format still remains. That is clearly not "plain text".

@matkoniecz
Copy link
Contributor

@jihu In such case you may try to open new issue, if it is not already covered by one of open or rejected ones.

Here "copy with another theme" was rejected, but "copy as a proper plaintext like any sane editor" was not (maybe it was rejected elsewhere!)

@jihu
Copy link

jihu commented Mar 4, 2021

@matkoniecz I did create a ticket after posting that comment:

#117879

@ivyshaft
Copy link

ivyshaft commented Nov 2, 2023

I recently found this thread. I solved this issue for myself by setting up a convenient hotkey to toggle the Dark mode.

Hit Ctrl + Shift + P to pull up the Command Palette. Search for "Toggle" and you should see the following option appear: "Preferences: Toggle between Light/Dark Themes".

You can set a hotkey combo for this function and VSCode will switch between your preferred Light and Dark themes quickly. This makes copying the text while using light theme much quicker, and allows you to switch back to Dark mode for editing quickly.

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-clipboard Editor clipboard issues feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code
Projects
None yet
Development

No branches or pull requests