fix(terminal): make backslashes in 'shell' work on Windows

If backslashes are used in 'shell' option, escape them to make Terminal
mode work.
This commit is contained in:
Luki446 2023-11-11 22:32:08 +01:00 committed by zeertzjq
parent 22270ae8e9
commit 6a0d19229d

View File

@ -7296,7 +7296,9 @@ static void ex_terminal(exarg_T *eap)
char shell_argv[512] = { 0 };
while (*p != NULL) {
snprintf(tempstring, sizeof(tempstring), ",\"%s\"", *p);
char *escaped = vim_strsave_escaped(*p, "\"\\");
snprintf(tempstring, sizeof(tempstring), ",\"%s\"", escaped);
xfree(escaped);
xstrlcat(shell_argv, tempstring, sizeof(shell_argv));
p++;
}