mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
refactor(options): remove set_string_option_direct()
Problem: `set_string_option_direct()` contains a separate codepath specifically for setting string options. Not only is that unnecessary code duplication, but it's also limited to only string options. Solution: Replace `set_string_option_direct()` with `set_option_direct()` which calls `set_option()` under the hood. This reduces code duplication and allows directly setting an option of any type.
This commit is contained in:
@@ -2697,7 +2697,7 @@ static void apply_cmdmod(cmdmod_T *cmod)
|
||||
// Set 'eventignore' to "all".
|
||||
// First save the existing option value for restoring it later.
|
||||
cmod->cmod_save_ei = xstrdup(p_ei);
|
||||
set_string_option_direct(kOptEventignore, "all", 0, SID_NONE);
|
||||
set_option_direct(kOptEventignore, STATIC_CSTR_AS_OPTVAL("all"), 0, SID_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2717,7 +2717,7 @@ void undo_cmdmod(cmdmod_T *cmod)
|
||||
|
||||
if (cmod->cmod_save_ei != NULL) {
|
||||
// Restore 'eventignore' to the value before ":noautocmd".
|
||||
set_string_option_direct(kOptEventignore, cmod->cmod_save_ei, 0, SID_NONE);
|
||||
set_option_direct(kOptEventignore, CSTR_AS_OPTVAL(cmod->cmod_save_ei), 0, SID_NONE);
|
||||
free_string_option(cmod->cmod_save_ei);
|
||||
cmod->cmod_save_ei = NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user