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]