Mercurial > vim
diff src/os_unix.c @ 12343:72046661f6d0 v8.0.1051
patch 8.0.1051: cannot run terminal with spaces in argument
commit https://github.com/vim/vim/commit/9d654a8d8cd3421307445f111785fb303a38c2a0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 3 19:52:17 2017 +0200
patch 8.0.1051: cannot run terminal with spaces in argument
Problem: Cannot run terminal with spaces in argument.
Solution: Accept backslash to escape space and other characters. (closes
#1999)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 03 Sep 2017 20:00:04 +0200 |
parents | 50b0b3aaa545 |
children | d7f087d1b0e5 |
line wrap: on
line diff
--- a/src/os_unix.c +++ b/src/os_unix.c @@ -4094,8 +4094,17 @@ mch_parse_cmd(char_u *cmd, int use_shcf, ++*argc; while (*p != NUL && (inquote || (*p != ' ' && *p != TAB))) { - if (*p == '"') + if (p[0] == '"') inquote = !inquote; + else if (p[0] == '\\' && p[1] != NUL) + { + /* First pass: skip over "\ " and "\"". + * Second pass: Remove the backslash. */ + if (i == 1) + mch_memmove(p, p + 1, STRLEN(p)); + else + ++p; + } ++p; } if (*p == NUL)