summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2013-09-08 20:00:48 +0200
committerBram Moolenaar <bram@vim.org>2013-09-08 20:00:48 +0200
commitd55b9c2de8473be49ebf7a9cbdb1e5162dc6d250 (patch)
treeedb2b1899186cb3e21b335bfd7f108b9a42f4cf1
parent8f9e416be4a92dc4ad616880b538f283feb07bb4 (diff)
downloadvim-d55b9c2de8473be49ebf7a9cbdb1e5162dc6d250.tar.gz
updated for version 7.4.027v7.4.027v7-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.
-rw-r--r--src/edit.c18
-rw-r--r--src/testdir/test32.in3
-rw-r--r--src/version.c2
3 files changed, 16 insertions, 7 deletions
diff --git a/src/edit.c b/src/edit.c
index b2b77872..d2f058a9 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -5183,15 +5183,19 @@ ins_complete(c)
}
else if (ctrl_x_mode == CTRL_X_FILES)
{
- char_u *p = line + startcol;
-
/* Go back to just before the first filename character. */
- mb_ptr_back(line, p);
- while (p > line && vim_isfilec(PTR2CHAR(p)))
+ if (startcol > 0)
+ {
+ char_u *p = line + startcol;
+
mb_ptr_back(line, p);
- startcol = (int)(p - line) + 1;
- if (p == line && vim_isfilec(PTR2CHAR(p)))
- startcol = 0;
+ while (p > line && vim_isfilec(PTR2CHAR(p)))
+ mb_ptr_back(line, p);
+ if (p == line && vim_isfilec(PTR2CHAR(p)))
+ startcol = 0;
+ else
+ startcol = (int)(p - line) + 1;
+ }
compl_col += startcol;
compl_length = (int)curs_col - startcol;
diff --git a/src/testdir/test32.in b/src/testdir/test32.in
index 97e5c8b8..6b399fa6 100644
--- a/src/testdir/test32.in
+++ b/src/testdir/test32.in
@@ -36,6 +36,9 @@ kOM
:w Xtest11.one
:w Xtest11.two
OIXA
+:" use CTRL-X CTRL-F to complete Xtest11.one, remove it and then use
+:" CTRL-X CTRL-F again to verify this doesn't cause trouble.
+OXddk
:se cpt=w
OST
:se cpt=u nohid
diff --git a/src/version.c b/src/version.c
index f875d013..ef3f9b1b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 27,
+/**/
26,
/**/
25,