Fix cells inverted outside the textbox to the left of the selection after closing a menu over the region

Normally, only the region with the textbox is updated, when the text selection changes, but if the canvas is refreshed by other means, like a menu, it can show up.
This commit is contained in:
Isaiah Odhner 2023-04-26 21:32:42 -04:00
parent f6b94f67c4
commit 06e2ad41e4

View File

@ -1115,7 +1115,7 @@ class Canvas(Widget):
assert style.color is not None
assert style.bgcolor is not None
def within_text_selection_highlight(textbox: Selection) -> int:
if cell_x >= textbox.region.right:
if cell_x >= textbox.region.right or cell_x < textbox.region.x:
# Prevent inverting outside the textbox.
return False
def offset_to_text_index(offset: Offset) -> int: