From 25bb360f13361313ee4e07216341225bad6c6908 Mon Sep 17 00:00:00 2001 From: Florian Dehau Date: Thu, 27 Oct 2016 23:21:42 +0200 Subject: [PATCH] Fix list selection --- src/widgets/list.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/list.rs b/src/widgets/list.rs index 6a186ee..c79df87 100644 --- a/src/widgets/list.rs +++ b/src/widgets/list.rs @@ -82,8 +82,8 @@ impl<'a> Widget for List<'a> { let list_length = self.items.len(); let list_height = list_area.height as usize; let bound = min(list_height, list_length); - let offset = if self.selected > list_height { - min(self.selected - list_height, list_length - list_height) + let offset = if self.selected >= list_height { + self.selected - list_height + 1 } else { 0 };