Karsten Hopp fada63
To: vim_dev@googlegroups.com
Karsten Hopp fada63
Subject: Patch 7.3.1274
Karsten Hopp fada63
Fcc: outbox
Karsten Hopp fada63
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp fada63
Mime-Version: 1.0
Karsten Hopp fada63
Content-Type: text/plain; charset=UTF-8
Karsten Hopp fada63
Content-Transfer-Encoding: 8bit
Karsten Hopp fada63
------------
Karsten Hopp fada63
Karsten Hopp fada63
Patch 7.3.1274
Karsten Hopp fada63
Problem:    When selecting an entry from a location list it may pick an
Karsten Hopp fada63
	    arbitrary window or open a new one.
Karsten Hopp fada63
Solution:   Prefer using a window related to the location list. (Lech Lorens)
Karsten Hopp fada63
Files:	    src/quickfix.c
Karsten Hopp fada63
Karsten Hopp fada63
Karsten Hopp fada63
*** ../vim-7.3.1273/src/quickfix.c	2013-06-30 13:33:53.000000000 +0200
Karsten Hopp fada63
--- src/quickfix.c	2013-06-30 13:48:25.000000000 +0200
Karsten Hopp fada63
***************
Karsten Hopp fada63
*** 1616,1621 ****
Karsten Hopp fada63
--- 1616,1623 ----
Karsten Hopp fada63
       */
Karsten Hopp fada63
      if (bt_quickfix(curbuf) && !opened_window)
Karsten Hopp fada63
      {
Karsten Hopp fada63
+ 	win_T *usable_win_ptr = NULL;
Karsten Hopp fada63
+ 
Karsten Hopp fada63
  	/*
Karsten Hopp fada63
  	 * If there is no file specified, we don't know where to go.
Karsten Hopp fada63
  	 * But do advance, otherwise ":cn" gets stuck.
Karsten Hopp fada63
***************
Karsten Hopp fada63
*** 1623,1636 ****
Karsten Hopp fada63
  	if (qf_ptr->qf_fnum == 0)
Karsten Hopp fada63
  	    goto theend;
Karsten Hopp fada63
  
Karsten Hopp fada63
- 	/* Locate a window showing a normal buffer */
Karsten Hopp fada63
  	usable_win = 0;
Karsten Hopp fada63
! 	FOR_ALL_WINDOWS(win)
Karsten Hopp fada63
! 	    if (win->w_buffer->b_p_bt[0] == NUL)
Karsten Hopp fada63
! 	    {
Karsten Hopp fada63
! 		usable_win = 1;
Karsten Hopp fada63
! 		break;
Karsten Hopp fada63
! 	    }
Karsten Hopp fada63
  
Karsten Hopp fada63
  	/*
Karsten Hopp fada63
  	 * If no usable window is found and 'switchbuf' contains "usetab"
Karsten Hopp fada63
--- 1625,1653 ----
Karsten Hopp fada63
  	if (qf_ptr->qf_fnum == 0)
Karsten Hopp fada63
  	    goto theend;
Karsten Hopp fada63
  
Karsten Hopp fada63
  	usable_win = 0;
Karsten Hopp fada63
! 
Karsten Hopp fada63
! 	ll_ref = curwin->w_llist_ref;
Karsten Hopp fada63
! 	if (ll_ref != NULL)
Karsten Hopp fada63
! 	{
Karsten Hopp fada63
! 	    /* Find a window using the same location list that is not a
Karsten Hopp fada63
! 	     * quickfix window. */
Karsten Hopp fada63
! 	    FOR_ALL_WINDOWS(usable_win_ptr)
Karsten Hopp fada63
! 		if (usable_win_ptr->w_llist == ll_ref
Karsten Hopp fada63
! 			&& usable_win_ptr->w_buffer->b_p_bt[0] != 'q')
Karsten Hopp fada63
! 		    break;
Karsten Hopp fada63
! 	}
Karsten Hopp fada63
! 
Karsten Hopp fada63
! 	if (!usable_win)
Karsten Hopp fada63
! 	{
Karsten Hopp fada63
! 	    /* Locate a window showing a normal buffer */
Karsten Hopp fada63
! 	    FOR_ALL_WINDOWS(win)
Karsten Hopp fada63
! 		if (win->w_buffer->b_p_bt[0] == NUL)
Karsten Hopp fada63
! 		{
Karsten Hopp fada63
! 		    usable_win = 1;
Karsten Hopp fada63
! 		    break;
Karsten Hopp fada63
! 		}
Karsten Hopp fada63
! 	}
Karsten Hopp fada63
  
Karsten Hopp fada63
  	/*
Karsten Hopp fada63
  	 * If no usable window is found and 'switchbuf' contains "usetab"
Karsten Hopp fada63
***************
Karsten Hopp fada63
*** 1659,1666 ****
Karsten Hopp fada63
  	 */
Karsten Hopp fada63
  	if (((firstwin == lastwin) && bt_quickfix(curbuf)) || !usable_win)
Karsten Hopp fada63
  	{
Karsten Hopp fada63
- 	    ll_ref = curwin->w_llist_ref;
Karsten Hopp fada63
- 
Karsten Hopp fada63
  	    flags = WSP_ABOVE;
Karsten Hopp fada63
  	    if (ll_ref != NULL)
Karsten Hopp fada63
  		flags |= WSP_NEWLOC;
Karsten Hopp fada63
--- 1676,1681 ----
Karsten Hopp fada63
***************
Karsten Hopp fada63
*** 1683,1694 ****
Karsten Hopp fada63
  	    if (curwin->w_llist_ref != NULL)
Karsten Hopp fada63
  	    {
Karsten Hopp fada63
  		/* In a location window */
Karsten Hopp fada63
! 		ll_ref = curwin->w_llist_ref;
Karsten Hopp fada63
! 
Karsten Hopp fada63
! 		/* Find the window with the same location list */
Karsten Hopp fada63
! 		FOR_ALL_WINDOWS(win)
Karsten Hopp fada63
! 		    if (win->w_llist == ll_ref)
Karsten Hopp fada63
! 			break;
Karsten Hopp fada63
  		if (win == NULL)
Karsten Hopp fada63
  		{
Karsten Hopp fada63
  		    /* Find the window showing the selected file */
Karsten Hopp fada63
--- 1698,1704 ----
Karsten Hopp fada63
  	    if (curwin->w_llist_ref != NULL)
Karsten Hopp fada63
  	    {
Karsten Hopp fada63
  		/* In a location window */
Karsten Hopp fada63
! 		win = usable_win_ptr;
Karsten Hopp fada63
  		if (win == NULL)
Karsten Hopp fada63
  		{
Karsten Hopp fada63
  		    /* Find the window showing the selected file */
Karsten Hopp fada63
*** ../vim-7.3.1273/src/version.c	2013-06-30 13:33:53.000000000 +0200
Karsten Hopp fada63
--- src/version.c	2013-06-30 13:56:35.000000000 +0200
Karsten Hopp fada63
***************
Karsten Hopp fada63
*** 730,731 ****
Karsten Hopp fada63
--- 730,733 ----
Karsten Hopp fada63
  {   /* Add new patch number below this line */
Karsten Hopp fada63
+ /**/
Karsten Hopp fada63
+     1274,
Karsten Hopp fada63
  /**/
Karsten Hopp fada63
Karsten Hopp fada63
-- 
Karsten Hopp fada63
Witches prefer brooms: vacuum-cleaners need extension cords!
Karsten Hopp fada63
Karsten Hopp fada63
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp fada63
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp fada63
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp fada63
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///