Revision: 15578
          http://sourceforge.net/p/skim-app/code/15578
Author:   hofman
Date:     2025-07-01 09:04:23 +0000 (Tue, 01 Jul 2025)
Log Message:
-----------
explicitly commit before starting new undo group in the one case we need to

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2025-07-01 09:02:36 UTC (rev 15577)
+++ trunk/SKPDFView.m   2025-07-01 09:04:23 UTC (rev 15578)
@@ -205,7 +205,7 @@
 - (void)editTextNoteWithEvent:(NSEvent *)theEvent;
 - (BOOL)isEditingAnnotation:(PDFAnnotation *)annotation;
 
-- (void)beginNewUndoGroupIfNeededWithCommit:(BOOL)commit;
+- (void)beginNewUndoGroupIfNeeded;
 
 - (void)addAnnotation:(PDFAnnotation *)annotation toPage:(PDFPage *)page;
 - (void)removeAnnotation:(PDFAnnotation *)annotation;
@@ -2382,7 +2382,8 @@
 #pragma mark Annotation management
 
 - (void)addAnnotation:(PDFAnnotation *)annotation toPage:(PDFPage *)page {
-    [self beginNewUndoGroupIfNeededWithCommit:YES];
+    [self commitEditing];
+    [self beginNewUndoGroupIfNeeded];
     [[self document] addAnnotation:annotation toPage:page];
     [[self undoManager] setActionName:NSLocalizedString(@"Add Note", @"Undo 
action name")];
 }
@@ -2780,9 +2781,7 @@
     return success;
 }
 
-- (void)beginNewUndoGroupIfNeededWithCommit:(BOOL)commit {
-    if (commit)
-        [self commitEditing];
+- (void)beginNewUndoGroupIfNeeded {
     if (wantsNewUndoGroup) {
         NSUndoManager *undoManger = [self undoManager];
         if ([undoManger groupingLevel] > 0) {
@@ -3094,7 +3093,7 @@
     
     if (currentAnnotation == annotation) {
         [self setCurrentAnnotation:nil];
-        [self beginNewUndoGroupIfNeededWithCommit:NO];
+        [self beginNewUndoGroupIfNeeded];
     }
     
     [self updatedAnnotation:annotation];
@@ -4076,7 +4075,7 @@
         } else if (currentAnnotation == nil) {
             continue;
         }
-        [self beginNewUndoGroupIfNeededWithCommit:NO];
+        [self beginNewUndoGroupIfNeeded];
         if (resizeHandle == 0)
             [self doMoveAnnotationWithEvent:lastMouseEvent offset:offset];
         else if (isLine)
@@ -4222,7 +4221,7 @@
             if (newAnnotation) {
                 [newAnnotation setColor:[currentAnnotation color]];
                 [newAnnotation registerUserName];
-                [self beginNewUndoGroupIfNeededWithCommit:NO];
+                [self beginNewUndoGroupIfNeeded];
                 [[self document] removeAnnotation:newCurrentAnnotation];
                 [[self document] removeAnnotation:currentAnnotation];
                 [[self document] addAnnotation:newAnnotation toPage:page];

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