diff options
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r-- | Source/TablesList.m | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m index bba94272..ac0be0d8 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -1057,7 +1057,9 @@ */ - (BOOL)selectTableOrViewWithName:(NSString *)theName { - int i, tableType, itemIndex = NSNotFound; + int i, tableType; + int itemIndex = NSNotFound; + int caseInsensitiveItemIndex = NSNotFound; // Loop through the tables/views to find the desired item for (i = 0; i < [tables count]; i++) { @@ -1067,8 +1069,15 @@ itemIndex = i; break; } + if ([[tables objectAtIndex:i] compare:theName options:NSCaseInsensitiveSearch|NSLiteralSearch] == NSOrderedSame) + caseInsensitiveItemIndex = i; } + // If no case-sensitive match was found, use a case-insensitive match if available + if (itemIndex == NSNotFound && caseInsensitiveItemIndex != NSNotFound) + itemIndex = caseInsensitiveItemIndex; + + // If no match found, return failure if (itemIndex == NSNotFound) return NO; [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO]; |