View | Details | Raw Unified | Return to issue 113461
Collapse All | Expand All

(-)a/editeng/source/misc/svxacorr.cxx (-13 / +11 lines)
Lines 1243-1269 Link Here
1243
                else if ( bIsNextRun && !IsAutoCorrectChar( cChar ) )
1243
                else if ( bIsNextRun && !IsAutoCorrectChar( cChar ) )
1244
                {
1244
                {
1245
                    // Remove the NBSP if it wasn't an autocorrection
1245
                    // Remove the NBSP if it wasn't an autocorrection
1246
                    if ( NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) && 
1246
                    if ( nInsPos != 0 && NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) &&
1247
                            cChar != ' ' && cChar != '\t' && cChar != CHAR_HARDBLANK )
1247
                            cChar != ' ' && cChar != '\t' && cChar != CHAR_HARDBLANK )
1248
                    {
1248
                    {
1249
                        // Look for the last HARD_SPACE
1249
                        // Look for the last HARD_SPACE
1250
                        xub_StrLen nPos = nInsPos - 1;
1250
                        xub_StrLen nPos = nInsPos - 1;
1251
                        bool bFound = false;
1251
                        bool bContinue = true;
1252
                        while ( nPos != STRING_NOTFOUND  && !bFound )
1252
                        while ( bContinue )
1253
                        {
1253
                        {
1254
                            sal_Unicode cTmpChar = rTxt.GetChar( nPos );
1254
                            const sal_Unicode cTmpChar = rTxt.GetChar( nPos );
1255
                            if ( cTmpChar == CHAR_HARDBLANK )
1255
                            if ( cTmpChar == CHAR_HARDBLANK )
1256
                                bFound = true;
1256
                            {
1257
                            else if ( !NeedsHardspaceAutocorr( cTmpChar ) )
1257
                                rDoc.Delete( nPos, nPos + 1 );
1258
                                nPos = STRING_NOTFOUND;
1258
                                nRet = AddNonBrkSpace;
1259
                                bContinue = false;
1260
                            }
1261
                            else if ( !NeedsHardspaceAutocorr( cTmpChar ) || nPos == 0 )
1262
                                bContinue = false;
1259
                            nPos--;
1263
                            nPos--;
1260
                        }
1264
                        }
1261
1262
                        if ( bFound && nPos != STRING_NOTFOUND )
1263
                        {
1264
                            rDoc.Delete( nPos + 1, nPos + 2 );
1265
                            nRet = AddNonBrkSpace;
1266
                        }
1267
                    }
1265
                    }
1268
                }
1266
                }
1269
            }
1267
            }

Return to issue 113461