diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-12 05:18:14 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-12 05:48:10 -0500 |
commit | ed42a7ebfef0374fb19ae3ecf4fe1f317bb7fd37 (patch) | |
tree | 0752923f782a5f0f2ebe93f35385dd7280750ebd /src/textual.cc | |
parent | fb2e80406fb61eb79a474fc683839c3536e55fb2 (diff) | |
download | fork-ledger-ed42a7ebfef0374fb19ae3ecf4fe1f317bb7fd37.tar.gz fork-ledger-ed42a7ebfef0374fb19ae3ecf4fe1f317bb7fd37.tar.bz2 fork-ledger-ed42a7ebfef0374fb19ae3ecf4fe1f317bb7fd37.zip |
Allow payee names to contain multiple spaces
Diffstat (limited to 'src/textual.cc')
-rw-r--r-- | src/textual.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/textual.cc b/src/textual.cc index 362bed4d..ab87a945 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -1732,7 +1732,30 @@ xact_t * instance_t::parse_xact(char * line, // Parse the description text if (next && *next) { - char * p = next_element(next, true); + char * p = next; + std::size_t spaces = 0; + std::size_t tabs = 0; + while (*p) { + if (*p == ' ') { + ++spaces; + } + else if (*p == '\t') { + ++tabs; + } + else if (*p == ';' && (tabs > 0 || spaces > 1)) { + char *q = p - 1; + while (q > next && std::isspace(*q)) + --q; + if (q > next) + *(q + 1) = '\0'; + break; + } + else { + spaces = 0; + tabs = 0; + } + ++p; + } xact->payee = context.journal->register_payee(next, xact.get()); next = p; } else { |