3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.378
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.378
3ef2ca
Problem:    Title of quickfist list is not kept for setqflist(list, 'r').
3ef2ca
Solution:   Keep the title.  Add a test. (Lcd)
3ef2ca
Files:	    src/quickfix.c, src/testdir/Make_amiga.mak,
3ef2ca
	    src/testdir/Make_dos.mak, src/testdir/Make_ming.mak,
3ef2ca
	    src/testdir/Make_os2.mak, src/testdir/Make_vms.mms,
3ef2ca
	    src/testdir/Makefile, src/testdir/test_qf_title.in,
3ef2ca
	    src/testdir/test_qf_title.ok
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.377/src/quickfix.c	2014-03-27 17:02:22.080660944 +0100
3ef2ca
--- src/quickfix.c	2014-07-23 15:37:30.551910459 +0200
3ef2ca
***************
3ef2ca
*** 107,112 ****
3ef2ca
--- 107,113 ----
3ef2ca
  };
3ef2ca
  
3ef2ca
  static int	qf_init_ext __ARGS((qf_info_T *qi, char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast, char_u *qf_title));
3ef2ca
+ static void	qf_store_title __ARGS((qf_info_T *qi, char_u *title));
3ef2ca
  static void	qf_new_list __ARGS((qf_info_T *qi, char_u *qf_title));
3ef2ca
  static void	ll_free_all __ARGS((qf_info_T **pqi));
3ef2ca
  static int	qf_add_entry __ARGS((qf_info_T *qi, qfline_T **prevp, char_u *dir, char_u *fname, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid));
3ef2ca
***************
3ef2ca
*** 126,132 ****
3ef2ca
  static win_T	*qf_find_win __ARGS((qf_info_T *qi));
3ef2ca
  static buf_T	*qf_find_buf __ARGS((qf_info_T *qi));
3ef2ca
  static void	qf_update_buffer __ARGS((qf_info_T *qi));
3ef2ca
! static void	qf_set_title __ARGS((qf_info_T *qi));
3ef2ca
  static void	qf_fill_buffer __ARGS((qf_info_T *qi));
3ef2ca
  #endif
3ef2ca
  static char_u	*get_mef_name __ARGS((void));
3ef2ca
--- 127,133 ----
3ef2ca
  static win_T	*qf_find_win __ARGS((qf_info_T *qi));
3ef2ca
  static buf_T	*qf_find_buf __ARGS((qf_info_T *qi));
3ef2ca
  static void	qf_update_buffer __ARGS((qf_info_T *qi));
3ef2ca
! static void	qf_set_title_var __ARGS((qf_info_T *qi));
3ef2ca
  static void	qf_fill_buffer __ARGS((qf_info_T *qi));
3ef2ca
  #endif
3ef2ca
  static char_u	*get_mef_name __ARGS((void));
3ef2ca
***************
3ef2ca
*** 884,889 ****
3ef2ca
--- 885,905 ----
3ef2ca
      return retval;
3ef2ca
  }
3ef2ca
  
3ef2ca
+     static void
3ef2ca
+ qf_store_title(qi, title)
3ef2ca
+     qf_info_T	*qi;
3ef2ca
+     char_u	*title;
3ef2ca
+ {
3ef2ca
+     if (title != NULL)
3ef2ca
+     {
3ef2ca
+ 	char_u *p = alloc((int)STRLEN(title) + 2);
3ef2ca
+ 
3ef2ca
+ 	qi->qf_lists[qi->qf_curlist].qf_title = p;
3ef2ca
+ 	if (p != NULL)
3ef2ca
+ 	    sprintf((char *)p, ":%s", (char *)title);
3ef2ca
+     }
3ef2ca
+ }
3ef2ca
+ 
3ef2ca
  /*
3ef2ca
   * Prepare for adding a new quickfix list.
3ef2ca
   */
3ef2ca
***************
3ef2ca
*** 895,901 ****
3ef2ca
      int		i;
3ef2ca
  
3ef2ca
      /*
3ef2ca
!      * If the current entry is not the last entry, delete entries below
3ef2ca
       * the current entry.  This makes it possible to browse in a tree-like
3ef2ca
       * way with ":grep'.
3ef2ca
       */
3ef2ca
--- 911,917 ----
3ef2ca
      int		i;
3ef2ca
  
3ef2ca
      /*
3ef2ca
!      * If the current entry is not the last entry, delete entries beyond
3ef2ca
       * the current entry.  This makes it possible to browse in a tree-like
3ef2ca
       * way with ":grep'.
3ef2ca
       */
3ef2ca
***************
3ef2ca
*** 916,929 ****
3ef2ca
      else
3ef2ca
  	qi->qf_curlist = qi->qf_listcount++;
3ef2ca
      vim_memset(&qi->qf_lists[qi->qf_curlist], 0, (size_t)(sizeof(qf_list_T)));
3ef2ca
!     if (qf_title != NULL)
3ef2ca
!     {
3ef2ca
! 	char_u *p = alloc((int)STRLEN(qf_title) + 2);
3ef2ca
! 
3ef2ca
! 	qi->qf_lists[qi->qf_curlist].qf_title = p;
3ef2ca
! 	if (p != NULL)
3ef2ca
! 	    sprintf((char *)p, ":%s", (char *)qf_title);
3ef2ca
!     }
3ef2ca
  }
3ef2ca
  
3ef2ca
  /*
3ef2ca
--- 932,938 ----
3ef2ca
      else
3ef2ca
  	qi->qf_curlist = qi->qf_listcount++;
3ef2ca
      vim_memset(&qi->qf_lists[qi->qf_curlist], 0, (size_t)(sizeof(qf_list_T)));
3ef2ca
!     qf_store_title(qi, qf_title);
3ef2ca
  }
3ef2ca
  
3ef2ca
  /*
3ef2ca
***************
3ef2ca
*** 2444,2450 ****
3ef2ca
      qf_fill_buffer(qi);
3ef2ca
  
3ef2ca
      if (qi->qf_lists[qi->qf_curlist].qf_title != NULL)
3ef2ca
! 	qf_set_title(qi);
3ef2ca
  
3ef2ca
      curwin->w_cursor.lnum = qi->qf_lists[qi->qf_curlist].qf_index;
3ef2ca
      curwin->w_cursor.col = 0;
3ef2ca
--- 2453,2459 ----
3ef2ca
      qf_fill_buffer(qi);
3ef2ca
  
3ef2ca
      if (qi->qf_lists[qi->qf_curlist].qf_title != NULL)
3ef2ca
! 	qf_set_title_var(qi);
3ef2ca
  
3ef2ca
      curwin->w_cursor.lnum = qi->qf_lists[qi->qf_curlist].qf_index;
3ef2ca
      curwin->w_cursor.col = 0;
3ef2ca
***************
3ef2ca
*** 2599,2605 ****
3ef2ca
  	{
3ef2ca
  	    curwin_save = curwin;
3ef2ca
  	    curwin = win;
3ef2ca
! 	    qf_set_title(qi);
3ef2ca
  	    curwin = curwin_save;
3ef2ca
  
3ef2ca
  	}
3ef2ca
--- 2608,2614 ----
3ef2ca
  	{
3ef2ca
  	    curwin_save = curwin;
3ef2ca
  	    curwin = win;
3ef2ca
! 	    qf_set_title_var(qi);
3ef2ca
  	    curwin = curwin_save;
3ef2ca
  
3ef2ca
  	}
3ef2ca
***************
3ef2ca
*** 2612,2618 ****
3ef2ca
  }
3ef2ca
  
3ef2ca
      static void
3ef2ca
! qf_set_title(qi)
3ef2ca
      qf_info_T	*qi;
3ef2ca
  {
3ef2ca
      set_internal_string_var((char_u *)"w:quickfix_title",
3ef2ca
--- 2621,2627 ----
3ef2ca
  }
3ef2ca
  
3ef2ca
      static void
3ef2ca
! qf_set_title_var(qi)
3ef2ca
      qf_info_T	*qi;
3ef2ca
  {
3ef2ca
      set_internal_string_var((char_u *)"w:quickfix_title",
3ef2ca
***************
3ef2ca
*** 3845,3851 ****
3ef2ca
--- 3854,3863 ----
3ef2ca
  	     prevp->qf_next != prevp; prevp = prevp->qf_next)
3ef2ca
  	    ;
3ef2ca
      else if (action == 'r')
3ef2ca
+     {
3ef2ca
  	qf_free(qi, qi->qf_curlist);
3ef2ca
+ 	qf_store_title(qi, title);
3ef2ca
+     }
3ef2ca
  
3ef2ca
      for (li = list->lv_first; li != NULL; li = li->li_next)
3ef2ca
      {
3ef2ca
*** ../vim-7.4.377/src/testdir/Make_amiga.mak	2014-07-16 17:01:38.275570568 +0200
3ef2ca
--- src/testdir/Make_amiga.mak	2014-07-23 15:26:51.455915053 +0200
3ef2ca
***************
3ef2ca
*** 40,45 ****
3ef2ca
--- 40,46 ----
3ef2ca
  		test_breakindent.out \
3ef2ca
  		test_listlbr.out \
3ef2ca
  		test_listlbr_utf8.out \
3ef2ca
+ 		test_qf_title.out \
3ef2ca
  		test_eval.out \
3ef2ca
  		test_options.out
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 169,173 ****
3ef2ca
--- 170,175 ----
3ef2ca
  test_breakindent.out: test_breakindent.in
3ef2ca
  test_listlbr.out: test_listlbr.in
3ef2ca
  test_listlbr_utf8.out: test_listlbr_utf8.in
3ef2ca
+ test_qf_title.out: test_qf_title.in
3ef2ca
  test_eval.out: test_eval.in
3ef2ca
  test_options.out: test_options.in
3ef2ca
*** ../vim-7.4.377/src/testdir/Make_dos.mak	2014-07-16 17:01:38.279570568 +0200
3ef2ca
--- src/testdir/Make_dos.mak	2014-07-23 15:27:01.231914983 +0200
3ef2ca
***************
3ef2ca
*** 39,44 ****
3ef2ca
--- 39,45 ----
3ef2ca
  		test_breakindent.out \
3ef2ca
  		test_listlbr.out \
3ef2ca
  		test_listlbr_utf8.out \
3ef2ca
+ 		test_qf_title.out \
3ef2ca
  		test_eval.out \
3ef2ca
  		test_options.out
3ef2ca
  
3ef2ca
*** ../vim-7.4.377/src/testdir/Make_ming.mak	2014-07-16 17:01:38.279570568 +0200
3ef2ca
--- src/testdir/Make_ming.mak	2014-07-23 15:27:13.163914897 +0200
3ef2ca
***************
3ef2ca
*** 59,64 ****
3ef2ca
--- 59,65 ----
3ef2ca
  		test_breakindent.out \
3ef2ca
  		test_listlbr.out \
3ef2ca
  		test_listlbr_utf8.out \
3ef2ca
+ 		test_qf_title.out \
3ef2ca
  		test_eval.out \
3ef2ca
  		test_options.out
3ef2ca
  
3ef2ca
*** ../vim-7.4.377/src/testdir/Make_os2.mak	2014-07-16 17:01:38.279570568 +0200
3ef2ca
--- src/testdir/Make_os2.mak	2014-07-23 15:27:25.999914805 +0200
3ef2ca
***************
3ef2ca
*** 40,47 ****
3ef2ca
  		test_autoformat_join.out \
3ef2ca
  		test_eval.out \
3ef2ca
  		test_breakindent.out \
3ef2ca
- 		test_listlbr_utf8.out \
3ef2ca
  		test_listlbr.out \
3ef2ca
  		test_options.out
3ef2ca
  
3ef2ca
  .SUFFIXES: .in .out
3ef2ca
--- 40,48 ----
3ef2ca
  		test_autoformat_join.out \
3ef2ca
  		test_eval.out \
3ef2ca
  		test_breakindent.out \
3ef2ca
  		test_listlbr.out \
3ef2ca
+ 		test_listlbr_utf8.out \
3ef2ca
+ 		test_qf_title.out \
3ef2ca
  		test_options.out
3ef2ca
  
3ef2ca
  .SUFFIXES: .in .out
3ef2ca
*** ../vim-7.4.377/src/testdir/Make_vms.mms	2014-07-16 17:01:38.279570568 +0200
3ef2ca
--- src/testdir/Make_vms.mms	2014-07-23 15:27:34.787914741 +0200
3ef2ca
***************
3ef2ca
*** 4,10 ****
3ef2ca
  # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
3ef2ca
  #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
3ef2ca
  #
3ef2ca
! # Last change:  2014 May 28
3ef2ca
  #
3ef2ca
  # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
3ef2ca
  # Edit the lines in the Configuration section below to select.
3ef2ca
--- 4,10 ----
3ef2ca
  # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
3ef2ca
  #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
3ef2ca
  #
3ef2ca
! # Last change:  2014 Jul 23
3ef2ca
  #
3ef2ca
  # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
3ef2ca
  # Edit the lines in the Configuration section below to select.
3ef2ca
***************
3ef2ca
*** 100,105 ****
3ef2ca
--- 100,106 ----
3ef2ca
  	 test_breakindent.out \
3ef2ca
  	 test_listlbr.out \
3ef2ca
  	 test_listlbr_utf8.out \
3ef2ca
+ 	 test_qf_title.out \
3ef2ca
  	 test_eval.out \
3ef2ca
  	 test_options.out
3ef2ca
  
3ef2ca
*** ../vim-7.4.377/src/testdir/Makefile	2014-07-16 17:01:38.279570568 +0200
3ef2ca
--- src/testdir/Makefile	2014-07-23 15:27:46.947914654 +0200
3ef2ca
***************
3ef2ca
*** 37,42 ****
3ef2ca
--- 37,43 ----
3ef2ca
  		test_breakindent.out \
3ef2ca
  		test_listlbr.out \
3ef2ca
  		test_listlbr_utf8.out \
3ef2ca
+ 		test_qf_title.out \
3ef2ca
  		test_eval.out \
3ef2ca
  		test_options.out
3ef2ca
  
3ef2ca
*** ../vim-7.4.377/src/testdir/test_qf_title.in	2014-07-23 15:53:26.279903590 +0200
3ef2ca
--- src/testdir/test_qf_title.in	2014-07-23 15:26:02.495915405 +0200
3ef2ca
***************
3ef2ca
*** 0 ****
3ef2ca
--- 1,18 ----
3ef2ca
+ Tests for quickfix window's title     vim: set ft=vim :
3ef2ca
+ 
3ef2ca
+ STARTTEST
3ef2ca
+ :so small.vim
3ef2ca
+ :if !has('quickfix') | e! test.ok | wq! test.out | endif
3ef2ca
+ :set efm=%E%f:%l:%c:%m
3ef2ca
+ :cgetexpr ['file:1:1:message']
3ef2ca
+ :let qflist=getqflist()
3ef2ca
+ :call setqflist(qflist, 'r')
3ef2ca
+ :copen
3ef2ca
+ :let g:quickfix_title=w:quickfix_title
3ef2ca
+ :wincmd p
3ef2ca
+ :$put =g:quickfix_title
3ef2ca
+ :/^Results/,$w test.out
3ef2ca
+ :qa!
3ef2ca
+ ENDTEST
3ef2ca
+ 
3ef2ca
+ Results of test_qf_title:
3ef2ca
*** ../vim-7.4.377/src/testdir/test_qf_title.ok	2014-07-23 15:53:26.283903590 +0200
3ef2ca
--- src/testdir/test_qf_title.ok	2014-07-23 15:25:55.303915456 +0200
3ef2ca
***************
3ef2ca
*** 0 ****
3ef2ca
--- 1,2 ----
3ef2ca
+ Results of test_qf_title:
3ef2ca
+ :setqflist()
3ef2ca
*** ../vim-7.4.377/src/version.c	2014-07-23 15:21:16.247917462 +0200
3ef2ca
--- src/version.c	2014-07-23 15:28:57.251914149 +0200
3ef2ca
***************
3ef2ca
*** 736,737 ****
3ef2ca
--- 736,739 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     378,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
ARTHUR: Old woman!
3ef2ca
DENNIS: Man!
3ef2ca
ARTHUR: Man.  I'm sorry.  Old man, What knight live in that castle over there?
3ef2ca
DENNIS: I'm thirty-seven.
3ef2ca
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///