diff options
author | vimboss <devnull@localhost> | 2006-01-23 22:23:09 +0000 |
---|---|---|
committer | vimboss <devnull@localhost> | 2006-01-23 22:23:09 +0000 |
commit | 21a641f55d8a3652e1849839042e526f11c81c39 (patch) | |
tree | 752b65fa5bce149cf43f81dc228204c2be88dc30 | |
parent | 7a7e6572e146adb383e0b1b817f67f27cc8761cb (diff) | |
download | vim-21a641f55d8a3652e1849839042e526f11c81c39.tar.gz |
updated for version 7.0186
-rw-r--r-- | runtime/autoload/htmlcomplete.vim | 44 | ||||
-rw-r--r-- | src/getchar.c | 4 | ||||
-rw-r--r-- | src/normal.c | 16 |
3 files changed, 46 insertions, 18 deletions
diff --git a/runtime/autoload/htmlcomplete.vim b/runtime/autoload/htmlcomplete.vim index 806eb524..768afd57 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: 2005 Now 20 +" Last Change: 2006 Jan 22 function! htmlcomplete#CompleteTags(findstart, base) if a:findstart @@ -31,7 +31,7 @@ function! htmlcomplete#CompleteTags(findstart, base) 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(findstart, base) 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(findstart, base) 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 + res2 + endif - return res endif if context =~ '>' @@ -76,6 +94,7 @@ function! htmlcomplete#CompleteTags(findstart, base) return [] endif endif + "if context !~ '<$' " Set attribute groups let coreattrs = ["id", "class", "style", "title"] @@ -456,6 +475,13 @@ function! htmlcomplete#CompleteTags(findstart, base) 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 diff --git a/src/getchar.c b/src/getchar.c index c1c9bca7..5da7537f 100644 --- 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) { diff --git a/src/normal.c b/src/normal.c index 310a6f05..4d105e73 100644 --- 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_yank) 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 |