mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.0933: 'quickfixtextfunc' does not get window ID of location list
Problem: 'quickfixtextfunc' does not get window ID of location list. Solution: Add "winid" to the dict argument. (Yegappan Lakshmanan, closes #6222)
This commit is contained in:
@@ -1953,6 +1953,9 @@ following fields:
|
|||||||
|
|
||||||
quickfix set to 1 when called for a quickfix list and 0 when called for
|
quickfix set to 1 when called for a quickfix list and 0 when called for
|
||||||
a location list.
|
a location list.
|
||||||
|
winid for a location list, set to the id of the window with the
|
||||||
|
location list. For a quickfix list, set to 0. Can be used in
|
||||||
|
getloclist() to get the location list entry.
|
||||||
id quickfix or location list identifier
|
id quickfix or location list identifier
|
||||||
idx index of the entry in the quickfix or location list
|
idx index of the entry in the quickfix or location list
|
||||||
|
|
||||||
|
@@ -175,7 +175,7 @@ static int qf_win_pos_update(qf_info_T *qi, int old_qf_index);
|
|||||||
static win_T *qf_find_win(qf_info_T *qi);
|
static win_T *qf_find_win(qf_info_T *qi);
|
||||||
static buf_T *qf_find_buf(qf_info_T *qi);
|
static buf_T *qf_find_buf(qf_info_T *qi);
|
||||||
static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last);
|
static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last);
|
||||||
static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last);
|
static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid);
|
||||||
static buf_T *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *resulting_dir);
|
static buf_T *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *resulting_dir);
|
||||||
static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start);
|
static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start);
|
||||||
static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start);
|
static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start);
|
||||||
@@ -4189,7 +4189,7 @@ ex_copen(exarg_T *eap)
|
|||||||
lnum = qfl->qf_index;
|
lnum = qfl->qf_index;
|
||||||
|
|
||||||
// Fill the buffer with the quickfix list.
|
// Fill the buffer with the quickfix list.
|
||||||
qf_fill_buffer(qfl, curbuf, NULL);
|
qf_fill_buffer(qfl, curbuf, NULL, curwin->w_id);
|
||||||
|
|
||||||
decr_quickfix_busy();
|
decr_quickfix_busy();
|
||||||
|
|
||||||
@@ -4381,6 +4381,10 @@ qf_update_buffer(qf_info_T *qi, qfline_T *old_last)
|
|||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
{
|
{
|
||||||
linenr_T old_line_count = buf->b_ml.ml_line_count;
|
linenr_T old_line_count = buf->b_ml.ml_line_count;
|
||||||
|
int qf_winid = 0;
|
||||||
|
|
||||||
|
if (IS_LL_STACK(qi))
|
||||||
|
qf_winid = curwin->w_id;
|
||||||
|
|
||||||
if (old_last == NULL)
|
if (old_last == NULL)
|
||||||
// set curwin/curbuf to buf and save a few things
|
// set curwin/curbuf to buf and save a few things
|
||||||
@@ -4388,7 +4392,7 @@ qf_update_buffer(qf_info_T *qi, qfline_T *old_last)
|
|||||||
|
|
||||||
qf_update_win_titlevar(qi);
|
qf_update_win_titlevar(qi);
|
||||||
|
|
||||||
qf_fill_buffer(qf_get_curlist(qi), buf, old_last);
|
qf_fill_buffer(qf_get_curlist(qi), buf, old_last, qf_winid);
|
||||||
++CHANGEDTICK(buf);
|
++CHANGEDTICK(buf);
|
||||||
|
|
||||||
if (old_last == NULL)
|
if (old_last == NULL)
|
||||||
@@ -4415,7 +4419,8 @@ qf_buf_add_line(
|
|||||||
buf_T *buf, // quickfix window buffer
|
buf_T *buf, // quickfix window buffer
|
||||||
linenr_T lnum,
|
linenr_T lnum,
|
||||||
qfline_T *qfp,
|
qfline_T *qfp,
|
||||||
char_u *dirname)
|
char_u *dirname,
|
||||||
|
int qf_winid)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
buf_T *errbuf;
|
buf_T *errbuf;
|
||||||
@@ -4433,10 +4438,11 @@ qf_buf_add_line(
|
|||||||
typval_T args[1];
|
typval_T args[1];
|
||||||
dict_T *d;
|
dict_T *d;
|
||||||
|
|
||||||
// create 'info' dict argument
|
// create the dict argument
|
||||||
if ((d = dict_alloc_lock(VAR_FIXED)) == NULL)
|
if ((d = dict_alloc_lock(VAR_FIXED)) == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
dict_add_number(d, "quickfix", (long)IS_QF_LIST(qfl));
|
dict_add_number(d, "quickfix", (long)IS_QF_LIST(qfl));
|
||||||
|
dict_add_number(d, "winid", (long)qf_winid);
|
||||||
dict_add_number(d, "id", (long)qfl->qf_id);
|
dict_add_number(d, "id", (long)qfl->qf_id);
|
||||||
dict_add_number(d, "idx", (long)(lnum + 1));
|
dict_add_number(d, "idx", (long)(lnum + 1));
|
||||||
++d->dv_refcount;
|
++d->dv_refcount;
|
||||||
@@ -4535,7 +4541,7 @@ qf_buf_add_line(
|
|||||||
* ml_delete() is used and autocommands will be triggered.
|
* ml_delete() is used and autocommands will be triggered.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last)
|
qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid)
|
||||||
{
|
{
|
||||||
linenr_T lnum;
|
linenr_T lnum;
|
||||||
qfline_T *qfp;
|
qfline_T *qfp;
|
||||||
@@ -4574,7 +4580,7 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last)
|
|||||||
}
|
}
|
||||||
while (lnum < qfl->qf_count)
|
while (lnum < qfl->qf_count)
|
||||||
{
|
{
|
||||||
if (qf_buf_add_line(qfl, buf, lnum, qfp, dirname) == FAIL)
|
if (qf_buf_add_line(qfl, buf, lnum, qfp, dirname, qf_winid) == FAIL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++lnum;
|
++lnum;
|
||||||
|
@@ -4822,7 +4822,7 @@ func Tqfexpr(info)
|
|||||||
let qfl = getqflist({'id' : a:info.id, 'idx' : a:info.idx,
|
let qfl = getqflist({'id' : a:info.id, 'idx' : a:info.idx,
|
||||||
\ 'items' : 1}).items
|
\ 'items' : 1}).items
|
||||||
else
|
else
|
||||||
let qfl = getloclist(0, {'id' : a:info.id, 'idx' : a:info.idx,
|
let qfl = getloclist(a:info.winid, {'id' : a:info.id, 'idx' : a:info.idx,
|
||||||
\ 'items' : 1}).items
|
\ 'items' : 1}).items
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -4863,7 +4863,7 @@ func Xtest_qftextfunc(cchar)
|
|||||||
let qfl = getqflist({'id' : a:info.id, 'idx' : a:info.idx,
|
let qfl = getqflist({'id' : a:info.id, 'idx' : a:info.idx,
|
||||||
\ 'items' : 1}).items
|
\ 'items' : 1}).items
|
||||||
else
|
else
|
||||||
let qfl = getloclist(0, {'id' : a:info.id, 'idx' : a:info.idx,
|
let qfl = getloclist(a:info.winid, {'id' : a:info.id, 'idx' : a:info.idx,
|
||||||
\ 'items' : 1}).items
|
\ 'items' : 1}).items
|
||||||
endif
|
endif
|
||||||
if empty(qfl)
|
if empty(qfl)
|
||||||
@@ -4878,6 +4878,11 @@ func Xtest_qftextfunc(cchar)
|
|||||||
call assert_equal('Line 10, Col 2', getline(1))
|
call assert_equal('Line 10, Col 2', getline(1))
|
||||||
call assert_equal('Line 20, Col 4', getline(2))
|
call assert_equal('Line 20, Col 4', getline(2))
|
||||||
Xclose
|
Xclose
|
||||||
|
" Add entries to the list when the quickfix buffer is hidden
|
||||||
|
Xaddexpr ['F1:30:6:red']
|
||||||
|
Xwindow
|
||||||
|
call assert_equal('Line 30, Col 6', getline(3))
|
||||||
|
Xclose
|
||||||
call g:Xsetlist([], 'r', {'quickfixtextfunc' : ''})
|
call g:Xsetlist([], 'r', {'quickfixtextfunc' : ''})
|
||||||
set quickfixtextfunc&
|
set quickfixtextfunc&
|
||||||
delfunc PerQfText
|
delfunc PerQfText
|
||||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
933,
|
||||||
/**/
|
/**/
|
||||||
932,
|
932,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user