diff options
-rw-r--r-- | runtime/doc/quickfix.txt | 3 | ||||
-rw-r--r-- | src/quickfix.c | 20 | ||||
-rw-r--r-- | src/testdir/test_quickfix.vim | 9 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 25 insertions, 9 deletions
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 4f3112c234..982044c5bf 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1953,6 +1953,9 @@ following fields: quickfix set to 1 when called for a quickfix list and 0 when called for 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 idx index of the entry in the quickfix or location list diff --git a/src/quickfix.c b/src/quickfix.c index b4ecaad32e..0da8ea27f1 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -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 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_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 void wipe_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; // 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(); @@ -4381,6 +4381,10 @@ qf_update_buffer(qf_info_T *qi, qfline_T *old_last) if (buf != NULL) { 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) // 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_fill_buffer(qf_get_curlist(qi), buf, old_last); + qf_fill_buffer(qf_get_curlist(qi), buf, old_last, qf_winid); ++CHANGEDTICK(buf); if (old_last == NULL) @@ -4415,7 +4419,8 @@ qf_buf_add_line( buf_T *buf, // quickfix window buffer linenr_T lnum, qfline_T *qfp, - char_u *dirname) + char_u *dirname, + int qf_winid) { int len; buf_T *errbuf; @@ -4433,10 +4438,11 @@ qf_buf_add_line( typval_T args[1]; dict_T *d; - // create 'info' dict argument + // create the dict argument if ((d = dict_alloc_lock(VAR_FIXED)) == NULL) return FAIL; 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, "idx", (long)(lnum + 1)); ++d->dv_refcount; @@ -4535,7 +4541,7 @@ qf_buf_add_line( * ml_delete() is used and autocommands will be triggered. */ 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; 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) { - 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; ++lnum; diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 96729a4e93..7587d979e5 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -4822,7 +4822,7 @@ func Tqfexpr(info) let qfl = getqflist({'id' : a:info.id, 'idx' : a:info.idx, \ 'items' : 1}).items 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 endif @@ -4863,7 +4863,7 @@ func Xtest_qftextfunc(cchar) let qfl = getqflist({'id' : a:info.id, 'idx' : a:info.idx, \ 'items' : 1}).items 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 endif if empty(qfl) @@ -4878,6 +4878,11 @@ func Xtest_qftextfunc(cchar) call assert_equal('Line 10, Col 2', getline(1)) call assert_equal('Line 20, Col 4', getline(2)) 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' : ''}) set quickfixtextfunc& delfunc PerQfText diff --git a/src/version.c b/src/version.c index 420d655a72..54369e4a73 100644 --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 933, +/**/ 932, /**/ 931, |