ryu1kn / vscode-partial-diff

Visual Studio Code Extension. Take a diff of 2 parts of text(s)
https://marketplace.visualstudio.com/items?itemName=ryu1kn.partial-diff
MIT License
184 stars 15 forks source link

Compare with Clipboard doesn't work properly on Windows 10 #12

Closed ctinghino closed 7 years ago

ctinghino commented 7 years ago

Everytime I try the option to Compare Text with Clipboard I see all the file differs from the clipboard. This happens even if I compare a file with itself. I'm on Windows10, vscode version 1.15.1

I disabled the extension

ryu1kn commented 7 years ago

Could it be because of like newline character difference?

quasarea commented 7 years ago

indeed it is, it looks like it converts \r\n into \n in clipboard and diff it against \r\n in source

VicCarLs commented 7 years ago

I have the same problem. When I copy text from a file with \r\n, it is \n on the clipboard. Can you add an option to compare ignoring carriage returns?

ryu1kn commented 7 years ago

Thanks guys. Yeah, we need to do something about it otherwise Compare Text with Clipboard function on Windows 10 is pretty useless.

I had a look at issues on clipboardy which Partial diff internally uses for clipboard interaction. There are several issues reported about Windows and EOL characters. I'll see if using the latest version of clipboardy fixes the problem first.

ryu1kn commented 7 years ago
  1. Open a file
  2. Copy the file contents into clipboard with Ctrl+C
  3. Execute "Compare Text with Clipboard" command
  4. Get the following diff view where there should be no diff

unnamed

ryu1kn commented 7 years ago

I'll see if using the latest version of clipboardy fixes the problem first.

Updated v1.1.2 to v1.1.4. Didn't fix the problem.

ryu1kn commented 7 years ago

As reported in https://github.com/sindresorhus/clipboardy/issues/27 , getting \r\r\n for EOL

ryu1kn commented 7 years ago

Released as v0.3.3. It would be great if you can test it out @quasarea @VicCarLs 😉

quasarea commented 7 years ago

Works great, thanks!

ryu1kn commented 7 years ago

Thanks for confirming it 👍