Skip to content

Commit

Permalink
Fix bug with component in-line
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewRadev committed Jul 17, 2019
1 parent 4467c80 commit f17f6ba
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions indent/handlebars.vim
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,15 @@ function! GetHandlebarsIndent(...)
endif

" check for a closing }}, indent according to the opening one
if prevLine =~# '}}$' && prevLine !~# '^\s*{{'
" Is it a block component?
let [line, col] = searchpos('{{#', 'Wbn')
if prevLine =~# '}}$' && prevLine !~# '^\s*{{' && search('}}$', 'Wb')
let [line, col] = searchpairpos('{{', '', '}}', 'Wb')
if line > 0
return (col - 1) + sw
endif

" Is it a single component?
let [line, col] = searchpos('{{', 'Wbn')
if line > 0
return (col - 1)
if strpart(getline(line), col - 1, 3) == '{{#'
" then it's a block component, indent a shiftwidth more
return indent(line) + sw
else
return indent(line)
endif
endif
endif

Expand Down

0 comments on commit f17f6ba

Please sign in to comment.