summaryrefslogtreecommitdiff
path: root/textual.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-02-16 21:10:50 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:24 -0400
commitf43370cae5d9297487fedeefa427d42ab869df48 (patch)
tree247b3e1f9628fd62e19f0758d8f7265308b1d8e2 /textual.cc
parentb0414258467a1216f69dc01ae7a7ad8af2751b8b (diff)
downloadfork-ledger-f43370cae5d9297487fedeefa427d42ab869df48.tar.gz
fork-ledger-f43370cae5d9297487fedeefa427d42ab869df48.tar.bz2
fork-ledger-f43370cae5d9297487fedeefa427d42ab869df48.zip
Transactions now track their beginning and ending position, as do
entries. The new format strings %xB %xE %xb %xe can be used to display those values relative to a transaction. The Emacs module now relies on this support to exactly determine where a transaction is, rather than the Elisp logic it relied on previously.
Diffstat (limited to 'textual.cc')
-rw-r--r--textual.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/textual.cc b/textual.cc
index fe2185d6..8b4775a5 100644
--- a/textual.cc
+++ b/textual.cc
@@ -384,6 +384,9 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
TIMER_START(entry_xacts);
while (! in.eof() && (in.peek() == ' ' || in.peek() == '\t')) {
+ istream_pos_type beg_pos = in.tellg();
+ unsigned long beg_line = linenum;
+
line[0] = '\0';
in.getline(line, MAX_LINE);
if (in.eof() && line[0] == '\0')
@@ -400,6 +403,12 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
if (state != transaction_t::UNCLEARED &&
xact->state == transaction_t::UNCLEARED)
xact->state = state;
+
+ xact->beg_pos = beg_pos;
+ xact->beg_line = beg_line;
+ xact->end_pos = in.tellg();
+ xact->end_line = linenum;
+
curr->add_transaction(xact);
}