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)
diff --git a/src/search.c b/src/search.c
index a4b4c41..4b3f853 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2601,6 +2601,8 @@
#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 @@
{
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 @@
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 @@
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 */