fix: Check for insufficient space in Panel::required_size
@@ -20,7 +20,13 @@ impl<V: View> ViewWrapper for Panel<V> {
fn wrap_required_size(&mut self, req: Vec2) -> Vec2 {
// TODO: make borders conditional?
- self.view.required_size(req - (2, 2)) + (2, 2)
+ let req = if Vec2::new(2, 2).fits_in(req) {
+ req - (2, 2)
+ } else {
+ Vec2::zero()
+ };
+
+ self.view.required_size(req) + (2, 2)
}
fn wrap_draw(&self, printer: &Printer) {
