From 7b502b06f74cf445c2ccf979b164e0531ee37a9b Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Mon, 2 Jul 2012 16:00:30 +0200 Subject: [PATCH] Limit selection in completion popup to boxes containing less than completion_change_to_ascii_sorting items --- src/calibre/gui2/complete.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/calibre/gui2/complete.py b/src/calibre/gui2/complete.py index 86e31ee30c..6ce6cc2ff0 100644 --- a/src/calibre/gui2/complete.py +++ b/src/calibre/gui2/complete.py @@ -168,13 +168,14 @@ class MultiCompleteComboBox(EnComboBox): v = unicode(c.currentCompletion()) c.setCompletionPrefix('') c.complete() - i = 0; - while c.setCurrentRow(i): - cr = unicode(c.currentIndex().data().toString()) - if cr.startswith(v): - c.popup().setCurrentIndex(c.currentIndex()) - return - i += 1 + if c.model().rowCount() < tweaks['completion_change_to_ascii_sorting']: + i = 0; + while c.setCurrentRow(i): + cr = unicode(c.currentIndex().data().toString()) + if cr.startswith(v): + c.popup().setCurrentIndex(c.currentIndex()) + break + i += 1 def update_items_cache(self, complete_items): self.lineEdit().update_items_cache(complete_items)