mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
refactor: replace unnecessary helper functions in optionstr.c
Replaces unnecessary helper functions in `optionstr.c` such as `get_option_flags()`, `get_option_fullname()`, `set_option_flag()`, `is_global_option()`, etc. with a single `get_option()` helper function that allows direct access to the `options` array. Also refactors `f_exists()` to use `get_varp_scope` instead of using `get_option_tv`. This opens up the path for removing `getoptions_T` altogether later down the line since the hidden option logic is no longer needed.
This commit is contained in:
@@ -990,4 +990,41 @@ typedef struct {
|
||||
uint64_t channel_id; /// Only used when script_id is SID_API_CLIENT.
|
||||
} LastSet;
|
||||
|
||||
// WV_ and BV_ values get typecasted to this for the "indir" field
|
||||
typedef enum {
|
||||
PV_NONE = 0,
|
||||
PV_MAXVAL = 0xffff, // to avoid warnings for value out of range
|
||||
} idopt_T;
|
||||
|
||||
typedef struct vimoption {
|
||||
char *fullname; // full option name
|
||||
char *shortname; // permissible abbreviation
|
||||
uint32_t flags; // see below
|
||||
char_u *var; // global option: pointer to variable;
|
||||
// window-local option: VAR_WIN;
|
||||
// buffer-local option: global value
|
||||
idopt_T indir; // global option: PV_NONE;
|
||||
// local option: indirect option index
|
||||
char *def_val; // default values for variable (neovim!!)
|
||||
LastSet last_set; // script in which the option was last set
|
||||
} vimoption_T;
|
||||
|
||||
// The options that are local to a window or buffer have "indir" set to one of
|
||||
// these values. Special values:
|
||||
// PV_NONE: global option.
|
||||
// PV_WIN is added: window-local option
|
||||
// PV_BUF is added: buffer-local option
|
||||
// PV_BOTH is added: global option which also has a local value.
|
||||
#define PV_BOTH 0x1000
|
||||
#define PV_WIN 0x2000
|
||||
#define PV_BUF 0x4000
|
||||
#define PV_MASK 0x0fff
|
||||
#define OPT_WIN(x) (idopt_T)(PV_WIN + (int)(x))
|
||||
#define OPT_BUF(x) (idopt_T)(PV_BUF + (int)(x))
|
||||
#define OPT_BOTH(x) (idopt_T)(PV_BOTH + (int)(x))
|
||||
|
||||
// Options local to a window have a value local to a buffer and global to all
|
||||
// buffers. Indicate this by setting "var" to VAR_WIN.
|
||||
#define VAR_WIN ((char_u *)-1)
|
||||
|
||||
#endif // NVIM_OPTION_DEFS_H
|
||||
|
Reference in New Issue
Block a user