Text storage fix.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9667 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-04-23 09:32:45 +00:00
parent 4b712d42ac
commit 512bbbf9d8
2 changed files with 24 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2001-04-22 Georg Fleischmann
* gui/Source/GSTextStorage.m:
([GSTextStorage.m replaceCharactersInRange:withString:])
recalculate effective range after removing attributes.
2001-04-23 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSColor.m:

View file

@ -738,19 +738,26 @@ 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)
{
attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange,
tmpLength, _infoArray, &arrayIndex);
arrayIndex ++;
if (effectiveRange.location == range.location
&& effectiveRange.length == range.length)
{
arrayIndex--;
REMOVEAT(arrayIndex);
arraySize--;
}
}
/*
* Now adjust the positions of the ranges following the one we are using.