aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGokul Soumya2022-06-22 18:00:12 +0000
committerGitHub2022-06-22 18:00:12 +0000
commit301065fe4d062dacc2b23b0f55780b3b6f2f52b5 (patch)
tree89241cac615f8e225cbadaa4ffcce9023a1eeacf
parentb365f2d6143c7a73de703425e00b32b8184d6a02 (diff)
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 :)
-rw-r--r--helix-term/src/ui/menu.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs
index d67a429e..477b218a 100644
--- a/helix-term/src/ui/menu.rs
+++ b/helix-term/src/ui/menu.rs
@@ -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);