From c75d9b55ee43fdb53401a620e44843d60dfc3566 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 12 Jul 2014 21:26:59 +0530 Subject: [PATCH] complete2: Prevent mouse moving in from the bottom of the list changing the scroll position of the list --- src/calibre/gui2/complete2.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/complete2.py b/src/calibre/gui2/complete2.py index 4920d9cb99..d9eb7f7bc1 100644 --- a/src/calibre/gui2/complete2.py +++ b/src/calibre/gui2/complete2.py @@ -115,7 +115,14 @@ class Completer(QListView): # {{{ self.relayout_needed.emit() def item_entered(self, idx): - self.setCurrentIndex(idx) + if self.visualRect(idx).top() < self.viewport().rect().bottom() - 5: + # Prevent any bottom item in the list that is only partially + # visible from triggering setCurrentIndex() + self.entered.disconnect() + try: + self.setCurrentIndex(idx) + finally: + self.entered.connect(self.item_entered) def next_match(self, previous=False): c = self.currentIndex()