summaryrefslogtreecommitdiff
path: root/qutebrowser/mainwindow/tabbedbrowser.py
diff options
context:
space:
mode:
authorPeter Rice <peter@peterrice.xyz>2020-01-25 20:54:24 -0500
committerPeter Rice <peter@peterrice.xyz>2020-01-25 20:54:24 -0500
commita1e3cb72fa4a3d535257e6b0ea1256d5b923d7f1 (patch)
tree200cf82b2a16adbd6315a5dd29f25b8c3b0b7b7d /qutebrowser/mainwindow/tabbedbrowser.py
parent94235defe358555171b399af5e686674f519b7c1 (diff)
downloadqutebrowser-a1e3cb72fa4a3d535257e6b0ea1256d5b923d7f1.tar.gz
qutebrowser-a1e3cb72fa4a3d535257e6b0ea1256d5b923d7f1.zip
Make :undo reopen the [count]th to last closed tab
Diffstat (limited to 'qutebrowser/mainwindow/tabbedbrowser.py')
-rw-r--r--qutebrowser/mainwindow/tabbedbrowser.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py
index f5dc3277b..916b94678 100644
--- a/qutebrowser/mainwindow/tabbedbrowser.py
+++ b/qutebrowser/mainwindow/tabbedbrowser.py
@@ -481,7 +481,7 @@ class TabbedBrowser(QWidget):
tab.layout().unwrap()
tab.deleteLater()
- def undo(self):
+ def undo(self, count=1):
"""Undo removing of a tab or tabs."""
# Remove unused tab which may be created after the last tab is closed
last_close = config.val.tabs.last_close
@@ -501,7 +501,9 @@ class TabbedBrowser(QWidget):
use_current_tab = (only_one_tab_open and no_history and
last_close_url_used)
- for entry in reversed(self._undo_stack.pop()):
+ entries = self._undo_stack[-count]
+ del self._undo_stack[-count]
+ for entry in reversed(entries):
if use_current_tab:
newtab = self.widget.widget(0)
use_current_tab = False