comparison src/quickfix.c @ 20762:68170c89e355 v8.2.0933

patch 8.2.0933: 'quickfixtextfunc' does not get window ID of location list Commit: https://github.com/vim/vim/commit/7ba5a7eff335dcce25afaa154f32eeadb6014b61 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 8 19:20:27 2020 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Mon, 08 Jun 2020 19:30:03 +0200
parents ada6f26e6eb1
children 3c61d8ec36af
comparison
equal deleted inserted replaced
20761:8eb1d42ec2c9 20762:68170c89e355
173 static void qf_fmt_text(char_u *text, char_u *buf, int bufsize); 173 static void qf_fmt_text(char_u *text, char_u *buf, int bufsize);
174 static int qf_win_pos_update(qf_info_T *qi, int old_qf_index); 174 static int qf_win_pos_update(qf_info_T *qi, int old_qf_index);
175 static win_T *qf_find_win(qf_info_T *qi); 175 static win_T *qf_find_win(qf_info_T *qi);
176 static buf_T *qf_find_buf(qf_info_T *qi); 176 static buf_T *qf_find_buf(qf_info_T *qi);
177 static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last); 177 static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last);
178 static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last); 178 static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid);
179 static buf_T *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *resulting_dir); 179 static buf_T *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *resulting_dir);
180 static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start); 180 static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start);
181 static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start); 181 static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start);
182 static qf_info_T *ll_get_or_alloc_list(win_T *); 182 static qf_info_T *ll_get_or_alloc_list(win_T *);
183 static char_u *e_no_more_items = (char_u *)N_("E553: No more items"); 183 static char_u *e_no_more_items = (char_u *)N_("E553: No more items");
4187 // Save the current index here, as updating the quickfix buffer may free 4187 // Save the current index here, as updating the quickfix buffer may free
4188 // the quickfix list 4188 // the quickfix list
4189 lnum = qfl->qf_index; 4189 lnum = qfl->qf_index;
4190 4190
4191 // Fill the buffer with the quickfix list. 4191 // Fill the buffer with the quickfix list.
4192 qf_fill_buffer(qfl, curbuf, NULL); 4192 qf_fill_buffer(qfl, curbuf, NULL, curwin->w_id);
4193 4193
4194 decr_quickfix_busy(); 4194 decr_quickfix_busy();
4195 4195
4196 curwin->w_cursor.lnum = lnum; 4196 curwin->w_cursor.lnum = lnum;
4197 curwin->w_cursor.col = 0; 4197 curwin->w_cursor.col = 0;
4379 // Check if a buffer for the quickfix list exists. Update it. 4379 // Check if a buffer for the quickfix list exists. Update it.
4380 buf = qf_find_buf(qi); 4380 buf = qf_find_buf(qi);
4381 if (buf != NULL) 4381 if (buf != NULL)
4382 { 4382 {
4383 linenr_T old_line_count = buf->b_ml.ml_line_count; 4383 linenr_T old_line_count = buf->b_ml.ml_line_count;
4384 int qf_winid = 0;
4385
4386 if (IS_LL_STACK(qi))
4387 qf_winid = curwin->w_id;
4384 4388
4385 if (old_last == NULL) 4389 if (old_last == NULL)
4386 // set curwin/curbuf to buf and save a few things 4390 // set curwin/curbuf to buf and save a few things
4387 aucmd_prepbuf(&aco, buf); 4391 aucmd_prepbuf(&aco, buf);
4388 4392
4389 qf_update_win_titlevar(qi); 4393 qf_update_win_titlevar(qi);
4390 4394
4391 qf_fill_buffer(qf_get_curlist(qi), buf, old_last); 4395 qf_fill_buffer(qf_get_curlist(qi), buf, old_last, qf_winid);
4392 ++CHANGEDTICK(buf); 4396 ++CHANGEDTICK(buf);
4393 4397
4394 if (old_last == NULL) 4398 if (old_last == NULL)
4395 { 4399 {
4396 (void)qf_win_pos_update(qi, 0); 4400 (void)qf_win_pos_update(qi, 0);
4413 qf_buf_add_line( 4417 qf_buf_add_line(
4414 qf_list_T *qfl, // quickfix list 4418 qf_list_T *qfl, // quickfix list
4415 buf_T *buf, // quickfix window buffer 4419 buf_T *buf, // quickfix window buffer
4416 linenr_T lnum, 4420 linenr_T lnum,
4417 qfline_T *qfp, 4421 qfline_T *qfp,
4418 char_u *dirname) 4422 char_u *dirname,
4423 int qf_winid)
4419 { 4424 {
4420 int len; 4425 int len;
4421 buf_T *errbuf; 4426 buf_T *errbuf;
4422 char_u *qftf; 4427 char_u *qftf;
4423 4428
4431 { 4436 {
4432 char_u *qfbuf_text; 4437 char_u *qfbuf_text;
4433 typval_T args[1]; 4438 typval_T args[1];
4434 dict_T *d; 4439 dict_T *d;
4435 4440
4436 // create 'info' dict argument 4441 // create the dict argument
4437 if ((d = dict_alloc_lock(VAR_FIXED)) == NULL) 4442 if ((d = dict_alloc_lock(VAR_FIXED)) == NULL)
4438 return FAIL; 4443 return FAIL;
4439 dict_add_number(d, "quickfix", (long)IS_QF_LIST(qfl)); 4444 dict_add_number(d, "quickfix", (long)IS_QF_LIST(qfl));
4445 dict_add_number(d, "winid", (long)qf_winid);
4440 dict_add_number(d, "id", (long)qfl->qf_id); 4446 dict_add_number(d, "id", (long)qfl->qf_id);
4441 dict_add_number(d, "idx", (long)(lnum + 1)); 4447 dict_add_number(d, "idx", (long)(lnum + 1));
4442 ++d->dv_refcount; 4448 ++d->dv_refcount;
4443 args[0].v_type = VAR_DICT; 4449 args[0].v_type = VAR_DICT;
4444 args[0].vval.v_dict = d; 4450 args[0].vval.v_dict = d;
4533 * If "old_last" is not NULL append the items after this one. 4539 * If "old_last" is not NULL append the items after this one.
4534 * When "old_last" is NULL then "buf" must equal "curbuf"! Because 4540 * When "old_last" is NULL then "buf" must equal "curbuf"! Because
4535 * ml_delete() is used and autocommands will be triggered. 4541 * ml_delete() is used and autocommands will be triggered.
4536 */ 4542 */
4537 static void 4543 static void
4538 qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last) 4544 qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid)
4539 { 4545 {
4540 linenr_T lnum; 4546 linenr_T lnum;
4541 qfline_T *qfp; 4547 qfline_T *qfp;
4542 int old_KeyTyped = KeyTyped; 4548 int old_KeyTyped = KeyTyped;
4543 4549
4572 qfp = old_last->qf_next; 4578 qfp = old_last->qf_next;
4573 lnum = buf->b_ml.ml_line_count; 4579 lnum = buf->b_ml.ml_line_count;
4574 } 4580 }
4575 while (lnum < qfl->qf_count) 4581 while (lnum < qfl->qf_count)
4576 { 4582 {
4577 if (qf_buf_add_line(qfl, buf, lnum, qfp, dirname) == FAIL) 4583 if (qf_buf_add_line(qfl, buf, lnum, qfp, dirname, qf_winid) == FAIL)
4578 break; 4584 break;
4579 4585
4580 ++lnum; 4586 ++lnum;
4581 qfp = qfp->qf_next; 4587 qfp = qfp->qf_next;
4582 if (qfp == NULL) 4588 if (qfp == NULL)