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

Perform string diff on strings #43

Open
FireyFly opened this issue Feb 20, 2019 · 0 comments
Open

Perform string diff on strings #43

FireyFly opened this issue Feb 20, 2019 · 0 comments

Comments

@FireyFly
Copy link
Contributor

As you're no doubt familiar with, Github's diffs show not only which lines have changed, but also frequently which bits of the line changed, when you make changes to an already existing line.

I'm not sure exactly how this is implemented, but I imagine it would be something like: perform the usual diff algorithm using lines as "atoms". Then, if the resulting diff would have a - followed by +, perform a char-by-char diff of these two lines. If the lines are at least n% similar, highlight the char-by-char diff in a stronger formatting to emphasize which bits of the line changed.

I think something similar for string values in the JSON data would be very handy. In the particular JSON data I've worked with, I'm importing data from a source, and from one import to the next there might've been typo fixes or small changes to description strings in the data. It would be very convenient to be able to tell at a glance exactly which bits were added/removed. So, I think it would be nice to perform a standard char-by-char diff of string values, if there is a - of a string value, followed by a + of a string value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant