aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-10-17 12:48:48 -0400
committerGitHub <noreply@github.com>2017-10-17 12:48:48 -0400
commit0f0fcce1ab5736fb0d34c1f6e86456cd605cfa52 (patch)
tree8acafa07288dbcc2087e5c4b5caaeba7ca465093 /src/nvim/option.c
parent2f4647e77b7e8271aad1b45eb07fbabed78d9fe6 (diff)
parent7d3f302ef97fc1bb0b6c6b65950a6825ea740cd5 (diff)
downloadrneovim-0f0fcce1ab5736fb0d34c1f6e86456cd605cfa52.tar.gz
rneovim-0f0fcce1ab5736fb0d34c1f6e86456cd605cfa52.tar.bz2
rneovim-0f0fcce1ab5736fb0d34c1f6e86456cd605cfa52.zip
Merge pull request #7313 from ckelsel/vim-8.0.0101
vim-patch:8.0.0101,8.0.0102,8.0.0104,8.0.0106
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 13aadb71bb..f6f334f432 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -242,6 +242,7 @@ typedef struct vimoption {
#define P_NO_DEF_EXP 0x8000000U ///< Do not expand default value.
#define P_RWINONLY 0x10000000U ///< only redraw current window
+#define P_NDNAME 0x20000000U ///< only normal dir name chars allowed
#define HIGHLIGHT_INIT \
"8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText," \
@@ -2454,11 +2455,14 @@ did_set_string_option (
if ((secure || sandbox != 0)
&& (options[opt_idx].flags & P_SECURE)) {
errmsg = e_secure;
- } else if ((options[opt_idx].flags & P_NFNAME)
- && vim_strpbrk(*varp, (char_u *)"/\\*?[|;&<>\r\n") != NULL) {
- // Check for a "normal" file name in some options. Disallow a path
- // separator (slash and/or backslash), wildcards and characters that are
- // often illegal in a file name.
+ } else if (((options[opt_idx].flags & P_NFNAME)
+ && vim_strpbrk(*varp, (char_u *)(secure ? "/\\*?[|;&<>\r\n"
+ : "/\\*?[<>\r\n")) != NULL)
+ || ((options[opt_idx].flags & P_NDNAME)
+ && vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL)) {
+ // Check for a "normal" directory or file name in some options. Disallow a
+ // path separator (slash and/or backslash), wildcards and characters that
+ // are often illegal in a file name. Be more permissive if "secure" is off.
errmsg = e_invarg;
}
/* 'backupcopy' */
@@ -3173,17 +3177,18 @@ did_set_string_option (
} else {
// Options that are a list of flags.
p = NULL;
- if (varp == &p_ww)
+ if (varp == &p_ww) { // 'whichwrap'
p = (char_u *)WW_ALL;
- if (varp == &p_shm)
+ }
+ if (varp == &p_shm) { // 'shortmess'
p = (char_u *)SHM_ALL;
- else if (varp == &(p_cpo))
+ } else if (varp == &(p_cpo)) { // 'cpoptions'
p = (char_u *)CPO_VI;
- else if (varp == &(curbuf->b_p_fo))
+ } else if (varp == &(curbuf->b_p_fo)) { // 'formatoptions'
p = (char_u *)FO_ALL;
- else if (varp == &curwin->w_p_cocu)
+ } else if (varp == &curwin->w_p_cocu) { // 'concealcursor'
p = (char_u *)COCU_ALL;
- else if (varp == &p_mouse) {
+ } else if (varp == &p_mouse) { // 'mouse'
p = (char_u *)MOUSE_ALL;
}
if (p != NULL) {