Mercurial > vim
changeset 641:6a944e0bd5d2
updated for version 7.0186
author | vimboss |
---|---|
date | Mon, 23 Jan 2006 22:23:09 +0000 |
parents | 8a5a95f7ef2a |
children | 2392a6da4aa4 |
files | runtime/autoload/htmlcomplete.vim src/getchar.c src/normal.c |
diffstat | 3 files changed, 46 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- 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: 2005 Now 20 +" Last Change: 2006 Jan 22 function! htmlcomplete#CompleteTags(findstart, base) if a:findstart @@ -31,7 +31,7 @@ function! htmlcomplete#CompleteTags(find endif if !exists("b:csscompl") let b:compl_context = getline('.')[0:(compl_begin)] - let b:compl_context = matchstr(b:compl_context, '.*<\zs.*') + let b:compl_context = matchstr(b:compl_context, '.*\zs<.*') else let b:compl_context = getline('.')[0:compl_begin] endif @@ -42,12 +42,18 @@ function! htmlcomplete#CompleteTags(find let res2 = [] " a:base is very short - we need context let context = b:compl_context - unlet! b:compl_context " Check if we should do CSS completion inside of <style> tag if exists("b:csscompl") unlet! b:csscompl + let context = b:compl_context return csscomplete#CompleteCSS(0, context) + else + if len(b:compl_context) == 0 && !exists("b:entitiescompl") + return [] + endif + let context = matchstr(b:compl_context, '.\zs.*') endif + unlet! b:compl_context " Make entities completion if exists("b:entitiescompl") unlet! b:entitiescompl @@ -58,13 +64,25 @@ function! htmlcomplete#CompleteTags(find let entities = g:xmldata_xhtml10s['vimxmlentities'] - for m in entities - if m =~ '^'.a:base - call add(res, m.';') - endif - endfor + if len(a:base) == 1 + for m in entities + if m =~ '^'.a:base + call add(res, m.';') + endif + endfor + return res + else + for m in entities + if m =~? '^'.a:base + call add(res, m.';') + elseif m =~? a:base + call add(res2, m.';') + endif + endfor - return res + return res + res2 + endif + endif if context =~ '>' @@ -76,6 +94,7 @@ function! htmlcomplete#CompleteTags(find return [] endif endif + "if context !~ '<$' " Set attribute groups let coreattrs = ["id", "class", "style", "title"] @@ -456,6 +475,13 @@ function! htmlcomplete#CompleteTags(find endif " Deal with tag completion. let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack") + if opentag == '' + " Hack for sometimes failing GetLastOpenTag. + " As far as I tested fail isn't GLOT fault but problem + " of invalid document - not properly closed tags and other mish-mash. + " If returns empty string assume <body>. Safe bet. + let opentag = 'body' + endif if !exists("g:xmldata_xhtml10s") runtime! autoload/xml/xhtml10s.vim
--- a/src/getchar.c +++ b/src/getchar.c @@ -2365,7 +2365,7 @@ vgetorpeek(advance) colnr_T col = 0, vcol; char_u *ptr; - if (p_smd) + if (p_smd && msg_silent == 0) { unshowmode(TRUE); mode_deleted = TRUE; @@ -2641,7 +2641,7 @@ vgetorpeek(advance) * if we return an ESC to exit insert mode, the message is deleted * if we don't return an ESC but deleted the message before, redisplay it */ - if (advance && p_smd && (State & INSERT)) + if (advance && p_smd && msg_silent == 0 && (State & INSERT)) { if (c == ESC && !mode_deleted && !no_mapping) {
--- a/src/normal.c +++ b/src/normal.c @@ -1165,6 +1165,7 @@ getcount: * Don't redraw the screen, it would remove the message. */ if ( ((p_smd + && msg_silent == 0 && (restart_edit != 0 #ifdef FEAT_VISUAL || (VIsual_active @@ -1713,7 +1714,7 @@ do_pending_operator(cap, old_col, gui_ya setmouse(); mouse_dragging = 0; # endif - if (p_smd) + if (p_smd && msg_silent == 0) clear_cmdline = TRUE; /* unshow visual mode later */ #ifdef FEAT_CMDL_INFO else @@ -2947,7 +2948,8 @@ do_mouse(oap, c, dir, count, fixindent) } /* If Visual mode changed show it later. */ - if (p_smd && (VIsual_active != old_active || VIsual_mode != old_mode)) + if (p_smd && msg_silent == 0 + && (VIsual_active != old_active || VIsual_mode != old_mode)) redraw_cmdline = TRUE; #endif @@ -3113,7 +3115,7 @@ end_visual_mode() curwin->w_cursor.coladd = 0; #endif - if (p_smd) + if (p_smd && msg_silent == 0) clear_cmdline = TRUE; /* unshow visual mode later */ #ifdef FEAT_CMDL_INFO else @@ -3644,7 +3646,7 @@ add_to_showcmd(c) }; #endif - if (!p_sc) + if (!p_sc || msg_silent != 0) return FALSE; if (showcmd_visual) @@ -7138,7 +7140,7 @@ nv_visual(cap) #ifdef FEAT_MOUSE setmouse(); #endif - if (p_smd) + if (p_smd && msg_silent == 0) redraw_cmdline = TRUE; /* show visual mode later */ /* * For V and ^V, we multiply the number of lines even if there @@ -7235,7 +7237,7 @@ n_start_visual_mode(c) #ifdef FEAT_MOUSE setmouse(); #endif - if (p_smd) + if (p_smd && msg_silent == 0) redraw_cmdline = TRUE; /* show visual mode later */ #ifdef FEAT_CLIPBOARD /* Make sure the clipboard gets updated. Needed because start and @@ -8280,7 +8282,7 @@ nv_normal(cap) if (cap->nchar == Ctrl_N || cap->nchar == Ctrl_G) { clearop(cap->oap); - if (restart_edit != 0 && p_smd) + if (restart_edit != 0 && p_smd && msg_silent == 0) clear_cmdline = TRUE; /* unshow mode later */ restart_edit = 0; #ifdef FEAT_CMDWIN