Mercurial > libervia-backend
diff sat_frontends/primitivus/chat.py @ 2904:5bba8953061e
primitivus (chat): fixed crash when removing focus_marker after a :search or :history command
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 10 Apr 2019 21:07:47 +0200 |
parents | 13e0a260e7b8 |
children | b5f8cb26ef6f |
line wrap: on
line diff
--- a/sat_frontends/primitivus/chat.py Wed Apr 10 21:04:51 2019 +0200 +++ b/sat_frontends/primitivus/chat.py Wed Apr 10 21:07:47 2019 +0200 @@ -436,12 +436,17 @@ 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