Revision: 15092
          http://sourceforge.net/p/skim-app/code/15092
Author:   hofman
Date:     2025-04-06 22:17:19 +0000 (Sun, 06 Apr 2025)
Log Message:
-----------
Join strings from joined markup notes when they are layed out non-interlacing 
in the order they occur, otherwise get the string from the joined selection.

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2025-04-06 17:12:15 UTC (rev 15091)
+++ trunk/SKPDFView.m   2025-04-06 22:17:19 UTC (rev 15092)
@@ -4134,11 +4134,30 @@
             if ([currentAnnotation isMarkup]) {
                 NSString *type = [currentAnnotation type];
                 PDFSelection *sel = [currentAnnotation selection];
-                [sel addSelection:[newCurrentAnnotation selection]];
+                PDFSelection *newSel = [newCurrentAnnotation selection];
+                BOOL copyText = [[NSUserDefaults standardUserDefaults] 
integerForKey:SKDisableUpdateContentsFromEnclosedTextKey] < 2;
+                NSString *string1 = [currentAnnotation string];
+                NSString *string2 = [newCurrentAnnotation string];
+                NSString *string = nil;
+                if ([string1 length] > 0 && [string2 length] > 0) {
+                    if ([sel safeIndexOfFirstCharacterOnPage:page] > (copyText 
? [newSel safeIndexOfLastCharacterOnPage:page] : [newSel 
safeIndexOfFirstCharacterOnPage:page]))
+                       string = [NSString stringWithFormat:@"%@ %@", string2, 
string1];
+                    else if (copyText || [newSel 
safeIndexOfFirstCharacterOnPage:page] > [sel 
safeIndexOfFirstCharacterOnPage:page])
+                        string = [NSString stringWithFormat:@"%@ %@", string1, 
string2];
+                }
+                [sel addSelection:newSel];
+                if (string == nil) {
+                    if (copyText)
+                        string = [sel cleanedString];
+                    else if ([string1 length])
+                        string = string1;
+                    else if ([string2 length])
+                        string = string2;
+                }
                 
                 newAnnotation = [PDFAnnotation newSkimNoteWithSelection:sel 
forType:type];
-                if ([[NSUserDefaults standardUserDefaults] 
integerForKey:SKDisableUpdateContentsFromEnclosedTextKey] < 2)
-                    [newAnnotation setString:[sel cleanedString]];
+                if ([string length] > 0)
+                    [newAnnotation setString:string];
             } else if ([currentAnnotation isInk]) {
                 NSMutableArray *paths = [[currentAnnotation pagePaths] 
mutableCopy];
                 [paths addObjectsFromArray:[newCurrentAnnotation pagePaths]];

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