diff src/ex_cmds.c @ 15713:ad8b2c109b22 v8.1.0864

patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff' commit https://github.com/vim/vim/commit/375e3390078e740d3c83b0c118c50d9a920036c7 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 31 18:26:10 2019 +0100 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff' Problem: Cannot have a local value for 'scrolloff' and 'sidescrolloff'. (Gary Holloway) Solution: Make 'scrolloff' and 'sidescrolloff' global-local. (mostly by Aron Widforss, closes #3539)
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Jan 2019 18:30:08 +0100
parents 6f1c7e9a6393
children 93b78c4a7cd5
line wrap: on
line diff
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3784,6 +3784,7 @@ do_ecmd(
 #endif
     int		readfile_flags = 0;
     int		did_inc_redrawing_disabled = FALSE;
+    long        *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so;
 
     if (eap != NULL)
 	command = eap->do_ecmd_cmd;
@@ -4389,12 +4390,12 @@ do_ecmd(
     did_inc_redrawing_disabled = FALSE;
     if (!skip_redraw)
     {
-	n = p_so;
+	n = *so_ptr;
 	if (topline == 0 && command == NULL)
-	    p_so = 999;			/* force cursor halfway the window */
+	    *so_ptr = 9999;		// force cursor halfway the window
 	update_topline();
 	curwin->w_scbind_pos = curwin->w_topline;
-	p_so = n;
+	*so_ptr = n;
 	redraw_curbuf_later(NOT_VALID);	/* redraw this buffer later */
     }