mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 04:50:47 +00:00
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:
parent
4f53a5e714
commit
678da07743
2 changed files with 26 additions and 1 deletions
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue