Fix account completion for virtual transactions
This commit is contained in:
parent
84e6a6e926
commit
396e1a5002
1 changed files with 6 additions and 1 deletions
|
|
@ -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, {})
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue