Don't panic at tiny screen sizes.

This commit is contained in:
shy 2021-04-08 12:32:37 +02:00
parent 5e01fbe066
commit 642ebcf077

View file

@ -69,11 +69,11 @@ impl Layout {
// Compute the position of various elements based on the size of the
// terminal.
fn compute(&mut self, display_hours: bool) {
let middle: u16 = self.height / 2 - 1;
// Prevent integer overflow on very low screen sizes.
// Prevent integer overflow at very low screen sizes.
if self.width < MIN_WIDTH || self.height < MIN_HEIGHT { return; }
let middle: u16 = self.height / 2 - 1;
if display_hours {
// Seconds digits.
self.clock_sec.col = (self.width + self.roster_width) / 2 + DIGIT_WIDTH + 6;