From a94c7d31ec152ff2427092054b99d8c4f3f74cfd Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 10 Mar 2024 07:52:10 +0100 Subject: fix possible overflow during substraction in mark pane It was there for quite a while. --- src/interactive/widgets/mark.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/interactive/widgets/mark.rs b/src/interactive/widgets/mark.rs index d50bd0e..8959017 100644 --- a/src/interactive/widgets/mark.rs +++ b/src/interactive/widgets/mark.rs @@ -295,7 +295,8 @@ impl MarkPane { let num_path_graphemes = path.graphemes(true).count(); match num_path_graphemes + format.total_width() { n if n > area.width as usize => { - let desired_size = num_path_graphemes - (n - area.width as usize); + let desired_size = + num_path_graphemes.saturating_sub(n - area.width as usize); fit_string_graphemes_with_ellipsis( path, num_path_graphemes, -- cgit v1.2.3