diff options
author | Famiu Haque <famiuhaque@proton.me> | 2024-02-03 12:57:03 +0600 |
---|---|---|
committer | Famiu Haque <famiuhaque@proton.me> | 2024-03-21 15:41:14 +0600 |
commit | 2214f9c19daa46a1fc37bcc14c017c092894a506 (patch) | |
tree | 5fd933cd67d5d868a4c876dcc20af263e3d4ddfc /src/nvim/ex_getln.c | |
parent | 5aa8c02a9de5c1efa1e2dee60af1ecf58f452d19 (diff) | |
download | rneovim-2214f9c19daa46a1fc37bcc14c017c092894a506.tar.gz rneovim-2214f9c19daa46a1fc37bcc14c017c092894a506.tar.bz2 rneovim-2214f9c19daa46a1fc37bcc14c017c092894a506.zip |
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.
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index e5d82cc126..a4501a31c2 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -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. |