imp!: balance: Stop eliding long amounts. (#1739)
This feature has caused a lot of confusion, and we now have better ways of making sure columns don't get too wide.
This commit is contained in:
		
							parent
							
								
									7e21f05a83
								
							
						
					
					
						commit
						de2776c996
					
				| @ -312,7 +312,7 @@ balancemode = hledgerCommandMode | |||||||
|     ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead" |     ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead" | ||||||
|     ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)" |     ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)" | ||||||
|     ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row" |     ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row" | ||||||
|     ,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode); don't show only 2 commodities per amount" |     ,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)" | ||||||
|     ,flagReq  ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)" |     ,flagReq  ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)" | ||||||
|     ,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed." |     ,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed." | ||||||
|     ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total" |     ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total" | ||||||
| @ -731,10 +731,7 @@ multiBalanceRowAsTableText opts = multiBalanceRowAsWbs (balanceOpts True opts) o | |||||||
| 
 | 
 | ||||||
| -- | Amount display options to use for balance reports | -- | Amount display options to use for balance reports | ||||||
| balanceOpts :: Bool -> ReportOpts -> AmountDisplayOpts | balanceOpts :: Bool -> ReportOpts -> AmountDisplayOpts | ||||||
| balanceOpts isTable ReportOpts{..} = oneLine | balanceOpts isTable ReportOpts{..} = oneLine {displayColour = isTable && color_} | ||||||
|     { displayColour   = isTable && color_ |  | ||||||
|     , displayMaxWidth = if isTable && not no_elide_ then Just 32 else Nothing |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
| tests_Balance = testGroup "Balance" [ | tests_Balance = testGroup "Balance" [ | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -80,7 +80,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = | |||||||
|     ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)" |     ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)" | ||||||
|     ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)" |     ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)" | ||||||
|     ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row" |     ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row" | ||||||
|     ,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode); don't show only 2 commodities per amount" |     ,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)" | ||||||
|     ,flagReq  ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)" |     ,flagReq  ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)" | ||||||
|     ,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name" |     ,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name" | ||||||
|     ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total" |     ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total" | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| # 1. In tabular balance reports, cap the maximum width and elide if sufficiently large | # 1. In tabular balance reports, display on a single line by default | ||||||
| < | < | ||||||
| 2020-01-01 | 2020-01-01 | ||||||
|   (a)  1.00A |   (a)  1.00A | ||||||
| @ -8,16 +8,6 @@ | |||||||
|   (a)  1.00E |   (a)  1.00E | ||||||
|   (a)  1.00F |   (a)  1.00F | ||||||
| 
 | 
 | ||||||
| $ hledger -f- bal -Y |  | ||||||
| Balance changes in 2020: |  | ||||||
| 
 |  | ||||||
|    ||                          2020  |  | ||||||
| ===++=============================== |  | ||||||
|  a || 1.00A, 1.00B, 1.00C, 3 more..  |  | ||||||
| ---++------------------------------- |  | ||||||
|    || 1.00A, 1.00B, 1.00C, 3 more..  |  | ||||||
| 
 |  | ||||||
| # 2. Unless --no-elide is used. |  | ||||||
| $ hledger -f- bal -Y --no-elide | $ hledger -f- bal -Y --no-elide | ||||||
| Balance changes in 2020: | Balance changes in 2020: | ||||||
| 
 | 
 | ||||||
| @ -48,16 +38,16 @@ Balance changes in 2020: | |||||||
|     ea50865f:3bfb86b7:bf72f75a:a7cad1ac       C$ -26.00 |     ea50865f:3bfb86b7:bf72f75a:a7cad1ac       C$ -26.00 | ||||||
|     ea50865f:325566ed:216fec7e:7b433efb         C$ 1.44 |     ea50865f:325566ed:216fec7e:7b433efb         C$ 1.44 | ||||||
| 
 | 
 | ||||||
| # 3. Make sure all amounts up to the largest fit | # 2. Make sure all amounts up to the largest fit | ||||||
| $ hledger -f- bal -Y --color=yes | $ hledger -f- bal -Y --color=yes | ||||||
| Balance changes in 2020: | Balance changes in 2020: | ||||||
| 
 | 
 | ||||||
|                                      ||                               2020  |                                      ||                               2020  | ||||||
| =====================================++================================= | =====================================++==================================== | ||||||
|  26018c6e:ced6cffd:c3c182f1:7b433efb ||      $ 9.41, C$ 24.56, 2 more..  |  26018c6e:ced6cffd:c3c182f1:7b433efb || $ 9.41, C$ 24.56, [31m£ -19.16[m, € 9.21  | ||||||
|  ea50865f:325566ed:216fec7e:7b433efb ||    $ 0.59, C$ 1.44, £ 0.91, € 0.79  |  ea50865f:325566ed:216fec7e:7b433efb ||    $ 0.59, C$ 1.44, £ 0.91, € 0.79  | ||||||
|  ea50865f:325566ed:47134948          ||                            £ 18.25  |  ea50865f:325566ed:47134948          ||                            £ 18.25  | ||||||
|  ea50865f:3bfb86b7:bf72f75a:a7cad1ac ||      [31m$ -10.00[m, [31mC$ -26.00[m, [31m€ -10.00[m  |  ea50865f:3bfb86b7:bf72f75a:a7cad1ac ||      [31m$ -10.00[m, [31mC$ -26.00[m, [31m€ -10.00[m  | ||||||
| -------------------------------------++--------------------------------- | -------------------------------------++------------------------------------ | ||||||
|                                      ||                                  0  |                                      ||                                  0  | ||||||
| >=0 | >=0 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user