fix: u16::try_from for text widths

This commit is contained in:
Jack Wills
2022-10-01 23:28:08 +00:00
parent 41cbb84f28
commit 31fb2cb1e6
3 changed files with 25 additions and 23 deletions
+2 -2
View File
@@ -148,7 +148,7 @@ fn ui<B: Backend>(
) {
// set max height for container section, needs +4 to deal with docker commands list and borders
let height = app_data.lock().get_container_len();
let height = if height < 12 { (height + 4) as u16 } else { 12 };
let height = if height < 12 { height + 4 } else { 12 };
let column_widths = app_data.lock().get_width();
let has_containers = !app_data.lock().containers.items.is_empty();
@@ -168,7 +168,7 @@ fn ui<B: Backend>(
// Split into 3, containers+controls, logs, then graphs
let upper_main = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Max(height as u16), Constraint::Percentage(50)].as_ref())
.constraints([Constraint::Max(height.try_into().unwrap_or_default()), Constraint::Percentage(50)].as_ref())
.split(whole_layout[1]);
let top_split = if has_containers {