]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.4.636 v7.4.636
authorBram Moolenaar <Bram@vim.org>
Tue, 17 Feb 2015 14:43:57 +0000 (15:43 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 17 Feb 2015 14:43:57 +0000 (15:43 +0100)
Problem:    A search with end offset gets stuck at end of file. (Gary Johnson)
Solution:   When a search doesn't move the cursor repeat it with a higher
            count. (Christian Brabandt)

src/normal.c
src/testdir/test44.in
src/testdir/test44.ok
src/version.c

index 74a001e82395e776a5fa8538c115754743f8ea87..86d4504a917bf5c56be1129b4a39d360f5f87b38 100644 (file)
@@ -100,7 +100,7 @@ static void nv_end __ARGS((cmdarg_T *cap));
 static void    nv_dollar __ARGS((cmdarg_T *cap));
 static void    nv_search __ARGS((cmdarg_T *cap));
 static void    nv_next __ARGS((cmdarg_T *cap));
-static void    normal_search __ARGS((cmdarg_T *cap, int dir, char_u *pat, int opt));
+static int     normal_search __ARGS((cmdarg_T *cap, int dir, char_u *pat, int opt));
 static void    nv_csearch __ARGS((cmdarg_T *cap));
 static void    nv_brackets __ARGS((cmdarg_T *cap));
 static void    nv_percent __ARGS((cmdarg_T *cap));
@@ -5765,7 +5765,7 @@ nv_ident(cap)
        init_history();
        add_to_history(HIST_SEARCH, buf, TRUE, NUL);
 #endif
-       normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0);
+       (void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0);
     }
     else
        do_cmdline_cmd(buf);
@@ -6301,7 +6301,7 @@ nv_search(cap)
        return;
     }
 
-    normal_search(cap, cap->cmdchar, cap->searchbuf,
+    (void)normal_search(cap, cap->cmdchar, cap->searchbuf,
                                                (cap->arg ? 0 : SEARCH_MARK));
 }
 
@@ -6313,14 +6313,26 @@ nv_search(cap)
 nv_next(cap)
     cmdarg_T   *cap;
 {
-    normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg);
+    pos_T old = curwin->w_cursor;
+    int   i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg);
+
+    if (i == 1 && equalpos(old, curwin->w_cursor))
+    {
+       /* Avoid getting stuck on the current cursor position, which can
+        * happen when an offset is given and the cursor is on the last char
+        * in the buffer: Repeat with count + 1. */
+       cap->count1 += 1;
+       (void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg);
+       cap->count1 -= 1;
+    }
 }
 
 /*
  * Search for "pat" in direction "dir" ('/' or '?', 0 for repeat).
  * Uses only cap->count1 and cap->oap from "cap".
+ * Return 0 for failure, 1 for found, 2 for found and line offset added.
  */
-    static void
+    static int
 normal_search(cap, dir, pat, opt)
     cmdarg_T   *cap;
     int                dir;
@@ -6354,6 +6366,7 @@ normal_search(cap, dir, pat, opt)
     /* "/$" will put the cursor after the end of the line, may need to
      * correct that here */
     check_cursor();
+    return i;
 }
 
 /*
index 87de1b95a4d9a821c5f4b481fabf174aff501f6f..69fbb9434e9f4e40ad4a151e1aafe3ebde5947ab 100644 (file)
@@ -42,6 +42,12 @@ G:put =matchstr(\"אבגד\", \".\", 0, 2) " ב
 :put =matchstr(\"אבגד\", \"..\", 0, 2) " בג
 :put =matchstr(\"אבגד\", \".\", 0, 0) " א
 :put =matchstr(\"אבגד\", \".\", 4, -1) " ג
+:new
+:$put =['dog(a', 'cat(']
+/(/e+
+"ayn:bd!
+:$put =''
+G"ap
 :w!
 :qa!
 ENDTEST
index 0bd0b8ab7341ca9d34a028111fc33250054eb53c..d9a1206cc2ab47b3a53a73206a5a33b8d32007c4 100644 (file)
@@ -22,3 +22,5 @@ k œ̄ṣ́m̥̄ᾱ̆́
 בג
 א
 ג
+a
+cat(
index 0c2004116edabbeb13de9496ae2aea49b2b85916..226386ac5dac84a49c74dbc94139029d554b550d 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    636,
 /**/
     635,
 /**/