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> 2001-04-23 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSColor.m: * Source/NSColor.m:

View file

@ -738,18 +738,25 @@ SANITY();
} }
moveLocations = [aString length] - range.length; 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,
* If we are replacing a range with a zero length string and the tmpLength, _infoArray, &arrayIndex);
* range we are using matches the range replaced, then we must arrayIndex ++;
* remove it from the array to avoid getting a zero length range.
*/ if (effectiveRange.location == range.location
arrayIndex--; && effectiveRange.length == range.length)
REMOVEAT(arrayIndex); {
arraySize--; arrayIndex--;
REMOVEAT(arrayIndex);
arraySize--;
}
} }
/* /*