summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-06-16 17:05:28 +0100
committerJohn Wiegley <johnw@newartisans.com>2009-06-16 17:05:28 +0100
commit94467e5b7f6b88580a443d494293acc044a17d54 (patch)
tree72374545ea0453d8926bde7341e34efa1bb896cb
parent298a4faef371cae8f308c0b729a1a34ea7aa927c (diff)
downloadfork-ledger-94467e5b7f6b88580a443d494293acc044a17d54.tar.gz
fork-ledger-94467e5b7f6b88580a443d494293acc044a17d54.tar.bz2
fork-ledger-94467e5b7f6b88580a443d494293acc044a17d54.zip
Fixed a problem with accounts and trailing spaces
This issue is caused by having a single space at the end of a posting that has neither an amount nor a note. Fixes C523E23F-CFAC-4A53-B0C6-21226640E763
-rw-r--r--src/textual.cc3
-rw-r--r--test/regress/C523E23F.test21
2 files changed, 24 insertions, 0 deletions
diff --git a/src/textual.cc b/src/textual.cc
index 5a47b75a..f2996a03 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -863,6 +863,9 @@ post_t * instance_t::parse_post(char * line,
char * next = next_element(p, true);
char * e = p + std::strlen(p);
+ while (e > p && std::isspace(*(e - 1)))
+ e--;
+
if ((*p == '[' && *(e - 1) == ']') || (*p == '(' && *(e - 1) == ')')) {
post->add_flags(POST_VIRTUAL);
DEBUG("textual.parse", "line " << linenum << ": "
diff --git a/test/regress/C523E23F.test b/test/regress/C523E23F.test
new file mode 100644
index 00000000..b8b08e00
--- /dev/null
+++ b/test/regress/C523E23F.test
@@ -0,0 +1,21 @@
+bal
+<<<
+D 1.000,00€
+
+2009/03/16 * denn's
+ ; Kauf: Yogi-Tee
+ Aufwand:Einkauf:Lebensmittel 17,94€
+ Aktiva:Bank:Girokonto
+
+2009/03/24 Ansparen
+ Aktiva:Bank:Sparkonto 800,00€
+ Aktiva:Bank:Girokonto
+>>>1
+ -17,94€ Aktiva:Bank
+ -817,94€ Girokonto
+ 800,00€ Sparkonto
+ 17,94€ Aufwand:Einkauf:Lebensmittel
+--------------------
+ 0
+>>>2
+=== 0