diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index e223a3b14..a51fda016 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -158,7 +158,7 @@ def _init_misc(): from qutebrowser.misc import lineparser command_history = lineparser.LimitLineParser( standarddir.data(), 'cmd-history', - limit=('completion', 'cmd-history-max-items'), + limit='completion.cmd_history_max_items', parent=objreg.get('config')) objreg.register('command-history', command_history) save_manager.add_saveable('command-history', command_history.save, diff --git a/qutebrowser/misc/lineparser.py b/qutebrowser/misc/lineparser.py index ea9d100b7..f137b91f3 100644 --- a/qutebrowser/misc/lineparser.py +++ b/qutebrowser/misc/lineparser.py @@ -263,8 +263,7 @@ class LimitLineParser(LineParser): """A LineParser with a limited count of lines. Attributes: - _limit: The config section/option used to limit the maximum number of - lines. + _limit: The config option used to limit the maximum number of lines. """ def __init__(self, configdir, fname, *, limit, binary=False, parent=None): @@ -273,7 +272,7 @@ class LimitLineParser(LineParser): Args: configdir: Directory to read the config from, or None. fname: Filename of the config file. - limit: Config tuple (section, option) which contains a limit. + limit: Config option which contains a limit. binary: Whether to open the file in binary mode. """ super().__init__(configdir, fname, binary=binary, parent=parent) @@ -286,20 +285,20 @@ class LimitLineParser(LineParser): configdir=self._configdir, fname=self._fname, limit=self._limit, binary=self._binary) - @pyqtSlot(str, str) - def cleanup_file(self, section, option): + @pyqtSlot(str) + def cleanup_file(self, option): """Delete the file if the limit was changed to 0.""" assert self._configfile is not None - if (section, option) != self._limit: + if option != self._limit: return - value = config.get(section, option) + value = config.get(option) if value == 0: if os.path.exists(self._configfile): os.remove(self._configfile) def save(self): """Save the config file.""" - limit = config.get(*self._limit) + limit = config.get(self._limit) if limit == 0: return do_save = self._prepare_save()