fix: out of bound bug in heading_bar

use a `saturating_sub` to calculate the column_width
This commit is contained in:
Jack Wills
2023-03-30 02:22:47 +00:00
parent 5d0d3ffa63
commit b9c125da46
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -432,7 +432,7 @@ pub fn heading_bar<B: Backend>(
let info_text = format!("( h ) {suffix} help {MARGIN}",);
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 splits = if has_containers {
vec![