Ticket #5149 defect new
insults ContainerWidget doesn't remove focus when child removed
|Reported by:||magmatt||Owned by:|
If a ContainerWidget's focusedChild is removed, focus is not removed.
This is bad because the focusedChild continues to receive characterReceived calls instead of newly added children.
Here's some code that demonstrates the problem:
>>> from twisted.conch.insults.window import Widget, ContainerWidget >>> c = ContainerWidget() >>> c.focused = True >>> a = Widget() >>> c.addChild(a) >>> assert c.focusedChild == a >>> c.remChild(a) >>> assert c.focusedChild == None Traceback (most recent call last): File "<stdin>", line 1, in <module> AssertionError >>> c.focusedChild == a True