From 298a4faef371cae8f308c0b729a1a34ea7aa927c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 16 Jun 2009 16:57:10 +0100 Subject: 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 --- src/balance.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/balance.cc') 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) { -- cgit v1.2.3