summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/text/qunicodetools.cpp9
-rw-r--r--tests/auto/corelib/text/qtextboundaryfinder/data/WordBreakTest.txt2
2 files changed, 8 insertions, 3 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)
diff --git a/tests/auto/corelib/text/qtextboundaryfinder/data/WordBreakTest.txt b/tests/auto/corelib/text/qtextboundaryfinder/data/WordBreakTest.txt
index d5ee598d11..1d1435bfc7 100644
--- a/tests/auto/corelib/text/qtextboundaryfinder/data/WordBreakTest.txt
+++ b/tests/auto/corelib/text/qtextboundaryfinder/data/WordBreakTest.txt
@@ -983,7 +983,7 @@
÷ 0020 ÷ 231A ÷ # ÷ [0.2] SPACE (WSegSpace) ÷ [999.0] WATCH (ExtPict) ÷ [0.3]
÷ 0020 × 0308 ÷ 231A ÷ # ÷ [0.2] SPACE (WSegSpace) × [4.0] COMBINING DIAERESIS (Extend_FE) ÷ [999.0] WATCH (ExtPict) ÷ [0.3]
÷ 0020 × 0020 ÷ # ÷ [0.2] SPACE (WSegSpace) × [3.4] SPACE (WSegSpace) ÷ [0.3]
-# ÷ 0020 × 0308 ÷ 0020 ÷ # ÷ [0.2] SPACE (WSegSpace) × [4.0] COMBINING DIAERESIS (Extend_FE) ÷ [999.0] SPACE (WSegSpace) ÷ [0.3]
+÷ 0020 × 0308 ÷ 0020 ÷ # ÷ [0.2] SPACE (WSegSpace) × [4.0] COMBINING DIAERESIS (Extend_FE) ÷ [999.0] SPACE (WSegSpace) ÷ [0.3]
÷ 0020 × 00AD ÷ # ÷ [0.2] SPACE (WSegSpace) × [4.0] SOFT HYPHEN (Format_FE) ÷ [0.3]
÷ 0020 × 0308 × 00AD ÷ # ÷ [0.2] SPACE (WSegSpace) × [4.0] COMBINING DIAERESIS (Extend_FE) × [4.0] SOFT HYPHEN (Format_FE) ÷ [0.3]
÷ 0020 × 0300 ÷ # ÷ [0.2] SPACE (WSegSpace) × [4.0] COMBINING GRAVE ACCENT (Extend_FE) ÷ [0.3]