From 6a4b25c6aa85a600b1a480e930864dcae0489f91 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Wed, 22 Jun 2022 22:34:04 +0530 Subject: [PATCH] Fix scrollbar length proportional to total menu items 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 :) --- helix-term/src/ui/menu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index d67a429e37f3..477b218ad63d 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -288,7 +288,7 @@ impl Component for Menu { 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);