diff options
author | Florian Walch <florian@fwalch.com> | 2015-02-17 19:04:22 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-02-22 14:55:58 -0500 |
commit | 0df6b9168e9dc09d3e0ae6050d67b7c31c603782 (patch) | |
tree | ad816b4aca549d99793626a10099fee6e0e6d343 /src | |
parent | 3e292316846708dfc1153d55fbd5f012c2da8a35 (diff) | |
download | rneovim-0df6b9168e9dc09d3e0ae6050d67b7c31c603782.tar.gz rneovim-0df6b9168e9dc09d3e0ae6050d67b7c31c603782.tar.bz2 rneovim-0df6b9168e9dc09d3e0ae6050d67b7c31c603782.zip |
Simpler handling for "always-on"/"always-off" options. #2002
'compatible' and 'edcompatible' are forced to be off.
'ttyfast' is forced to be on.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/option.c | 19 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 3 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 5435a1adeb..6cd195cdad 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -558,7 +558,7 @@ static vimoption_T /* P_PRI_MKRC isn't needed here, optval_default() * always returns TRUE for 'compatible' */ {"compatible", "cp", P_BOOL|P_RALL, - (char_u *)&p_cp, PV_NONE, + (char_u *)&p_force_off, PV_NONE, {(char_u *)TRUE, (char_u *)FALSE} SCRIPTID_INIT}, {"complete", "cpt", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, (char_u *)&p_cpt, PV_CPT, @@ -660,7 +660,7 @@ static vimoption_T {(char_u *)"both", (char_u *)0L} SCRIPTID_INIT}, {"edcompatible","ed", P_BOOL|P_VI_DEF, - (char_u *)&p_ed, PV_NONE, + (char_u *)&p_force_off, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR|P_NO_ML, (char_u *)&p_enc, PV_NONE, @@ -1576,6 +1576,9 @@ static vimoption_T {"ttimeoutlen", "ttm", P_NUM|P_VI_DEF, (char_u *)&p_ttm, PV_NONE, {(char_u *)-1L, (char_u *)0L} SCRIPTID_INIT}, + {"ttyfast", "tf", P_BOOL|P_NO_MKRC|P_VI_DEF, + (char_u *)&p_force_on, PV_NONE, + {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, {"ttymouse", "ttym", P_STRING|P_NODEFAULT|P_NO_MKRC|P_VI_DEF, #if defined(FEAT_MOUSE) && defined(UNIX) (char_u *)&p_ttym, PV_NONE, @@ -4709,14 +4712,14 @@ set_bool_option ( if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = value; - // Ensure that compatible can not be enabled - if ((int *)varp == &p_cp && p_cp == TRUE) { - p_cp = FALSE; + // Ensure that options set to p_force_on cannot be disabled. + if ((int *)varp == &p_force_on && p_force_on == FALSE) { + p_force_on = TRUE; return e_unsupportedoption; } - // Ensure that edcompatible can not be enabled - else if ((int *)varp == &p_ed && p_ed == TRUE) { - p_ed = FALSE; + // Ensure that options set to p_force_off cannot be enabled. + else if ((int *)varp == &p_force_off && p_force_off == TRUE) { + p_force_off = FALSE; return e_unsupportedoption; } /* 'undofile' */ diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index c75137f765..1db5a0b51c 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -630,6 +630,9 @@ EXTERN int p_wa; /* 'writeany' */ EXTERN int p_wb; /* 'writebackup' */ EXTERN long p_wd; /* 'writedelay' */ +EXTERN int p_force_on; ///< options that cannot be turned off. +EXTERN int p_force_off; ///< options that cannot be turned on. + /* * "indir" values for buffer-local opions. * These need to be defined globally, so that the BV_COUNT can be used with |