diff --git a/ChangeLog b/ChangeLog index b35cd58cd..2b4ede551 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-02-23 00:02 Alexander Malmberg + + * Source/NSParagraphStyle.m: Implement -isEqual: and -hash. + 2003-02-23 13:30 Alexander Malmberg * Source/NSWindow (-update): Don't redisplay the window. diff --git a/Source/NSParagraphStyle.m b/Source/NSParagraphStyle.m index b8f0a6212..e6260c37f 100644 --- a/Source/NSParagraphStyle.m +++ b/Source/NSParagraphStyle.m @@ -351,6 +351,36 @@ static NSParagraphStyle *defaultStyle = nil; } } + +- (BOOL) isEqual: (id)aother +{ + NSParagraphStyle *other = aother; + if (other == self) + return YES; + if ([other isKindOfClass: [NSParagraphStyle class]] == NO) + return NO; + +#define C(x) if (x != other->x) return NO + C(_lineSpacing); + C(_paragraphSpacing); + C(_headIndent); + C(_tailIndent); + C(_firstLineHeadIndent); + C(_minimumLineHeight); + C(_maximumLineHeight); + C(_alignment); + C(_lineBreakMode); +#undef C + + return [_tabStops isEqualToArray: other->_tabStops]; +} + +- (unsigned int) hash +{ + return _alignment + _lineBreakMode; +} + + @end