diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-01-23 09:43:20 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2023-01-25 11:48:52 +0000 |
commit | f9e15db27d6f1707cf0b381dd16bced607d697f0 (patch) | |
tree | 108f4ba1396972c39ea39d3135f31e7480bca885 /src | |
parent | 700a02bd83248428c95ceea51c9372f0ea4c6cc7 (diff) | |
download | rneovim-f9e15db27d6f1707cf0b381dd16bced607d697f0.tar.gz rneovim-f9e15db27d6f1707cf0b381dd16bced607d697f0.tar.bz2 rneovim-f9e15db27d6f1707cf0b381dd16bced607d697f0.zip |
refactor(optionstr.c): break up did_set_string_option 27
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/optionstr.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index ea05c8e56b..15111b36b5 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -966,6 +966,20 @@ static void did_set_shada(vimoption_T **opt, int *opt_idx, bool *free_oldval, ch } } +static void did_set_titleiconstring(char **varp) +{ + // 'titlestring' and 'iconstring' + int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON; + + // NULL => statusline syntax + if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL) { + stl_syntax |= flagval; + } else { + stl_syntax &= ~flagval; + } + did_set_title(); +} + static void did_set_buftype(buf_T *buf, win_T *win, char **errmsg) { // When 'buftype' is set, check for valid value. @@ -1446,15 +1460,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf fill_breakat_flags(); } else if (varp == &p_titlestring || varp == &p_iconstring) { // 'titlestring' and 'iconstring' - int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON; - - // NULL => statusline syntax - if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL) { - stl_syntax |= flagval; - } else { - stl_syntax &= ~flagval; - } - did_set_title(); + did_set_titleiconstring(varp); } else if (varp == &p_sel) { // 'selection' if (*p_sel == NUL || check_opt_strings(p_sel, p_sel_values, false) != OK) { |