diff --git a/CHANGELOG.md b/CHANGELOG.md index 110de9c292..eaa0ec647d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ You can grab pre-release versions from PyPi. See the available versions from the Arcade [PyPi Release History](https://pypi.org/project/arcade/#history) page. +## Unreleased + +- GUI + - Fix a bug, where the caret of UIInputText was misplaced after resizing the widget + ## 3.3.2 - GUI diff --git a/arcade/gui/widgets/text.py b/arcade/gui/widgets/text.py index e4e8d6db8a..a9b50cbee8 100644 --- a/arcade/gui/widgets/text.py +++ b/arcade/gui/widgets/text.py @@ -735,6 +735,9 @@ def _update_layout(self): layout.y = 0 layout.end_update() + # manually update caret position + self.caret.on_layout_update() + @property def text(self): """Text of the input field.""" diff --git a/tests/unit/gui/test_widget_tree.py b/tests/unit/gui/test_widget_tree.py index fee72f39c8..51d12a0bfe 100644 --- a/tests/unit/gui/test_widget_tree.py +++ b/tests/unit/gui/test_widget_tree.py @@ -131,23 +131,25 @@ def objs_in_memory(obj_type): del root gc.collect() - if objs_in_memory(UIWidget) > start_count: - print("Render object graph...") - import objgraph - - objgraph.show_chain( - objgraph.find_backref_chain( - [obj for obj in gc.get_objects() if isinstance(obj, UIWidget)][1], - objgraph.is_proper_module, - ), - # filename="chain.png", - ) - - # print("Render backrefs...") - # objgraph.show_backrefs( - # [[obj for obj in gc.get_objects() if isinstance(obj, UIWidget)][1]], - # max_depth=15, - # # filename="sample-graph.png", - # ) + # This might help, if the test fails ;) + # requires `objgraph` + # if objs_in_memory(UIWidget) > start_count: + # print("Render object graph...") + # import objgraph + # + # objgraph.show_chain( + # objgraph.find_backref_chain( + # [obj for obj in gc.get_objects() if isinstance(obj, UIWidget)][1], + # objgraph.is_proper_module, + # ), + # # filename="chain.png", + # ) + + # print("Render backrefs...") + # objgraph.show_backrefs( + # [[obj for obj in gc.get_objects() if isinstance(obj, UIWidget)][1]], + # max_depth=15, + # # filename="sample-graph.png", + # ) assert objs_in_memory(UIWidget) == start_count