-
Notifications
You must be signed in to change notification settings - Fork 9
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
Character diffs should typically be on word boundaries #4
Comments
As a counterpoint, here's an example where the current character diffs do really well, but word diffs might not: (before)
(after)
|
Should be fixed by e8d7b91. |
The '_p' → 'P' diff isn't ideal (shows up as '_pair' → 'Pair'), but otherwise this is a big win. |
cool! fwiw, I don't mind also just saw this in the wild: happy to see this fixed |
codediff.js often makes poor choices about how to present character diffs. For example, in this three line diff:
Before:
After:
it shows these character diffs:
All three of these have problems, and all three would be improved by making the intra-line diffs operate at the word level, rather than the character level. In other words, rather than applying the diffing algorithm to
line.split('')
(which splits the line into individual characters), it should be applied to a list containing the words in the line. These are broken by whitespace, symbols and capital/lowercase transitions.The text was updated successfully, but these errors were encountered: