ui: preserve --ignore-assertions & flags on reload

This commit is contained in:
Simon Michael 2016-05-02 20:12:11 -07:00
parent 9a424d77fc
commit 0a90ef4658
4 changed files with 8 additions and 7 deletions

View File

@ -205,6 +205,7 @@ drawAccountsItem (acctwidth, balwidth) selected (indent, _fullacct, displayacct,
handleAccountsScreen :: AppState -> Vty.Event -> EventM (Next AppState) handleAccountsScreen :: AppState -> Vty.Event -> EventM (Next AppState)
handleAccountsScreen st@AppState{ handleAccountsScreen st@AppState{
aScreen=scr@AccountsScreen{asState=(l,selacct)} aScreen=scr@AccountsScreen{asState=(l,selacct)}
,aopts=UIOpts{cliopts_=copts}
,ajournal=j ,ajournal=j
} e = do } e = do
d <- liftIO getCurrentDay d <- liftIO getCurrentDay
@ -226,7 +227,7 @@ handleAccountsScreen st@AppState{
-- Vty.EvKey (Vty.KChar 'l') [Vty.MCtrl] -> do -- Vty.EvKey (Vty.KChar 'l') [Vty.MCtrl] -> do
Vty.EvKey (Vty.KChar 'g') [] -> do Vty.EvKey (Vty.KChar 'g') [] -> do
ej <- liftIO $ journalReload j -- (ej, changed) <- liftIO $ journalReloadIfChanged copts j (ej, _) <- liftIO $ journalReloadIfChanged copts d j
case ej of case ej of
Right j' -> continue $ reload j' d st' Right j' -> continue $ reload j' d st'
Left err -> continue $ screenEnter d ES.screen{esState=err} st' Left err -> continue $ screenEnter d ES.screen{esState=err} st'

View File

@ -100,7 +100,7 @@ drawErrorScreen _ = error "draw function called with wrong screen type, should n
handleErrorScreen :: AppState -> Vty.Event -> EventM (Next AppState) handleErrorScreen :: AppState -> Vty.Event -> EventM (Next AppState)
handleErrorScreen st@AppState{ handleErrorScreen st@AppState{
aScreen=s@ErrorScreen{esState=_err} aScreen=s@ErrorScreen{esState=_err}
,aopts=UIOpts{cliopts_=_copts} ,aopts=UIOpts{cliopts_=copts}
,ajournal=j ,ajournal=j
} e = do } e = do
case e of case e of
@ -109,7 +109,7 @@ handleErrorScreen st@AppState{
Vty.EvKey (Vty.KChar 'g') [] -> do Vty.EvKey (Vty.KChar 'g') [] -> do
d <- liftIO getCurrentDay d <- liftIO getCurrentDay
ej <- liftIO $ journalReload j -- (ej, changed) <- liftIO $ journalReloadIfChanged copts j (ej, _) <- liftIO $ journalReloadIfChanged copts d j
case ej of case ej of
Left err -> continue st{aScreen=s{esState=err}} -- show latest parse error Left err -> continue st{aScreen=s{esState=err}} -- show latest parse error
Right j' -> continue $ reload j' d $ popScreen st -- return to previous screen, and reload it Right j' -> continue $ reload j' d $ popScreen st -- return to previous screen, and reload it

View File

@ -189,7 +189,7 @@ drawRegisterItem (datewidth,descwidth,acctswidth,changewidth,balwidth) selected
handleRegisterScreen :: AppState -> Vty.Event -> EventM (Next AppState) handleRegisterScreen :: AppState -> Vty.Event -> EventM (Next AppState)
handleRegisterScreen st@AppState{ handleRegisterScreen st@AppState{
aScreen=s@RegisterScreen{rsState=(l,acct)} aScreen=s@RegisterScreen{rsState=(l,acct)}
,aopts=UIOpts{cliopts_=_copts} ,aopts=UIOpts{cliopts_=copts}
,ajournal=j ,ajournal=j
} e = do } e = do
d <- liftIO getCurrentDay d <- liftIO getCurrentDay
@ -198,7 +198,7 @@ handleRegisterScreen st@AppState{
Vty.EvKey (Vty.KChar 'q') [] -> halt st Vty.EvKey (Vty.KChar 'q') [] -> halt st
Vty.EvKey (Vty.KChar 'g') [] -> do Vty.EvKey (Vty.KChar 'g') [] -> do
ej <- liftIO $ journalReload j -- (ej, changed) <- liftIO $ journalReloadIfChanged copts j (ej, _) <- liftIO $ journalReloadIfChanged copts d j
case ej of case ej of
Right j' -> continue $ reload j' d st Right j' -> continue $ reload j' d st
Left err -> continue $ screenEnter d ES.screen{esState=err} st Left err -> continue $ screenEnter d ES.screen{esState=err} st

View File

@ -71,7 +71,7 @@ drawTransactionScreen _ = error "draw function called with wrong screen type, sh
handleTransactionScreen :: AppState -> Vty.Event -> EventM (Next AppState) handleTransactionScreen :: AppState -> Vty.Event -> EventM (Next AppState)
handleTransactionScreen st@AppState{ handleTransactionScreen st@AppState{
aScreen=s@TransactionScreen{tsState=((i,t),nts,acct)} aScreen=s@TransactionScreen{tsState=((i,t),nts,acct)}
,aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}} ,aopts=UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}
,ajournal=j ,ajournal=j
} e = do } e = do
d <- liftIO getCurrentDay d <- liftIO getCurrentDay
@ -84,7 +84,7 @@ handleTransactionScreen st@AppState{
Vty.EvKey (Vty.KChar 'g') [] -> do Vty.EvKey (Vty.KChar 'g') [] -> do
d <- liftIO getCurrentDay d <- liftIO getCurrentDay
ej <- liftIO $ journalReload j -- (ej, changed) <- liftIO $ journalReloadIfChanged copts j (ej, _) <- liftIO $ journalReloadIfChanged copts d j
case ej of case ej of
Right j' -> do Right j' -> do
-- got to redo the register screen's transactions report, to get the latest transactions list for this screen -- got to redo the register screen's transactions report, to get the latest transactions list for this screen