mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 03:04:27 +08:00
Fix split/join tag
This commit is contained in:
@@ -910,18 +910,21 @@ 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
|
||||||
else
|
endif
|
||||||
if block[0][0] > 0
|
if block[0][0] > 0
|
||||||
call setpos('.', [0, block[0][0]-1, block[0][1], 0])
|
call setpos('.', [0, block[0][0]-1, block[0][1], 0])
|
||||||
else
|
else
|
||||||
@@ -933,7 +936,6 @@ function! emmet#lang#html#splitJoinTag() abort
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
endwhile
|
endwhile
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user