Skip to content

Commit 563f491

Browse files
committed
print fix
1 parent 5aa0311 commit 563f491

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ledger/cmd/print.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ func cliTransactions() ([]*ledger.Transaction, error) {
4545
}
4646
}
4747
}
48-
spaceStr = strings.Repeat(" ", columnWidth)
4948

5049
parsedStartDate, tstartErr := date.Parse(startString)
5150
parsedEndDate, tendErr := date.Parse(endString)
@@ -160,6 +159,10 @@ func PrintBalances(accountList []*ledger.Account, printZeroBalances bool, depth,
160159

161160
// WriteTransaction writes a transaction formatted to fit in specified column width.
162161
func WriteTransaction(w io.StringWriter, trans *ledger.Transaction, columns int) {
162+
if len(spaceStr) < columns {
163+
spaceStr = strings.Repeat(" ", columns)
164+
}
165+
163166
for _, c := range trans.Comments {
164167
w.WriteString(c)
165168
w.WriteString(newLine)

0 commit comments

Comments
 (0)