c5199abfc1
Reported upstream at https://unicode-org.atlassian.net/browse/ICU-21946 , they've confirmed the problem, but so far no actual code change. So let's push my patch for now. Change-Id: Idd92ca66eea9b28103ad890aec66c40029ec7ebd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132676 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
37 lines
1.7 KiB
Groff
37 lines
1.7 KiB
Groff
From 34b2f7174ba187d99dfb8704b9cf19d369accc13 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@centrum.cz>
|
|
Date: Wed, 16 Mar 2022 10:54:03 +0100
|
|
Subject: [PATCH] do not reset useful cache to empty in populateNear()
|
|
|
|
---
|
|
icu4c/source/common/rbbi_cache.cpp | 5 ++++-
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/icu4c/source/common/rbbi_cache.cpp b/icu4c/source/common/rbbi_cache.cpp
|
|
index 26d82df781..54a77c97c6 100644
|
|
--- a/icu/source/common/rbbi_cache.cpp
|
|
+++ b/icu/source/common/rbbi_cache.cpp
|
|
@@ -352,7 +352,7 @@ UBool RuleBasedBreakIterator::BreakCache
|
|
if ((position < fBoundaries[fStartBufIdx] - 15) || position > (fBoundaries[fEndBufIdx] + 15)) {
|
|
int32_t aBoundary = 0;
|
|
int32_t ruleStatusIndex = 0;
|
|
- if (position > 20) {
|
|
+ if (position > 20 && false) { // handleSafePrevious() is broken and always returns 0
|
|
int32_t backupPos = fBI->handleSafePrevious(position);
|
|
|
|
if (backupPos > 0) {
|
|
@@ -376,7 +376,10 @@ UBool RuleBasedBreakIterator::BreakCache::populateNear(int32_t position, UErrorC
|
|
ruleStatusIndex = fBI->fRuleStatusIndex;
|
|
}
|
|
}
|
|
- reset(aBoundary, ruleStatusIndex); // Reset cache to hold aBoundary as a single starting point.
|
|
+ // Reset cache to hold aBoundary as a single starting point.
|
|
+ // Do not do so if what's in the cache is still more useful than an empty cache.
|
|
+ if (!(aBoundary == 0 && position > fBoundaries[fEndBufIdx]))
|
|
+ reset(aBoundary, ruleStatusIndex);
|
|
}
|
|
|
|
// Fill in boundaries between existing cache content and the new requested position.
|
|
--
|
|
2.34.1
|
|
|