Fix handling of surrogate pairs in ircview and inputeditor #2569
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The ircview and input editor (used also in topic editor) contains custom methods to render text on screen.
They didn't take in account that QString can contain surrogate pairs: 2 characters that gets drawn as a single character.
Example of these characters are emojis like 😀😃😄
As a consequence, selecting or editing text containing these characters would lead to the wrong calculation of each character width, causing overlapped and jumping text when selected, or the appearance of Mojibake.
This PR fixes handling of these weirdos.
Possible fix for #2566
Fix #2051
As a bonus, fix out of bound memory read when a line ends with a tab
Fix #2377