Fix account completion for virtual transactions

This commit is contained in:
Johann Klähn 2009-06-29 15:06:55 +02:00
parent 84e6a6e926
commit 396e1a5002

View file

@ -163,7 +163,10 @@ function! LedgerComplete(findstart, base) "{{{1
" only allow completion when in or at end of account name " only allow completion when in or at end of account name
return -1 return -1
endif endif
return matchend(line, '^\s\+') " the start of the first non-blank character
" (excluding virtual-transaction-marks)
" is the beginning of the account name
return matchend(line, '^\s\+[\[(]\?')
else "}}} else "}}}
return -1 return -1
endif endif
@ -218,6 +221,8 @@ function! LedgerGetAccountHierarchy() "{{{1
let hierarchy = {} let hierarchy = {}
let accounts = s:grep_buffer('^\s\+\zs[^[:blank:];]\%(\S \S\|\S\)\+\ze') let accounts = s:grep_buffer('^\s\+\zs[^[:blank:];]\%(\S \S\|\S\)\+\ze')
for name in accounts for name in accounts
" remove virtual-transaction-marks
let name = substitute(name, '\%(^\s*[\[(]\?\|[\])]\?\s*$\)', '', 'g')
let last = hierarchy let last = hierarchy
for part in split(name, ':') for part in split(name, ':')
let last[part] = get(last, part, {}) let last[part] = get(last, part, {})