Skip to content

Commit

Permalink
updated for version 7.4.378
Browse files Browse the repository at this point in the history
Problem:    Title of quickfist list is not kept for setqflist(list, 'r').
Solution:   Keep the title.  Add a test. (Lcd)
  • Loading branch information
brammool committed Jul 23, 2014
1 parent 9475838 commit bc131b2
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 15 deletions.
38 changes: 25 additions & 13 deletions src/quickfix.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ struct efm_S
};

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));
Expand All @@ -126,7 +127,7 @@ static int is_qf_win __ARGS((win_T *win, qf_info_T *qi));
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_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));
Expand Down Expand Up @@ -884,6 +885,21 @@ qf_init_ext(qi, efile, buf, tv, errorformat, newlist, lnumfirst, lnumlast,
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.
*/
Expand All @@ -895,7 +911,7 @@ qf_new_list(qi, qf_title)
int i;

/*
* If the current entry is not the last entry, delete entries below
* 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'.
*/
Expand All @@ -916,14 +932,7 @@ qf_new_list(qi, qf_title)
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);
}
qf_store_title(qi, qf_title);
}

/*
Expand Down Expand Up @@ -2444,7 +2453,7 @@ ex_copen(eap)
qf_fill_buffer(qi);

if (qi->qf_lists[qi->qf_curlist].qf_title != NULL)
qf_set_title(qi);
qf_set_title_var(qi);

curwin->w_cursor.lnum = qi->qf_lists[qi->qf_curlist].qf_index;
curwin->w_cursor.col = 0;
Expand Down Expand Up @@ -2599,7 +2608,7 @@ qf_update_buffer(qi)
{
curwin_save = curwin;
curwin = win;
qf_set_title(qi);
qf_set_title_var(qi);
curwin = curwin_save;

}
Expand All @@ -2612,7 +2621,7 @@ qf_update_buffer(qi)
}

static void
qf_set_title(qi)
qf_set_title_var(qi)
qf_info_T *qi;
{
set_internal_string_var((char_u *)"w:quickfix_title",
Expand Down Expand Up @@ -3845,7 +3854,10 @@ set_errorlist(wp, list, action, title)
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)
{
Expand Down
2 changes: 2 additions & 0 deletions src/testdir/Make_amiga.mak
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test_breakindent.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_qf_title.out \
test_eval.out \
test_options.out

Expand Down Expand Up @@ -169,5 +170,6 @@ test_autoformat_join.out: test_autoformat_join.in
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
1 change: 1 addition & 0 deletions src/testdir/Make_dos.mak
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test_breakindent.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_qf_title.out \
test_eval.out \
test_options.out

Expand Down
1 change: 1 addition & 0 deletions src/testdir/Make_ming.mak
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test_breakindent.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_qf_title.out \
test_eval.out \
test_options.out

Expand Down
3 changes: 2 additions & 1 deletion src/testdir/Make_os2.mak
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test_autoformat_join.out \
test_eval.out \
test_breakindent.out \
test_listlbr_utf8.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_qf_title.out \
test_options.out

.SUFFIXES: .in .out
Expand Down
3 changes: 2 additions & 1 deletion src/testdir/Make_vms.mms
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
#
# Last change: 2014 May 28
# 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.
Expand Down Expand Up @@ -100,6 +100,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test_breakindent.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_qf_title.out \
test_eval.out \
test_options.out

Expand Down
1 change: 1 addition & 0 deletions src/testdir/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test_breakindent.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_qf_title.out \
test_eval.out \
test_options.out

Expand Down
18 changes: 18 additions & 0 deletions src/testdir/test_qf_title.in
Original file line number Diff line number Diff line change
@@ -0,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:
2 changes: 2 additions & 0 deletions src/testdir/test_qf_title.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Results of test_qf_title:
:setqflist()
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
378,
/**/
377,
/**/
Expand Down

0 comments on commit bc131b2

Please sign in to comment.