diff src/option.c @ 32679:1b9a29f7fe86 v9.0.1670

patch 9.0.1670: resetting local option to global value is inconsistent Commit: https://github.com/vim/vim/commit/bf5f189e449d6517239b79804d7a422a46946838 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 27 21:51:07 2023 +0100 patch 9.0.1670: resetting local option to global value is inconsistent Problem: Resetting local option to global value is inconsistent. Solution: Handle "<" specifically for 'scrolloff' and 'sidescrolloff'. (closes #12594)
author Bram Moolenaar <Bram@vim.org>
date Tue, 27 Jun 2023 23:00:04 +0200
parents 695b50472e85
children 80152cf7ce63
line wrap: on
line diff
--- a/src/option.c
+++ b/src/option.c
@@ -2135,10 +2135,14 @@ do_set_option_numeric(
 	    ((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : VIM_DEFAULT];
     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);
     }