mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 19:24:27 +08:00
fix balance inward.
This commit is contained in:
@@ -358,7 +358,6 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
|||||||
let str .= "\n" . indent
|
let str .= "\n" . indent
|
||||||
let dr = 1
|
let dr = 1
|
||||||
elseif current.multiplier == 1 && nc == 1 && len(child.name) == 0
|
elseif current.multiplier == 1 && nc == 1 && len(child.name) == 0
|
||||||
echo current.multiplier
|
|
||||||
let str .= "\n" . indent
|
let str .= "\n" . indent
|
||||||
let dr = 1
|
let dr = 1
|
||||||
endif
|
endif
|
||||||
@@ -536,9 +535,9 @@ function! zencoding#lang#html#balanceTag(flag) range
|
|||||||
endif
|
endif
|
||||||
let settings = zencoding#getSettings()
|
let settings = zencoding#getSettings()
|
||||||
|
|
||||||
if a:flag > 0
|
if a:flag > 0 || abs(a:flag) == 1
|
||||||
while 1
|
|
||||||
let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
||||||
|
while 1
|
||||||
let pos1 = searchpos(mx, 'bW')
|
let pos1 = searchpos(mx, 'bW')
|
||||||
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||||
let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze')
|
let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze')
|
||||||
@@ -557,9 +556,18 @@ function! zencoding#lang#html#balanceTag(flag) range
|
|||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
else
|
else
|
||||||
while 1
|
|
||||||
let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
||||||
|
while 1
|
||||||
let pos1 = searchpos(mx, 'W')
|
let pos1 = searchpos(mx, 'W')
|
||||||
|
if pos1 == curpos[1:2]
|
||||||
|
let pos1 = searchpos(mx . '\zs', 'W')
|
||||||
|
let pos2 = searchpos('.\ze<', 'W')
|
||||||
|
let block = [pos1, pos2]
|
||||||
|
if zencoding#util#regionIsValid(block)
|
||||||
|
call zencoding#util#selectRegion(block)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endif
|
||||||
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||||
let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze')
|
let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze')
|
||||||
if stridx(','.settings.html.empty_elements.',', ','.tag_name.',') != -1
|
if stridx(','.settings.html.empty_elements.',', ','.tag_name.',') != -1
|
||||||
|
|||||||
Reference in New Issue
Block a user