Skip to content

Commit bc131b2

Browse files
committed
updated for version 7.4.378
Problem: Title of quickfist list is not kept for setqflist(list, 'r'). Solution: Keep the title. Add a test. (Lcd)
1 parent 9475838 commit bc131b2

File tree

10 files changed

+56
-15
lines changed

10 files changed

+56
-15
lines changed

src/quickfix.c

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ struct efm_S
107107
};
108108

109109
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));
110+
static void qf_store_title __ARGS((qf_info_T *qi, char_u *title));
110111
static void qf_new_list __ARGS((qf_info_T *qi, char_u *qf_title));
111112
static void ll_free_all __ARGS((qf_info_T **pqi));
112113
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,7 +127,7 @@ static int is_qf_win __ARGS((win_T *win, qf_info_T *qi));
126127
static win_T *qf_find_win __ARGS((qf_info_T *qi));
127128
static buf_T *qf_find_buf __ARGS((qf_info_T *qi));
128129
static void qf_update_buffer __ARGS((qf_info_T *qi));
129-
static void qf_set_title __ARGS((qf_info_T *qi));
130+
static void qf_set_title_var __ARGS((qf_info_T *qi));
130131
static void qf_fill_buffer __ARGS((qf_info_T *qi));
131132
#endif
132133
static char_u *get_mef_name __ARGS((void));
@@ -884,6 +885,21 @@ qf_init_ext(qi, efile, buf, tv, errorformat, newlist, lnumfirst, lnumlast,
884885
return retval;
885886
}
886887

888+
static void
889+
qf_store_title(qi, title)
890+
qf_info_T *qi;
891+
char_u *title;
892+
{
893+
if (title != NULL)
894+
{
895+
char_u *p = alloc((int)STRLEN(title) + 2);
896+
897+
qi->qf_lists[qi->qf_curlist].qf_title = p;
898+
if (p != NULL)
899+
sprintf((char *)p, ":%s", (char *)title);
900+
}
901+
}
902+
887903
/*
888904
* Prepare for adding a new quickfix list.
889905
*/
@@ -895,7 +911,7 @@ qf_new_list(qi, qf_title)
895911
int i;
896912

897913
/*
898-
* If the current entry is not the last entry, delete entries below
914+
* If the current entry is not the last entry, delete entries beyond
899915
* the current entry. This makes it possible to browse in a tree-like
900916
* way with ":grep'.
901917
*/
@@ -916,14 +932,7 @@ qf_new_list(qi, qf_title)
916932
else
917933
qi->qf_curlist = qi->qf_listcount++;
918934
vim_memset(&qi->qf_lists[qi->qf_curlist], 0, (size_t)(sizeof(qf_list_T)));
919-
if (qf_title != NULL)
920-
{
921-
char_u *p = alloc((int)STRLEN(qf_title) + 2);
922-
923-
qi->qf_lists[qi->qf_curlist].qf_title = p;
924-
if (p != NULL)
925-
sprintf((char *)p, ":%s", (char *)qf_title);
926-
}
935+
qf_store_title(qi, qf_title);
927936
}
928937

929938
/*
@@ -2444,7 +2453,7 @@ ex_copen(eap)
24442453
qf_fill_buffer(qi);
24452454

24462455
if (qi->qf_lists[qi->qf_curlist].qf_title != NULL)
2447-
qf_set_title(qi);
2456+
qf_set_title_var(qi);
24482457

24492458
curwin->w_cursor.lnum = qi->qf_lists[qi->qf_curlist].qf_index;
24502459
curwin->w_cursor.col = 0;
@@ -2599,7 +2608,7 @@ qf_update_buffer(qi)
25992608
{
26002609
curwin_save = curwin;
26012610
curwin = win;
2602-
qf_set_title(qi);
2611+
qf_set_title_var(qi);
26032612
curwin = curwin_save;
26042613

26052614
}
@@ -2612,7 +2621,7 @@ qf_update_buffer(qi)
26122621
}
26132622

26142623
static void
2615-
qf_set_title(qi)
2624+
qf_set_title_var(qi)
26162625
qf_info_T *qi;
26172626
{
26182627
set_internal_string_var((char_u *)"w:quickfix_title",
@@ -3845,7 +3854,10 @@ set_errorlist(wp, list, action, title)
38453854
prevp->qf_next != prevp; prevp = prevp->qf_next)
38463855
;
38473856
else if (action == 'r')
3857+
{
38483858
qf_free(qi, qi->qf_curlist);
3859+
qf_store_title(qi, title);
3860+
}
38493861

38503862
for (li = list->lv_first; li != NULL; li = li->li_next)
38513863
{

src/testdir/Make_amiga.mak

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
4040
test_breakindent.out \
4141
test_listlbr.out \
4242
test_listlbr_utf8.out \
43+
test_qf_title.out \
4344
test_eval.out \
4445
test_options.out
4546

@@ -169,5 +170,6 @@ test_autoformat_join.out: test_autoformat_join.in
169170
test_breakindent.out: test_breakindent.in
170171
test_listlbr.out: test_listlbr.in
171172
test_listlbr_utf8.out: test_listlbr_utf8.in
173+
test_qf_title.out: test_qf_title.in
172174
test_eval.out: test_eval.in
173175
test_options.out: test_options.in

src/testdir/Make_dos.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
3939
test_breakindent.out \
4040
test_listlbr.out \
4141
test_listlbr_utf8.out \
42+
test_qf_title.out \
4243
test_eval.out \
4344
test_options.out
4445

src/testdir/Make_ming.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
5959
test_breakindent.out \
6060
test_listlbr.out \
6161
test_listlbr_utf8.out \
62+
test_qf_title.out \
6263
test_eval.out \
6364
test_options.out
6465

src/testdir/Make_os2.mak

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
4040
test_autoformat_join.out \
4141
test_eval.out \
4242
test_breakindent.out \
43-
test_listlbr_utf8.out \
4443
test_listlbr.out \
44+
test_listlbr_utf8.out \
45+
test_qf_title.out \
4546
test_options.out
4647

4748
.SUFFIXES: .in .out

src/testdir/Make_vms.mms

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Authors: Zoltan Arpadffy, <[email protected]>
55
# Sandor Kopanyi, <[email protected]>
66
#
7-
# Last change: 2014 May 28
7+
# Last change: 2014 Jul 23
88
#
99
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
1010
# Edit the lines in the Configuration section below to select.
@@ -100,6 +100,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
100100
test_breakindent.out \
101101
test_listlbr.out \
102102
test_listlbr_utf8.out \
103+
test_qf_title.out \
103104
test_eval.out \
104105
test_options.out
105106

src/testdir/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
3737
test_breakindent.out \
3838
test_listlbr.out \
3939
test_listlbr_utf8.out \
40+
test_qf_title.out \
4041
test_eval.out \
4142
test_options.out
4243

src/testdir/test_qf_title.in

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Tests for quickfix window's title vim: set ft=vim :
2+
3+
STARTTEST
4+
:so small.vim
5+
:if !has('quickfix') | e! test.ok | wq! test.out | endif
6+
:set efm=%E%f:%l:%c:%m
7+
:cgetexpr ['file:1:1:message']
8+
:let qflist=getqflist()
9+
:call setqflist(qflist, 'r')
10+
:copen
11+
:let g:quickfix_title=w:quickfix_title
12+
:wincmd p
13+
:$put =g:quickfix_title
14+
:/^Results/,$w test.out
15+
:qa!
16+
ENDTEST
17+
18+
Results of test_qf_title:

src/testdir/test_qf_title.ok

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Results of test_qf_title:
2+
:setqflist()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
378,
737739
/**/
738740
377,
739741
/**/

0 commit comments

Comments
 (0)