aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhuoyun Wei2017-09-12 07:39:28 -0400
committerZhuoyun Wei2017-09-12 07:39:28 -0400
commit914ae985fb05c4c7f6d8e652bbc53a2de12542df (patch)
treeea8733aba4f3a383ddff2491b78fdc5c7fb3e8d4
parent8e86516961817c22da4a75ebb89de23da5038a7c (diff)
downloadvim-beancount-914ae985fb05c4c7f6d8e652bbc53a2de12542df.tar.gz
Fix a regression bug in AlignCommodity
Since commit e17eb3d, putting a plus sign before a number causes :AlignCommodity to behaviour incorrectly. A reproducible example: Assets:Cash -100.00 USD Expenses:Food +100.00 USD This commit fixes the regression bug.
-rw-r--r--autoload/beancount.vim2
1 files changed, 1 insertions, 1 deletions
diff --git a/autoload/beancount.vim b/autoload/beancount.vim
index 81067a3..c5d8f97 100644
--- a/autoload/beancount.vim
+++ b/autoload/beancount.vim
@@ -39,7 +39,7 @@ function! beancount#align_commodity(line1, line2) abort
" Look for a minus sign and a number (possibly containing commas) and
" align on the next column.
- let l:separator = matchend(l:line, '^\v(-)?[,[:digit:]]+', l:begin_number) + 1
+ let l:separator = matchend(l:line, '^\v([-+])?[,[:digit:]]+', l:begin_number) + 1
if l:separator < 0 | continue | endif
let l:has_spaces = l:begin_number - l:end_account
let l:need_spaces = g:beancount_separator_col - l:separator + l:has_spaces