summaryrefslogtreecommitdiff
path: root/qutebrowser/mainwindow/tabbedbrowser.py
diff options
context:
space:
mode:
authorJimmy <jimmy@spalge.com>2019-05-26 14:37:17 +1200
committerJimmy <jimmy@spalge.com>2020-07-13 13:14:48 +1200
commita69e6903389d39c997b046868b35028ef44c05dd (patch)
tree557e033e59b2401437a1b2c54e5a35407cb3a398 /qutebrowser/mainwindow/tabbedbrowser.py
parent4071317df1e12f0ad927c910334a808bbd8737ee (diff)
downloadqutebrowser-a69e6903389d39c997b046868b35028ef44c05dd.tar.gz
qutebrowser-a69e6903389d39c997b046868b35028ef44c05dd.zip
Don't consider undoing into a None tab.
For undoing the closing of windows we currently instantiate a TabbedBrowser without any tabs. We make tabs by filling in the browsers `_undo` list and calling `undo()`. If the "tabs.last_close" setting was on of the values that modifies the last tab instead of closing it we were getting an AttributeError when trying to access the history of the sole tab.
Diffstat (limited to 'qutebrowser/mainwindow/tabbedbrowser.py')
-rw-r--r--qutebrowser/mainwindow/tabbedbrowser.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py
index 58d545c44..1bd71aea0 100644
--- a/qutebrowser/mainwindow/tabbedbrowser.py
+++ b/qutebrowser/mainwindow/tabbedbrowser.py
@@ -497,8 +497,11 @@ class TabbedBrowser(QWidget):
# Remove unused tab which may be created after the last tab is closed
last_close = config.val.tabs.last_close
use_current_tab = False
- if last_close in ['blank', 'startpage', 'default-page']:
- only_one_tab_open = self.widget.count() == 1
+ last_close_replaces = last_close in [
+ 'blank', 'startpage', 'default-page'
+ ]
+ only_one_tab_open = self.widget.count() == 1
+ if only_one_tab_open and last_close_replaces:
no_history = len(self.widget.widget(0).history) == 1
urls = {
'blank': QUrl('about:blank'),