diff --git a/hledger-ui/Hledger/UI/TransactionScreen.hs b/hledger-ui/Hledger/UI/TransactionScreen.hs index b99bda066..1e97895b1 100644 --- a/hledger-ui/Hledger/UI/TransactionScreen.hs +++ b/hledger-ui/Hledger/UI/TransactionScreen.hs @@ -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 + diff --git a/hledger-ui/hledger-ui.1.md b/hledger-ui/hledger-ui.1.md index 56e46ba81..5c837c853 100644 --- a/hledger-ui/hledger-ui.1.md +++ b/hledger-ui/hledger-ui.1.md @@ -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.