Mercurial > vim
comparison src/quickfix.c @ 20631:d6827bd31d1d v8.2.0869
patch 8.2.0869: it is not possible to customize the quickfix window contents
Commit: https://github.com/vim/vim/commit/858ba06d5f577b187da0367b231f7fa9461cb32d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 31 23:11:59 2020 +0200
patch 8.2.0869: it is not possible to customize the quickfix window contents
Problem: It is not possible to customize the quickfix window contents.
Solution: Add 'quickfixtextfunc'. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5465)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 31 May 2020 23:15:03 +0200 |
parents | d571231175b4 |
children | ada6f26e6eb1 |
comparison
equal
deleted
inserted
replaced
20630:b7bfe0a2b961 | 20631:d6827bd31d1d |
---|---|
80 int qf_index; // current index in the error list | 80 int qf_index; // current index in the error list |
81 int qf_nonevalid; // TRUE if not a single valid entry found | 81 int qf_nonevalid; // TRUE if not a single valid entry found |
82 char_u *qf_title; // title derived from the command that created | 82 char_u *qf_title; // title derived from the command that created |
83 // the error list or set by setqflist | 83 // the error list or set by setqflist |
84 typval_T *qf_ctx; // context set by setqflist/setloclist | 84 typval_T *qf_ctx; // context set by setqflist/setloclist |
85 char_u *qf_qftf; // 'quickfixtextfunc' setting for this list | |
85 | 86 |
86 struct dir_stack_T *qf_dir_stack; | 87 struct dir_stack_T *qf_dir_stack; |
87 char_u *qf_directory; | 88 char_u *qf_directory; |
88 struct dir_stack_T *qf_file_stack; | 89 struct dir_stack_T *qf_file_stack; |
89 char_u *qf_currfile; | 90 char_u *qf_currfile; |
2275 if (to_qfl->qf_ctx != NULL) | 2276 if (to_qfl->qf_ctx != NULL) |
2276 copy_tv(from_qfl->qf_ctx, to_qfl->qf_ctx); | 2277 copy_tv(from_qfl->qf_ctx, to_qfl->qf_ctx); |
2277 } | 2278 } |
2278 else | 2279 else |
2279 to_qfl->qf_ctx = NULL; | 2280 to_qfl->qf_ctx = NULL; |
2281 if (from_qfl->qf_qftf != NULL) | |
2282 to_qfl->qf_qftf = vim_strsave(from_qfl->qf_qftf); | |
2283 else | |
2284 to_qfl->qf_qftf = NULL; | |
2280 | 2285 |
2281 if (from_qfl->qf_count) | 2286 if (from_qfl->qf_count) |
2282 if (copy_loclist_entries(from_qfl, to_qfl) == FAIL) | 2287 if (copy_loclist_entries(from_qfl, to_qfl) == FAIL) |
2283 return FAIL; | 2288 return FAIL; |
2284 | 2289 |
3810 qf_free_items(qfl); | 3815 qf_free_items(qfl); |
3811 | 3816 |
3812 VIM_CLEAR(qfl->qf_title); | 3817 VIM_CLEAR(qfl->qf_title); |
3813 free_tv(qfl->qf_ctx); | 3818 free_tv(qfl->qf_ctx); |
3814 qfl->qf_ctx = NULL; | 3819 qfl->qf_ctx = NULL; |
3820 VIM_CLEAR(qfl->qf_qftf); | |
3815 qfl->qf_id = 0; | 3821 qfl->qf_id = 0; |
3816 qfl->qf_changedtick = 0L; | 3822 qfl->qf_changedtick = 0L; |
3817 } | 3823 } |
3818 | 3824 |
3819 /* | 3825 /* |
4397 | 4403 |
4398 /* | 4404 /* |
4399 * Add an error line to the quickfix buffer. | 4405 * Add an error line to the quickfix buffer. |
4400 */ | 4406 */ |
4401 static int | 4407 static int |
4402 qf_buf_add_line(buf_T *buf, linenr_T lnum, qfline_T *qfp, char_u *dirname) | 4408 qf_buf_add_line( |
4409 qf_list_T *qfl, // quickfix list | |
4410 buf_T *buf, // quickfix window buffer | |
4411 linenr_T lnum, | |
4412 qfline_T *qfp, | |
4413 char_u *dirname) | |
4403 { | 4414 { |
4404 int len; | 4415 int len; |
4405 buf_T *errbuf; | 4416 buf_T *errbuf; |
4406 | 4417 char_u *qftf; |
4407 if (qfp->qf_module != NULL) | 4418 |
4408 { | 4419 // If 'quickfixtextfunc' is set, then use the user-supplied function to get |
4409 vim_strncpy(IObuff, qfp->qf_module, IOSIZE - 1); | 4420 // the text to display |
4410 len = (int)STRLEN(IObuff); | 4421 qftf = p_qftf; |
4411 } | 4422 // Use the local value of 'quickfixtextfunc' if it is set. |
4412 else if (qfp->qf_fnum != 0 | 4423 if (qfl->qf_qftf != NULL) |
4413 && (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL | 4424 qftf = qfl->qf_qftf; |
4414 && errbuf->b_fname != NULL) | 4425 if (qftf != NULL && *qftf != NUL) |
4415 { | 4426 { |
4416 if (qfp->qf_type == 1) // :helpgrep | 4427 char_u *qfbuf_text; |
4417 vim_strncpy(IObuff, gettail(errbuf->b_fname), IOSIZE - 1); | 4428 typval_T args[1]; |
4429 dict_T *d; | |
4430 | |
4431 // create 'info' dict argument | |
4432 if ((d = dict_alloc_lock(VAR_FIXED)) == NULL) | |
4433 return FAIL; | |
4434 dict_add_number(d, "quickfix", (long)IS_QF_LIST(qfl)); | |
4435 dict_add_number(d, "id", (long)qfl->qf_id); | |
4436 dict_add_number(d, "idx", (long)(lnum + 1)); | |
4437 ++d->dv_refcount; | |
4438 args[0].v_type = VAR_DICT; | |
4439 args[0].vval.v_dict = d; | |
4440 | |
4441 qfbuf_text = call_func_retstr(qftf, 1, args); | |
4442 --d->dv_refcount; | |
4443 | |
4444 if (qfbuf_text == NULL) | |
4445 return FAIL; | |
4446 | |
4447 vim_strncpy(IObuff, qfbuf_text, IOSIZE - 1); | |
4448 vim_free(qfbuf_text); | |
4449 } | |
4450 else | |
4451 { | |
4452 if (qfp->qf_module != NULL) | |
4453 { | |
4454 vim_strncpy(IObuff, qfp->qf_module, IOSIZE - 1); | |
4455 len = (int)STRLEN(IObuff); | |
4456 } | |
4457 else if (qfp->qf_fnum != 0 | |
4458 && (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL | |
4459 && errbuf->b_fname != NULL) | |
4460 { | |
4461 if (qfp->qf_type == 1) // :helpgrep | |
4462 vim_strncpy(IObuff, gettail(errbuf->b_fname), IOSIZE - 1); | |
4463 else | |
4464 { | |
4465 // shorten the file name if not done already | |
4466 if (errbuf->b_sfname == NULL | |
4467 || mch_isFullName(errbuf->b_sfname)) | |
4468 { | |
4469 if (*dirname == NUL) | |
4470 mch_dirname(dirname, MAXPATHL); | |
4471 shorten_buf_fname(errbuf, dirname, FALSE); | |
4472 } | |
4473 vim_strncpy(IObuff, errbuf->b_fname, IOSIZE - 1); | |
4474 } | |
4475 len = (int)STRLEN(IObuff); | |
4476 } | |
4418 else | 4477 else |
4419 { | 4478 len = 0; |
4420 // shorten the file name if not done already | 4479 |
4421 if (errbuf->b_sfname == NULL | 4480 if (len < IOSIZE - 1) |
4422 || mch_isFullName(errbuf->b_sfname)) | 4481 IObuff[len++] = '|'; |
4482 | |
4483 if (qfp->qf_lnum > 0) | |
4484 { | |
4485 vim_snprintf((char *)IObuff + len, IOSIZE - len, "%ld", | |
4486 qfp->qf_lnum); | |
4487 len += (int)STRLEN(IObuff + len); | |
4488 | |
4489 if (qfp->qf_col > 0) | |
4423 { | 4490 { |
4424 if (*dirname == NUL) | 4491 vim_snprintf((char *)IObuff + len, IOSIZE - len, |
4425 mch_dirname(dirname, MAXPATHL); | 4492 " col %d", qfp->qf_col); |
4426 shorten_buf_fname(errbuf, dirname, FALSE); | 4493 len += (int)STRLEN(IObuff + len); |
4427 } | 4494 } |
4428 vim_strncpy(IObuff, errbuf->b_fname, IOSIZE - 1); | 4495 |
4429 } | 4496 vim_snprintf((char *)IObuff + len, IOSIZE - len, "%s", |
4430 len = (int)STRLEN(IObuff); | 4497 (char *)qf_types(qfp->qf_type, qfp->qf_nr)); |
4431 } | |
4432 else | |
4433 len = 0; | |
4434 | |
4435 if (len < IOSIZE - 1) | |
4436 IObuff[len++] = '|'; | |
4437 | |
4438 if (qfp->qf_lnum > 0) | |
4439 { | |
4440 vim_snprintf((char *)IObuff + len, IOSIZE - len, "%ld", qfp->qf_lnum); | |
4441 len += (int)STRLEN(IObuff + len); | |
4442 | |
4443 if (qfp->qf_col > 0) | |
4444 { | |
4445 vim_snprintf((char *)IObuff + len, IOSIZE - len, | |
4446 " col %d", qfp->qf_col); | |
4447 len += (int)STRLEN(IObuff + len); | 4498 len += (int)STRLEN(IObuff + len); |
4448 } | 4499 } |
4449 | 4500 else if (qfp->qf_pattern != NULL) |
4450 vim_snprintf((char *)IObuff + len, IOSIZE - len, "%s", | 4501 { |
4451 (char *)qf_types(qfp->qf_type, qfp->qf_nr)); | 4502 qf_fmt_text(qfp->qf_pattern, IObuff + len, IOSIZE - len); |
4452 len += (int)STRLEN(IObuff + len); | 4503 len += (int)STRLEN(IObuff + len); |
4453 } | 4504 } |
4454 else if (qfp->qf_pattern != NULL) | 4505 if (len < IOSIZE - 2) |
4455 { | 4506 { |
4456 qf_fmt_text(qfp->qf_pattern, IObuff + len, IOSIZE - len); | 4507 IObuff[len++] = '|'; |
4457 len += (int)STRLEN(IObuff + len); | 4508 IObuff[len++] = ' '; |
4458 } | 4509 } |
4459 if (len < IOSIZE - 2) | 4510 |
4460 { | 4511 // Remove newlines and leading whitespace from the text. |
4461 IObuff[len++] = '|'; | 4512 // For an unrecognized line keep the indent, the compiler may |
4462 IObuff[len++] = ' '; | 4513 // mark a word with ^^^^. |
4463 } | 4514 qf_fmt_text(len > 3 ? skipwhite(qfp->qf_text) : qfp->qf_text, |
4464 | 4515 IObuff + len, IOSIZE - len); |
4465 // Remove newlines and leading whitespace from the text. | 4516 } |
4466 // For an unrecognized line keep the indent, the compiler may | |
4467 // mark a word with ^^^^. | |
4468 qf_fmt_text(len > 3 ? skipwhite(qfp->qf_text) : qfp->qf_text, | |
4469 IObuff + len, IOSIZE - len); | |
4470 | 4517 |
4471 if (ml_append_buf(buf, lnum, IObuff, | 4518 if (ml_append_buf(buf, lnum, IObuff, |
4472 (colnr_T)STRLEN(IObuff) + 1, FALSE) == FAIL) | 4519 (colnr_T)STRLEN(IObuff) + 1, FALSE) == FAIL) |
4473 return FAIL; | 4520 return FAIL; |
4474 | 4521 |
4520 qfp = old_last->qf_next; | 4567 qfp = old_last->qf_next; |
4521 lnum = buf->b_ml.ml_line_count; | 4568 lnum = buf->b_ml.ml_line_count; |
4522 } | 4569 } |
4523 while (lnum < qfl->qf_count) | 4570 while (lnum < qfl->qf_count) |
4524 { | 4571 { |
4525 if (qf_buf_add_line(buf, lnum, qfp, dirname) == FAIL) | 4572 if (qf_buf_add_line(qfl, buf, lnum, qfp, dirname) == FAIL) |
4526 break; | 4573 break; |
4527 | 4574 |
4528 ++lnum; | 4575 ++lnum; |
4529 qfp = qfp->qf_next; | 4576 qfp = qfp->qf_next; |
4530 if (qfp == NULL) | 4577 if (qfp == NULL) |
6367 } | 6414 } |
6368 | 6415 |
6369 /* | 6416 /* |
6370 * Add each quickfix error to list "list" as a dictionary. | 6417 * Add each quickfix error to list "list" as a dictionary. |
6371 * If qf_idx is -1, use the current list. Otherwise, use the specified list. | 6418 * If qf_idx is -1, use the current list. Otherwise, use the specified list. |
6372 */ | 6419 * If eidx is not 0, then return only the specified entry. Otherwise return |
6373 static int | 6420 * all the entries. |
6374 get_errorlist(qf_info_T *qi_arg, win_T *wp, int qf_idx, list_T *list) | 6421 */ |
6422 static int | |
6423 get_errorlist( | |
6424 qf_info_T *qi_arg, | |
6425 win_T *wp, | |
6426 int qf_idx, | |
6427 int eidx, | |
6428 list_T *list) | |
6375 { | 6429 { |
6376 qf_info_T *qi = qi_arg; | 6430 qf_info_T *qi = qi_arg; |
6377 qf_list_T *qfl; | 6431 qf_list_T *qfl; |
6378 qfline_T *qfp; | 6432 qfline_T *qfp; |
6379 int i; | 6433 int i; |
6387 if (qi == NULL) | 6441 if (qi == NULL) |
6388 return FAIL; | 6442 return FAIL; |
6389 } | 6443 } |
6390 } | 6444 } |
6391 | 6445 |
6446 if (eidx < 0) | |
6447 return OK; | |
6448 | |
6392 if (qf_idx == INVALID_QFIDX) | 6449 if (qf_idx == INVALID_QFIDX) |
6393 qf_idx = qi->qf_curlist; | 6450 qf_idx = qi->qf_curlist; |
6394 | 6451 |
6395 if (qf_idx >= qi->qf_listcount) | 6452 if (qf_idx >= qi->qf_listcount) |
6396 return FAIL; | 6453 return FAIL; |
6399 if (qf_list_empty(qfl)) | 6456 if (qf_list_empty(qfl)) |
6400 return FAIL; | 6457 return FAIL; |
6401 | 6458 |
6402 FOR_ALL_QFL_ITEMS(qfl, qfp, i) | 6459 FOR_ALL_QFL_ITEMS(qfl, qfp, i) |
6403 { | 6460 { |
6404 if (get_qfline_items(qfp, list) == FAIL) | 6461 if (eidx > 0) |
6462 { | |
6463 if (eidx == i) | |
6464 return get_qfline_items(qfp, list); | |
6465 } | |
6466 else if (get_qfline_items(qfp, list) == FAIL) | |
6405 return FAIL; | 6467 return FAIL; |
6406 } | 6468 } |
6407 | 6469 |
6408 return OK; | 6470 return OK; |
6409 } | 6471 } |
6459 if (qi != NULL) | 6521 if (qi != NULL) |
6460 { | 6522 { |
6461 if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, errorformat, | 6523 if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, errorformat, |
6462 TRUE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) | 6524 TRUE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) |
6463 { | 6525 { |
6464 (void)get_errorlist(qi, NULL, 0, l); | 6526 (void)get_errorlist(qi, NULL, 0, 0, l); |
6465 qf_free(&qi->qf_lists[0]); | 6527 qf_free(&qi->qf_lists[0]); |
6466 } | 6528 } |
6467 free(qi); | 6529 free(qi); |
6468 } | 6530 } |
6469 dict_add_list(retdict, "items", l); | 6531 dict_add_list(retdict, "items", l); |
6677 | 6739 |
6678 return dict_add_number(retdict, "filewinid", winid); | 6740 return dict_add_number(retdict, "filewinid", winid); |
6679 } | 6741 } |
6680 | 6742 |
6681 /* | 6743 /* |
6682 * Return the quickfix list items/entries as 'items' in retdict | 6744 * Return the quickfix list items/entries as 'items' in retdict. |
6683 */ | 6745 * If eidx is not 0, then return the item at the specified index. |
6684 static int | 6746 */ |
6685 qf_getprop_items(qf_info_T *qi, int qf_idx, dict_T *retdict) | 6747 static int |
6748 qf_getprop_items(qf_info_T *qi, int qf_idx, int eidx, dict_T *retdict) | |
6686 { | 6749 { |
6687 int status = OK; | 6750 int status = OK; |
6688 list_T *l = list_alloc(); | 6751 list_T *l = list_alloc(); |
6689 if (l != NULL) | 6752 if (l != NULL) |
6690 { | 6753 { |
6691 (void)get_errorlist(qi, NULL, qf_idx, l); | 6754 (void)get_errorlist(qi, NULL, qf_idx, eidx, l); |
6692 dict_add_list(retdict, "items", l); | 6755 dict_add_list(retdict, "items", l); |
6693 } | 6756 } |
6694 else | 6757 else |
6695 status = FAIL; | 6758 status = FAIL; |
6696 | 6759 |
6724 | 6787 |
6725 return status; | 6788 return status; |
6726 } | 6789 } |
6727 | 6790 |
6728 /* | 6791 /* |
6729 * Return the current quickfix list index as 'idx' in retdict | 6792 * Return the current quickfix list index as 'idx' in retdict. |
6730 */ | 6793 * If a specific entry index (eidx) is supplied, then use that. |
6731 static int | 6794 */ |
6732 qf_getprop_idx(qf_list_T *qfl, dict_T *retdict) | 6795 static int |
6733 { | 6796 qf_getprop_idx(qf_list_T *qfl, int eidx, dict_T *retdict) |
6734 int curidx = qfl->qf_index; | 6797 { |
6735 if (qf_list_empty(qfl)) | 6798 if (eidx == 0) |
6736 // For empty lists, current index is set to 0 | 6799 { |
6737 curidx = 0; | 6800 eidx = qfl->qf_index; |
6738 return dict_add_number(retdict, "idx", curidx); | 6801 if (qf_list_empty(qfl)) |
6802 // For empty lists, current index is set to 0 | |
6803 eidx = 0; | |
6804 } | |
6805 return dict_add_number(retdict, "idx", eidx); | |
6739 } | 6806 } |
6740 | 6807 |
6741 /* | 6808 /* |
6742 * Return quickfix/location list details (title) as a | 6809 * Return quickfix/location list details (title) as a |
6743 * dictionary. 'what' contains the details to return. If 'list_idx' is -1, | 6810 * dictionary. 'what' contains the details to return. If 'list_idx' is -1, |
6748 { | 6815 { |
6749 qf_info_T *qi = &ql_info; | 6816 qf_info_T *qi = &ql_info; |
6750 qf_list_T *qfl; | 6817 qf_list_T *qfl; |
6751 int status = OK; | 6818 int status = OK; |
6752 int qf_idx = INVALID_QFIDX; | 6819 int qf_idx = INVALID_QFIDX; |
6820 int eidx = 0; | |
6753 dictitem_T *di; | 6821 dictitem_T *di; |
6754 int flags = QF_GETLIST_NONE; | 6822 int flags = QF_GETLIST_NONE; |
6755 | 6823 |
6756 if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL) | 6824 if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL) |
6757 return qf_get_list_from_lines(what, di, retdict); | 6825 return qf_get_list_from_lines(what, di, retdict); |
6767 // List is not present or is empty | 6835 // List is not present or is empty |
6768 if (qf_stack_empty(qi) || qf_idx == INVALID_QFIDX) | 6836 if (qf_stack_empty(qi) || qf_idx == INVALID_QFIDX) |
6769 return qf_getprop_defaults(qi, flags, wp != NULL, retdict); | 6837 return qf_getprop_defaults(qi, flags, wp != NULL, retdict); |
6770 | 6838 |
6771 qfl = qf_get_list(qi, qf_idx); | 6839 qfl = qf_get_list(qi, qf_idx); |
6840 | |
6841 // If an entry index is specified, use that | |
6842 if ((di = dict_find(what, (char_u *)"idx", -1)) != NULL) | |
6843 { | |
6844 if (di->di_tv.v_type != VAR_NUMBER) | |
6845 return FAIL; | |
6846 eidx = di->di_tv.vval.v_number; | |
6847 } | |
6772 | 6848 |
6773 if (flags & QF_GETLIST_TITLE) | 6849 if (flags & QF_GETLIST_TITLE) |
6774 status = qf_getprop_title(qfl, retdict); | 6850 status = qf_getprop_title(qfl, retdict); |
6775 if ((status == OK) && (flags & QF_GETLIST_NR)) | 6851 if ((status == OK) && (flags & QF_GETLIST_NR)) |
6776 status = dict_add_number(retdict, "nr", qf_idx + 1); | 6852 status = dict_add_number(retdict, "nr", qf_idx + 1); |
6777 if ((status == OK) && (flags & QF_GETLIST_WINID)) | 6853 if ((status == OK) && (flags & QF_GETLIST_WINID)) |
6778 status = dict_add_number(retdict, "winid", qf_winid(qi)); | 6854 status = dict_add_number(retdict, "winid", qf_winid(qi)); |
6779 if ((status == OK) && (flags & QF_GETLIST_ITEMS)) | 6855 if ((status == OK) && (flags & QF_GETLIST_ITEMS)) |
6780 status = qf_getprop_items(qi, qf_idx, retdict); | 6856 status = qf_getprop_items(qi, qf_idx, eidx, retdict); |
6781 if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) | 6857 if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) |
6782 status = qf_getprop_ctx(qfl, retdict); | 6858 status = qf_getprop_ctx(qfl, retdict); |
6783 if ((status == OK) && (flags & QF_GETLIST_ID)) | 6859 if ((status == OK) && (flags & QF_GETLIST_ID)) |
6784 status = dict_add_number(retdict, "id", qfl->qf_id); | 6860 status = dict_add_number(retdict, "id", qfl->qf_id); |
6785 if ((status == OK) && (flags & QF_GETLIST_IDX)) | 6861 if ((status == OK) && (flags & QF_GETLIST_IDX)) |
6786 status = qf_getprop_idx(qfl, retdict); | 6862 status = qf_getprop_idx(qfl, eidx, retdict); |
6787 if ((status == OK) && (flags & QF_GETLIST_SIZE)) | 6863 if ((status == OK) && (flags & QF_GETLIST_SIZE)) |
6788 status = dict_add_number(retdict, "size", qfl->qf_count); | 6864 status = dict_add_number(retdict, "size", qfl->qf_count); |
6789 if ((status == OK) && (flags & QF_GETLIST_TICK)) | 6865 if ((status == OK) && (flags & QF_GETLIST_TICK)) |
6790 status = dict_add_number(retdict, "changedtick", qfl->qf_changedtick); | 6866 status = dict_add_number(retdict, "changedtick", qfl->qf_changedtick); |
6791 if ((status == OK) && (wp != NULL) && (flags & QF_GETLIST_FILEWINID)) | 6867 if ((status == OK) && (wp != NULL) && (flags & QF_GETLIST_FILEWINID)) |
7146 | 7222 |
7147 return OK; | 7223 return OK; |
7148 } | 7224 } |
7149 | 7225 |
7150 /* | 7226 /* |
7227 * Set the current index in the specified quickfix list | |
7228 */ | |
7229 static int | |
7230 qf_setprop_qftf(qf_info_T *qi UNUSED, qf_list_T *qfl, dictitem_T *di) | |
7231 { | |
7232 VIM_CLEAR(qfl->qf_qftf); | |
7233 if (di->di_tv.v_type == VAR_STRING | |
7234 && di->di_tv.vval.v_string != NULL) | |
7235 qfl->qf_qftf = vim_strsave(di->di_tv.vval.v_string); | |
7236 | |
7237 return OK; | |
7238 } | |
7239 | |
7240 /* | |
7151 * Set quickfix/location list properties (title, items, context). | 7241 * Set quickfix/location list properties (title, items, context). |
7152 * Also used to add items from parsing a list of lines. | 7242 * Also used to add items from parsing a list of lines. |
7153 * Used by the setqflist() and setloclist() Vim script functions. | 7243 * Used by the setqflist() and setloclist() Vim script functions. |
7154 */ | 7244 */ |
7155 static int | 7245 static int |
7184 retval = qf_setprop_items_from_lines(qi, qf_idx, what, di, action); | 7274 retval = qf_setprop_items_from_lines(qi, qf_idx, what, di, action); |
7185 if ((di = dict_find(what, (char_u *)"context", -1)) != NULL) | 7275 if ((di = dict_find(what, (char_u *)"context", -1)) != NULL) |
7186 retval = qf_setprop_context(qfl, di); | 7276 retval = qf_setprop_context(qfl, di); |
7187 if ((di = dict_find(what, (char_u *)"idx", -1)) != NULL) | 7277 if ((di = dict_find(what, (char_u *)"idx", -1)) != NULL) |
7188 retval = qf_setprop_curidx(qi, qfl, di); | 7278 retval = qf_setprop_curidx(qi, qfl, di); |
7279 if ((di = dict_find(what, (char_u *)"quickfixtextfunc", -1)) != NULL) | |
7280 retval = qf_setprop_qftf(qi, qfl, di); | |
7189 | 7281 |
7190 if (retval == OK) | 7282 if (retval == OK) |
7191 qf_list_changed(qfl); | 7283 qf_list_changed(qfl); |
7192 | 7284 |
7193 return retval; | 7285 return retval; |
7898 { | 7990 { |
7899 if (what_arg->v_type == VAR_UNKNOWN) | 7991 if (what_arg->v_type == VAR_UNKNOWN) |
7900 { | 7992 { |
7901 if (rettv_list_alloc(rettv) == OK) | 7993 if (rettv_list_alloc(rettv) == OK) |
7902 if (is_qf || wp != NULL) | 7994 if (is_qf || wp != NULL) |
7903 (void)get_errorlist(NULL, wp, -1, rettv->vval.v_list); | 7995 (void)get_errorlist(NULL, wp, -1, 0, rettv->vval.v_list); |
7904 } | 7996 } |
7905 else | 7997 else |
7906 { | 7998 { |
7907 if (rettv_dict_alloc(rettv) == OK) | 7999 if (rettv_dict_alloc(rettv) == OK) |
7908 if (is_qf || (wp != NULL)) | 8000 if (is_qf || (wp != NULL)) |