Revision: 2777
http://skim-app.svn.sourceforge.net/skim-app/?rev=2777&view=rev
Author: hofman
Date: 2007-08-30 04:22:19 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Use a type-select timeout based on the initial key repeat interval.
Modified Paths:
--------------
trunk/SKTypeSelectHelper.m
Modified: trunk/SKTypeSelectHelper.m
===================================================================
--- trunk/SKTypeSelectHelper.m 2007-08-30 09:59:17 UTC (rev 2776)
+++ trunk/SKTypeSelectHelper.m 2007-08-30 11:22:19 UTC (rev 2777)
@@ -38,7 +38,6 @@
#import "SKTypeSelectHelper.h"
-#define TIMEOUT 0.7
#define REPEAT_CHARACTER '/'
@interface NSString (BDSKTypeAheadHelperExtensions)
@@ -48,6 +47,7 @@
#pragma mark -
@interface SKTypeSelectHelper (SKPrivate)
+- (NSTimeInterval)timeoutInterval;
- (NSArray *)searchCache;
- (void)searchWithStickyMatch:(BOOL)allowUpdate;
- (void)stopTimer;
@@ -176,6 +176,15 @@
@implementation SKTypeSelectHelper (SKPrivate)
+// See
http://www.mactech.com/articles/mactech/Vol.18/18.10/1810TableTechniques/index.html
+- (NSTimeInterval)timeoutInterval {
+ int keyThreshTicks = [[NSUserDefaults standardUserDefaults]
integerForKey:@"InitialKeyRepeat"];
+ if (0 == keyThreshTicks)
+ keyThreshTicks = 35; // apparent default value, translates to 1.17
sec timeout.
+
+ return fmin(2.0 / 60.0 * keyThreshTicks, 2.0);
+}
+
- (NSArray *)searchCache {
if (searchCache == nil)
[self rebuildTypeSelectSearchCache];
@@ -190,7 +199,7 @@
- (void)startTimerForSelector:(SEL)selector {
[self stopTimer];
- timer = [[NSTimer alloc] initWithFireDate:[NSDate
dateWithTimeIntervalSinceNow:TIMEOUT] interval:0 target:self selector:selector
userInfo:NULL repeats:NO];
+ timer = [[NSTimer alloc] initWithFireDate:[NSDate
dateWithTimeIntervalSinceNow:[self timeoutInterval]] interval:0 target:self
selector:selector userInfo:NULL repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
}
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