ui: txn: next/prev also moves selection in register

This commit is contained in:
Simon Michael 2015-10-29 20:34:31 -07:00
parent 4691454908
commit 722e19098f
2 changed files with 10 additions and 6 deletions

View File

@ -19,7 +19,7 @@ import Data.Time.Calendar (Day)
import Graphics.Vty as Vty
-- import Safe (headDef, lastDef)
import Brick
-- import Brick.Widgets.List
import Brick.Widgets.List (listMoveTo)
-- import Brick.Widgets.Border
-- import Brick.Widgets.Border.Style
-- import Brick.Widgets.Center
@ -89,8 +89,16 @@ handleTransactionScreen st@AppState{
Vty.EvKey (Vty.KUp) [] -> continue $ reload j d st{aScreen=s{tsState=((iprev,tprev),nts,acct)}}
Vty.EvKey (Vty.KDown) [] -> continue $ reload j d st{aScreen=s{tsState=((inext,tnext),nts,acct)}}
Vty.EvKey (Vty.KLeft) [] -> continue $ popScreen st
Vty.EvKey (Vty.KLeft) [] -> continue st''
where
st'@AppState{aScreen=scr} = popScreen st
st'' = st'{aScreen=rsSetSelectedTransaction (fromIntegral i) scr}
_ev -> continue st
handleTransactionScreen _ _ = error "event handler called with wrong screen type, should not happen"
rsSetSelectedTransaction i scr@RegisterScreen{rsState=(l,a)} = scr{rsState=(l',a)}
where l' = listMoveTo (i-1) l
rsSetSelectedTransaction _ scr = scr

View File

@ -214,7 +214,3 @@ visual indication that this is in progress.
The register screen's switching between historic balance and running
total based on query arguments may be confusing, and there is no
column heading to indicate which is being displayed.
When you navigate to an earlier or later transaction with cursor
up/down in the transaction screen, and then return to the register
screen, the selection will not have moved.