diff options
author | Shougo <Shougo.Matsu@gmail.com> | 2017-06-19 08:13:32 +0900 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-06-19 01:13:32 +0200 |
commit | 694eb18e03a6a73321aafc19aa2f28104bdf3b8b (patch) | |
tree | efa225da5994010f0e9a74801cb295fdc5581931 | |
parent | 3a86dd54f3875d158d059dd08a1513b6957d6216 (diff) | |
download | rneovim-694eb18e03a6a73321aafc19aa2f28104bdf3b8b.tar.gz rneovim-694eb18e03a6a73321aafc19aa2f28104bdf3b8b.tar.bz2 rneovim-694eb18e03a6a73321aafc19aa2f28104bdf3b8b.zip |
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".
https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
-rw-r--r-- | src/nvim/search.c | 7 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_search.vim | 12 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
4 files changed, 17 insertions, 5 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index 61ef2e9ba3..1bf2317d2a 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -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 *)""; diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 3482001f63..7e55fffa06 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -58,6 +58,7 @@ NEW_TESTS ?= \ test_nested_function.res \ test_normal.res \ test_quickfix.res \ + test_search.res \ test_signs.res \ test_smartindent.res \ test_stat.res \ diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim new file mode 100644 index 0000000000..e85525e663 --- /dev/null +++ b/src/nvim/testdir/test_search.vim @@ -0,0 +1,12 @@ +" Test for the search command + +func Test_use_sub_pat() + split + let @/ = '' + func X() + s/^/a/ + / + endfunc + call X() + bwipe! +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index c8300e786e..a28dbcf061 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -88,7 +88,7 @@ static const int included_patches[] = { 2359, // 2358 NA 2357, - // 2356, + 2356, 2355, // 2354, 2353, |