diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-01-19 10:30:00 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2023-01-25 11:48:52 +0000 |
commit | fca3053a3e5884f6eadc27e473661da2a87c353f (patch) | |
tree | 2b872519d7bf8105ba57eeb4d57293d3db2475f9 | |
parent | 5adf8f92762bc457e4314b5d94d5485b51eef713 (diff) | |
download | rneovim-fca3053a3e5884f6eadc27e473661da2a87c353f.tar.gz rneovim-fca3053a3e5884f6eadc27e473661da2a87c353f.tar.bz2 rneovim-fca3053a3e5884f6eadc27e473661da2a87c353f.zip |
refactor(optionstr.c): break up did_set_string_option 17
-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 c67494bf70..30c6d0ec91 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -1064,6 +1064,20 @@ static void did_set_completeopt(char **errmsg) } } +static void did_set_signcolumn(win_T *win, char **varp, const char *oldval, char **errmsg) +{ + if (check_signcolumn(*varp) != OK) { + *errmsg = e_invarg; + } + // When changing the 'signcolumn' to or from 'number', recompute the + // width of the number column if 'number' or 'relativenumber' is set. + if (((*oldval == 'n' && *(oldval + 1) == 'u') + || (*win->w_p_scl == 'n' && *(win->w_p_scl + 1) == 'u')) + && (win->w_p_nu || win->w_p_rnu)) { + win->w_nrwidth_line_count = 0; + } +} + /// Handle string options that need some action to perform when changed. /// The new value must be allocated. /// @@ -1346,16 +1360,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf } #endif } else if (varp == &curwin->w_p_scl) { // 'signcolumn' - if (check_signcolumn(*varp) != OK) { - errmsg = e_invarg; - } - // When changing the 'signcolumn' to or from 'number', recompute the - // width of the number column if 'number' or 'relativenumber' is set. - if (((*oldval == 'n' && *(oldval + 1) == 'u') - || (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) == 'u')) - && (curwin->w_p_nu || curwin->w_p_rnu)) { - curwin->w_nrwidth_line_count = 0; - } + did_set_signcolumn(curwin, varp, oldval, &errmsg); } else if (varp == &p_sloc) { // 'showcmdloc' if (check_opt_strings(p_sloc, p_sloc_values, false) != OK) { errmsg = e_invarg; |