]> granicus.if.org Git - vim/commitdiff
updated for version 7.0186
authorBram Moolenaar <Bram@vim.org>
Mon, 23 Jan 2006 22:23:09 +0000 (22:23 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 23 Jan 2006 22:23:09 +0000 (22:23 +0000)
runtime/autoload/htmlcomplete.vim
src/getchar.c
src/normal.c

index 806eb52447ca1ac3b184e52be7077bee0ac4860b..768afd5725a0af8750b81e5b6b65c6f31549926b 100644 (file)
@@ -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
index c1c9bca75149fc43e9ddb83e3de09391fdad70c3..5da7537ff0a17b876f25f40004cfd00baf890cd8 100644 (file)
@@ -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)
        {
index 310a6f054bc3dff37ae87a8d5fc77eeec2de48c0..4d105e731d96401cf70a56fc7ae58701ae93068b 100644 (file)
@@ -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