Changeset 607 for trunk/Cocoa/Pester/Source/NJRTableView.m
- Timestamp:
- 12/21/09 22:13:15 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/NJRTableView.m
r605 r607 63 63 - (void)insertText:(id)inString; 64 64 { 65 if (![[self delegate] respondsToSelector:@selector(selectString:inTableView:)]) { 66 // For consistency with List Manager as documented, reset the typeahead buffer after twice the delay until key repeat (in ticks). 67 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 68 int keyRepeatTicks = [defaults integerForKey: @"InitialKeyRepeat"]; 69 NSTimeInterval resetDelay; 65 // For consistency with List Manager as documented, reset the typeahead buffer after twice the delay until key repeat (in ticks). 66 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 67 int keyRepeatTicks = [defaults integerForKey: @"InitialKeyRepeat"]; 68 NSTimeInterval resetDelay; 70 69 71 70 if (keyRepeatTicks == 0) keyRepeatTicks = 35; // default may be missing; if so, set default 72 71 73 72 resetDelay = MIN(2.0 / 60.0 * keyRepeatTicks, 2.0); 74 73 75 76 74 if (typed == nil) typed = [[NSMutableString alloc] init]; 75 [typed appendString: inString]; 77 76 78 79 77 // Cancel any previously queued future invocations of _resetTypeSelect 78 [NSObject cancelPreviousPerformRequestsWithTarget: self selector: @selector(_resetTypeSelect) object: nil]; 80 79 81 82 80 // queue an invocation of clearAccumulatingTypeahead for the near future. 81 [self performSelector: @selector(_resetTypeSelect) withObject: nil afterDelay: resetDelay]; 83 82 84 85 83 // Use stringWithString to make an autoreleased copy, since we may clear out the original string below before it can be used. 84 [[self delegate] tableView: self selectRowMatchingString: [NSString stringWithString: typed]]; 86 85 87 // Show the current typeahead string in the optional display field, like CodeWarrior does (well, not really, CW is much more elegant because it doesn't select anything until you stop typing) 88 [typeSelectDisplay setObjectValue: typed]; 89 } 86 // Show the current typeahead string in the optional display field, like CodeWarrior does (well, not really, CW is much more elegant because it doesn't select anything until you stop typing) 87 [typeSelectDisplay setObjectValue: typed]; 90 88 } 91 89
Note:
See TracChangeset
for help on using the changeset viewer.