diff options
Diffstat (limited to 'alot/walker.py')
-rw-r--r-- | alot/walker.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/alot/walker.py b/alot/walker.py index a9306bb8..d1d0a898 100644 --- a/alot/walker.py +++ b/alot/walker.py @@ -34,9 +34,13 @@ class PipeWalker(urwid.ListWalker): return self._get_at_pos(start_from - 1) def remove(self, obj): + next_focus = self.focus % len(self.lines) + if self.focus == len(self.lines) - 1 and self.empty: + next_focus = self.focus - 1 + self.lines.remove(obj) if self.lines: - self.set_focus(self.focus % len(self.lines)) + self.set_focus(next_focus) self._modified() def _get_at_pos(self, pos): |