summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJohann Klähn <kljohann@gmail.com>2010-09-15 20:03:27 +0200
committerJohann Klähn <kljohann@gmail.com>2010-09-15 20:03:27 +0200
commit453327a1806d728668ffa190ea67f5d693e30362 (patch)
tree37a25cb0d074bd30fcb5fc3a4fce45dd036bbdde /contrib
parentc2384b60465ac48ac9bdd77871c611ebeeb7795b (diff)
downloadfork-ledger-453327a1806d728668ffa190ea67f5d693e30362.tar.gz
fork-ledger-453327a1806d728668ffa190ea67f5d693e30362.tar.bz2
fork-ledger-453327a1806d728668ffa190ea67f5d693e30362.zip
vim. fix issue with description in from_lnum()
Thanks to Chad Voegele, see mailing list ledger-cli@googlegroups.com: Whenever I had a transaction such as 2010/09/10 * castle bar, nyc (beer) the transaction.from_lnum function would recognize (beer) as the code for the transaction which is incorrect since it comes at the end of the line. Message ID: 73e397f4-234e-46fe-87e5-45f86f934bf1@k30g2000vbn.googlegroups.com
Diffstat (limited to 'contrib')
-rw-r--r--contrib/vim/ftplugin/ledger.vim7
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/vim/ftplugin/ledger.vim b/contrib/vim/ftplugin/ledger.vim
index 7c2c1d73..326c6c72 100644
--- a/contrib/vim/ftplugin/ledger.vim
+++ b/contrib/vim/ftplugin/ledger.vim
@@ -302,7 +302,6 @@ function! s:transaction.from_lnum(lnum) dict "{{{2
return {}
endif
- let description = []
for part in parts
if ! has_key(trans, 'date') && part =~ '^\d'
let trans['date'] = part
@@ -312,10 +311,12 @@ function! s:transaction.from_lnum(lnum) dict "{{{2
" the first character by itself is assumed to be the state of the transaction.
let trans['state'] = part
else
- call add(description, part)
+ " everything after date/code or state belongs to the description
+ break
endif
+ call remove(parts, 0)
endfor
- let trans['description'] = join(description)
+ let trans['description'] = join(parts)
return trans
endf "}}}