Closed ExplodingCabbage closed 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?
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.
Three fixes here:
ignoreWhitespace
now behaves the same as otherignoreXxx
methods - i.e. changes how tokens are compared for equality but does NOT affect thevalue
s that show up in the returned change objects. Resolves https://github.com/kpdecker/jsdiff/pull/219.newlineIsToken
andignoreWhitespace
. Resolves https://github.com/kpdecker/jsdiff/issues/472, albeit not quite in the way I'd originally intended.diffTrimmedLines
. I don't see a reason to have two ways (diffTrimmedLines
&ignoreWhitespace
) to do exactly the same thing, so I've purged one from the documented API. (I'll still keep the method itself around just for backwards compat, though.)For me to do before merging:
diffTrimmedLines
.newlineIsToken
andignoreWhitespace
.