aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-25 19:01:48 +0800
committerGitHub <noreply@github.com>2022-07-25 19:01:48 +0800
commit6e9a7e7db81b899553548b82b42bf5c162109e19 (patch)
treea313a1b2f01708f784d3af2a98c3444592c3ac3d /src/nvim/eval.c
parent6c26d0b068a3aee4155f38bbf52e3568073ede8a (diff)
parentaba3147cb62339714633b53f9ba114b08c5d6761 (diff)
downloadrneovim-6e9a7e7db81b899553548b82b42bf5c162109e19.tar.gz
rneovim-6e9a7e7db81b899553548b82b42bf5c162109e19.tar.bz2
rneovim-6e9a7e7db81b899553548b82b42bf5c162109e19.zip
Merge pull request #19493 from zeertzjq/vim-8.2.1469
vim-patch:8.2.{1469,2254,2284,2285,2969,4228}: option fixes and refactorings
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 7b2a20e6fb..9c27ec16f3 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -3774,7 +3774,7 @@ int get_option_tv(const char **const arg, typval_T *const rettv, const bool eval
{
long numval;
char *stringval;
- int opt_type;
+ getoption_T opt_type;
bool working = (**arg == '+'); // has("+option")
int ret = OK;
int opt_flags;
@@ -3798,26 +3798,28 @@ int get_option_tv(const char **const arg, typval_T *const rettv, const bool eval
opt_type = get_option_value(*arg, &numval,
rettv == NULL ? NULL : &stringval, opt_flags);
- if (opt_type == -3) { // invalid name
+ if (opt_type == gov_unknown) {
if (rettv != NULL) {
semsg(_("E113: Unknown option: %s"), *arg);
}
ret = FAIL;
} else if (rettv != NULL) {
- if (opt_type == -2) { // hidden string option
+ if (opt_type == gov_hidden_string) {
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
- } else if (opt_type == -1) { // hidden number option
+ } else if (opt_type == gov_hidden_bool || opt_type == gov_hidden_number) {
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0;
- } else if (opt_type == 1 || opt_type == 2) { // number or boolean option
+ } else if (opt_type == gov_bool || opt_type == gov_number) {
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = numval;
} else { // string option
rettv->v_type = VAR_STRING;
rettv->vval.v_string = stringval;
}
- } else if (working && (opt_type == -2 || opt_type == -1)) {
+ } else if (working && (opt_type == gov_hidden_bool
+ || opt_type == gov_hidden_number
+ || opt_type == gov_hidden_string)) {
ret = FAIL;
}