]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.159 v7.4.159
authorBram Moolenaar <Bram@vim.org>
Thu, 23 Jan 2014 21:45:58 +0000 (22:45 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 23 Jan 2014 21:45:58 +0000 (22:45 +0100)
Problem:    Completion hangs when scanning the current buffer after doing
            keywords. (Christian Brabandt)
Solution:   Set the first match position when starting to scan the current
            buffer.

src/edit.c
src/version.c

index 0904af8576c4d54033a0c42ce0c0c72e722aaf09..29d8d3e65d0dcb0a00aae90a02df7c9242aeac27 100644 (file)
@@ -4180,6 +4180,7 @@ ins_compl_get_exp(ini)
     char_u     *dict = NULL;
     int                dict_f = 0;
     compl_T    *old_match;
+    int                set_match_pos;
 
     if (!compl_started)
     {
@@ -4198,6 +4199,7 @@ ins_compl_get_exp(ini)
     for (;;)
     {
        found_new_match = FAIL;
+       set_match_pos = FALSE;
 
        /* For ^N/^P pick a new entry from e_cpt if compl_started is off,
         * or if found_all says this entry is done.  For ^X^L only use the
@@ -4217,6 +4219,10 @@ ins_compl_get_exp(ini)
                    dec(&first_match_pos);
                last_match_pos = first_match_pos;
                type = 0;
+
+               /* Remember the first match so that the loop stops when we
+                * wrap and come back there a second time. */
+               set_match_pos = TRUE;
            }
            else if (vim_strchr((char_u *)"buwU", *e_cpt) != NULL
                 && (ins_buf = ins_compl_next_buf(ins_buf, *e_cpt)) != curbuf)
@@ -4381,7 +4387,7 @@ ins_compl_get_exp(ini)
            if (ins_buf->b_p_inf)
                p_scs = FALSE;
 
-           /*  buffers other than curbuf are scanned from the beginning or the
+           /*  Buffers other than curbuf are scanned from the beginning or the
             *  end but never from the middle, thus setting nowrapscan in this
             *  buffers is a good idea, on the other hand, we always set
             *  wrapscan for curbuf to avoid missing matches -- Acevedo,Webb */
@@ -4408,12 +4414,13 @@ ins_compl_get_exp(ini)
                                 compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG,
                                                  RE_LAST, (linenr_T)0, NULL);
                --msg_silent;
-               if (!compl_started)
+               if (!compl_started || set_match_pos)
                {
                    /* set "compl_started" even on fail */
                    compl_started = TRUE;
                    first_match_pos = *pos;
                    last_match_pos = *pos;
+                   set_match_pos = FALSE;
                }
                else if (first_match_pos.lnum == last_match_pos.lnum
                                 && first_match_pos.col == last_match_pos.col)
index 00e1ae6b101316cd39ae23dcf1d5ba5ae22e479c..e8bfd9ae959512cd40f5b389364d7d257e30f568 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    159,
 /**/
     158,
 /**/