Made setAlignment:range: save against missing paragraph style

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6702 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2000-06-16 17:07:11 +00:00
parent 0b61b7ec7f
commit 3a2b5d31e2

View file

@ -2883,7 +2883,8 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
- (void) setAlignment: (NSTextAlignment)alignment
range: (NSRange)aRange
{
NSMutableParagraphStyle *style;
NSParagraphStyle *style;
NSMutableParagraphStyle *mstyle;
if (aRange.location == NSNotFound)
return;
@ -2898,11 +2899,15 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
[self didChangeText];
// Set the typing attributes
style = [[_typingAttributes objectForKey: NSParagraphStyleAttributeName]
mutableCopy];
[style setAlignment: alignment];
style = [_typingAttributes objectForKey: NSParagraphStyleAttributeName];
if (style == nil)
style = [NSParagraphStyle defaultParagraphStyle];
mstyle = [style mutableCopy];
[mstyle setAlignment: alignment];
// FIXME: Should use setTypingAttributes
[_typingAttributes setObject: style forKey: NSParagraphStyleAttributeName];
[_typingAttributes setObject: mstyle forKey: NSParagraphStyleAttributeName];
}
- (NSString*) preferredPasteboardTypeFromArray: (NSArray*)availableTypes