complete2: Prevent mouse moving in from the bottom of the list changing the scroll position of the list

This commit is contained in:
Kovid Goyal 2014-07-12 21:26:59 +05:30
parent 4166178747
commit c75d9b55ee

View File

@ -115,7 +115,14 @@ class Completer(QListView): # {{{
self.relayout_needed.emit()
def item_entered(self, 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()