fix: out of bound bug in heading_bar
use a `saturating_sub` to calculate the column_width
This commit is contained in:
@@ -424,7 +424,7 @@ impl DockerData {
|
|||||||
self.gui_state.lock().set_delete_container(None);
|
self.gui_state.lock().set_delete_container(None);
|
||||||
}
|
}
|
||||||
DockerMessage::ConfirmDelete(id) => {
|
DockerMessage::ConfirmDelete(id) => {
|
||||||
self.gui_state.lock().set_delete_container(Some(id))
|
self.gui_state.lock().set_delete_container(Some(id));
|
||||||
}
|
}
|
||||||
DockerMessage::Update => self.update_everything().await,
|
DockerMessage::Update => self.update_everything().await,
|
||||||
DockerMessage::Quit => {
|
DockerMessage::Quit => {
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ pub fn heading_bar<B: Backend>(
|
|||||||
let info_text = format!("( h ) {suffix} help {MARGIN}",);
|
let info_text = format!("( h ) {suffix} help {MARGIN}",);
|
||||||
let info_width = info_text.chars().count();
|
let info_width = info_text.chars().count();
|
||||||
|
|
||||||
let column_width = usize::from(area.width) - info_width;
|
let column_width = usize::from(area.width).saturating_sub(info_width);
|
||||||
let column_width = if column_width > 0 { column_width } else { 1 };
|
let column_width = if column_width > 0 { column_width } else { 1 };
|
||||||
let splits = if has_containers {
|
let splits = if has_containers {
|
||||||
vec![
|
vec![
|
||||||
|
|||||||
Reference in New Issue
Block a user