mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
when an existing search term is reused, move it to top
This commit is contained in:
parent
42f8088037
commit
1a5fd5c44a
1 changed files with 9 additions and 7 deletions
|
@ -475,14 +475,16 @@ class Browser(QMainWindow):
|
|||
def onSearch(self, reset=True):
|
||||
"Careful: if reset is true, the current note is saved."
|
||||
txt = unicode(self.form.searchEdit.lineEdit().text()).strip()
|
||||
sh = self.mw.pm.profile['searchHistory']
|
||||
prompt = _("<type here to search; hit enter to show current deck>")
|
||||
if txt not in sh:
|
||||
sh.insert(0, txt)
|
||||
sh = sh[:30]
|
||||
self.form.searchEdit.clear()
|
||||
self.form.searchEdit.addItems(sh)
|
||||
self.mw.pm.profile['searchHistory'] = sh
|
||||
sh = self.mw.pm.profile['searchHistory']
|
||||
# update search history
|
||||
if txt in sh:
|
||||
sh.remove(txt)
|
||||
sh.insert(0, txt)
|
||||
sh = sh[:30]
|
||||
self.form.searchEdit.clear()
|
||||
self.form.searchEdit.addItems(sh)
|
||||
self.mw.pm.profile['searchHistory'] = sh
|
||||
if self.mw.state == "review" and "is:current" in txt:
|
||||
# search for current card, but set search to easily display whole
|
||||
# deck
|
||||
|
|
Loading…
Reference in a new issue