summaryrefslogtreecommitdiffstats
path: root/src/dosinst.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-05-13 14:45:25 +0200
committerBram Moolenaar <Bram@vim.org>2018-05-13 14:45:25 +0200
commit12365ce49f671a62a1e647df205c9a020828ee1b (patch)
tree315611122d2069811c84a38a8d1a494eec0dc78a /src/dosinst.c
parente65fffd9b4f02539d8c2717b36a09d0e3250e220 (diff)
patch 8.0.1829: MS-Windows: script for vimdiff can't handle ! charsv8.0.1829
Problem: MS-Windows: script for vimdiff can't handle ! chars. Solution: Escape the ! chars. (Hans Ginzel, closes #2896)
Diffstat (limited to 'src/dosinst.c')
-rw-r--r--src/dosinst.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dosinst.c b/src/dosinst.c
index ae5517da94..e5d1f75fd3 100644
--- a/src/dosinst.c
+++ b/src/dosinst.c
@@ -1197,13 +1197,17 @@ install_vimrc(int idx)
fprintf(fd, " let opt = '-a --binary '\n");
fprintf(fd, " if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif\n");
fprintf(fd, " if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif\n");
- /* Use quotes only when needed, they may cause trouble. */
+ /* Use quotes only when needed, they may cause trouble.
+ * Always escape "!". */
fprintf(fd, " let arg1 = v:fname_in\n");
fprintf(fd, " if arg1 =~ ' ' | let arg1 = '\"' . arg1 . '\"' | endif\n");
+ fprintf(fd, " let arg1 = substitute(arg1, '!', '\\!', 'g')\n");
fprintf(fd, " let arg2 = v:fname_new\n");
fprintf(fd, " if arg2 =~ ' ' | let arg2 = '\"' . arg2 . '\"' | endif\n");
+ fprintf(fd, " let arg2 = substitute(arg2, '!', '\\!', 'g')\n");
fprintf(fd, " let arg3 = v:fname_out\n");
fprintf(fd, " if arg3 =~ ' ' | let arg3 = '\"' . arg3 . '\"' | endif\n");
+ fprintf(fd, " let arg3 = substitute(arg3, '!', '\\!', 'g')\n");
/* If the path has a space: When using cmd.exe (Win NT/2000/XP) put
* quotes around the diff command and rely on the default value of
@@ -1225,6 +1229,7 @@ install_vimrc(int idx)
fprintf(fd, " else\n");
fprintf(fd, " let cmd = $VIMRUNTIME . '\\diff'\n");
fprintf(fd, " endif\n");
+ fprintf(fd, " let cmd = substitute(cmd, '!', '\\!', 'g')\n");
fprintf(fd, " silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3\n");
fprintf(fd, " if exists('l:shxq_sav')\n");
fprintf(fd, " let &shellxquote=l:shxq_sav\n");