1
0
forked from aniani/vim

patch 8.0.1416: crash when searching for a sentence

Problem:    Crash when searching for a sentence.
Solution:   Return NUL when getting character at MAXCOL. (closes #2468)
This commit is contained in:
Bram Moolenaar
2017-12-19 21:23:21 +01:00
parent 4ce46c2a6b
commit 8ada6aa929
5 changed files with 33 additions and 14 deletions

View File

@@ -4521,13 +4521,14 @@ get_address(
if (lnum != MAXLNUM)
curwin->w_cursor.lnum = lnum;
/*
* Start a forward search at the end of the line.
* Start a forward search at the end of the line (unless
* before the first line).
* Start a backward search at the start of the line.
* This makes sure we never match in the current
* line, and can match anywhere in the
* next/previous line.
*/
if (c == '/')
if (c == '/' && curwin->w_cursor.lnum > 0)
curwin->w_cursor.col = MAXCOL;
else
curwin->w_cursor.col = 0;