Fix scrollbar length proportional to total menu items (#2860)
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 :)
commit301065fe4d062dacc2b23b0f55780b3b6f2f52b5
authorGokul Soumya <gokulps15@gmail.com>
dateWed 22 Jun 2022, 23:30 (4 years ago)
parentb365f2d
helix-term/src/ui/menu.rs+1−1
@@ -288,7 +288,7 @@ impl<T: Item + 'static> Component for Menu<T> {
288288 let win_height = area.height as usize;
289289
290290 const fn div_ceil(a: usize, b: usize) -> usize {
291− (a + b - 1) / a
291+ (a + b - 1) / b
292292 }
293293
294294 let scroll_height = std::cmp::min(div_ceil(win_height.pow(2), len), win_height as usize);