forked from aniani/vim
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)
This commit is contained in:
parent
54368f2742
commit
fb60409a3f
@ -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));
|
||||
@ -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));
|
||||
@ -884,6 +885,21 @@ qf_init_end:
|
||||
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,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'.
|
||||
*/
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -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;
|
||||
@ -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;
|
||||
|
||||
}
|
||||
@ -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",
|
||||
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
18
src/testdir/test_qf_title.in
Normal file
18
src/testdir/test_qf_title.in
Normal file
@ -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
src/testdir/test_qf_title.ok
Normal file
2
src/testdir/test_qf_title.ok
Normal file
@ -0,0 +1,2 @@
|
||||
Results of test_qf_title:
|
||||
:setqflist()
|
@ -734,6 +734,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
378,
|
||||
/**/
|
||||
377,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user