Revision: 16243
          http://sourceforge.net/p/skim-app/code/16243
Author:   hofman
Date:     2026-05-07 17:33:53 +0000 (Thu, 07 May 2026)
Log Message:
-----------
remove convenience method

Modified Paths:
--------------
    trunk/PDFAnnotationMarkup_SKExtensions.m
    trunk/PDFSelection_SKExtensions.h
    trunk/PDFSelection_SKExtensions.m
    trunk/SKMainWindowController_UI.m

Modified: trunk/PDFAnnotationMarkup_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationMarkup_SKExtensions.m    2026-05-07 17:13:06 UTC (rev 
16242)
+++ trunk/PDFAnnotationMarkup_SKExtensions.m    2026-05-07 17:33:53 UTC (rev 
16243)
@@ -49,7 +49,6 @@
 #import "NSCharacterSet_SKExtensions.h"
 #import "NSPointerArray_SKExtensions.h"
 #import "NSColor_SKExtensions.h"
-#import "PDFSelection_SKExtensions.h"
 #import "PDFPage_SKExtensions.h"
 #import "NSView_SKExtensions.h"
 #import "SKNoteText.h"
@@ -199,17 +198,21 @@
 }
 
 - (PDFSelection *)selectionWithPage:(PDFPage *)page {
-    NSMutableArray *selections = [NSMutableArray array];
+    PDFSelection *selection = nil;
     NSPointerArray *lines = [self lineRects];
     NSUInteger i, iMax = [lines count];
     
     for (i = 0; i < iMax; i++) {
         // slightly outset the rect to avoid rounding errors, as 
selectionForRect is pretty strict in some OS versions, but unfortunately not in 
others
-        PDFSelection *selection = [page selectionForRect:NSInsetRect([lines 
rectAtIndex:i], -1.0, -1.0)];
-        if ([selection hasCharacters])
-            [selections addObject:selection];
+        PDFSelection *sel = [page selectionForRect:NSInsetRect([lines 
rectAtIndex:i], -1.0, -1.0)];
+        if ([sel hasCharacters]) {
+            if (selection)
+                [selection addSelection:sel];
+            else
+                selection = sel;
+        }
     }
-    return [PDFSelection selectionByAddingSelections:selections];
+    return selection;
 }
 
 - (PDFSelection *)selection {

Modified: trunk/PDFSelection_SKExtensions.h
===================================================================
--- trunk/PDFSelection_SKExtensions.h   2026-05-07 17:13:06 UTC (rev 16242)
+++ trunk/PDFSelection_SKExtensions.h   2026-05-07 17:33:53 UTC (rev 16243)
@@ -43,8 +43,6 @@
 
 @interface PDFSelection (SKExtensions)
 
-+ (PDFSelection *)selectionByAddingSelections:(NSArray<PDFSelection *> 
*)selections;
-
 // the search table columns bind to these methods for display
 @property (nonatomic, nullable, readonly) NSString *cleanedString;
 @property (nonatomic, readonly) NSAttributedString *contextString;

Modified: trunk/PDFSelection_SKExtensions.m
===================================================================
--- trunk/PDFSelection_SKExtensions.m   2026-05-07 17:13:06 UTC (rev 16242)
+++ trunk/PDFSelection_SKExtensions.m   2026-05-07 17:33:53 UTC (rev 16243)
@@ -61,17 +61,6 @@
 
 @implementation PDFSelection (SKExtensions)
 
-+ (PDFSelection *)selectionByAddingSelections:(NSArray *)selections {
-    PDFSelection *selection = nil;
-    NSUInteger count = [selections count];
-    if (count > 0) {
-        selection = [[selections objectAtIndex:0] copy];
-        if (count > 1)
-            [selection addSelections:[selections 
subarrayWithRange:NSMakeRange(1, count - 1)]];
-    }
-    return selection;
-}
-
 static BOOL inline isHyphenated(NSString *string, PDFSelection *line, 
PDFSelection *nextLine) {
     NSUInteger l = [string length];
     unichar ch = [string characterAtIndex:l - 1];

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2026-05-07 17:13:06 UTC (rev 16242)
+++ trunk/SKMainWindowController_UI.m   2026-05-07 17:33:53 UTC (rev 16243)
@@ -1180,7 +1180,12 @@
 }
 
 - (void)selectSelections:(id)sender {
-    [pdfView setCurrentSelection:[PDFSelection 
selectionByAddingSelections:[sender representedObject]]];
+    NSArray *selections = [sender representedObject];
+    PDFSelection *selection = [[selections firstObject] copy];
+    NSUInteger count = [selections count];
+    if (count > 1)
+        [selection addSelections:[selections subarrayWithRange:NSMakeRange(1, 
count - 1)]];
+    [pdfView setCurrentSelection:selection];
 }
 
 - (void)changeSearchResultsHighlighting:(id)sender {

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