fix: ui: accounts: don't let j or C-n move past bottom

This commit is contained in:
Simon Michael 2021-11-18 07:11:04 -10:00
parent 9f6595f122
commit 7bbff6a359
2 changed files with 3 additions and 4 deletions

View File

@ -332,9 +332,8 @@ asHandle ui0@UIState{
asEnterRegister d clickedacct ui
where clickedacct = maybe "" asItemAccountName $ listElements _asList !? y
-- prevent moving down over blank padding items;
-- instead scroll down by one, until maximally scrolled - shows the end has been reached
VtyEvent (EvKey (KDown) []) | isBlankElement mnextelement -> do
-- when selection is at the last item, DOWN scrolls instead of moving, until maximally scrolled
VtyEvent e | e `elem` moveDownEvents, isBlankElement mnextelement -> do
vScrollBy (viewportScroll $ _asList^.listNameL) 1 >> continue ui
where mnextelement = listSelectedElement $ listMoveDown _asList

View File

@ -372,7 +372,7 @@ rsHandle ui@UIState{
continue $ screenEnter d transactionScreen{tsAccount=rsAccount} ui
where clickeddate = maybe "" rsItemDate $ listElements rsList !? y
-- when at the last item, instead of moving down, scroll down by one, until maximally scrolled
-- when selection is at the last item, DOWN scrolls instead of moving, until maximally scrolled
VtyEvent e | e `elem` moveDownEvents, isBlankElement mnextelement -> do
vScrollBy (viewportScroll $ rsList ^. listNameL) 1 >> continue ui
where mnextelement = listSelectedElement $ listMoveDown rsList