diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2022-05-05 15:26:06 +0200 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2022-05-24 23:07:42 +0200 |
commit | 08d2ae411fc5d0607eacb5389598ee488b76e0df (patch) | |
tree | ef1245a7c8518959b26238cae4fecafbf3385b2f /src/corelib | |
parent | c63cdbdc43682e2034fef3e83b721c82e9aac55b (diff) |
QUnicodeTools: Fix interactions of WB3d and WB4 rules
Word breaking rule WB3d should not be affected by WB4.
This fixes the remaining word break test.
Task-number: QTBUG-97537
Pick-to: 6.2 6.3
Change-Id: I99aee831d7c54fafcd2a9d526a3e078b12c5bfad
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/text/qunicodetools.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/text/qunicodetools.cpp b/src/corelib/text/qunicodetools.cpp index 9cfca74a05..ac6302362d 100644 --- a/src/corelib/text/qunicodetools.cpp +++ b/src/corelib/text/qunicodetools.cpp @@ -287,6 +287,11 @@ static void getWordBreaks(const char16_t *string, qsizetype len, QCharAttributes // WB15/WB16: break between pairs of Regional indicator ncls = QUnicodeTables::WordBreak_Any; } + if (Q_UNLIKELY(ncls == QUnicodeTables::WordBreak_WSegSpace + && real_cls != QUnicodeTables::WordBreak_WSegSpace)) { + // WB3d should not be affected by WB4 + action = WB::Break; + } break; case WB::Lookup: case WB::LookupW: @@ -325,6 +330,8 @@ static void getWordBreaks(const char16_t *string, qsizetype len, QCharAttributes } cls = ncls; + real_cls = ncls; + if (action == WB::Break) { attributes[pos].wordBreak = true; if (currentWordType != WordTypeNone) @@ -345,8 +352,6 @@ static void getWordBreaks(const char16_t *string, qsizetype len, QCharAttributes break; } } - - real_cls = ncls; } if (currentWordType != WordTypeNone) |