fix finding begining of token

closes #428
This commit is contained in:
Yasuhiro Matsumoto
2018-07-19 01:02:57 +09:00
parent dcf8f6efd8
commit 3fb134b503
2 changed files with 16 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
let s:bx = '{\%("[^"]*"\|''[^'']*''\|\$#\|\${\w\+}\|\$\+\|{[^{]\+\|[^{}]\)\{-}}'
let s:mx = '\([+>]\|[<^]\+\)\{-}\s*'
\ .'\((*\)\{-}\s*'
let s:mx = '\([+>]\|[<^]\+\)\{-}'
\ .'\((*\)\{-}'
\ .'\([@#.]\{-}[a-zA-Z_\!][a-zA-Z0-9:_\!\-$]*\|' . s:bx . '\|\[[^\]]\+\]\)'
\ .'\('
\ .'\%('
@@ -32,14 +32,15 @@ function! emmet#lang#html#findTokens(str) abort
endwhile
let last_pos = pos
while len(str) > 0
let white = matchstr(str, '^\s\+', pos)
if white != ''
let last_pos = pos + len(white)
let pos = last_pos
endif
let token = matchstr(str, s:mx, pos)
if token ==# ''
break
endif
if token =~# '^\s'
let token = matchstr(token, '^\s*\zs.*')
let last_pos = stridx(str, token, pos)
endif
let pos = stridx(str, token, pos) + len(token)
endwhile
let str = a:str[last_pos :-1]

View File

@@ -122,6 +122,7 @@ function! s:test(...)
if stridx(query, '$$$$') != -1
silent! 1new
silent! exe 'setlocal ft='.testgroup.type
EmmetInstall
silent! let key = matchstr(query, '.*\$\$\$\$\zs.*\ze\$\$\$\$')
if len(key) > 0
exe printf('let key = "%s"', key)
@@ -193,6 +194,9 @@ function! s:do_tests(bang, ...)
if exists('s:old_user_emmet_settings')
let g:user_emmet_settings = s:old_user_emmet_settings
endif
if exists('s:old_user_emmet_install_global')
let g:user_emmet_install_global = s:old_user_emmet_install_global
endif
endtry
endfunction
@@ -841,7 +845,7 @@ finish
],
},
{
'name': 'expand abbreviation',
'name': 'split join',
'tests': [
{
'query': "%a foo\n bar$$$$\\<c-y>j$$$$",