From 9a653ca663c7778169844bd0b0746220df206e2a Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 9 Dec 2019 21:52:36 -0800 Subject: [PATCH] fix subtraction underflow in debug mode --- src/frontend/gui/tabbar.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/frontend/gui/tabbar.rs b/src/frontend/gui/tabbar.rs index b862e0429..ddfbf5208 100644 --- a/src/frontend/gui/tabbar.rs +++ b/src/frontend/gui/tabbar.rs @@ -61,7 +61,8 @@ impl TabBarState { let titles_len: usize = tab_titles.iter().map(|s| unicode_column_width(s)).sum(); let number_of_tabs = tab_titles.len(); - let available_cells = title_width - ((number_of_tabs * per_tab_overhead) + system_overhead); + let available_cells = + title_width.saturating_sub((number_of_tabs * per_tab_overhead) + system_overhead); let tab_width_max = if available_cells >= titles_len { // We can render each title with its full width usize::max_value()