New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unexpected diffchars result #514
Comments
No, there's no option that will achieve the result you want here; the result jsdiff gives is the one that the Myers diff algorithm, implemented as described in Myers's paper, gives. I'm not totally opposed to concrete proposals about options for tweaking this, but I'm not sure what such an option would look like (nor indeed what underlying rule you're envisaging that makes your "expected" output here be, well, expected). |
The Levenshtein distance between the two strings is 1, so a diff would ideally contain a single substitution (i.e. insertion and deletion at the same index). |
@kerams aha - you're thinking in terms of substitutions! Okay, #475 is the issue that would give you what you want, then - but it'd be a drastic addition of an entirely new algorithm to the library. The Myers diff algorithm has no concept of substitutions - only of insertions and deletions - which is why it sees the two diffs in @void285's post as having equal edit distance. |
Hi, this is unexpected:
expected:
but got:
Is there any option to achieve the expected result? Thanks.
The text was updated successfully, but these errors were encountered: