neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit aaeffba6846bf1e6065be3079e6e9d4310298227
parent af9c1e572dc1015b7b8f2a8a09d527f54ca080d3
Author: Sean Dewar <seandewar@users.noreply.github.com>
Date:   Fri, 13 May 2022 00:41:20 +0100

vim-patch:8.2.4943: changing 'switchbuf' may have no effect (#18545)

Problem:    Changing 'switchbuf' may have no effect.
Solution:   Handle 'switchbuf' in didset_string_options(). (Sean Dewar,
            closes vim/vim#10406)
https://github.com/vim/vim/commit/39c46b43780ad00ea27a93d92aadd44753d4c3ea

Guess it doesn't hurt to cherry-pick didset_string_options from v8.1.2045
(but in option.c, for now).
Diffstat:
Msrc/nvim/option.c | 21+++++++++++++++------
Msrc/nvim/testdir/test_options.vim | 13+++++++++++++
2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/src/nvim/option.c b/src/nvim/option.c @@ -1963,13 +1963,10 @@ static char_u *option_expand(int opt_idx, char_u *val) return NameBuff; } -// After setting various option values: recompute variables that depend on -// option values. -static void didset_options(void) +/// After setting various option values: recompute variables that depend on +/// option values. +static void didset_string_options(void) { - // initialize the table for 'iskeyword' et.al. - (void)init_chartab(); - (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, true); (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, true); (void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, true); @@ -1981,8 +1978,20 @@ static void didset_options(void) (void)opt_strings_flags(p_tc, p_tc_values, &tc_flags, false); (void)opt_strings_flags(p_tpf, p_tpf_values, &tpf_flags, true); (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, true); + (void)opt_strings_flags(p_swb, p_swb_values, &swb_flags, true); (void)opt_strings_flags(p_wop, p_wop_values, &wop_flags, true); (void)opt_strings_flags(p_jop, p_jop_values, &jop_flags, true); +} + +/// After setting various option values: recompute variables that depend on +/// option values. +static void didset_options(void) +{ + // initialize the table for 'iskeyword' et.al. + (void)init_chartab(); + + didset_string_options(); + (void)spell_check_msm(); (void)spell_check_sps(); (void)compile_cap_prog(curwin->w_s); diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim @@ -832,4 +832,17 @@ func Test_opt_cdhome() set cdhome& endfunc +func Test_switchbuf_reset() + set switchbuf=useopen + sblast + call assert_equal(1, winnr('$')) + set all& + " Nvim has a different default for 'switchbuf' + " call assert_equal('', &switchbuf) + call assert_equal('uselast', &switchbuf) + sblast + call assert_equal(2, winnr('$')) + only! +endfunc + " vim: shiftwidth=2 sts=2 expandtab