forked from aniani/vim
patch 7.4.2360
Problem: Invalid memory access when formatting. (Dominique Pelle) Solution: Make sure cursor line and column are associated.
This commit is contained in:
@@ -6097,7 +6097,7 @@ cin_isterminated(
|
|||||||
* When a line ends in a comma we continue looking in the next line.
|
* When a line ends in a comma we continue looking in the next line.
|
||||||
* "sp" points to a string with the line. When looking at other lines it must
|
* "sp" points to a string with the line. When looking at other lines it must
|
||||||
* be restored to the line. When it's NULL fetch lines here.
|
* be restored to the line. When it's NULL fetch lines here.
|
||||||
* "lnum" is where we start looking.
|
* "first_lnum" is where we start looking.
|
||||||
* "min_lnum" is the line before which we will not be looking.
|
* "min_lnum" is the line before which we will not be looking.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
@@ -6108,6 +6108,7 @@ cin_isfuncdecl(
|
|||||||
{
|
{
|
||||||
char_u *s;
|
char_u *s;
|
||||||
linenr_T lnum = first_lnum;
|
linenr_T lnum = first_lnum;
|
||||||
|
linenr_T save_lnum = curwin->w_cursor.lnum;
|
||||||
int retval = FALSE;
|
int retval = FALSE;
|
||||||
pos_T *trypos;
|
pos_T *trypos;
|
||||||
int just_started = TRUE;
|
int just_started = TRUE;
|
||||||
@@ -6117,15 +6118,20 @@ cin_isfuncdecl(
|
|||||||
else
|
else
|
||||||
s = *sp;
|
s = *sp;
|
||||||
|
|
||||||
|
curwin->w_cursor.lnum = lnum;
|
||||||
if (find_last_paren(s, '(', ')')
|
if (find_last_paren(s, '(', ')')
|
||||||
&& (trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL)
|
&& (trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL)
|
||||||
{
|
{
|
||||||
lnum = trypos->lnum;
|
lnum = trypos->lnum;
|
||||||
if (lnum < min_lnum)
|
if (lnum < min_lnum)
|
||||||
|
{
|
||||||
|
curwin->w_cursor.lnum = save_lnum;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
s = ml_get(lnum);
|
s = ml_get(lnum);
|
||||||
}
|
}
|
||||||
|
curwin->w_cursor.lnum = save_lnum;
|
||||||
|
|
||||||
/* Ignore line starting with #. */
|
/* Ignore line starting with #. */
|
||||||
if (cin_ispreproc(s))
|
if (cin_ispreproc(s))
|
||||||
|
@@ -763,6 +763,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2360,
|
||||||
/**/
|
/**/
|
||||||
2359,
|
2359,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user