summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-31 15:42:40 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-31 15:42:40 -0400
commit90404e85fa222bf11a8d338a659c1395d82c4c31 (patch)
treed8d7f2333b563053ad9d39a83f1da751effd743e /src
parent1ece3f8b1ce67197844084009fd0ac022b266450 (diff)
downloadfork-ledger-90404e85fa222bf11a8d338a659c1395d82c4c31.tar.gz
fork-ledger-90404e85fa222bf11a8d338a659c1395d82c4c31.tar.bz2
fork-ledger-90404e85fa222bf11a8d338a659c1395d82c4c31.zip
Corrected the way that thousands markers are output.
Diffstat (limited to 'src')
-rw-r--r--src/amount.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/amount.cc b/src/amount.cc
index f0266b36..6f945002 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -580,7 +580,7 @@ namespace {
for (const char * p = buf; *p; p++) {
if (*p == '.')
break;
- else if (std::isdigit(*p))
+ else if (*p != '-')
integer_digits++;
}
}
@@ -591,16 +591,20 @@ namespace {
out << ',';
else
out << *p;
- assert(integer_digits < 3);
- } else {
- if (integer_digits >= 3 && std::isdigit(*p) &&
- integer_digits-- % 3 == 0) {
+ assert(integer_digits <= 3);
+ }
+ else if (*p == '-') {
+ out << *p;
+ }
+ else {
+ out << *p;
+
+ if (integer_digits > 3 && --integer_digits % 3 == 0) {
if (comm && comm->has_flags(COMMODITY_STYLE_EUROPEAN))
out << '.';
else
out << ',';
}
- out << *p;
}
}
} else {