I hope I am not breaking any rules here. I have a question about another post, but I am not a big user on stackoverflow, so my reputation is too low to add a comment to questions or answers that are not my own.
On this question: How to compare two rich text box contents and highlight the characters that are changed?
TaW provided some sample C# code and we have made use of that in a Visual Studio project. But, we discovered a problem and don't know how to fix it.
If RTB1 contains the text "My name is David" and RTB2 contains the text "My name is", then after the comparison is run there are two diffs in the diffs collection and somehow, when the rich text boxes are rewritten to show the differences, RTB1 is an exact match of RTB2 and nothing is highlighted. Maybe this is the expected behavior and we just are not realizing that, but we were hoping that the text " David" in RTB1 would be highlighted.
If the text in RTB2 is "My name is " (two added spaces at the end of the line), then we get the expected behavior.
I should have mentioned that we wrote a VB.NET equivalent of TaW's C# code and just noticed a difference. I have noted the difference in the comments.
If I was up to 50 reputation, I would have also added in my comment that we are very thankful to TaW for sharing his example, as well as the creator of DiffMatchPatch.