From 587a0e41d52a4040ccf08207ba48b61eaec4279d Mon Sep 17 00:00:00 2001 From: richard Date: Sun, 2 Apr 2000 17:12:00 +0000 Subject: [PATCH] Attributed string bugfix git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6409 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSAttributedString.m | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 221c561d9..e03697b5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-04-02 Richard Frith-Macdonald + + * Source/NSAttributedString.m: Infinite loop fix by Fred Kiefer to + ([replaceCharactersInRange:withAttributedString:]) + 2000-03-29 Richard Frith-Macdonald * Source/NSUserDefaults.m: typo reported by karl@nfox.com fixed. diff --git a/Source/NSAttributedString.m b/Source/NSAttributedString.m index d2f5cfaa8..c5dee0dd6 100644 --- a/Source/NSAttributedString.m +++ b/Source/NSAttributedString.m @@ -621,17 +621,18 @@ static Class NSMutableAttributedString_concrete_class; NSRange ownRange; NSDictionary *attrDict; NSString *tmpStr; + unsigned loc; tmpStr = [attributedString string]; [self replaceCharactersInRange: aRange withString: tmpStr]; effectiveRange = NSMakeRange(0,0); clipRange = NSMakeRange(0,[tmpStr length]); - while (NSMaxRange(effectiveRange) < NSMaxRange(clipRange)) + while ((loc = NSMaxRange(effectiveRange)) < NSMaxRange(clipRange)) { - attrDict = [attributedString attributesAtIndex: effectiveRange.location + attrDict = [attributedString attributesAtIndex: loc effectiveRange: &effectiveRange]; - ownRange = NSIntersectionRange(clipRange,effectiveRange); + ownRange = NSIntersectionRange(clipRange, effectiveRange); ownRange.location += aRange.location; [self setAttributes: attrDict range: ownRange]; }