diff options
author | extrawurst <mail@rusticorn.com> | 2023-08-22 13:19:17 +0200 |
---|---|---|
committer | extrawurst <mail@rusticorn.com> | 2023-08-22 13:19:17 +0200 |
commit | a5b898c718499da57d8e41fb77e445ff4d3015b6 (patch) | |
tree | eb3a5cbbf35147d49c9ab76de8d4d76d21153c05 /src | |
parent | 9e69f251a865fae6e77cf6bc7d17d4edd0be3096 (diff) |
fix potential panic
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 3bff9e46..f0ee1539 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -22,7 +22,7 @@ pub const fn calc_scroll_top( height_in_lines: usize, selection: usize, ) -> usize { - if current_top + height_in_lines <= selection { + if current_top.saturating_add(height_in_lines) <= selection { selection.saturating_sub(height_in_lines) + 1 } else if current_top > selection { selection |