From 17724b95220ecdc7e941a43b9dc5eaa152b7a29a Mon Sep 17 00:00:00 2001 From: mattn Date: Mon, 28 May 2012 17:24:00 +0900 Subject: [PATCH] fix begining of tokens. --- autoload/zencoding/html.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/autoload/zencoding/html.vim b/autoload/zencoding/html.vim index ebbd18d..e324ddc 100644 --- a/autoload/zencoding/html.vim +++ b/autoload/zencoding/html.vim @@ -7,16 +7,17 @@ let s:mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:_\! function! zencoding#html#findTokens(str) let str = a:str - let last_pos = 0 + let [pos, last_pos] = [0, 0] while len(str) > 0 - let token = matchstr(str, '\s'.s:mx) + let token = matchstr(str, s:mx, pos) if token == '' break endif if token =~ '^\s' - let last_pos = stridx(str, matchstr(token, '^\s*\zs.*')) + let token = matchstr(token, '^\s*\zs.*') + let last_pos = stridx(str, token) endif - let str = str[stridx(str, token) + len(token):] + let pos = stridx(str, token) + len(token) endwhile return a:str[last_pos :-1] endfunction