Mercurial > vim
comparison src/quickfix.c @ 11609:6f11697fb92c v8.0.0687
patch 8.0.0687: minor issues related to quickfix
commit https://github.com/vim/vim/commit/86f100dc0922e83bead7bcd5fd2bb2abbf153f46
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 28 21:26:27 2017 +0200
patch 8.0.0687: minor issues related to quickfix
Problem: Minor issues related to quickfix.
Solution: Set the proper return status for all cases in setqflist() and at
test cases for this. Move the "adding" flag outside of
FEAT_WINDOWS. Minor update to the setqflist() help text. (Yegappan
Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 28 Jun 2017 21:30:03 +0200 |
parents | 39787def24bb |
children | dd821396754e |
comparison
equal
deleted
inserted
replaced
11608:bc935094dcdb | 11609:6f11697fb92c |
---|---|
1161 { | 1161 { |
1162 qfstate_T state; | 1162 qfstate_T state; |
1163 qffields_T fields; | 1163 qffields_T fields; |
1164 #ifdef FEAT_WINDOWS | 1164 #ifdef FEAT_WINDOWS |
1165 qfline_T *old_last = NULL; | 1165 qfline_T *old_last = NULL; |
1166 #endif | |
1166 int adding = FALSE; | 1167 int adding = FALSE; |
1167 #endif | |
1168 static efm_T *fmt_first = NULL; | 1168 static efm_T *fmt_first = NULL; |
1169 char_u *efm; | 1169 char_u *efm; |
1170 static char_u *last_efm = NULL; | 1170 static char_u *last_efm = NULL; |
1171 int retval = -1; /* default: return error flag */ | 1171 int retval = -1; /* default: return error flag */ |
1172 int status; | 1172 int status; |
1197 } | 1197 } |
1198 | 1198 |
1199 if (newlist || qi->qf_curlist == qi->qf_listcount) | 1199 if (newlist || qi->qf_curlist == qi->qf_listcount) |
1200 /* make place for a new list */ | 1200 /* make place for a new list */ |
1201 qf_new_list(qi, qf_title); | 1201 qf_new_list(qi, qf_title); |
1202 #ifdef FEAT_WINDOWS | 1202 else |
1203 else if (qi->qf_lists[qi->qf_curlist].qf_count > 0) | |
1204 { | 1203 { |
1205 /* Adding to existing list, use last entry. */ | 1204 /* Adding to existing list, use last entry. */ |
1206 adding = TRUE; | 1205 adding = TRUE; |
1207 old_last = qi->qf_lists[qi->qf_curlist].qf_last; | 1206 #ifdef FEAT_WINDOWS |
1208 } | 1207 if (qi->qf_lists[qi->qf_curlist].qf_count > 0) |
1209 #endif | 1208 old_last = qi->qf_lists[qi->qf_curlist].qf_last; |
1209 #endif | |
1210 } | |
1210 | 1211 |
1211 /* Use the local value of 'errorformat' if it's set. */ | 1212 /* Use the local value of 'errorformat' if it's set. */ |
1212 if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL) | 1213 if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL) |
1213 efm = buf->b_p_efm; | 1214 efm = buf->b_p_efm; |
1214 else | 1215 else |
4783 if (l != NULL) | 4784 if (l != NULL) |
4784 { | 4785 { |
4785 (void)get_errorlist(wp, qf_idx, l); | 4786 (void)get_errorlist(wp, qf_idx, l); |
4786 dict_add_list(retdict, "items", l); | 4787 dict_add_list(retdict, "items", l); |
4787 } | 4788 } |
4789 else | |
4790 status = FAIL; | |
4788 } | 4791 } |
4789 | 4792 |
4790 if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) | 4793 if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) |
4791 { | 4794 { |
4792 if (qi->qf_lists[qf_idx].qf_ctx != NULL) | 4795 if (qi->qf_lists[qf_idx].qf_ctx != NULL) |
4793 { | 4796 { |
4794 di = dictitem_alloc((char_u *)"context"); | 4797 di = dictitem_alloc((char_u *)"context"); |
4795 if (di != NULL) | 4798 if (di != NULL) |
4796 { | 4799 { |
4797 copy_tv(qi->qf_lists[qf_idx].qf_ctx, &di->di_tv); | 4800 copy_tv(qi->qf_lists[qf_idx].qf_ctx, &di->di_tv); |
4798 if (dict_add(retdict, di) == FAIL) | 4801 status = dict_add(retdict, di); |
4802 if (status == FAIL) | |
4799 dictitem_free(di); | 4803 dictitem_free(di); |
4800 } | 4804 } |
4805 else | |
4806 status = FAIL; | |
4801 } | 4807 } |
4802 else | 4808 else |
4803 status = dict_add_nr_str(retdict, "context", 0L, (char_u *)""); | 4809 status = dict_add_nr_str(retdict, "context", 0L, (char_u *)""); |
4804 } | 4810 } |
4805 | 4811 |
5018 free_tv(qi->qf_lists[qf_idx].qf_ctx); | 5024 free_tv(qi->qf_lists[qf_idx].qf_ctx); |
5019 ctx = alloc_tv(); | 5025 ctx = alloc_tv(); |
5020 if (ctx != NULL) | 5026 if (ctx != NULL) |
5021 copy_tv(&di->di_tv, ctx); | 5027 copy_tv(&di->di_tv, ctx); |
5022 qi->qf_lists[qf_idx].qf_ctx = ctx; | 5028 qi->qf_lists[qf_idx].qf_ctx = ctx; |
5029 retval = OK; | |
5023 } | 5030 } |
5024 | 5031 |
5025 return retval; | 5032 return retval; |
5026 } | 5033 } |
5027 | 5034 |