mmanela / diffplex

DiffPlex is Netstandard 1.0+ C# library to generate textual diffs.
Apache License 2.0
996 stars 183 forks source link

#47: Implement chunker that preserves line endings #48

Closed cezarypiatek closed 4 years ago

cezarypiatek commented 4 years ago

Hi This PR should fix #47. I've made also a small refactoring by introducing IChunker interface which simplifies the DIffer. In my opinion, the IDiffer interface should be cut to:

DiffResult CreateCustomDiffs(string oldText, string newText, bool ignoreWhiteSpace, bool ignoreCase, IChunker chunker);

and the rest of the overloads should be implemented as the extension methods. IMHO the name should be also simplified, let's say CreateDiff. Of course, these are breaking changes so I want to discuss it at first.

EDIT: I realized that this not enough to fix the problem because InlineDiffBuilder has hardcoded an invocation of specific overload from IDiffer. I needed to go further and I made another refactor by making an IChunker a constructor dependency for DIffer class. Now the API is much simpler and the extensibility and testability has been improved.

mmanela commented 4 years ago

@cezarypiatek Overall looks great. Thanks for working through this

cezarypiatek commented 4 years ago

Thanks for merging. Where can I expect the release of the new version?

mmanela commented 4 years ago

Pushed it now 1.5

cezarypiatek commented 4 years ago

Cool, thank you.