comparison 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
comparison
equal deleted inserted replaced
15712:bc1989f9bd37 15713:ad8b2c109b22
2599 #ifdef CURSOR_SHAPE 2599 #ifdef CURSOR_SHAPE
2600 int save_state; 2600 int save_state;
2601 #endif 2601 #endif
2602 colnr_T save_dollar_vcol; 2602 colnr_T save_dollar_vcol;
2603 char_u *p; 2603 char_u *p;
2604 long *so = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so;
2605 long *siso = curwin->w_p_siso >= 0 ? &curwin->w_p_siso : &p_siso;
2604 2606
2605 /* 2607 /*
2606 * Only show match for chars in the 'matchpairs' option. 2608 * Only show match for chars in the 'matchpairs' option.
2607 */ 2609 */
2608 /* 'matchpairs' is "x:y,x:y" */ 2610 /* 'matchpairs' is "x:y,x:y" */
2633 if (curwin->w_p_wrap || (vcol >= curwin->w_leftcol 2635 if (curwin->w_p_wrap || (vcol >= curwin->w_leftcol
2634 && vcol < curwin->w_leftcol + curwin->w_width)) 2636 && vcol < curwin->w_leftcol + curwin->w_width))
2635 { 2637 {
2636 mpos = *lpos; /* save the pos, update_screen() may change it */ 2638 mpos = *lpos; /* save the pos, update_screen() may change it */
2637 save_cursor = curwin->w_cursor; 2639 save_cursor = curwin->w_cursor;
2638 save_so = p_so; 2640 save_so = *so;
2639 save_siso = p_siso; 2641 save_siso = *siso;
2640 /* Handle "$" in 'cpo': If the ')' is typed on top of the "$", 2642 /* Handle "$" in 'cpo': If the ')' is typed on top of the "$",
2641 * stop displaying the "$". */ 2643 * stop displaying the "$". */
2642 if (dollar_vcol >= 0 && dollar_vcol == curwin->w_virtcol) 2644 if (dollar_vcol >= 0 && dollar_vcol == curwin->w_virtcol)
2643 dollar_vcol = -1; 2645 dollar_vcol = -1;
2644 ++curwin->w_virtcol; /* do display ')' just before "$" */ 2646 ++curwin->w_virtcol; /* do display ')' just before "$" */
2649 save_state = State; 2651 save_state = State;
2650 State = SHOWMATCH; 2652 State = SHOWMATCH;
2651 ui_cursor_shape(); /* may show different cursor shape */ 2653 ui_cursor_shape(); /* may show different cursor shape */
2652 #endif 2654 #endif
2653 curwin->w_cursor = mpos; /* move to matching char */ 2655 curwin->w_cursor = mpos; /* move to matching char */
2654 p_so = 0; /* don't use 'scrolloff' here */ 2656 *so = 0; /* don't use 'scrolloff' here */
2655 p_siso = 0; /* don't use 'sidescrolloff' here */ 2657 *siso = 0; /* don't use 'sidescrolloff' here */
2656 showruler(FALSE); 2658 showruler(FALSE);
2657 setcursor(); 2659 setcursor();
2658 cursor_on(); /* make sure that the cursor is shown */ 2660 cursor_on(); /* make sure that the cursor is shown */
2659 out_flush_cursor(TRUE, FALSE); 2661 out_flush_cursor(TRUE, FALSE);
2660 2662
2670 if (vim_strchr(p_cpo, CPO_SHOWMATCH) != NULL) 2672 if (vim_strchr(p_cpo, CPO_SHOWMATCH) != NULL)
2671 ui_delay(p_mat * 100L, TRUE); 2673 ui_delay(p_mat * 100L, TRUE);
2672 else if (!char_avail()) 2674 else if (!char_avail())
2673 ui_delay(p_mat * 100L, FALSE); 2675 ui_delay(p_mat * 100L, FALSE);
2674 curwin->w_cursor = save_cursor; /* restore cursor position */ 2676 curwin->w_cursor = save_cursor; /* restore cursor position */
2675 p_so = save_so; 2677 *so = save_so;
2676 p_siso = save_siso; 2678 *siso = save_siso;
2677 #ifdef CURSOR_SHAPE 2679 #ifdef CURSOR_SHAPE
2678 State = save_state; 2680 State = save_state;
2679 ui_cursor_shape(); /* may show different cursor shape */ 2681 ui_cursor_shape(); /* may show different cursor shape */
2680 #endif 2682 #endif
2681 } 2683 }