Merge pull request #3698 from ylmrx/crash_on_empty_focus_next

Fixes crash upon view.focus.[next|prev] - #3694
This commit is contained in:
Maximilian Hils 2019-11-14 21:07:53 +01:00 committed by GitHub
commit d38e20689e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -238,18 +238,24 @@ class View(collections.abc.Sequence):
"""
Set focus to the next flow.
"""
idx = self.focus.index + 1
if self.inbounds(idx):
self.focus.flow = self[idx]
if self.focus.index is not None:
idx = self.focus.index + 1
if self.inbounds(idx):
self.focus.flow = self[idx]
else:
pass
@command.command("view.focus.prev")
def focus_prev(self) -> None:
"""
Set focus to the previous flow.
"""
idx = self.focus.index - 1
if self.inbounds(idx):
self.focus.flow = self[idx]
if self.focus.index is not None:
idx = self.focus.index - 1
if self.inbounds(idx):
self.focus.flow = self[idx]
else:
pass
# Order
@command.command("view.order.options")