ui: register: E key toggles zero-amount txns
This commit is contained in:
parent
cc67aeba8d
commit
2c8b47b293
@ -58,23 +58,25 @@ initRegisterScreen d st@AppState{aopts=opts, ajournal=j, aScreen=s@RegisterScree
|
|||||||
thisacctq = Acct $ accountNameToAccountRegex acct -- includes subs
|
thisacctq = Acct $ accountNameToAccountRegex acct -- includes subs
|
||||||
q = filterQuery (not . queryIsDepth) $ queryFromOpts d ropts
|
q = filterQuery (not . queryIsDepth) $ queryFromOpts d ropts
|
||||||
|
|
||||||
-- run a transactions report, most recent last
|
(_label,items) = accountTransactionsReport ropts j q thisacctq
|
||||||
(_label,items') = accountTransactionsReport ropts j q thisacctq
|
items' = (if empty_ ropts then id else filter ((/=0) . fifth6)) $ -- exclude zero-change txns unless --empty
|
||||||
items = reverse items'
|
reverse -- most recent last
|
||||||
|
items
|
||||||
|
|
||||||
-- pre-render all items; these will be the List elements. This helps calculate column widths.
|
-- pre-render all items; these will be the List elements. This helps calculate column widths.
|
||||||
displayitem (t, _, _issplit, otheracctsstr, change, bal) =
|
displayitems = map displayitem items'
|
||||||
(showDate $ tdate t
|
where
|
||||||
,T.unpack $ tdescription t
|
displayitem (t, _, _issplit, otheracctsstr, change, bal) =
|
||||||
,case splitOn ", " otheracctsstr of
|
(showDate $ tdate t
|
||||||
[s] -> s
|
,T.unpack $ tdescription t
|
||||||
ss -> intercalate ", " ss
|
,case splitOn ", " otheracctsstr of
|
||||||
-- _ -> "<split>" -- should do this if accounts field width < 30
|
[s] -> s
|
||||||
,showMixedAmountOneLineWithoutPrice change
|
ss -> intercalate ", " ss
|
||||||
,showMixedAmountOneLineWithoutPrice bal
|
-- _ -> "<split>" -- should do this if accounts field width < 30
|
||||||
,t
|
,showMixedAmountOneLineWithoutPrice change
|
||||||
)
|
,showMixedAmountOneLineWithoutPrice bal
|
||||||
displayitems = map displayitem items
|
,t
|
||||||
|
)
|
||||||
|
|
||||||
-- build the List, moving the selection to the end
|
-- build the List, moving the selection to the end
|
||||||
l = listMoveTo (length items) $
|
l = listMoveTo (length items) $
|
||||||
@ -161,6 +163,7 @@ drawRegisterScreen AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
|
|||||||
bottomlabel = borderKeysStr [
|
bottomlabel = borderKeysStr [
|
||||||
-- ("up/down/pgup/pgdown/home/end", "move")
|
-- ("up/down/pgup/pgdown/home/end", "move")
|
||||||
("left", "back")
|
("left", "back")
|
||||||
|
,("E", "nonzero?")
|
||||||
,("C", "cleared?")
|
,("C", "cleared?")
|
||||||
,("R", "real?")
|
,("R", "real?")
|
||||||
,("right/enter", "transaction")
|
,("right/enter", "transaction")
|
||||||
@ -210,6 +213,7 @@ handleRegisterScreen st@AppState{
|
|||||||
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
|
||||||
|
|
||||||
|
Vty.EvKey (Vty.KChar 'E') [] -> continue $ reload j d $ stToggleEmpty st
|
||||||
Vty.EvKey (Vty.KChar 'C') [] -> continue $ reload j d $ stToggleCleared st
|
Vty.EvKey (Vty.KChar 'C') [] -> continue $ reload j d $ stToggleCleared st
|
||||||
Vty.EvKey (Vty.KChar 'R') [] -> continue $ reload j d $ stToggleReal st
|
Vty.EvKey (Vty.KChar 'R') [] -> continue $ reload j d $ stToggleReal st
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user