diff --git a/hledger-ui/Hledger/UI/AccountsScreen.hs b/hledger-ui/Hledger/UI/AccountsScreen.hs index 2fc77af41..cfeaa2762 100644 --- a/hledger-ui/Hledger/UI/AccountsScreen.hs +++ b/hledger-ui/Hledger/UI/AccountsScreen.hs @@ -40,7 +40,7 @@ screen = AccountsScreen{ } initAccountsScreen :: Maybe AccountName -> Day -> AppState -> AppState -initAccountsScreen mselacct d st@AppState{aopts=opts, aargs=args, ajournal=j, aScreen=s@AccountsScreen{}} = +initAccountsScreen mselacct d st@AppState{aopts=opts, ajournal=j, aScreen=s@AccountsScreen{}} = st{aScreen=s{asState=is''}} where is' = list (Name "accounts") (V.fromList items) 1 @@ -60,7 +60,6 @@ initAccountsScreen mselacct d st@AppState{aopts=opts, aargs=args, ajournal=j, aS --{query_=unwords' $ locArgs l} ropts = (reportopts_ cliopts) { - query_=unwords' args, balancetype_=HistoricalBalance -- XXX balanceReport doesn't respect this yet } cliopts = cliopts_ opts @@ -131,7 +130,7 @@ drawAccountsItem fmt _sel item = render $ str $ showitem item handleAccountsScreen :: AppState -> Vty.Event -> EventM (Next AppState) -handleAccountsScreen st@AppState{aargs=args, aScreen=scr@AccountsScreen{asState=is}} e = do +handleAccountsScreen st@AppState{aScreen=scr@AccountsScreen{asState=is}} e = do d <- liftIO getCurrentDay -- c <- getContext -- let h = c^.availHeightL @@ -155,7 +154,7 @@ handleAccountsScreen st@AppState{aargs=args, aScreen=scr@AccountsScreen{asState= Vty.EvKey (Vty.KChar '9') [] -> continue $ initAccountsScreen (Just acct) d $ setDepth 9 st Vty.EvKey (Vty.KLeft) [] -> continue $ popScreen st Vty.EvKey (Vty.KRight) [] -> do - let st' = screenEnter d args RS.screen{rsAcct=acct} st + let st' = screenEnter d RS.screen{rsAcct=acct} st vScrollToBeginning $ viewportScroll "register" continue st' diff --git a/hledger-ui/Hledger/UI/Main.hs b/hledger-ui/Hledger/UI/Main.hs index 32b7c9a8c..e75273ce1 100644 --- a/hledger-ui/Hledger/UI/Main.hs +++ b/hledger-ui/Hledger/UI/Main.hs @@ -62,12 +62,10 @@ runBrickUi opts j = do let theme = maybe defaultTheme (fromMaybe defaultTheme . getTheme) $ maybestringopt "theme" $ rawopts_ $ cliopts_ opts - args = words' $ query_ $ reportopts_ $ cliopts_ opts scr = AS.screen st = (sInitFn scr) d AppState{ aopts=opts - ,aargs=args ,ajournal=j ,aScreen=scr ,aPrevScreens=[] diff --git a/hledger-ui/Hledger/UI/RegisterScreen.hs b/hledger-ui/Hledger/UI/RegisterScreen.hs index fde9ae04e..e59838558 100644 --- a/hledger-ui/Hledger/UI/RegisterScreen.hs +++ b/hledger-ui/Hledger/UI/RegisterScreen.hs @@ -38,14 +38,13 @@ screen = RegisterScreen{ } initRegisterScreen :: Day -> AppState -> AppState -initRegisterScreen d st@AppState{aargs=args, aopts=opts, ajournal=j, aScreen=s@RegisterScreen{rsAcct=acct}} = +initRegisterScreen d st@AppState{aopts=opts, ajournal=j, aScreen=s@RegisterScreen{rsAcct=acct}} = st{aScreen=s{rsState=l}} where -- gather arguments and queries ropts = (reportopts_ $ cliopts_ opts) { depth_=Nothing, - query_=unwords' args, balancetype_=HistoricalBalance } -- XXX temp diff --git a/hledger-ui/Hledger/UI/UITypes.hs b/hledger-ui/Hledger/UI/UITypes.hs index cc04a8d76..a0d2a75ce 100644 --- a/hledger-ui/Hledger/UI/UITypes.hs +++ b/hledger-ui/Hledger/UI/UITypes.hs @@ -14,7 +14,7 @@ import Hledger.UI.Options -- from, brick's App. data AppState = AppState { aopts :: UIOpts -- ^ command-line options at startup - ,aargs :: [String] -- ^ command-line arguments at startup + -- ,aargs :: [String] -- ^ command-line arguments at startup ,ajournal :: Journal -- ^ the parsed journal ,aScreen :: Screen -- ^ the currently active screen ,aPrevScreens :: [Screen] -- ^ previously visited screens diff --git a/hledger-ui/Hledger/UI/UIUtils.hs b/hledger-ui/Hledger/UI/UIUtils.hs index 6ce799372..93068d4f6 100644 --- a/hledger-ui/Hledger/UI/UIUtils.hs +++ b/hledger-ui/Hledger/UI/UIUtils.hs @@ -45,12 +45,10 @@ popScreen st = st -- | Enter a new screen, saving the old screen & state in the -- navigation history and initialising the new screen's state. --- Extra args can be passed to the new screen's init function, --- these can be eg query arguments. -screenEnter :: Day -> [String] -> Screen -> AppState -> AppState -screenEnter d args scr st = (sInitFn scr) d $ - pushScreen scr - st{aargs=args} +screenEnter :: Day -> Screen -> AppState -> AppState +screenEnter d scr st = (sInitFn scr) d $ + pushScreen scr + st -- | In the EventM monad, get the named current viewport's width and height, -- or (0,0) if the named viewport is not found.