summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-05-01 16:26:58 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-05-01 16:27:17 +0100
commitae716b07f7218fadf0143de1946cc9e0e2c08744 (patch)
tree584c187f94c76f7281b6a2acf7aa077058938398
parentccc47b3db3eae25cc11bb709416c0b61747ca89e (diff)
Related: fdo#49208 optimize common case
Change-Id: Ieec379b08cb9096b1c8187c2eda5053f093c612d
-rw-r--r--sw/source/core/bastyp/breakit.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
index 1fbadd80114c..4c8437902a07 100644
--- a/sw/source/core/bastyp/breakit.cxx
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -172,9 +172,16 @@ sal_Int32 SwBreakIt::getGraphemeCount(const rtl::OUString& rText, sal_Int32 nSta
sal_Int32 nCurPos = nStart;
while (nCurPos < nEnd)
{
- sal_Int32 nCount2 = 1;
- nCurPos = xBreak->nextCharacters(rText, nCurPos, lang::Locale(),
- i18n::CharacterIteratorMode::SKIPCELL, nCount2, nCount2);
+ //fdo#49208 cheat and assume that nothing can combine with a space
+ //to form a single grapheme
+ if (rText[nCurPos] == ' ')
+ ++nCurPos;
+ else
+ {
+ sal_Int32 nCount2 = 1;
+ nCurPos = xBreak->nextCharacters(rText, nCurPos, lang::Locale(),
+ i18n::CharacterIteratorMode::SKIPCELL, nCount2, nCount2);
+ }
++nGraphemeCount;
}