Skip to content
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

Handle case where the user explicitly passes maxEditLength: 0 the way you'd expect #464

Merged
merged 4 commits into from
Jan 8, 2024

Conversation

ExplodingCabbage
Copy link
Collaborator

Previously, this was treated as if the maxEditLength option wasn't provided at all, which seems surprising. Obviously, passing maxEditLength: 0 isn't usually gonna be a very useful thing to do, but you can imagine a system where there's a configurable max edit distance between two texts with a UI that lets you put it all the way down to 0, and jsdiff is being used both to check that the max distance is being adhered to and to display the diff. In such a case, the current behaviour would introduce a surprising bug in the maxEditLength: 0 case.

This PR makes jsdiff instead treat maxEditLength: 0 as specifying a max edit length of 0.

@ExplodingCabbage ExplodingCabbage merged commit b3aab68 into 6.0.0-staging Jan 8, 2024
@ExplodingCabbage ExplodingCabbage deleted the maxEditLength-0 branch January 8, 2024 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant