Karsten Hopp e97c6e
To: vim-dev@vim.org
Karsten Hopp e97c6e
Subject: Patch 7.0.146
Karsten Hopp e97c6e
Fcc: outbox
Karsten Hopp e97c6e
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp e97c6e
Mime-Version: 1.0
Karsten Hopp e97c6e
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp e97c6e
Content-Transfer-Encoding: 8bit
Karsten Hopp e97c6e
------------
Karsten Hopp e97c6e
Karsten Hopp e97c6e
Patch 7.0.146
Karsten Hopp e97c6e
Problem:    When 'switchbuf' is set to "usetab" and the current tab has only a
Karsten Hopp e97c6e
	    quickfix window, jumping to an error always opens a new window.
Karsten Hopp e97c6e
	    Also, when the buffer is open in another tab page it's not found.
Karsten Hopp e97c6e
Solution:   Check for the "split" value of 'switchbuf' properly.  Search in
Karsten Hopp e97c6e
	    other tab pages for the desired buffer. (Yegappan Lakshmanan)
Karsten Hopp e97c6e
Files:	    src/buffer.c, src/quickfix.c
Karsten Hopp e97c6e
Karsten Hopp e97c6e
Karsten Hopp e97c6e
*** ../vim-7.0.145/src/buffer.c	Sat Sep  9 14:51:43 2006
Karsten Hopp e97c6e
--- src/buffer.c	Fri Oct 20 20:08:49 2006
Karsten Hopp e97c6e
***************
Karsten Hopp e97c6e
*** 1208,1218 ****
Karsten Hopp e97c6e
      {
Karsten Hopp e97c6e
  # ifdef FEAT_WINDOWS
Karsten Hopp e97c6e
  	/* jump to first window containing buf if one exists ("useopen") */
Karsten Hopp e97c6e
! 	if (vim_strchr(p_swb, 'o') && buf_jump_open_win(buf))
Karsten Hopp e97c6e
  	    return OK;
Karsten Hopp e97c6e
  	/* jump to first window in any tab page containing buf if one exists
Karsten Hopp e97c6e
  	 * ("usetab") */
Karsten Hopp e97c6e
! 	if (vim_strchr(p_swb, 'a') && buf_jump_open_tab(buf))
Karsten Hopp e97c6e
  	    return OK;
Karsten Hopp e97c6e
  	if (win_split(0, 0) == FAIL)
Karsten Hopp e97c6e
  # endif
Karsten Hopp e97c6e
--- 1208,1218 ----
Karsten Hopp e97c6e
      {
Karsten Hopp e97c6e
  # ifdef FEAT_WINDOWS
Karsten Hopp e97c6e
  	/* jump to first window containing buf if one exists ("useopen") */
Karsten Hopp e97c6e
! 	if (vim_strchr(p_swb, 'o') != NULL && buf_jump_open_win(buf))
Karsten Hopp e97c6e
  	    return OK;
Karsten Hopp e97c6e
  	/* jump to first window in any tab page containing buf if one exists
Karsten Hopp e97c6e
  	 * ("usetab") */
Karsten Hopp e97c6e
! 	if (vim_strchr(p_swb, 'a') != NULL && buf_jump_open_tab(buf))
Karsten Hopp e97c6e
  	    return OK;
Karsten Hopp e97c6e
  	if (win_split(0, 0) == FAIL)
Karsten Hopp e97c6e
  # endif
Karsten Hopp e97c6e
***************
Karsten Hopp e97c6e
*** 1842,1854 ****
Karsten Hopp e97c6e
      if (options & GETF_SWITCH)
Karsten Hopp e97c6e
      {
Karsten Hopp e97c6e
  	/* use existing open window for buffer if wanted */
Karsten Hopp e97c6e
! 	if (vim_strchr(p_swb, 'o'))     /* useopen */
Karsten Hopp e97c6e
  	    wp = buf_jump_open_win(buf);
Karsten Hopp e97c6e
  	/* use existing open window in any tab page for buffer if wanted */
Karsten Hopp e97c6e
! 	if (vim_strchr(p_swb, 'a'))     /* usetab */
Karsten Hopp e97c6e
  	    wp = buf_jump_open_tab(buf);
Karsten Hopp e97c6e
  	/* split window if wanted ("split") */
Karsten Hopp e97c6e
! 	if (wp == NULL && vim_strchr(p_swb, 't') && !bufempty())
Karsten Hopp e97c6e
  	{
Karsten Hopp e97c6e
  	    if (win_split(0, 0) == FAIL)
Karsten Hopp e97c6e
  		return FAIL;
Karsten Hopp e97c6e
--- 1842,1854 ----
Karsten Hopp e97c6e
      if (options & GETF_SWITCH)
Karsten Hopp e97c6e
      {
Karsten Hopp e97c6e
  	/* use existing open window for buffer if wanted */
Karsten Hopp e97c6e
! 	if (vim_strchr(p_swb, 'o') != NULL)	/* useopen */
Karsten Hopp e97c6e
  	    wp = buf_jump_open_win(buf);
Karsten Hopp e97c6e
  	/* use existing open window in any tab page for buffer if wanted */
Karsten Hopp e97c6e
! 	if (vim_strchr(p_swb, 'a') != NULL)	/* usetab */
Karsten Hopp e97c6e
  	    wp = buf_jump_open_tab(buf);
Karsten Hopp e97c6e
  	/* split window if wanted ("split") */
Karsten Hopp e97c6e
! 	if (wp == NULL && vim_strchr(p_swb, 'l') != NULL && !bufempty())
Karsten Hopp e97c6e
  	{
Karsten Hopp e97c6e
  	    if (win_split(0, 0) == FAIL)
Karsten Hopp e97c6e
  		return FAIL;
Karsten Hopp e97c6e
*** ../vim-7.0.145/src/quickfix.c	Tue Sep  5 15:36:30 2006
Karsten Hopp e97c6e
--- src/quickfix.c	Fri Oct 20 20:05:00 2006
Karsten Hopp e97c6e
***************
Karsten Hopp e97c6e
*** 1586,1595 ****
Karsten Hopp e97c6e
  	    }
Karsten Hopp e97c6e
  
Karsten Hopp e97c6e
  	/*
Karsten Hopp e97c6e
! 	 * If there is only one window, create a new one above the quickfix
Karsten Hopp e97c6e
! 	 * window.
Karsten Hopp e97c6e
  	 */
Karsten Hopp e97c6e
! 	if (firstwin == lastwin || !usable_win)
Karsten Hopp e97c6e
  	{
Karsten Hopp e97c6e
  	    ll_ref = curwin->w_llist_ref;
Karsten Hopp e97c6e
  
Karsten Hopp e97c6e
--- 1586,1615 ----
Karsten Hopp e97c6e
  	    }
Karsten Hopp e97c6e
  
Karsten Hopp e97c6e
  	/*
Karsten Hopp e97c6e
! 	 * If no usable window is found and 'switchbuf' is set to 'usetab'
Karsten Hopp e97c6e
! 	 * then search in other tabs.
Karsten Hopp e97c6e
  	 */
Karsten Hopp e97c6e
! 	if (!usable_win && vim_strchr(p_swb, 'a') != NULL)
Karsten Hopp e97c6e
! 	{
Karsten Hopp e97c6e
! 	    tabpage_T	*tp;
Karsten Hopp e97c6e
! 	    win_T	*wp;
Karsten Hopp e97c6e
! 
Karsten Hopp e97c6e
! 	    FOR_ALL_TAB_WINDOWS(tp, wp)
Karsten Hopp e97c6e
! 	    {
Karsten Hopp e97c6e
! 		if (wp->w_buffer->b_fnum == qf_ptr->qf_fnum)
Karsten Hopp e97c6e
! 		{
Karsten Hopp e97c6e
! 		    goto_tabpage_win(tp, wp);
Karsten Hopp e97c6e
! 		    usable_win = 1;
Karsten Hopp e97c6e
! 		    break;
Karsten Hopp e97c6e
! 		}
Karsten Hopp e97c6e
! 	    }
Karsten Hopp e97c6e
! 	}
Karsten Hopp e97c6e
! 
Karsten Hopp e97c6e
! 	/*
Karsten Hopp e97c6e
! 	 * If there is only one window and is the quickfix window, create a new
Karsten Hopp e97c6e
! 	 * one above the quickfix window.
Karsten Hopp e97c6e
! 	 */
Karsten Hopp e97c6e
! 	if (((firstwin == lastwin) && bt_quickfix(curbuf)) || !usable_win)
Karsten Hopp e97c6e
  	{
Karsten Hopp e97c6e
  	    ll_ref = curwin->w_llist_ref;
Karsten Hopp e97c6e
  
Karsten Hopp e97c6e
*** ../vim-7.0.145/src/version.c	Tue Oct 17 22:40:14 2006
Karsten Hopp e97c6e
--- src/version.c	Fri Oct 20 20:11:58 2006
Karsten Hopp e97c6e
***************
Karsten Hopp e97c6e
*** 668,669 ****
Karsten Hopp e97c6e
--- 668,671 ----
Karsten Hopp e97c6e
  {   /* Add new patch number below this line */
Karsten Hopp e97c6e
+ /**/
Karsten Hopp e97c6e
+     146,
Karsten Hopp e97c6e
  /**/
Karsten Hopp e97c6e
Karsten Hopp e97c6e
-- 
Karsten Hopp e97c6e
hundred-and-one symptoms of being an internet addict:
Karsten Hopp e97c6e
80. At parties, you introduce your spouse as your "service provider."
Karsten Hopp e97c6e
Karsten Hopp e97c6e
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp e97c6e
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp e97c6e
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp e97c6e
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///