mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-11 11:07:07 +00:00
fixed: undo support for fontpanel
This commit is contained in:
1 parent
7e622f1153
commit
7d2eb83a1b
1 file changed
+12
-1
@@ -1479,6 +1479,12 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
[_textStorage setFont:_font];
|
||||
}
|
||||
|
||||
var currentAttributes = [_textStorage attributesAtIndex:range.location effectiveRange:nil] || _typingAttributes;
|
||||
|
||||
[[[[self window] undoManager] prepareWithInvocationTarget:self]
|
||||
setFont:[currentAttributes objectForKey:CPFontAttributeName] || _font
|
||||
range:CPMakeRangeCopy(range)];
|
||||
|
||||
[_textStorage addAttribute:CPFontAttributeName value:font range:CPMakeRangeCopy(range)];
|
||||
[_layoutManager _validateLayoutAndGlyphs];
|
||||
}
|
||||
@@ -1488,7 +1494,10 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
var currRange = CPMakeRange(_selectionRange.location, 0),
|
||||
oldFont,
|
||||
attributes,
|
||||
scrollRange = CPMakeRange(CPMaxRange(_selectionRange), 0);
|
||||
scrollRange = CPMakeRange(CPMaxRange(_selectionRange), 0),
|
||||
undoManager = [[self window] undoManager];
|
||||
|
||||
[undoManager beginUndoGrouping];
|
||||
|
||||
if ([self isRichText])
|
||||
{
|
||||
@@ -1518,6 +1527,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
scrollRange = CPMakeRange(length, 0);
|
||||
}
|
||||
|
||||
[undoManager endUndoGrouping];
|
||||
|
||||
[_layoutManager _validateLayoutAndGlyphs];
|
||||
[self sizeToFit];
|
||||
[self setNeedsDisplay:YES];
|
||||
|
||||
Reference in new issue
Block a user