Corrected bug #17096, setting of typing attributes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23183 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2006-07-20 22:32:41 +00:00
parent 6462d48f4a
commit d0d68dd618
2 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2006-07-21 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m (-setTypingAttributes:): Make sure to keep
the main parts of the old attributes, if they are not provided by
the new ones.
2006-07-18 23:11-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: Added category on NSView and

View file

@ -2703,15 +2703,34 @@ This method is for user changes; see NSTextView_actions.m.
- (void) setTypingAttributes: (NSDictionary *)attrs
{
NSDictionary *old_attrs;
NSString *names[] = {NSParagraphStyleAttributeName,
NSFontAttributeName,
NSForegroundColorAttributeName};
int i;
if (attrs == nil)
{
attrs = [isa defaultTypingAttributes];
}
DESTROY(_layoutManager->_typingAttributes);
old_attrs = _layoutManager->_typingAttributes;
_layoutManager->_typingAttributes = [[NSMutableDictionary alloc]
initWithDictionary: attrs];
// make sure to keep the main attributes set.
for (i = 0; i < 3; i++)
{
NSString *name = names[i];
if ([attrs objectForKey: name] == nil)
{
[_layoutManager->_typingAttributes setObject: [old_attrs objectForKey: name]
forKey: name];
}
}
RELEASE(old_attrs);
[self updateFontPanel];
[self updateRuler];
}