Revision: 16339
          http://sourceforge.net/p/skim-app/code/16339
Author:   hofman
Date:     2026-06-01 16:32:36 +0000 (Mon, 01 Jun 2026)
Log Message:
-----------
don't bother extracting single markup note to add

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2026-06-01 16:11:52 UTC (rev 16338)
+++ trunk/SKPDFView.m   2026-06-01 16:32:36 UTC (rev 16339)
@@ -2392,8 +2392,6 @@
 }
 
 - (BOOL)addAnnotationWithType:(SKNoteType)annotationType 
selection:(PDFSelection *)selection page:(PDFPage *)page bounds:(NSRect)bounds {
-    PDFAnnotation *newAnnotation = nil;
-    NSArray *newAnnotations = nil;
     NSInteger disableUpdateString = [[NSUserDefaults standardUserDefaults] 
integerForKey:SKDisableUpdateContentsFromEnclosedTextKey];
     NSString *text = disableUpdateString < 2 ? [selection cleanedString] : nil;
     BOOL isInitial = NSEqualSizes(bounds.size, NSZeroSize) && selection == nil;
@@ -2406,15 +2404,21 @@
     NSString *type = typeForNoteType(annotationType);
     
     if (IS_MARKUP(annotationType)) {
-        newAnnotations = [PDFAnnotation 
SkimNotesAndPagesWithSelection:selection forType:type];
-        if ([newAnnotations count] == 1) {
-            newAnnotation = [[newAnnotations firstObject] firstObject];
-            page = [[newAnnotations firstObject] lastObject];
-            newAnnotations = nil;
-        }
+        NSArray *newAnnotations = [PDFAnnotation 
SkimNotesAndPagesWithSelection:selection forType:type];
+        if ([newAnnotations count] == 0)
+            return NO;
+        
+        for (NSArray *annotationAndPage in newAnnotations)
+            [[annotationAndPage firstObject] setString:text ?: @""];
+        [self addAnnotations:newAnnotations];
+        
+        return YES;
     } else if (annotationType != SKNoteTypeInk) {
         // we need a drawn path to add an ink note
-        newAnnotation = [PDFAnnotation newSkimNoteWithBounds:bounds 
forType:type];
+        PDFAnnotation *newAnnotation = [PDFAnnotation 
newSkimNoteWithBounds:bounds forType:type];
+        if (newAnnotation == nil)
+            return NO;
+        
         if (annotationType == SKNoteTypeLine && isInitial == NO) {
             NSInteger rotation = [page intrinsicRotation];
             if (rotation != 0) {
@@ -2436,17 +2440,7 @@
                 }
             }
         }
-    }
-    
-    if ([newAnnotations count] > 0) {
         
-        for (NSArray *annotationAndPage in newAnnotations)
-            [[annotationAndPage firstObject] setString:text ?: @""];
-        [self addAnnotations:newAnnotations];
-        
-        return YES;
-    } else if (newAnnotation) {
-        
         if (annotationType != SKNoteTypeLine && annotationType != 
SKNoteTypeInk) {
             if ([text length] > 0)
                 [newAnnotation setString:text];
@@ -2458,9 +2452,9 @@
         [self addAnnotation:newAnnotation toPage:page select:YES];
         
         return YES;
-    } else {
-        return NO;
     }
+    
+    return NO;
 }
 
 // y=primaryOutset(x) approximately solves x*secondaryOutset(y)=y

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to