Fix hang-up while split/join tag

This commit is contained in:
Yasuhiro Matsumoto
2019-06-19 00:46:33 +09:00
parent d02023cd7a
commit 50b44d90c9
2 changed files with 9 additions and 1 deletions

View File

@@ -386,6 +386,9 @@ function! emmet#getFileType(...) abort
if type == 'htmlTagName' if type == 'htmlTagName'
let type = '' let type = ''
endif endif
if type =~ '^mkdSnippet'
let type = tolower(type[10:])
endif
if type =~? '^css' if type =~? '^css'
let type = 'css' let type = 'css'

View File

@@ -894,8 +894,9 @@ endfunction
function! emmet#lang#html#splitJoinTag() abort function! emmet#lang#html#splitJoinTag() abort
let curpos = emmet#util#getcurpos() let curpos = emmet#util#getcurpos()
let mx = '<\(/\{0,1}[a-zA-Z][-a-zA-Z0-9:_\-]*\)\%(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|"[^"]\{-}"\|''[^'']\{-}''\)\s*\)*\)\s*\%(/\{0,1}\)>'
while 1 while 1
let mx = '<\(/\{0,1}[a-zA-Z][-a-zA-Z0-9:_\-]*\)\%(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|"[^"]\{-}"\|''[^'']\{-}''\)\s*\)*\)\%(/\{0,1}\)>' let old = getpos('.')[1:2]
let pos1 = searchpos(mx, 'bcnW') let pos1 = searchpos(mx, 'bcnW')
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx) let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\).*$', '\1', '') let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\).*$', '\1', '')
@@ -927,6 +928,10 @@ function! emmet#lang#html#splitJoinTag() abort
call setpos('.', curpos) call setpos('.', curpos)
return return
endif endif
if pos1 == old
call setpos('.', curpos)
return
endif
endif endif
endif endif
endwhile endwhile