From e0fa560e6f77181969c16333f357c168eff16fd4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 19 Mar 2006 22:08:37 +0000 Subject: updated for version 7.0229 --- runtime/autoload/htmlcomplete.vim | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/runtime/autoload/htmlcomplete.vim b/runtime/autoload/htmlcomplete.vim index cbe5792c3..759d1267c 100644 --- a/runtime/autoload/htmlcomplete.vim +++ b/runtime/autoload/htmlcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: XHTML 1.0 Strict " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2006 Mar 5 +" Last Change: 2006 Mar 19 function! htmlcomplete#CompleteTags(findstart, base) if a:findstart @@ -87,17 +87,25 @@ function! htmlcomplete#CompleteTags(findstart, base) let context_lines = getline(curline-i, curline) let b:compl_context = join(context_lines, ' ') break - elseif context_line =~ '>[^<]*$' - " Normal tag line, no need for completion at all + elseif context_line =~ '>[^<]*$' || i == curline + " We are in normal tag line, no need for completion at all + " OR reached first line without tag at all let b:compl_context = '' break endif let i += 1 + " We reached first line and no tag approached + " Prevents endless loop + "if i > curline + "let b:compl_context = '' + "break + "endif endwhile " Make sure we don't have counter unlet! i endif let b:compl_context = matchstr(b:compl_context, '.*\zs<.*') + " Return proper start for on-events. Without that beginning of " completion will be badly reported if b:compl_context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$' @@ -106,6 +114,15 @@ function! htmlcomplete#CompleteTags(findstart, base) let start -= 1 endwhile endif + " If b:compl_context begins with = 0 && line[start - 1] =~ '[a-zA-Z_0-9\x7f-\xff$]' + let start -= 1 + endwhile + endif else let b:compl_context = getline('.')[0:compl_begin] endif @@ -117,7 +134,8 @@ function! htmlcomplete#CompleteTags(findstart, base) " a:base is very short - we need context let context = b:compl_context " Check if we should do CSS completion inside of