Revision: 4069
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4069&view=rev
Author:   hofman
Date:     2008-06-25 11:44:33 -0700 (Wed, 25 Jun 2008)

Log Message:
-----------
Check matches returned by PDFDocument find  when finding whole words to see if 
they are really whole words, because PDFDocument itself does not seem to filter 
for this.

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-06-23 20:11:01 UTC (rev 4068)
+++ trunk/SKMainWindowController.m      2008-06-25 18:44:33 UTC (rev 4069)
@@ -2957,6 +2957,22 @@
 
 - (void)didMatchString:(PDFSelection *)instance {
     if (findPanelFind == NO) {
+        if (wholeWordSearch) {
+            PDFSelection *copy = [[instance copy] autorelease];
+            NSString *string = [instance string];
+            unsigned int l = [string length];
+            [copy extendSelectionAtEnd:1];
+            string = [copy string];
+            if ([string length] > l && [[NSCharacterSet letterCharacterSet] 
characterIsMember:[string characterAtIndex:0]]) {
+                return;
+            }
+            l = [string length];
+            [copy extendSelectionAtStart:1];
+            string = [copy string];
+            if ([string length] > l && [[NSCharacterSet letterCharacterSet] 
characterIsMember:[string characterAtIndex:l]]) {
+                return;
+            }
+        }
         [searchResults addObject:instance];
         
         PDFPage *page = [[instance pages] objectAtIndex:0];


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to