diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-02-03 15:14:46 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-02-03 15:14:46 +0100 |
commit | 4bfa8af14142e54f509048239f4e8596911f56aa (patch) | |
tree | 42d136ae2e49c5444802af12493c5c63c5197a28 /src/option.c | |
parent | 42b23fad1d9cdd6266f52d1ed7e0f3f17ce2d04b (diff) | |
download | vim-git-4bfa8af14142e54f509048239f4e8596911f56aa.tar.gz |
patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrectv8.0.1455
Problem: If $SHELL contains a space then the default value of 'shell' is
incorrect. (Matthew Horan)
Solution: Escape spaces in $SHELL. (Christian Brabandt, closes #459)
Diffstat (limited to 'src/option.c')
-rw-r--r-- | src/option.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/option.c b/src/option.c index ce5436996..4898e694c 100644 --- a/src/option.c +++ b/src/option.c @@ -3265,6 +3265,7 @@ static char *(p_scl_values[]) = {"yes", "no", "auto", NULL}; static void set_option_default(int, int opt_flags, int compatible); static void set_options_default(int opt_flags); +static void set_string_default_esc(char *name, char_u *val, int escape); static char_u *term_bg_default(void); static void did_set_option(int opt_idx, int opt_flags, int new_value); static char_u *illegal_char(char_u *, int); @@ -3371,7 +3372,7 @@ set_init_1(void) # endif #endif ) - set_string_default("sh", p); + set_string_default_esc("sh", p, TRUE); #ifdef FEAT_WILDIGN /* @@ -3859,14 +3860,18 @@ set_options_default( /* * Set the Vi-default value of a string option. * Used for 'sh', 'backupskip' and 'term'. + * When "escape" is TRUE escape spaces with a backslash. */ - void -set_string_default(char *name, char_u *val) + static void +set_string_default_esc(char *name, char_u *val, int escape) { char_u *p; int opt_idx; - p = vim_strsave(val); + if (escape && vim_strchr(val, ' ') != NULL) + p = vim_strsave_escaped(val, (char_u *)" "); + else + p = vim_strsave(val); if (p != NULL) /* we don't want a NULL */ { opt_idx = findoption((char_u *)name); @@ -3880,6 +3885,12 @@ set_string_default(char *name, char_u *val) } } + void +set_string_default(char *name, char_u *val) +{ + set_string_default_esc(name, val, FALSE); +} + /* * Set the Vi-default value of a number option. * Used for 'lines' and 'columns'. |