summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ldg-post.el2
-rw-r--r--src/format.cc12
-rw-r--r--test/baseline/opt-payee-as-account.test4
-rw-r--r--test/regress/6E041C52.test8
4 files changed, 22 insertions, 4 deletions
diff --git a/lisp/ldg-post.el b/lisp/ldg-post.el
index da4a2806..05b9d352 100644
--- a/lisp/ldg-post.el
+++ b/lisp/ldg-post.el
@@ -4,7 +4,7 @@
""
:group 'ledger)
-(defcustom ledger-post-auto-adjust-amounts t
+(defcustom ledger-post-auto-adjust-amounts nil
"If non-nil, ."
:type 'boolean
:group 'ledger-post)
diff --git a/src/format.cc b/src/format.cc
index 79f94869..8c3cbc14 100644
--- a/src/format.cc
+++ b/src/format.cc
@@ -599,6 +599,7 @@ string format_t::truncate(const unistring& ustr,
index = 0;
#endif
std::size_t counter = lens.size();
+ std::list<string>::iterator x = parts.begin();
for (std::list<std::size_t>::iterator i = lens.begin();
i != lens.end();
i++) {
@@ -628,12 +629,21 @@ string format_t::truncate(const unistring& ustr,
if (adjust > 0) {
DEBUG("format.abbrev",
"Reducing segment " << ++index << " by " << adjust << " chars");
+ while (std::isspace((*x)[*i - adjust - 1]) && adjust < *i) {
+ DEBUG("format.abbrev",
+ "Segment ends in whitespace, adjusting down");
+ ++adjust;
+ }
(*i) -= adjust;
DEBUG("format.abbrev",
"Segment " << index << " is now " << *i << " chars wide");
- overflow -= adjust;
+ if (adjust > overflow)
+ overflow = 0;
+ else
+ overflow -= adjust;
DEBUG("format.abbrev", "Overflow is now " << overflow << " chars");
}
+ ++x;
}
DEBUG("format.abbrev",
"Overflow ending this time at " << overflow << " chars");
diff --git a/test/baseline/opt-payee-as-account.test b/test/baseline/opt-payee-as-account.test
index 113a395b..0d1f87d6 100644
--- a/test/baseline/opt-payee-as-account.test
+++ b/test/baseline/opt-payee-as-account.test
@@ -21,11 +21,11 @@
test reg --account=payee
08-Jan-01 January January:Expenses:Books $10.00 $10.00
08-Jan-01 January January:Assets:Cash $-10.00 0
-08-Jan-31 End of January End of :Expenses:Books $10.00 $10.00
+08-Jan-31 End of January End of:Expenses:Books $10.00 $10.00
08-Jan-31 End of January End of Jan:Assets:Cash $-10.00 0
08-Feb-01 February Februar:Expenses:Books $20.00 $20.00
08-Feb-01 February February:Assets:Cash $-20.00 0
-08-Feb-28 End of February End of :Expenses:Books $20.00 $20.00
+08-Feb-28 End of February End of:Expenses:Books $20.00 $20.00
08-Feb-28 End of February End of Feb:Assets:Cash $-20.00 0
08-Mar-01 March March:Expenses:Books $30.00 $30.00
08-Mar-01 March March:Assets:Cash $-30.00 0
diff --git a/test/regress/6E041C52.test b/test/regress/6E041C52.test
new file mode 100644
index 00000000..0a56dd70
--- /dev/null
+++ b/test/regress/6E041C52.test
@@ -0,0 +1,8 @@
+2012-03-16 KFC
+ Expenses:E of March: End of April $100.00
+ Assets:Cash
+
+test reg
+12-Mar-16 KFC Ex:E of: End of April $100.00 $100.00
+ Assets:Cash $-100.00 0
+end test