@@ -2762,7 +2762,7 @@ qf_free_items(qf_info_T *qi, int idx)
27622762 {
27632763 qfp = qfl -> qf_start ;
27642764 qfpnext = qfp -> qf_next ;
2765- if (qfl -> qf_title != NULL && !stop )
2765+ if (!stop )
27662766 {
27672767 vim_free (qfp -> qf_text );
27682768 stop = (qfp == qfpnext );
@@ -4556,20 +4556,24 @@ unload_dummy_buffer(buf_T *buf, char_u *dirname_start)
45564556 * If qf_idx is -1, use the current list. Otherwise, use the specified list.
45574557 */
45584558 int
4559- get_errorlist (win_T * wp , int qf_idx , list_T * list )
4559+ get_errorlist (qf_info_T * qi_arg , win_T * wp , int qf_idx , list_T * list )
45604560{
4561- qf_info_T * qi = & ql_info ;
4561+ qf_info_T * qi = qi_arg ;
45624562 dict_T * dict ;
45634563 char_u buf [2 ];
45644564 qfline_T * qfp ;
45654565 int i ;
45664566 int bufnum ;
45674567
4568- if (wp ! = NULL )
4568+ if (qi = = NULL )
45694569 {
4570- qi = GET_LOC_LIST (wp );
4571- if (qi == NULL )
4572- return FAIL ;
4570+ qi = & ql_info ;
4571+ if (wp != NULL )
4572+ {
4573+ qi = GET_LOC_LIST (wp );
4574+ if (qi == NULL )
4575+ return FAIL ;
4576+ }
45734577 }
45744578
45754579 if (qf_idx == -1 )
@@ -4627,6 +4631,45 @@ enum {
46274631 QF_GETLIST_ALL = 0xFF
46284632};
46294633
4634+ /*
4635+ * Parse text from 'di' and return the quickfix list items
4636+ */
4637+ static int
4638+ qf_get_list_from_text (dictitem_T * di , dict_T * retdict )
4639+ {
4640+ int status = FAIL ;
4641+ qf_info_T * qi ;
4642+
4643+ /* Only string and list values are supported */
4644+ if ((di -> di_tv .v_type == VAR_STRING && di -> di_tv .vval .v_string != NULL )
4645+ || (di -> di_tv .v_type == VAR_LIST
4646+ && di -> di_tv .vval .v_list != NULL ))
4647+ {
4648+ qi = (qf_info_T * )alloc ((unsigned )sizeof (qf_info_T ));
4649+ if (qi != NULL )
4650+ {
4651+ vim_memset (qi , 0 , (size_t )(sizeof (qf_info_T )));
4652+ qi -> qf_refcount ++ ;
4653+
4654+ if (qf_init_ext (qi , 0 , NULL , NULL , & di -> di_tv , p_efm ,
4655+ TRUE, (linenr_T )0 , (linenr_T )0 , NULL , NULL ) > 0 )
4656+ {
4657+ list_T * l = list_alloc ();
4658+ if (l != NULL )
4659+ {
4660+ (void )get_errorlist (qi , NULL , 0 , l );
4661+ dict_add_list (retdict , "items" , l );
4662+ status = OK ;
4663+ }
4664+ qf_free (qi , 0 );
4665+ }
4666+ free (qi );
4667+ }
4668+ }
4669+
4670+ return status ;
4671+ }
4672+
46304673/*
46314674 * Return quickfix/location list details (title) as a
46324675 * dictionary. 'what' contains the details to return. If 'list_idx' is -1,
@@ -4641,6 +4684,9 @@ get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
46414684 dictitem_T * di ;
46424685 int flags = QF_GETLIST_NONE ;
46434686
4687+ if ((di = dict_find (what , (char_u * )"text" , -1 )) != NULL )
4688+ return qf_get_list_from_text (di , retdict );
4689+
46444690 if (wp != NULL )
46454691 {
46464692 qi = GET_LOC_LIST (wp );
@@ -4726,7 +4772,7 @@ get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
47264772 list_T * l = list_alloc ();
47274773 if (l != NULL )
47284774 {
4729- (void )get_errorlist (wp , qf_idx , l );
4775+ (void )get_errorlist (qi , NULL , qf_idx , l );
47304776 dict_add_list (retdict , "items" , l );
47314777 }
47324778 else
0 commit comments