ui: show nonzero (empty) mode, turn it off by default
-E/--empty is now the default for hledger-ui, so accounts with 0 balance and transactions posting 0 change are shown by default. The E key toggles this, entering "nonzero" mode which hides zero items.
This commit is contained in:
		
							parent
							
								
									6acd57da53
								
							
						
					
					
						commit
						16bb17fbe8
					
				@ -106,6 +106,7 @@ drawAccountsScreen AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
 | 
				
			|||||||
  [ui]
 | 
					  [ui]
 | 
				
			||||||
    where
 | 
					    where
 | 
				
			||||||
      toplabel = files
 | 
					      toplabel = files
 | 
				
			||||||
 | 
					              <+> nonzero
 | 
				
			||||||
              <+> str " accounts"
 | 
					              <+> str " accounts"
 | 
				
			||||||
              <+> borderQueryStr querystr
 | 
					              <+> borderQueryStr querystr
 | 
				
			||||||
              <+> togglefilters
 | 
					              <+> togglefilters
 | 
				
			||||||
@ -129,6 +130,8 @@ drawAccountsScreen AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
 | 
				
			|||||||
            ] of
 | 
					            ] of
 | 
				
			||||||
          [] -> str ""
 | 
					          [] -> str ""
 | 
				
			||||||
          fs -> str " with " <+> withAttr (borderAttr <> "query") (str $ intercalate ", " fs) <+> str " txns"
 | 
					          fs -> str " with " <+> withAttr (borderAttr <> "query") (str $ intercalate ", " fs) <+> str " txns"
 | 
				
			||||||
 | 
					      nonzero | empty_ ropts = str ""
 | 
				
			||||||
 | 
					              | otherwise    = withAttr (borderAttr <> "query") (str " nonzero")
 | 
				
			||||||
      cur = str (case l^.listSelectedL of
 | 
					      cur = str (case l^.listSelectedL of
 | 
				
			||||||
                  Nothing -> "-"
 | 
					                  Nothing -> "-"
 | 
				
			||||||
                  Just i -> show (i + 1))
 | 
					                  Just i -> show (i + 1))
 | 
				
			||||||
@ -138,7 +141,7 @@ drawAccountsScreen AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
 | 
				
			|||||||
         -- ("up/down/pgup/pgdown/home/end", "move")
 | 
					         -- ("up/down/pgup/pgdown/home/end", "move")
 | 
				
			||||||
         ("-=1234567890", "depth")
 | 
					         ("-=1234567890", "depth")
 | 
				
			||||||
        ,("F", "flat?")
 | 
					        ,("F", "flat?")
 | 
				
			||||||
        ,("E", "empty?")
 | 
					        ,("E", "nonzero?")
 | 
				
			||||||
        ,("C", "cleared?")
 | 
					        ,("C", "cleared?")
 | 
				
			||||||
        ,("R", "real?")
 | 
					        ,("R", "real?")
 | 
				
			||||||
        ,("right/enter", "register")
 | 
					        ,("right/enter", "register")
 | 
				
			||||||
 | 
				
			|||||||
@ -79,7 +79,9 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do
 | 
				
			|||||||
            depth_=depthfromoptsandargs,
 | 
					            depth_=depthfromoptsandargs,
 | 
				
			||||||
            -- remove depth: args from query_
 | 
					            -- remove depth: args from query_
 | 
				
			||||||
            query_=unwords $ -- as in ReportOptions, with same limitations
 | 
					            query_=unwords $ -- as in ReportOptions, with same limitations
 | 
				
			||||||
                   [v | (k,v) <- rawopts_ copts, k=="args", not $ "depth" `isPrefixOf` v]
 | 
					                   [v | (k,v) <- rawopts_ copts, k=="args", not $ "depth" `isPrefixOf` v],
 | 
				
			||||||
 | 
					            -- show items with zero amount by default, unlike the CLI
 | 
				
			||||||
 | 
					            empty_=True
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
				
			|||||||
@ -104,6 +104,7 @@ drawRegisterScreen AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
 | 
				
			|||||||
      case concat [
 | 
					      case concat [
 | 
				
			||||||
           if cleared_ ropts then ["cleared"] else []
 | 
					           if cleared_ ropts then ["cleared"] else []
 | 
				
			||||||
          ,if real_ ropts then ["real"] else []
 | 
					          ,if real_ ropts then ["real"] else []
 | 
				
			||||||
 | 
					          ,if empty_ ropts then [] else ["nonzero"]
 | 
				
			||||||
          ] of
 | 
					          ] of
 | 
				
			||||||
        [] -> str ""
 | 
					        [] -> str ""
 | 
				
			||||||
        fs -> withAttr (borderAttr <> "query") (str $ " " ++ intercalate ", " fs)
 | 
					        fs -> withAttr (borderAttr <> "query") (str $ " " ++ intercalate ", " fs)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user