aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/DBView.xib1
-rw-r--r--Source/SPTablesList.m51
2 files changed, 36 insertions, 16 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index d9cc806c..5258239c 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -147,6 +147,7 @@
</searchFieldCell>
<connections>
<action selector="updateFilter:" target="68" id="6285"/>
+ <outlet property="delegate" destination="68" id="3S3-Wq-23P"/>
<outlet property="nextKeyView" destination="22" id="6322"/>
</connections>
</searchField>
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index 67f26c31..338ecd7e 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -1624,23 +1624,42 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
*/
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
{
-
- // When enter/return is used, save the row.
- if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] ) {
- [[control window] makeFirstResponder:control];
- return YES;
-
- // When the escape key is used, abort the rename.
- } else if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(cancelOperation:)] ||
- [textView methodForSelector:command] == [textView methodForSelector:@selector(complete:)] ) {
-
- [control abortEditing];
- [[tablesListView window] makeFirstResponder:tablesListView];
-
- return YES;
- } else{
- return NO;
+
+ if(control == listFilterField) {
+ NSInteger newRow = NSNotFound;
+ // Arrow down/up will usually go to start/end of the text field. we want to change the selected table row.
+ if (command == @selector(moveDown:)) {
+ newRow = [tablesListView selectedRow] + 1;
+ }
+
+ if (command == @selector(moveUp:)) {
+ newRow = [tablesListView selectedRow] - 1;
+ }
+
+ if(newRow != NSNotFound) {
+ //we can't go below 1 or we'll select the table header
+ [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:(newRow > 0 ? newRow : 1)] byExtendingSelection:NO];
+ return YES;
+ }
+ }
+ else {
+ // When enter/return is used, save the row.
+ if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] ) {
+ [[control window] makeFirstResponder:control];
+ return YES;
+ }
+ // When the escape key is used, abort the rename.
+ else if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(cancelOperation:)] ||
+ [textView methodForSelector:command] == [textView methodForSelector:@selector(complete:)] ) {
+
+ [control abortEditing];
+ [[tablesListView window] makeFirstResponder:tablesListView];
+
+ return YES;
+ }
}
+
+ return NO;
}
#endif