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