To reproduce the bug, add two newlines to the end of an empty multi-line edit control. When the second newline is added, the old text will be "\n" and the new text will be "\n\n". Before this fix, the function mistakely calculated 1 byte as a common suffix since both strings ended with a newline, even though that same newline in the old string was also the common prefix.
To reproduce the bug, add two newlines to the end of an empty multi-line edit control. When the second newline is added, the old text will be "\n" and the new text will be "\n\n". Before this fix, the function mistakely calculated 1 byte as a common suffix since both strings ended with a newline, even though that same newline in the old string was also the common prefix.