From 7364a3bad2807869566415ef5e9c28fb135415d9 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 6 Dec 2015 20:10:58 +0100 Subject: Go to database: change the way the arrow keys are forwarded, so the list will scroll (#2343) --- Source/SPGotoDatabaseController.m | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Source/SPGotoDatabaseController.m b/Source/SPGotoDatabaseController.m index 54e4a22f..61ec8962 100644 --- a/Source/SPGotoDatabaseController.m +++ b/Source/SPGotoDatabaseController.m @@ -396,15 +396,30 @@ static BOOL StringQualifiesForWordSearch(NSString *s); [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; } -- cgit v1.2.3