summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cc5
-rw-r--r--src/output.cc12
-rw-r--r--src/output.h1
-rw-r--r--src/session.cc2
4 files changed, 17 insertions, 3 deletions
diff --git a/src/main.cc b/src/main.cc
index a4e78ab7..9b03afd2 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -407,7 +407,10 @@ namespace ledger {
}
else if (verb == "print" || verb == "p") {
verb = "print";
- command = reporter<>(new format_xacts(report, session.print_format));
+ command = reporter<>(new format_xacts(report,
+ report.format_string.empty() ?
+ session.print_format :
+ report.format_string));
}
else if (verb == "balance" || verb == "bal" || verb == "b") {
verb = "balance";
diff --git a/src/output.cc b/src/output.cc
index 582fb0cf..4ddcffb5 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -42,10 +42,18 @@ format_xacts::format_xacts(report_t& _report, const string& format)
if (const char * p = std::strstr(f, "%/")) {
first_line_format.parse(string(f, 0, p - f));
- next_lines_format.parse(string(p + 2));
+ const char * n = p + 2;
+ if (const char * p = std::strstr(n, "%/")) {
+ next_lines_format.parse(string(n, 0, p - n));
+ between_format.parse(string(p + 2));
+ } else {
+ next_lines_format.parse(n);
+ between_format.parse("\n");
+ }
} else {
first_line_format.parse(format);
next_lines_format.parse(format);
+ between_format.parse("\n");
}
}
@@ -56,6 +64,8 @@ void format_xacts::operator()(xact_t& xact)
if (! xact.has_xdata() ||
! xact.xdata().has_flags(XACT_EXT_DISPLAYED)) {
if (last_entry != xact.entry) {
+ if (last_entry)
+ between_format.format(out, *last_entry);
first_line_format.format(out, xact);
last_entry = xact.entry;
}
diff --git a/src/output.h b/src/output.h
index df556235..01b5221f 100644
--- a/src/output.h
+++ b/src/output.h
@@ -44,6 +44,7 @@ protected:
report_t& report;
format_t first_line_format;
format_t next_lines_format;
+ format_t between_format;
entry_t * last_entry;
xact_t * last_xact;
diff --git a/src/session.cc b/src/session.cc
index 3b0b77e1..74dd13e6 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -79,7 +79,7 @@ session_t::session_t()
("%-.9D %-.35P %-.39A %22.108t %!22.132T\n%/"
"%48|%-.38A %22.108t %!22.132T\n"),
print_format
- ("\n%d %Y%C%P\n %-34W %12o%n\n%/ %-34W %12o%n\n"),
+ ("%(date)%(cleared ? \" *\" : (uncleared ? \"\" : \" !\"))%(code ? \" (\" + code + \")\" : \"\") %(payee)\n %-34(account) %12(amount)\n%/ %-34(account) %12(amount)%(note ? \" ; \" + note : \"\")\n"),
balance_format
("%20T %_%-a\n"),
equity_format