mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
refactor(options): swap immutable
and hidden
option property names
Ref: https://github.com/neovim/neovim/pull/28018#issuecomment-2021622120
This commit is contained in:
parent
635fa2c51c
commit
63f7b1f31e
@ -3481,11 +3481,11 @@ static const char *did_set_option(OptIndex opt_idx, void *varp, OptVal old_value
|
||||
.os_win = curwin
|
||||
};
|
||||
|
||||
if (direct || opt->immutable) {
|
||||
// Don't do any extra processing if setting directly or if option is immutable.
|
||||
if (direct || opt->hidden) {
|
||||
// Don't do any extra processing if setting directly or if option is hidden.
|
||||
}
|
||||
// Disallow changing hidden options.
|
||||
else if (opt->hidden && !optval_equal(old_value, new_value)) {
|
||||
// Disallow changing immutable options.
|
||||
else if (opt->immutable && !optval_equal(old_value, new_value)) {
|
||||
errmsg = e_unsupportedoption;
|
||||
}
|
||||
// Disallow changing some options from secure mode.
|
||||
@ -3509,9 +3509,9 @@ static const char *did_set_option(OptIndex opt_idx, void *varp, OptVal old_value
|
||||
restore_chartab = did_set_cb_args.os_restore_chartab;
|
||||
}
|
||||
|
||||
// If option is immutable or if an error is detected, restore the previous value and don't do any
|
||||
// If option is hidden or if an error is detected, restore the previous value and don't do any
|
||||
// further processing.
|
||||
if (opt->immutable || errmsg != NULL) {
|
||||
if (opt->hidden || errmsg != NULL) {
|
||||
set_option_varp(opt_idx, varp, old_value, true);
|
||||
// When resetting some values, need to act on it.
|
||||
if (restore_chartab) {
|
||||
|
@ -49,9 +49,8 @@ typedef struct {
|
||||
///< buffer-local option: global value
|
||||
idopt_T indir; ///< global option: PV_NONE;
|
||||
///< local option: indirect option index
|
||||
bool hidden; ///< option is hidden and cannot be set.
|
||||
bool immutable; ///< option value can be set but any attempt to change the option is
|
||||
/// ignored.
|
||||
bool hidden; ///< option is hidden, any attempt to set its value will be ignored.
|
||||
bool immutable; ///< option is immutable, trying to set its value will give an error.
|
||||
|
||||
/// callback function to invoke after an option is modified to validate and
|
||||
/// apply the new value.
|
||||
|
@ -1341,7 +1341,7 @@ return {
|
||||
scope = { 'global' },
|
||||
short_desc = N_('No description'),
|
||||
type = 'boolean',
|
||||
hidden = true,
|
||||
immutable = true,
|
||||
},
|
||||
{
|
||||
abbreviation = 'cpt',
|
||||
@ -2300,7 +2300,7 @@ return {
|
||||
scope = { 'global' },
|
||||
short_desc = N_('No description'),
|
||||
type = 'boolean',
|
||||
hidden = true,
|
||||
immutable = true,
|
||||
},
|
||||
{
|
||||
abbreviation = 'emo',
|
||||
@ -3889,7 +3889,7 @@ return {
|
||||
scope = { 'global' },
|
||||
short_desc = N_('No description'),
|
||||
type = 'boolean',
|
||||
hidden = true,
|
||||
immutable = true,
|
||||
},
|
||||
{
|
||||
abbreviation = 'hkp',
|
||||
@ -3898,7 +3898,7 @@ return {
|
||||
scope = { 'global' },
|
||||
short_desc = N_('No description'),
|
||||
type = 'boolean',
|
||||
hidden = true,
|
||||
immutable = true,
|
||||
},
|
||||
{
|
||||
abbreviation = 'hls',
|
||||
@ -4296,7 +4296,7 @@ return {
|
||||
scope = { 'global' },
|
||||
short_desc = N_('No description'),
|
||||
type = 'boolean',
|
||||
hidden = true,
|
||||
immutable = true,
|
||||
},
|
||||
{
|
||||
abbreviation = 'isf',
|
||||
@ -5147,7 +5147,7 @@ return {
|
||||
scope = { 'global' },
|
||||
short_desc = N_('maximum nr of combining characters displayed'),
|
||||
type = 'number',
|
||||
immutable = true,
|
||||
hidden = true,
|
||||
},
|
||||
{
|
||||
abbreviation = 'mfd',
|
||||
@ -6048,7 +6048,7 @@ return {
|
||||
scope = { 'global' },
|
||||
short_desc = N_('enable prompt in Ex mode'),
|
||||
type = 'boolean',
|
||||
hidden = true,
|
||||
immutable = true,
|
||||
},
|
||||
{
|
||||
abbreviation = 'pb',
|
||||
@ -6305,7 +6305,7 @@ return {
|
||||
scope = { 'global' },
|
||||
short_desc = N_('No description'),
|
||||
type = 'boolean',
|
||||
hidden = true,
|
||||
immutable = true,
|
||||
},
|
||||
{
|
||||
defaults = { if_true = 2 },
|
||||
@ -8844,7 +8844,7 @@ return {
|
||||
scope = { 'global' },
|
||||
short_desc = N_('No description'),
|
||||
type = 'boolean',
|
||||
hidden = true,
|
||||
immutable = true,
|
||||
},
|
||||
{
|
||||
abbreviation = 'tw',
|
||||
@ -9089,7 +9089,7 @@ return {
|
||||
scope = { 'global' },
|
||||
short_desc = N_('No description'),
|
||||
type = 'boolean',
|
||||
hidden = true,
|
||||
immutable = true,
|
||||
},
|
||||
{
|
||||
abbreviation = 'udir',
|
||||
|
Loading…
Reference in New Issue
Block a user