From b734af6dd07535afe471a3c9b48e54c9c23cc242 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 11 Sep 2022 17:33:57 -0400 Subject: [PATCH] Only delete lines under cursor if not `None` --- piker/ui/_editors.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/piker/ui/_editors.py b/piker/ui/_editors.py index e7e1bdf0..e250eee3 100644 --- a/piker/ui/_editors.py +++ b/piker/ui/_editors.py @@ -219,19 +219,19 @@ class LineEditor(Struct): lines = self._order_lines.pop(uuid) if lines: cursor = self.godw.get_cursor() + if cursor: + for line in lines: + # if hovered remove from cursor set + hovered = cursor._hovered + if line in hovered: + hovered.remove(line) - for line in lines: - # if hovered remove from cursor set - hovered = cursor._hovered - if line in hovered: - hovered.remove(line) + log.debug(f'deleting {line} with oid: {uuid}') + line.delete() - log.debug(f'deleting {line} with oid: {uuid}') - line.delete() - - # make sure the xhair doesn't get left off - # just because we never got a un-hover event - cursor.show_xhair() + # make sure the xhair doesn't get left off + # just because we never got a un-hover event + cursor.show_xhair() else: log.warning(f'Could not find line for {line}')