]> granicus.if.org Git - transmission/commitdiff
slight improvement for the auto-group code
authorMitchell Livingston <livings124@transmissionbt.com>
Sun, 14 Dec 2008 15:58:17 +0000 (15:58 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sun, 14 Dec 2008 15:58:17 +0000 (15:58 +0000)
macosx/GroupsController.m

index 1e9285593553564fdbf849b5bcd006090f7715db..e39e54ffecd696b2d434b35da75bc060cac5ed19 100644 (file)
@@ -470,23 +470,18 @@ GroupsController * fGroupsInstance = nil;
         BOOL match = NO;
         
         NSStringCompareOptions options = NSCaseInsensitiveSearch;
-        if ([place isEqualToString: @"ends"])
-            options += NSBackwardsSearch;
+        if ([place isEqualToString: @"begins"])
+            options += NSAnchoredSearch;
+        else if ([place isEqualToString: @"ends"])
+            options += NSBackwardsSearch + NSAnchoredSearch;
+        else;
         
         NSEnumerator * enumerator = [values objectEnumerator];
         NSString * value;
         while (!match && (value = [enumerator nextObject]))
         {
             NSRange result = [value rangeOfString: givenValue options: options];
-            
-            if ([place isEqualToString: @"begins"])
-                match = result.location == 0;
-            else if ([place isEqualToString: @"contains"])
-                match = result.location != NSNotFound;
-            else if ([place isEqualToString: @"ends"])
-                match = NSMaxRange(result) == [value length];
-            else
-                break;
+            match = result.location != NSNotFound;
         }
         
         if (match && !needAll)