npcole / npyscreen

Automatically exported from code.google.com/p/npyscreen
Other
479 stars 109 forks source link

Fix incorrect minimum heigh check in multiline #88

Open whisperchan opened 4 years ago

whisperchan commented 4 years ago

The minimum height check by default assumes a contained widget height of 1 line. Because it requires space for at least two containing widgets this is set to 2. Setting this internal should not be required by inheriting classes. Instead the check should use the _contained_widget_height property.

Currently having contained widgets with a height > 1 and two or more values with less than two times the space available will cause an infinite recursion loop.

whisperchan commented 4 years ago

I've been looking at MultiLine after someone reported a bug in my application to me. The way it is setup I'm assuming that it originally just were textfields for contained widgets. Because at least two need to exist. One for values and one for the MORE_LABEL.

Therefor the requirement to the height should be: Space for one contained widget and the more label. But currently the code assumes, I think, there are at least two widgets (one being the more label). Thus I changed the check to two times the size of the contained widget.

Rewriting it to one contained_widget + more_label would be the better (but more expensive) thing to do.