From 4a0d1701fc99fdf0e7d91c6880d3416ab7b91577 Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 10 Apr 2019 21:07:47 +0200 Subject: [PATCH] primitivus (chat): fixed crash when removing focus_marker after a :search or :history command --- sat_frontends/primitivus/chat.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sat_frontends/primitivus/chat.py b/sat_frontends/primitivus/chat.py index 827c8018..110e6d73 100644 --- a/sat_frontends/primitivus/chat.py +++ b/sat_frontends/primitivus/chat.py @@ -436,12 +436,17 @@ class Chat(PrimitivusWidget, quick_chat.QuickChat): if self.handleUserMoved(message): return - if ( - self.host.selected_widget != self or not self.host.x_notify.hasFocus() - ) and self.focus_marker_set is not None: + if ((self.host.selected_widget != self or not self.host.x_notify.hasFocus()) + and self.focus_marker_set is not None): if not self.focus_marker_set and not self._locked and self.mess_walker: if self.focus_marker is not None: - self.mess_walker.remove(self.focus_marker) + try: + self.mess_walker.remove(self.focus_marker) + except ValueError: + # self.focus_marker may not be in mess_walker anymore if + # mess_walker has been cleared, e.g. when showing search + # result or using :history command + pass self.focus_marker = urwid.Divider("—") self.mess_walker.append(self.focus_marker) self.focus_marker_set = True