AccessKit / accesskit

Accessibility infrastructure for UI toolkits
https://accesskit.dev
BSD 3-Clause "New" or "Revised" License
1.05k stars 53 forks source link

fix: Fix a logic error in suffix calculation for text changes #423

Closed mwcampbell closed 4 months ago

mwcampbell commented 4 months ago

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.