From f0ceb81ed4220230ec775aea438afab1e61b93ad Mon Sep 17 00:00:00 2001 From: Jonathan Daugherty Date: Thu, 16 Sep 2021 12:54:08 -0700 Subject: [PATCH] listMoveToEnd: use correct destination index (fixes #337) --- src/Brick/Widgets/List.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Brick/Widgets/List.hs b/src/Brick/Widgets/List.hs index 4983cf6..de1ce4b 100644 --- a/src/Brick/Widgets/List.hs +++ b/src/Brick/Widgets/List.hs @@ -253,7 +253,7 @@ listMoveToBeginning = listMoveTo 0 listMoveToEnd :: (Foldable t, Splittable t) => GenericList n t e -> GenericList n t e -listMoveToEnd l = listMoveTo (length $ listElements l) l +listMoveToEnd l = listMoveTo (max 0 $ length (listElements l) - 1) l -- | The top-level attribute used for the entire list. listAttr :: AttrName