Closed boukenka closed 3 years ago
The default word separator does not consider < or > to break words (this may be a mistake but has been this way for a long time). To get around this you need to pass your own word breaker. The below code shows you how:
string oldText = "<revision>1<revision>";
string newText = "<revision>2</revision>";
char[] wordSeparaters = { ' ', '\t', '.', '(', ')', '{', '}', ',', '!', '?', ';', '<','>' };
var delimiterChunker = new DelimiterChunker(wordSeparaters);
SideBySideDiffBuilder sideBySideDiffBuilder = new SideBySideDiffBuilder(Differ.Instance, new LineChunker(), delimiterChunker);
SideBySideDiffModel sideBySideDiffModel = sideBySideDiffBuilder.BuildDiffModel(oldText, newText);
Thank you @mmanela. I will give it a go. 😄
That solved my problem. 😄
May I suggest the following two points, please.
Thanks again @mmanela.
@boukenka Both are reasonable suggestion. Would you be interested in contributing :) PRs are gladly appreciated
Hello,
I am doing the following :
The result should be that only character '1' has been changed to '2'. Or it is not the result. The line of the old text is defined as deleted in the subPieces and the line of the new text is defined as inserted in the subPieces. Could you help please? Is it by design? Is there a workaround?
PS: If ignoreWhiteSpace is set to True or False, the result remains the same.