summaryrefslogtreecommitdiff
path: root/qutebrowser/app.py
diff options
context:
space:
mode:
authorJimmy <jimmy@spalge.com>2019-06-03 12:40:23 +1200
committerJimmy <jimmy@spalge.com>2020-07-13 13:14:48 +1200
commite777aef64889094338d29c7bb225a93692c6f968 (patch)
tree3739bf23a85e7b566865fc3e6d0aefac3a496a0d /qutebrowser/app.py
parent3650e26b853382d19dcaf4845ace4e3d19d632cf (diff)
downloadqutebrowser-e777aef64889094338d29c7bb225a93692c6f968.tar.gz
qutebrowser-e777aef64889094338d29c7bb225a93692c6f968.zip
Give the window undo stack a max size.
It is an arbitrary limit for now. We can make in configurable once #4814 adds such a config option. The only time I can imagine someone would want more than 100 entries is if they have tabs_are_windows and more than 100 windows open and do :window-only by mistake. Tested by doing `:repeat 110 open -w about:blank`, `:window-only`, `:repeat 110 undo -w` and looking at the window IDs in the buffer completion.
Diffstat (limited to 'qutebrowser/app.py')
-rw-r--r--qutebrowser/app.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/qutebrowser/app.py b/qutebrowser/app.py
index c9d4d7305..e81412420 100644
--- a/qutebrowser/app.py
+++ b/qutebrowser/app.py
@@ -44,6 +44,7 @@ import tempfile
import datetime
import argparse
import typing
+import collections
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QDesktopServices, QPixmap, QIcon
@@ -502,7 +503,7 @@ class Application(QApplication):
Argument namespace from argparse.
"""
self._last_focus_object = None
- self._undos = []
+ self._undos = collections.deque(maxlen=100)
qt_args = qtargs.qt_args(args)
log.init.debug("Commandline args: {}".format(sys.argv[1:]))