diff options
author | Max <post@wickenrode.com> | 2014-10-16 23:12:58 +0200 |
---|---|---|
committer | Max <post@wickenrode.com> | 2014-10-16 23:12:58 +0200 |
commit | 68d3620a5277293959f5f86efcf53680ddba9152 (patch) | |
tree | 10e5a08423291ed6309b5a226aee356ec64219cf /Source/SPGotoDatabaseController.m | |
parent | 0e4ad8eb9cddbbd755d55bb50f7707f1e8160121 (diff) | |
download | sequelpro-68d3620a5277293959f5f86efcf53680ddba9152.tar.gz sequelpro-68d3620a5277293959f5f86efcf53680ddba9152.tar.bz2 sequelpro-68d3620a5277293959f5f86efcf53680ddba9152.zip |
Tweak "Go to Database"
* Possibility to double-click an item to go there
* Search is case-insensitive
Diffstat (limited to 'Source/SPGotoDatabaseController.m')
-rw-r--r-- | Source/SPGotoDatabaseController.m | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Source/SPGotoDatabaseController.m b/Source/SPGotoDatabaseController.m index 0c6cbef0..a038cd8b 100644 --- a/Source/SPGotoDatabaseController.m +++ b/Source/SPGotoDatabaseController.m @@ -29,9 +29,19 @@ // More info at <https://github.com/sequelpro/sequelpro> #import "SPGotoDatabaseController.h" -#import "SPDatabaseDocument.h" @interface SPGotoDatabaseController (Private) + +/** Update the list of matched names + * @param filter The string to be matched. + * @param exactMatch Will be set to YES if there is at least one entry in + * unfilteredList that is equivalent to filter. Can be NULL to disable. + * + * This method will take every item in the unfilteredList and add matching items + * to the filteredList, including highlighting. + * It will neither clear the filteredList first, nor change the isFiltered ivar! + * Search is case insensitive. + */ - (void)_buildHightlightedFilterList:(NSString *)filter didFindExactMatch:(BOOL *)exactMatch; - (IBAction)okClicked:(id)sender; @@ -53,6 +63,12 @@ return self; } +- (void)windowDidLoad { + //handle a double click in the DB list the same as if OK was clicked. + [databaseListView setTarget:self]; + [databaseListView setDoubleAction:@selector(okClicked:)]; +} + #pragma mark - #pragma mark IBAction @@ -145,10 +161,11 @@ nil]; for(NSString *db in unfilteredList) { - NSRange match = [db rangeOfString:filter]; + //let's just assume it is in the users interest (most of the time) for searches to be CI. + NSRange match = [db rangeOfString:filter options:NSCaseInsensitiveSearch]; if(match.location == NSNotFound) continue; - //check for exact match? + //should we check for exact match AND have not yet found one? if(exactMatch && !*exactMatch) { if(match.location == 0 && match.length == [db length]) *exactMatch = YES; |