You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interesting. #254 was about the same behaviour in the context of jsdiff's patch-generation functions, and I closed it saying the behaviour is correct. I think I agree with myself with regards to patches. When it comes to change objects as returned from diffLines, though, I'm less certain, but still inclined towards the same answer - that this is how things should work. (Though I should probably note it in the docs.)
How do you reckon things ought to behave, here? It would be weird if your first example returned literally the exact same result as your second one since then it'd be adding in an extra \n character after the c that wasn't there in the original text.
The line with a "b" does not change : the newline character is a separator and should be treated at such when using diffLines.
So that second line should not be marked as being removed.
A computer doesn't care so it's not an issue if you generate patches.
But diffLines is probably targeted at humans, and as a human I don't like this 🙂.
yields:
I need to add a trailing \n to get the expected, simpler result.
The text was updated successfully, but these errors were encountered: