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:
fredkiefer 2006-07-20 22:32:41 +00:00
parent 4f53a5e714
commit 678da07743
2 changed files with 26 additions and 1 deletions

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];
}