summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qutebrowser/misc/sessions.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/qutebrowser/misc/sessions.py b/qutebrowser/misc/sessions.py
index f8842ca6b..0e0d79510 100644
--- a/qutebrowser/misc/sessions.py
+++ b/qutebrowser/misc/sessions.py
@@ -242,21 +242,19 @@ class SessionManager(QObject):
return data
- def _save_tab(self, tab, active, no_history=False):
+ def _save_tab(self, tab, active, with_history=True):
"""Get a dict with data for a single tab.
Args:
tab: The WebView to save.
active: Whether the tab is currently active.
+ with_history: Include the tab's history.
"""
data: _JsonType = {'history': []}
if active:
data['active'] = True
- if no_history:
- history = [tab.history.current_item()]
- else:
- history = tab.history
+ history = tab.history if with_history else [tab.history.current_item()]
for idx, item in enumerate(history):
qtutils.ensure_valid(item)
@@ -270,7 +268,7 @@ class SessionManager(QObject):
data['history'].append(item_data)
return data
- def _save_all(self, *, only_window=None, with_private=False, no_history=False):
+ def _save_all(self, *, only_window=None, with_private=False, with_history=True):
"""Get a dict with data for all windows/tabs."""
data: _JsonType = {'windows': []}
if only_window is not None:
@@ -302,7 +300,7 @@ class SessionManager(QObject):
for i, tab in enumerate(tabbed_browser.widgets()):
active = i == tabbed_browser.widget.currentIndex()
win_data['tabs'].append(self._save_tab(tab, active,
- no_history=no_history))
+ with_history=with_history))
data['windows'].append(win_data)
return data
@@ -323,7 +321,7 @@ class SessionManager(QObject):
return name
def save(self, name, last_window=False, load_next_time=False,
- only_window=None, with_private=False, no_history=False):
+ only_window=None, with_private=False, with_history=True):
"""Save a named session.
Args:
@@ -334,7 +332,7 @@ class SessionManager(QObject):
load_next_time: If set, prepares this session to be load next time.
only_window: If set, only tabs in the specified window is saved.
with_private: Include private windows.
- no_history: Don't save tab history
+ with_history: Include tab history.
Return:
The name of the saved session.
@@ -351,7 +349,7 @@ class SessionManager(QObject):
else:
data = self._save_all(only_window=only_window,
with_private=with_private,
- no_history=no_history)
+ with_history=with_history)
log.sessions.vdebug( # type: ignore[attr-defined]
"Saving data: {}".format(data))
try:
@@ -604,7 +602,7 @@ def session_save(name: ArgType = default, *,
force: Force saving internal sessions (starting with an underline).
only_active_window: Saves only tabs of the currently active window.
with_private: Include private windows.
- no_history: Don't store tab history
+ no_history: Don't store tab history.
"""
if not isinstance(name, Sentinel) and name.startswith('_') and not force:
raise cmdutils.CommandError("{} is an internal session, use --force "
@@ -618,10 +616,10 @@ def session_save(name: ArgType = default, *,
if only_active_window:
name = session_manager.save(name, only_window=win_id,
with_private=True,
- no_history=no_history)
+ with_history=not no_history)
else:
name = session_manager.save(name, with_private=with_private,
- no_history=no_history)
+ with_history=not no_history)
except SessionError as e:
raise cmdutils.CommandError("Error while saving session: {}".format(e))
else: