Improve diff readability for eg "Bob," -> "Bob"#7
Open
laughinghan wants to merge 2 commits intoj-e-d:masterfrom
Open
Improve diff readability for eg "Bob," -> "Bob"#7laughinghan wants to merge 2 commits intoj-e-d:masterfrom
laughinghan wants to merge 2 commits intoj-e-d:masterfrom
Conversation
If a hunk consists of only deleting or only adding at the beginning
or end of a word, then combine them into one hunk.
Examples:
Changes from simplediff:
- Alice, Bob and Charlie
+ Alice, Bob, and Charlie
simplediff: Alice, <del>Bob</del><ins>Bob,</ins> Charlie
this diff: Alice, Bob<del>,</del> Charlie
- Alice Bob Charlie's Angels And David
+ Alice Bob Charlie David
simplediff: Alice Bob <del>Charlie's Angels And</del><ins>Charlie</ins> David
this diff: Alice Bob Charlie<del>'s Angels And</del> David
Same as simplediff:
hunks you wouldn't want simplified:
- Alice Bob Charlie
+ Alice Robert Charlie
diff: Alice <del>Bob</del> <ins>Robert</ins> Charlie
if the change isn't only at the beginning or end:
- Alice Bob Charlie
+ Alice Blob Charlie
diff: Alice <del>Bob</del> <ins>Bob</ins> Charlie
- Alice Bobby Charlie
+ Alice bb Charlie
diff: Alice <del>Bobby</del> <ins>bb</ins>
- Alice Zeneca Charlie
+ Alice AstraZeneca Charlie's
diff: Alice <del>Zeneca Charlie</del> <ins>AstraZeneca Charlie's</ins>
Owner
|
Thanks for the PR @laughinghan, let me find some time to test it locally and I will merge it if it looks good. |
Owner
|
@laughinghan the problem I have with your proposed patch is with cases like the following: The I would be OK and like that the algorithm didn't consider punctuation marks as part of a word, but I don't want words to be cut into parts when they are changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a hunk consists of only deleting or only adding at the beginning
or end of a word, then combine them into one hunk.
Examples:
Changes from
simplediff:simplediff: Alice,
BobBob, Charliethis diff: Alice, Bob, Charlie
simplediff: Alice Bob
Charlie's Angels AndCharlie Davidthis diff: Alice Bob Charlie
's Angels AndDavidSame as
simplediff:hunks you wouldn't want simplified:
diff: Alice
BobRobert Charlieif the change isn't only at the beginning or end:
diff: Alice
BobBlob Charliediff: Alice
Bobbybb Charliediff: Alice
Zeneca CharlieAstraZeneca Charlie's