Revision: 16240
          http://sourceforge.net/p/skim-app/code/16240
Author:   hofman
Date:     2026-05-07 17:01:40 +0000 (Thu, 07 May 2026)
Log Message:
-----------
first check whether search string is at the expected range, without any cleaning

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

Modified: trunk/PDFSelection_SKExtensions.m
===================================================================
--- trunk/PDFSelection_SKExtensions.m   2026-05-07 16:53:28 UTC (rev 16239)
+++ trunk/PDFSelection_SKExtensions.m   2026-05-07 17:01:40 UTC (rev 16240)
@@ -160,9 +160,12 @@
     attributedSample = [[NSMutableAttributedString alloc] 
initWithString:sample attributes:attributes];
     
        // Find instances of search string and "bold" them.
-    foundRange = [sample rangeOfString:searchString options:NSBackwardsSearch 
range:NSMakeRange(0, MIN([searchString length] + i - start, [sample length]))];
-    if (foundRange.location == NSNotFound)
-        foundRange = [sample rangeOfString:searchString];
+    foundRange = NSMakeRange(i - start, [searchString length]);
+    if ([[sample substringWithRange:foundRange] isEqualToString:searchString] 
== NO) {
+        foundRange = [sample rangeOfString:searchString 
options:NSBackwardsSearch range:NSMakeRange(0, MIN([searchString length] + i - 
start, [sample length]))];
+        if (foundRange.location == NSNotFound)
+            foundRange = [sample rangeOfString:searchString];
+    }
     if (foundRange.location != NSNotFound)
         // Use bold font for the text range where the search term was found.
         [attributedSample addAttribute:NSFontAttributeName value:[NSFont 
boldSystemFontOfSize:fontSize] range:foundRange];

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