Community Wishlist Survey 2021/Editing/Copy and paste from diffs

From Meta, a Wikimedia project coordination wiki

Copy and paste from diffs

  • Problem: It is difficult to copy and paste from a diff without having to edit the resulting text afterwards.
  • Who would benefit: Everyone
  • Proposed solution: 1) Add CSS similar to Github to not include the + or - signs when copying. 2) Allow the ability to select text from just one column rather than having to copy both columns.
  • More comments:
  • Phabricator tickets: T192526, T270775
  • Proposer: Rschen7754 01:16, 17 November 2020 (UTC)Reply[reply]


  • Good idea. I've noticed this annoying problem before, and it shouldn't be too hard to fix. --Piotrus (talk) 04:43, 17 November 2020 (UTC)Reply[reply]
    • It is harder to fix then you think. That's because browsers for security reasons, don't like it when you copy things and then 'leave out' parts of what you have selected. That can be abused in phishing for instance. Perhaps we can completely revamp the layout of the diff, maybe with grid layout CSS or something to avoid this problem... Haven't checked yet if that is possible now, but a couple of years ago, browser support wasn't there yet to enable an alternate layout. Could be worth a revisit. —TheDJ (talkcontribs) 11:39, 17 November 2020 (UTC)Reply[reply]
      • It's fine to change what gets written to the clipboard. The onCopy event fires just before the data is written to the clipboard so you can modify the selection. We use such a technique in VE to ensure we write Parsoid HTML to the clipboard instead of what you see on the page. ESanders (WMF) (talk) 15:39, 24 November 2020 (UTC)Reply[reply]
      • Grid is still not greatly supported by the long tail. --Izno (talk) 01:18, 21 November 2020 (UTC)Reply[reply]
  • +1 ~~ CAPTAIN MEDUSAtalk 12:11, 17 November 2020 (UTC)Reply[reply]
  • Agreed it should be done. Anyway you can hold ctrl while selecting text and it should do the trick (at least on Firefox / Windows). Stryn (talk) 20:17, 17 November 2020 (UTC)Reply[reply]
    What? Just holding Ctrl? No way that could… Oh, it works! Thanks! --Mormegil (cs) 08:13, 15 December 2020 (UTC)Reply[reply]
  • Absolutely. This is a pretty annoying problem especially in communities where quoting from diffs is common practice (such as enwiki where I copy from diffs hundreds of times a year at least, no exaggeration). Best, KevinL (aka L235 · t) 06:44, 1 December 2020 (UTC)Reply[reply]
  • This appears to have been resolved. (Many thanks to TheDJ and PeterTheOne, and code reviewers ESanders and Thiemo Kreuz.) Deployment will happen over the next couple days, if I understand correctly. --Yair rand (talk) 07:46, 1 December 2020 (UTC)Reply[reply]
  • What is a diff? I assume it's a 'Difference revision' of an article --RanuKanu (talk) 09:33, 15 December 2020 (UTC)Reply[reply]
A diff is the difference between two versions of any wikipage, where the differences are shown. Something like this, and those little + are copied with the real stuff, if you mark them and press ctrl-c. If there is text on both sides of the relevant parts, that's included as well. Grüße vom Sänger ♫(Reden) 23:11, 20 December 2020 (UTC)Reply[reply]