summaryrefslogtreecommitdiff
path: root/src/balance.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-06-16 16:57:10 +0100
committerJohn Wiegley <johnw@newartisans.com>2009-06-16 16:57:10 +0100
commit298a4faef371cae8f308c0b729a1a34ea7aa927c (patch)
tree277f3125c4e03f7c80c8187c6165a66286131a9b /src/balance.cc
parent995c94ef178d143c2458ebf66ddb084aa782e975 (diff)
downloadfork-ledger-298a4faef371cae8f308c0b729a1a34ea7aa927c.tar.gz
fork-ledger-298a4faef371cae8f308c0b729a1a34ea7aa927c.tar.bz2
fork-ledger-298a4faef371cae8f308c0b729a1a34ea7aa927c.zip
Move amount colorization deeper into the core
This is necessary in order to redden negative amounts correctly under all circumstances, such as component amounts of a multi-commodity balance. Fixes 727B2DF8-A2A1-4716-9C15-547F20D5F933
Diffstat (limited to 'src/balance.cc')
-rw-r--r--src/balance.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/balance.cc b/src/balance.cc
index 864926cf..8acb6378 100644
--- a/src/balance.cc
+++ b/src/balance.cc
@@ -243,7 +243,8 @@ balance_t::strip_annotations(const keep_details_t& what_to_keep) const
void balance_t::print(std::ostream& out,
const int first_width,
const int latter_width,
- const bool right_justify) const
+ const bool right_justify,
+ const bool colorize) const
{
bool first = true;
int lwidth = latter_width;
@@ -272,7 +273,8 @@ void balance_t::print(std::ostream& out,
std::ostringstream buf;
buf << *amount;
- justify(out, buf.str(), width, right_justify);
+ justify(out, buf.str(), width, right_justify,
+ colorize && amount->sign() < 0);
}
if (first) {