diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-09-24 10:40:39 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-09-24 10:40:39 +0200 |
commit | 1f42859596afd818a44681818fca914fa25b9911 (patch) | |
tree | d2ca14a481eb84a9b0631d7a8878f7759968c1c9 | |
parent | e60de95c7a04ab2608cd7f40247c24b87ac74e04 (diff) |
Fixed i#114659: non-breaking spaces corner case
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index f969a8033f08..bcb70a483abb 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -658,8 +658,8 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( chars = OUString::createFromAscii( ":" ); sal_Unicode cChar = rTxt.GetChar( nEndPos ); - bool bHasSpace = chars.indexOf( sal_Unicode( cChar ) ) != -1; - bool bIsSpecial = allChars.indexOf( sal_Unicode( cChar ) ) != -1; + bool bHasSpace = chars.indexOf( cChar ) != -1; + bool bIsSpecial = allChars.indexOf( cChar ) != -1; if ( bIsSpecial ) { // Get the last word delimiter position @@ -673,7 +673,7 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( { // Check the previous char sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 ); - if ( ( chars.indexOf( sal_Unicode( cPrevChar ) ) == -1 ) && cPrevChar != '\t' ) + if ( ( chars.indexOf( cPrevChar ) == -1 ) && cPrevChar != '\t' ) { // Remove any previous normal space xub_StrLen nPos = nEndPos - 1; @@ -684,20 +684,17 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( cPrevChar = rTxt.GetChar( nPos ); } - if ( nPos != 0 ) - { - nPos++; - if ( nEndPos - nPos > 0 ) - rDoc.Delete( nPos, nEndPos ); - - // Add the non-breaking space at the end pos - if ( bHasSpace ) - rDoc.Insert( nPos, CHAR_HARDBLANK ); - bRunNext = true; - bRet = true; - } + nPos++; + if ( nEndPos - nPos > 0 ) + rDoc.Delete( nPos, nEndPos ); + + // Add the non-breaking space at the end pos + if ( bHasSpace ) + rDoc.Insert( nPos, CHAR_HARDBLANK ); + bRunNext = true; + bRet = true; } - else if ( chars.indexOf( sal_Unicode( cPrevChar ) ) != -1 ) + else if ( chars.indexOf( cPrevChar ) != -1 ) bRunNext = true; } } |