Karsten Hopp 97760f
To: vim_dev@googlegroups.com
Karsten Hopp 97760f
Subject: Patch 7.3.756
Karsten Hopp 97760f
Fcc: outbox
Karsten Hopp 97760f
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 97760f
Mime-Version: 1.0
Karsten Hopp 97760f
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 97760f
Content-Transfer-Encoding: 8bit
Karsten Hopp 97760f
------------
Karsten Hopp 97760f
Karsten Hopp 97760f
Patch 7.3.756
Karsten Hopp 97760f
Problem:    A location list can get a wrong count in :lvimgrep.
Karsten Hopp 97760f
Solution:   Check if the list was changed by autocommands. (mostly by
Karsten Hopp 97760f
	    Christian Brabandt)
Karsten Hopp 97760f
Files:	    src/quickfic.c
Karsten Hopp 97760f
Karsten Hopp 97760f
Karsten Hopp 97760f
*** ../vim-7.3.755/src/quickfix.c	2012-12-05 15:16:42.000000000 +0100
Karsten Hopp 97760f
--- src/quickfix.c	2012-12-12 15:50:08.000000000 +0100
Karsten Hopp 97760f
***************
Karsten Hopp 97760f
*** 3109,3114 ****
Karsten Hopp 97760f
--- 3109,3117 ----
Karsten Hopp 97760f
      char_u	*p;
Karsten Hopp 97760f
      int		fi;
Karsten Hopp 97760f
      qf_info_T	*qi = &ql_info;
Karsten Hopp 97760f
+ #ifdef FEAT_AUTOCMD
Karsten Hopp 97760f
+     qfline_T	*cur_qf_start;
Karsten Hopp 97760f
+ #endif
Karsten Hopp 97760f
      qfline_T	*prevp = NULL;
Karsten Hopp 97760f
      long	lnum;
Karsten Hopp 97760f
      buf_T	*buf;
Karsten Hopp 97760f
***************
Karsten Hopp 97760f
*** 3218,3223 ****
Karsten Hopp 97760f
--- 3221,3232 ----
Karsten Hopp 97760f
       * ":lcd %:p:h" changes the meaning of short path names. */
Karsten Hopp 97760f
      mch_dirname(dirname_start, MAXPATHL);
Karsten Hopp 97760f
  
Karsten Hopp 97760f
+ #ifdef FEAT_AUTOCMD
Karsten Hopp 97760f
+      /* Remeber the value of qf_start, so that we can check for autocommands
Karsten Hopp 97760f
+       * changing the current quickfix list. */
Karsten Hopp 97760f
+     cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
Karsten Hopp 97760f
+ #endif
Karsten Hopp 97760f
+ 
Karsten Hopp 97760f
      seconds = (time_t)0;
Karsten Hopp 97760f
      for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi)
Karsten Hopp 97760f
      {
Karsten Hopp 97760f
***************
Karsten Hopp 97760f
*** 3273,3278 ****
Karsten Hopp 97760f
--- 3282,3309 ----
Karsten Hopp 97760f
  	    /* Use existing, loaded buffer. */
Karsten Hopp 97760f
  	    using_dummy = FALSE;
Karsten Hopp 97760f
  
Karsten Hopp 97760f
+ #ifdef FEAT_AUTOCMD
Karsten Hopp 97760f
+ 	if (cur_qf_start != qi->qf_lists[qi->qf_curlist].qf_start)
Karsten Hopp 97760f
+ 	{
Karsten Hopp 97760f
+ 	    int idx;
Karsten Hopp 97760f
+ 
Karsten Hopp 97760f
+ 	    /* Autocommands changed the quickfix list.  Find the one we were
Karsten Hopp 97760f
+ 	     * using and restore it. */
Karsten Hopp 97760f
+ 	    for (idx = 0; idx < LISTCOUNT; ++idx)
Karsten Hopp 97760f
+ 		if (cur_qf_start == qi->qf_lists[idx].qf_start)
Karsten Hopp 97760f
+ 		{
Karsten Hopp 97760f
+ 		    qi->qf_curlist = idx;
Karsten Hopp 97760f
+ 		    break;
Karsten Hopp 97760f
+ 		}
Karsten Hopp 97760f
+ 	    if (idx == LISTCOUNT)
Karsten Hopp 97760f
+ 	    {
Karsten Hopp 97760f
+ 		/* List cannot be found, create a new one. */
Karsten Hopp 97760f
+ 		qf_new_list(qi, *eap->cmdlinep);
Karsten Hopp 97760f
+ 		cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
Karsten Hopp 97760f
+ 	    }
Karsten Hopp 97760f
+ 	}
Karsten Hopp 97760f
+ #endif
Karsten Hopp 97760f
+ 
Karsten Hopp 97760f
  	if (buf == NULL)
Karsten Hopp 97760f
  	{
Karsten Hopp 97760f
  	    if (!got_int)
Karsten Hopp 97760f
***************
Karsten Hopp 97760f
*** 3324,3329 ****
Karsten Hopp 97760f
--- 3355,3363 ----
Karsten Hopp 97760f
  		if (got_int)
Karsten Hopp 97760f
  		    break;
Karsten Hopp 97760f
  	    }
Karsten Hopp 97760f
+ #ifdef FEAT_AUTOCMD
Karsten Hopp 97760f
+ 	    cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
Karsten Hopp 97760f
+ #endif
Karsten Hopp 97760f
  
Karsten Hopp 97760f
  	    if (using_dummy)
Karsten Hopp 97760f
  	    {
Karsten Hopp 97760f
*** ../vim-7.3.755/src/version.c	2012-12-12 14:25:01.000000000 +0100
Karsten Hopp 97760f
--- src/version.c	2012-12-12 15:35:58.000000000 +0100
Karsten Hopp 97760f
***************
Karsten Hopp 97760f
*** 727,728 ****
Karsten Hopp 97760f
--- 727,730 ----
Karsten Hopp 97760f
  {   /* Add new patch number below this line */
Karsten Hopp 97760f
+ /**/
Karsten Hopp 97760f
+     756,
Karsten Hopp 97760f
  /**/
Karsten Hopp 97760f
Karsten Hopp 97760f
-- 
Karsten Hopp 97760f
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 97760f
146. You experience ACTUAL physical withdrawal symptoms when away
Karsten Hopp 97760f
     from your 'puter and the net.
Karsten Hopp 97760f
Karsten Hopp 97760f
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 97760f
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 97760f
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 97760f
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///