diff options
-rw-r--r-- | src/ex_docmd.c | 6 | ||||
-rw-r--r-- | src/testdir/test_search.vim | 14 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 2c55e67bc..08a48305e 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -4229,8 +4229,10 @@ get_address( // When '/' or '?' follows another address, start from // there. - if (lnum != MAXLNUM) - curwin->w_cursor.lnum = lnum; + if (lnum > 0 && lnum != MAXLNUM) + curwin->w_cursor.lnum = + lnum > curbuf->b_ml.ml_line_count + ? curbuf->b_ml.ml_line_count : lnum; // Start a forward search at the end of the line (unless // before the first line). diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim index bb4e45def..eaf9c2326 100644 --- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -1989,5 +1989,19 @@ func Test_no_last_search_pattern() call feedkeys("??\<C-T>", 'xt') endfunc +func Test_search_with_invalid_range() + new + let lines =<< trim END + /\%.v + 5/ + c + END + call writefile(lines, 'Xrangesearch') + source Xrangesearch + + bwipe! + call delete('Xrangesearch') +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index f3fbd45bc..43f87aabe 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3489, +/**/ 3488, /**/ 3487, |