Skip to content

Commit

Permalink
Fix scrollbar length proportional to total menu items (#2860)
Browse files Browse the repository at this point in the history
The scrollbar length used to increase with more entries in the menu,
which was counter-intuitive to how scrollbars worked in most
applications. Turns out there was a typo in the floor division
implementation :)
  • Loading branch information
sudormrfbin authored Jun 22, 2022
1 parent b365f2d commit 301065f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-term/src/ui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl<T: Item + 'static> Component for Menu<T> {
let win_height = area.height as usize;

const fn div_ceil(a: usize, b: usize) -> usize {
(a + b - 1) / a
(a + b - 1) / b
}

let scroll_height = std::cmp::min(div_ceil(win_height.pow(2), len), win_height as usize);
Expand Down

0 comments on commit 301065f

Please sign in to comment.