Kaydet (Commit) 1f428595 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

Fixed i#114659: non-breaking spaces corner case

üst e60de95c
...@@ -658,8 +658,8 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( ...@@ -658,8 +658,8 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace(
chars = OUString::createFromAscii( ":" ); chars = OUString::createFromAscii( ":" );
sal_Unicode cChar = rTxt.GetChar( nEndPos ); sal_Unicode cChar = rTxt.GetChar( nEndPos );
bool bHasSpace = chars.indexOf( sal_Unicode( cChar ) ) != -1; bool bHasSpace = chars.indexOf( cChar ) != -1;
bool bIsSpecial = allChars.indexOf( sal_Unicode( cChar ) ) != -1; bool bIsSpecial = allChars.indexOf( cChar ) != -1;
if ( bIsSpecial ) if ( bIsSpecial )
{ {
// Get the last word delimiter position // Get the last word delimiter position
...@@ -673,7 +673,7 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( ...@@ -673,7 +673,7 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace(
{ {
// Check the previous char // Check the previous char
sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 ); 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 // Remove any previous normal space
xub_StrLen nPos = nEndPos - 1; xub_StrLen nPos = nEndPos - 1;
...@@ -684,20 +684,17 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( ...@@ -684,20 +684,17 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace(
cPrevChar = rTxt.GetChar( nPos ); cPrevChar = rTxt.GetChar( nPos );
} }
if ( nPos != 0 ) nPos++;
{ if ( nEndPos - nPos > 0 )
nPos++; rDoc.Delete( nPos, nEndPos );
if ( nEndPos - nPos > 0 )
rDoc.Delete( nPos, nEndPos ); // Add the non-breaking space at the end pos
if ( bHasSpace )
// Add the non-breaking space at the end pos rDoc.Insert( nPos, CHAR_HARDBLANK );
if ( bHasSpace ) bRunNext = true;
rDoc.Insert( nPos, CHAR_HARDBLANK ); bRet = true;
bRunNext = true;
bRet = true;
}
} }
else if ( chars.indexOf( sal_Unicode( cPrevChar ) ) != -1 ) else if ( chars.indexOf( cPrevChar ) != -1 )
bRunNext = true; bRunNext = true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment