fix behavour to toggle.

This commit is contained in:
mattn
2012-06-05 01:15:02 +09:00
parent b8ba003728
commit 843e99c883

View File

@@ -202,24 +202,29 @@ function! zencoding#lang#haml#splitJoinTag()
while n > 0 while n > 0
if getline(n) =~ '^\s*\ze%[a-z]' if getline(n) =~ '^\s*\ze%[a-z]'
let line = getline(n) let line = getline(n)
call setline(n, matchstr(line, '^\s*%\w\+\s*{[^}]*}')) call setline(n, substitute(line, '^\s*%\w\+\%(\s*{[^}]*}\|\s\)\zs.*', '', ''))
let sn = n let sn = n
let n += 1 let n += 1
let ml = len(matchstr(getline(n), '^\s*%[a-z]')) let ml = len(matchstr(getline(n), '^\s*%[a-z]'))
if getline(n) =~ '^\s*|' if len(matchstr(getline(n), '^\s*')) > ml
while n < line('$') while n <= line('$')
let l = len(matchstr(getline(n), '^\s*')) let l = len(matchstr(getline(n), '^\s*'))
if l <= ml if l <= ml
break break
endif endif
exe n "delete" exe n "delete"
let n += 1
endwhile endwhile
call setpos('.', [0, sn, 1, 0]) call setpos('.', [0, sn, 1, 0])
else else
let tag = matchstr(getline(sn), '^\s*%\zs\(\w\+\)')
let spaces = matchstr(getline(sn), '^\s*') let spaces = matchstr(getline(sn), '^\s*')
call append(sn, spaces . ' | ') let settings = zencoding#getSettings()
call setpos('.', [0, sn+1, 1, 0]) if stridx(','.settings.html.inline_elements.',', ','.tag.',') == -1
call append(sn, spaces . ' ')
call setpos('.', [0, sn+1, 1, 0])
else
call setpos('.', [0, sn, 1, 0])
endif
startinsert! startinsert!
endif endif
break break