Created
April 20, 2017 16:20
-
-
Save chrisbra/2ab6f18365c6e7d4f291c6a0a49b82f2 to your computer and use it in GitHub Desktop.
Vim issue #1590
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt | |
index 83bc8f379..884f4501c 100644 | |
--- a/runtime/doc/eval.txt | |
+++ b/runtime/doc/eval.txt | |
@@ -7092,9 +7092,9 @@ shellescape({string} [, {special}]) *shellescape()* | |
{special}) when 'shell' contains "csh" in the tail. That is | |
because for csh and tcsh "!" is used for history replacement | |
even when inside single quotes. | |
- The <NL> character is also escaped. With a |non-zero-arg| | |
- {special} and 'shell' containing "csh" in the tail it's | |
- escaped a second time. | |
+ The <NL> character is also escaped when {special} is set. | |
+ With a |non-zero-arg| {special} and 'shell' containing "csh" in | |
+ the tail it's escaped a second time. | |
Example of use with a |:!| command: > | |
:exe '!dir ' . shellescape(expand('<cfile>'), 1) | |
< This results in a directory listing for the file under the | |
diff --git a/src/evalfunc.c b/src/evalfunc.c | |
index 45c43f685..e1986e6c4 100644 | |
--- a/src/evalfunc.c | |
+++ b/src/evalfunc.c | |
@@ -10473,8 +10473,10 @@ f_sha256(typval_T *argvars, typval_T *rettv) | |
static void | |
f_shellescape(typval_T *argvars, typval_T *rettv) | |
{ | |
+ int do_special = non_zero_arg(&argvars[1]); | |
+ | |
rettv->vval.v_string = vim_strsave_shellescape( | |
- get_tv_string(&argvars[0]), non_zero_arg(&argvars[1]), TRUE); | |
+ get_tv_string(&argvars[0]), do_special, do_special); | |
rettv->v_type = VAR_STRING; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current behavior is the other way around for when 'shell' is "csh".
Thus the code should check for that.