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 vim/vim#2468)
8ada6aa929
This commit is contained in:
Jan Edmund Lazo
2018-09-16 20:28:05 -04:00
parent 9f1401e25c
commit 91352b36b7
4 changed files with 20 additions and 11 deletions

View File

@@ -3665,13 +3665,14 @@ static linenr_T get_address(exarg_T *eap,
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;