fix: ui: fix regenerateScreens, it was not updating the journal

And add to test suite. Fixes unreleased code.
This commit is contained in:
Simon Michael 2022-10-28 22:45:13 -10:00
parent 778b660919
commit 3a0473b5b4
2 changed files with 13 additions and 4 deletions

View File

@ -347,10 +347,11 @@ resetScreens d ui@UIState{astartupopts=origopts, ajournal=j, aScreen=s,aPrevScre
where
topscreen' = screenUpdate origopts d j $ lastDef s ss
-- | Regenerate the content of the current and all parent screens
-- from a new journal and reporting date (and current options),
-- while preserving the screen navigation history.
-- | Given a new journal and reporting date, save the new journal in the ui state,
-- then regenerate the content of all screens in the stack
-- (using the ui state's current options), preserving the screen navigation history.
-- Note, does not save the reporting date.
regenerateScreens :: Journal -> Day -> UIState -> UIState
regenerateScreens j d ui@UIState{aopts=opts, aScreen=s,aPrevScreens=ss} =
ui{aScreen=screenUpdate opts d j s, aPrevScreens=map (screenUpdate opts d j) ss}
ui{ajournal=j, aScreen=screenUpdate opts d j s, aPrevScreens=map (screenUpdate opts d j) ss}

View File

@ -213,3 +213,11 @@ which has nice screenshots, but might be less up to date.
──────────────────────────── a:aa transactions (2/2) ───────────────────────────
2021-01-02 a:aa 10 10
2021-01-03 a:aa:aaa 100 110 # <- selected
** hledger-ui -f sample.journal saving, edit and change the "save" txn description and amount to "NEW" and $22, g # current screen shows new data after reload
───────────── sample.journal account balances matching saving (1/1) ────────────
assets:bank:saving $22
** RIGHT # newly created screens show new data after reload
───────────── assets:bank:saving transactions matching saving (1/1) ────────────
2008-06-02 NEW as:ba:saving $22 $22