wl-clipboard icon indicating copy to clipboard operation
wl-clipboard copied to clipboard

Treat git patches as text

Open vinliao opened this issue 5 years ago • 4 comments

Same issue as #102, but for git patch files.

Steps to reproduce:

  1. Create a patch file with git format-patch.
  2. Let's assume that the file name is new.patch.
  3. Run cat new.patch | wl-copy
  4. Try pasting... nothing happens.

Just like #102, adding --type text/plain solves the issue, but it's a nuisance.

vinliao avatar Nov 23 '20 03:11 vinliao

Just like in #102, you can copy git patches, it's just the target software that doesn't want to paste them 🙂

I should add a workaround for the type, but saying that you can't copy is just wrong.

bugaevc avatar Nov 23 '20 06:11 bugaevc

Oh... pardon my lack of understanding. So the clilpboard actually registers those unpasteable text, and it's the input text that rejects anything beside text/plain?

I thought it's about wl-copy rejecting anything that's not text/plain.

vinliao avatar Nov 23 '20 12:11 vinliao

Yes, everything works except for pasting into the target application (because it doesn't think it can paste git patches, even though it can, because git patches are just text). Copying works, the clipboard works, pasting works — but the target app doesn't accept it.

You can always paste from the clipboard or inspect the actual state of clipboard using wl-paste:

  • wl-paste will always paste what's currently in the clipboard (unlike all those other apps, it doesn't refuse pasting unknown types), so you can use it to check whether something has actually been copied or not
  • wl-paste --list-types (or wl-paste -l for short) will list the types the current selection is offered in (such as plain/text or application/pgp-encrypted)

I've previously shown you how to inspect the clipboard with it in https://github.com/bugaevc/wl-clipboard/issues/102#issuecomment-727175552. See the man page for some more things wl-clipboard can do for you.

Does that make sense / make it clearer what's going on?

bugaevc avatar Nov 23 '20 13:11 bugaevc

To be quite honest with you, I didn't inspect the clipboard when you showed me at #102. I just placed --type text/plain and went on with my day.

That's a misundertanding on my end, and yes, it makes sense now.

vinliao avatar Nov 23 '20 13:11 vinliao