diff --git a/qutebrowser/completion/models/urlmodel.py b/qutebrowser/completion/models/urlmodel.py index 9c4c2516a..0436669ae 100644 --- a/qutebrowser/completion/models/urlmodel.py +++ b/qutebrowser/completion/models/urlmodel.py @@ -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)) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 18ded258b..9b311627f 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -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',