Limit the count of history items in the completion.

This commit is contained in:
Florian Bruhin 2015-03-13 19:47:42 +01:00
parent 55eabafc0d
commit 833830d5e9
2 changed files with 11 additions and 3 deletions

View File

@ -23,7 +23,7 @@ import datetime
from PyQt5.QtCore import pyqtSlot
from qutebrowser.utils import objreg
from qutebrowser.utils import objreg, utils
from qutebrowser.completion.models import base
from qutebrowser.config import config
@ -48,7 +48,10 @@ class UrlCompletionModel(base.BaseCompletionModel):
for qm_name, qm_url in quickmarks:
self.new_item(self._quickmark_cat, qm_url, qm_name)
for entry in self._history:
max_history = config.get('completion', 'web-history-max-items')
history = utils.newest_slice(self._history, max_history)
for entry in history:
self.new_item(self._history_cat, entry.url, "",
self._fmt_atime(entry.atime), sort=int(entry.atime))

View File

@ -324,7 +324,12 @@ DATA = collections.OrderedDict([
('cmd-history-max-items',
SettingValue(typ.Int(minval=-1), '100'),
"How many commands to save in the history.\n\n"
"How many commands to save in the command history.\n\n"
"0: no history / -1: unlimited"),
('web-history-max-items',
SettingValue(typ.Int(minval=-1), '1000'),
"How many URLs to show in the web history.\n\n"
"0: no history / -1: unlimited"),
('quick-complete',