Revision: 10965
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=10965&view=rev
Author:   hofman
Date:     2007-08-21 16:14:50 -0700 (Tue, 21 Aug 2007)

Log Message:
-----------
Rebuild type select search cache lazily.

Modified Paths:
--------------
    trunk/bibdesk/BDSKTypeSelectHelper.m

Modified: trunk/bibdesk/BDSKTypeSelectHelper.m
===================================================================
--- trunk/bibdesk/BDSKTypeSelectHelper.m        2007-08-21 17:23:37 UTC (rev 
10964)
+++ trunk/bibdesk/BDSKTypeSelectHelper.m        2007-08-21 23:14:50 UTC (rev 
10965)
@@ -192,7 +192,7 @@
         
         if (cycleResults) {
             selectedIndex = [dataSource 
typeSelectHelperCurrentlySelectedIndex:self];
-            if (selectedIndex >= [searchCache count])
+            if (selectedIndex >= [[self searchCache] count])
                 selectedIndex = NSNotFound;
         } else {
             selectedIndex = NSNotFound;
@@ -200,7 +200,7 @@
         
         startIndex = selectedIndex;
         if (sticky && selectedIndex != NSNotFound)
-            startIndex = startIndex > 0 ? startIndex - 1 : [searchCache count] 
- 1;
+            startIndex = startIndex > 0 ? startIndex - 1 : [[self searchCache] 
count] - 1;
         
         foundIndex = [self indexOfMatchedItemAfterIndex:startIndex];
         
@@ -212,11 +212,8 @@
 
 - (unsigned int)indexOfMatchedItemAfterIndex:(unsigned int)selectedIndex;
 {
-    if (searchCache == nil)
-        [self rebuildTypeSelectSearchCache];
+    unsigned int labelCount = [[self searchCache] count];
     
-    unsigned int labelCount = [searchCache count];
-    
     if (labelCount == NO)
         return NSNotFound;
     
@@ -239,7 +236,7 @@
         if (labelIndex == selectedIndex)
             looped = YES;
         
-        label = [searchCache objectAtIndex:labelIndex];
+        label = [[self searchCache] objectAtIndex:labelIndex];
         
         int location = [label length] < searchStringLength ? NSNotFound : 
[label rangeOfString:searchString options:options].location;
         if (location != NSNotFound) {


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to