diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-01-25 13:46:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-25 13:46:23 +0000 |
commit | e2a9d71521a1acdc5a554e3d9f54dfe543914db5 (patch) | |
tree | 07b5ac97f4770df35d8cf412b0a9c24f8c3a576d /src/nvim/ops.c | |
parent | b8288df99be8df701308167e4b0b497f003f25e9 (diff) | |
parent | 7bee622fdc72d7461ed43ea170cca20056891d2c (diff) | |
download | rneovim-e2a9d71521a1acdc5a554e3d9f54dfe543914db5.tar.gz rneovim-e2a9d71521a1acdc5a554e3d9f54dfe543914db5.tar.bz2 rneovim-e2a9d71521a1acdc5a554e3d9f54dfe543914db5.zip |
Merge pull request #21885 from lewis6991/refactor/options
Problems:
- Scope of local variables in options code is too large.
- did_set_string_option() is too large (>1000LOC).
- Setting options for a particular window or buffer requires a changing context (assigning curwin/curbuf).
Solutions:
- Reduce the scope of local variables.
- Break up did_set_string_option so it doesn't contain specific logic about each individual option (1038 LOC -> 310 LOC).
- Begin work on making functions not depend on curbuf or curwin and pass window or buffer handles explicitly.
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index ac4116095f..435ca106ab 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -5626,10 +5626,11 @@ static void op_colon(oparg_T *oap) static Callback opfunc_cb; /// Process the 'operatorfunc' option value. -/// @return OK or FAIL -int set_operatorfunc_option(void) +void set_operatorfunc_option(char **errmsg) { - return option_set_callback_func(p_opfunc, &opfunc_cb); + if (option_set_callback_func(p_opfunc, &opfunc_cb) == FAIL) { + *errmsg = e_invarg; + } } #if defined(EXITFREE) |