aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@proton.me>2024-03-27 14:37:50 +0600
committerLewis Russell <me@lewisr.dev>2024-03-27 09:27:16 +0000
commit63f7b1f31eae9e2710bd973f05a575f26e0208d9 (patch)
tree2953a5503d51f80eda7f639cc0ee18d85816bad7
parent635fa2c51c1db604804bd7b9dbd818bb06677fde (diff)
downloadrneovim-63f7b1f31eae9e2710bd973f05a575f26e0208d9.tar.gz
rneovim-63f7b1f31eae9e2710bd973f05a575f26e0208d9.tar.bz2
rneovim-63f7b1f31eae9e2710bd973f05a575f26e0208d9.zip
refactor(options): swap `immutable` and `hidden` option property names
Ref: https://github.com/neovim/neovim/pull/28018#issuecomment-2021622120
-rw-r--r--src/nvim/option.c12
-rw-r--r--src/nvim/option.h5
-rw-r--r--src/nvim/options.lua20
3 files changed, 18 insertions, 19 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index e4f32ebec4..2c7922908c 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -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) {
diff --git a/src/nvim/option.h b/src/nvim/option.h
index 2357aa68ac..19764c0121 100644
--- a/src/nvim/option.h
+++ b/src/nvim/option.h
@@ -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.
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index 26a0c1a3a9..0cbdf45f4e 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -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',