refactor(optionstr.c): break up did_set_string_option 26

This commit is contained in:
Lewis Russell
2023-01-23 09:38:44 +00:00
parent 7fa7c758e2
commit 700a02bd83
5 changed files with 31 additions and 42 deletions

View File

@@ -2258,14 +2258,14 @@ static void copy_global_to_buflocal_cb(Callback *globcb, Callback *bufcb)
/// Invoked when the 'completefunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
int set_completefunc_option(void)
void set_completefunc_option(char **errmsg)
{
int retval = option_set_callback_func(curbuf->b_p_cfu, &cfu_cb);
if (retval == OK) {
set_buflocal_cfu_callback(curbuf);
if (option_set_callback_func(curbuf->b_p_cfu, &cfu_cb) == FAIL) {
*errmsg = e_invarg;
return;
}
return retval;
set_buflocal_cfu_callback(curbuf);
}
/// Copy the global 'completefunc' callback function to the buffer-local
@@ -2279,14 +2279,13 @@ void set_buflocal_cfu_callback(buf_T *buf)
/// Invoked when the 'omnifunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
int set_omnifunc_option(void)
void set_omnifunc_option(buf_T *buf, char **errmsg)
{
int retval = option_set_callback_func(curbuf->b_p_ofu, &ofu_cb);
if (retval == OK) {
set_buflocal_ofu_callback(curbuf);
if (option_set_callback_func(buf->b_p_ofu, &ofu_cb) == FAIL) {
*errmsg = e_invarg;
return;
}
return retval;
set_buflocal_ofu_callback(buf);
}
/// Copy the global 'omnifunc' callback function to the buffer-local 'omnifunc'
@@ -2300,7 +2299,7 @@ void set_buflocal_ofu_callback(buf_T *buf)
/// Invoked when the 'thesaurusfunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
int set_thesaurusfunc_option(void)
void set_thesaurusfunc_option(char **errmsg)
{
int retval;
@@ -2312,7 +2311,9 @@ int set_thesaurusfunc_option(void)
retval = option_set_callback_func(p_tsrfu, &tsrfu_cb);
}
return retval;
if (retval == FAIL) {
*errmsg = e_invarg;
}
}
/// Mark the global 'completefunc' 'omnifunc' and 'thesaurusfunc' callbacks with