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/unistring.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/unistring.h') diff --git a/src/unistring.h b/src/unistring.h index b3086c39..5467a151 100644 --- a/src/unistring.h +++ b/src/unistring.h @@ -99,10 +99,14 @@ public: inline void justify(std::ostream& out, const std::string& str, int width, - bool right = false) + bool right = false, + bool redden = false) { - if (! right) + if (! right) { + if (redden) out << "\e[31m"; out << str; + if (redden) out << "\e[0m"; + } unistring temp(str); @@ -110,8 +114,11 @@ inline void justify(std::ostream& out, while (spacing-- > 0) out << ' '; - if (right) + if (right) { + if (redden) out << "\e[31m"; out << str; + if (redden) out << "\e[0m"; + } } } // namespace ledger -- cgit v1.2.3