summaryrefslogtreecommitdiffstats
path: root/src/edit.c
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
commitdd4073480011fe1cc58408a33963154fcb41673d (patch)
tree5674d007dc9b0826deb7735d762c6805bb0c7127 /src/edit.c
parent95235e64d8329b8c0fbd9311d98626afe86ad911 (diff)
updated for version 7.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.
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/edit.c b/src/edit.c
index b2b7787293..d2f058a985 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;