Revision: 12549
          http://sourceforge.net/p/skim-app/code/12549
Author:   hofman
Date:     2021-11-13 17:50:00 +0000 (Sat, 13 Nov 2021)
Log Message:
-----------
Implement NSTextDelegate rather than NSControlTextDelegate. Clear undo manager 
for textview when editing ends.

Modified Paths:
--------------
    trunk/SKNoteWindowController.m

Modified: trunk/SKNoteWindowController.m
===================================================================
--- trunk/SKNoteWindowController.m      2021-11-13 14:24:53 UTC (rev 12548)
+++ trunk/SKNoteWindowController.m      2021-11-13 17:50:00 UTC (rev 12549)
@@ -324,12 +324,6 @@
     [pdfView setActiveAnnotation:note];
 }
 
-- (NSUndoManager *)undoManagerForTextView:(NSTextView *)aTextView {
-    if (textViewUndoManager == nil)
-        textViewUndoManager = [[NSUndoManager alloc] init];
-    return textViewUndoManager;
-}
-
 - (NSURL *)writeImageToDestination:(NSURL *)destination {
     NSImage *image = [self isNoteType] ? [(SKNPDFAnnotationNote *)note image] 
: nil;
     if (image) {
@@ -344,11 +338,23 @@
     return nil;
 }
 
-- (void)controlTextDidChange:(NSNotification *)notification {
+#pragma mark NSTextViewDelegate and NSTextDelegate protocol
+
+- (NSUndoManager *)undoManagerForTextView:(NSTextView *)aTextView {
+    if (textViewUndoManager == nil)
+        textViewUndoManager = [[NSUndoManager alloc] init];
+    return textViewUndoManager;
+}
+
+- (void)textDidChange:(NSNotification *)notification {
     if (RUNNING_AFTER(10_13))
         [[textView textStorage] addTextColorAttribute];
 }
 
+- (void)textDidEndEditing:(NSNotification *)notification {
+    [textViewUndoManager removeAllActions];
+}
+
 #pragma mark NSEditorRegistration and NSEditor protocol
 
 - (void)objectDidBeginEditing:(id)editor {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to