Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.3.008
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.008
Problem:    'cursorbind' is kept in places where 'scrollbind' is reset.
Solution:   Reset 'cursorbind'.
Files:	    src/buffer.c, src/diff.c, src/ex_cmds.c, src/ex_cmds2.c,
	    src/ex_docmd.c, src/ex_getln.c, src/if_cscope.c, src/macros.h,
	    src/quickfix.c, src/search.c, src/tag.c, src/window.c


*** ../vim-7.3.007/src/buffer.c	2010-08-15 21:57:32.000000000 +0200
--- src/buffer.c	2010-09-21 16:54:19.000000000 +0200
***************
*** 1288,1296 ****
      /* Go to the other buffer. */
      set_curbuf(buf, action);
  
! #if defined(FEAT_LISTCMDS) && defined(FEAT_SCROLLBIND)
      if (action == DOBUF_SPLIT)
! 	curwin->w_p_scb = FALSE;	/* reset 'scrollbind' */
  #endif
  
  #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
--- 1288,1299 ----
      /* Go to the other buffer. */
      set_curbuf(buf, action);
  
! #if defined(FEAT_LISTCMDS) \
! 	&& (defined(FEAT_SCROLLBIND) || defined(FEAT_CURSORBIND))
      if (action == DOBUF_SPLIT)
!     {
! 	RESET_BINDING(curwin);	/* reset 'scrollbind' and 'cursorbind' */
!     }
  #endif
  
  #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
***************
*** 1917,1925 ****
  		tabpage_new();
  	    else if (win_split(0, 0) == FAIL)	/* Open in a new window */
  		return FAIL;
! # ifdef FEAT_SCROLLBIND
! 	    curwin->w_p_scb = FALSE;
! # endif
  	}
      }
  #endif
--- 1920,1926 ----
  		tabpage_new();
  	    else if (win_split(0, 0) == FAIL)	/* Open in a new window */
  		return FAIL;
! 	    RESET_BINDING(curwin);
  	}
      }
  #endif
*** ../vim-7.3.007/src/diff.c	2010-08-15 21:57:32.000000000 +0200
--- src/diff.c	2010-09-21 16:14:07.000000000 +0200
***************
*** 1127,1137 ****
  # endif
  
      wp->w_p_diff = TRUE;
  #ifdef FEAT_CURSORBIND
-     /* Use cursorbind if it's available */
      wp->w_p_crb = TRUE;
  #endif
-     wp->w_p_scb = TRUE;
      wp->w_p_wrap = FALSE;
  # ifdef FEAT_FOLDING
      curwin = wp;
--- 1127,1139 ----
  # endif
  
      wp->w_p_diff = TRUE;
+     /* Use 'scrollbind' and 'cursorbind' when available */
+ #ifdef FEAT_SCROLLBIND
+     wp->w_p_scb = TRUE;
+ #endif
  #ifdef FEAT_CURSORBIND
      wp->w_p_crb = TRUE;
  #endif
      wp->w_p_wrap = FALSE;
  # ifdef FEAT_FOLDING
      curwin = wp;
***************
*** 1177,1186 ****
  	{
  	    /* Set 'diff', 'scrollbind' off and 'wrap' on. */
  	    wp->w_p_diff = FALSE;
! #ifdef FEAT_CURSORBIND
! 	    wp->w_p_crb = FALSE;
! #endif
! 	    wp->w_p_scb = FALSE;
  	    wp->w_p_wrap = TRUE;
  #ifdef FEAT_FOLDING
  	    curwin = wp;
--- 1179,1185 ----
  	{
  	    /* Set 'diff', 'scrollbind' off and 'wrap' on. */
  	    wp->w_p_diff = FALSE;
! 	    RESET_BINDING(wp);
  	    wp->w_p_wrap = TRUE;
  #ifdef FEAT_FOLDING
  	    curwin = wp;
*** ../vim-7.3.007/src/ex_cmds.c	2010-08-15 21:57:26.000000000 +0200
--- src/ex_cmds.c	2010-09-21 16:15:07.000000000 +0200
***************
*** 3498,3506 ****
  	curbuf->b_p_bin = FALSE;	/* reset 'bin' before reading file */
  	curwin->w_p_nu = 0;		/* no line numbers */
  	curwin->w_p_rnu = 0;		/* no relative line numbers */
! #ifdef FEAT_SCROLLBIND
! 	curwin->w_p_scb = FALSE;	/* no scroll binding */
! #endif
  #ifdef FEAT_ARABIC
  	curwin->w_p_arab = FALSE;	/* no arabic mode */
  #endif
--- 3498,3504 ----
  	curbuf->b_p_bin = FALSE;	/* reset 'bin' before reading file */
  	curwin->w_p_nu = 0;		/* no line numbers */
  	curwin->w_p_rnu = 0;		/* no relative line numbers */
! 	RESET_BINDING(curwin);		/* no scroll or cursor binding */
  #ifdef FEAT_ARABIC
  	curwin->w_p_arab = FALSE;	/* no arabic mode */
  #endif
***************
*** 5471,5479 ****
  		return FALSE;
  	    curwin->w_p_pvw = TRUE;
  	    curwin->w_p_wfh = TRUE;
! # ifdef FEAT_SCROLLBIND
! 	    curwin->w_p_scb = FALSE;	    /* don't take over 'scrollbind' */
! # endif
  # ifdef FEAT_DIFF
  	    curwin->w_p_diff = FALSE;	    /* no 'diff' */
  # endif
--- 5469,5476 ----
  		return FALSE;
  	    curwin->w_p_pvw = TRUE;
  	    curwin->w_p_wfh = TRUE;
! 	    RESET_BINDING(curwin);	    /* don't take over 'scrollbind'
! 					       and 'cursorbind' */
  # ifdef FEAT_DIFF
  	    curwin->w_p_diff = FALSE;	    /* no 'diff' */
  # endif
*** ../vim-7.3.007/src/ex_cmds2.c	2010-08-15 21:57:31.000000000 +0200
--- src/ex_cmds2.c	2010-09-21 16:15:17.000000000 +0200
***************
*** 2165,2173 ****
  	{
  	    if (win_split(0, 0) == FAIL)
  		return;
! # ifdef FEAT_SCROLLBIND
! 	    curwin->w_p_scb = FALSE;
! # endif
  	}
  	else
  #endif
--- 2165,2171 ----
  	{
  	    if (win_split(0, 0) == FAIL)
  		return;
! 	    RESET_BINDING(curwin);
  	}
  	else
  #endif
*** ../vim-7.3.007/src/ex_docmd.c	2010-08-16 22:33:55.000000000 +0200
--- src/ex_docmd.c	2010-09-21 16:15:39.000000000 +0200
***************
*** 6898,6906 ****
  # ifdef FEAT_WINDOWS
  	if (win_split(0, 0) == FAIL)
  	    return;
! #  ifdef FEAT_SCROLLBIND
! 	curwin->w_p_scb = FALSE;
! #  endif
  
  	/* When splitting the window, create a new alist.  Otherwise the
  	 * existing one is overwritten. */
--- 6898,6904 ----
  # ifdef FEAT_WINDOWS
  	if (win_split(0, 0) == FAIL)
  	    return;
! 	RESET_BINDING(curwin);
  
  	/* When splitting the window, create a new alist.  Otherwise the
  	 * existing one is overwritten. */
***************
*** 7300,7306 ****
  		|| cmdmod.browse
  #  endif
  	   )
! 	    curwin->w_p_scb = FALSE;
  	else
  	    do_check_scrollbind(FALSE);
  # endif
--- 7298,7306 ----
  		|| cmdmod.browse
  #  endif
  	   )
! 	{
! 	    RESET_BINDING(curwin);
! 	}
  	else
  	    do_check_scrollbind(FALSE);
  # endif
*** ../vim-7.3.007/src/ex_getln.c	2010-08-15 21:57:28.000000000 +0200
--- src/ex_getln.c	2010-09-21 16:15:55.000000000 +0200
***************
*** 6147,6155 ****
      curwin->w_p_rl = cmdmsg_rl;
      cmdmsg_rl = FALSE;
  # endif
! # ifdef FEAT_SCROLLBIND
!     curwin->w_p_scb = FALSE;
! # endif
  
  # ifdef FEAT_AUTOCMD
      /* Do execute autocommands for setting the filetype (load syntax). */
--- 6147,6153 ----
      curwin->w_p_rl = cmdmsg_rl;
      cmdmsg_rl = FALSE;
  # endif
!     RESET_BINDING(curwin);
  
  # ifdef FEAT_AUTOCMD
      /* Do execute autocommands for setting the filetype (load syntax). */
*** ../vim-7.3.007/src/if_cscope.c	2010-08-15 21:57:32.000000000 +0200
--- src/if_cscope.c	2010-09-21 16:16:26.000000000 +0200
***************
*** 1274,1282 ****
  		{
  		    win_split(postponed_split > 0 ? postponed_split : 0,
  						       postponed_split_flags);
! #  ifdef FEAT_SCROLLBIND
! 		    curwin->w_p_scb = FALSE;
! #  endif
  		    postponed_split = 0;
  		}
  # endif
--- 1274,1280 ----
  		{
  		    win_split(postponed_split > 0 ? postponed_split : 0,
  						       postponed_split_flags);
! 		    RESET_BINDING(curwin);
  		    postponed_split = 0;
  		}
  # endif
*** ../vim-7.3.007/src/macros.h	2010-08-15 21:57:28.000000000 +0200
--- src/macros.h	2010-09-21 16:13:10.000000000 +0200
***************
*** 285,287 ****
--- 285,301 ----
  #else
  # define DO_AUTOCHDIR
  #endif
+ 
+ #if defined(FEAT_SCROLLBIND) && defined(FEAT_CURSORBIND)
+ # define RESET_BINDING(wp)  (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE
+ #else
+ # if defined(FEAT_SCROLLBIND)
+ #  define RESET_BINDING(wp)  (wp)->w_p_scb = FALSE
+ # else
+ #  if defined(FEAT_CURSORBIND)
+ #   define RESET_BINDING(wp)  (wp)->w_p_crb = FALSE
+ #  else
+ #   define RESET_BINDING(wp)
+ #  endif
+ # endif
+ #endif
*** ../vim-7.3.007/src/quickfix.c	2010-08-17 20:23:18.000000000 +0200
--- src/quickfix.c	2010-09-21 16:17:17.000000000 +0200
***************
*** 1656,1664 ****
  	    opened_window = TRUE;	/* close it when fail */
  	    p_swb = empty_option;	/* don't split again */
  	    swb_flags = 0;
! # ifdef FEAT_SCROLLBIND
! 	    curwin->w_p_scb = FALSE;
! # endif
  	    if (ll_ref != NULL)
  	    {
  		/* The new window should use the location list from the
--- 1656,1662 ----
  	    opened_window = TRUE;	/* close it when fail */
  	    p_swb = empty_option;	/* don't split again */
  	    swb_flags = 0;
! 	    RESET_BINDING(curwin);
  	    if (ll_ref != NULL)
  	    {
  		/* The new window should use the location list from the
***************
*** 2334,2342 ****
  	    win_goto(lastwin);
  	if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
  	    return;		/* not enough room for window */
! #ifdef FEAT_SCROLLBIND
! 	curwin->w_p_scb = FALSE;
! #endif
  
  	if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
  	{
--- 2332,2338 ----
  	    win_goto(lastwin);
  	if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
  	    return;		/* not enough room for window */
! 	RESET_BINDING(curwin);
  
  	if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
  	{
*** ../vim-7.3.007/src/search.c	2010-08-15 21:57:32.000000000 +0200
--- src/search.c	2010-09-21 16:17:28.000000000 +0200
***************
*** 5075,5083 ****
  			if (win_split(0, 0) == FAIL)
  #endif
  			    break;
! #ifdef FEAT_SCROLLBIND
! 			curwin->w_p_scb = FALSE;
! #endif
  		    }
  		    if (depth == -1)
  		    {
--- 5075,5081 ----
  			if (win_split(0, 0) == FAIL)
  #endif
  			    break;
! 			RESET_BINDING(curwin);
  		    }
  		    if (depth == -1)
  		    {
*** ../vim-7.3.007/src/tag.c	2010-08-15 21:57:25.000000000 +0200
--- src/tag.c	2010-09-21 16:17:51.000000000 +0200
***************
*** 3143,3151 ****
      {
  	win_split(postponed_split > 0 ? postponed_split : 0,
  						       postponed_split_flags);
! # ifdef FEAT_SCROLLBIND
! 	curwin->w_p_scb = FALSE;
! # endif
      }
  #endif
  
--- 3143,3149 ----
      {
  	win_split(postponed_split > 0 ? postponed_split : 0,
  						       postponed_split_flags);
! 	RESET_BINDING(curwin);
      }
  #endif
  
*** ../vim-7.3.007/src/window.c	2010-08-15 21:57:32.000000000 +0200
--- src/window.c	2010-09-21 16:18:44.000000000 +0200
***************
*** 525,533 ****
  		    setpcmark();
  		    if (win_split(0, 0) == OK)
  		    {
! # ifdef FEAT_SCROLLBIND
! 			curwin->w_p_scb = FALSE;
! # endif
  			(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL,
  							   ECMD_HIDE, NULL);
  			if (nchar == 'F' && lnum >= 0)
--- 525,531 ----
  		    setpcmark();
  		    if (win_split(0, 0) == OK)
  		    {
! 			RESET_BINDING(curwin);
  			(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL,
  							   ECMD_HIDE, NULL);
  			if (nchar == 'F' && lnum >= 0)
***************
*** 3277,3285 ****
      if (aucmd_win != NULL)
      {
  	win_init_some(aucmd_win, curwin);
! # ifdef FEAT_SCROLLBIND
! 	aucmd_win->w_p_scb = FALSE;
! # endif
  	new_frame(aucmd_win);
      }
  }
--- 3275,3281 ----
      if (aucmd_win != NULL)
      {
  	win_init_some(aucmd_win, curwin);
! 	RESET_BINDING(aucmd_win);
  	new_frame(aucmd_win);
      }
  }
***************
*** 3320,3329 ****
  	/* First window in new tab page, initialize it from "oldwin". */
  	win_init(curwin, oldwin, 0);
  
! # ifdef FEAT_SCROLLBIND
! 	/* We don't want scroll-binding in the first window. */
! 	curwin->w_p_scb = FALSE;
! # endif
      }
  #endif
  
--- 3316,3323 ----
  	/* First window in new tab page, initialize it from "oldwin". */
  	win_init(curwin, oldwin, 0);
  
! 	/* We don't want cursor- and scroll-binding in the first window. */
! 	RESET_BINDING(curwin);
      }
  #endif
  
*** ../vim-7.3.007/src/version.c	2010-09-21 16:49:29.000000000 +0200
--- src/version.c	2010-09-21 16:53:16.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     8,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
181. You make up words that go with the "happy tune" your modem makes
     while dialing your ISP.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///