Commit a531f5ff authored by Bram Schoenmakers's avatar Bram Schoenmakers

Merge pull request #96 from mruwek/column-ui-fix-old_focus

Fix crashes when last item in column disappeared
parents 84de4e30 3d135aad
......@@ -75,7 +75,12 @@ class TodoListWidget(urwid.LineBox):
self.todolist.append(urwid.Divider('-'))
if old_focus_position:
self.todolist.set_focus(old_focus_position)
try:
self.todolist.set_focus(old_focus_position)
except IndexError:
# scroll to the bottom if the last item disappeared from column
# -2 for the same reason as in self._scroll_to_bottom()
self.todolist.set_focus(len(self.todolist) - 2)
def _scroll_to_top(self, p_size):
self.listbox.set_focus(0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment