diff options
-rw-r--r-- | Source/TableDocument.m | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 07a8538f..77bc78d7 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1311,11 +1311,6 @@ int i; NSMutableArray *tempResult = [NSMutableArray array]; - if (variables) { - [variables release]; - variables = nil; - } - if (variablesFiltered) { [variablesFiltered release]; variablesFiltered = nil; @@ -1332,11 +1327,16 @@ variablesFiltered = [[NSArray arrayWithArray:tempResult] retain]; - // Weak pointer + // Weak reference variables = variablesFiltered; [variablesTableView reloadData]; + // If the search field already has value from when the panel was previously open, apply the filter. + if ([[variablesSearchField stringValue] length] > 0) { + [self _updateServerVariablesFilterForFilterString:[variablesSearchField stringValue]]; + } + // Show variables sheet [NSApp beginSheet:variablesSheet modalForWindow:tableWindow modalDelegate:self @@ -2155,7 +2155,7 @@ } if (object == variablesSearchField) { - [self _updateServerVariablesFilterForFilterString:[[object stringValue] lowercaseString]]; + [self _updateServerVariablesFilterForFilterString:[object stringValue]]; } } @@ -2257,6 +2257,8 @@ { [saveVariablesButton setEnabled:NO]; + filterString = [filterString lowercaseString]; + filterString = [filterString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; variables = [[NSMutableArray alloc] init]; |