aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPTablesList.m20
1 files changed, 15 insertions, 5 deletions
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index a0a9bf92..79df1a4d 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -64,16 +64,19 @@
NSArray *resultRow;
NSInteger i;
NSString *previousSelectedTable = nil;
+ NSString *previousFilterString = nil;
BOOL previousTableListIsSelectable = tableListIsSelectable;
BOOL changeEncoding = ![[mySQLConnection encoding] isEqualToString:@"utf8"];
if (selectedTableName) previousSelectedTable = [[NSString alloc] initWithString:selectedTableName];
if (isTableListFiltered) {
+ previousFilterString = [[NSString alloc] initWithString:[listFilterField stringValue]];
if (filteredTables) [filteredTables release];
filteredTables = tables;
if (filteredTableTypes) [filteredTableTypes release];
filteredTableTypes = tableTypes;
isTableListFiltered = NO;
+ [[self onMainThread] clearFilter];
}
tableListContainsViews = NO;
@@ -256,11 +259,17 @@
selectedTableType = SPTableTypeNone;
}
- // Determine whether or not to show the list filter based on the number of tables, and clear it
- [[self onMainThread] clearFilter];
-
- if ([tables count] > 20) [self showFilter];
- else [self hideFilter];
+ // Determine whether or not to preserve the existing filter, and whether to
+ // show or hide the list filter based on the number of tables
+ if ([tables count] > 20) {
+ [self showFilter];
+ if (previousFilterString) {
+ [[listFilterField onMainThread] setStringValue:previousFilterString];
+ [[self onMainThread] updateFilter:self];
+ }
+ } else {
+ [self hideFilter];
+ }
// Set the filter placeholder text
if ([tableDocumentInstance database]) {
@@ -268,6 +277,7 @@
}
if (previousSelectedTable) [previousSelectedTable release];
+ if (previousFilterString) [previousFilterString release];
// Query the structure of all databases in the background
if (sender == self)