From 274d3d4a13d3620764daaa1c606986dca397a9b9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Jul 2012 17:44:52 +0530 Subject: [PATCH] Fix return key not working in completion popup on OS X --- src/calibre/gui2/complete2.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/complete2.py b/src/calibre/gui2/complete2.py index eb28c38881..dad2e21d90 100644 --- a/src/calibre/gui2/complete2.py +++ b/src/calibre/gui2/complete2.py @@ -185,11 +185,14 @@ class Completer(QListView): # {{{ e.accept() return True if key in (Qt.Key_Enter, Qt.Key_Return): - if not self.currentIndex().isValid(): - self.hide() - e.accept() - return True - return False + # We handle this explicitly because on OS X activated() is + # not emitted on pressing Enter. + idx = self.currentIndex() + if idx.isValid(): + self.item_chosen(idx) + self.hide() + e.accept() + return True if key in (Qt.Key_PageUp, Qt.Key_PageDown): # Let the list view handle these keys return False