Don't panic at tiny screen sizes.
This commit is contained in:
parent
5e01fbe066
commit
642ebcf077
1 changed files with 3 additions and 3 deletions
|
@ -69,11 +69,11 @@ impl Layout {
|
||||||
// Compute the position of various elements based on the size of the
|
// Compute the position of various elements based on the size of the
|
||||||
// terminal.
|
// terminal.
|
||||||
fn compute(&mut self, display_hours: bool) {
|
fn compute(&mut self, display_hours: bool) {
|
||||||
let middle: u16 = self.height / 2 - 1;
|
// Prevent integer overflow at very low screen sizes.
|
||||||
|
|
||||||
// Prevent integer overflow on very low screen sizes.
|
|
||||||
if self.width < MIN_WIDTH || self.height < MIN_HEIGHT { return; }
|
if self.width < MIN_WIDTH || self.height < MIN_HEIGHT { return; }
|
||||||
|
|
||||||
|
let middle: u16 = self.height / 2 - 1;
|
||||||
|
|
||||||
if display_hours {
|
if display_hours {
|
||||||
// Seconds digits.
|
// Seconds digits.
|
||||||
self.clock_sec.col = (self.width + self.roster_width) / 2 + DIGIT_WIDTH + 6;
|
self.clock_sec.col = (self.width + self.roster_width) / 2 + DIGIT_WIDTH + 6;
|
||||||
|
|
Loading…
Reference in a new issue