mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +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:
@@ -919,7 +919,7 @@ static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear
|
||||
need_wait_return = false;
|
||||
}
|
||||
|
||||
set_string_option_direct(kOptInccommand, s->save_p_icm, 0, SID_NONE);
|
||||
set_option_direct(kOptInccommand, CSTR_AS_OPTVAL(s->save_p_icm), 0, SID_NONE);
|
||||
State = s->save_State;
|
||||
if (cmdpreview != save_cmdpreview) {
|
||||
cmdpreview = save_cmdpreview; // restore preview state
|
||||
@@ -2554,7 +2554,7 @@ static bool cmdpreview_may_show(CommandLineState *s)
|
||||
// Open preview buffer if inccommand=split.
|
||||
if (icm_split && (cmdpreview_buf = cmdpreview_open_buf()) == NULL) {
|
||||
// Failed to create preview buffer, so disable preview.
|
||||
set_string_option_direct(kOptInccommand, "nosplit", 0, SID_NONE);
|
||||
set_option_direct(kOptInccommand, STATIC_CSTR_AS_OPTVAL("nosplit"), 0, SID_NONE);
|
||||
icm_split = false;
|
||||
}
|
||||
// Setup preview namespace if it's not already set.
|
||||
|
Reference in New Issue
Block a user