Skip to content

Commit

Permalink
Fix handling of surrogates in QBidiAlgorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
handsomematt committed Jul 14, 2023
1 parent 3670fee commit d3bdd53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion valve/qtbase/src/gui/text/qtextengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ struct QBidiAlgorithm {
for (int i = 0; i < length; ++i) {
int pos = i;
uint uc = text[i].unicode();
if (QChar::isHighSurrogate(uc) && i < length - 1) {
if (QChar::isHighSurrogate(uc) && i < length - 1 && text[i + 1].isLowSurrogate()) {
++i;
analysis[i].bidiDirection = QChar::DirNSM;
uc = QChar::surrogateToUcs4(ushort(uc), text[i].unicode());
Expand Down

0 comments on commit d3bdd53

Please sign in to comment.