Fix handling of first :completion-item-prev call.
Before, the first item was unconditionally selected when none was selected before. With :completion-item-prev (e.g. Shift-Tab), it makes more sense to select the *last* one.
This commit is contained in:
parent
37ab5296a7
commit
214347497a
@ -151,7 +151,10 @@ class CompletionView(QTreeView):
|
|||||||
idx = self.selectionModel().currentIndex()
|
idx = self.selectionModel().currentIndex()
|
||||||
if not idx.isValid():
|
if not idx.isValid():
|
||||||
# No item selected yet
|
# No item selected yet
|
||||||
return self.model().first_item()
|
if upwards:
|
||||||
|
return self.model().last_item()
|
||||||
|
else:
|
||||||
|
return self.model().first_item()
|
||||||
while True:
|
while True:
|
||||||
idx = self.indexAbove(idx) if upwards else self.indexBelow(idx)
|
idx = self.indexAbove(idx) if upwards else self.indexBelow(idx)
|
||||||
# wrap around if we arrived at beginning/end
|
# wrap around if we arrived at beginning/end
|
||||||
|
Loading…
Reference in New Issue
Block a user