Permalink
Browse files

Go to database: change the way the arrow keys are forwarded, so the l…

…ist will scroll (#2343)
  • Loading branch information...
dmoagx committed Dec 6, 2015
1 parent 798786a commit 7364a3bad2807869566415ef5e9c28fb135415d9
Showing with 17 additions and 2 deletions.
  1. +17 −2 Source/SPGotoDatabaseController.m
@@ -396,15 +396,30 @@ - (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doComman
[cancelButton performClick:control];
return YES;
}
// the keyboard event is the preferable choice as it will also scroll the window
// TODO: check if the other path is ever used
NSEvent *currentEvent = [NSApp currentEvent];
BOOL isKeyDownEvent = ([currentEvent type] == NSKeyDown);
// Arrow down/up will usually go to start/end of the text field. we want to change the selected table row.
if (commandSelector == @selector(moveDown:)) {
[databaseListView selectRowIndexes:[NSIndexSet indexSetWithIndex:([databaseListView selectedRow]+1)] byExtendingSelection:NO];
if(isKeyDownEvent) {
[databaseListView keyDown:currentEvent];
}
else {
[databaseListView selectRowIndexes:[NSIndexSet indexSetWithIndex:([databaseListView selectedRow]+1)] byExtendingSelection:NO];
}
return YES;
}
if (commandSelector == @selector(moveUp:)) {
[databaseListView selectRowIndexes:[NSIndexSet indexSetWithIndex:([databaseListView selectedRow]-1)] byExtendingSelection:NO];
if(isKeyDownEvent) {
[databaseListView keyDown:currentEvent];
}
else {
[databaseListView selectRowIndexes:[NSIndexSet indexSetWithIndex:([databaseListView selectedRow]-1)] byExtendingSelection:NO];
}
return YES;
}

0 comments on commit 7364a3b

Please sign in to comment.