mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
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:
parent
0b61b7ec7f
commit
3a2b5d31e2
1 changed files with 10 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue