summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-09-11 19:59:53 +0200
committertv <tv@nomic.retiolum>2013-09-11 19:59:53 +0200
commit87b90098679c9daccd558d6df0fef508cf7a4a24 (patch)
treec59527f1efb8effc0688cb17ff891685719f63b7
parenta48c908949884f1e550abbd5bda5b30131fe71c4 (diff)
ledger balance: clarify max_balance_len computation
-rwxr-xr-xledger/lib/balance9
1 files changed, 4 insertions, 5 deletions
diff --git a/ledger/lib/balance b/ledger/lib/balance
index 1e9e2db2..f75410c3 100755
--- a/ledger/lib/balance
+++ b/ledger/lib/balance
@@ -42,15 +42,14 @@ function display_accounts() {
max_balance_len = 0
for (name in accounts) {
for (u in accounts[name]) {
- s = accounts[name][u]
- sub(/\..*/, "", s)
- if (length(s) > max_balance_len) {
- max_balance_len = length(s)
+ n = length(int(accounts[name][u]))
+ if (n > max_balance_len) {
+ max_balance_len = n
}
}
}
if (scale > 0) {
- max_balance_len += 1 + scale
+ max_balance_len += length(".") + scale
}
for (name in accounts) {