Bugfix to avoid empty ranges.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9666 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-04-23 09:30:45 +00:00
parent 87c9d2e2e5
commit 9792d39ba3
2 changed files with 23 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2001-04-22 Georg Fleischmann
* Source/GSAttributedString.m:
([replaceCharactersInRange:withString:])
recalculate effective range after removing attributes.
2001-04-23 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSLocale.m: Only call setlocale() in GSSetLocaleC()

View file

@ -805,18 +805,24 @@ SANITY();
}
moveLocations = [aString length] - range.length;
if (effectiveRange.location == range.location
&& effectiveRange.length == range.length
&& (moveLocations + range.length) == 0)
/*
* If we are replacing a range with a zero length string and the
* range we are using matches the range replaced, then we must
* remove it from the array to avoid getting a zero length range.
*/
if ((moveLocations + range.length) == 0)
{
/*
* If we are replacing a range with a zero length string and the
* range we are using matches the range replaced, then we must
* remove it from the array to avoid getting a zero length range.
*/
arrayIndex--;
REMOVEAT(arrayIndex);
arraySize--;
attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange,
tmpLength, _infoArray, &arrayIndex);
arrayIndex++;
if (effectiveRange.location == range.location
&& effectiveRange.length == range.length)
{
arrayIndex--;
REMOVEAT(arrayIndex);
arraySize--;
}
}
/*