From 42f9573e5da64d6eb8e0dd9ccfefadb68773202c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 28 Jun 2023 08:13:14 +0800 Subject: vim-patch:9.0.1670: resetting local option to global value is inconsistent (#24185) Problem: Resetting local option to global value is inconsistent. Solution: Handle "<" specifically for 'scrolloff' and 'sidescrolloff'. (closes vim/vim#12594) https://github.com/vim/vim/commit/bf5f189e449d6517239b79804d7a422a46946838 Co-authored-by: Bram Moolenaar --- src/nvim/option.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/option.c b/src/nvim/option.c index 673c6280d3..0002329da3 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -794,10 +794,14 @@ static void do_set_num(int opt_idx, int opt_flags, char **argp, int nextchar, co if (nextchar == '&') { value = (long)(intptr_t)options[opt_idx].def_val; } else if (nextchar == '<') { - // For 'undolevels' NO_LOCAL_UNDOLEVEL means to - // use the global value. if ((long *)varp == &curbuf->b_p_ul && opt_flags == OPT_LOCAL) { + // for 'undolevels' NO_LOCAL_UNDOLEVEL means using the global value value = NO_LOCAL_UNDOLEVEL; + } else if (opt_flags == OPT_LOCAL + && ((long *)varp == &curwin->w_p_siso + || (long *)varp == &curwin->w_p_so)) { + // for 'scrolloff'/'sidescrolloff' -1 means using the global value + value = -1; } else { value = *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL); } -- cgit