From ed42a7ebfef0374fb19ae3ecf4fe1f317bb7fd37 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 12 Mar 2012 05:18:14 -0500 Subject: Allow payee names to contain multiple spaces --- src/textual.cc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/textual.cc') 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 { -- cgit v1.2.3