mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-06 08:34:28 +01:00
Remember no more than 100 search expressions in the history
This commit is contained in:
parent
0301890d59
commit
16c3101490
2 changed files with 6 additions and 0 deletions
|
|
@ -27,6 +27,8 @@ def __init__(self, text, action, parent):
|
|||
|
||||
class HistoryLineEdit(HistoryLineEdit2):
|
||||
|
||||
max_history_items = 100
|
||||
|
||||
def __init__(self, parent, clear_msg):
|
||||
HistoryLineEdit2.__init__(self, parent)
|
||||
self.disable_popup = tprefs['disable_completion_popup_for_search']
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
class HistoryLineEdit2(LineEdit):
|
||||
|
||||
max_history_items = None
|
||||
|
||||
@property
|
||||
def store_name(self):
|
||||
return 'lineedit_history_'+self._name
|
||||
|
|
@ -31,6 +33,8 @@ def save_history(self):
|
|||
except ValueError:
|
||||
pass
|
||||
self.history.insert(0, ct)
|
||||
if self.max_history_items is not None:
|
||||
del self.history[self.max_history_items:]
|
||||
history.set(self.store_name, self.history)
|
||||
self.update_items_cache(self.history)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue