diff src/search.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 675dd5d7afb3
line wrap: on
line diff
--- a/src/search.c
+++ b/src/search.c
@@ -2601,6 +2601,8 @@ showmatch(
 #endif
     colnr_T	save_dollar_vcol;
     char_u	*p;
+    long        *so = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so;
+    long        *siso = curwin->w_p_siso >= 0 ? &curwin->w_p_siso : &p_siso;
 
     /*
      * Only show match for chars in the 'matchpairs' option.
@@ -2635,8 +2637,8 @@ showmatch(
 	{
 	    mpos = *lpos;    /* save the pos, update_screen() may change it */
 	    save_cursor = curwin->w_cursor;
-	    save_so = p_so;
-	    save_siso = p_siso;
+	    save_so = *so;
+	    save_siso = *siso;
 	    /* Handle "$" in 'cpo': If the ')' is typed on top of the "$",
 	     * stop displaying the "$". */
 	    if (dollar_vcol >= 0 && dollar_vcol == curwin->w_virtcol)
@@ -2651,8 +2653,8 @@ showmatch(
 	    ui_cursor_shape();		/* may show different cursor shape */
 #endif
 	    curwin->w_cursor = mpos;	/* move to matching char */
-	    p_so = 0;			/* don't use 'scrolloff' here */
-	    p_siso = 0;			/* don't use 'sidescrolloff' here */
+	    *so = 0;			/* don't use 'scrolloff' here */
+	    *siso = 0;			/* don't use 'sidescrolloff' here */
 	    showruler(FALSE);
 	    setcursor();
 	    cursor_on();		/* make sure that the cursor is shown */
@@ -2672,8 +2674,8 @@ showmatch(
 	    else if (!char_avail())
 		ui_delay(p_mat * 100L, FALSE);
 	    curwin->w_cursor = save_cursor;	/* restore cursor position */
-	    p_so = save_so;
-	    p_siso = save_siso;
+	    *so = save_so;
+	    *siso = save_siso;
 #ifdef CURSOR_SHAPE
 	    State = save_state;
 	    ui_cursor_shape();		/* may show different cursor shape */