changeset 11991:15ec6d5adf43 v8.0.0876

patch 8.0.0876: backslashes and wildcards in backticks don't work commit https://github.com/vim/vim/commit/39d21e3c30f3391f3b27f5ddb7e1ad411bdb8f2e Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 5 23:09:31 2017 +0200 patch 8.0.0876: backslashes and wildcards in backticks don't work Problem: MS-Windows: Backslashes and wildcards in backticks don't work. Solution: Do not handle backslashes inside backticks in the wrong place. (Yasuhiro Matsumoto, closes #1942)
author Christian Brabandt <cb@256bit.org>
date Sat, 05 Aug 2017 23:15:04 +0200
parents 402d24fae651
children e5c731391a9f
files src/os_mswin.c src/os_win32.c src/version.c
diffstat 3 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -450,6 +450,15 @@ slash_adjust(char_u *p)
 {
     if (path_with_url(p))
 	return;
+
+    if (*p == '`')
+    {
+	/* don't replace backslash in backtick quoted strings */
+	int len = STRLEN(p);
+	if (len > 2 && *(p + len - 1) == '`')
+	    return;
+    }
+
     while (*p)
     {
 	if (*p == psepcN)
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -7004,6 +7004,8 @@ fix_arg_enc(void)
 	str = utf16_to_enc(ArglistW[idx], NULL);
 	if (str != NULL)
 	{
+	    int literal = used_file_literal;
+
 #ifdef FEAT_DIFF
 	    /* When using diff mode may need to concatenate file name to
 	     * directory name.  Just like it's done in main(). */
@@ -7025,7 +7027,15 @@ fix_arg_enc(void)
 	    if (used_file_literal)
 		buf_set_name(fnum_list[i], str);
 
-	    alist_add(&global_alist, str, used_file_literal ? 2 : 0);
+	    /* Check backtick literal. backtick literal is already expanded in
+	     * main.c, so this part add str as literal. */
+	    if (literal == FALSE)
+	    {
+		int len = STRLEN(str);
+		if (len > 2 && *str == '`' && *(str + len - 1) == '`')
+		    literal = TRUE;
+	    }
+	    alist_add(&global_alist, str, literal ? 2 : 0);
 	}
     }
 
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    876,
+/**/
     875,
 /**/
     874,