aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPGotoDatabaseController.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPGotoDatabaseController.m')
-rw-r--r--Source/SPGotoDatabaseController.m25
1 files changed, 20 insertions, 5 deletions
diff --git a/Source/SPGotoDatabaseController.m b/Source/SPGotoDatabaseController.m
index d9573ea4..3f9a4730 100644
--- a/Source/SPGotoDatabaseController.m
+++ b/Source/SPGotoDatabaseController.m
@@ -29,10 +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;
@@ -58,6 +67,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
@@ -169,13 +184,13 @@
[NSNumber numberWithInt:NSUnderlineStyleSingle],NSUnderlineStyleAttributeName,
nil];
- for (NSString *db in unfilteredList)
- {
- NSRange match = [db rangeOfString:filter];
+ for (NSString *db in unfilteredList) {
+ // 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;