summaryrefslogtreecommitdiff
path: root/format.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-04-15 19:36:47 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:07 -0400
commitd79b1b6a48dfaf2cfe28336029baf660f6bf951d (patch)
tree8dd916735763566f961978f957048d263ad1c51f /format.cc
parent72d14a0bb394822ac5cbc3e64b031649d7ad9baa (diff)
downloadfork-ledger-d79b1b6a48dfaf2cfe28336029baf660f6bf951d.tar.gz
fork-ledger-d79b1b6a48dfaf2cfe28336029baf660f6bf951d.tar.bz2
fork-ledger-d79b1b6a48dfaf2cfe28336029baf660f6bf951d.zip
(format): [1178223] Don't truncate to max_width in the case of
outputting balances.
Diffstat (limited to 'format.cc')
-rw-r--r--format.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/format.cc b/format.cc
index 2e437cfd..bfe20998 100644
--- a/format.cc
+++ b/format.cc
@@ -248,6 +248,7 @@ void format_t::format(std::ostream& out_str, const details_t& details) const
{
for (const element_t * elem = elements; elem; elem = elem->next) {
std::ostringstream out;
+ bool ignore_max_width = false;
if (elem->align_left)
out << std::left;
@@ -302,6 +303,7 @@ void format_t::format(std::ostream& out_str, const details_t& details) const
bal->write(out, elem->min_width,
(elem->max_width > 0 ? elem->max_width : elem->min_width));
+ ignore_max_width = true;
break;
default:
assert(0);
@@ -492,7 +494,8 @@ void format_t::format(std::ostream& out_str, const details_t& details) const
}
std::string temp = out.str();
- if (elem->max_width > 0 && elem->max_width < temp.length())
+ if (! ignore_max_width &&
+ elem->max_width > 0 && elem->max_width < temp.length())
temp.erase(elem->max_width);
out_str << temp;
}