aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuki446 <luki446@gmail.com>2023-11-11 22:32:08 +0100
committerzeertzjq <zeertzjq@outlook.com>2023-11-30 07:32:28 +0800
commit5ca6c9e04629fee4e9f1f9786e9d36a2f892160c (patch)
treee89ca8cf6f4aa7e8d9b6e51233d1ad7fabce0d57
parent65de1a22c4d94cd8591f90255bcde72e6b385e60 (diff)
downloadrneovim-5ca6c9e04629fee4e9f1f9786e9d36a2f892160c.tar.gz
rneovim-5ca6c9e04629fee4e9f1f9786e9d36a2f892160c.tar.bz2
rneovim-5ca6c9e04629fee4e9f1f9786e9d36a2f892160c.zip
fix(terminal): make backslashes in 'shell' work on Windows
If backslashes are used in 'shell' option, escape them to make Terminal mode work.
-rw-r--r--src/nvim/ex_docmd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 0b466bbe4e..245121f4af 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -7424,7 +7424,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++;
}