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

Paste as plain text #1684

Closed
kalaschnik opened this issue Mar 25, 2020 · 52 comments
Closed

Paste as plain text #1684

kalaschnik opened this issue Mar 25, 2020 · 52 comments
Assignees
Labels
Idea-New PowerToy Suggestion for a PowerToy Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@kalaschnik
Copy link

kalaschnik commented Mar 25, 2020

Crutkas: See Comment below for an update for Windows build 21318

Summary of the new feature/enhancement

Most of the time people copy rich text from their browser or some application, and want to insert the text without the source (or any) formatting. Some applications allow to Paste as plain text (e.g. browser, or some Linux distros, macOS: Shift+Option+Command+V)) using Ctrl+Shift+V. However, a global Windows shortcut would solve a lot of trouble, preferably to Ctrl+Shift+V

@crutkas crutkas added the Idea-New PowerToy Suggestion for a PowerToy label Mar 25, 2020
@crutkas
Copy link
Member

crutkas commented Mar 25, 2020

this is a great idea.

@pakbaz
Copy link

pakbaz commented May 20, 2020

I love this idea, I often find myself using this and improvise from either using a notepad to using random third party apps like PureText but none of them is easy. having them in PowerToys is amazing. I can help too

@crutkas crutkas added this to the Suggested Ideas milestone Jun 11, 2020
@noseratio
Copy link

noseratio commented Jun 16, 2020

Up-voted! Also as an improvement to what PureText already does, can we add a UI option to enable filtering out any trailing CR/LF characters before pasting?

When I do copy/paste into my command line prompt from (say) a web page, I normally want to edit the text I've pasted before executing it, to avoid any potentially dangerous consequences. Removing all trailing CR/LFs would help preventing automatic execution.

@crutkas, does it sound like a feasible feature?

Updated, I've open-sourced my own side project for copy-pasting in plain text and more. Hopefully, it might be useful to others.

@crutkas
Copy link
Member

crutkas commented Jun 16, 2020

this seems like a great feature. I use run prompt as my scratch pad to unformat text all the time.

@kylejrp
Copy link

kylejrp commented Jun 17, 2020

I feel like Ctrl+Shift+C for Copy as plain text would also be useful.

@pakbaz
Copy link

pakbaz commented Jul 27, 2020

I feel like Ctrl+Shift+C for Copy as plain text would also be useful.

Some apps already use that shortcut as well as Ctrl+Shift+V For pasting as plain text. It would be trivial

@NickCraver
Copy link
Member

I would look at this feature as one of 2 potential paths: it either has a UI (on keypress), or it doesn't. If it does have a UI, then this can be quite an expansive feature later. I personally use Ditto (link) which does several things on Ctrl+Shift+V (by default), mainly showing a paste buffer history, like this (it can do images, note the search down bottom, etc.):
image

Upon selecting the top item (click or Enter), it's pasted. If you press Shift+Enter, it pastes without formatting. FWIW, I find this to be quite intuitive.

In the PT case, I think the overlapping issue is #671 (though that layout is much too whitespace-y for my taste 😉). I just wanted to add to the discussion pasting with or without formatting and which item you're pasting in a history context matters and these two will inevitably inter-relate. We should consider that when choosing shortcuts given the relatively few default possibilities.

As with many of the PT proposals, I definitely recommend looking at existing behaviors, like Ditto and others, and see how they look and feel.

@noseratio
Copy link

As with many of the PT proposals, I definitely recommend looking at existing behaviors, like Ditto and others, and see how they look and feel.

The built-in Win10 Clipboard Manager (Win+V) should be able to fit nicely in this picture, too. IMO, ideally the clipboard management should be the feature of Windows, not PT.

A shameless plug, you may want to try out the related tool I maintain, DevComrade. Among other things, it allows to use Win+Ins for pasting a single unformatted line, so nothing gets executed automatically. Time permitting, I'm going to explore Monitoring Clipboard Contents API and more modern WinRT's Clipboard Class to see if I can integrate it with Win10 Clipboard Manager.

@crutkas crutkas added the Help Wanted We encourage anyone to jump in on these and submit a PR. label Oct 2, 2020
@TheMulti0
Copy link

Excellent idea!

@shanselman
Copy link
Member

shanselman commented Nov 18, 2020

Coming back to say we need this. I am using PureText.exe (Win+V) but the ask is really to make Ctrl-Shift-V a WINDOWS GLOBAL STANDARD for pasting as Plain text. Chrome and Teams already do this. on

@noseratio
Copy link

noseratio commented Nov 18, 2020

to make Ctrl-Shift-V a WINDOWS GLOBAL STANDARD for pasting as Plain text.

@shanselman, perhaps, the challenge to make it work for all existing apps is to settle on how to implement it. There are a few options but none is perfect, IMO:

  • Simulate typing via SendInput. I've tried this approach (see my comment above) and while it works generally well, simulating typing is an async process by its nature and there may be some side effects. I had to tackle them on per-app basis. I still use this approach for apps like Windows Terminal and VS Code via a custom hotkey (Win+Ins). I think PureText also uses SendInput, and in my experience, it wasn't always reliable, sometimes nothing was getting pasted.

  • Sanitize the clipboard by stripping out formatting when new rich text is copied, using something like Clipboard Monitoring API. Then Ctrl+V simply works. This is what I currently use the most and I find it the best compromise, but it's still not perfect. There are rare cases when I need to paste rich formatting, so I disable filtering manually (with a timeout to enable it back automatically).

  • Sanitize the clipboard right upon Ctrl+Shift+V, then simulate Ctrl+V and perhaps restore the clipboard formatting afterwards. This is non-deterministic because there's no feedback from the app as to when the text has been pasted. So it leaves a gap for side effects as well, but it's still a viable option to explore.

  • Make Windows Clipboard API return plain text as long as Shift key is hold (perhaps, the best option, but I wouldn't keep high hopes 🙂 about this).

  • Introduce some new Win32 standard (like WM_PASTEPLAINTEXT) and some UWP standard to encourage the new apps to adopt pasting plain text. Not a 100% solution but would be the right thing to do.

  • Any other ideas? // @crutkas

@shanselman
Copy link
Member

https://stevemiller.net/puretext/ does it reliably and has for years. What does Steve do?

@noseratio
Copy link

https://stevemiller.net/puretext/ does it reliably and has for years. What does Steve do?

Could be just "my machine", but with PureText I'd often hit Win+V and nothing would happen, besides the beep. Especially with console apps. I only started playing with a custom app because of this.

@ghost
Copy link

ghost commented Nov 19, 2020

But it doesn't seem to be open source

@noseratio
Copy link

But it doesn't seem to be open source

PureText doesn't seem to be open-source, but another popular app mentioned here, Ditto Clipboard Manager, is.
My tool DevComrade is also open-source.

@ghost
Copy link

ghost commented Nov 19, 2020

@crutkas What about an integration?

@ghost
Copy link

ghost commented Nov 19, 2020

This issue has the "Help-Wanted" label. Someone could help integrate DevComrade? Ditto is not an option because its GPL licensed

@noseratio
Copy link

This issue has the "Help-Wanted" label. Someone could help integrate DevComrade? Ditto is not an option because its GPL licensed

I think we need first decide on what the pasting behavior should be, given the current array of implementation options. What DevComrade does really isn't a universal solution (see my comment above), it's just something that has worked for me.

E.g., I prefer stripping out formatting upon copying in-place in the clipboard, so later Ctrl+V just does the default thing for the current app.

@ghost
Copy link

ghost commented Nov 19, 2020

This issue has the "Help-Wanted" label. Someone could help integrate DevComrade? Ditto is not an option because its GPL licensed

I think we need first decide on what the pasting behavior should be, given the current array of implementation options. What DevComrade does really isn't a universal solution (see my comment above), it's just something that has worked for me.

E.g., I prefer stripping out formatting upon copying in-place in the clipboard, so later Ctrl+V just does the default thing for the current app.

Then it is something that we would have to wait for a while OR manage behavior customization after the "integration"

@ghost
Copy link

ghost commented Nov 19, 2020

Love to hear what @crutkas thinks about this.

@crutkas
Copy link
Member

crutkas commented Nov 20, 2020

to me, the ask here is be consistent across everything,

  1. low level hook to Shift+Ctrl+V
  2. Grab clipboard
  3. format as plain text
  4. force a paste

This could be a service but no matter what, it has to be able to be run as admin due to scenarios like Terminal is being run as admin. If you have just gotten into muscle memory of using that shortcut, it won't fire unless this process is admin

@noseratio
Copy link

noseratio commented Nov 20, 2020

force a paste

@crutkas, I wonder how exactly do you plan to force the paste? I can think of the following options:

  • SendInput
  • Put the plain text back to the clipboard, then simulate Ctrl+V

I've actually tried both and they both have some shortcomings I mentioned in the comments above.

@crutkas
Copy link
Member

crutkas commented Nov 20, 2020

I'm embracing my PM role right now for expectations.

My first round of people to chat with is the Win-V team and see what they did.

@noseratio
Copy link

My first round of people to chat with is the Win-V team and see what they did.

👍 Please report back to the community 🙂

@kalaschnik
Copy link
Author

Was there some news from the Win-V team, @crutkas?

@kwilcz
Copy link

kwilcz commented Feb 27, 2023

This got implmented with insider build 21318

Yeah, up 'till this day it is not :(

It is though, on standard W11 just with no hotkey:
image

@Jay-o-Way Jay-o-Way added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Feb 28, 2023
@Jay-o-Way Jay-o-Way moved this from In Progress ⚒️ to Done ✔ in Test for PowerToys Feb 28, 2023
@quangkieu
Copy link

@Wando1423
Yeah there is no shortcut or custom shortcut. And you need to enable clipboard logging which I disable
How about paste as escaped quote/slash for copy into visual studio?

@maisondasilva
Copy link
Contributor

Love this feature, link https://aka.ms/PowerToysOverview_PastePlain leads to a 404 page @crutkas

@Jay-o-Way
Copy link
Collaborator

Love this feature, link https://aka.ms/PowerToysOverview_PastePlain leads to a 404 page

Known cause, explained in #24403

@maisondasilva
Copy link
Contributor

Love this feature, link https://aka.ms/PowerToysOverview_PastePlain leads to a 404 page

Known cause, explained in #24403

Thanks for the warning @Jay-o-Way

@itsthisjustin
Copy link

Just happened across this thread via my PowerToys update. Not sure if it's possible at all but I just released a clipboard manager that would be amazing to integrate with PowerToys. It's pretty early but available for free at https://pasteboard.app if anyone wants to check it out. It's fully reboot persistent, has search and pinned items, and will soon have Onedrive cloud sync and mobile companion apps.

@noseratio
Copy link

https://pasteboard.app

Very nice! (this is coming from someone who believes to be quite familiar with the topic).

For cloud sync'ing, may I suggest adding end-to-end encryption with a master key, opaque to the cloud, similar to how Chrome Password Managers does it.

@Aaron-Junker
Copy link
Collaborator

Just happened across this thread via my PowerToys update. Not sure if it's possible at all but I just released a clipboard manager that would be amazing to integrate with PowerToys. It's pretty early but available for free at https://pasteboard.app if anyone wants to check it out. It's fully reboot persistent, has search and pinned items, and will soon have Onedrive cloud sync and mobile companion apps.

Please open a new issue and tag me with @Aaron-Junker

@TimB1023
Copy link

TimB1023 commented Mar 2, 2023

Great addition to PowerToys! I've been using PureText by Steve Miller for years, but it's nice to have everything together in one tool
https://stevemiller.net/PureText/

@Aaron-Junker
Copy link
Collaborator

This was implemented in release 0.68. Thank you for the enhancement request!

@jsuelwald
Copy link

jsuelwald commented Mar 24, 2023

This was implemented in release 0.68. Thank you for the enhancement request!

Can this feature be enhanced? The documentation specifies that this changes the contents of the clipboard. Why don't store the content before using ths and then restoring it to its former content?

@Aaron-Junker
Copy link
Collaborator

This was implemented in release 0.68. Thank you for the enhancement request!

Can this feature be enhanced? The documentation specifies that this changes the contents of the clipboard. Why don't store the content before using ths and then restoring it to its former content?

This is tracked in #24468

@jeremykyle183
Copy link

jeremykyle183 commented Mar 24, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Idea-New PowerToy Suggestion for a PowerToy Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
Status: Done
Development

No branches or pull requests