vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Cannot select text from deleted lines diff view

Open coreh opened this issue 9 years ago • 112 comments

  • VSCode Version: 1.3.0-insider
  • OS Version: OS X 10.11

Steps to Reproduce:

  1. Open a file with changes in inline diff mode
  2. Try to select the red (deleted) lines (You can't)

You can select them normally in the side-by-side. Being able to do so is useful to restore/revert small pieces of code manually by copying and pasting.

coreh avatar Jun 27 '16 22:06 coreh

That is a limitation of how the inline diff is implemented. I wonder if we can alleviate this limitation by adding a button somewhere in there (copy or revert this change) that would show up on hover

alexdima avatar Jun 28 '16 09:06 alexdima

Instead of buttons, there can be code actions in the diffs for Previous | Next | Copy original | Revert to original like the one provided with git merge. I have requested the feature at #30519

gulshan avatar Jul 18 '17 18:07 gulshan

With all due respect, please just fix the inline diff implementation. No need for extra buttons. If you've had this bug around for a year, you should just make the right fix at this point.

Note that this also prevents ctrl-F from working correctly, since it can't find results in the removed lines. "Copy original" buttons don't avoid that issue.

Edit: this is a daily source of frustration, missing relevant changes because I don't get the results I should when using ctrl-F, and being unable to quickly select removed code for pasting into a search box. I rescind my "due respect", this is absolutely stupid behavior and ridiculous that there has been no action on this item. Literally any other diff program (windiff, odd, VS, etc) will allow you to select text from both files and get search results from both files.

DrQuailMan avatar Jul 18 '17 21:07 DrQuailMan

This is one of the reasons that I have to open Visual Studio or another diff tool. When traveling the side by side is not an option on small laptops screens and not being able to find or copy the deleted code it is a significant loss.

jenseralmeida avatar Dec 11 '17 17:12 jenseralmeida

I think this is a very necessary function !

hoangnamitc avatar Feb 26 '18 12:02 hoangnamitc

Yes, this limitation basically forces the user to revert the whole batch of changes just to be able to get a single deleted line back. Its not a big deal if the line was just deleted - that is ctrl+z is for, but if I did a bunch of changes since already it's obviously not an option. I often just need to copy one single chunk of text and put it back into the file. Often not even at the location where it was removed from. But I can't.

I think it has something to do with the fact that the removed text is not a part of the surrounding, still present text - so you can't select them together, but I think if the user started selction inside the removed (red) line - he could/should be limited to selecting (and copying) the text only in the same red region.

Spown avatar Mar 23 '18 07:03 Spown

Any news on this?

/cc @alexandrudima @rebornix @bpasero

ghost avatar May 07 '18 12:05 ghost

A quick workaround is to switch to side by side view that allows copy/paste.

lukeza avatar Jun 21 '18 12:06 lukeza

This is just painful and makes me so sad.

ghost avatar Dec 06 '18 20:12 ghost

It is surprising to see such a common feature request pending from 2016. Or was it solved in some intermediate vscode releases and reappeared again in 1.31? Also right click doesn't work on left side. Even in side by side view, I was able to select the deleted text, but can't copy it.

drdebmath avatar Feb 13 '19 18:02 drdebmath

@drdebmath I searched the VS release notes, I don't think this was ever fixed in earlier versions. There have been multiple such requests over time, so a lot of people do want this.

My current "workaround" is to just have Sublime Text open as well - which I use as my git tool - using its amazing GitSavvy plugin.

dufferzafar avatar Feb 20 '19 15:02 dufferzafar

It is a bit frustrating to be able to see deleted text and not being able to select it haha

yalopov avatar Mar 08 '19 16:03 yalopov

@alexandrudima @rebornix @bpasero any updates here?

Stanzilla avatar Apr 22 '19 10:04 Stanzilla

Can we test/help?

phifa avatar Apr 30 '19 09:04 phifa

This was actually the straw that broken the camels back reason for me to keep using WebStorm over VSCode (until WebStorm completely was unable to open a project without crashing ...) This is a SUPER needed feature. I often make changes and want to revert a little bit all the time (via a quick copy paste NOT revert a huge block). Without this ability it's super painful!

johnculviner avatar May 19 '19 01:05 johnculviner

Much much needed, please add this.!!

vitormv avatar May 22 '19 00:05 vitormv

Would have been very useful to have this.

Emettant avatar Jun 19 '19 19:06 Emettant

Please, this is a really important and necessary tool, and maybe a trivial one. Why are you so obstinated?

titoleiva avatar Jul 09 '19 07:07 titoleiva

@titoleiva are you able to work around this by using side-by-side view?

gjsjohnmurray avatar Jul 09 '19 09:07 gjsjohnmurray

@gjsjohnmurray, yes. It's the best option for now.

titoleiva avatar Jul 09 '19 09:07 titoleiva

Yeah this is really annoying...

nbransby avatar Jul 30 '19 16:07 nbransby

Not sure how this UX issue has been open since 2016...

ShoeQ avatar Aug 02 '19 13:08 ShoeQ

You can copy deleted content or deleted line, or revert change by quick actions on the gutter, with latest Stable 1.38.

actions-for-inline

rebornix avatar Sep 04 '19 21:09 rebornix

But it seems it's still not possible to stage deleted lines as this action does not exist in the gutter menu.

powerpaul17 avatar Sep 22 '19 12:09 powerpaul17

Yes, it is nice to see some improvements, but it took only a couple of usages to see how we still need the full editable capabilities to have a really enjoyable inline diff experience.

Visual studio code is really a pleasure to use, but I really miss my preferred way to work with diffs, fully functional 😉

jenseralmeida avatar Sep 23 '19 06:09 jenseralmeida

@rebornix thanks for the update that adds new functionality! It is definitely a step in the right direction!

That said, it would still be even better if we could copy any portion of the old diff.

I find I often only want to copy a small portion of the old diff instead of the entire thing. This is still not possible.

If you could make it so we could highlight and copy any portion of the old diff that would be ideal!

tnrich avatar Sep 23 '19 15:09 tnrich

Still seems to be an issue in 2019... Guess its time to go back to webstorm. 🤔

davidhiber avatar Oct 28 '19 12:10 davidhiber

Please fix this. I went through a whole file replacing hard-coded strings with references to constants in an internationalization matrix. My intent was to then go back through the diff, copy-pasting the original text in the deleted lines into the matrix. Have to do something a bit more roundabout, now.

jack-jjm avatar Nov 30 '19 12:11 jack-jjm

First comment of 2020! 🤣 😭

I would make use of this every day if it were fixed...

seanjfellows avatar Jan 09 '20 19:01 seanjfellows

Still waiting...

yzi-afk avatar Jan 16 '20 17:01 yzi-afk