crysterm
crysterm copied to clipboard
Fix dependence on `Widget#screen`
Widgets have a parent-children hierarchy.
However, the top-level widget has parent = nil, and instead it has a screen to which it is attached.
In Blessed, Screen is a widget; in Crysterm it is not.
Because of that, there is a new method parent_or_screen which is guaranteed to return something.
However, because screen must be known for various purposes, directly at the time of widget creation, screen is determined and set. Also, on adding children to parent, parent's screen value is set on all children.
This is an unclean implementation. Reduce reliance on Widget#screen and in general see how this should be done in a proper way.