[Libreoffice-commits] core.git: sw/source
Caolán McNamara
caolanm at redhat.com
Tue Sep 23 07:16:30 PDT 2014
sw/source/core/bastyp/breakit.cxx | 2 +-
sw/source/core/txtnode/txtedt.cxx | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
New commits:
commit 93e7ae6f5719c56c90679e46a6e817dedf5c54c6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Sep 23 15:03:38 2014 +0100
with show changes on we can have negative offsets
for counting words in a range of text which has redline deleted
text at the start
Change-Id: I34149822d43f8ee3fbde58a166dad408fb588fce
diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
index b4caeb3..8a4c40e 100644
--- a/sw/source/core/bastyp/breakit.cxx
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -175,7 +175,7 @@ sal_Int32 SwBreakIt::getGraphemeCount(const OUString& rText,
{
sal_Int32 nGraphemeCount = 0;
- sal_Int32 nCurPos = nStart;
+ sal_Int32 nCurPos = std::max(0, nStart);
while (nCurPos < nEnd)
{
// fdo#49208 cheat and assume that nothing can combine with a space
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index c083245..a4616ba 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -730,6 +730,8 @@ SwScanner::SwScanner( const SwTxtNode& rNd, const OUString& rTxt,
OUStringBuffer aBuf(aPreDashReplacementText);
for (sal_Int32 i = nStartPos; i < nEndPos; ++i)
{
+ if (i < 0)
+ continue;
sal_Unicode cChar = aBuf[i];
if (sDashes.indexOf(cChar) != -1)
{
@@ -805,9 +807,9 @@ bool SwScanner::NextWord()
while ( true )
{
// skip non-letter characters:
- while ( nBegin < aText.getLength() )
+ while (nBegin < aText.getLength())
{
- if ( !u_isspace( aText[nBegin] ) )
+ if (nBegin >= 0 && !u_isspace(aText[nBegin]))
{
if ( !pLanguage )
{
More information about the Libreoffice-commits
mailing list