From 06e2ad41e41306c86cafef914a3853c85f91874d Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Wed, 26 Apr 2023 21:32:42 -0400 Subject: [PATCH] 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. --- paint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paint.py b/paint.py index 0c21ca2..07c841b 100755 --- a/paint.py +++ b/paint.py @@ -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: