Permalink
Browse files

patch 7.4.2356

Problem:    Reading past end of line when using previous substitute pattern.
            (Dominique Pelle)
Solution:   Don't set "pat" only set "searchstr".
  • Loading branch information...
1 parent 16b3578 commit ea683da58cf9ecf3afab9d650d3d2da76e5298d3 @brammool brammool committed Sep 9, 2016
Showing with 15 additions and 3 deletions.
  1. +2 −3 src/search.c
  2. +11 −0 src/testdir/test_search.vim
  3. +2 −0 src/version.c
View
@@ -1240,14 +1240,13 @@ do_search(
{
if (spats[RE_SEARCH].pat == NULL) /* no previous pattern */
{
- pat = spats[RE_SUBST].pat;
- if (pat == NULL)
+ searchstr = spats[RE_SUBST].pat;
+ if (searchstr == NULL)
{
EMSG(_(e_noprevre));
retval = 0;
goto end_do_search;
}
- searchstr = pat;
}
else
{
@@ -268,3 +268,14 @@ func Test_search_cmdline2()
call test_disable_char_avail(0)
bw!
endfunc
+
+func Test_use_sub_pat()
+ split
+ let @/ = ''
+ func X()
+ s/^/a/
+ /
+ endfunc
+ call X()
+ bwipe!
+endfunc
View
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2356,
+/**/
2355,
/**/
2354,

0 comments on commit ea683da

Please sign in to comment.