Skip to content

Commit be9645d

Browse files
committed
updated for version 7.4.027
Problem: Another valgrind error when using CTRL-X CTRL-F at the start of the line. (Dominique Pelle) Solution: Don't call mb_ptr_back() at the start of the line. Add a test.
1 parent 155cd7f commit be9645d

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/edit.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5183,15 +5183,19 @@ ins_complete(c)
51835183
}
51845184
else if (ctrl_x_mode == CTRL_X_FILES)
51855185
{
5186-
char_u *p = line + startcol;
5187-
51885186
/* Go back to just before the first filename character. */
5189-
mb_ptr_back(line, p);
5190-
while (p > line && vim_isfilec(PTR2CHAR(p)))
5187+
if (startcol > 0)
5188+
{
5189+
char_u *p = line + startcol;
5190+
51915191
mb_ptr_back(line, p);
5192-
startcol = (int)(p - line) + 1;
5193-
if (p == line && vim_isfilec(PTR2CHAR(p)))
5194-
startcol = 0;
5192+
while (p > line && vim_isfilec(PTR2CHAR(p)))
5193+
mb_ptr_back(line, p);
5194+
if (p == line && vim_isfilec(PTR2CHAR(p)))
5195+
startcol = 0;
5196+
else
5197+
startcol = (int)(p - line) + 1;
5198+
}
51955199

51965200
compl_col += startcol;
51975201
compl_length = (int)curs_col - startcol;

src/testdir/test32.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ kOM
3636
:w Xtest11.one
3737
:w Xtest11.two
3838
OIXA
39+
:" use CTRL-X CTRL-F to complete Xtest11.one, remove it and then use
40+
:" CTRL-X CTRL-F again to verify this doesn't cause trouble.
41+
OXddk
3942
:se cpt=w
4043
OST
4144
:se cpt=u nohid

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
27,
741743
/**/
742744
26,
743745
/**/

0 commit comments

Comments
 (0)