diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-01-19 09:54:12 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2023-01-25 11:48:52 +0000 |
commit | e334f5a57d3d00d4fc6ca0aeca8a6254e7e5da81 (patch) | |
tree | 6a193791f4ab32f9daec92499961ff5059bc5c56 | |
parent | 2a665736c18e2535e233e3d72bb29d4dc98a5bb4 (diff) | |
download | rneovim-e334f5a57d3d00d4fc6ca0aeca8a6254e7e5da81.tar.gz rneovim-e334f5a57d3d00d4fc6ca0aeca8a6254e7e5da81.tar.bz2 rneovim-e334f5a57d3d00d4fc6ca0aeca8a6254e7e5da81.zip |
refactor(optionstr.c): break up did_set_string_option 4
-rw-r--r-- | src/nvim/optionstr.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index fa26db5c12..dcefd450ca 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -690,6 +690,20 @@ static void did_set_helpfile(void) } } +static void did_set_helplang(char **errmsg) +{ + // Check for "", "ab", "ab,cd", etc. + for (char *s = p_hlg; *s != NUL; s += 3) { + if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL)) { + *errmsg = e_invarg; + break; + } + if (s[2] == NUL) { + break; + } + } +} + /// Handle string options that need some action to perform when changed. /// The new value must be allocated. /// @@ -759,16 +773,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf } else if (varp == &curwin->w_p_cc) { // 'colorcolumn' errmsg = check_colorcolumn(curwin); } else if (varp == &p_hlg) { // 'helplang' - // Check for "", "ab", "ab,cd", etc. - for (char *s = p_hlg; *s != NUL; s += 3) { - if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL)) { - errmsg = e_invarg; - break; - } - if (s[2] == NUL) { - break; - } - } + did_set_helplang(&errmsg); } else if (varp == &p_hl) { // 'highlight' if (strcmp(*varp, HIGHLIGHT_INIT) != 0) { errmsg = e_unsupportedoption; |