Don't record command history in private mode.

Fixes #43.
This commit is contained in:
Florian Bruhin 2014-12-10 13:19:42 +01:00
parent 76c5c8bf8e
commit b30ca6bcb6
2 changed files with 7 additions and 0 deletions

View File

@ -21,6 +21,7 @@
from PyQt5.QtCore import pyqtSlot
from qutebrowser.config import config
from qutebrowser.utils import usertypes, log
@ -43,6 +44,7 @@ class History:
"""Command history.
Attributes:
handle_private_mode: Whether to ignore history in private mode.
history: A list of executed commands, with newer commands at the end.
_tmphist: Temporary history for history browsing (as NeighborList)
"""
@ -53,6 +55,7 @@ class History:
Args:
history: The initial history to set.
"""
self.handle_private_mode = False
self._tmphist = None
if history is None:
self.history = []
@ -120,5 +123,8 @@ class History:
Args:
text: The text to append.
"""
if (self.handle_private_mode and
config.get('general', 'private-browsing')):
return
if not self.history or text != self.history[-1]:
self.history.append(text)

View File

@ -64,6 +64,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
misc.CommandLineEdit.__init__(self, parent)
misc.MinimalLineEditMixin.__init__(self)
self._win_id = win_id
self.history.handle_private_mode = True
self.history.history = objreg.get('command-history').data
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Ignored)
self.cursorPositionChanged.connect(self.update_completion)