summaryrefslogtreecommitdiffstats
path: root/src/search.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-07-25 13:46:30 +0200
committerBram Moolenaar <Bram@vim.org>2012-07-25 13:46:30 +0200
commit058bdcfd5d7f2fd0945e3cb9c84cab514cd95fb9 (patch)
treec09d1ad28734ca463710860980bb9f92638bdae2 /src/search.c
parent6763c140d656703814d9a268c8492762aee69469 (diff)
updated for version 7.3.609v7.3.609
Problem: File names in :checkpath! output are garbled. Solution: Check for \zs in the pattern. (Lech Lorens)
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/search.c b/src/search.c
index e231a3a10e..9f9f0c1c21 100644
--- a/src/search.c
+++ b/src/search.c
@@ -4740,17 +4740,33 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments,
* Isolate the file name.
* Include the surrounding "" or <> if present.
*/
- for (p = incl_regmatch.endp[0]; !vim_isfilec(*p); p++)
- ;
- for (i = 0; vim_isfilec(p[i]); i++)
- ;
+ if (inc_opt != NULL
+ && strstr((char *)inc_opt, "\\zs") != NULL)
+ {
+ /* pattern contains \zs, use the match */
+ p = incl_regmatch.startp[0];
+ i = (int)(incl_regmatch.endp[0]
+ - incl_regmatch.startp[0]);
+ }
+ else
+ {
+ /* find the file name after the end of the match */
+ for (p = incl_regmatch.endp[0];
+ *p && !vim_isfilec(*p); p++)
+ ;
+ for (i = 0; vim_isfilec(p[i]); i++)
+ ;
+ }
+
if (i == 0)
{
/* Nothing found, use the rest of the line. */
p = incl_regmatch.endp[0];
i = (int)STRLEN(p);
}
- else
+ /* Avoid checking before the start of the line, can
+ * happen if \zs appears in the regexp. */
+ else if (p > line)
{
if (p[-1] == '"' || p[-1] == '<')
{