summaryrefslogtreecommitdiff
path: root/src/format.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-14 02:49:38 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-14 02:49:38 -0500
commit7a447912216e467a402e48be49f143f1b4be8261 (patch)
tree4b0c70b1a9cc71a77a304672ac45dbdeef9c8c52 /src/format.cc
parent2d58224001e502111812aaecbc56fdf618147bf8 (diff)
downloadfork-ledger-7a447912216e467a402e48be49f143f1b4be8261.tar.gz
fork-ledger-7a447912216e467a402e48be49f143f1b4be8261.tar.bz2
fork-ledger-7a447912216e467a402e48be49f143f1b4be8261.zip
Optimization in the formatting of string values
Diffstat (limited to 'src/format.cc')
-rw-r--r--src/format.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/format.cc b/src/format.cc
index e910ce3b..f26a86a1 100644
--- a/src/format.cc
+++ b/src/format.cc
@@ -355,8 +355,11 @@ string format_t::real_calc(scope_t& scope)
}
DEBUG("format.expr", "value = (" << value << ")");
- value.print(out, static_cast<int>(elem->min_width), -1,
- ! elem->has_flags(ELEMENT_ALIGN_LEFT));
+ if (elem->min_width > 0)
+ value.print(out, static_cast<int>(elem->min_width), -1,
+ ! elem->has_flags(ELEMENT_ALIGN_LEFT));
+ else
+ out << value.to_string();
}
catch (const calc_error&) {
add_error_context(_("While calculating format expression:"));