Revision: 2696
http://skim-app.svn.sourceforge.net/skim-app/?rev=2696&view=rev
Author: hofman
Date: 2007-08-21 16:13:30 -0700 (Tue, 21 Aug 2007)
Log Message:
-----------
Rebuild type select search cache lazily.
Modified Paths:
--------------
trunk/SKTypeSelectHelper.m
Modified: trunk/SKTypeSelectHelper.m
===================================================================
--- trunk/SKTypeSelectHelper.m 2007-08-21 22:45:47 UTC (rev 2695)
+++ trunk/SKTypeSelectHelper.m 2007-08-21 23:13:30 UTC (rev 2696)
@@ -41,6 +41,7 @@
#define TIMEOUT 0.7
@interface SKTypeSelectHelper (SKPrivate)
+- (NSArray *)searchCache;
- (void)searchWithStickyMatch:(BOOL)allowUpdate;
- (void)stopTimer;
- (void)startTimerForSelector:(SEL)selector;
@@ -156,6 +157,12 @@
@implementation SKTypeSelectHelper (SKPrivate)
+- (NSArray *)searchCache {
+ if (searchCache == nil)
+ [self rebuildTypeSelectSearchCache];
+ return searchCache;
+}
+
- (void)stopTimer {
[timer invalidate];
[timer release];
@@ -187,7 +194,7 @@
if (cycleResults) {
selectedIndex = [dataSource
typeSelectHelperCurrentlySelectedIndex:self];
- if (selectedIndex >= [searchCache count])
+ if (selectedIndex >= [[self searchCache] count])
selectedIndex = NSNotFound;
} else {
selectedIndex = NSNotFound;
@@ -195,7 +202,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];
@@ -206,11 +213,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;
@@ -233,7 +237,7 @@
if (labelIndex == selectedIndex)
looped = YES;
- label = [searchCache objectAtIndex:labelIndex];
+ label = [[self searchCache] objectAtIndex:labelIndex];
if (matchOption == SKFullStringMatch) {
if ([label caseInsensitiveCompare:searchString] == NSOrderedSame)
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/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit