Set default count for AbstractHistory.back/.forward

Otherwise, using back/forward mouse buttons will crash.
This commit is contained in:
Florian Bruhin 2017-07-11 08:38:06 +02:00
parent 196f4a67b2
commit 882dc75536

View File

@ -465,7 +465,7 @@ class AbstractHistory:
def current_idx(self):
raise NotImplementedError
def back(self, count):
def back(self, count=1):
idx = self.current_idx() - count
if idx >= 0:
self._go_to_item(self._item_at(idx))
@ -473,7 +473,7 @@ class AbstractHistory:
self._go_to_item(self._item_at(0))
raise WebTabError("At beginning of history.")
def forward(self, count):
def forward(self, count=1):
idx = self.current_idx() + count
if idx < len(self):
self._go_to_item(self._item_at(idx))