vim-patch:7.4.2356 (#6880)

Problem:    Reading past end of line when using previous substitute pattern.
            (Dominique Pelle)
Solution:   Don't set "pat" only set "searchstr".

ea683da58c
This commit is contained in:
Shougo
2017-06-19 08:13:32 +09:00
committed by Justin M. Keyes
parent 3a86dd54f3
commit 694eb18e03
4 changed files with 17 additions and 5 deletions

View File

@@ -1005,14 +1005,13 @@ int do_search(
dircp = NULL;
/* use previous pattern */
if (pat == NULL || *pat == NUL || *pat == dirc) {
if (spats[RE_SEARCH].pat == NULL) { /* no previous pattern */
pat = spats[RE_SUBST].pat;
if (pat == NULL) {
if (spats[RE_SEARCH].pat == NULL) { // no previous pattern
searchstr = spats[RE_SUBST].pat;
if (searchstr == NULL) {
EMSG(_(e_noprevre));
retval = 0;
goto end_do_search;
}
searchstr = pat;
} else {
/* make search_regcomp() use spats[RE_SEARCH].pat */
searchstr = (char_u *)"";