Set default count for AbstractHistory.back/.forward
Otherwise, using back/forward mouse buttons will crash.
This commit is contained in:
parent
196f4a67b2
commit
882dc75536
@ -465,7 +465,7 @@ class AbstractHistory:
|
|||||||
def current_idx(self):
|
def current_idx(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def back(self, count):
|
def back(self, count=1):
|
||||||
idx = self.current_idx() - count
|
idx = self.current_idx() - count
|
||||||
if idx >= 0:
|
if idx >= 0:
|
||||||
self._go_to_item(self._item_at(idx))
|
self._go_to_item(self._item_at(idx))
|
||||||
@ -473,7 +473,7 @@ class AbstractHistory:
|
|||||||
self._go_to_item(self._item_at(0))
|
self._go_to_item(self._item_at(0))
|
||||||
raise WebTabError("At beginning of history.")
|
raise WebTabError("At beginning of history.")
|
||||||
|
|
||||||
def forward(self, count):
|
def forward(self, count=1):
|
||||||
idx = self.current_idx() + count
|
idx = self.current_idx() + count
|
||||||
if idx < len(self):
|
if idx < len(self):
|
||||||
self._go_to_item(self._item_at(idx))
|
self._go_to_item(self._item_at(idx))
|
||||||
|
Loading…
Reference in New Issue
Block a user