Fix return key not working in completion popup on OS X

This commit is contained in:
Kovid Goyal 2012-07-17 17:44:52 +05:30
parent 1508b76c68
commit 274d3d4a13

View File

@ -185,11 +185,14 @@ class Completer(QListView): # {{{
e.accept() e.accept()
return True return True
if key in (Qt.Key_Enter, Qt.Key_Return): if key in (Qt.Key_Enter, Qt.Key_Return):
if not self.currentIndex().isValid(): # We handle this explicitly because on OS X activated() is
self.hide() # not emitted on pressing Enter.
e.accept() idx = self.currentIndex()
return True if idx.isValid():
return False self.item_chosen(idx)
self.hide()
e.accept()
return True
if key in (Qt.Key_PageUp, Qt.Key_PageDown): if key in (Qt.Key_PageUp, Qt.Key_PageDown):
# Let the list view handle these keys # Let the list view handle these keys
return False return False