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:
FredKiefer 2000-06-16 17:07:11 +00:00
parent 204663c900
commit 77f49737e3

View file

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