From 89fa38c71204c4275918be1a5a5330234ef32750 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 10 Jun 2017 22:58:28 +0530 Subject: [PATCH] Fix initial down arrow in search box jumping two places --- src/calibre/gui2/search_box.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py index 9446eae4a7..d7e5af5927 100644 --- a/src/calibre/gui2/search_box.py +++ b/src/calibre/gui2/search_box.py @@ -213,12 +213,15 @@ class SearchBox2(QComboBox): # {{{ if k in (Qt.Key_Enter, Qt.Key_Return): return self.do_search() if k not in (Qt.Key_Up, Qt.Key_Down): - QComboBox.keyPressEvent(self, event) - else: - self.blockSignals(True) - self.normalize_state() - QComboBox.keyPressEvent(self, event) - self.blockSignals(False) + return QComboBox.keyPressEvent(self, event) + self.blockSignals(True) + self.normalize_state() + if k == Qt.Key_Down and self.currentIndex() == 0 and not self.lineEdit().text(): + self.setCurrentIndex(1), self.setCurrentIndex(0) + event.accept() + return + QComboBox.keyPressEvent(self, event) + self.blockSignals(False) def completer_used(self, text): self.timer.stop()