kpdecker / jsdiff

A javascript text differencing implementation.
BSD 3-Clause "New" or "Revised" License
8.04k stars 499 forks source link

Sort out behaviour of newlineIsToken and ignoreWhitespace #486

Closed ExplodingCabbage closed 7 months ago

ExplodingCabbage commented 7 months ago

Three fixes here:

For me to do before merging:

ExplodingCabbage commented 7 months ago

@Mingun I'd welcome any comments you have on this. Have I failed to properly handle anything here that your PR did better?

Mingun commented 7 months ago

Hi @ExplodingCabbage!

My intention was to get correct diff behavior that you usually expect from code diffs. When I implemented my fix in #219 I think, I got the expected results, that TortoiseGitMerge and similar tools give you when you merge file in ignored whitespace mode. I probably didn't actually investigate that behavior is identical, but I remember that at least results was not surprising:

Anyway, I think, that your fix is simpler, but I suggest to take tests from my PR, because they:

I think, that having them it is much better to understand what to expect from results.