diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2024-03-10 07:52:10 +0100 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2024-03-10 07:52:10 +0100 |
commit | a94c7d31ec152ff2427092054b99d8c4f3f74cfd (patch) | |
tree | 2398cceca5602c4483f2fd534e7ec92956e7c250 | |
parent | 5fe858d771d286204d2ed911533869223ea20d2c (diff) |
fix possible overflow during substraction in mark pane
It was there for quite a while.
-rw-r--r-- | src/interactive/widgets/mark.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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, |