comparison 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
comparison
equal deleted inserted replaced
2903:68a7543ebbb3 2904:5bba8953061e
434 return 434 return
435 435
436 if self.handleUserMoved(message): 436 if self.handleUserMoved(message):
437 return 437 return
438 438
439 if ( 439 if ((self.host.selected_widget != self or not self.host.x_notify.hasFocus())
440 self.host.selected_widget != self or not self.host.x_notify.hasFocus() 440 and self.focus_marker_set is not None):
441 ) and self.focus_marker_set is not None:
442 if not self.focus_marker_set and not self._locked and self.mess_walker: 441 if not self.focus_marker_set and not self._locked and self.mess_walker:
443 if self.focus_marker is not None: 442 if self.focus_marker is not None:
444 self.mess_walker.remove(self.focus_marker) 443 try:
444 self.mess_walker.remove(self.focus_marker)
445 except ValueError:
446 # self.focus_marker may not be in mess_walker anymore if
447 # mess_walker has been cleared, e.g. when showing search
448 # result or using :history command
449 pass
445 self.focus_marker = urwid.Divider("—") 450 self.focus_marker = urwid.Divider("—")
446 self.mess_walker.append(self.focus_marker) 451 self.mess_walker.append(self.focus_marker)
447 self.focus_marker_set = True 452 self.focus_marker_set = True
448 self._scrollDown() 453 self._scrollDown()
449 else: 454 else: