diff options
author | John Wiegley <johnw@newartisans.com> | 2009-06-16 16:57:10 +0100 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-06-16 16:57:10 +0100 |
commit | 298a4faef371cae8f308c0b729a1a34ea7aa927c (patch) | |
tree | 277f3125c4e03f7c80c8187c6165a66286131a9b /src/unistring.h | |
parent | 995c94ef178d143c2458ebf66ddb084aa782e975 (diff) | |
download | fork-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/unistring.h')
-rw-r--r-- | src/unistring.h | 13 |
1 files changed, 10 insertions, 3 deletions
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 |