Revision: 7565
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7565&view=rev
Author:   hofman
Date:     2011-12-10 19:08:10 +0000 (Sat, 10 Dec 2011)
Log Message:
-----------
Combine words using double quotes in finding separate words

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2011-12-09 23:51:42 UTC (rev 7564)
+++ trunk/SKMainWindowController.m      2011-12-10 19:08:10 UTC (rev 7565)
@@ -102,6 +102,7 @@
 #import "SKPDFPage.h"
 #import "NSScreen_SKExtensions.h"
 #import "PDFView_SKExtensions.h"
+#import "NSScanner_SKExtensions.h"
 
 #define MULTIPLICATION_SIGN_CHARACTER 0x00d7
 
@@ -1666,10 +1667,21 @@
     } else {
         NSInteger options = mwcFlags.caseInsensitiveSearch ? 
NSCaseInsensitiveSearch : 0;
         if (mwcFlags.wholeWordSearch) {
+            NSScanner *scanner = [NSScanner scannerWithString:[sender 
stringValue]];
             NSMutableArray *words = [NSMutableArray array];
-            for (NSString *word in [[sender stringValue] 
componentsSeparatedByString:@" "]) {
-                if ([word isEqualToString:@""] == NO)
+            NSString *word;
+            [scanner setCharactersToBeSkipped:nil];
+            while ([scanner isAtEnd] == NO) {
+                if ('"' == [[scanner string] characterAtIndex:[scanner 
scanLocation]]) {
+                    [scanner setScanLocation:[scanner scanLocation] + 1];
+                    if ([scanner scanUpToString:@"\"" intoString:&word])
+                        [words addObject:word];
+                    if ([scanner isAtEnd] == NO)
+                        [scanner setScanLocation:[scanner scanLocation] + 1];
+                } else if ([scanner scanUpToCharactersFromSet:[NSCharacterSet 
whitespaceCharacterSet] intoString:&word]) {
                     [words addObject:word];
+                }
+                [scanner scanCharactersFromSet:[NSCharacterSet 
whitespaceCharacterSet] intoString:NULL];
             }
             [[pdfView document] beginFindStrings:words withOptions:options];
         } else {

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


------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to