Skip to content

Commit

Permalink
patch 8.0.1829: MS-Windows: script for vimdiff can't handle ! chars
Browse files Browse the repository at this point in the history
Problem:    MS-Windows: script for vimdiff can't handle ! chars.
Solution:   Escape the ! chars. (Hans Ginzel, closes #2896)
  • Loading branch information
brammool committed May 13, 2018
1 parent e65fffd commit 12365ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dosinst.c
Expand Up @@ -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
Expand All @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -761,6 +761,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1829,
/**/
1828,
/**/
Expand Down

0 comments on commit 12365ce

Please sign in to comment.