summaryrefslogtreecommitdiff
path: root/src/item.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-03-01 05:40:44 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-03-01 05:40:44 -0400
commitad424474758b9fbb501c84e9a63a2eaf17e81c85 (patch)
tree843d524799e68ec50512d784e605fee1f3e45392 /src/item.cc
parent9a23b73491a49496db3ae7e9c002016d700359d5 (diff)
downloadfork-ledger-ad424474758b9fbb501c84e9a63a2eaf17e81c85.tar.gz
fork-ledger-ad424474758b9fbb501c84e9a63a2eaf17e81c85.tar.bz2
fork-ledger-ad424474758b9fbb501c84e9a63a2eaf17e81c85.zip
Changed how comments are output to be more logical
Diffstat (limited to 'src/item.cc')
-rw-r--r--src/item.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/item.cc b/src/item.cc
index 4fcaea21..426a2f1c 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -158,11 +158,12 @@ void item_t::parse_tags(const char * p, int current_year)
void item_t::append_note(const char * p, int current_year)
{
- if (note)
+ if (note) {
+ *note += '\n';
*note += p;
- else
+ } else {
note = p;
- *note += '\n';
+ }
parse_tags(p, current_year);
}
@@ -251,15 +252,17 @@ namespace {
value_t get_comment(item_t& item)
{
if (! item.note) {
- return false;
+ return string_value("");
} else {
+ // jww (2009-03-01): If the comment is a short one-liner, put it at the
+ // end of the post/xact
std::ostringstream buf;
buf << "\n ;";
bool need_separator = false;
for (const char * p = item.note->c_str(); *p; p++) {
- if (*p == '\n')
+ if (*p == '\n') {
need_separator = true;
- else {
+ } else {
if (need_separator) {
buf << "\n ;";
need_separator = false;