mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Bgfix reported by Fred Kiefer
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6497 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
60a4737d59
commit
0ba0eb1ca8
2 changed files with 18 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
|||
2000-04-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSAttributedString.m: Corrected code of
|
||||
([-attribute:atIndex:longestEffectiveRange:inRange:]) so that it
|
||||
compares attributes correctly.
|
||||
|
||||
2000-04-20 Jonathan Gapen <jagapen@whitewater.chem.wisc.edu>
|
||||
|
||||
* Tools/plmerge.m: New tool to merge property lists.
|
||||
|
|
|
@ -300,21 +300,26 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
id attrValue;
|
||||
id tmpAttrValue;
|
||||
NSRange tmpRange;
|
||||
BOOL (*eImp)(id,SEL,id);
|
||||
|
||||
if (rangeLimit.location < 0 || NSMaxRange(rangeLimit) > [self length])
|
||||
{
|
||||
[NSException raise: NSRangeException
|
||||
format: @"RangeError in method -attribute:atIndex:longestEffectiveRange:inRange: in class NSAttributedString"];
|
||||
}
|
||||
if (attributeName == nil)
|
||||
return nil;
|
||||
|
||||
attrValue = [self attribute: attributeName
|
||||
atIndex: index
|
||||
effectiveRange: aRange];
|
||||
|
||||
if (attributeName == nil)
|
||||
return nil;
|
||||
if (aRange == 0)
|
||||
return attrValue;
|
||||
|
||||
/*
|
||||
* If attrValue == nil then eImp will be zero
|
||||
*/
|
||||
eImp = (BOOL(*)(id,SEL,id))[attrValue methodForSelector: @selector(isEqual:)];
|
||||
|
||||
while (aRange->location > rangeLimit.location)
|
||||
{
|
||||
|
@ -322,7 +327,8 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
tmpDictionary = [self attributesAtIndex: aRange->location-1
|
||||
effectiveRange: &tmpRange];
|
||||
tmpAttrValue = [tmpDictionary objectForKey: attributeName];
|
||||
if (tmpAttrValue == attrValue)
|
||||
if (tmpAttrValue == attrValue
|
||||
|| (eImp != 0 && (*eImp)(attrValue, @selector(isEqual), tmpAttrValue)))
|
||||
{
|
||||
aRange->length = NSMaxRange(*aRange) - tmpRange.location;
|
||||
aRange->location = tmpRange.location;
|
||||
|
@ -338,7 +344,8 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
tmpDictionary = [self attributesAtIndex: NSMaxRange(*aRange)
|
||||
effectiveRange: &tmpRange];
|
||||
tmpAttrValue = [tmpDictionary objectForKey: attributeName];
|
||||
if (tmpAttrValue == attrValue)
|
||||
if (tmpAttrValue == attrValue
|
||||
|| (eImp != 0 && (*eImp)(attrValue, @selector(isEqual), tmpAttrValue)))
|
||||
{
|
||||
aRange->length = NSMaxRange(tmpRange) - aRange->location;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue