forked from VimPlug/emmet-vim
Fix split/join tag
This commit is contained in:
@@ -910,28 +910,30 @@ function! emmet#lang#html#splitJoinTag() abort
|
|||||||
if tag_name[0] ==# '/'
|
if tag_name[0] ==# '/'
|
||||||
let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW')
|
let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW')
|
||||||
call setpos('.', [0, pos1[0], pos1[1], 0])
|
call setpos('.', [0, pos1[0], pos1[1], 0])
|
||||||
let pos2 = searchpos('</' . tag_name[1:] . '>', 'cneW')
|
let pos2 = searchpairpos('<'. tag_name[1:] . '\>[^>]*>', '', '</' . tag_name[1:] . '>', 'W')
|
||||||
else
|
else
|
||||||
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
let pos2 = searchpairpos('<'. tag_name . '[^>]*>', '', '</' . tag_name . '>', 'W')
|
||||||
endif
|
endif
|
||||||
|
if pos2 == [0, 0]
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let pos2 = searchpos('>', 'neW')
|
||||||
let block = [pos1, pos2]
|
let block = [pos1, pos2]
|
||||||
let content = emmet#util#getContent(block)
|
if emmet#util#pointInRegion(curpos[1:2], block)
|
||||||
if emmet#util#pointInRegion(curpos[1:2], block) && content[1:] !~# '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
|
||||||
let content = matchstr(content, mx)[:-2] . ' />'
|
let content = matchstr(content, mx)[:-2] . ' />'
|
||||||
call emmet#util#setContent(block, content)
|
call emmet#util#setContent(block, content)
|
||||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||||
return
|
return
|
||||||
|
endif
|
||||||
|
if block[0][0] > 0
|
||||||
|
call setpos('.', [0, block[0][0]-1, block[0][1], 0])
|
||||||
else
|
else
|
||||||
if block[0][0] > 0
|
call setpos('.', curpos)
|
||||||
call setpos('.', [0, block[0][0]-1, block[0][1], 0])
|
return
|
||||||
else
|
endif
|
||||||
call setpos('.', curpos)
|
if pos1 == old
|
||||||
return
|
call setpos('.', curpos)
|
||||||
endif
|
return
|
||||||
if pos1 == old
|
|
||||||
call setpos('.', curpos)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
|
|||||||
Reference in New Issue
Block a user