From e897d2ef814eebcdbf0815a517d097f8dc3da9a8 Mon Sep 17 00:00:00 2001 From: daboe01 Date: Tue, 24 May 2016 10:39:23 +0200 Subject: [PATCH] fixed: missing undo support for textcolor --- AppKit/CPTextView/CPTextView.j | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index 9f80b2da5..938f60de4 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -1542,6 +1542,12 @@ var kDelegateRespondsTo_textShouldBeginEditing - (void)setTextColor:(CPColor)aColor range:(CPRange)range { + var currentAttributes = [_textStorage attributesAtIndex:range.location effectiveRange:nil] || _typingAttributes; + + [[[[self window] undoManager] prepareWithInvocationTarget:self] + setTextColor:[currentAttributes objectForKey:CPForegroundColorAttributeName] + range:CPMakeRangeCopy(range)]; + if (!CPEmptyRange(range)) { if (aColor)