Mercurial > vim
annotate src/quickfix.c @ 15867:4a3823e692d3
Added tag v8.1.0940 for changeset 6ddcd10aa7aff82a42f71dadf306d543dc3ff36d
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 17 Feb 2019 15:15:07 +0100 |
parents | 77e97f159554 |
children | f376cd250b07 |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
9982
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 * See README.txt for an overview of the Vim source code. | |
8 */ | |
9 | |
10 /* | |
11 * quickfix.c: functions for quickfix mode, using a file with error messages | |
12 */ | |
13 | |
14 #include "vim.h" | |
15 | |
16 #if defined(FEAT_QUICKFIX) || defined(PROTO) | |
17 | |
18 struct dir_stack_T | |
19 { | |
20 struct dir_stack_T *next; | |
21 char_u *dirname; | |
22 }; | |
23 | |
24 /* | |
230 | 25 * For each error the next struct is allocated and linked in a list. |
7 | 26 */ |
230 | 27 typedef struct qfline_S qfline_T; |
28 struct qfline_S | |
7 | 29 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
30 qfline_T *qf_next; // pointer to next error in the list |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
31 qfline_T *qf_prev; // pointer to previous error in the list |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
32 linenr_T qf_lnum; // line number where the error occurred |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
33 int qf_fnum; // file number for the line |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
34 int qf_col; // column where the error occurred |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
35 int qf_nr; // error number |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
36 char_u *qf_module; // module name for this error |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
37 char_u *qf_pattern; // search pattern for the error |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
38 char_u *qf_text; // description of the error |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
39 char_u qf_viscol; // set to TRUE if qf_col is screen column |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
40 char_u qf_cleared; // set to TRUE if line has been deleted |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
41 char_u qf_type; // type of the error (mostly 'E'); 1 for |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
42 // :helpgrep |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
43 char_u qf_valid; // valid error message detected |
7 | 44 }; |
45 | |
46 /* | |
47 * There is a stack of error lists. | |
48 */ | |
49 #define LISTCOUNT 10 | |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
50 #define INVALID_QFIDX (-1) |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
51 #define INVALID_QFBUFNR (0) |
7 | 52 |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
53 /* |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
54 * Quickfix list type. |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
55 */ |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
56 typedef enum |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
57 { |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
58 QFLT_QUICKFIX, // Quickfix list - global list |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
59 QFLT_LOCATION, // Location list - per window list |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
60 QFLT_INTERNAL // Internal - Temporary list used by getqflist()/getloclist() |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
61 } qfltype_T; |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
62 |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
63 /* |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
64 * Quickfix/Location list definition |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
65 * Contains a list of entries (qfline_T). qf_start points to the first entry |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
66 * and qf_last points to the last entry. qf_count contains the list size. |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
67 * |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
68 * Usually the list contains one or more entries. But an empty list can be |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
69 * created using setqflist()/setloclist() with a title and/or user context |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
70 * information and entries can be added later using setqflist()/setloclist(). |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
71 */ |
644 | 72 typedef struct qf_list_S |
7 | 73 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
74 int_u qf_id; // Unique identifier for this list |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
75 qfltype_T qfl_type; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
76 qfline_T *qf_start; // pointer to the first error |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
77 qfline_T *qf_last; // pointer to the last error |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
78 qfline_T *qf_ptr; // pointer to the current error |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
79 int qf_count; // number of errors (0 means empty list) |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
80 int qf_index; // current index in the error list |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
81 int qf_nonevalid; // TRUE if not a single valid entry found |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
82 char_u *qf_title; // title derived from the command that created |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
83 // the error list or set by setqflist |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
84 typval_T *qf_ctx; // context set by setqflist/setloclist |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
85 |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
86 struct dir_stack_T *qf_dir_stack; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
87 char_u *qf_directory; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
88 struct dir_stack_T *qf_file_stack; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
89 char_u *qf_currfile; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
90 int qf_multiline; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
91 int qf_multiignore; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
92 int qf_multiscan; |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
93 long qf_changedtick; |
644 | 94 } qf_list_T; |
95 | |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
96 /* |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
97 * Quickfix/Location list stack definition |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
98 * Contains a list of quickfix/location lists (qf_list_T) |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
99 */ |
644 | 100 struct qf_info_S |
101 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
102 // Count of references to this list. Used only for location lists. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
103 // When a location list window reference this list, qf_refcount |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
104 // will be 2. Otherwise, qf_refcount will be 1. When qf_refcount |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
105 // reaches 0, the list is freed. |
644 | 106 int qf_refcount; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
107 int qf_listcount; // current number of lists |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
108 int qf_curlist; // current error list |
644 | 109 qf_list_T qf_lists[LISTCOUNT]; |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
110 qfltype_T qfl_type; // type of list |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
111 int qf_bufnr; // quickfix window buffer number |
644 | 112 }; |
113 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
114 static qf_info_T ql_info; // global quickfix list |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
115 static int_u last_qf_id = 0; // Last used quickfix list id |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
116 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
117 #define FMT_PATTERNS 11 // maximum number of % recognized |
7 | 118 |
119 /* | |
120 * Structure used to hold the info of one part of 'errorformat' | |
121 */ | |
789 | 122 typedef struct efm_S efm_T; |
123 struct efm_S | |
7 | 124 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
125 regprog_T *prog; // pre-formatted part of 'errorformat' |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
126 efm_T *next; // pointer to next (NULL if last) |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
127 char_u addr[FMT_PATTERNS]; // indices of used % patterns |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
128 char_u prefix; // prefix of this format line: |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
129 // 'D' enter directory |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
130 // 'X' leave directory |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
131 // 'A' start of multi-line message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
132 // 'E' error message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
133 // 'W' warning message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
134 // 'I' informational message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
135 // 'C' continuation line |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
136 // 'Z' end of multi-line message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
137 // 'G' general, unspecific message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
138 // 'P' push file (partial) message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
139 // 'Q' pop/quit file (partial) message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
140 // 'O' overread (partial) message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
141 char_u flags; // additional flags given in prefix |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
142 // '-' do not include this line |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
143 // '+' include whole line in message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
144 int conthere; // %> used |
7 | 145 }; |
146 | |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
147 // List of location lists to be deleted. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
148 // Used to delay the deletion of locations lists by autocmds. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
149 typedef struct qf_delq_S |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
150 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
151 struct qf_delq_S *next; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
152 qf_info_T *qi; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
153 } qf_delq_T; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
154 static qf_delq_T *qf_delq_head = NULL; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
155 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
156 // Counter to prevent autocmds from freeing up location lists when they are |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
157 // still being used. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
158 static int quickfix_busy = 0; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
159 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
160 static efm_T *fmt_start = NULL; // cached across qf_parse_line() calls |
10367
4e4e116e3689
commit https://github.com/vim/vim/commit/63bed3d319b5d90765dbdae93a3579b6322d79fb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
161 |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
162 static void qf_new_list(qf_info_T *qi, char_u *qf_title); |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
163 static int qf_add_entry(qf_info_T *qi, int qf_idx, char_u *dir, char_u *fname, char_u *module, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid); |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
164 static void qf_free(qf_list_T *qfl); |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
165 static char_u *qf_types(int, int); |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
166 static int qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *, char_u *); |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
167 static char_u *qf_push_dir(char_u *, struct dir_stack_T **, int is_file_stack); |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
168 static char_u *qf_pop_dir(struct dir_stack_T **); |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
169 static char_u *qf_guess_filepath(qf_list_T *qfl, char_u *); |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
170 static void qf_fmt_text(char_u *text, char_u *buf, int bufsize); |
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
171 static int qf_win_pos_update(qf_info_T *qi, int old_qf_index); |
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
172 static win_T *qf_find_win(qf_info_T *qi); |
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
173 static buf_T *qf_find_buf(qf_info_T *qi); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
174 static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last); |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
175 static void qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last); |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
176 static buf_T *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *resulting_dir); |
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
177 static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start); |
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
178 static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start); |
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
179 static qf_info_T *ll_get_or_alloc_list(win_T *); |
7 | 180 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
181 // Quickfix window check helper macro |
644 | 182 #define IS_QF_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref == NULL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
183 // Location list window check helper macro |
644 | 184 #define IS_LL_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL) |
14560
8413e66d00a1
patch 8.1.0293: checks for type of stack is cryptic
Christian Brabandt <cb@256bit.org>
parents:
14552
diff
changeset
|
185 |
8413e66d00a1
patch 8.1.0293: checks for type of stack is cryptic
Christian Brabandt <cb@256bit.org>
parents:
14552
diff
changeset
|
186 // Quickfix and location list stack check helper macros |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
187 #define IS_QF_STACK(qi) (qi->qfl_type == QFLT_QUICKFIX) |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
188 #define IS_LL_STACK(qi) (qi->qfl_type == QFLT_LOCATION) |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
189 #define IS_QF_LIST(qfl) (qfl->qfl_type == QFLT_QUICKFIX) |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
190 #define IS_LL_LIST(qfl) (qfl->qfl_type == QFLT_LOCATION) |
14560
8413e66d00a1
patch 8.1.0293: checks for type of stack is cryptic
Christian Brabandt <cb@256bit.org>
parents:
14552
diff
changeset
|
191 |
644 | 192 /* |
193 * Return location list for window 'wp' | |
194 * For location list window, return the referenced location list | |
195 */ | |
196 #define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? wp->w_llist_ref : wp->w_llist) | |
197 | |
7 | 198 /* |
11443
30b3775addb2
patch 8.0.0605: the quickfix cached buffer may become invalid
Christian Brabandt <cb@256bit.org>
parents:
11426
diff
changeset
|
199 * Looking up a buffer can be slow if there are many. Remember the last one |
30b3775addb2
patch 8.0.0605: the quickfix cached buffer may become invalid
Christian Brabandt <cb@256bit.org>
parents:
11426
diff
changeset
|
200 * to make this a lot faster if there are multiple matches in the same file. |
30b3775addb2
patch 8.0.0605: the quickfix cached buffer may become invalid
Christian Brabandt <cb@256bit.org>
parents:
11426
diff
changeset
|
201 */ |
11447
698ee9d4fe9f
patch 8.0.0607: after :bwipe + :new bufref might still be valid
Christian Brabandt <cb@256bit.org>
parents:
11445
diff
changeset
|
202 static char_u *qf_last_bufname = NULL; |
698ee9d4fe9f
patch 8.0.0607: after :bwipe + :new bufref might still be valid
Christian Brabandt <cb@256bit.org>
parents:
11445
diff
changeset
|
203 static bufref_T qf_last_bufref = {NULL, 0, 0}; |
11443
30b3775addb2
patch 8.0.0605: the quickfix cached buffer may become invalid
Christian Brabandt <cb@256bit.org>
parents:
11426
diff
changeset
|
204 |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
205 static char *e_loc_list_changed = |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
206 N_("E926: Current location list was changed"); |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
207 |
11443
30b3775addb2
patch 8.0.0605: the quickfix cached buffer may become invalid
Christian Brabandt <cb@256bit.org>
parents:
11426
diff
changeset
|
208 /* |
9033
0536d1469b67
commit https://github.com/vim/vim/commit/6be8c8e165204b8aa4eeb8a52be87a58d8b41b9e
Christian Brabandt <cb@256bit.org>
parents:
8932
diff
changeset
|
209 * Maximum number of bytes allowed per line while reading a errorfile. |
0536d1469b67
commit https://github.com/vim/vim/commit/6be8c8e165204b8aa4eeb8a52be87a58d8b41b9e
Christian Brabandt <cb@256bit.org>
parents:
8932
diff
changeset
|
210 */ |
0536d1469b67
commit https://github.com/vim/vim/commit/6be8c8e165204b8aa4eeb8a52be87a58d8b41b9e
Christian Brabandt <cb@256bit.org>
parents:
8932
diff
changeset
|
211 #define LINE_MAXLEN 4096 |
0536d1469b67
commit https://github.com/vim/vim/commit/6be8c8e165204b8aa4eeb8a52be87a58d8b41b9e
Christian Brabandt <cb@256bit.org>
parents:
8932
diff
changeset
|
212 |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
213 static struct fmtpattern |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
214 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
215 char_u convchar; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
216 char *pattern; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
217 } fmt_pat[FMT_PATTERNS] = |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
218 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
219 {'f', ".\\+"}, // only used when at end |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
220 {'n', "\\d\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
221 {'l', "\\d\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
222 {'c', "\\d\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
223 {'t', "."}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
224 {'m', ".\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
225 {'r', ".*"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
226 {'p', "[- .]*"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
227 {'v', "\\d\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
228 {'s', ".\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
229 {'o', ".\\+"} |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
230 }; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
231 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
232 /* |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
233 * Convert an errorformat pattern to a regular expression pattern. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
234 * See fmt_pat definition above for the list of supported patterns. The |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
235 * pattern specifier is supplied in "efmpat". The converted pattern is stored |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
236 * in "regpat". Returns a pointer to the location after the pattern. |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
237 */ |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
238 static char_u * |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
239 efmpat_to_regpat( |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
240 char_u *efmpat, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
241 char_u *regpat, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
242 efm_T *efminfo, |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
243 int idx, |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
244 int round) |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
245 { |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
246 char_u *srcptr; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
247 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
248 if (efminfo->addr[idx]) |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
249 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
250 // Each errorformat pattern can occur only once |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
251 semsg(_("E372: Too many %%%c in format string"), *efmpat); |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
252 return NULL; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
253 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
254 if ((idx && idx < 6 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
255 && vim_strchr((char_u *)"DXOPQ", efminfo->prefix) != NULL) |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
256 || (idx == 6 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
257 && vim_strchr((char_u *)"OPQ", efminfo->prefix) == NULL)) |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
258 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
259 semsg(_("E373: Unexpected %%%c in format string"), *efmpat); |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
260 return NULL; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
261 } |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
262 efminfo->addr[idx] = (char_u)++round; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
263 *regpat++ = '\\'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
264 *regpat++ = '('; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
265 #ifdef BACKSLASH_IN_FILENAME |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
266 if (*efmpat == 'f') |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
267 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
268 // Also match "c:" in the file name, even when |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
269 // checking for a colon next: "%f:". |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
270 // "\%(\a:\)\=" |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
271 STRCPY(regpat, "\\%(\\a:\\)\\="); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
272 regpat += 10; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
273 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
274 #endif |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
275 if (*efmpat == 'f' && efmpat[1] != NUL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
276 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
277 if (efmpat[1] != '\\' && efmpat[1] != '%') |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
278 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
279 // A file name may contain spaces, but this isn't |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
280 // in "\f". For "%f:%l:%m" there may be a ":" in |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
281 // the file name. Use ".\{-1,}x" instead (x is |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
282 // the next character), the requirement that :999: |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
283 // follows should work. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
284 STRCPY(regpat, ".\\{-1,}"); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
285 regpat += 7; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
286 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
287 else |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
288 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
289 // File name followed by '\\' or '%': include as |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
290 // many file name chars as possible. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
291 STRCPY(regpat, "\\f\\+"); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
292 regpat += 4; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
293 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
294 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
295 else |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
296 { |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
297 srcptr = (char_u *)fmt_pat[idx].pattern; |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
298 while ((*regpat = *srcptr++) != NUL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
299 ++regpat; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
300 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
301 *regpat++ = '\\'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
302 *regpat++ = ')'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
303 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
304 return regpat; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
305 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
306 |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
307 /* |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
308 * Convert a scanf like format in 'errorformat' to a regular expression. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
309 * Returns a pointer to the location after the pattern. |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
310 */ |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
311 static char_u * |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
312 scanf_fmt_to_regpat( |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
313 char_u **pefmp, |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
314 char_u *efm, |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
315 int len, |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
316 char_u *regpat) |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
317 { |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
318 char_u *efmp = *pefmp; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
319 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
320 if (*efmp == '[' || *efmp == '\\') |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
321 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
322 if ((*regpat++ = *efmp) == '[') // %*[^a-z0-9] etc. |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
323 { |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
324 if (efmp[1] == '^') |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
325 *regpat++ = *++efmp; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
326 if (efmp < efm + len) |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
327 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
328 *regpat++ = *++efmp; // could be ']' |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
329 while (efmp < efm + len |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
330 && (*regpat++ = *++efmp) != ']') |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
331 // skip ; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
332 if (efmp == efm + len) |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
333 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
334 emsg(_("E374: Missing ] in format string")); |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
335 return NULL; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
336 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
337 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
338 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
339 else if (efmp < efm + len) // %*\D, %*\s etc. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
340 *regpat++ = *++efmp; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
341 *regpat++ = '\\'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
342 *regpat++ = '+'; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
343 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
344 else |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
345 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
346 // TODO: scanf()-like: %*ud, %*3c, %*f, ... ? |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
347 semsg(_("E375: Unsupported %%%c in format string"), *efmp); |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
348 return NULL; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
349 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
350 |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
351 *pefmp = efmp; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
352 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
353 return regpat; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
354 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
355 |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
356 /* |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
357 * Analyze/parse an errorformat prefix. |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
358 */ |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
359 static char_u * |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
360 efm_analyze_prefix(char_u *efmp, efm_T *efminfo) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
361 { |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
362 if (vim_strchr((char_u *)"+-", *efmp) != NULL) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
363 efminfo->flags = *efmp++; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
364 if (vim_strchr((char_u *)"DXAEWICZGOPQ", *efmp) != NULL) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
365 efminfo->prefix = *efmp; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
366 else |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
367 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
368 semsg(_("E376: Invalid %%%c in format string prefix"), *efmp); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
369 return NULL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
370 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
371 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
372 return efmp; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
373 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
374 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
375 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
376 * Converts a 'errorformat' string part in 'efm' to a regular expression |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
377 * pattern. The resulting regex pattern is returned in "regpat". Additional |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
378 * information about the 'erroformat' pattern is returned in "fmt_ptr". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
379 * Returns OK or FAIL. |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
380 */ |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
381 static int |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
382 efm_to_regpat( |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
383 char_u *efm, |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
384 int len, |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
385 efm_T *fmt_ptr, |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
386 char_u *regpat) |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
387 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
388 char_u *ptr; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
389 char_u *efmp; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
390 int round; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
391 int idx = 0; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
392 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
393 // Build a regexp pattern for a 'errorformat' option part |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
394 ptr = regpat; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
395 *ptr++ = '^'; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
396 round = 0; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
397 for (efmp = efm; efmp < efm + len; ++efmp) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
398 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
399 if (*efmp == '%') |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
400 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
401 ++efmp; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
402 for (idx = 0; idx < FMT_PATTERNS; ++idx) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
403 if (fmt_pat[idx].convchar == *efmp) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
404 break; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
405 if (idx < FMT_PATTERNS) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
406 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
407 ptr = efmpat_to_regpat(efmp, ptr, fmt_ptr, idx, round); |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
408 if (ptr == NULL) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
409 return FAIL; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
410 round++; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
411 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
412 else if (*efmp == '*') |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
413 { |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
414 ++efmp; |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
415 ptr = scanf_fmt_to_regpat(&efmp, efm, len, ptr); |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
416 if (ptr == NULL) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
417 return FAIL; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
418 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
419 else if (vim_strchr((char_u *)"%\\.^$~[", *efmp) != NULL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
420 *ptr++ = *efmp; // regexp magic characters |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
421 else if (*efmp == '#') |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
422 *ptr++ = '*'; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
423 else if (*efmp == '>') |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
424 fmt_ptr->conthere = TRUE; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
425 else if (efmp == efm + 1) // analyse prefix |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
426 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
427 // prefix is allowed only at the beginning of the errorformat |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
428 // option part |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
429 efmp = efm_analyze_prefix(efmp, fmt_ptr); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
430 if (efmp == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
431 return FAIL; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
432 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
433 else |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
434 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
435 semsg(_("E377: Invalid %%%c in format string"), *efmp); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
436 return FAIL; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
437 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
438 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
439 else // copy normal character |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
440 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
441 if (*efmp == '\\' && efmp + 1 < efm + len) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
442 ++efmp; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
443 else if (vim_strchr((char_u *)".*^$~[", *efmp) != NULL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
444 *ptr++ = '\\'; // escape regexp atoms |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
445 if (*efmp) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
446 *ptr++ = *efmp; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
447 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
448 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
449 *ptr++ = '$'; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
450 *ptr = NUL; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
451 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
452 return OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
453 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
454 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
455 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
456 * Free the 'errorformat' information list |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
457 */ |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
458 static void |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
459 free_efm_list(efm_T **efm_first) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
460 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
461 efm_T *efm_ptr; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
462 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
463 for (efm_ptr = *efm_first; efm_ptr != NULL; efm_ptr = *efm_first) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
464 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
465 *efm_first = efm_ptr->next; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
466 vim_regfree(efm_ptr->prog); |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
467 vim_free(efm_ptr); |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
468 } |
10367
4e4e116e3689
commit https://github.com/vim/vim/commit/63bed3d319b5d90765dbdae93a3579b6322d79fb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
469 fmt_start = NULL; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
470 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
471 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
472 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
473 * Compute the size of the buffer used to convert a 'errorformat' pattern into |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
474 * a regular expression pattern. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
475 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
476 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
477 efm_regpat_bufsz(char_u *efm) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
478 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
479 int sz; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
480 int i; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
481 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
482 sz = (FMT_PATTERNS * 3) + ((int)STRLEN(efm) << 2); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
483 for (i = FMT_PATTERNS; i > 0; ) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
484 sz += (int)STRLEN(fmt_pat[--i].pattern); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
485 #ifdef BACKSLASH_IN_FILENAME |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
486 sz += 12; // "%f" can become twelve chars longer (see efm_to_regpat) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
487 #else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
488 sz += 2; // "%f" can become two chars longer |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
489 #endif |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
490 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
491 return sz; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
492 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
493 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
494 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
495 * Return the length of a 'errorformat' option part (separated by ","). |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
496 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
497 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
498 efm_option_part_len(char_u *efm) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
499 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
500 int len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
501 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
502 for (len = 0; efm[len] != NUL && efm[len] != ','; ++len) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
503 if (efm[len] == '\\' && efm[len + 1] != NUL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
504 ++len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
505 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
506 return len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
507 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
508 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
509 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
510 * Parse the 'errorformat' option. Multiple parts in the 'errorformat' option |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
511 * are parsed and converted to regular expressions. Returns information about |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
512 * the parsed 'errorformat' option. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
513 */ |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
514 static efm_T * |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
515 parse_efm_option(char_u *efm) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
516 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
517 efm_T *fmt_ptr = NULL; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
518 efm_T *fmt_first = NULL; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
519 efm_T *fmt_last = NULL; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
520 char_u *fmtstr = NULL; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
521 int len; |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
522 int sz; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
523 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
524 // Each part of the format string is copied and modified from errorformat |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
525 // to regex prog. Only a few % characters are allowed. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
526 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
527 // Get some space to modify the format string into. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
528 sz = efm_regpat_bufsz(efm); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
529 if ((fmtstr = alloc(sz)) == NULL) |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
530 goto parse_efm_error; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
531 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
532 while (efm[0] != NUL) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
533 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
534 // Allocate a new eformat structure and put it at the end of the list |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
535 fmt_ptr = (efm_T *)alloc_clear((unsigned)sizeof(efm_T)); |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
536 if (fmt_ptr == NULL) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
537 goto parse_efm_error; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
538 if (fmt_first == NULL) // first one |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
539 fmt_first = fmt_ptr; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
540 else |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
541 fmt_last->next = fmt_ptr; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
542 fmt_last = fmt_ptr; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
543 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
544 // Isolate one part in the 'errorformat' option |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
545 len = efm_option_part_len(efm); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
546 |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
547 if (efm_to_regpat(efm, len, fmt_ptr, fmtstr) == FAIL) |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
548 goto parse_efm_error; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
549 if ((fmt_ptr->prog = vim_regcomp(fmtstr, RE_MAGIC + RE_STRING)) == NULL) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
550 goto parse_efm_error; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
551 // Advance to next part |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
552 efm = skip_to_option_part(efm + len); // skip comma and spaces |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
553 } |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
554 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
555 if (fmt_first == NULL) // nothing found |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
556 emsg(_("E378: 'errorformat' contains no pattern")); |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
557 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
558 goto parse_efm_end; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
559 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
560 parse_efm_error: |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
561 free_efm_list(&fmt_first); |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
562 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
563 parse_efm_end: |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
564 vim_free(fmtstr); |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
565 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
566 return fmt_first; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
567 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
568 |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
569 enum { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
570 QF_FAIL = 0, |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
571 QF_OK = 1, |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
572 QF_END_OF_INPUT = 2, |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
573 QF_NOMEM = 3, |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
574 QF_IGNORE_LINE = 4, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
575 QF_MULTISCAN = 5, |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
576 }; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
577 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
578 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
579 * State information used to parse lines and add entries to a quickfix/location |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
580 * list. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
581 */ |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
582 typedef struct { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
583 char_u *linebuf; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
584 int linelen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
585 char_u *growbuf; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
586 int growbufsiz; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
587 FILE *fd; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
588 typval_T *tv; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
589 char_u *p_str; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
590 listitem_T *p_li; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
591 buf_T *buf; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
592 linenr_T buflnum; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
593 linenr_T lnumlast; |
11063
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
594 vimconv_T vc; |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
595 } qfstate_T; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
596 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
597 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
598 * Allocate more memory for the line buffer used for parsing lines. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
599 */ |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
600 static char_u * |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
601 qf_grow_linebuf(qfstate_T *state, int newsz) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
602 { |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
603 char_u *p; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
604 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
605 // If the line exceeds LINE_MAXLEN exclude the last |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
606 // byte since it's not a NL character. |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
607 state->linelen = newsz > LINE_MAXLEN ? LINE_MAXLEN - 1 : newsz; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
608 if (state->growbuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
609 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
610 state->growbuf = alloc(state->linelen + 1); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
611 if (state->growbuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
612 return NULL; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
613 state->growbufsiz = state->linelen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
614 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
615 else if (state->linelen > state->growbufsiz) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
616 { |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
617 if ((p = vim_realloc(state->growbuf, state->linelen + 1)) == NULL) |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
618 return NULL; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
619 state->growbuf = p; |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
620 state->growbufsiz = state->linelen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
621 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
622 return state->growbuf; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
623 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
624 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
625 /* |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
626 * Get the next string (separated by newline) from state->p_str. |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
627 */ |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
628 static int |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
629 qf_get_next_str_line(qfstate_T *state) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
630 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
631 // Get the next line from the supplied string |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
632 char_u *p_str = state->p_str; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
633 char_u *p; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
634 int len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
635 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
636 if (*p_str == NUL) // Reached the end of the string |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
637 return QF_END_OF_INPUT; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
638 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
639 p = vim_strchr(p_str, '\n'); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
640 if (p != NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
641 len = (int)(p - p_str) + 1; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
642 else |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
643 len = (int)STRLEN(p_str); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
644 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
645 if (len > IOSIZE - 2) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
646 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
647 state->linebuf = qf_grow_linebuf(state, len); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
648 if (state->linebuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
649 return QF_NOMEM; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
650 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
651 else |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
652 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
653 state->linebuf = IObuff; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
654 state->linelen = len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
655 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
656 vim_strncpy(state->linebuf, p_str, state->linelen); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
657 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
658 // Increment using len in order to discard the rest of the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
659 // line if it exceeds LINE_MAXLEN. |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
660 p_str += len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
661 state->p_str = p_str; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
662 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
663 return QF_OK; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
664 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
665 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
666 /* |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
667 * Get the next string from state->p_Li. |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
668 */ |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
669 static int |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
670 qf_get_next_list_line(qfstate_T *state) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
671 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
672 listitem_T *p_li = state->p_li; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
673 int len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
674 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
675 while (p_li != NULL |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
676 && (p_li->li_tv.v_type != VAR_STRING |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
677 || p_li->li_tv.vval.v_string == NULL)) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
678 p_li = p_li->li_next; // Skip non-string items |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
679 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
680 if (p_li == NULL) // End of the list |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
681 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
682 state->p_li = NULL; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
683 return QF_END_OF_INPUT; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
684 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
685 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
686 len = (int)STRLEN(p_li->li_tv.vval.v_string); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
687 if (len > IOSIZE - 2) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
688 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
689 state->linebuf = qf_grow_linebuf(state, len); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
690 if (state->linebuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
691 return QF_NOMEM; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
692 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
693 else |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
694 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
695 state->linebuf = IObuff; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
696 state->linelen = len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
697 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
698 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
699 vim_strncpy(state->linebuf, p_li->li_tv.vval.v_string, state->linelen); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
700 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
701 state->p_li = p_li->li_next; // next item |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
702 return QF_OK; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
703 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
704 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
705 /* |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
706 * Get the next string from state->buf. |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
707 */ |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
708 static int |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
709 qf_get_next_buf_line(qfstate_T *state) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
710 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
711 char_u *p_buf = NULL; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
712 int len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
713 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
714 // Get the next line from the supplied buffer |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
715 if (state->buflnum > state->lnumlast) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
716 return QF_END_OF_INPUT; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
717 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
718 p_buf = ml_get_buf(state->buf, state->buflnum, FALSE); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
719 state->buflnum += 1; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
720 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
721 len = (int)STRLEN(p_buf); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
722 if (len > IOSIZE - 2) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
723 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
724 state->linebuf = qf_grow_linebuf(state, len); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
725 if (state->linebuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
726 return QF_NOMEM; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
727 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
728 else |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
729 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
730 state->linebuf = IObuff; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
731 state->linelen = len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
732 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
733 vim_strncpy(state->linebuf, p_buf, state->linelen); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
734 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
735 return QF_OK; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
736 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
737 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
738 /* |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
739 * Get the next string from file state->fd. |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
740 */ |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
741 static int |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
742 qf_get_next_file_line(qfstate_T *state) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
743 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
744 int discard; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
745 int growbuflen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
746 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
747 if (fgets((char *)IObuff, IOSIZE, state->fd) == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
748 return QF_END_OF_INPUT; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
749 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
750 discard = FALSE; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
751 state->linelen = (int)STRLEN(IObuff); |
9738
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
752 if (state->linelen == IOSIZE - 1 && !(IObuff[state->linelen - 1] == '\n')) |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
753 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
754 // The current line exceeds IObuff, continue reading using |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
755 // growbuf until EOL or LINE_MAXLEN bytes is read. |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
756 if (state->growbuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
757 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
758 state->growbufsiz = 2 * (IOSIZE - 1); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
759 state->growbuf = alloc(state->growbufsiz); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
760 if (state->growbuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
761 return QF_NOMEM; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
762 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
763 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
764 // Copy the read part of the line, excluding null-terminator |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
765 memcpy(state->growbuf, IObuff, IOSIZE - 1); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
766 growbuflen = state->linelen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
767 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
768 for (;;) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
769 { |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
770 char_u *p; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
771 |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
772 if (fgets((char *)state->growbuf + growbuflen, |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
773 state->growbufsiz - growbuflen, state->fd) == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
774 break; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
775 state->linelen = (int)STRLEN(state->growbuf + growbuflen); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
776 growbuflen += state->linelen; |
9738
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
777 if ((state->growbuf)[growbuflen - 1] == '\n') |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
778 break; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
779 if (state->growbufsiz == LINE_MAXLEN) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
780 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
781 discard = TRUE; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
782 break; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
783 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
784 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
785 state->growbufsiz = 2 * state->growbufsiz < LINE_MAXLEN |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
786 ? 2 * state->growbufsiz : LINE_MAXLEN; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
787 if ((p = vim_realloc(state->growbuf, state->growbufsiz)) == NULL) |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
788 return QF_NOMEM; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
789 state->growbuf = p; |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
790 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
791 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
792 while (discard) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
793 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
794 // The current line is longer than LINE_MAXLEN, continue |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
795 // reading but discard everything until EOL or EOF is |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
796 // reached. |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
797 if (fgets((char *)IObuff, IOSIZE, state->fd) == NULL |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
798 || (int)STRLEN(IObuff) < IOSIZE - 1 |
9738
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
799 || IObuff[IOSIZE - 1] == '\n') |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
800 break; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
801 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
802 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
803 state->linebuf = state->growbuf; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
804 state->linelen = growbuflen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
805 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
806 else |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
807 state->linebuf = IObuff; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
808 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
809 // Convert a line if it contains a non-ASCII character. |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
810 if (state->vc.vc_type != CONV_NONE && has_non_ascii(state->linebuf)) |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
811 { |
11063
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
812 char_u *line; |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
813 |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
814 line = string_convert(&state->vc, state->linebuf, &state->linelen); |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
815 if (line != NULL) |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
816 { |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
817 if (state->linelen < IOSIZE) |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
818 { |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
819 STRCPY(state->linebuf, line); |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
820 vim_free(line); |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
821 } |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
822 else |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
823 { |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
824 vim_free(state->growbuf); |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
825 state->linebuf = state->growbuf = line; |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
826 state->growbufsiz = state->linelen < LINE_MAXLEN |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
827 ? state->linelen : LINE_MAXLEN; |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
828 } |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
829 } |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
830 } |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
831 |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
832 return QF_OK; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
833 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
834 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
835 /* |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
836 * Get the next string from a file/buffer/list/string. |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
837 */ |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
838 static int |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
839 qf_get_nextline(qfstate_T *state) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
840 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
841 int status = QF_FAIL; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
842 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
843 if (state->fd == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
844 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
845 if (state->tv != NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
846 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
847 if (state->tv->v_type == VAR_STRING) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
848 // Get the next line from the supplied string |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
849 status = qf_get_next_str_line(state); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
850 else if (state->tv->v_type == VAR_LIST) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
851 // Get the next line from the supplied list |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
852 status = qf_get_next_list_line(state); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
853 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
854 else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
855 // Get the next line from the supplied buffer |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
856 status = qf_get_next_buf_line(state); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
857 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
858 else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
859 // Get the next line from the supplied file |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
860 status = qf_get_next_file_line(state); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
861 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
862 if (status != QF_OK) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
863 return status; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
864 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
865 // remove newline/CR from the line |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
866 if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\n') |
9738
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
867 { |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
868 state->linebuf[state->linelen - 1] = NUL; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
869 #ifdef USE_CRNL |
9738
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
870 if (state->linelen > 1 && state->linebuf[state->linelen - 2] == '\r') |
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
871 state->linebuf[state->linelen - 2] = NUL; |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
872 #endif |
9738
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
873 } |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
874 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
875 remove_bom(state->linebuf); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
876 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
877 return QF_OK; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
878 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
879 |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
880 typedef struct { |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
881 char_u *namebuf; |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
882 char_u *module; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
883 char_u *errmsg; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
884 int errmsglen; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
885 long lnum; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
886 int col; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
887 char_u use_viscol; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
888 char_u *pattern; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
889 int enr; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
890 int type; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
891 int valid; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
892 } qffields_T; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
893 |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
894 /* |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
895 * Parse the match for filename ('%f') pattern in regmatch. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
896 * Return the matched value in "fields->namebuf". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
897 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
898 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
899 qf_parse_fmt_f(regmatch_T *rmp, int midx, qffields_T *fields, int prefix) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
900 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
901 int c; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
902 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
903 if (rmp->startp[midx] == NULL || rmp->endp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
904 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
905 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
906 // Expand ~/file and $HOME/file to full path. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
907 c = *rmp->endp[midx]; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
908 *rmp->endp[midx] = NUL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
909 expand_env(rmp->startp[midx], fields->namebuf, CMDBUFFSIZE); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
910 *rmp->endp[midx] = c; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
911 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
912 // For separate filename patterns (%O, %P and %Q), the specified file |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
913 // should exist. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
914 if (vim_strchr((char_u *)"OPQ", prefix) != NULL |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
915 && mch_getperm(fields->namebuf) == -1) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
916 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
917 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
918 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
919 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
920 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
921 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
922 * Parse the match for error number ('%n') pattern in regmatch. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
923 * Return the matched value in "fields->enr". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
924 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
925 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
926 qf_parse_fmt_n(regmatch_T *rmp, int midx, qffields_T *fields) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
927 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
928 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
929 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
930 fields->enr = (int)atol((char *)rmp->startp[midx]); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
931 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
932 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
933 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
934 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
935 * Parse the match for line number (%l') pattern in regmatch. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
936 * Return the matched value in "fields->lnum". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
937 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
938 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
939 qf_parse_fmt_l(regmatch_T *rmp, int midx, qffields_T *fields) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
940 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
941 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
942 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
943 fields->lnum = atol((char *)rmp->startp[midx]); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
944 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
945 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
946 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
947 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
948 * Parse the match for column number ('%c') pattern in regmatch. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
949 * Return the matched value in "fields->col". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
950 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
951 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
952 qf_parse_fmt_c(regmatch_T *rmp, int midx, qffields_T *fields) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
953 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
954 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
955 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
956 fields->col = (int)atol((char *)rmp->startp[midx]); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
957 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
958 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
959 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
960 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
961 * Parse the match for error type ('%t') pattern in regmatch. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
962 * Return the matched value in "fields->type". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
963 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
964 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
965 qf_parse_fmt_t(regmatch_T *rmp, int midx, qffields_T *fields) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
966 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
967 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
968 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
969 fields->type = *rmp->startp[midx]; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
970 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
971 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
972 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
973 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
974 * Parse the match for '%+' format pattern. The whole matching line is included |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
975 * in the error string. Return the matched line in "fields->errmsg". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
976 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
977 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
978 qf_parse_fmt_plus(char_u *linebuf, int linelen, qffields_T *fields) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
979 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
980 char_u *p; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
981 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
982 if (linelen >= fields->errmsglen) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
983 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
984 // linelen + null terminator |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
985 if ((p = vim_realloc(fields->errmsg, linelen + 1)) == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
986 return QF_NOMEM; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
987 fields->errmsg = p; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
988 fields->errmsglen = linelen + 1; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
989 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
990 vim_strncpy(fields->errmsg, linebuf, linelen); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
991 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
992 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
993 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
994 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
995 * Parse the match for error message ('%m') pattern in regmatch. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
996 * Return the matched value in "fields->errmsg". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
997 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
998 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
999 qf_parse_fmt_m(regmatch_T *rmp, int midx, qffields_T *fields) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1000 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1001 char_u *p; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1002 int len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1003 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1004 if (rmp->startp[midx] == NULL || rmp->endp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1005 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1006 len = (int)(rmp->endp[midx] - rmp->startp[midx]); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1007 if (len >= fields->errmsglen) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1008 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1009 // len + null terminator |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1010 if ((p = vim_realloc(fields->errmsg, len + 1)) == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1011 return QF_NOMEM; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1012 fields->errmsg = p; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1013 fields->errmsglen = len + 1; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1014 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1015 vim_strncpy(fields->errmsg, rmp->startp[midx], len); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1016 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1017 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1018 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1019 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1020 * Parse the match for rest of a single-line file message ('%r') pattern. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1021 * Return the matched value in "tail". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1022 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1023 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1024 qf_parse_fmt_r(regmatch_T *rmp, int midx, char_u **tail) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1025 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1026 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1027 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1028 *tail = rmp->startp[midx]; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1029 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1030 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1031 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1032 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1033 * Parse the match for the pointer line ('%p') pattern in regmatch. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1034 * Return the matched value in "fields->col". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1035 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1036 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1037 qf_parse_fmt_p(regmatch_T *rmp, int midx, qffields_T *fields) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1038 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1039 char_u *match_ptr; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1040 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1041 if (rmp->startp[midx] == NULL || rmp->endp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1042 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1043 fields->col = 0; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1044 for (match_ptr = rmp->startp[midx]; match_ptr != rmp->endp[midx]; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1045 ++match_ptr) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1046 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1047 ++fields->col; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1048 if (*match_ptr == TAB) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1049 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1050 fields->col += 7; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1051 fields->col -= fields->col % 8; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1052 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1053 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1054 ++fields->col; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1055 fields->use_viscol = TRUE; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1056 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1057 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1058 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1059 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1060 * Parse the match for the virtual column number ('%v') pattern in regmatch. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1061 * Return the matched value in "fields->col". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1062 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1063 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1064 qf_parse_fmt_v(regmatch_T *rmp, int midx, qffields_T *fields) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1065 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1066 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1067 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1068 fields->col = (int)atol((char *)rmp->startp[midx]); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1069 fields->use_viscol = TRUE; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1070 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1071 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1072 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1073 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1074 * Parse the match for the search text ('%s') pattern in regmatch. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1075 * Return the matched value in "fields->pattern". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1076 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1077 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1078 qf_parse_fmt_s(regmatch_T *rmp, int midx, qffields_T *fields) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1079 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1080 int len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1081 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1082 if (rmp->startp[midx] == NULL || rmp->endp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1083 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1084 len = (int)(rmp->endp[midx] - rmp->startp[midx]); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1085 if (len > CMDBUFFSIZE - 5) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1086 len = CMDBUFFSIZE - 5; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1087 STRCPY(fields->pattern, "^\\V"); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1088 STRNCAT(fields->pattern, rmp->startp[midx], len); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1089 fields->pattern[len + 3] = '\\'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1090 fields->pattern[len + 4] = '$'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1091 fields->pattern[len + 5] = NUL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1092 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1093 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1094 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1095 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1096 * Parse the match for the module ('%o') pattern in regmatch. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1097 * Return the matched value in "fields->module". |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1098 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1099 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1100 qf_parse_fmt_o(regmatch_T *rmp, int midx, qffields_T *fields) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1101 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1102 int len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1103 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1104 if (rmp->startp[midx] == NULL || rmp->endp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1105 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1106 len = (int)(rmp->endp[midx] - rmp->startp[midx]); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1107 if (len > CMDBUFFSIZE) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1108 len = CMDBUFFSIZE; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1109 STRNCAT(fields->module, rmp->startp[midx], len); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1110 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1111 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1112 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1113 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1114 * 'errorformat' format pattern parser functions. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1115 * The '%f' and '%r' formats are parsed differently from other formats. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1116 * See qf_parse_match() for details. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1117 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1118 static int (*qf_parse_fmt[FMT_PATTERNS])(regmatch_T *, int, qffields_T *) = |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1119 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1120 NULL, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1121 qf_parse_fmt_n, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1122 qf_parse_fmt_l, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1123 qf_parse_fmt_c, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1124 qf_parse_fmt_t, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1125 qf_parse_fmt_m, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1126 NULL, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1127 qf_parse_fmt_p, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1128 qf_parse_fmt_v, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1129 qf_parse_fmt_s, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1130 qf_parse_fmt_o |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1131 }; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1132 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1133 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1134 * Parse the error format pattern matches in "regmatch" and set the values in |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1135 * "fields". fmt_ptr contains the 'efm' format specifiers/prefixes that have a |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1136 * match. Returns QF_OK if all the matches are successfully parsed. On |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1137 * failure, returns QF_FAIL or QF_NOMEM. |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1138 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1139 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1140 qf_parse_match( |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1141 char_u *linebuf, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1142 int linelen, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1143 efm_T *fmt_ptr, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1144 regmatch_T *regmatch, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1145 qffields_T *fields, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1146 int qf_multiline, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1147 int qf_multiscan, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1148 char_u **tail) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1149 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1150 int idx = fmt_ptr->prefix; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1151 int i; |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1152 int midx; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1153 int status; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1154 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1155 if ((idx == 'C' || idx == 'Z') && !qf_multiline) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1156 return QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1157 if (vim_strchr((char_u *)"EWI", idx) != NULL) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1158 fields->type = idx; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1159 else |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1160 fields->type = 0; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1161 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1162 // Extract error message data from matched line. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1163 // We check for an actual submatch, because "\[" and "\]" in |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1164 // the 'errorformat' may cause the wrong submatch to be used. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1165 for (i = 0; i < FMT_PATTERNS; i++) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1166 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1167 status = QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1168 midx = (int)fmt_ptr->addr[i]; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1169 if (i == 0 && midx > 0) // %f |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1170 status = qf_parse_fmt_f(regmatch, midx, fields, idx); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1171 else if (i == 5) |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1172 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1173 if (fmt_ptr->flags == '+' && !qf_multiscan) // %+ |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1174 status = qf_parse_fmt_plus(linebuf, linelen, fields); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1175 else if (midx > 0) // %m |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1176 status = qf_parse_fmt_m(regmatch, midx, fields); |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1177 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1178 else if (i == 6 && midx > 0) // %r |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1179 status = qf_parse_fmt_r(regmatch, midx, tail); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1180 else if (midx > 0) // others |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1181 status = (qf_parse_fmt[i])(regmatch, midx, fields); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1182 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1183 if (status != QF_OK) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1184 return status; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1185 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1186 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1187 return QF_OK; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1188 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1189 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1190 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1191 * Parse an error line in 'linebuf' using a single error format string in |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1192 * 'fmt_ptr->prog' and return the matching values in 'fields'. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1193 * Returns QF_OK if the efm format matches completely and the fields are |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1194 * successfully copied. Otherwise returns QF_FAIL or QF_NOMEM. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1195 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1196 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1197 qf_parse_get_fields( |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1198 char_u *linebuf, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1199 int linelen, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1200 efm_T *fmt_ptr, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1201 qffields_T *fields, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1202 int qf_multiline, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1203 int qf_multiscan, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1204 char_u **tail) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1205 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1206 regmatch_T regmatch; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1207 int status = QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1208 int r; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1209 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1210 if (qf_multiscan && |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1211 vim_strchr((char_u *)"OPQ", fmt_ptr->prefix) == NULL) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1212 return QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1213 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1214 fields->namebuf[0] = NUL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1215 fields->module[0] = NUL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1216 fields->pattern[0] = NUL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1217 if (!qf_multiscan) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1218 fields->errmsg[0] = NUL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1219 fields->lnum = 0; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1220 fields->col = 0; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1221 fields->use_viscol = FALSE; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1222 fields->enr = -1; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1223 fields->type = 0; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1224 *tail = NULL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1225 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1226 // Always ignore case when looking for a matching error. |
13921
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1227 regmatch.rm_ic = TRUE; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1228 regmatch.regprog = fmt_ptr->prog; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1229 r = vim_regexec(®match, linebuf, (colnr_T)0); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1230 fmt_ptr->prog = regmatch.regprog; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1231 if (r) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1232 status = qf_parse_match(linebuf, linelen, fmt_ptr, ®match, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1233 fields, qf_multiline, qf_multiscan, tail); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1234 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1235 return status; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1236 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1237 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1238 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1239 * Parse directory error format prefixes (%D and %X). |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1240 * Push and pop directories from the directory stack when scanning directory |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1241 * names. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1242 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1243 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1244 qf_parse_dir_pfx(int idx, qffields_T *fields, qf_list_T *qfl) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1245 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1246 if (idx == 'D') // enter directory |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1247 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1248 if (*fields->namebuf == NUL) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1249 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
1250 emsg(_("E379: Missing or empty directory name")); |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1251 return QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1252 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1253 qfl->qf_directory = |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1254 qf_push_dir(fields->namebuf, &qfl->qf_dir_stack, FALSE); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1255 if (qfl->qf_directory == NULL) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1256 return QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1257 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1258 else if (idx == 'X') // leave directory |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1259 qfl->qf_directory = qf_pop_dir(&qfl->qf_dir_stack); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1260 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1261 return QF_OK; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1262 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1263 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1264 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1265 * Parse global file name error format prefixes (%O, %P and %Q). |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1266 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1267 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1268 qf_parse_file_pfx( |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1269 int idx, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1270 qffields_T *fields, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1271 qf_list_T *qfl, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1272 char_u *tail) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1273 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1274 fields->valid = FALSE; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1275 if (*fields->namebuf == NUL || mch_getperm(fields->namebuf) >= 0) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1276 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1277 if (*fields->namebuf && idx == 'P') |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1278 qfl->qf_currfile = |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1279 qf_push_dir(fields->namebuf, &qfl->qf_file_stack, TRUE); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1280 else if (idx == 'Q') |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1281 qfl->qf_currfile = qf_pop_dir(&qfl->qf_file_stack); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1282 *fields->namebuf = NUL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1283 if (tail && *tail) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1284 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1285 STRMOVE(IObuff, skipwhite(tail)); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1286 qfl->qf_multiscan = TRUE; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1287 return QF_MULTISCAN; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1288 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1289 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1290 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1291 return QF_OK; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1292 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1293 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1294 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1295 * Parse a non-error line (a line which doesn't match any of the error |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1296 * format in 'efm'). |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1297 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1298 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1299 qf_parse_line_nomatch(char_u *linebuf, int linelen, qffields_T *fields) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1300 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1301 char_u *p; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1302 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1303 fields->namebuf[0] = NUL; // no match found, remove file name |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1304 fields->lnum = 0; // don't jump to this line |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1305 fields->valid = FALSE; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1306 if (linelen >= fields->errmsglen) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1307 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1308 // linelen + null terminator |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1309 if ((p = vim_realloc(fields->errmsg, linelen + 1)) == NULL) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1310 return QF_NOMEM; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1311 fields->errmsg = p; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1312 fields->errmsglen = linelen + 1; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1313 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1314 // copy whole line to error message |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1315 vim_strncpy(fields->errmsg, linebuf, linelen); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1316 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1317 return QF_OK; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1318 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1319 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1320 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1321 * Parse multi-line error format prefixes (%C and %Z) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1322 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1323 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1324 qf_parse_multiline_pfx( |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1325 qf_info_T *qi, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1326 int qf_idx, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1327 int idx, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1328 qf_list_T *qfl, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1329 qffields_T *fields) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1330 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1331 char_u *ptr; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1332 int len; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1333 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1334 if (!qfl->qf_multiignore) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1335 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1336 qfline_T *qfprev = qfl->qf_last; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1337 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1338 if (qfprev == NULL) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1339 return QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1340 if (*fields->errmsg && !qfl->qf_multiignore) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1341 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1342 len = (int)STRLEN(qfprev->qf_text); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1343 if ((ptr = alloc((unsigned)(len + STRLEN(fields->errmsg) + 2))) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1344 == NULL) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1345 return QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1346 STRCPY(ptr, qfprev->qf_text); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1347 vim_free(qfprev->qf_text); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1348 qfprev->qf_text = ptr; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1349 *(ptr += len) = '\n'; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1350 STRCPY(++ptr, fields->errmsg); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1351 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1352 if (qfprev->qf_nr == -1) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1353 qfprev->qf_nr = fields->enr; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1354 if (vim_isprintc(fields->type) && !qfprev->qf_type) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1355 // only printable chars allowed |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1356 qfprev->qf_type = fields->type; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1357 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1358 if (!qfprev->qf_lnum) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1359 qfprev->qf_lnum = fields->lnum; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1360 if (!qfprev->qf_col) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1361 qfprev->qf_col = fields->col; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1362 qfprev->qf_viscol = fields->use_viscol; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1363 if (!qfprev->qf_fnum) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1364 qfprev->qf_fnum = qf_get_fnum(qi, qf_idx, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1365 qfl->qf_directory, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1366 *fields->namebuf || qfl->qf_directory != NULL |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1367 ? fields->namebuf |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1368 : qfl->qf_currfile != NULL && fields->valid |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1369 ? qfl->qf_currfile : 0); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1370 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1371 if (idx == 'Z') |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1372 qfl->qf_multiline = qfl->qf_multiignore = FALSE; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1373 line_breakcheck(); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1374 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1375 return QF_IGNORE_LINE; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1376 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1377 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1378 /* |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1379 * Parse a line and get the quickfix fields. |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1380 * Return the QF_ status. |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1381 */ |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1382 static int |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1383 qf_parse_line( |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1384 qf_info_T *qi, |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1385 int qf_idx, |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1386 char_u *linebuf, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1387 int linelen, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1388 efm_T *fmt_first, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1389 qffields_T *fields) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1390 { |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1391 efm_T *fmt_ptr; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1392 int idx = 0; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1393 char_u *tail = NULL; |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1394 qf_list_T *qfl = &qi->qf_lists[qf_idx]; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1395 int status; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1396 |
13612
89223f5d5d12
patch 8.0.1678: errorformat "%r" implies "%>"
Christian Brabandt <cb@256bit.org>
parents:
13594
diff
changeset
|
1397 restofline: |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1398 // If there was no %> item start at the first pattern |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1399 if (fmt_start == NULL) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1400 fmt_ptr = fmt_first; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1401 else |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1402 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1403 // Otherwise start from the last used pattern |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1404 fmt_ptr = fmt_start; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1405 fmt_start = NULL; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1406 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1407 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1408 // Try to match each part of 'errorformat' until we find a complete |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1409 // match or no match. |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1410 fields->valid = TRUE; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1411 for ( ; fmt_ptr != NULL; fmt_ptr = fmt_ptr->next) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1412 { |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1413 idx = fmt_ptr->prefix; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1414 status = qf_parse_get_fields(linebuf, linelen, fmt_ptr, fields, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1415 qfl->qf_multiline, qfl->qf_multiscan, &tail); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1416 if (status == QF_NOMEM) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1417 return status; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1418 if (status == QF_OK) |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1419 break; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1420 } |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1421 qfl->qf_multiscan = FALSE; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1422 |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1423 if (fmt_ptr == NULL || idx == 'D' || idx == 'X') |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1424 { |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1425 if (fmt_ptr != NULL) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1426 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1427 // 'D' and 'X' directory specifiers |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1428 status = qf_parse_dir_pfx(idx, fields, qfl); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1429 if (status != QF_OK) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1430 return status; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1431 } |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1432 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1433 status = qf_parse_line_nomatch(linebuf, linelen, fields); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1434 if (status != QF_OK) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1435 return status; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1436 |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1437 if (fmt_ptr == NULL) |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1438 qfl->qf_multiline = qfl->qf_multiignore = FALSE; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1439 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1440 else if (fmt_ptr != NULL) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1441 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1442 // honor %> item |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1443 if (fmt_ptr->conthere) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1444 fmt_start = fmt_ptr; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1445 |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1446 if (vim_strchr((char_u *)"AEWI", idx) != NULL) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1447 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1448 qfl->qf_multiline = TRUE; // start of a multi-line message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1449 qfl->qf_multiignore = FALSE;// reset continuation |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1450 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1451 else if (vim_strchr((char_u *)"CZ", idx) != NULL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1452 { // continuation of multi-line msg |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1453 status = qf_parse_multiline_pfx(qi, qf_idx, idx, qfl, fields); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1454 if (status != QF_OK) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1455 return status; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1456 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1457 else if (vim_strchr((char_u *)"OPQ", idx) != NULL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1458 { // global file names |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1459 status = qf_parse_file_pfx(idx, fields, qfl, tail); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1460 if (status == QF_MULTISCAN) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1461 goto restofline; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1462 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1463 if (fmt_ptr->flags == '-') // generally exclude this line |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1464 { |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1465 if (qfl->qf_multiline) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1466 // also exclude continuation lines |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1467 qfl->qf_multiignore = TRUE; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1468 return QF_IGNORE_LINE; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1469 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1470 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1471 |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1472 return QF_OK; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1473 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1474 |
9033
0536d1469b67
commit https://github.com/vim/vim/commit/6be8c8e165204b8aa4eeb8a52be87a58d8b41b9e
Christian Brabandt <cb@256bit.org>
parents:
8932
diff
changeset
|
1475 /* |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1476 * Returns TRUE if the specified quickfix/location stack is empty |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1477 */ |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1478 static int |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1479 qf_stack_empty(qf_info_T *qi) |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1480 { |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1481 return qi == NULL || qi->qf_listcount <= 0; |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1482 } |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1483 |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1484 /* |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1485 * Returns TRUE if the specified quickfix/location list is empty. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1486 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1487 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1488 qf_list_empty(qf_info_T *qi, int qf_idx) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1489 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1490 if (qi == NULL || qf_idx < 0 || qf_idx >= LISTCOUNT) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1491 return TRUE; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1492 return qi->qf_lists[qf_idx].qf_count <= 0; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1493 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1494 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1495 /* |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1496 * Allocate the fields used for parsing lines and populating a quickfix list. |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1497 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1498 static int |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1499 qf_alloc_fields(qffields_T *pfields) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1500 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1501 pfields->namebuf = alloc_id(CMDBUFFSIZE + 1, aid_qf_namebuf); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1502 pfields->module = alloc_id(CMDBUFFSIZE + 1, aid_qf_module); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1503 pfields->errmsglen = CMDBUFFSIZE + 1; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1504 pfields->errmsg = alloc_id(pfields->errmsglen, aid_qf_errmsg); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1505 pfields->pattern = alloc_id(CMDBUFFSIZE + 1, aid_qf_pattern); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1506 if (pfields->namebuf == NULL || pfields->errmsg == NULL |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1507 || pfields->pattern == NULL || pfields->module == NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1508 return FAIL; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1509 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1510 return OK; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1511 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1512 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1513 /* |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1514 * Free the fields used for parsing lines and populating a quickfix list. |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1515 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1516 static void |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1517 qf_free_fields(qffields_T *pfields) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1518 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1519 vim_free(pfields->namebuf); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1520 vim_free(pfields->module); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1521 vim_free(pfields->errmsg); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1522 vim_free(pfields->pattern); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1523 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1524 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1525 /* |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1526 * Setup the state information used for parsing lines and populating a |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1527 * quickfix list. |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1528 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1529 static int |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1530 qf_setup_state( |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1531 qfstate_T *pstate, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1532 char_u *enc, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1533 char_u *efile, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1534 typval_T *tv, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1535 buf_T *buf, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1536 linenr_T lnumfirst, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1537 linenr_T lnumlast) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1538 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1539 pstate->vc.vc_type = CONV_NONE; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1540 if (enc != NULL && *enc != NUL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1541 convert_setup(&pstate->vc, enc, p_enc); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1542 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1543 if (efile != NULL && (pstate->fd = mch_fopen((char *)efile, "r")) == NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1544 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
1545 semsg(_(e_openerrf), efile); |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1546 return FAIL; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1547 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1548 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1549 if (tv != NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1550 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1551 if (tv->v_type == VAR_STRING) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1552 pstate->p_str = tv->vval.v_string; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1553 else if (tv->v_type == VAR_LIST) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1554 pstate->p_li = tv->vval.v_list->lv_first; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1555 pstate->tv = tv; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1556 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1557 pstate->buf = buf; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1558 pstate->buflnum = lnumfirst; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1559 pstate->lnumlast = lnumlast; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1560 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1561 return OK; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1562 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1563 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1564 /* |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1565 * Cleanup the state information used for parsing lines and populating a |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1566 * quickfix list. |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1567 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1568 static void |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1569 qf_cleanup_state(qfstate_T *pstate) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1570 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1571 if (pstate->fd != NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1572 fclose(pstate->fd); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1573 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1574 vim_free(pstate->growbuf); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1575 if (pstate->vc.vc_type != CONV_NONE) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1576 convert_setup(&pstate->vc, NULL, NULL); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1577 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1578 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1579 /* |
41 | 1580 * Read the errorfile "efile" into memory, line by line, building the error |
1581 * list. | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
1582 * Alternative: when "efile" is NULL read errors from buffer "buf". |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
1583 * Alternative: when "tv" is not NULL get errors from the string or list. |
41 | 1584 * Always use 'errorformat' from "buf" if there is a local value. |
2411
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
1585 * Then "lnumfirst" and "lnumlast" specify the range of lines to use. |
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
1586 * Set the title of the list to "qf_title". |
41 | 1587 * Return -1 for error, number of errors for success. |
1588 */ | |
1589 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1590 qf_init_ext( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1591 qf_info_T *qi, |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1592 int qf_idx, |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1593 char_u *efile, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1594 buf_T *buf, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1595 typval_T *tv, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1596 char_u *errorformat, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1597 int newlist, // TRUE: start a new error list |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1598 linenr_T lnumfirst, // first line number to use |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1599 linenr_T lnumlast, // last line number to use |
11063
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
1600 char_u *qf_title, |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
1601 char_u *enc) |
41 | 1602 { |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1603 qf_list_T *qfl; |
11063
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
1604 qfstate_T state; |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
1605 qffields_T fields; |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
1606 qfline_T *old_last = NULL; |
10369
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1607 int adding = FALSE; |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1608 static efm_T *fmt_first = NULL; |
7 | 1609 char_u *efm; |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1610 static char_u *last_efm = NULL; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1611 int retval = -1; // default: return error flag |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
1612 int status; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1613 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1614 // Do not used the cached buffer, it may have been wiped out. |
13244
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13115
diff
changeset
|
1615 VIM_CLEAR(qf_last_bufname); |
11443
30b3775addb2
patch 8.0.0605: the quickfix cached buffer may become invalid
Christian Brabandt <cb@256bit.org>
parents:
11426
diff
changeset
|
1616 |
11063
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
1617 vim_memset(&state, 0, sizeof(state)); |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
1618 vim_memset(&fields, 0, sizeof(fields)); |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1619 if ((qf_alloc_fields(&fields) == FAIL) || |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1620 (qf_setup_state(&state, enc, efile, tv, buf, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1621 lnumfirst, lnumlast) == FAIL)) |
7 | 1622 goto qf_init_end; |
1623 | |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1624 if (newlist || qf_idx == qi->qf_listcount) |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1625 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1626 // make place for a new list |
3965 | 1627 qf_new_list(qi, qf_title); |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1628 qf_idx = qi->qf_curlist; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1629 } |
11609
6f11697fb92c
patch 8.0.0687: minor issues related to quickfix
Christian Brabandt <cb@256bit.org>
parents:
11589
diff
changeset
|
1630 else |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
1631 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1632 // Adding to existing list, use last entry. |
10369
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1633 adding = TRUE; |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1634 if (!qf_list_empty(qi, qf_idx)) |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1635 old_last = qi->qf_lists[qf_idx].qf_last; |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
1636 } |
7 | 1637 |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1638 qfl = &qi->qf_lists[qf_idx]; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1639 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1640 // Use the local value of 'errorformat' if it's set. |
446 | 1641 if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL) |
41 | 1642 efm = buf->b_p_efm; |
7 | 1643 else |
1644 efm = errorformat; | |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
1645 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1646 // If the errorformat didn't change between calls, then reuse the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1647 // previously parsed values. |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1648 if (last_efm == NULL || (STRCMP(last_efm, efm) != 0)) |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1649 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1650 // free the previously parsed data |
13244
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13115
diff
changeset
|
1651 VIM_CLEAR(last_efm); |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1652 free_efm_list(&fmt_first); |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1653 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1654 // parse the current 'efm' |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1655 fmt_first = parse_efm_option(efm); |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1656 if (fmt_first != NULL) |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1657 last_efm = vim_strsave(efm); |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1658 } |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1659 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1660 if (fmt_first == NULL) // nothing found |
7 | 1661 goto error2; |
1662 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1663 // got_int is reset here, because it was probably set when killing the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1664 // ":make" command, but we still want to read the errorfile then. |
7 | 1665 got_int = FALSE; |
1666 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1667 // Read the lines in the error file one by one. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1668 // Try to recognize one of the error formats in each line. |
41 | 1669 while (!got_int) |
7 | 1670 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1671 // Get the next line from a file/buffer/list/string |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
1672 status = qf_get_nextline(&state); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1673 if (status == QF_NOMEM) // memory alloc failure |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
1674 goto qf_init_end; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1675 if (status == QF_END_OF_INPUT) // end of input |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
1676 break; |
7 | 1677 |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1678 status = qf_parse_line(qi, qf_idx, state.linebuf, state.linelen, |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1679 fmt_first, &fields); |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1680 if (status == QF_FAIL) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1681 goto error2; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1682 if (status == QF_NOMEM) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1683 goto qf_init_end; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1684 if (status == QF_IGNORE_LINE) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1685 continue; |
7 | 1686 |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
1687 if (qf_add_entry(qi, |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1688 qf_idx, |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1689 qfl->qf_directory, |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1690 (*fields.namebuf || qfl->qf_directory != NULL) |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1691 ? fields.namebuf |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1692 : ((qfl->qf_currfile != NULL && fields.valid) |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1693 ? qfl->qf_currfile : (char_u *)NULL), |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
1694 fields.module, |
1065 | 1695 0, |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1696 fields.errmsg, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1697 fields.lnum, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1698 fields.col, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1699 fields.use_viscol, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1700 fields.pattern, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1701 fields.enr, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1702 fields.type, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1703 fields.valid) == FAIL) |
7 | 1704 goto error2; |
1705 line_breakcheck(); | |
1706 } | |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
1707 if (state.fd == NULL || !ferror(state.fd)) |
7 | 1708 { |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1709 if (qfl->qf_index == 0) |
7 | 1710 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1711 // no valid entry found |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1712 qfl->qf_ptr = qfl->qf_start; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1713 qfl->qf_index = 1; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1714 qfl->qf_nonevalid = TRUE; |
7 | 1715 } |
1716 else | |
1717 { | |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1718 qfl->qf_nonevalid = FALSE; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1719 if (qfl->qf_ptr == NULL) |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1720 qfl->qf_ptr = qfl->qf_start; |
7 | 1721 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1722 // return number of matches |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1723 retval = qfl->qf_count; |
9369
ce5b79b005ec
commit https://github.com/vim/vim/commit/bcf7772a23624edc0942120e564f6b4ac95604ad
Christian Brabandt <cb@256bit.org>
parents:
9365
diff
changeset
|
1724 goto qf_init_end; |
7 | 1725 } |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
1726 emsg(_(e_readerrf)); |
7 | 1727 error2: |
10369
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1728 if (!adding) |
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1729 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1730 // Error when creating a new list. Free the new list |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
1731 qf_free(qfl); |
10369
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1732 qi->qf_listcount--; |
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1733 if (qi->qf_curlist > 0) |
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1734 --qi->qf_curlist; |
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1735 } |
9369
ce5b79b005ec
commit https://github.com/vim/vim/commit/bcf7772a23624edc0942120e564f6b4ac95604ad
Christian Brabandt <cb@256bit.org>
parents:
9365
diff
changeset
|
1736 qf_init_end: |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1737 if (qf_idx == qi->qf_curlist) |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
1738 qf_update_buffer(qi, old_last); |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1739 qf_cleanup_state(&state); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1740 qf_free_fields(&fields); |
7 | 1741 |
1742 return retval; | |
1743 } | |
1744 | |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1745 /* |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1746 * Read the errorfile "efile" into memory, line by line, building the error |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1747 * list. Set the error list's title to qf_title. |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1748 * Return -1 for error, number of errors for success. |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1749 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1750 int |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1751 qf_init(win_T *wp, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1752 char_u *efile, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1753 char_u *errorformat, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1754 int newlist, // TRUE: start a new error list |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1755 char_u *qf_title, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1756 char_u *enc) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1757 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1758 qf_info_T *qi = &ql_info; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1759 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1760 if (wp != NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1761 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1762 qi = ll_get_or_alloc_list(wp); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1763 if (qi == NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1764 return FAIL; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1765 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1766 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1767 return qf_init_ext(qi, qi->qf_curlist, efile, curbuf, NULL, errorformat, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1768 newlist, (linenr_T)0, (linenr_T)0, qf_title, enc); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1769 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1770 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1771 /* |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1772 * Set the title of the specified quickfix list. Frees the previous title. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1773 * Prepends ':' to the title. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1774 */ |
6079 | 1775 static void |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
1776 qf_store_title(qf_list_T *qfl, char_u *title) |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
1777 { |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
1778 VIM_CLEAR(qfl->qf_title); |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
1779 |
6079 | 1780 if (title != NULL) |
1781 { | |
1782 char_u *p = alloc((int)STRLEN(title) + 2); | |
1783 | |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
1784 qfl->qf_title = p; |
6079 | 1785 if (p != NULL) |
13921
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1786 STRCPY(p, title); |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1787 } |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1788 } |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1789 |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1790 /* |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1791 * The title of a quickfix/location list is set, by default, to the command |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1792 * that created the quickfix list with the ":" prefix. |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1793 * Create a quickfix list title string by prepending ":" to a user command. |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1794 * Returns a pointer to a static buffer with the title. |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1795 */ |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1796 static char_u * |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1797 qf_cmdtitle(char_u *cmd) |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1798 { |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1799 static char_u qftitle_str[IOSIZE]; |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1800 |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1801 vim_snprintf((char *)qftitle_str, IOSIZE, ":%s", (char *)cmd); |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1802 return qftitle_str; |
6079 | 1803 } |
1804 | |
7 | 1805 /* |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
1806 * Prepare for adding a new quickfix list. If the current list is in the |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
1807 * middle of the stack, then all the following lists are freed and then |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
1808 * the new list is added. |
7 | 1809 */ |
1810 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1811 qf_new_list(qf_info_T *qi, char_u *qf_title) |
7 | 1812 { |
1813 int i; | |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
1814 qf_list_T *qfl; |
7 | 1815 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1816 // If the current entry is not the last entry, delete entries beyond |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1817 // the current entry. This makes it possible to browse in a tree-like |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1818 // way with ":grep'. |
644 | 1819 while (qi->qf_listcount > qi->qf_curlist + 1) |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
1820 qf_free(&qi->qf_lists[--qi->qf_listcount]); |
7 | 1821 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1822 // When the stack is full, remove to oldest entry |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1823 // Otherwise, add a new entry. |
644 | 1824 if (qi->qf_listcount == LISTCOUNT) |
7 | 1825 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
1826 qf_free(&qi->qf_lists[0]); |
7 | 1827 for (i = 1; i < LISTCOUNT; ++i) |
644 | 1828 qi->qf_lists[i - 1] = qi->qf_lists[i]; |
1829 qi->qf_curlist = LISTCOUNT - 1; | |
7 | 1830 } |
1831 else | |
644 | 1832 qi->qf_curlist = qi->qf_listcount++; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
1833 qfl = &qi->qf_lists[qi->qf_curlist]; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
1834 vim_memset(qfl, 0, (size_t)(sizeof(qf_list_T))); |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
1835 qf_store_title(qfl, qf_title); |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
1836 qfl->qfl_type = qi->qfl_type; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
1837 qfl->qf_id = ++last_qf_id; |
7 | 1838 } |
1839 | |
644 | 1840 /* |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1841 * Queue location list stack delete request. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1842 */ |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1843 static void |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1844 locstack_queue_delreq(qf_info_T *qi) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1845 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1846 qf_delq_T *q; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1847 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1848 q = (qf_delq_T *)alloc((unsigned)sizeof(qf_delq_T)); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1849 if (q != NULL) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1850 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1851 q->qi = qi; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1852 q->next = qf_delq_head; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1853 qf_delq_head = q; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1854 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1855 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1856 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1857 /* |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1858 * Return the global quickfix stack window buffer number. |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1859 */ |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1860 int |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1861 qf_stack_get_bufnr(void) |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1862 { |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1863 return ql_info.qf_bufnr; |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1864 } |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1865 |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1866 /* |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1867 * Wipe the quickfix window buffer (if present) for the specified |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1868 * quickfix/location list. |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1869 */ |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1870 static void |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1871 wipe_qf_buffer(qf_info_T *qi) |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1872 { |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1873 buf_T *qfbuf; |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1874 |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1875 if (qi->qf_bufnr != INVALID_QFBUFNR) |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1876 { |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1877 qfbuf = buflist_findnr(qi->qf_bufnr); |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1878 if (qfbuf != NULL && qfbuf->b_nwindows == 0) |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1879 { |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1880 // If the quickfix buffer is not loaded in any window, then |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1881 // wipe the buffer. |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1882 close_buffer(NULL, qfbuf, DOBUF_WIPE, FALSE); |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1883 qi->qf_bufnr = INVALID_QFBUFNR; |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1884 } |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1885 } |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1886 } |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1887 |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1888 /* |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
1889 * Free a location list stack |
644 | 1890 */ |
1891 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1892 ll_free_all(qf_info_T **pqi) |
359 | 1893 { |
1894 int i; | |
644 | 1895 qf_info_T *qi; |
1896 | |
1897 qi = *pqi; | |
1898 if (qi == NULL) | |
1899 return; | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1900 *pqi = NULL; // Remove reference to this list |
644 | 1901 |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1902 // If the location list is still in use, then queue the delete request |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1903 // to be processed later. |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1904 if (quickfix_busy > 0) |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1905 { |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1906 locstack_queue_delreq(qi); |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1907 return; |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1908 } |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1909 |
644 | 1910 qi->qf_refcount--; |
1911 if (qi->qf_refcount < 1) | |
1912 { | |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1913 // No references to this location list. |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1914 // If the quickfix window buffer is loaded, then wipe it |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1915 wipe_qf_buffer(qi); |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1916 |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1917 for (i = 0; i < qi->qf_listcount; ++i) |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1918 qf_free(&qi->qf_lists[i]); |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
1919 vim_free(qi); |
644 | 1920 } |
359 | 1921 } |
644 | 1922 |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1923 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1924 * Free all the quickfix/location lists in the stack. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1925 */ |
644 | 1926 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1927 qf_free_all(win_T *wp) |
644 | 1928 { |
1929 int i; | |
1930 qf_info_T *qi = &ql_info; | |
1931 | |
1932 if (wp != NULL) | |
1933 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1934 // location list |
644 | 1935 ll_free_all(&wp->w_llist); |
1936 ll_free_all(&wp->w_llist_ref); | |
1937 } | |
1938 else | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1939 // quickfix list |
644 | 1940 for (i = 0; i < qi->qf_listcount; ++i) |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
1941 qf_free(&qi->qf_lists[i]); |
644 | 1942 } |
359 | 1943 |
7 | 1944 /* |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1945 * Delay freeing of location list stacks when the quickfix code is running. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1946 * Used to avoid problems with autocmds freeing location list stacks when the |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1947 * quickfix code is still referencing the stack. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1948 * Must always call decr_quickfix_busy() exactly once after this. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1949 */ |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1950 static void |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1951 incr_quickfix_busy(void) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1952 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1953 quickfix_busy++; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1954 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1955 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1956 /* |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1957 * Safe to free location list stacks. Process any delayed delete requests. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1958 */ |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1959 static void |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1960 decr_quickfix_busy(void) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1961 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1962 if (--quickfix_busy == 0) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1963 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1964 // No longer referencing the location lists. Process all the pending |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1965 // delete requests. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1966 while (qf_delq_head != NULL) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1967 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1968 qf_delq_T *q = qf_delq_head; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1969 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1970 qf_delq_head = q->next; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1971 ll_free_all(&q->qi); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1972 vim_free(q); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1973 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1974 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1975 #ifdef ABORT_ON_INTERNAL_ERROR |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1976 if (quickfix_busy < 0) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1977 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
1978 emsg("quickfix_busy has become negative"); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1979 abort(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1980 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1981 #endif |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1982 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1983 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1984 #if defined(EXITFREE) || defined(PROTO) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1985 void |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1986 check_quickfix_busy(void) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1987 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1988 if (quickfix_busy != 0) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1989 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
1990 semsg("quickfix_busy not zero on exit: %ld", (long)quickfix_busy); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1991 # ifdef ABORT_ON_INTERNAL_ERROR |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1992 abort(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1993 # endif |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1994 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1995 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1996 #endif |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1997 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1998 /* |
7 | 1999 * Add an entry to the end of the list of errors. |
2000 * Returns OK or FAIL. | |
2001 */ | |
2002 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2003 qf_add_entry( |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2004 qf_info_T *qi, // quickfix list |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2005 int qf_idx, // list index |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2006 char_u *dir, // optional directory name |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2007 char_u *fname, // file name or NULL |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2008 char_u *module, // module name or NULL |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2009 int bufnum, // buffer number or zero |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2010 char_u *mesg, // message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2011 long lnum, // line number |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2012 int col, // column |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2013 int vis_col, // using visual column |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2014 char_u *pattern, // search pattern |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2015 int nr, // error number |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2016 int type, // type character |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2017 int valid) // valid entry |
7 | 2018 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2019 qf_list_T *qfl = &qi->qf_lists[qf_idx]; |
230 | 2020 qfline_T *qfp; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2021 qfline_T **lastp; // pointer to qf_last or NULL |
7 | 2022 |
230 | 2023 if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL) |
7 | 2024 return FAIL; |
1065 | 2025 if (bufnum != 0) |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2026 { |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2027 buf_T *buf = buflist_findnr(bufnum); |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2028 |
1065 | 2029 qfp->qf_fnum = bufnum; |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2030 if (buf != NULL) |
9608
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
2031 buf->b_has_qf_entry |= |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2032 IS_QF_LIST(qfl) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2033 } |
1065 | 2034 else |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
2035 qfp->qf_fnum = qf_get_fnum(qi, qf_idx, dir, fname); |
7 | 2036 if ((qfp->qf_text = vim_strsave(mesg)) == NULL) |
2037 { | |
2038 vim_free(qfp); | |
2039 return FAIL; | |
2040 } | |
2041 qfp->qf_lnum = lnum; | |
2042 qfp->qf_col = col; | |
170 | 2043 qfp->qf_viscol = vis_col; |
230 | 2044 if (pattern == NULL || *pattern == NUL) |
2045 qfp->qf_pattern = NULL; | |
2046 else if ((qfp->qf_pattern = vim_strsave(pattern)) == NULL) | |
2047 { | |
2048 vim_free(qfp->qf_text); | |
2049 vim_free(qfp); | |
2050 return FAIL; | |
2051 } | |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2052 if (module == NULL || *module == NUL) |
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2053 qfp->qf_module = NULL; |
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2054 else if ((qfp->qf_module = vim_strsave(module)) == NULL) |
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2055 { |
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2056 vim_free(qfp->qf_text); |
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2057 vim_free(qfp->qf_pattern); |
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2058 vim_free(qfp); |
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2059 return FAIL; |
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2060 } |
7 | 2061 qfp->qf_nr = nr; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2062 if (type != 1 && !vim_isprintc(type)) // only printable chars allowed |
7 | 2063 type = 0; |
2064 qfp->qf_type = type; | |
2065 qfp->qf_valid = valid; | |
2066 | |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2067 lastp = &qfl->qf_last; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2068 if (qf_list_empty(qi, qf_idx)) // first element in the list |
7 | 2069 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2070 qfl->qf_start = qfp; |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2071 qfl->qf_ptr = qfp; |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2072 qfl->qf_index = 0; |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2073 qfp->qf_prev = NULL; |
7 | 2074 } |
2075 else | |
2076 { | |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2077 qfp->qf_prev = *lastp; |
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2078 (*lastp)->qf_next = qfp; |
7 | 2079 } |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2080 qfp->qf_next = NULL; |
7 | 2081 qfp->qf_cleared = FALSE; |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2082 *lastp = qfp; |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2083 ++qfl->qf_count; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2084 if (qfl->qf_index == 0 && qfp->qf_valid) // first valid entry |
7 | 2085 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2086 qfl->qf_index = qfl->qf_count; |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2087 qfl->qf_ptr = qfp; |
7 | 2088 } |
2089 | |
2090 return OK; | |
2091 } | |
2092 | |
2093 /* | |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2094 * Allocate a new quickfix/location list stack |
644 | 2095 */ |
659 | 2096 static qf_info_T * |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2097 qf_alloc_stack(qfltype_T qfltype) |
644 | 2098 { |
659 | 2099 qf_info_T *qi; |
2100 | |
14495
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
2101 qi = (qf_info_T *)alloc_clear((unsigned)sizeof(qf_info_T)); |
659 | 2102 if (qi != NULL) |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2103 { |
659 | 2104 qi->qf_refcount++; |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2105 qi->qfl_type = qfltype; |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
2106 qi->qf_bufnr = INVALID_QFBUFNR; |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2107 } |
659 | 2108 return qi; |
644 | 2109 } |
2110 | |
2111 /* | |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2112 * Return the location list stack for window 'wp'. |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2113 * If not present, allocate a location list stack |
644 | 2114 */ |
2115 static qf_info_T * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2116 ll_get_or_alloc_list(win_T *wp) |
644 | 2117 { |
2118 if (IS_LL_WINDOW(wp)) | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2119 // For a location list window, use the referenced location list |
644 | 2120 return wp->w_llist_ref; |
2121 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2122 // For a non-location list window, w_llist_ref should not point to a |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2123 // location list. |
644 | 2124 ll_free_all(&wp->w_llist_ref); |
2125 | |
2126 if (wp->w_llist == NULL) | |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2127 wp->w_llist = qf_alloc_stack(QFLT_LOCATION); // new location list |
644 | 2128 return wp->w_llist; |
2129 } | |
2130 | |
2131 /* | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2132 * Copy location list entries from 'from_qfl' to 'to_qfl'. |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2133 */ |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2134 static int |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2135 copy_loclist_entries(qf_list_T *from_qfl, qf_list_T *to_qfl, qf_info_T *to_qi) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2136 { |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2137 int i; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2138 qfline_T *from_qfp; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2139 qfline_T *prevp; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2140 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2141 // copy all the location entries in this list |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2142 for (i = 0, from_qfp = from_qfl->qf_start; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2143 i < from_qfl->qf_count && from_qfp != NULL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2144 ++i, from_qfp = from_qfp->qf_next) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2145 { |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2146 if (qf_add_entry(to_qi, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2147 to_qi->qf_curlist, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2148 NULL, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2149 NULL, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2150 from_qfp->qf_module, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2151 0, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2152 from_qfp->qf_text, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2153 from_qfp->qf_lnum, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2154 from_qfp->qf_col, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2155 from_qfp->qf_viscol, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2156 from_qfp->qf_pattern, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2157 from_qfp->qf_nr, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2158 0, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2159 from_qfp->qf_valid) == FAIL) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2160 return FAIL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2161 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2162 // qf_add_entry() will not set the qf_num field, as the |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2163 // directory and file names are not supplied. So the qf_fnum |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2164 // field is copied here. |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2165 prevp = to_qfl->qf_last; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2166 prevp->qf_fnum = from_qfp->qf_fnum; // file number |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2167 prevp->qf_type = from_qfp->qf_type; // error type |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2168 if (from_qfl->qf_ptr == from_qfp) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2169 to_qfl->qf_ptr = prevp; // current location |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2170 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2171 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2172 return OK; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2173 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2174 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2175 /* |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2176 * Copy the specified location list 'from_qfl' to 'to_qfl'. |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2177 */ |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2178 static int |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2179 copy_loclist(qf_list_T *from_qfl, qf_list_T *to_qfl, qf_info_T *to_qi) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2180 { |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2181 // Some of the fields are populated by qf_add_entry() |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2182 to_qfl->qfl_type = from_qfl->qfl_type; |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2183 to_qfl->qf_nonevalid = from_qfl->qf_nonevalid; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2184 to_qfl->qf_count = 0; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2185 to_qfl->qf_index = 0; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2186 to_qfl->qf_start = NULL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2187 to_qfl->qf_last = NULL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2188 to_qfl->qf_ptr = NULL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2189 if (from_qfl->qf_title != NULL) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2190 to_qfl->qf_title = vim_strsave(from_qfl->qf_title); |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2191 else |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2192 to_qfl->qf_title = NULL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2193 if (from_qfl->qf_ctx != NULL) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2194 { |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2195 to_qfl->qf_ctx = alloc_tv(); |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2196 if (to_qfl->qf_ctx != NULL) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2197 copy_tv(from_qfl->qf_ctx, to_qfl->qf_ctx); |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2198 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2199 else |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2200 to_qfl->qf_ctx = NULL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2201 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2202 if (from_qfl->qf_count) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2203 if (copy_loclist_entries(from_qfl, to_qfl, to_qi) == FAIL) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2204 return FAIL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2205 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2206 to_qfl->qf_index = from_qfl->qf_index; // current index in the list |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2207 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2208 // Assign a new ID for the location list |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2209 to_qfl->qf_id = ++last_qf_id; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2210 to_qfl->qf_changedtick = 0L; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2211 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2212 // When no valid entries are present in the list, qf_ptr points to |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2213 // the first item in the list |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2214 if (to_qfl->qf_nonevalid) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2215 { |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2216 to_qfl->qf_ptr = to_qfl->qf_start; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2217 to_qfl->qf_index = 1; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2218 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2219 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2220 return OK; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2221 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2222 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2223 /* |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2224 * Copy the location list stack 'from' window to 'to' window. |
644 | 2225 */ |
2226 void | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2227 copy_loclist_stack(win_T *from, win_T *to) |
644 | 2228 { |
2229 qf_info_T *qi; | |
2230 int idx; | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2231 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2232 // When copying from a location list window, copy the referenced |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2233 // location list. For other windows, copy the location list for |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2234 // that window. |
644 | 2235 if (IS_LL_WINDOW(from)) |
2236 qi = from->w_llist_ref; | |
2237 else | |
2238 qi = from->w_llist; | |
2239 | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2240 if (qi == NULL) // no location list to copy |
644 | 2241 return; |
2242 | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2243 // allocate a new location list |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2244 if ((to->w_llist = qf_alloc_stack(QFLT_LOCATION)) == NULL) |
644 | 2245 return; |
2246 | |
2247 to->w_llist->qf_listcount = qi->qf_listcount; | |
2248 | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2249 // Copy the location lists one at a time |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
2250 for (idx = 0; idx < qi->qf_listcount; ++idx) |
644 | 2251 { |
2252 to->w_llist->qf_curlist = idx; | |
2253 | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2254 if (copy_loclist(&qi->qf_lists[idx], |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2255 &to->w_llist->qf_lists[idx], to->w_llist) == FAIL) |
644 | 2256 { |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2257 qf_free_all(to); |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2258 return; |
644 | 2259 } |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2260 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2261 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2262 to->w_llist->qf_curlist = qi->qf_curlist; // current list |
644 | 2263 } |
2264 | |
2265 /* | |
10379
73e2a7abe2a3
commit https://github.com/vim/vim/commit/7618e00d3b8bfe064cfc524640d754607361f9df
Christian Brabandt <cb@256bit.org>
parents:
10369
diff
changeset
|
2266 * Get buffer number for file "directory/fname". |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2267 * Also sets the b_has_qf_entry flag. |
7 | 2268 */ |
2269 static int | |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
2270 qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *directory, char_u *fname) |
7 | 2271 { |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
2272 qf_list_T *qfl = &qi->qf_lists[qf_idx]; |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2273 char_u *ptr = NULL; |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2274 buf_T *buf; |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2275 char_u *bufname; |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2276 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2277 if (fname == NULL || *fname == NUL) // no file name |
7 | 2278 return 0; |
2279 | |
2823 | 2280 #ifdef VMS |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2281 vms_remove_version(fname); |
2823 | 2282 #endif |
2283 #ifdef BACKSLASH_IN_FILENAME | |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2284 if (directory != NULL) |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2285 slash_adjust(directory); |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2286 slash_adjust(fname); |
2823 | 2287 #endif |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2288 if (directory != NULL && !vim_isAbsName(fname) |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2289 && (ptr = concat_fnames(directory, fname, TRUE)) != NULL) |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2290 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2291 // Here we check if the file really exists. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2292 // This should normally be true, but if make works without |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2293 // "leaving directory"-messages we might have missed a |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2294 // directory change. |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2295 if (mch_getperm(ptr) < 0) |
7 | 2296 { |
2297 vim_free(ptr); | |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
2298 directory = qf_guess_filepath(qfl, fname); |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2299 if (directory) |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2300 ptr = concat_fnames(directory, fname, TRUE); |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2301 else |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2302 ptr = vim_strsave(fname); |
7 | 2303 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2304 // Use concatenated directory name and file name |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2305 bufname = ptr; |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2306 } |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2307 else |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2308 bufname = fname; |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2309 |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2310 if (qf_last_bufname != NULL && STRCMP(bufname, qf_last_bufname) == 0 |
9475
4d8f7f8da90c
commit https://github.com/vim/vim/commit/b25f9a97e9aad3cbb4bc3fe87cdbd5700f8aa0c6
Christian Brabandt <cb@256bit.org>
parents:
9473
diff
changeset
|
2311 && bufref_valid(&qf_last_bufref)) |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2312 { |
9475
4d8f7f8da90c
commit https://github.com/vim/vim/commit/b25f9a97e9aad3cbb4bc3fe87cdbd5700f8aa0c6
Christian Brabandt <cb@256bit.org>
parents:
9473
diff
changeset
|
2313 buf = qf_last_bufref.br_buf; |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2314 vim_free(ptr); |
7 | 2315 } |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2316 else |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2317 { |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2318 vim_free(qf_last_bufname); |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2319 buf = buflist_new(bufname, NULL, (linenr_T)0, BLN_NOOPT); |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2320 if (bufname == ptr) |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2321 qf_last_bufname = bufname; |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2322 else |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2323 qf_last_bufname = vim_strsave(bufname); |
9475
4d8f7f8da90c
commit https://github.com/vim/vim/commit/b25f9a97e9aad3cbb4bc3fe87cdbd5700f8aa0c6
Christian Brabandt <cb@256bit.org>
parents:
9473
diff
changeset
|
2324 set_bufref(&qf_last_bufref, buf); |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2325 } |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2326 if (buf == NULL) |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2327 return 0; |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2328 |
9608
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
2329 buf->b_has_qf_entry = |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2330 IS_QF_LIST(qfl) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2331 return buf->b_fnum; |
7 | 2332 } |
2333 | |
2334 /* | |
9334
674f9e3ccd1a
commit https://github.com/vim/vim/commit/38df43bd13a2498cc96b3ddd9a20dd75126bd171
Christian Brabandt <cb@256bit.org>
parents:
9201
diff
changeset
|
2335 * Push dirbuf onto the directory stack and return pointer to actual dir or |
674f9e3ccd1a
commit https://github.com/vim/vim/commit/38df43bd13a2498cc96b3ddd9a20dd75126bd171
Christian Brabandt <cb@256bit.org>
parents:
9201
diff
changeset
|
2336 * NULL on error. |
7 | 2337 */ |
2338 static char_u * | |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
2339 qf_push_dir(char_u *dirbuf, struct dir_stack_T **stackptr, int is_file_stack) |
7 | 2340 { |
2341 struct dir_stack_T *ds_new; | |
2342 struct dir_stack_T *ds_ptr; | |
2343 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2344 // allocate new stack element and hook it in |
7 | 2345 ds_new = (struct dir_stack_T *)alloc((unsigned)sizeof(struct dir_stack_T)); |
2346 if (ds_new == NULL) | |
2347 return NULL; | |
2348 | |
2349 ds_new->next = *stackptr; | |
2350 *stackptr = ds_new; | |
2351 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2352 // store directory on the stack |
7 | 2353 if (vim_isAbsName(dirbuf) |
2354 || (*stackptr)->next == NULL | |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
2355 || (*stackptr && is_file_stack)) |
7 | 2356 (*stackptr)->dirname = vim_strsave(dirbuf); |
2357 else | |
2358 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2359 // Okay we don't have an absolute path. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2360 // dirbuf must be a subdir of one of the directories on the stack. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2361 // Let's search... |
7 | 2362 ds_new = (*stackptr)->next; |
2363 (*stackptr)->dirname = NULL; | |
2364 while (ds_new) | |
2365 { | |
2366 vim_free((*stackptr)->dirname); | |
2367 (*stackptr)->dirname = concat_fnames(ds_new->dirname, dirbuf, | |
2368 TRUE); | |
2369 if (mch_isdir((*stackptr)->dirname) == TRUE) | |
2370 break; | |
2371 | |
2372 ds_new = ds_new->next; | |
2373 } | |
2374 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2375 // clean up all dirs we already left |
7 | 2376 while ((*stackptr)->next != ds_new) |
2377 { | |
2378 ds_ptr = (*stackptr)->next; | |
2379 (*stackptr)->next = (*stackptr)->next->next; | |
2380 vim_free(ds_ptr->dirname); | |
2381 vim_free(ds_ptr); | |
2382 } | |
2383 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2384 // Nothing found -> it must be on top level |
7 | 2385 if (ds_new == NULL) |
2386 { | |
2387 vim_free((*stackptr)->dirname); | |
2388 (*stackptr)->dirname = vim_strsave(dirbuf); | |
2389 } | |
2390 } | |
2391 | |
2392 if ((*stackptr)->dirname != NULL) | |
2393 return (*stackptr)->dirname; | |
2394 else | |
2395 { | |
2396 ds_ptr = *stackptr; | |
2397 *stackptr = (*stackptr)->next; | |
2398 vim_free(ds_ptr); | |
2399 return NULL; | |
2400 } | |
2401 } | |
2402 | |
2403 /* | |
2404 * pop dirbuf from the directory stack and return previous directory or NULL if | |
2405 * stack is empty | |
2406 */ | |
2407 static char_u * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2408 qf_pop_dir(struct dir_stack_T **stackptr) |
7 | 2409 { |
2410 struct dir_stack_T *ds_ptr; | |
2411 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2412 // TODO: Should we check if dirbuf is the directory on top of the stack? |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2413 // What to do if it isn't? |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2414 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2415 // pop top element and free it |
7 | 2416 if (*stackptr != NULL) |
2417 { | |
2418 ds_ptr = *stackptr; | |
2419 *stackptr = (*stackptr)->next; | |
2420 vim_free(ds_ptr->dirname); | |
2421 vim_free(ds_ptr); | |
2422 } | |
2423 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2424 // return NEW top element as current dir or NULL if stack is empty |
7 | 2425 return *stackptr ? (*stackptr)->dirname : NULL; |
2426 } | |
2427 | |
2428 /* | |
2429 * clean up directory stack | |
2430 */ | |
2431 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2432 qf_clean_dir_stack(struct dir_stack_T **stackptr) |
7 | 2433 { |
2434 struct dir_stack_T *ds_ptr; | |
2435 | |
2436 while ((ds_ptr = *stackptr) != NULL) | |
2437 { | |
2438 *stackptr = (*stackptr)->next; | |
2439 vim_free(ds_ptr->dirname); | |
2440 vim_free(ds_ptr); | |
2441 } | |
2442 } | |
2443 | |
2444 /* | |
2445 * Check in which directory of the directory stack the given file can be | |
2446 * found. | |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
2447 * Returns a pointer to the directory name or NULL if not found. |
7 | 2448 * Cleans up intermediate directory entries. |
2449 * | |
2450 * TODO: How to solve the following problem? | |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2451 * If we have this directory tree: |
7 | 2452 * ./ |
2453 * ./aa | |
2454 * ./aa/bb | |
2455 * ./bb | |
2456 * ./bb/x.c | |
2457 * and make says: | |
2458 * making all in aa | |
2459 * making all in bb | |
2460 * x.c:9: Error | |
2461 * Then qf_push_dir thinks we are in ./aa/bb, but we are in ./bb. | |
2462 * qf_guess_filepath will return NULL. | |
2463 */ | |
2464 static char_u * | |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2465 qf_guess_filepath(qf_list_T *qfl, char_u *filename) |
7 | 2466 { |
2467 struct dir_stack_T *ds_ptr; | |
2468 struct dir_stack_T *ds_tmp; | |
2469 char_u *fullname; | |
2470 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2471 // no dirs on the stack - there's nothing we can do |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
2472 if (qfl->qf_dir_stack == NULL) |
7 | 2473 return NULL; |
2474 | |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
2475 ds_ptr = qfl->qf_dir_stack->next; |
7 | 2476 fullname = NULL; |
2477 while (ds_ptr) | |
2478 { | |
2479 vim_free(fullname); | |
2480 fullname = concat_fnames(ds_ptr->dirname, filename, TRUE); | |
2481 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2482 // If concat_fnames failed, just go on. The worst thing that can happen |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2483 // is that we delete the entire stack. |
7 | 2484 if ((fullname != NULL) && (mch_getperm(fullname) >= 0)) |
2485 break; | |
2486 | |
2487 ds_ptr = ds_ptr->next; | |
2488 } | |
2489 | |
2490 vim_free(fullname); | |
2491 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2492 // clean up all dirs we already left |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
2493 while (qfl->qf_dir_stack->next != ds_ptr) |
7 | 2494 { |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
2495 ds_tmp = qfl->qf_dir_stack->next; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
2496 qfl->qf_dir_stack->next = qfl->qf_dir_stack->next->next; |
7 | 2497 vim_free(ds_tmp->dirname); |
2498 vim_free(ds_tmp); | |
2499 } | |
2500 | |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2501 return ds_ptr == NULL ? NULL : ds_ptr->dirname; |
7 | 2502 } |
2503 | |
2504 /* | |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2505 * Returns TRUE if a quickfix/location list with the given identifier exists. |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2506 */ |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2507 static int |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2508 qflist_valid(win_T *wp, int_u qf_id) |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2509 { |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2510 qf_info_T *qi = &ql_info; |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2511 int i; |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2512 |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2513 if (wp != NULL) |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2514 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2515 qi = GET_LOC_LIST(wp); // Location list |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2516 if (qi == NULL) |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2517 return FALSE; |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2518 } |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2519 |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2520 for (i = 0; i < qi->qf_listcount; ++i) |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2521 if (qi->qf_lists[i].qf_id == qf_id) |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2522 return TRUE; |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2523 |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2524 return FALSE; |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2525 } |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2526 |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2527 /* |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
2528 * When loading a file from the quickfix, the autocommands may modify it. |
8702
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2529 * This may invalidate the current quickfix entry. This function checks |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2530 * whether an entry is still present in the quickfix list. |
8702
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2531 * Similar to location list. |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2532 */ |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2533 static int |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2534 is_qf_entry_present(qf_list_T *qfl, qfline_T *qf_ptr) |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2535 { |
8702
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2536 qfline_T *qfp; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2537 int i; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2538 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2539 // Search for the entry in the current list |
8702
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2540 for (i = 0, qfp = qfl->qf_start; i < qfl->qf_count; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2541 ++i, qfp = qfp->qf_next) |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2542 if (qfp == NULL || qfp == qf_ptr) |
8702
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2543 break; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2544 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2545 if (i == qfl->qf_count) // Entry is not found |
8702
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2546 return FALSE; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2547 |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2548 return TRUE; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2549 } |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2550 |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2551 /* |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2552 * Get the next valid entry in the current quickfix/location list. The search |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2553 * starts from the current entry. Returns NULL on failure. |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2554 */ |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2555 static qfline_T * |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2556 get_next_valid_entry( |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2557 qf_list_T *qfl, |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2558 qfline_T *qf_ptr, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2559 int *qf_index, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2560 int dir) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2561 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2562 int idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2563 int old_qf_fnum; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2564 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2565 idx = *qf_index; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2566 old_qf_fnum = qf_ptr->qf_fnum; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2567 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2568 do |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2569 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2570 if (idx == qfl->qf_count || qf_ptr->qf_next == NULL) |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2571 return NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2572 ++idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2573 qf_ptr = qf_ptr->qf_next; |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2574 } while ((!qfl->qf_nonevalid && !qf_ptr->qf_valid) |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2575 || (dir == FORWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum)); |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2576 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2577 *qf_index = idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2578 return qf_ptr; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2579 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2580 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2581 /* |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2582 * Get the previous valid entry in the current quickfix/location list. The |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2583 * search starts from the current entry. Returns NULL on failure. |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2584 */ |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2585 static qfline_T * |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2586 get_prev_valid_entry( |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2587 qf_list_T *qfl, |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2588 qfline_T *qf_ptr, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2589 int *qf_index, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2590 int dir) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2591 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2592 int idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2593 int old_qf_fnum; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2594 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2595 idx = *qf_index; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2596 old_qf_fnum = qf_ptr->qf_fnum; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2597 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2598 do |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2599 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2600 if (idx == 1 || qf_ptr->qf_prev == NULL) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2601 return NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2602 --idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2603 qf_ptr = qf_ptr->qf_prev; |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2604 } while ((!qfl->qf_nonevalid && !qf_ptr->qf_valid) |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2605 || (dir == BACKWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum)); |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2606 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2607 *qf_index = idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2608 return qf_ptr; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2609 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2610 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2611 /* |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2612 * Get the n'th (errornr) previous/next valid entry from the current entry in |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2613 * the quickfix list. |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2614 * dir == FORWARD or FORWARD_FILE: next valid entry |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2615 * dir == BACKWARD or BACKWARD_FILE: previous valid entry |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2616 */ |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2617 static qfline_T * |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2618 get_nth_valid_entry( |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2619 qf_list_T *qfl, |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2620 int errornr, |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2621 int dir, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2622 int *new_qfidx) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2623 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2624 qfline_T *qf_ptr = qfl->qf_ptr; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2625 int qf_idx = qfl->qf_index; |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2626 qfline_T *prev_qf_ptr; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2627 int prev_index; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2628 static char_u *e_no_more_items = (char_u *)N_("E553: No more items"); |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2629 char_u *err = e_no_more_items; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2630 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2631 while (errornr--) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2632 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2633 prev_qf_ptr = qf_ptr; |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2634 prev_index = qf_idx; |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2635 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2636 if (dir == FORWARD || dir == FORWARD_FILE) |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2637 qf_ptr = get_next_valid_entry(qfl, qf_ptr, &qf_idx, dir); |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2638 else |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2639 qf_ptr = get_prev_valid_entry(qfl, qf_ptr, &qf_idx, dir); |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2640 if (qf_ptr == NULL) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2641 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2642 qf_ptr = prev_qf_ptr; |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2643 qf_idx = prev_index; |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2644 if (err != NULL) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2645 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
2646 emsg(_(err)); |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2647 return NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2648 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2649 break; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2650 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2651 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2652 err = NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2653 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2654 |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2655 *new_qfidx = qf_idx; |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2656 return qf_ptr; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2657 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2658 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2659 /* |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2660 * Get n'th (errornr) quickfix entry from the current entry in the quickfix |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2661 * list 'qfl'. Returns a pointer to the new entry and the index in 'new_qfidx' |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2662 */ |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2663 static qfline_T * |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2664 get_nth_entry(qf_list_T *qfl, int errornr, int *new_qfidx) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2665 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2666 qfline_T *qf_ptr = qfl->qf_ptr; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2667 int qf_idx = qfl->qf_index; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2668 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2669 // New error number is less than the current error number |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2670 while (errornr < qf_idx && qf_idx > 1 && qf_ptr->qf_prev != NULL) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2671 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2672 --qf_idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2673 qf_ptr = qf_ptr->qf_prev; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2674 } |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2675 // New error number is greater than the current error number |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2676 while (errornr > qf_idx && qf_idx < qfl->qf_count && |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2677 qf_ptr->qf_next != NULL) |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2678 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2679 ++qf_idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2680 qf_ptr = qf_ptr->qf_next; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2681 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2682 |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2683 *new_qfidx = qf_idx; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2684 return qf_ptr; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2685 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2686 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2687 /* |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2688 * Get a entry specied by 'errornr' and 'dir' from the current |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2689 * quickfix/location list. 'errornr' specifies the index of the entry and 'dir' |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2690 * specifies the direction (FORWARD/BACKWARD/FORWARD_FILE/BACKWARD_FILE). |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2691 * Returns a pointer to the entry and the index of the new entry is stored in |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2692 * 'new_qfidx'. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2693 */ |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2694 static qfline_T * |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2695 qf_get_entry( |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2696 qf_list_T *qfl, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2697 int errornr, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2698 int dir, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2699 int *new_qfidx) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2700 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2701 qfline_T *qf_ptr = qfl->qf_ptr; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2702 int qfidx = qfl->qf_index; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2703 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2704 if (dir != 0) // next/prev valid entry |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2705 qf_ptr = get_nth_valid_entry(qfl, errornr, dir, &qfidx); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2706 else if (errornr != 0) // go to specified number |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2707 qf_ptr = get_nth_entry(qfl, errornr, &qfidx); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2708 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2709 *new_qfidx = qfidx; |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2710 return qf_ptr; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2711 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2712 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2713 /* |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2714 * Find a window displaying a Vim help file. |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2715 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2716 static win_T * |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2717 qf_find_help_win(void) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2718 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2719 win_T *wp; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2720 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2721 FOR_ALL_WINDOWS(wp) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2722 if (bt_help(wp->w_buffer)) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2723 return wp; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2724 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2725 return NULL; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2726 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2727 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2728 /* |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2729 * Find a help window or open one. If 'newwin' is TRUE, then open a new help |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2730 * window. |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2731 */ |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2732 static int |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2733 jump_to_help_window(qf_info_T *qi, int newwin, int *opened_window) |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2734 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2735 win_T *wp; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2736 int flags; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2737 |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2738 if (cmdmod.tab != 0 || newwin) |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2739 wp = NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2740 else |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2741 wp = qf_find_help_win(); |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2742 if (wp != NULL && wp->w_buffer->b_nwindows > 0) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2743 win_enter(wp, TRUE); |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2744 else |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2745 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2746 // Split off help window; put it at far top if no position |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2747 // specified, the current window is vertically split and narrow. |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2748 flags = WSP_HELP; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2749 if (cmdmod.split == 0 && curwin->w_width != Columns |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2750 && curwin->w_width < 80) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2751 flags |= WSP_TOP; |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2752 // If the user asks to open a new window, then copy the location list. |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2753 // Otherwise, don't copy the location list. |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2754 if (IS_LL_STACK(qi) && !newwin) |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2755 flags |= WSP_NEWLOC; |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2756 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2757 if (win_split(0, flags) == FAIL) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2758 return FAIL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2759 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2760 *opened_window = TRUE; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2761 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2762 if (curwin->w_height < p_hh) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2763 win_setheight((int)p_hh); |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2764 |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2765 // When using location list, the new window should use the supplied |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2766 // location list. If the user asks to open a new window, then the new |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2767 // window will get a copy of the location list. |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2768 if (IS_LL_STACK(qi) && !newwin) |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2769 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2770 curwin->w_llist = qi; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2771 qi->qf_refcount++; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2772 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2773 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2774 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2775 if (!p_im) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2776 restart_edit = 0; // don't want insert mode in help file |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2777 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2778 return OK; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2779 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2780 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2781 /* |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
2782 * Find a non-quickfix window in the current tabpage using the given location |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
2783 * list stack. |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2784 * Returns NULL if a matching window is not found. |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2785 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2786 static win_T * |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2787 qf_find_win_with_loclist(qf_info_T *ll) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2788 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2789 win_T *wp; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2790 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2791 FOR_ALL_WINDOWS(wp) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2792 if (wp->w_llist == ll && !bt_quickfix(wp->w_buffer)) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2793 return wp; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2794 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2795 return NULL; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2796 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2797 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2798 /* |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2799 * Find a window containing a normal buffer |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2800 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2801 static win_T * |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2802 qf_find_win_with_normal_buf(void) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2803 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2804 win_T *wp; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2805 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2806 FOR_ALL_WINDOWS(wp) |
14433
4a94173743d9
patch 8.1.0230: directly checking 'buftype' value
Christian Brabandt <cb@256bit.org>
parents:
14397
diff
changeset
|
2807 if (bt_normal(wp->w_buffer)) |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2808 return wp; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2809 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2810 return NULL; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2811 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2812 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2813 /* |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2814 * Go to a window in any tabpage containing the specified file. Returns TRUE |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2815 * if successfully jumped to the window. Otherwise returns FALSE. |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2816 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2817 static int |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2818 qf_goto_tabwin_with_file(int fnum) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2819 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2820 tabpage_T *tp; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2821 win_T *wp; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2822 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2823 FOR_ALL_TAB_WINDOWS(tp, wp) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2824 if (wp->w_buffer->b_fnum == fnum) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2825 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2826 goto_tabpage_win(tp, wp); |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2827 return TRUE; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2828 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2829 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2830 return FALSE; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2831 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2832 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2833 /* |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2834 * Create a new window to show a file above the quickfix window. Called when |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2835 * only the quickfix window is present. |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2836 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2837 static int |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2838 qf_open_new_file_win(qf_info_T *ll_ref) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2839 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2840 int flags; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2841 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2842 flags = WSP_ABOVE; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2843 if (ll_ref != NULL) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2844 flags |= WSP_NEWLOC; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2845 if (win_split(0, flags) == FAIL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2846 return FAIL; // not enough room for window |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2847 p_swb = empty_option; // don't split again |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2848 swb_flags = 0; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2849 RESET_BINDING(curwin); |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2850 if (ll_ref != NULL) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2851 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2852 // The new window should use the location list from the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2853 // location list window |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2854 curwin->w_llist = ll_ref; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2855 ll_ref->qf_refcount++; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2856 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2857 return OK; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2858 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2859 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2860 /* |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2861 * Go to a window that shows the right buffer. If the window is not found, go |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2862 * to the window just above the location list window. This is used for opening |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2863 * a file from a location window and not from a quickfix window. If some usable |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2864 * window is previously found, then it is supplied in 'use_win'. |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2865 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2866 static void |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2867 qf_goto_win_with_ll_file(win_T *use_win, int qf_fnum, qf_info_T *ll_ref) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2868 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2869 win_T *win = use_win; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2870 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2871 if (win == NULL) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2872 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2873 // Find the window showing the selected file |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2874 FOR_ALL_WINDOWS(win) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2875 if (win->w_buffer->b_fnum == qf_fnum) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2876 break; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2877 if (win == NULL) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2878 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2879 // Find a previous usable window |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2880 win = curwin; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2881 do |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2882 { |
14433
4a94173743d9
patch 8.1.0230: directly checking 'buftype' value
Christian Brabandt <cb@256bit.org>
parents:
14397
diff
changeset
|
2883 if (bt_normal(win->w_buffer)) |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2884 break; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2885 if (win->w_prev == NULL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2886 win = lastwin; // wrap around the top |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2887 else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2888 win = win->w_prev; // go to previous window |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2889 } while (win != curwin); |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2890 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2891 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2892 win_goto(win); |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2893 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2894 // If the location list for the window is not set, then set it |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2895 // to the location list from the location window |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2896 if (win->w_llist == NULL) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2897 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2898 win->w_llist = ll_ref; |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
2899 if (ll_ref != NULL) |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
2900 ll_ref->qf_refcount++; |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2901 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2902 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2903 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2904 /* |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2905 * Go to a window that contains the specified buffer 'qf_fnum'. If a window is |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2906 * not found, then go to the window just above the quickfix window. This is |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2907 * used for opening a file from a quickfix window and not from a location |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
2908 * window. |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2909 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2910 static void |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2911 qf_goto_win_with_qfl_file(int qf_fnum) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2912 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2913 win_T *win; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2914 win_T *altwin; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2915 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2916 win = curwin; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2917 altwin = NULL; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2918 for (;;) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2919 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2920 if (win->w_buffer->b_fnum == qf_fnum) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2921 break; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2922 if (win->w_prev == NULL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2923 win = lastwin; // wrap around the top |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2924 else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2925 win = win->w_prev; // go to previous window |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2926 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2927 if (IS_QF_WINDOW(win)) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2928 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2929 // Didn't find it, go to the window before the quickfix |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2930 // window. |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2931 if (altwin != NULL) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2932 win = altwin; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2933 else if (curwin->w_prev != NULL) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2934 win = curwin->w_prev; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2935 else |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2936 win = curwin->w_next; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2937 break; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2938 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2939 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2940 // Remember a usable window. |
14433
4a94173743d9
patch 8.1.0230: directly checking 'buftype' value
Christian Brabandt <cb@256bit.org>
parents:
14397
diff
changeset
|
2941 if (altwin == NULL && !win->w_p_pvw && bt_normal(win->w_buffer)) |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2942 altwin = win; |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2943 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2944 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2945 win_goto(win); |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2946 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2947 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2948 /* |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2949 * Find a suitable window for opening a file (qf_fnum) from the |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2950 * quickfix/location list and jump to it. If the file is already opened in a |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2951 * window, jump to it. Otherwise open a new window to display the file. If |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2952 * 'newwin' is TRUE, then always open a new window. This is called from either |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2953 * a quickfix or a location list window. |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2954 */ |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2955 static int |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2956 qf_jump_to_usable_window(int qf_fnum, int newwin, int *opened_window) |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2957 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2958 win_T *usable_win_ptr = NULL; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2959 int usable_win; |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2960 qf_info_T *ll_ref = NULL; |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2961 win_T *win; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2962 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2963 usable_win = 0; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2964 |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2965 // If opening a new window, then don't use the location list referred by |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2966 // the current window. Otherwise two windows will refer to the same |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2967 // location list. |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2968 if (!newwin) |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2969 ll_ref = curwin->w_llist_ref; |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2970 |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2971 if (ll_ref != NULL) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2972 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2973 // Find a non-quickfix window with this location list |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2974 usable_win_ptr = qf_find_win_with_loclist(ll_ref); |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2975 if (usable_win_ptr != NULL) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2976 usable_win = 1; |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2977 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2978 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2979 if (!usable_win) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2980 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2981 // Locate a window showing a normal buffer |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2982 win = qf_find_win_with_normal_buf(); |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2983 if (win != NULL) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2984 usable_win = 1; |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2985 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2986 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2987 // If no usable window is found and 'switchbuf' contains "usetab" |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2988 // then search in other tabs. |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2989 if (!usable_win && (swb_flags & SWB_USETAB)) |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2990 usable_win = qf_goto_tabwin_with_file(qf_fnum); |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2991 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2992 // If there is only one window and it is the quickfix window, create a |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2993 // new one above the quickfix window. |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2994 if ((ONE_WINDOW && bt_quickfix(curbuf)) || !usable_win || newwin) |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2995 { |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2996 if (qf_open_new_file_win(ll_ref) != OK) |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2997 return FAIL; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2998 *opened_window = TRUE; // close it when fail |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2999 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3000 else |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3001 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3002 if (curwin->w_llist_ref != NULL) // In a location window |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3003 qf_goto_win_with_ll_file(usable_win_ptr, qf_fnum, ll_ref); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3004 else // In a quickfix window |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3005 qf_goto_win_with_qfl_file(qf_fnum); |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3006 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3007 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3008 return OK; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3009 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3010 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3011 /* |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3012 * Edit the selected file or help file. |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3013 * Returns OK if successfully edited the file, FAIL on failing to open the |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3014 * buffer and NOTDONE if the quickfix/location list was freed by an autocmd |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3015 * when opening the buffer. |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3016 */ |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3017 static int |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3018 qf_jump_edit_buffer( |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3019 qf_info_T *qi, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3020 qfline_T *qf_ptr, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3021 int forceit, |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3022 int prev_winid, |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3023 int *opened_window) |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3024 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3025 qf_list_T *qfl = &qi->qf_lists[qi->qf_curlist]; |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
3026 qfltype_T qfl_type = qfl->qfl_type; |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3027 int retval = OK; |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3028 int old_qf_curlist = qi->qf_curlist; |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3029 int save_qfid = qfl->qf_id; |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3030 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3031 if (qf_ptr->qf_type == 1) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3032 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3033 // Open help file (do_ecmd() will set b_help flag, readfile() will |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3034 // set b_p_ro flag). |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3035 if (!can_abandon(curbuf, forceit)) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3036 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3037 no_write_message(); |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3038 return FAIL; |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3039 } |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3040 |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3041 retval = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1, |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3042 ECMD_HIDE + ECMD_SET_HELP, |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3043 prev_winid == curwin->w_id ? curwin : NULL); |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3044 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3045 else |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3046 retval = buflist_getfile(qf_ptr->qf_fnum, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3047 (linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit); |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
3048 |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3049 // If a location list, check whether the associated window is still |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3050 // present. |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3051 if (qfl_type == QFLT_LOCATION) |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3052 { |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3053 win_T *wp = win_id2wp(prev_winid); |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3054 if (wp == NULL && curwin->w_llist != qi) |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3055 { |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3056 emsg(_("E924: Current window was closed")); |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3057 *opened_window = FALSE; |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3058 return NOTDONE; |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3059 } |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3060 } |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3061 |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
3062 if (qfl_type == QFLT_QUICKFIX && !qflist_valid(NULL, save_qfid)) |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3063 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3064 emsg(_("E925: Current quickfix was changed")); |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3065 return NOTDONE; |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3066 } |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3067 |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3068 if (old_qf_curlist != qi->qf_curlist |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3069 || !is_qf_entry_present(qfl, qf_ptr)) |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3070 { |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
3071 if (qfl_type == QFLT_QUICKFIX) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3072 emsg(_("E925: Current quickfix was changed")); |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3073 else |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3074 emsg(_(e_loc_list_changed)); |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3075 return NOTDONE; |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3076 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3077 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3078 return retval; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3079 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3080 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3081 /* |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3082 * Go to the error line in the current file using either line/column number or |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3083 * a search pattern. |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3084 */ |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3085 static void |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3086 qf_jump_goto_line( |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3087 linenr_T qf_lnum, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3088 int qf_col, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3089 char_u qf_viscol, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3090 char_u *qf_pattern) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3091 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3092 linenr_T i; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3093 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3094 if (qf_pattern == NULL) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3095 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3096 // Go to line with error, unless qf_lnum is 0. |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3097 i = qf_lnum; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3098 if (i > 0) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3099 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3100 if (i > curbuf->b_ml.ml_line_count) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3101 i = curbuf->b_ml.ml_line_count; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3102 curwin->w_cursor.lnum = i; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3103 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3104 if (qf_col > 0) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3105 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3106 curwin->w_cursor.coladd = 0; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3107 if (qf_viscol == TRUE) |
15703
b8a2362073bb
patch 8.1.0859: "%v" in 'errorformat' does handle multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents:
15641
diff
changeset
|
3108 coladvance(qf_col - 1); |
b8a2362073bb
patch 8.1.0859: "%v" in 'errorformat' does handle multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents:
15641
diff
changeset
|
3109 else |
b8a2362073bb
patch 8.1.0859: "%v" in 'errorformat' does handle multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents:
15641
diff
changeset
|
3110 curwin->w_cursor.col = qf_col - 1; |
14552
b298737a7188
patch 8.1.0289: cursor moves to wrong column after quickfix jump
Christian Brabandt <cb@256bit.org>
parents:
14550
diff
changeset
|
3111 curwin->w_set_curswant = TRUE; |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3112 check_cursor(); |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3113 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3114 else |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3115 beginline(BL_WHITE | BL_FIX); |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3116 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3117 else |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3118 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3119 pos_T save_cursor; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3120 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3121 // Move the cursor to the first line in the buffer |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3122 save_cursor = curwin->w_cursor; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3123 curwin->w_cursor.lnum = 0; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3124 if (!do_search(NULL, '/', qf_pattern, (long)1, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3125 SEARCH_KEEP, NULL, NULL)) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3126 curwin->w_cursor = save_cursor; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3127 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3128 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3129 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3130 /* |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3131 * Display quickfix list index and size message |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3132 */ |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3133 static void |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3134 qf_jump_print_msg( |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3135 qf_info_T *qi, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3136 int qf_index, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3137 qfline_T *qf_ptr, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3138 buf_T *old_curbuf, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3139 linenr_T old_lnum) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3140 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3141 linenr_T i; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3142 int len; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3143 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3144 // Update the screen before showing the message, unless the screen |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3145 // scrolled up. |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3146 if (!msg_scrolled) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3147 update_topline_redraw(); |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3148 sprintf((char *)IObuff, _("(%d of %d)%s%s: "), qf_index, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3149 qi->qf_lists[qi->qf_curlist].qf_count, |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3150 qf_ptr->qf_cleared ? _(" (line deleted)") : "", |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3151 (char *)qf_types(qf_ptr->qf_type, qf_ptr->qf_nr)); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3152 // Add the message, skipping leading whitespace and newlines. |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3153 len = (int)STRLEN(IObuff); |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3154 qf_fmt_text(skipwhite(qf_ptr->qf_text), IObuff + len, IOSIZE - len); |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3155 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3156 // Output the message. Overwrite to avoid scrolling when the 'O' |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3157 // flag is present in 'shortmess'; But when not jumping, print the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3158 // whole message. |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3159 i = msg_scroll; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3160 if (curbuf == old_curbuf && curwin->w_cursor.lnum == old_lnum) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3161 msg_scroll = TRUE; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3162 else if (!msg_scrolled && shortmess(SHM_OVERALL)) |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3163 msg_scroll = FALSE; |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3164 msg_attr_keep((char *)IObuff, 0, TRUE); |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3165 msg_scroll = i; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3166 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3167 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3168 /* |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3169 * Find a usable window for opening a file from the quickfix/location list. If |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3170 * a window is not found then open a new window. If 'newwin' is TRUE, then open |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3171 * a new window. |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3172 * Returns OK if successfully jumped or opened a window. Returns FAIL if not |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3173 * able to jump/open a window. Returns NOTDONE if a file is not associated |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3174 * with the entry. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3175 */ |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3176 static int |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3177 qf_jump_open_window( |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3178 qf_info_T *qi, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3179 qfline_T *qf_ptr, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3180 int newwin, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3181 int *opened_window) |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3182 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3183 // For ":helpgrep" find a help window or open one. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3184 if (qf_ptr->qf_type == 1 && (!bt_help(curwin->w_buffer) || cmdmod.tab != 0)) |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3185 if (jump_to_help_window(qi, newwin, opened_window) == FAIL) |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3186 return FAIL; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3187 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3188 // If currently in the quickfix window, find another window to show the |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3189 // file in. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3190 if (bt_quickfix(curbuf) && !*opened_window) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3191 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3192 // If there is no file specified, we don't know where to go. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3193 // But do advance, otherwise ":cn" gets stuck. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3194 if (qf_ptr->qf_fnum == 0) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3195 return NOTDONE; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3196 |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3197 if (qf_jump_to_usable_window(qf_ptr->qf_fnum, newwin, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3198 opened_window) == FAIL) |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3199 return FAIL; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3200 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3201 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3202 return OK; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3203 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3204 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3205 /* |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3206 * Edit a selected file from the quickfix/location list and jump to a |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3207 * particular line/column, adjust the folds and display a message about the |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3208 * jump. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3209 * Returns OK on success and FAIL on failing to open the file/buffer. Returns |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3210 * NOTDONE if the quickfix/location list is freed by an autocmd when opening |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3211 * the file. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3212 */ |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3213 static int |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3214 qf_jump_to_buffer( |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3215 qf_info_T *qi, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3216 int qf_index, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3217 qfline_T *qf_ptr, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3218 int forceit, |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3219 int prev_winid, |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3220 int *opened_window, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3221 int openfold, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3222 int print_message) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3223 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3224 buf_T *old_curbuf; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3225 linenr_T old_lnum; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3226 int retval = OK; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3227 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3228 // If there is a file name, read the wanted file if needed, and check |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3229 // autowrite etc. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3230 old_curbuf = curbuf; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3231 old_lnum = curwin->w_cursor.lnum; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3232 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3233 if (qf_ptr->qf_fnum != 0) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3234 { |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3235 retval = qf_jump_edit_buffer(qi, qf_ptr, forceit, prev_winid, |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3236 opened_window); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3237 if (retval != OK) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3238 return retval; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3239 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3240 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3241 // When not switched to another buffer, still need to set pc mark |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3242 if (curbuf == old_curbuf) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3243 setpcmark(); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3244 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3245 qf_jump_goto_line(qf_ptr->qf_lnum, qf_ptr->qf_col, qf_ptr->qf_viscol, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3246 qf_ptr->qf_pattern); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3247 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3248 #ifdef FEAT_FOLDING |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3249 if ((fdo_flags & FDO_QUICKFIX) && openfold) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3250 foldOpenCursor(); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3251 #endif |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3252 if (print_message) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3253 qf_jump_print_msg(qi, qf_index, qf_ptr, old_curbuf, old_lnum); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3254 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3255 return retval; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3256 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3257 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3258 /* |
15424
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3259 * Jump to a quickfix line and try to use an existing window. |
7 | 3260 */ |
3261 void | |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3262 qf_jump(qf_info_T *qi, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3263 int dir, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3264 int errornr, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3265 int forceit) |
7 | 3266 { |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3267 qf_jump_newwin(qi, dir, errornr, forceit, FALSE); |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3268 } |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3269 |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3270 /* |
15424
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3271 * Jump to a quickfix line. |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3272 * If dir == 0 go to entry "errornr". |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3273 * If dir == FORWARD go "errornr" valid entries forward. |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3274 * If dir == BACKWARD go "errornr" valid entries backward. |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3275 * If dir == FORWARD_FILE go "errornr" valid entries files backward. |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3276 * If dir == BACKWARD_FILE go "errornr" valid entries files backward |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3277 * else if "errornr" is zero, redisplay the same line |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3278 * If 'forceit' is TRUE, then can discard changes to the current buffer. |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3279 * If 'newwin' is TRUE, then open the file in a new window. |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3280 */ |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3281 void |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3282 qf_jump_newwin(qf_info_T *qi, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3283 int dir, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3284 int errornr, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3285 int forceit, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3286 int newwin) |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3287 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3288 qf_list_T *qfl; |
230 | 3289 qfline_T *qf_ptr; |
3290 qfline_T *old_qf_ptr; | |
7 | 3291 int qf_index; |
3292 int old_qf_index; | |
639 | 3293 char_u *old_swb = p_swb; |
1621 | 3294 unsigned old_swb_flags = swb_flags; |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3295 int prev_winid; |
7 | 3296 int opened_window = FALSE; |
3297 int print_message = TRUE; | |
3298 #ifdef FEAT_FOLDING | |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3299 int old_KeyTyped = KeyTyped; // getting file may reset it |
7 | 3300 #endif |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3301 int retval = OK; |
644 | 3302 |
659 | 3303 if (qi == NULL) |
3304 qi = &ql_info; | |
644 | 3305 |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
3306 if (qf_stack_empty(qi) || qf_list_empty(qi, qi->qf_curlist)) |
7 | 3307 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3308 emsg(_(e_quickfix)); |
7 | 3309 return; |
3310 } | |
3311 | |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3312 incr_quickfix_busy(); |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3313 |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3314 qfl = &qi->qf_lists[qi->qf_curlist]; |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3315 |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3316 qf_ptr = qfl->qf_ptr; |
7 | 3317 old_qf_ptr = qf_ptr; |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3318 qf_index = qfl->qf_index; |
7 | 3319 old_qf_index = qf_index; |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3320 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3321 qf_ptr = qf_get_entry(qfl, errornr, dir, &qf_index); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3322 if (qf_ptr == NULL) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3323 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3324 qf_ptr = old_qf_ptr; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3325 qf_index = old_qf_index; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3326 goto theend; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3327 } |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3328 |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3329 qfl->qf_index = qf_index; |
644 | 3330 if (qf_win_pos_update(qi, old_qf_index)) |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3331 // No need to print the error message if it's visible in the error |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3332 // window |
7 | 3333 print_message = FALSE; |
3334 | |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3335 prev_winid = curwin->w_id; |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3336 |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3337 retval = qf_jump_open_window(qi, qf_ptr, newwin, &opened_window); |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3338 if (retval == FAIL) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3339 goto failed; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3340 if (retval == NOTDONE) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3341 goto theend; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3342 |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3343 retval = qf_jump_to_buffer(qi, qf_index, qf_ptr, forceit, prev_winid, |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3344 &opened_window, old_KeyTyped, print_message); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3345 if (retval == NOTDONE) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3346 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3347 // Quickfix/location list is freed by an autocmd |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3348 qi = NULL; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3349 qf_ptr = NULL; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3350 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3351 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3352 if (retval != OK) |
7 | 3353 { |
3354 if (opened_window) | |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3355 win_close(curwin, TRUE); // Close opened window |
8605
536b9b88d1ca
commit https://github.com/vim/vim/commit/0899d698030ec076eb26352cda1ea334ab0819d9
Christian Brabandt <cb@256bit.org>
parents:
8603
diff
changeset
|
3356 if (qf_ptr != NULL && qf_ptr->qf_fnum != 0) |
7 | 3357 { |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3358 // Couldn't open file, so put index back where it was. This could |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3359 // happen if the file was readonly and we changed something. |
7 | 3360 failed: |
3361 qf_ptr = old_qf_ptr; | |
3362 qf_index = old_qf_index; | |
3363 } | |
3364 } | |
3365 theend: | |
8605
536b9b88d1ca
commit https://github.com/vim/vim/commit/0899d698030ec076eb26352cda1ea334ab0819d9
Christian Brabandt <cb@256bit.org>
parents:
8603
diff
changeset
|
3366 if (qi != NULL) |
536b9b88d1ca
commit https://github.com/vim/vim/commit/0899d698030ec076eb26352cda1ea334ab0819d9
Christian Brabandt <cb@256bit.org>
parents:
8603
diff
changeset
|
3367 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3368 qfl->qf_ptr = qf_ptr; |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3369 qfl->qf_index = qf_index; |
8605
536b9b88d1ca
commit https://github.com/vim/vim/commit/0899d698030ec076eb26352cda1ea334ab0819d9
Christian Brabandt <cb@256bit.org>
parents:
8603
diff
changeset
|
3370 } |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3371 if (p_swb != old_swb) |
7 | 3372 { |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3373 // Restore old 'switchbuf' value, but not when an autocommand or |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3374 // modeline has changed the value. |
7 | 3375 if (p_swb == empty_option) |
1621 | 3376 { |
7 | 3377 p_swb = old_swb; |
1621 | 3378 swb_flags = old_swb_flags; |
3379 } | |
7 | 3380 else |
3381 free_string_option(old_swb); | |
3382 } | |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
3383 decr_quickfix_busy(); |
7 | 3384 } |
3385 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3386 // Highlight attributes used for displaying entries from the quickfix list. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3387 static int qfFileAttr; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3388 static int qfSepAttr; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3389 static int qfLineAttr; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3390 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3391 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3392 * Display information about a single entry from the quickfix/location list. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3393 * Used by ":clist/:llist" commands. |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3394 * 'cursel' will be set to TRUE for the currently selected entry in the |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3395 * quickfix list. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3396 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3397 static void |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3398 qf_list_entry(qfline_T *qfp, int qf_idx, int cursel) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3399 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3400 char_u *fname; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3401 buf_T *buf; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3402 int filter_entry; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3403 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3404 fname = NULL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3405 if (qfp->qf_module != NULL && *qfp->qf_module != NUL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3406 vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", qf_idx, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3407 (char *)qfp->qf_module); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3408 else { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3409 if (qfp->qf_fnum != 0 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3410 && (buf = buflist_findnr(qfp->qf_fnum)) != NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3411 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3412 fname = buf->b_fname; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3413 if (qfp->qf_type == 1) // :helpgrep |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3414 fname = gettail(fname); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3415 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3416 if (fname == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3417 sprintf((char *)IObuff, "%2d", qf_idx); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3418 else |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3419 vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3420 qf_idx, (char *)fname); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3421 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3422 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3423 // Support for filtering entries using :filter /pat/ clist |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3424 // Match against the module name, file name, search pattern and |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3425 // text of the entry. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3426 filter_entry = TRUE; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3427 if (qfp->qf_module != NULL && *qfp->qf_module != NUL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3428 filter_entry &= message_filtered(qfp->qf_module); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3429 if (filter_entry && fname != NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3430 filter_entry &= message_filtered(fname); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3431 if (filter_entry && qfp->qf_pattern != NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3432 filter_entry &= message_filtered(qfp->qf_pattern); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3433 if (filter_entry) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3434 filter_entry &= message_filtered(qfp->qf_text); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3435 if (filter_entry) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3436 return; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3437 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3438 msg_putchar('\n'); |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3439 msg_outtrans_attr(IObuff, cursel ? HL_ATTR(HLF_QFL) : qfFileAttr); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3440 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3441 if (qfp->qf_lnum != 0) |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3442 msg_puts_attr(":", qfSepAttr); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3443 if (qfp->qf_lnum == 0) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3444 IObuff[0] = NUL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3445 else if (qfp->qf_col == 0) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3446 sprintf((char *)IObuff, "%ld", qfp->qf_lnum); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3447 else |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3448 sprintf((char *)IObuff, "%ld col %d", |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3449 qfp->qf_lnum, qfp->qf_col); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3450 sprintf((char *)IObuff + STRLEN(IObuff), "%s", |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3451 (char *)qf_types(qfp->qf_type, qfp->qf_nr)); |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3452 msg_puts_attr((char *)IObuff, qfLineAttr); |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3453 msg_puts_attr(":", qfSepAttr); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3454 if (qfp->qf_pattern != NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3455 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3456 qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE); |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3457 msg_puts((char *)IObuff); |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3458 msg_puts_attr(":", qfSepAttr); |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3459 } |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3460 msg_puts(" "); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3461 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3462 // Remove newlines and leading whitespace from the text. For an |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3463 // unrecognized line keep the indent, the compiler may mark a word |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3464 // with ^^^^. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3465 qf_fmt_text((fname != NULL || qfp->qf_lnum != 0) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3466 ? skipwhite(qfp->qf_text) : qfp->qf_text, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3467 IObuff, IOSIZE); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3468 msg_prt_line(IObuff, FALSE); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3469 out_flush(); // show one line at a time |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3470 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3471 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3472 /* |
7 | 3473 * ":clist": list all errors |
644 | 3474 * ":llist": list all locations |
7 | 3475 */ |
3476 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3477 qf_list(exarg_T *eap) |
7 | 3478 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3479 qf_list_T *qfl; |
230 | 3480 qfline_T *qfp; |
3481 int i; | |
3482 int idx1 = 1; | |
3483 int idx2 = -1; | |
3484 char_u *arg = eap->arg; | |
9379
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3485 int plus = FALSE; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3486 int all = eap->forceit; // if not :cl!, only show |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3487 // recognised errors |
644 | 3488 qf_info_T *qi = &ql_info; |
3489 | |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
3490 if (is_loclist_cmd(eap->cmdidx)) |
644 | 3491 { |
3492 qi = GET_LOC_LIST(curwin); | |
3493 if (qi == NULL) | |
3494 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3495 emsg(_(e_loclist)); |
644 | 3496 return; |
3497 } | |
3498 } | |
3499 | |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
3500 if (qf_stack_empty(qi) || qf_list_empty(qi, qi->qf_curlist)) |
7 | 3501 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3502 emsg(_(e_quickfix)); |
7 | 3503 return; |
3504 } | |
9379
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3505 if (*arg == '+') |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3506 { |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3507 ++arg; |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3508 plus = TRUE; |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3509 } |
7 | 3510 if (!get_list_range(&arg, &idx1, &idx2) || *arg != NUL) |
3511 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3512 emsg(_(e_trailing)); |
7 | 3513 return; |
3514 } | |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3515 qfl = &qi->qf_lists[qi->qf_curlist]; |
9379
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3516 if (plus) |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3517 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3518 i = qfl->qf_index; |
9379
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3519 idx2 = i + idx1; |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3520 idx1 = i; |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3521 } |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3522 else |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3523 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3524 i = qfl->qf_count; |
9379
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3525 if (idx1 < 0) |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3526 idx1 = (-idx1 > i) ? 0 : idx1 + i + 1; |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3527 if (idx2 < 0) |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3528 idx2 = (-idx2 > i) ? 0 : idx2 + i + 1; |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3529 } |
7 | 3530 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3531 // Shorten all the file names, so that it is easy to read |
13819
31bb8e1f7625
patch 8.0.1781: file names in quickfix window are not shortened
Christian Brabandt <cb@256bit.org>
parents:
13802
diff
changeset
|
3532 shorten_fnames(FALSE); |
31bb8e1f7625
patch 8.0.1781: file names in quickfix window are not shortened
Christian Brabandt <cb@256bit.org>
parents:
13802
diff
changeset
|
3533 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3534 // Get the attributes for the different quickfix highlight items. Note |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3535 // that this depends on syntax items defined in the qf.vim syntax file |
12912
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3536 qfFileAttr = syn_name2attr((char_u *)"qfFileName"); |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3537 if (qfFileAttr == 0) |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3538 qfFileAttr = HL_ATTR(HLF_D); |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3539 qfSepAttr = syn_name2attr((char_u *)"qfSeparator"); |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3540 if (qfSepAttr == 0) |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3541 qfSepAttr = HL_ATTR(HLF_D); |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3542 qfLineAttr = syn_name2attr((char_u *)"qfLineNr"); |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3543 if (qfLineAttr == 0) |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3544 qfLineAttr = HL_ATTR(HLF_N); |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3545 |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3546 if (qfl->qf_nonevalid) |
7 | 3547 all = TRUE; |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3548 qfp = qfl->qf_start; |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3549 for (i = 1; !got_int && i <= qfl->qf_count; ) |
7 | 3550 { |
3551 if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2) | |
3552 { | |
2047
85da03763130
updated for version 7.2.333
Bram Moolenaar <bram@zimbu.org>
parents:
1918
diff
changeset
|
3553 if (got_int) |
85da03763130
updated for version 7.2.333
Bram Moolenaar <bram@zimbu.org>
parents:
1918
diff
changeset
|
3554 break; |
446 | 3555 |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3556 qf_list_entry(qfp, i, i == qfl->qf_index); |
7 | 3557 } |
446 | 3558 |
3559 qfp = qfp->qf_next; | |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3560 if (qfp == NULL) |
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3561 break; |
446 | 3562 ++i; |
7 | 3563 ui_breakcheck(); |
3564 } | |
3565 } | |
3566 | |
3567 /* | |
3568 * Remove newlines and leading whitespace from an error message. | |
3569 * Put the result in "buf[bufsize]". | |
3570 */ | |
3571 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3572 qf_fmt_text(char_u *text, char_u *buf, int bufsize) |
7 | 3573 { |
3574 int i; | |
3575 char_u *p = text; | |
3576 | |
3577 for (i = 0; *p != NUL && i < bufsize - 1; ++i) | |
3578 { | |
3579 if (*p == '\n') | |
3580 { | |
3581 buf[i] = ' '; | |
3582 while (*++p != NUL) | |
11129
f4ea50924c6d
patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
11063
diff
changeset
|
3583 if (!VIM_ISWHITE(*p) && *p != '\n') |
7 | 3584 break; |
3585 } | |
3586 else | |
3587 buf[i] = *p++; | |
3588 } | |
3589 buf[i] = NUL; | |
3590 } | |
3591 | |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3592 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3593 * Display information (list number, list size and the title) about a |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3594 * quickfix/location list. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3595 */ |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3596 static void |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3597 qf_msg(qf_info_T *qi, int which, char *lead) |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3598 { |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3599 char *title = (char *)qi->qf_lists[which].qf_title; |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3600 int count = qi->qf_lists[which].qf_count; |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3601 char_u buf[IOSIZE]; |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3602 |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3603 vim_snprintf((char *)buf, IOSIZE, _("%serror list %d of %d; %d errors "), |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3604 lead, |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3605 which + 1, |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3606 qi->qf_listcount, |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3607 count); |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3608 |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3609 if (title != NULL) |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3610 { |
9579
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3611 size_t len = STRLEN(buf); |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3612 |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3613 if (len < 34) |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3614 { |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3615 vim_memset(buf + len, ' ', 34 - len); |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3616 buf[34] = NUL; |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3617 } |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3618 vim_strcat(buf, (char_u *)title, IOSIZE); |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3619 } |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3620 trunc_string(buf, buf, Columns - 1, IOSIZE); |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3621 msg((char *)buf); |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3622 } |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3623 |
7 | 3624 /* |
3625 * ":colder [count]": Up in the quickfix stack. | |
3626 * ":cnewer [count]": Down in the quickfix stack. | |
644 | 3627 * ":lolder [count]": Up in the location list stack. |
3628 * ":lnewer [count]": Down in the location list stack. | |
7 | 3629 */ |
3630 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3631 qf_age(exarg_T *eap) |
7 | 3632 { |
644 | 3633 qf_info_T *qi = &ql_info; |
7 | 3634 int count; |
3635 | |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
3636 if (is_loclist_cmd(eap->cmdidx)) |
644 | 3637 { |
3638 qi = GET_LOC_LIST(curwin); | |
3639 if (qi == NULL) | |
3640 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3641 emsg(_(e_loclist)); |
644 | 3642 return; |
3643 } | |
3644 } | |
3645 | |
7 | 3646 if (eap->addr_count != 0) |
3647 count = eap->line2; | |
3648 else | |
3649 count = 1; | |
3650 while (count--) | |
3651 { | |
644 | 3652 if (eap->cmdidx == CMD_colder || eap->cmdidx == CMD_lolder) |
7 | 3653 { |
644 | 3654 if (qi->qf_curlist == 0) |
7 | 3655 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3656 emsg(_("E380: At bottom of quickfix stack")); |
4371 | 3657 break; |
7 | 3658 } |
644 | 3659 --qi->qf_curlist; |
7 | 3660 } |
3661 else | |
3662 { | |
644 | 3663 if (qi->qf_curlist >= qi->qf_listcount - 1) |
7 | 3664 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3665 emsg(_("E381: At top of quickfix stack")); |
4371 | 3666 break; |
7 | 3667 } |
644 | 3668 ++qi->qf_curlist; |
7 | 3669 } |
3670 } | |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3671 qf_msg(qi, qi->qf_curlist, ""); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
3672 qf_update_buffer(qi, NULL); |
7 | 3673 } |
3674 | |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3675 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3676 * Display the information about all the quickfix/location lists in the stack |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3677 */ |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3678 void |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3679 qf_history(exarg_T *eap) |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3680 { |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3681 qf_info_T *qi = &ql_info; |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3682 int i; |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3683 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
3684 if (is_loclist_cmd(eap->cmdidx)) |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3685 qi = GET_LOC_LIST(curwin); |
15424
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3686 if (qf_stack_empty(qi)) |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3687 msg(_("No entries")); |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3688 else |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3689 for (i = 0; i < qi->qf_listcount; ++i) |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3690 qf_msg(qi, i, i == qi->qf_curlist ? "> " : " "); |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3691 } |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3692 |
7 | 3693 /* |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3694 * Free all the entries in the error list "idx". Note that other information |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3695 * associated with the list like context and title are not freed. |
7 | 3696 */ |
3697 static void | |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3698 qf_free_items(qf_list_T *qfl) |
7 | 3699 { |
230 | 3700 qfline_T *qfp; |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3701 qfline_T *qfpnext; |
3982 | 3702 int stop = FALSE; |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3703 |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3704 while (qfl->qf_count && qfl->qf_start != NULL) |
7 | 3705 { |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3706 qfp = qfl->qf_start; |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3707 qfpnext = qfp->qf_next; |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
3708 if (!stop) |
3949 | 3709 { |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
3710 vim_free(qfp->qf_module); |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3711 vim_free(qfp->qf_text); |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
3712 vim_free(qfp->qf_pattern); |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3713 stop = (qfp == qfpnext); |
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3714 vim_free(qfp); |
3982 | 3715 if (stop) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3716 // Somehow qf_count may have an incorrect value, set it to 1 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3717 // to avoid crashing when it's wrong. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3718 // TODO: Avoid qf_count being incorrect. |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3719 qfl->qf_count = 1; |
3949 | 3720 } |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3721 qfl->qf_start = qfpnext; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3722 --qfl->qf_count; |
7 | 3723 } |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3724 |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3725 qfl->qf_index = 0; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3726 qfl->qf_start = NULL; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3727 qfl->qf_last = NULL; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3728 qfl->qf_ptr = NULL; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3729 qfl->qf_nonevalid = TRUE; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3730 |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3731 qf_clean_dir_stack(&qfl->qf_dir_stack); |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3732 qfl->qf_directory = NULL; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3733 qf_clean_dir_stack(&qfl->qf_file_stack); |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3734 qfl->qf_currfile = NULL; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3735 qfl->qf_multiline = FALSE; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3736 qfl->qf_multiignore = FALSE; |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3737 qfl->qf_multiscan = FALSE; |
7 | 3738 } |
3739 | |
3740 /* | |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3741 * Free error list "idx". Frees all the entries in the quickfix list, |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3742 * associated context information and the title. |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3743 */ |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3744 static void |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3745 qf_free(qf_list_T *qfl) |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3746 { |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3747 qf_free_items(qfl); |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3748 |
13244
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13115
diff
changeset
|
3749 VIM_CLEAR(qfl->qf_title); |
11700
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3750 free_tv(qfl->qf_ctx); |
dd821396754e
patch 8.0.0733: can only add entries to one list in the quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11609
diff
changeset
|
3751 qfl->qf_ctx = NULL; |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
3752 qfl->qf_id = 0; |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
3753 qfl->qf_changedtick = 0L; |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3754 } |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3755 |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3756 /* |
7 | 3757 * qf_mark_adjust: adjust marks |
3758 */ | |
3759 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3760 qf_mark_adjust( |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3761 win_T *wp, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3762 linenr_T line1, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3763 linenr_T line2, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3764 long amount, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3765 long amount_after) |
7 | 3766 { |
230 | 3767 int i; |
3768 qfline_T *qfp; | |
3769 int idx; | |
644 | 3770 qf_info_T *qi = &ql_info; |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
3771 int found_one = FALSE; |
9608
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
3772 int buf_has_flag = wp == NULL ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; |
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
3773 |
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
3774 if (!(curbuf->b_has_qf_entry & buf_has_flag)) |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
3775 return; |
644 | 3776 if (wp != NULL) |
3777 { | |
3778 if (wp->w_llist == NULL) | |
3779 return; | |
3780 qi = wp->w_llist; | |
3781 } | |
3782 | |
3783 for (idx = 0; idx < qi->qf_listcount; ++idx) | |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3784 if (!qf_list_empty(qi, idx)) |
644 | 3785 for (i = 0, qfp = qi->qf_lists[idx].qf_start; |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3786 i < qi->qf_lists[idx].qf_count && qfp != NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3787 ++i, qfp = qfp->qf_next) |
7 | 3788 if (qfp->qf_fnum == curbuf->b_fnum) |
3789 { | |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
3790 found_one = TRUE; |
7 | 3791 if (qfp->qf_lnum >= line1 && qfp->qf_lnum <= line2) |
3792 { | |
3793 if (amount == MAXLNUM) | |
3794 qfp->qf_cleared = TRUE; | |
3795 else | |
3796 qfp->qf_lnum += amount; | |
3797 } | |
3798 else if (amount_after && qfp->qf_lnum > line2) | |
3799 qfp->qf_lnum += amount_after; | |
3800 } | |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
3801 |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
3802 if (!found_one) |
9608
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
3803 curbuf->b_has_qf_entry &= ~buf_has_flag; |
7 | 3804 } |
3805 | |
3806 /* | |
3807 * Make a nice message out of the error character and the error number: | |
3808 * char number message | |
3809 * e or E 0 " error" | |
3810 * w or W 0 " warning" | |
3811 * i or I 0 " info" | |
3812 * 0 0 "" | |
3813 * other 0 " c" | |
3814 * e or E n " error n" | |
3815 * w or W n " warning n" | |
3816 * i or I n " info n" | |
3817 * 0 n " error n" | |
3818 * other n " c n" | |
3819 * 1 x "" :helpgrep | |
3820 */ | |
3821 static char_u * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3822 qf_types(int c, int nr) |
7 | 3823 { |
3824 static char_u buf[20]; | |
3825 static char_u cc[3]; | |
3826 char_u *p; | |
3827 | |
3828 if (c == 'W' || c == 'w') | |
3829 p = (char_u *)" warning"; | |
3830 else if (c == 'I' || c == 'i') | |
3831 p = (char_u *)" info"; | |
3832 else if (c == 'E' || c == 'e' || (c == 0 && nr > 0)) | |
3833 p = (char_u *)" error"; | |
3834 else if (c == 0 || c == 1) | |
3835 p = (char_u *)""; | |
3836 else | |
3837 { | |
3838 cc[0] = ' '; | |
3839 cc[1] = c; | |
3840 cc[2] = NUL; | |
3841 p = cc; | |
3842 } | |
3843 | |
3844 if (nr <= 0) | |
3845 return p; | |
3846 | |
3847 sprintf((char *)buf, "%s %3d", (char *)p, nr); | |
3848 return buf; | |
3849 } | |
3850 | |
3851 /* | |
14397
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3852 * When "split" is FALSE: Open the entry/result under the cursor. |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3853 * When "split" is TRUE: Open the entry/result under the cursor in a new window. |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3854 */ |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3855 void |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3856 qf_view_result(int split) |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3857 { |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3858 qf_info_T *qi = &ql_info; |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3859 |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3860 if (!bt_quickfix(curbuf)) |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3861 return; |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3862 |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3863 if (IS_LL_WINDOW(curwin)) |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3864 qi = GET_LOC_LIST(curwin); |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3865 |
14491
9df0fcbfebb2
patch 8.1.0259: no test for fixed quickfix issue
Christian Brabandt <cb@256bit.org>
parents:
14477
diff
changeset
|
3866 if (qf_list_empty(qi, qi->qf_curlist)) |
14397
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3867 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3868 emsg(_(e_quickfix)); |
14397
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3869 return; |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3870 } |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3871 |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3872 if (split) |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3873 { |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3874 // Open the selected entry in a new window |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3875 qf_jump_newwin(qi, 0, (long)curwin->w_cursor.lnum, FALSE, TRUE); |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3876 do_cmdline_cmd((char_u *) "clearjumps"); |
14397
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3877 return; |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3878 } |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3879 |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3880 do_cmdline_cmd((char_u *)(IS_LL_WINDOW(curwin) ? ".ll" : ".cc")); |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3881 } |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3882 |
19d99d9e670c
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Christian Brabandt <cb@256bit.org>
parents:
14307
diff
changeset
|
3883 /* |
7 | 3884 * ":cwindow": open the quickfix window if we have errors to display, |
3885 * close it if not. | |
644 | 3886 * ":lwindow": open the location list window if we have locations to display, |
3887 * close it if not. | |
7 | 3888 */ |
3889 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3890 ex_cwindow(exarg_T *eap) |
7 | 3891 { |
644 | 3892 qf_info_T *qi = &ql_info; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
3893 qf_list_T *qfl; |
7 | 3894 win_T *win; |
3895 | |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
3896 if (is_loclist_cmd(eap->cmdidx)) |
644 | 3897 { |
3898 qi = GET_LOC_LIST(curwin); | |
3899 if (qi == NULL) | |
3900 return; | |
3901 } | |
3902 | |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
3903 qfl = &qi->qf_lists[qi->qf_curlist]; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
3904 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3905 // Look for an existing quickfix window. |
644 | 3906 win = qf_find_win(qi); |
7 | 3907 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3908 // If a quickfix window is open but we have no errors to display, |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3909 // close the window. If a quickfix window is not open, then open |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3910 // it if we have errors; otherwise, leave it closed. |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
3911 if (qf_stack_empty(qi) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
3912 || qfl->qf_nonevalid |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
3913 || qf_list_empty(qi, qi->qf_curlist)) |
7 | 3914 { |
3915 if (win != NULL) | |
3916 ex_cclose(eap); | |
3917 } | |
3918 else if (win == NULL) | |
3919 ex_copen(eap); | |
3920 } | |
3921 | |
3922 /* | |
3923 * ":cclose": close the window showing the list of errors. | |
644 | 3924 * ":lclose": close the window showing the location list |
7 | 3925 */ |
3926 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3927 ex_cclose(exarg_T *eap) |
7 | 3928 { |
644 | 3929 win_T *win = NULL; |
3930 qf_info_T *qi = &ql_info; | |
3931 | |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
3932 if (is_loclist_cmd(eap->cmdidx)) |
644 | 3933 { |
3934 qi = GET_LOC_LIST(curwin); | |
3935 if (qi == NULL) | |
3936 return; | |
3937 } | |
3938 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3939 // Find existing quickfix window and close it. |
644 | 3940 win = qf_find_win(qi); |
7 | 3941 if (win != NULL) |
3942 win_close(win, FALSE); | |
3943 } | |
3944 | |
3945 /* | |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3946 * Set "w:quickfix_title" if "qi" has a title. |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3947 */ |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3948 static void |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3949 qf_set_title_var(qf_list_T *qfl) |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3950 { |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3951 if (qfl->qf_title != NULL) |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3952 set_internal_string_var((char_u *)"w:quickfix_title", qfl->qf_title); |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3953 } |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3954 |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3955 /* |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3956 * Goto a quickfix or location list window (if present). |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3957 * Returns OK if the window is found, FAIL otherwise. |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3958 */ |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3959 static int |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3960 qf_goto_cwindow(qf_info_T *qi, int resize, int sz, int vertsplit) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3961 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3962 win_T *win; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3963 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3964 win = qf_find_win(qi); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3965 if (win == NULL) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3966 return FAIL; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3967 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3968 win_goto(win); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3969 if (resize) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3970 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3971 if (vertsplit) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3972 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3973 if (sz != win->w_width) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3974 win_setwidth(sz); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3975 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3976 else if (sz != win->w_height) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3977 win_setheight(sz); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3978 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3979 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3980 return OK; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3981 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3982 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3983 /* |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3984 * Open a new quickfix or location list window, load the quickfix buffer and |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3985 * set the appropriate options for the window. |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3986 * Returns FAIL if the window could not be opened. |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3987 */ |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3988 static int |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3989 qf_open_new_cwindow(qf_info_T *qi, int height) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3990 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3991 buf_T *qf_buf; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3992 win_T *oldwin = curwin; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3993 tabpage_T *prevtab = curtab; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3994 int flags = 0; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3995 win_T *win; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3996 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3997 qf_buf = qf_find_buf(qi); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3998 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
3999 // The current window becomes the previous window afterwards. |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4000 win = curwin; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4001 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4002 if (IS_QF_STACK(qi) && cmdmod.split == 0) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4003 // Create the new quickfix window at the very bottom, except when |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4004 // :belowright or :aboveleft is used. |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4005 win_goto(lastwin); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4006 // Default is to open the window below the current window |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4007 if (cmdmod.split == 0) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4008 flags = WSP_BELOW; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4009 flags |= WSP_NEWLOC; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4010 if (win_split(height, flags) == FAIL) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4011 return FAIL; // not enough room for window |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4012 RESET_BINDING(curwin); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4013 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4014 if (IS_LL_STACK(qi)) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4015 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4016 // For the location list window, create a reference to the |
15770
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
4017 // location list stack from the window 'win'. |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
4018 curwin->w_llist_ref = qi; |
77e97f159554
patch 8.1.0892: failure when closing a window when location list is in use
Bram Moolenaar <Bram@vim.org>
parents:
15740
diff
changeset
|
4019 qi->qf_refcount++; |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4020 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4021 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4022 if (oldwin != curwin) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4023 oldwin = NULL; // don't store info when in another window |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4024 if (qf_buf != NULL) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4025 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4026 // Use the existing quickfix buffer |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4027 (void)do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE, |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4028 ECMD_HIDE + ECMD_OLDBUF, oldwin); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4029 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4030 else |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4031 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4032 // Create a new quickfix buffer |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4033 (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4034 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4035 // switch off 'swapfile' |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4036 set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4037 set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix", |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4038 OPT_LOCAL); |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4039 set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL); |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4040 RESET_BINDING(curwin); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4041 #ifdef FEAT_DIFF |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4042 curwin->w_p_diff = FALSE; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4043 #endif |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4044 #ifdef FEAT_FOLDING |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4045 set_option_value((char_u *)"fdm", 0L, (char_u *)"manual", |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4046 OPT_LOCAL); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4047 #endif |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4048 // save the number of the new buffer |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4049 qi->qf_bufnr = curbuf->b_fnum; |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4050 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4051 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4052 // Only set the height when still in the same tab page and there is no |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4053 // window to the side. |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4054 if (curtab == prevtab && curwin->w_width == Columns) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4055 win_setheight(height); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4056 curwin->w_p_wfh = TRUE; // set 'winfixheight' |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4057 if (win_valid(win)) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4058 prevwin = win; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4059 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4060 return OK; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4061 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4062 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4063 /* |
7 | 4064 * ":copen": open a window that shows the list of errors. |
644 | 4065 * ":lopen": open a window that shows the location list. |
7 | 4066 */ |
4067 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4068 ex_copen(exarg_T *eap) |
7 | 4069 { |
644 | 4070 qf_info_T *qi = &ql_info; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4071 qf_list_T *qfl; |
7 | 4072 int height; |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4073 int status = FAIL; |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4074 int lnum; |
7 | 4075 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4076 if (is_loclist_cmd(eap->cmdidx)) |
644 | 4077 { |
4078 qi = GET_LOC_LIST(curwin); | |
4079 if (qi == NULL) | |
4080 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
4081 emsg(_(e_loclist)); |
644 | 4082 return; |
4083 } | |
4084 } | |
4085 | |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4086 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4087 |
7 | 4088 if (eap->addr_count != 0) |
4089 height = eap->line2; | |
4090 else | |
4091 height = QF_WINHEIGHT; | |
4092 | |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4093 reset_VIsual_and_resel(); // stop Visual mode |
7 | 4094 #ifdef FEAT_GUI |
4095 need_mouse_correct = TRUE; | |
4096 #endif | |
4097 | |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4098 // Find an existing quickfix window, or open a new one. |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4099 if (cmdmod.tab == 0) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4100 status = qf_goto_cwindow(qi, eap->addr_count != 0, height, |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4101 cmdmod.split & WSP_VERT); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4102 if (status == FAIL) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4103 if (qf_open_new_cwindow(qi, height) == FAIL) |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4104 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4105 decr_quickfix_busy(); |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4106 return; |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4107 } |
7 | 4108 |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4109 qfl = &qi->qf_lists[qi->qf_curlist]; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4110 qf_set_title_var(qfl); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4111 // Save the current index here, as updating the quickfix buffer may free |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4112 // the quickfix list |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4113 lnum = qfl->qf_index; |
6793 | 4114 |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4115 // Fill the buffer with the quickfix list. |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4116 qf_fill_buffer(qi, curbuf, NULL); |
644 | 4117 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4118 decr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4119 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4120 curwin->w_cursor.lnum = lnum; |
7 | 4121 curwin->w_cursor.col = 0; |
4122 check_cursor(); | |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4123 update_topline(); // scroll to show the line |
7 | 4124 } |
4125 | |
4126 /* | |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4127 * Move the cursor in the quickfix window to "lnum". |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4128 */ |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4129 static void |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4130 qf_win_goto(win_T *win, linenr_T lnum) |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4131 { |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4132 win_T *old_curwin = curwin; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4133 |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4134 curwin = win; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4135 curbuf = win->w_buffer; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4136 curwin->w_cursor.lnum = lnum; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4137 curwin->w_cursor.col = 0; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4138 curwin->w_cursor.coladd = 0; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4139 curwin->w_curswant = 0; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4140 update_topline(); // scroll to show the line |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4141 redraw_later(VALID); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4142 curwin->w_redr_status = TRUE; // update ruler |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4143 curwin = old_curwin; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4144 curbuf = curwin->w_buffer; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4145 } |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4146 |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4147 /* |
9458
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4148 * :cbottom/:lbottom commands. |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4149 */ |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4150 void |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4151 ex_cbottom(exarg_T *eap) |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4152 { |
9458
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4153 qf_info_T *qi = &ql_info; |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4154 win_T *win; |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4155 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4156 if (is_loclist_cmd(eap->cmdidx)) |
9458
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4157 { |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4158 qi = GET_LOC_LIST(curwin); |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4159 if (qi == NULL) |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4160 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
4161 emsg(_(e_loclist)); |
9458
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4162 return; |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4163 } |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4164 } |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4165 |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4166 win = qf_find_win(qi); |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4167 if (win != NULL && win->w_cursor.lnum != win->w_buffer->b_ml.ml_line_count) |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4168 qf_win_goto(win, win->w_buffer->b_ml.ml_line_count); |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4169 } |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4170 |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4171 /* |
7 | 4172 * Return the number of the current entry (line number in the quickfix |
4173 * window). | |
4174 */ | |
4175 linenr_T | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4176 qf_current_entry(win_T *wp) |
7 | 4177 { |
644 | 4178 qf_info_T *qi = &ql_info; |
4179 | |
4180 if (IS_LL_WINDOW(wp)) | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4181 // In the location list window, use the referenced location list |
644 | 4182 qi = wp->w_llist_ref; |
4183 | |
4184 return qi->qf_lists[qi->qf_curlist].qf_index; | |
7 | 4185 } |
4186 | |
4187 /* | |
4188 * Update the cursor position in the quickfix window to the current error. | |
4189 * Return TRUE if there is a quickfix window. | |
4190 */ | |
4191 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4192 qf_win_pos_update( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4193 qf_info_T *qi, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4194 int old_qf_index) // previous qf_index or zero |
7 | 4195 { |
4196 win_T *win; | |
644 | 4197 int qf_index = qi->qf_lists[qi->qf_curlist].qf_index; |
7 | 4198 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4199 // Put the cursor on the current error in the quickfix window, so that |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4200 // it's viewable. |
644 | 4201 win = qf_find_win(qi); |
7 | 4202 if (win != NULL |
4203 && qf_index <= win->w_buffer->b_ml.ml_line_count | |
4204 && old_qf_index != qf_index) | |
4205 { | |
4206 if (qf_index > old_qf_index) | |
4207 { | |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4208 win->w_redraw_top = old_qf_index; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4209 win->w_redraw_bot = qf_index; |
7 | 4210 } |
4211 else | |
4212 { | |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4213 win->w_redraw_top = qf_index; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4214 win->w_redraw_bot = old_qf_index; |
7 | 4215 } |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4216 qf_win_goto(win, qf_index); |
7 | 4217 } |
4218 return win != NULL; | |
4219 } | |
4220 | |
4221 /* | |
859 | 4222 * Check whether the given window is displaying the specified quickfix/location |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
4223 * stack. |
859 | 4224 */ |
4225 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4226 is_qf_win(win_T *win, qf_info_T *qi) |
859 | 4227 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4228 // A window displaying the quickfix buffer will have the w_llist_ref field |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4229 // set to NULL. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4230 // A window displaying a location list buffer will have the w_llist_ref |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4231 // pointing to the location list. |
859 | 4232 if (bt_quickfix(win->w_buffer)) |
14560
8413e66d00a1
patch 8.1.0293: checks for type of stack is cryptic
Christian Brabandt <cb@256bit.org>
parents:
14552
diff
changeset
|
4233 if ((IS_QF_STACK(qi) && win->w_llist_ref == NULL) |
8413e66d00a1
patch 8.1.0293: checks for type of stack is cryptic
Christian Brabandt <cb@256bit.org>
parents:
14552
diff
changeset
|
4234 || (IS_LL_STACK(qi) && win->w_llist_ref == qi)) |
859 | 4235 return TRUE; |
4236 | |
4237 return FALSE; | |
4238 } | |
4239 | |
4240 /* | |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
4241 * Find a window displaying the quickfix/location stack 'qi' |
13115
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
4242 * Only searches in the current tabpage. |
644 | 4243 */ |
4244 static win_T * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4245 qf_find_win(qf_info_T *qi) |
644 | 4246 { |
4247 win_T *win; | |
4248 | |
4249 FOR_ALL_WINDOWS(win) | |
859 | 4250 if (is_qf_win(win, qi)) |
13115
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
4251 return win; |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
4252 return NULL; |
644 | 4253 } |
4254 | |
4255 /* | |
859 | 4256 * Find a quickfix buffer. |
4257 * Searches in windows opened in all the tabs. | |
7 | 4258 */ |
4259 static buf_T * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4260 qf_find_buf(qf_info_T *qi) |
7 | 4261 { |
859 | 4262 tabpage_T *tp; |
644 | 4263 win_T *win; |
4264 | |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4265 if (qi->qf_bufnr != INVALID_QFBUFNR) |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4266 { |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4267 buf_T *qfbuf; |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4268 qfbuf = buflist_findnr(qi->qf_bufnr); |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4269 if (qfbuf != NULL) |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4270 return qfbuf; |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4271 // buffer is no longer present |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4272 qi->qf_bufnr = INVALID_QFBUFNR; |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4273 } |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4274 |
859 | 4275 FOR_ALL_TAB_WINDOWS(tp, win) |
4276 if (is_qf_win(win, qi)) | |
4277 return win->w_buffer; | |
4278 | |
4279 return NULL; | |
7 | 4280 } |
4281 | |
4282 /* | |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4283 * Update the w:quickfix_title variable in the quickfix/location list window |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4284 */ |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4285 static void |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4286 qf_update_win_titlevar(qf_info_T *qi) |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4287 { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4288 win_T *win; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4289 win_T *curwin_save; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4290 |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4291 if ((win = qf_find_win(qi)) != NULL) |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4292 { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4293 curwin_save = curwin; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4294 curwin = win; |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
4295 qf_set_title_var(&qi->qf_lists[qi->qf_curlist]); |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4296 curwin = curwin_save; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4297 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4298 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4299 |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4300 /* |
7 | 4301 * Find the quickfix buffer. If it exists, update the contents. |
4302 */ | |
4303 static void | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4304 qf_update_buffer(qf_info_T *qi, qfline_T *old_last) |
7 | 4305 { |
4306 buf_T *buf; | |
3016 | 4307 win_T *win; |
7 | 4308 aco_save_T aco; |
4309 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4310 // Check if a buffer for the quickfix list exists. Update it. |
644 | 4311 buf = qf_find_buf(qi); |
7 | 4312 if (buf != NULL) |
4313 { | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4314 linenr_T old_line_count = buf->b_ml.ml_line_count; |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4315 |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4316 if (old_last == NULL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4317 // set curwin/curbuf to buf and save a few things |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4318 aucmd_prepbuf(&aco, buf); |
7 | 4319 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4320 qf_update_win_titlevar(qi); |
3016 | 4321 |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4322 qf_fill_buffer(qi, buf, old_last); |
11705
c43118ecb0a3
patch 8.0.0735: no indication that the quickfix window/buffer changed
Christian Brabandt <cb@256bit.org>
parents:
11700
diff
changeset
|
4323 ++CHANGEDTICK(buf); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4324 |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4325 if (old_last == NULL) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4326 { |
8932
25c2031e9f9f
commit https://github.com/vim/vim/commit/c1808d5822ed9534ef7f0fe509b15bee92a5cc28
Christian Brabandt <cb@256bit.org>
parents:
8751
diff
changeset
|
4327 (void)qf_win_pos_update(qi, 0); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4328 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4329 // restore curwin/curbuf and a few other things |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4330 aucmd_restbuf(&aco); |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4331 } |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4332 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4333 // Only redraw when added lines are visible. This avoids flickering |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4334 // when the added lines are not visible. |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4335 if ((win = qf_find_win(qi)) != NULL && old_line_count < win->w_botline) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4336 redraw_buf_later(buf, NOT_VALID); |
7 | 4337 } |
4338 } | |
4339 | |
6793 | 4340 /* |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4341 * Add an error line to the quickfix buffer. |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4342 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4343 static int |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4344 qf_buf_add_line(buf_T *buf, linenr_T lnum, qfline_T *qfp, char_u *dirname) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4345 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4346 int len; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4347 buf_T *errbuf; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4348 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4349 if (qfp->qf_module != NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4350 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4351 STRCPY(IObuff, qfp->qf_module); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4352 len = (int)STRLEN(IObuff); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4353 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4354 else if (qfp->qf_fnum != 0 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4355 && (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4356 && errbuf->b_fname != NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4357 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4358 if (qfp->qf_type == 1) // :helpgrep |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4359 STRCPY(IObuff, gettail(errbuf->b_fname)); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4360 else |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4361 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4362 // shorten the file name if not done already |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4363 if (errbuf->b_sfname == NULL |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4364 || mch_isFullName(errbuf->b_sfname)) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4365 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4366 if (*dirname == NUL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4367 mch_dirname(dirname, MAXPATHL); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4368 shorten_buf_fname(errbuf, dirname, FALSE); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4369 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4370 STRCPY(IObuff, errbuf->b_fname); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4371 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4372 len = (int)STRLEN(IObuff); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4373 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4374 else |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4375 len = 0; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4376 IObuff[len++] = '|'; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4377 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4378 if (qfp->qf_lnum > 0) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4379 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4380 sprintf((char *)IObuff + len, "%ld", qfp->qf_lnum); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4381 len += (int)STRLEN(IObuff + len); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4382 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4383 if (qfp->qf_col > 0) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4384 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4385 sprintf((char *)IObuff + len, " col %d", qfp->qf_col); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4386 len += (int)STRLEN(IObuff + len); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4387 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4388 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4389 sprintf((char *)IObuff + len, "%s", |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4390 (char *)qf_types(qfp->qf_type, qfp->qf_nr)); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4391 len += (int)STRLEN(IObuff + len); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4392 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4393 else if (qfp->qf_pattern != NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4394 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4395 qf_fmt_text(qfp->qf_pattern, IObuff + len, IOSIZE - len); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4396 len += (int)STRLEN(IObuff + len); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4397 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4398 IObuff[len++] = '|'; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4399 IObuff[len++] = ' '; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4400 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4401 // Remove newlines and leading whitespace from the text. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4402 // For an unrecognized line keep the indent, the compiler may |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4403 // mark a word with ^^^^. |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4404 qf_fmt_text(len > 3 ? skipwhite(qfp->qf_text) : qfp->qf_text, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4405 IObuff + len, IOSIZE - len); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4406 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4407 if (ml_append_buf(buf, lnum, IObuff, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4408 (colnr_T)STRLEN(IObuff) + 1, FALSE) == FAIL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4409 return FAIL; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4410 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4411 return OK; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4412 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4413 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4414 /* |
7 | 4415 * Fill current buffer with quickfix errors, replacing any previous contents. |
4416 * curbuf must be the quickfix buffer! | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4417 * If "old_last" is not NULL append the items after this one. |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4418 * When "old_last" is NULL then "buf" must equal "curbuf"! Because |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4419 * ml_delete() is used and autocommands will be triggered. |
7 | 4420 */ |
4421 static void | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4422 qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last) |
7 | 4423 { |
230 | 4424 linenr_T lnum; |
4425 qfline_T *qfp; | |
4426 int old_KeyTyped = KeyTyped; | |
7 | 4427 |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4428 if (old_last == NULL) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4429 { |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4430 if (buf != curbuf) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4431 { |
10359
66f1b5bf3fa6
commit https://github.com/vim/vim/commit/95f096030ed1a8afea028f2ea295d6f6a70f466f
Christian Brabandt <cb@256bit.org>
parents:
10349
diff
changeset
|
4432 internal_error("qf_fill_buffer()"); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4433 return; |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4434 } |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4435 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4436 // delete all existing lines |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4437 while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4438 (void)ml_delete((linenr_T)1, FALSE); |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4439 } |
7 | 4440 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4441 // Check if there is anything to display |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
4442 if (!qf_stack_empty(qi)) |
7 | 4443 { |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4444 qf_list_T *qfl = &qi->qf_lists[qi->qf_curlist]; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4445 char_u dirname[MAXPATHL]; |
13819
31bb8e1f7625
patch 8.0.1781: file names in quickfix window are not shortened
Christian Brabandt <cb@256bit.org>
parents:
13802
diff
changeset
|
4446 |
31bb8e1f7625
patch 8.0.1781: file names in quickfix window are not shortened
Christian Brabandt <cb@256bit.org>
parents:
13802
diff
changeset
|
4447 *dirname = NUL; |
31bb8e1f7625
patch 8.0.1781: file names in quickfix window are not shortened
Christian Brabandt <cb@256bit.org>
parents:
13802
diff
changeset
|
4448 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4449 // Add one line for each error |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4450 if (old_last == NULL) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4451 { |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4452 qfp = qfl->qf_start; |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4453 lnum = 0; |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4454 } |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4455 else |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4456 { |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4457 qfp = old_last->qf_next; |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4458 lnum = buf->b_ml.ml_line_count; |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4459 } |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4460 while (lnum < qfl->qf_count) |
7 | 4461 { |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4462 if (qf_buf_add_line(buf, lnum, qfp, dirname) == FAIL) |
7 | 4463 break; |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4464 |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4465 ++lnum; |
7 | 4466 qfp = qfp->qf_next; |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
4467 if (qfp == NULL) |
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
4468 break; |
7 | 4469 } |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4470 |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4471 if (old_last == NULL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4472 // Delete the empty line which is now at the end |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4473 (void)ml_delete(lnum + 1, FALSE); |
7 | 4474 } |
4475 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4476 // correct cursor position |
7 | 4477 check_lnums(TRUE); |
4478 | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4479 if (old_last == NULL) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4480 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4481 // Set the 'filetype' to "qf" each time after filling the buffer. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4482 // This resembles reading a file into a buffer, it's more logical when |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4483 // using autocommands. |
11589
39787def24bb
patch 8.0.0677: setting 'filetype' may switch buffers
Christian Brabandt <cb@256bit.org>
parents:
11549
diff
changeset
|
4484 ++curbuf_lock; |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4485 set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL); |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4486 curbuf->b_p_ma = FALSE; |
7 | 4487 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4488 keep_filetype = TRUE; // don't detect 'filetype' |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4489 apply_autocmds(EVENT_BUFREADPOST, (char_u *)"quickfix", NULL, |
7 | 4490 FALSE, curbuf); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4491 apply_autocmds(EVENT_BUFWINENTER, (char_u *)"quickfix", NULL, |
7 | 4492 FALSE, curbuf); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4493 keep_filetype = FALSE; |
11589
39787def24bb
patch 8.0.0677: setting 'filetype' may switch buffers
Christian Brabandt <cb@256bit.org>
parents:
11549
diff
changeset
|
4494 --curbuf_lock; |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
4495 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4496 // make sure it will be redrawn |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4497 redraw_curbuf_later(NOT_VALID); |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4498 } |
7 | 4499 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4500 // Restore KeyTyped, setting 'filetype' may reset it. |
7 | 4501 KeyTyped = old_KeyTyped; |
4502 } | |
4503 | |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
4504 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
4505 * For every change made to the quickfix list, update the changed tick. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
4506 */ |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
4507 static void |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4508 qf_list_changed(qf_list_T *qfl) |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4509 { |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4510 qfl->qf_changedtick++; |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
4511 } |
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
4512 |
7 | 4513 /* |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4514 * Return the quickfix/location list number with the given identifier. |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4515 * Returns -1 if list is not found. |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4516 */ |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4517 static int |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4518 qf_id2nr(qf_info_T *qi, int_u qfid) |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4519 { |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4520 int qf_idx; |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4521 |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4522 for (qf_idx = 0; qf_idx < qi->qf_listcount; qf_idx++) |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4523 if (qi->qf_lists[qf_idx].qf_id == qfid) |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4524 return qf_idx; |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4525 return INVALID_QFIDX; |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4526 } |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4527 |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4528 /* |
14495
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4529 * If the current list is not "save_qfid" and we can find the list with that ID |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4530 * then make it the current list. |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4531 * This is used when autocommands may have changed the current list. |
14507
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4532 * Returns OK if successfully restored the list. Returns FAIL if the list with |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4533 * the specified identifier (save_qfid) is not found in the stack. |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4534 */ |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4535 static int |
14495
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4536 qf_restore_list(qf_info_T *qi, int_u save_qfid) |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4537 { |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4538 int curlist; |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4539 |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4540 if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid) |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4541 { |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4542 curlist = qf_id2nr(qi, save_qfid); |
14507
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4543 if (curlist < 0) |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4544 // list is not present |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4545 return FAIL; |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4546 qi->qf_curlist = curlist; |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4547 } |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4548 return OK; |
14495
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4549 } |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4550 |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4551 /* |
14469
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4552 * Jump to the first entry if there is one. |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4553 */ |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4554 static void |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4555 qf_jump_first(qf_info_T *qi, int_u save_qfid, int forceit) |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4556 { |
14507
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4557 if (qf_restore_list(qi, save_qfid) == FAIL) |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4558 return; |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4559 |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4560 // Autocommands might have cleared the list, check for that. |
14491
9df0fcbfebb2
patch 8.1.0259: no test for fixed quickfix issue
Christian Brabandt <cb@256bit.org>
parents:
14477
diff
changeset
|
4561 if (!qf_list_empty(qi, qi->qf_curlist)) |
14469
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4562 qf_jump(qi, 0, 0, forceit); |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4563 } |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4564 |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4565 /* |
41 | 4566 * Return TRUE when using ":vimgrep" for ":grep". |
4567 */ | |
4568 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4569 grep_internal(cmdidx_T cmdidx) |
41 | 4570 { |
661 | 4571 return ((cmdidx == CMD_grep |
4572 || cmdidx == CMD_lgrep | |
4573 || cmdidx == CMD_grepadd | |
4574 || cmdidx == CMD_lgrepadd) | |
41 | 4575 && STRCMP("internal", |
4576 *curbuf->b_p_gp == NUL ? p_gp : curbuf->b_p_gp) == 0); | |
4577 } | |
4578 | |
4579 /* | |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4580 * Return the make/grep autocmd name. |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4581 */ |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4582 static char_u * |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4583 make_get_auname(cmdidx_T cmdidx) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4584 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4585 switch (cmdidx) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4586 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4587 case CMD_make: return (char_u *)"make"; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4588 case CMD_lmake: return (char_u *)"lmake"; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4589 case CMD_grep: return (char_u *)"grep"; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4590 case CMD_lgrep: return (char_u *)"lgrep"; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4591 case CMD_grepadd: return (char_u *)"grepadd"; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4592 case CMD_lgrepadd: return (char_u *)"lgrepadd"; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4593 default: return NULL; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4594 } |
7 | 4595 } |
4596 | |
4597 /* | |
4598 * Return the name for the errorfile, in allocated memory. | |
4599 * Find a new unique name when 'makeef' contains "##". | |
4600 * Returns NULL for error. | |
4601 */ | |
4602 static char_u * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4603 get_mef_name(void) |
7 | 4604 { |
4605 char_u *p; | |
4606 char_u *name; | |
4607 static int start = -1; | |
4608 static int off = 0; | |
4609 #ifdef HAVE_LSTAT | |
9387
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
9379
diff
changeset
|
4610 stat_T sb; |
7 | 4611 #endif |
4612 | |
4613 if (*p_mef == NUL) | |
4614 { | |
6721 | 4615 name = vim_tempname('e', FALSE); |
7 | 4616 if (name == NULL) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
4617 emsg(_(e_notmp)); |
7 | 4618 return name; |
4619 } | |
4620 | |
4621 for (p = p_mef; *p; ++p) | |
4622 if (p[0] == '#' && p[1] == '#') | |
4623 break; | |
4624 | |
4625 if (*p == NUL) | |
4626 return vim_strsave(p_mef); | |
4627 | |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4628 // Keep trying until the name doesn't exist yet. |
7 | 4629 for (;;) |
4630 { | |
4631 if (start == -1) | |
4632 start = mch_get_pid(); | |
4633 else | |
4634 off += 19; | |
4635 | |
4636 name = alloc((unsigned)STRLEN(p_mef) + 30); | |
4637 if (name == NULL) | |
4638 break; | |
4639 STRCPY(name, p_mef); | |
4640 sprintf((char *)name + (p - p_mef), "%d%d", start, off); | |
4641 STRCAT(name, p + 2); | |
4642 if (mch_getperm(name) < 0 | |
4643 #ifdef HAVE_LSTAT | |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4644 // Don't accept a symbolic link, it's a security risk. |
7 | 4645 && mch_lstat((char *)name, &sb) < 0 |
4646 #endif | |
4647 ) | |
4648 break; | |
4649 vim_free(name); | |
4650 } | |
4651 return name; | |
4652 } | |
4653 | |
4654 /* | |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4655 * Form the complete command line to invoke 'make'/'grep'. Quote the command |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4656 * using 'shellquote' and append 'shellpipe'. Echo the fully formed command. |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4657 */ |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4658 static char_u * |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4659 make_get_fullcmd(char_u *makecmd, char_u *fname) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4660 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4661 char_u *cmd; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4662 unsigned len; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4663 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4664 len = (unsigned)STRLEN(p_shq) * 2 + (unsigned)STRLEN(makecmd) + 1; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4665 if (*p_sp != NUL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4666 len += (unsigned)STRLEN(p_sp) + (unsigned)STRLEN(fname) + 3; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4667 cmd = alloc(len); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4668 if (cmd == NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4669 return NULL; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4670 sprintf((char *)cmd, "%s%s%s", (char *)p_shq, (char *)makecmd, |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4671 (char *)p_shq); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4672 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4673 // If 'shellpipe' empty: don't redirect to 'errorfile'. |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4674 if (*p_sp != NUL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4675 append_redir(cmd, len, p_sp, fname); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4676 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4677 // Display the fully formed command. Output a newline if there's something |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4678 // else than the :make command that was typed (in which case the cursor is |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4679 // in column 0). |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4680 if (msg_col == 0) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4681 msg_didout = FALSE; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4682 msg_start(); |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
4683 msg_puts(":!"); |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4684 msg_outtrans(cmd); // show what we are doing |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4685 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4686 return cmd; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4687 } |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4688 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4689 /* |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4690 * Used for ":make", ":lmake", ":grep", ":lgrep", ":grepadd", and ":lgrepadd" |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4691 */ |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4692 void |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4693 ex_make(exarg_T *eap) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4694 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4695 char_u *fname; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4696 char_u *cmd; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4697 char_u *enc = NULL; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4698 win_T *wp = NULL; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4699 qf_info_T *qi = &ql_info; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4700 int res; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4701 char_u *au_name = NULL; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4702 int_u save_qfid; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4703 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4704 // Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal". |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4705 if (grep_internal(eap->cmdidx)) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4706 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4707 ex_vimgrep(eap); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4708 return; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4709 } |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4710 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4711 au_name = make_get_auname(eap->cmdidx); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4712 if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4713 curbuf->b_fname, TRUE, curbuf)) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4714 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4715 #ifdef FEAT_EVAL |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4716 if (aborting()) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4717 return; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4718 #endif |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4719 } |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4720 enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4721 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4722 if (is_loclist_cmd(eap->cmdidx)) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4723 wp = curwin; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4724 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4725 autowrite_all(); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4726 fname = get_mef_name(); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4727 if (fname == NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4728 return; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4729 mch_remove(fname); // in case it's not unique |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4730 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4731 cmd = make_get_fullcmd(eap->arg, fname); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4732 if (cmd == NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4733 return; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4734 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4735 // let the shell know if we are redirecting output or not |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4736 do_shell(cmd, *p_sp != NUL ? SHELL_DOOUT : 0); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4737 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4738 #ifdef AMIGA |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4739 out_flush(); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4740 // read window status report and redraw before message |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4741 (void)char_avail(); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4742 #endif |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4743 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4744 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4745 |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4746 res = qf_init(wp, fname, (eap->cmdidx != CMD_make |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4747 && eap->cmdidx != CMD_lmake) ? p_gefm : p_efm, |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4748 (eap->cmdidx != CMD_grepadd |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4749 && eap->cmdidx != CMD_lgrepadd), |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4750 qf_cmdtitle(*eap->cmdlinep), enc); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4751 if (wp != NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4752 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4753 qi = GET_LOC_LIST(wp); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4754 if (qi == NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4755 goto cleanup; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4756 } |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4757 if (res >= 0) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4758 qf_list_changed(&qi->qf_lists[qi->qf_curlist]); |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4759 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4760 // Remember the current quickfix list identifier, so that we can |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4761 // check for autocommands changing the current quickfix list. |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4762 save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4763 if (au_name != NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4764 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4765 curbuf->b_fname, TRUE, curbuf); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4766 if (res > 0 && !eap->forceit && qflist_valid(wp, save_qfid)) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4767 // display the first error |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4768 qf_jump_first(qi, save_qfid, FALSE); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4769 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4770 cleanup: |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4771 decr_quickfix_busy(); |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4772 mch_remove(fname); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4773 vim_free(fname); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4774 vim_free(cmd); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4775 } |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4776 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4777 /* |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4778 * Returns the number of valid entries in the current quickfix/location list. |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4779 */ |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4780 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4781 qf_get_size(exarg_T *eap) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4782 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4783 qf_info_T *qi = &ql_info; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4784 qf_list_T *qfl; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4785 qfline_T *qfp; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4786 int i, sz = 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4787 int prev_fnum = 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4788 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4789 if (is_loclist_cmd(eap->cmdidx)) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4790 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4791 // Location list |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4792 qi = GET_LOC_LIST(curwin); |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4793 if (qi == NULL) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4794 return 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4795 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4796 |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4797 qfl = &qi->qf_lists[qi->qf_curlist]; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4798 for (i = 0, qfp = qfl->qf_start; i < qfl->qf_count && qfp != NULL; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4799 ++i, qfp = qfp->qf_next) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4800 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4801 if (qfp->qf_valid) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4802 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4803 if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4804 sz++; // Count all valid entries |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4805 else if (qfp->qf_fnum > 0 && qfp->qf_fnum != prev_fnum) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4806 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4807 // Count the number of files |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4808 sz++; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4809 prev_fnum = qfp->qf_fnum; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4810 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4811 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4812 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4813 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4814 return sz; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4815 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4816 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4817 /* |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4818 * Returns the current index of the quickfix/location list. |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4819 * Returns 0 if there is an error. |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4820 */ |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4821 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4822 qf_get_cur_idx(exarg_T *eap) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4823 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4824 qf_info_T *qi = &ql_info; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4825 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4826 if (is_loclist_cmd(eap->cmdidx)) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4827 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4828 // Location list |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4829 qi = GET_LOC_LIST(curwin); |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4830 if (qi == NULL) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4831 return 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4832 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4833 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4834 return qi->qf_lists[qi->qf_curlist].qf_index; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4835 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4836 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4837 /* |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4838 * Returns the current index in the quickfix/location list (counting only valid |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4839 * entries). If no valid entries are in the list, then returns 1. |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4840 */ |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4841 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4842 qf_get_cur_valid_idx(exarg_T *eap) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4843 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4844 qf_info_T *qi = &ql_info; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4845 qf_list_T *qfl; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4846 qfline_T *qfp; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4847 int i, eidx = 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4848 int prev_fnum = 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4849 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4850 if (is_loclist_cmd(eap->cmdidx)) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4851 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4852 // Location list |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4853 qi = GET_LOC_LIST(curwin); |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4854 if (qi == NULL) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4855 return 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4856 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4857 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4858 qfl = &qi->qf_lists[qi->qf_curlist]; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4859 qfp = qfl->qf_start; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4860 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4861 // check if the list has valid errors |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4862 if (qfl->qf_count <= 0 || qfl->qf_nonevalid) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4863 return 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4864 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4865 for (i = 1; i <= qfl->qf_index && qfp!= NULL; i++, qfp = qfp->qf_next) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4866 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4867 if (qfp->qf_valid) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4868 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4869 if (eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4870 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4871 if (qfp->qf_fnum > 0 && qfp->qf_fnum != prev_fnum) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4872 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4873 // Count the number of files |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4874 eidx++; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4875 prev_fnum = qfp->qf_fnum; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4876 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4877 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4878 else |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4879 eidx++; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4880 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4881 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4882 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4883 return eidx ? eidx : 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4884 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4885 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4886 /* |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4887 * Get the 'n'th valid error entry in the quickfix or location list. |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4888 * Used by :cdo, :ldo, :cfdo and :lfdo commands. |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4889 * For :cdo and :ldo returns the 'n'th valid error entry. |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4890 * For :cfdo and :lfdo returns the 'n'th valid file entry. |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4891 */ |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4892 static int |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
4893 qf_get_nth_valid_entry(qf_list_T *qfl, int n, int fdo) |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
4894 { |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4895 qfline_T *qfp = qfl->qf_start; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4896 int i, eidx; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4897 int prev_fnum = 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4898 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4899 // check if the list has valid errors |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4900 if (qfl->qf_count <= 0 || qfl->qf_nonevalid) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4901 return 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4902 |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
4903 for (i = 1, eidx = 0; i <= qfl->qf_count && qfp != NULL; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4904 i++, qfp = qfp->qf_next) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4905 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4906 if (qfp->qf_valid) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4907 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4908 if (fdo) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4909 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4910 if (qfp->qf_fnum > 0 && qfp->qf_fnum != prev_fnum) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4911 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4912 // Count the number of files |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4913 eidx++; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4914 prev_fnum = qfp->qf_fnum; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4915 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4916 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4917 else |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4918 eidx++; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4919 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4920 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4921 if (eidx == n) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4922 break; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4923 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4924 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4925 if (i <= qfl->qf_count) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4926 return i; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4927 else |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4928 return 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4929 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4930 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4931 /* |
7 | 4932 * ":cc", ":crewind", ":cfirst" and ":clast". |
644 | 4933 * ":ll", ":lrewind", ":lfirst" and ":llast". |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4934 * ":cdo", ":ldo", ":cfdo" and ":lfdo" |
7 | 4935 */ |
4936 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4937 ex_cc(exarg_T *eap) |
7 | 4938 { |
659 | 4939 qf_info_T *qi = &ql_info; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4940 int errornr; |
659 | 4941 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4942 if (is_loclist_cmd(eap->cmdidx)) |
644 | 4943 { |
4944 qi = GET_LOC_LIST(curwin); | |
4945 if (qi == NULL) | |
4946 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
4947 emsg(_(e_loclist)); |
644 | 4948 return; |
4949 } | |
4950 } | |
4951 | |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4952 if (eap->addr_count > 0) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4953 errornr = (int)eap->line2; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4954 else |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4955 { |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4956 switch (eap->cmdidx) |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4957 { |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4958 case CMD_cc: case CMD_ll: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4959 errornr = 0; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4960 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4961 case CMD_crewind: case CMD_lrewind: case CMD_cfirst: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4962 case CMD_lfirst: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4963 errornr = 1; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4964 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4965 default: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4966 errornr = 32767; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4967 } |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4968 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4969 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4970 // For cdo and ldo commands, jump to the nth valid error. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4971 // For cfdo and lfdo commands, jump to the nth valid file entry. |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
4972 if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
4973 || eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
4974 errornr = qf_get_nth_valid_entry(&qi->qf_lists[qi->qf_curlist], |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4975 eap->addr_count > 0 ? (int)eap->line1 : 1, |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4976 eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo); |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4977 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4978 qf_jump(qi, 0, errornr, eap->forceit); |
7 | 4979 } |
4980 | |
4981 /* | |
4982 * ":cnext", ":cnfile", ":cNext" and ":cprevious". | |
644 | 4983 * ":lnext", ":lNext", ":lprevious", ":lnfile", ":lNfile" and ":lpfile". |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4984 * Also, used by ":cdo", ":ldo", ":cfdo" and ":lfdo" commands. |
7 | 4985 */ |
4986 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4987 ex_cnext(exarg_T *eap) |
7 | 4988 { |
659 | 4989 qf_info_T *qi = &ql_info; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
4990 int errornr; |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4991 int dir; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4992 |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4993 if (is_loclist_cmd(eap->cmdidx)) |
644 | 4994 { |
4995 qi = GET_LOC_LIST(curwin); | |
4996 if (qi == NULL) | |
4997 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
4998 emsg(_(e_loclist)); |
644 | 4999 return; |
5000 } | |
5001 } | |
5002 | |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
5003 if (eap->addr_count > 0 |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
5004 && (eap->cmdidx != CMD_cdo && eap->cmdidx != CMD_ldo |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
5005 && eap->cmdidx != CMD_cfdo && eap->cmdidx != CMD_lfdo)) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5006 errornr = (int)eap->line2; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5007 else |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5008 errornr = 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5009 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5010 // Depending on the command jump to either next or previous entry/file. |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5011 switch (eap->cmdidx) |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5012 { |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5013 case CMD_cnext: case CMD_lnext: case CMD_cdo: case CMD_ldo: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5014 dir = FORWARD; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5015 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5016 case CMD_cprevious: case CMD_lprevious: case CMD_cNext: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5017 case CMD_lNext: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5018 dir = BACKWARD; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5019 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5020 case CMD_cnfile: case CMD_lnfile: case CMD_cfdo: case CMD_lfdo: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5021 dir = FORWARD_FILE; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5022 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5023 case CMD_cpfile: case CMD_lpfile: case CMD_cNfile: case CMD_lNfile: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5024 dir = BACKWARD_FILE; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5025 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5026 default: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5027 dir = FORWARD; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5028 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5029 } |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5030 |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5031 qf_jump(qi, dir, errornr, eap->forceit); |
7 | 5032 } |
5033 | |
5034 /* | |
446 | 5035 * ":cfile"/":cgetfile"/":caddfile" commands. |
644 | 5036 * ":lfile"/":lgetfile"/":laddfile" commands. |
7 | 5037 */ |
5038 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5039 ex_cfile(exarg_T *eap) |
7 | 5040 { |
11063
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
5041 char_u *enc = NULL; |
644 | 5042 win_T *wp = NULL; |
659 | 5043 qf_info_T *qi = &ql_info; |
3404 | 5044 char_u *au_name = NULL; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5045 int_u save_qfid = 0; // init for gcc |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
5046 int res; |
644 | 5047 |
3404 | 5048 switch (eap->cmdidx) |
5049 { | |
5050 case CMD_cfile: au_name = (char_u *)"cfile"; break; | |
5051 case CMD_cgetfile: au_name = (char_u *)"cgetfile"; break; | |
5052 case CMD_caddfile: au_name = (char_u *)"caddfile"; break; | |
5053 case CMD_lfile: au_name = (char_u *)"lfile"; break; | |
5054 case CMD_lgetfile: au_name = (char_u *)"lgetfile"; break; | |
5055 case CMD_laddfile: au_name = (char_u *)"laddfile"; break; | |
5056 default: break; | |
5057 } | |
5058 if (au_name != NULL) | |
5059 apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf); | |
11063
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
5060 enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; |
2296
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5061 #ifdef FEAT_BROWSE |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5062 if (cmdmod.browse) |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5063 { |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5064 char_u *browse_file = do_browse(0, (char_u *)_("Error file"), eap->arg, |
13802
378f9f8e6d8f
patch 8.0.1773: dialog messages are not translated
Christian Brabandt <cb@256bit.org>
parents:
13800
diff
changeset
|
5065 NULL, NULL, |
378f9f8e6d8f
patch 8.0.1773: dialog messages are not translated
Christian Brabandt <cb@256bit.org>
parents:
13800
diff
changeset
|
5066 (char_u *)_(BROWSE_FILTER_ALL_FILES), NULL); |
2296
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5067 if (browse_file == NULL) |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5068 return; |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5069 set_string_option_direct((char_u *)"ef", -1, browse_file, OPT_FREE, 0); |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5070 vim_free(browse_file); |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5071 } |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5072 else |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5073 #endif |
7 | 5074 if (*eap->arg != NUL) |
694 | 5075 set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0); |
446 | 5076 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5077 if (is_loclist_cmd(eap->cmdidx)) |
13078
a1f8939a4644
patch 8.0.1414: accessing freed memory in :lfile.
Christian Brabandt <cb@256bit.org>
parents:
13076
diff
changeset
|
5078 wp = curwin; |
a1f8939a4644
patch 8.0.1414: accessing freed memory in :lfile.
Christian Brabandt <cb@256bit.org>
parents:
13076
diff
changeset
|
5079 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5080 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5081 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5082 // This function is used by the :cfile, :cgetfile and :caddfile |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5083 // commands. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5084 // :cfile always creates a new quickfix list and jumps to the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5085 // first error. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5086 // :cgetfile creates a new quickfix list but doesn't jump to the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5087 // first error. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5088 // :caddfile adds to an existing quickfix list. If there is no |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5089 // quickfix list then a new list is created. |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
5090 res = qf_init(wp, p_ef, p_efm, (eap->cmdidx != CMD_caddfile |
13921
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
5091 && eap->cmdidx != CMD_laddfile), |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
5092 qf_cmdtitle(*eap->cmdlinep), enc); |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
5093 if (wp != NULL) |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5094 { |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
5095 qi = GET_LOC_LIST(wp); |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5096 if (qi == NULL) |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5097 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5098 decr_quickfix_busy(); |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5099 return; |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5100 } |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5101 } |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5102 if (res >= 0) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
5103 qf_list_changed(&qi->qf_lists[qi->qf_curlist]); |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5104 save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
5105 if (au_name != NULL) |
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
5106 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf); |
13252
66b8b29854d9
patch 8.0.1500: possible NULL pointer dereference
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
5107 |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5108 // Jump to the first error for a new list and if autocmds didn't |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5109 // free the list. |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5110 if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile) |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5111 && qflist_valid(wp, save_qfid)) |
14469
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
5112 // display the first error |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
5113 qf_jump_first(qi, save_qfid, eap->forceit); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5114 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5115 decr_quickfix_busy(); |
13594
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5116 } |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5117 |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5118 /* |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5119 * Return the vimgrep autocmd name. |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5120 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5121 static char_u * |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5122 vgr_get_auname(cmdidx_T cmdidx) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5123 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5124 switch (cmdidx) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5125 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5126 case CMD_vimgrep: return (char_u *)"vimgrep"; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5127 case CMD_lvimgrep: return (char_u *)"lvimgrep"; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5128 case CMD_vimgrepadd: return (char_u *)"vimgrepadd"; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5129 case CMD_lvimgrepadd: return (char_u *)"lvimgrepadd"; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5130 case CMD_grep: return (char_u *)"grep"; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5131 case CMD_lgrep: return (char_u *)"lgrep"; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5132 case CMD_grepadd: return (char_u *)"grepadd"; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5133 case CMD_lgrepadd: return (char_u *)"lgrepadd"; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5134 default: return NULL; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5135 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5136 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5137 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5138 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5139 * Initialize the regmatch used by vimgrep for pattern "s". |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5140 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5141 static void |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5142 vgr_init_regmatch(regmmatch_T *regmatch, char_u *s) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5143 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5144 // Get the search pattern: either white-separated or enclosed in // |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5145 regmatch->regprog = NULL; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5146 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5147 if (s == NULL || *s == NUL) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5148 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5149 // Pattern is empty, use last search pattern. |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5150 if (last_search_pat() == NULL) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5151 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
5152 emsg(_(e_noprevre)); |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5153 return; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5154 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5155 regmatch->regprog = vim_regcomp(last_search_pat(), RE_MAGIC); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5156 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5157 else |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5158 regmatch->regprog = vim_regcomp(s, RE_MAGIC); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5159 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5160 regmatch->rmm_ic = p_ic; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5161 regmatch->rmm_maxcol = 0; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5162 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5163 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5164 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5165 * Display a file name when vimgrep is running. |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5166 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5167 static void |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5168 vgr_display_fname(char_u *fname) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5169 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5170 char_u *p; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5171 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5172 msg_start(); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5173 p = msg_strtrunc(fname, TRUE); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5174 if (p == NULL) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5175 msg_outtrans(fname); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5176 else |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5177 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5178 msg_outtrans(p); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5179 vim_free(p); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5180 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5181 msg_clr_eos(); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5182 msg_didout = FALSE; // overwrite this message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5183 msg_nowait = TRUE; // don't wait for this message |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5184 msg_col = 0; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5185 out_flush(); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5186 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5187 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5188 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5189 * Load a dummy buffer to search for a pattern using vimgrep. |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5190 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5191 static buf_T * |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5192 vgr_load_dummy_buf( |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5193 char_u *fname, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5194 char_u *dirname_start, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5195 char_u *dirname_now) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5196 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5197 int save_mls; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5198 #if defined(FEAT_SYN_HL) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5199 char_u *save_ei = NULL; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5200 #endif |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5201 buf_T *buf; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5202 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5203 #if defined(FEAT_SYN_HL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5204 // Don't do Filetype autocommands to avoid loading syntax and |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5205 // indent scripts, a great speed improvement. |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5206 save_ei = au_event_disable(",Filetype"); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5207 #endif |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5208 // Don't use modelines here, it's useless. |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5209 save_mls = p_mls; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5210 p_mls = 0; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5211 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5212 // Load file into a buffer, so that 'fileencoding' is detected, |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5213 // autocommands applied, etc. |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5214 buf = load_dummy_buffer(fname, dirname_start, dirname_now); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5215 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5216 p_mls = save_mls; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5217 #if defined(FEAT_SYN_HL) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5218 au_event_restore(save_ei); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5219 #endif |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5220 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5221 return buf; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5222 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5223 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5224 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5225 * Check whether a quickfix/location list valid. Autocmds may remove or change |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5226 * a quickfix list when vimgrep is running. If the list is not found, create a |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5227 * new list. |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5228 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5229 static int |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5230 vgr_qflist_valid( |
13594
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5231 win_T *wp, |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5232 qf_info_T *qi, |
13594
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5233 int_u qfid, |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5234 char_u *title) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5235 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5236 // Verify that the quickfix/location list was not freed by an autocmd |
13594
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5237 if (!qflist_valid(wp, qfid)) |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5238 { |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5239 if (wp != NULL) |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5240 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5241 // An autocmd has freed the location list. |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
5242 emsg(_(e_loc_list_changed)); |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5243 return FALSE; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5244 } |
13594
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5245 else |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5246 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5247 // Quickfix list is not found, create a new one. |
13594
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5248 qf_new_list(qi, title); |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5249 return TRUE; |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5250 } |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5251 } |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5252 |
14507
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
5253 if (qf_restore_list(qi, qfid) == FAIL) |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
5254 return FALSE; |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5255 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5256 return TRUE; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5257 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5258 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5259 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5260 * Search for a pattern in all the lines in a buffer and add the matching lines |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5261 * to a quickfix list. |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5262 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5263 static int |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5264 vgr_match_buflines( |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5265 qf_info_T *qi, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5266 char_u *fname, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5267 buf_T *buf, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5268 regmmatch_T *regmatch, |
14976
676db1b7fc35
patch 8.1.0499: :2vimgrep causes an ml_get error
Bram Moolenaar <Bram@vim.org>
parents:
14956
diff
changeset
|
5269 long *tomatch, |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5270 int duplicate_name, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5271 int flags) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5272 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5273 int found_match = FALSE; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5274 long lnum; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5275 colnr_T col; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5276 |
14976
676db1b7fc35
patch 8.1.0499: :2vimgrep causes an ml_get error
Bram Moolenaar <Bram@vim.org>
parents:
14956
diff
changeset
|
5277 for (lnum = 1; lnum <= buf->b_ml.ml_line_count && *tomatch > 0; ++lnum) |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5278 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5279 col = 0; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5280 while (vim_regexec_multi(regmatch, curwin, buf, lnum, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5281 col, NULL, NULL) > 0) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5282 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5283 // Pass the buffer number so that it gets used even for a |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5284 // dummy buffer, unless duplicate_name is set, then the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5285 // buffer will be wiped out below. |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5286 if (qf_add_entry(qi, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5287 qi->qf_curlist, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5288 NULL, // dir |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5289 fname, |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
5290 NULL, |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5291 duplicate_name ? 0 : buf->b_fnum, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5292 ml_get_buf(buf, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5293 regmatch->startpos[0].lnum + lnum, FALSE), |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5294 regmatch->startpos[0].lnum + lnum, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5295 regmatch->startpos[0].col + 1, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5296 FALSE, // vis_col |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5297 NULL, // search pattern |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5298 0, // nr |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5299 0, // type |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5300 TRUE // valid |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5301 ) == FAIL) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5302 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5303 got_int = TRUE; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5304 break; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5305 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5306 found_match = TRUE; |
14976
676db1b7fc35
patch 8.1.0499: :2vimgrep causes an ml_get error
Bram Moolenaar <Bram@vim.org>
parents:
14956
diff
changeset
|
5307 if (--*tomatch == 0) |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5308 break; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5309 if ((flags & VGR_GLOBAL) == 0 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5310 || regmatch->endpos[0].lnum > 0) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5311 break; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5312 col = regmatch->endpos[0].col |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5313 + (col == regmatch->endpos[0].col); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5314 if (col > (colnr_T)STRLEN(ml_get_buf(buf, lnum, FALSE))) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5315 break; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5316 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5317 line_breakcheck(); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5318 if (got_int) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5319 break; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5320 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5321 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5322 return found_match; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5323 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5324 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5325 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5326 * Jump to the first match and update the directory. |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5327 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5328 static void |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5329 vgr_jump_to_match( |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5330 qf_info_T *qi, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5331 int forceit, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5332 int *redraw_for_dummy, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5333 buf_T *first_match_buf, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5334 char_u *target_dir) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5335 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5336 buf_T *buf; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5337 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5338 buf = curbuf; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5339 qf_jump(qi, 0, 0, forceit); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5340 if (buf != curbuf) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5341 // If we jumped to another buffer redrawing will already be |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5342 // taken care of. |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5343 *redraw_for_dummy = FALSE; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5344 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5345 // Jump to the directory used after loading the buffer. |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5346 if (curbuf == first_match_buf && target_dir != NULL) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5347 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5348 exarg_T ea; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5349 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5350 ea.arg = target_dir; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5351 ea.cmdidx = CMD_lcd; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5352 ex_cd(&ea); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5353 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5354 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5355 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5356 /* |
41 | 5357 * ":vimgrep {pattern} file(s)" |
657 | 5358 * ":vimgrepadd {pattern} file(s)" |
5359 * ":lvimgrep {pattern} file(s)" | |
5360 * ":lvimgrepadd {pattern} file(s)" | |
41 | 5361 */ |
5362 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5363 ex_vimgrep(exarg_T *eap) |
41 | 5364 { |
42 | 5365 regmmatch_T regmatch; |
153 | 5366 int fcount; |
41 | 5367 char_u **fnames; |
1411 | 5368 char_u *fname; |
8603
bfa74b84c41c
commit https://github.com/vim/vim/commit/5584df65a0ca2315d1eebc13c54a448bee4d0758
Christian Brabandt <cb@256bit.org>
parents:
7833
diff
changeset
|
5369 char_u *title; |
153 | 5370 char_u *s; |
5371 char_u *p; | |
5372 int fi; | |
657 | 5373 qf_info_T *qi = &ql_info; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
5374 qf_list_T *qfl; |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
5375 int_u save_qfid; |
13594
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5376 win_T *wp = NULL; |
42 | 5377 buf_T *buf; |
5378 int duplicate_name = FALSE; | |
5379 int using_dummy; | |
1396 | 5380 int redraw_for_dummy = FALSE; |
42 | 5381 int found_match; |
123 | 5382 buf_T *first_match_buf = NULL; |
5383 time_t seconds = 0; | |
5384 aco_save_T aco; | |
170 | 5385 int flags = 0; |
716 | 5386 long tomatch; |
2770 | 5387 char_u *dirname_start = NULL; |
5388 char_u *dirname_now = NULL; | |
1411 | 5389 char_u *target_dir = NULL; |
1683 | 5390 char_u *au_name = NULL; |
161 | 5391 |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5392 au_name = vgr_get_auname(eap->cmdidx); |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
5393 if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, |
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
5394 curbuf->b_fname, TRUE, curbuf)) |
161 | 5395 { |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
5396 #ifdef FEAT_EVAL |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
5397 if (aborting()) |
161 | 5398 return; |
5399 #endif | |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
5400 } |
41 | 5401 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5402 if (is_loclist_cmd(eap->cmdidx)) |
657 | 5403 { |
5404 qi = ll_get_or_alloc_list(curwin); | |
5405 if (qi == NULL) | |
5406 return; | |
13594
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5407 wp = curwin; |
657 | 5408 } |
5409 | |
716 | 5410 if (eap->addr_count > 0) |
5411 tomatch = eap->line2; | |
5412 else | |
5413 tomatch = MAXLNUM; | |
5414 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5415 // Get the search pattern: either white-separated or enclosed in // |
41 | 5416 regmatch.regprog = NULL; |
13921
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
5417 title = vim_strsave(qf_cmdtitle(*eap->cmdlinep)); |
170 | 5418 p = skip_vimgrep_pat(eap->arg, &s, &flags); |
153 | 5419 if (p == NULL) |
41 | 5420 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
5421 emsg(_(e_invalpat)); |
153 | 5422 goto theend; |
41 | 5423 } |
4197 | 5424 |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5425 vgr_init_regmatch(®match, s); |
41 | 5426 if (regmatch.regprog == NULL) |
5427 goto theend; | |
5428 | |
5429 p = skipwhite(p); | |
5430 if (*p == NUL) | |
5431 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
5432 emsg(_("E683: File name missing or invalid pattern")); |
41 | 5433 goto theend; |
5434 } | |
5435 | |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
5436 if ((eap->cmdidx != CMD_grepadd && eap->cmdidx != CMD_lgrepadd |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5437 && eap->cmdidx != CMD_vimgrepadd |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5438 && eap->cmdidx != CMD_lvimgrepadd) |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
5439 || qf_stack_empty(qi)) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5440 // make place for a new list |
13921
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
5441 qf_new_list(qi, title != NULL ? title : qf_cmdtitle(*eap->cmdlinep)); |
41 | 5442 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5443 // parse the list of arguments |
3620 | 5444 if (get_arglist_exp(p, &fcount, &fnames, TRUE) == FAIL) |
41 | 5445 goto theend; |
5446 if (fcount == 0) | |
5447 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
5448 emsg(_(e_nomatch)); |
41 | 5449 goto theend; |
5450 } | |
5451 | |
7558
9a4c9dccd603
commit https://github.com/vim/vim/commit/b86a343280b08d6701da68ee0651e960a0a7a61c
Christian Brabandt <cb@256bit.org>
parents:
7515
diff
changeset
|
5452 dirname_start = alloc_id(MAXPATHL, aid_qf_dirname_start); |
9a4c9dccd603
commit https://github.com/vim/vim/commit/b86a343280b08d6701da68ee0651e960a0a7a61c
Christian Brabandt <cb@256bit.org>
parents:
7515
diff
changeset
|
5453 dirname_now = alloc_id(MAXPATHL, aid_qf_dirname_now); |
2770 | 5454 if (dirname_start == NULL || dirname_now == NULL) |
7662
4d34891e98f4
commit https://github.com/vim/vim/commit/61ff4dd6a4d47bd32383fe28087be2b37dec53f4
Christian Brabandt <cb@256bit.org>
parents:
7558
diff
changeset
|
5455 { |
4d34891e98f4
commit https://github.com/vim/vim/commit/61ff4dd6a4d47bd32383fe28087be2b37dec53f4
Christian Brabandt <cb@256bit.org>
parents:
7558
diff
changeset
|
5456 FreeWild(fcount, fnames); |
2770 | 5457 goto theend; |
7662
4d34891e98f4
commit https://github.com/vim/vim/commit/61ff4dd6a4d47bd32383fe28087be2b37dec53f4
Christian Brabandt <cb@256bit.org>
parents:
7558
diff
changeset
|
5458 } |
2770 | 5459 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5460 // Remember the current directory, because a BufRead autocommand that does |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5461 // ":lcd %:p:h" changes the meaning of short path names. |
1411 | 5462 mch_dirname(dirname_start, MAXPATHL); |
5463 | |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5464 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5465 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5466 // Remember the current quickfix list identifier, so that we can check for |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5467 // autocommands changing the current quickfix list. |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
5468 save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; |
4003 | 5469 |
123 | 5470 seconds = (time_t)0; |
716 | 5471 for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi) |
41 | 5472 { |
1411 | 5473 fname = shorten_fname1(fnames[fi]); |
123 | 5474 if (time(NULL) > seconds) |
5475 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5476 // Display the file name every second or so, show the user we are |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5477 // working on it. |
123 | 5478 seconds = time(NULL); |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5479 vgr_display_fname(fname); |
123 | 5480 } |
5481 | |
42 | 5482 buf = buflist_findname_exp(fnames[fi]); |
5483 if (buf == NULL || buf->b_ml.ml_mfp == NULL) | |
5484 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5485 // Remember that a buffer with this name already exists. |
42 | 5486 duplicate_name = (buf != NULL); |
123 | 5487 using_dummy = TRUE; |
1396 | 5488 redraw_for_dummy = TRUE; |
123 | 5489 |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5490 buf = vgr_load_dummy_buf(fname, dirname_start, dirname_now); |
42 | 5491 } |
5492 else | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5493 // Use existing, loaded buffer. |
42 | 5494 using_dummy = FALSE; |
123 | 5495 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5496 // Check whether the quickfix list is still valid. When loading a |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5497 // buffer above, autocommands might have changed the quickfix list. |
13921
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
5498 if (!vgr_qflist_valid(wp, qi, save_qfid, qf_cmdtitle(*eap->cmdlinep))) |
13660
2d94fcb0277d
patch 8.0.1702: leaking memory when autocommands make quickfix list invalid
Christian Brabandt <cb@256bit.org>
parents:
13612
diff
changeset
|
5499 { |
2d94fcb0277d
patch 8.0.1702: leaking memory when autocommands make quickfix list invalid
Christian Brabandt <cb@256bit.org>
parents:
13612
diff
changeset
|
5500 FreeWild(fcount, fnames); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5501 decr_quickfix_busy(); |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5502 goto theend; |
13660
2d94fcb0277d
patch 8.0.1702: leaking memory when autocommands make quickfix list invalid
Christian Brabandt <cb@256bit.org>
parents:
13612
diff
changeset
|
5503 } |
13594
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5504 save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; |
4003 | 5505 |
42 | 5506 if (buf == NULL) |
123 | 5507 { |
5508 if (!got_int) | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
5509 smsg(_("Cannot open file \"%s\""), fname); |
123 | 5510 } |
41 | 5511 else |
5512 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5513 // Try for a match in all lines of the buffer. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5514 // For ":1vimgrep" look for first match only. |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5515 found_match = vgr_match_buflines(qi, fname, buf, ®match, |
14976
676db1b7fc35
patch 8.1.0499: :2vimgrep causes an ml_get error
Bram Moolenaar <Bram@vim.org>
parents:
14956
diff
changeset
|
5516 &tomatch, duplicate_name, flags); |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5517 |
42 | 5518 if (using_dummy) |
5519 { | |
123 | 5520 if (found_match && first_match_buf == NULL) |
5521 first_match_buf = buf; | |
42 | 5522 if (duplicate_name) |
123 | 5523 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5524 // Never keep a dummy buffer if there is another buffer |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5525 // with the same name. |
3490 | 5526 wipe_dummy_buffer(buf, dirname_start); |
123 | 5527 buf = NULL; |
5528 } | |
717 | 5529 else if (!cmdmod.hide |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5530 || buf->b_p_bh[0] == 'u' // "unload" |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5531 || buf->b_p_bh[0] == 'w' // "wipe" |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5532 || buf->b_p_bh[0] == 'd') // "delete" |
42 | 5533 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5534 // When no match was found we don't need to remember the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5535 // buffer, wipe it out. If there was a match and it |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5536 // wasn't the first one or we won't jump there: only |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5537 // unload the buffer. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5538 // Ignore 'hidden' here, because it may lead to having too |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5539 // many swap files. |
42 | 5540 if (!found_match) |
123 | 5541 { |
3490 | 5542 wipe_dummy_buffer(buf, dirname_start); |
123 | 5543 buf = NULL; |
5544 } | |
170 | 5545 else if (buf != first_match_buf || (flags & VGR_NOJUMP)) |
123 | 5546 { |
3490 | 5547 unload_dummy_buffer(buf, dirname_start); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5548 // Keeping the buffer, remove the dummy flag. |
9540
64a791c53418
commit https://github.com/vim/vim/commit/015102e91e978a0bb42a14461c132a85e8f7e1ea
Christian Brabandt <cb@256bit.org>
parents:
9538
diff
changeset
|
5549 buf->b_flags &= ~BF_DUMMY; |
123 | 5550 buf = NULL; |
5551 } | |
42 | 5552 } |
123 | 5553 |
5554 if (buf != NULL) | |
5555 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5556 // Keeping the buffer, remove the dummy flag. |
9540
64a791c53418
commit https://github.com/vim/vim/commit/015102e91e978a0bb42a14461c132a85e8f7e1ea
Christian Brabandt <cb@256bit.org>
parents:
9538
diff
changeset
|
5557 buf->b_flags &= ~BF_DUMMY; |
64a791c53418
commit https://github.com/vim/vim/commit/015102e91e978a0bb42a14461c132a85e8f7e1ea
Christian Brabandt <cb@256bit.org>
parents:
9538
diff
changeset
|
5558 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5559 // If the buffer is still loaded we need to use the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5560 // directory we jumped to below. |
1411 | 5561 if (buf == first_match_buf |
5562 && target_dir == NULL | |
5563 && STRCMP(dirname_start, dirname_now) != 0) | |
5564 target_dir = vim_strsave(dirname_now); | |
5565 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5566 // The buffer is still loaded, the Filetype autocommands |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5567 // need to be done now, in that buffer. And the modelines |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5568 // need to be done (again). But not the window-local |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5569 // options! |
123 | 5570 aucmd_prepbuf(&aco, buf); |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
5571 #if defined(FEAT_SYN_HL) |
123 | 5572 apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, |
5573 buf->b_fname, TRUE, buf); | |
677 | 5574 #endif |
717 | 5575 do_modelines(OPT_NOWIN); |
123 | 5576 aucmd_restbuf(&aco); |
5577 } | |
42 | 5578 } |
41 | 5579 } |
5580 } | |
5581 | |
5582 FreeWild(fcount, fnames); | |
5583 | |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
5584 qfl = &qi->qf_lists[qi->qf_curlist]; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
5585 qfl->qf_nonevalid = FALSE; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
5586 qfl->qf_ptr = qfl->qf_start; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
5587 qfl->qf_index = 1; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
5588 qf_list_changed(qfl); |
41 | 5589 |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
5590 qf_update_buffer(qi, NULL); |
41 | 5591 |
842 | 5592 if (au_name != NULL) |
5593 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, | |
5594 curbuf->b_fname, TRUE, curbuf); | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5595 // The QuickFixCmdPost autocmd may free the quickfix list. Check the list |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5596 // is still valid. |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5597 if (!qflist_valid(wp, save_qfid) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5598 || qf_restore_list(qi, save_qfid) == FAIL) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5599 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5600 decr_quickfix_busy(); |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
5601 goto theend; |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5602 } |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5603 |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
5604 // Jump to first match. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
5605 if (!qf_list_empty(qi, qi->qf_curlist)) |
170 | 5606 { |
5607 if ((flags & VGR_NOJUMP) == 0) | |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5608 vgr_jump_to_match(qi, eap->forceit, &redraw_for_dummy, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5609 first_match_buf, target_dir); |
170 | 5610 } |
42 | 5611 else |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
5612 semsg(_(e_nomatch2), s); |
41 | 5613 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5614 decr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5615 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5616 // If we loaded a dummy buffer into the current window, the autocommands |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5617 // may have messed up things, need to redraw and recompute folds. |
1396 | 5618 if (redraw_for_dummy) |
5619 { | |
5620 #ifdef FEAT_FOLDING | |
5621 foldUpdateAll(curwin); | |
5622 #else | |
5623 redraw_later(NOT_VALID); | |
5624 #endif | |
5625 } | |
5626 | |
41 | 5627 theend: |
8603
bfa74b84c41c
commit https://github.com/vim/vim/commit/5584df65a0ca2315d1eebc13c54a448bee4d0758
Christian Brabandt <cb@256bit.org>
parents:
7833
diff
changeset
|
5628 vim_free(title); |
2770 | 5629 vim_free(dirname_now); |
5630 vim_free(dirname_start); | |
1411 | 5631 vim_free(target_dir); |
4805
66803af09906
updated for version 7.3.1149
Bram Moolenaar <bram@vim.org>
parents:
4371
diff
changeset
|
5632 vim_regfree(regmatch.regprog); |
41 | 5633 } |
5634 | |
5635 /* | |
3490 | 5636 * Restore current working directory to "dirname_start" if they differ, taking |
5637 * into account whether it is set locally or globally. | |
5638 */ | |
5639 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5640 restore_start_dir(char_u *dirname_start) |
3490 | 5641 { |
5642 char_u *dirname_now = alloc(MAXPATHL); | |
5643 | |
5644 if (NULL != dirname_now) | |
5645 { | |
5646 mch_dirname(dirname_now, MAXPATHL); | |
5647 if (STRCMP(dirname_start, dirname_now) != 0) | |
5648 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5649 // If the directory has changed, change it back by building up an |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5650 // appropriate ex command and executing it. |
3490 | 5651 exarg_T ea; |
5652 | |
5653 ea.arg = dirname_start; | |
5654 ea.cmdidx = (curwin->w_localdir == NULL) ? CMD_cd : CMD_lcd; | |
5655 ex_cd(&ea); | |
5656 } | |
3974 | 5657 vim_free(dirname_now); |
3490 | 5658 } |
5659 } | |
5660 | |
5661 /* | |
5662 * Load file "fname" into a dummy buffer and return the buffer pointer, | |
5663 * placing the directory resulting from the buffer load into the | |
5664 * "resulting_dir" pointer. "resulting_dir" must be allocated by the caller | |
5665 * prior to calling this function. Restores directory to "dirname_start" prior | |
5666 * to returning, if autocmds or the 'autochdir' option have changed it. | |
5667 * | |
5668 * If creating the dummy buffer does not fail, must call unload_dummy_buffer() | |
5669 * or wipe_dummy_buffer() later! | |
5670 * | |
42 | 5671 * Returns NULL if it fails. |
5672 */ | |
5673 static buf_T * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5674 load_dummy_buffer( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5675 char_u *fname, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5676 char_u *dirname_start, // in: old directory |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5677 char_u *resulting_dir) // out: new directory |
42 | 5678 { |
5679 buf_T *newbuf; | |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
5680 bufref_T newbufref; |
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
5681 bufref_T newbuf_to_wipe; |
42 | 5682 int failed = TRUE; |
5683 aco_save_T aco; | |
13056
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13026
diff
changeset
|
5684 int readfile_result; |
42 | 5685 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5686 // Allocate a buffer without putting it in the buffer list. |
42 | 5687 newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY); |
5688 if (newbuf == NULL) | |
5689 return NULL; | |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
5690 set_bufref(&newbufref, newbuf); |
42 | 5691 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5692 // Init the options. |
177 | 5693 buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP); |
5694 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5695 // need to open the memfile before putting the buffer in a window |
1918 | 5696 if (ml_open(newbuf) == OK) |
42 | 5697 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5698 // Make sure this buffer isn't wiped out by autocommands. |
13056
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13026
diff
changeset
|
5699 ++newbuf->b_locked; |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13026
diff
changeset
|
5700 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5701 // set curwin/curbuf to buf and save a few things |
1918 | 5702 aucmd_prepbuf(&aco, newbuf); |
5703 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5704 // Need to set the filename for autocommands. |
1918 | 5705 (void)setfname(curbuf, fname, NULL, FALSE); |
5706 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5707 // Create swap file now to avoid the ATTENTION message. |
42 | 5708 check_need_swap(TRUE); |
5709 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5710 // Remove the "dummy" flag, otherwise autocommands may not |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5711 // work. |
42 | 5712 curbuf->b_flags &= ~BF_DUMMY; |
5713 | |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
5714 newbuf_to_wipe.br_buf = NULL; |
13056
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13026
diff
changeset
|
5715 readfile_result = readfile(fname, NULL, |
42 | 5716 (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, |
13056
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13026
diff
changeset
|
5717 NULL, READ_NEW | READ_DUMMY); |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13026
diff
changeset
|
5718 --newbuf->b_locked; |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13026
diff
changeset
|
5719 if (readfile_result == OK |
857 | 5720 && !got_int |
42 | 5721 && !(curbuf->b_flags & BF_NEW)) |
5722 { | |
5723 failed = FALSE; | |
5724 if (curbuf != newbuf) | |
5725 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5726 // Bloody autocommands changed the buffer! Can happen when |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5727 // using netrw and editing a remote file. Use the current |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5728 // buffer instead, delete the dummy one after restoring the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5729 // window stuff. |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
5730 set_bufref(&newbuf_to_wipe, newbuf); |
42 | 5731 newbuf = curbuf; |
5732 } | |
5733 } | |
1918 | 5734 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5735 // restore curwin/curbuf and a few other things |
1918 | 5736 aucmd_restbuf(&aco); |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
5737 if (newbuf_to_wipe.br_buf != NULL && bufref_valid(&newbuf_to_wipe)) |
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
5738 wipe_buffer(newbuf_to_wipe.br_buf, FALSE); |
9485
c16e207dc465
commit https://github.com/vim/vim/commit/ea3f2e7be447a8f0c4436869620f908de5e8ef1e
Christian Brabandt <cb@256bit.org>
parents:
9475
diff
changeset
|
5739 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5740 // Add back the "dummy" flag, otherwise buflist_findname_stat() won't |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5741 // skip it. |
9485
c16e207dc465
commit https://github.com/vim/vim/commit/ea3f2e7be447a8f0c4436869620f908de5e8ef1e
Christian Brabandt <cb@256bit.org>
parents:
9475
diff
changeset
|
5742 newbuf->b_flags |= BF_DUMMY; |
42 | 5743 } |
5744 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5745 // When autocommands/'autochdir' option changed directory: go back. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5746 // Let the caller know what the resulting dir was first, in case it is |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5747 // important. |
3490 | 5748 mch_dirname(resulting_dir, MAXPATHL); |
5749 restore_start_dir(dirname_start); | |
5750 | |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
5751 if (!bufref_valid(&newbufref)) |
42 | 5752 return NULL; |
5753 if (failed) | |
5754 { | |
3490 | 5755 wipe_dummy_buffer(newbuf, dirname_start); |
42 | 5756 return NULL; |
5757 } | |
5758 return newbuf; | |
5759 } | |
5760 | |
5761 /* | |
3490 | 5762 * Wipe out the dummy buffer that load_dummy_buffer() created. Restores |
5763 * directory to "dirname_start" prior to returning, if autocmds or the | |
5764 * 'autochdir' option have changed it. | |
42 | 5765 */ |
5766 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5767 wipe_dummy_buffer(buf_T *buf, char_u *dirname_start) |
42 | 5768 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5769 if (curbuf != buf) // safety check |
857 | 5770 { |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
5771 #if defined(FEAT_EVAL) |
857 | 5772 cleanup_T cs; |
5773 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5774 // Reset the error/interrupt/exception state here so that aborting() |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5775 // returns FALSE when wiping out the buffer. Otherwise it doesn't |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5776 // work when got_int is set. |
857 | 5777 enter_cleanup(&cs); |
5778 #endif | |
5779 | |
42 | 5780 wipe_buffer(buf, FALSE); |
857 | 5781 |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
5782 #if defined(FEAT_EVAL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5783 // Restore the error/interrupt/exception state if not discarded by a |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5784 // new aborting error, interrupt, or uncaught exception. |
857 | 5785 leave_cleanup(&cs); |
5786 #endif | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5787 // When autocommands/'autochdir' option changed directory: go back. |
3490 | 5788 restore_start_dir(dirname_start); |
857 | 5789 } |
42 | 5790 } |
5791 | |
5792 /* | |
3490 | 5793 * Unload the dummy buffer that load_dummy_buffer() created. Restores |
5794 * directory to "dirname_start" prior to returning, if autocmds or the | |
5795 * 'autochdir' option have changed it. | |
42 | 5796 */ |
5797 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5798 unload_dummy_buffer(buf_T *buf, char_u *dirname_start) |
42 | 5799 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5800 if (curbuf != buf) // safety check |
3490 | 5801 { |
3365 | 5802 close_buffer(NULL, buf, DOBUF_UNLOAD, FALSE); |
3490 | 5803 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5804 // When autocommands/'autochdir' option changed directory: go back. |
3490 | 5805 restore_start_dir(dirname_start); |
5806 } | |
42 | 5807 } |
5808 | |
170 | 5809 #if defined(FEAT_EVAL) || defined(PROTO) |
5810 /* | |
5811 * Add each quickfix error to list "list" as a dictionary. | |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5812 * If qf_idx is -1, use the current list. Otherwise, use the specified list. |
170 | 5813 */ |
5814 int | |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5815 get_errorlist(qf_info_T *qi_arg, win_T *wp, int qf_idx, list_T *list) |
170 | 5816 { |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5817 qf_info_T *qi = qi_arg; |
230 | 5818 dict_T *dict; |
5819 char_u buf[2]; | |
5820 qfline_T *qfp; | |
5821 int i; | |
1065 | 5822 int bufnum; |
170 | 5823 |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5824 if (qi == NULL) |
647 | 5825 { |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5826 qi = &ql_info; |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5827 if (wp != NULL) |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5828 { |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5829 qi = GET_LOC_LIST(wp); |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5830 if (qi == NULL) |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5831 return FAIL; |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5832 } |
647 | 5833 } |
5834 | |
13800
e4dc4ede9ef8
patch 8.0.1772: quickfix: mixup of FALSE and FAIL, returning -1
Christian Brabandt <cb@256bit.org>
parents:
13764
diff
changeset
|
5835 if (qf_idx == INVALID_QFIDX) |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5836 qf_idx = qi->qf_curlist; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5837 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
5838 if (qf_idx >= qi->qf_listcount || qf_list_empty(qi, qf_idx)) |
170 | 5839 return FAIL; |
5840 | |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5841 qfp = qi->qf_lists[qf_idx].qf_start; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5842 for (i = 1; !got_int && i <= qi->qf_lists[qf_idx].qf_count; ++i) |
170 | 5843 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5844 // Handle entries with a non-existing buffer number. |
1065 | 5845 bufnum = qfp->qf_fnum; |
5846 if (bufnum != 0 && (buflist_findnr(bufnum) == NULL)) | |
5847 bufnum = 0; | |
5848 | |
170 | 5849 if ((dict = dict_alloc()) == NULL) |
5850 return FAIL; | |
5851 if (list_append_dict(list, dict) == FAIL) | |
5852 return FAIL; | |
5853 | |
5854 buf[0] = qfp->qf_type; | |
5855 buf[1] = NUL; | |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
5856 if ( dict_add_number(dict, "bufnr", (long)bufnum) == FAIL |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
5857 || dict_add_number(dict, "lnum", (long)qfp->qf_lnum) == FAIL |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
5858 || dict_add_number(dict, "col", (long)qfp->qf_col) == FAIL |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
5859 || dict_add_number(dict, "vcol", (long)qfp->qf_viscol) == FAIL |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
5860 || dict_add_number(dict, "nr", (long)qfp->qf_nr) == FAIL |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
5861 || dict_add_string(dict, "module", qfp->qf_module) == FAIL |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
5862 || dict_add_string(dict, "pattern", qfp->qf_pattern) == FAIL |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
5863 || dict_add_string(dict, "text", qfp->qf_text) == FAIL |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
5864 || dict_add_string(dict, "type", buf) == FAIL |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
5865 || dict_add_number(dict, "valid", (long)qfp->qf_valid) == FAIL) |
170 | 5866 return FAIL; |
5867 | |
5868 qfp = qfp->qf_next; | |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
5869 if (qfp == NULL) |
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
5870 break; |
170 | 5871 } |
5872 return OK; | |
5873 } | |
230 | 5874 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5875 // Flags used by getqflist()/getloclist() to determine which fields to return. |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5876 enum { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5877 QF_GETLIST_NONE = 0x0, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5878 QF_GETLIST_TITLE = 0x1, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5879 QF_GETLIST_ITEMS = 0x2, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5880 QF_GETLIST_NR = 0x4, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5881 QF_GETLIST_WINID = 0x8, |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
5882 QF_GETLIST_CONTEXT = 0x10, |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5883 QF_GETLIST_ID = 0x20, |
12465
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
5884 QF_GETLIST_IDX = 0x40, |
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
5885 QF_GETLIST_SIZE = 0x80, |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
5886 QF_GETLIST_TICK = 0x100, |
14664
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
5887 QF_GETLIST_FILEWINID = 0x200, |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
5888 QF_GETLIST_ALL = 0x3FF, |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5889 }; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5890 |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5891 /* |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
5892 * Parse text from 'di' and return the quickfix list items. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
5893 * Existing quickfix lists are not modified. |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5894 */ |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5895 static int |
12321
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5896 qf_get_list_from_lines(dict_T *what, dictitem_T *di, dict_T *retdict) |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5897 { |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5898 int status = FAIL; |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5899 qf_info_T *qi; |
12321
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5900 char_u *errorformat = p_efm; |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5901 dictitem_T *efm_di; |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5902 list_T *l; |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5903 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5904 // Only a List value is supported |
12303
ec7a4fd21dd5
patch 8.0.1031: "text" argument for getqflist() is confusing
Christian Brabandt <cb@256bit.org>
parents:
12299
diff
changeset
|
5905 if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL) |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5906 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5907 // If errorformat is supplied then use it, otherwise use the 'efm' |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5908 // option setting |
12321
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5909 if ((efm_di = dict_find(what, (char_u *)"efm", -1)) != NULL) |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5910 { |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5911 if (efm_di->di_tv.v_type != VAR_STRING || |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5912 efm_di->di_tv.vval.v_string == NULL) |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5913 return FAIL; |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5914 errorformat = efm_di->di_tv.vval.v_string; |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5915 } |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5916 |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5917 l = list_alloc(); |
12299
f4d00472e617
patch 8.0.1029: return value of getqflist() is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
12287
diff
changeset
|
5918 if (l == NULL) |
f4d00472e617
patch 8.0.1029: return value of getqflist() is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
12287
diff
changeset
|
5919 return FAIL; |
f4d00472e617
patch 8.0.1029: return value of getqflist() is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
12287
diff
changeset
|
5920 |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
5921 qi = qf_alloc_stack(QFLT_INTERNAL); |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5922 if (qi != NULL) |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5923 { |
12321
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
5924 if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, errorformat, |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5925 TRUE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5926 { |
12299
f4d00472e617
patch 8.0.1029: return value of getqflist() is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
12287
diff
changeset
|
5927 (void)get_errorlist(qi, NULL, 0, l); |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
5928 qf_free(&qi->qf_lists[0]); |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5929 } |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5930 free(qi); |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5931 } |
12299
f4d00472e617
patch 8.0.1029: return value of getqflist() is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
12287
diff
changeset
|
5932 dict_add_list(retdict, "items", l); |
f4d00472e617
patch 8.0.1029: return value of getqflist() is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
12287
diff
changeset
|
5933 status = OK; |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5934 } |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5935 |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5936 return status; |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5937 } |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5938 |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
5939 /* |
13115
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5940 * Return the quickfix/location list window identifier in the current tabpage. |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5941 */ |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5942 static int |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5943 qf_winid(qf_info_T *qi) |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5944 { |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5945 win_T *win; |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5946 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5947 // The quickfix window can be opened even if the quickfix list is not set |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5948 // using ":copen". This is not true for location lists. |
13115
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5949 if (qi == NULL) |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5950 return 0; |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5951 win = qf_find_win(qi); |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5952 if (win != NULL) |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5953 return win->w_id; |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5954 return 0; |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5955 } |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5956 |
9812a9ca3ab2
patch 8.0.1432: after ":copen" can't get the window-ID of the quickfix window
Christian Brabandt <cb@256bit.org>
parents:
13105
diff
changeset
|
5957 /* |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
5958 * Convert the keys in 'what' to quickfix list property flags. |
230 | 5959 */ |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
5960 static int |
14664
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
5961 qf_getprop_keys2flags(dict_T *what, int loclist) |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5962 { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5963 int flags = QF_GETLIST_NONE; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
5964 |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5965 if (dict_find(what, (char_u *)"all", -1) != NULL) |
14664
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
5966 { |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5967 flags |= QF_GETLIST_ALL; |
14664
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
5968 if (!loclist) |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
5969 // File window ID is applicable only to location list windows |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
5970 flags &= ~ QF_GETLIST_FILEWINID; |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
5971 } |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5972 |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5973 if (dict_find(what, (char_u *)"title", -1) != NULL) |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5974 flags |= QF_GETLIST_TITLE; |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5975 |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
5976 if (dict_find(what, (char_u *)"nr", -1) != NULL) |
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
5977 flags |= QF_GETLIST_NR; |
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
5978 |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5979 if (dict_find(what, (char_u *)"winid", -1) != NULL) |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5980 flags |= QF_GETLIST_WINID; |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5981 |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5982 if (dict_find(what, (char_u *)"context", -1) != NULL) |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5983 flags |= QF_GETLIST_CONTEXT; |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5984 |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
5985 if (dict_find(what, (char_u *)"id", -1) != NULL) |
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
5986 flags |= QF_GETLIST_ID; |
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
5987 |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5988 if (dict_find(what, (char_u *)"items", -1) != NULL) |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
5989 flags |= QF_GETLIST_ITEMS; |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
5990 |
12465
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
5991 if (dict_find(what, (char_u *)"idx", -1) != NULL) |
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
5992 flags |= QF_GETLIST_IDX; |
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
5993 |
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
5994 if (dict_find(what, (char_u *)"size", -1) != NULL) |
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
5995 flags |= QF_GETLIST_SIZE; |
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
5996 |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
5997 if (dict_find(what, (char_u *)"changedtick", -1) != NULL) |
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
5998 flags |= QF_GETLIST_TICK; |
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
5999 |
14664
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6000 if (loclist && dict_find(what, (char_u *)"filewinid", -1) != NULL) |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6001 flags |= QF_GETLIST_FILEWINID; |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6002 |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6003 return flags; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6004 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6005 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6006 /* |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6007 * Return the quickfix list index based on 'nr' or 'id' in 'what'. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6008 * If 'nr' and 'id' are not present in 'what' then return the current |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6009 * quickfix list index. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6010 * If 'nr' is zero then return the current quickfix list index. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6011 * If 'nr' is '$' then return the last quickfix list index. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6012 * If 'id' is present then return the index of the quickfix list with that id. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6013 * If 'id' is zero then return the quickfix list index specified by 'nr'. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6014 * Return -1, if quickfix list is not present or if the stack is empty. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6015 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6016 static int |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6017 qf_getprop_qfidx(qf_info_T *qi, dict_T *what) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6018 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6019 int qf_idx; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6020 dictitem_T *di; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6021 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6022 qf_idx = qi->qf_curlist; // default is the current list |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6023 if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6024 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6025 // Use the specified quickfix/location list |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6026 if (di->di_tv.v_type == VAR_NUMBER) |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6027 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6028 // for zero use the current list |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6029 if (di->di_tv.vval.v_number != 0) |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6030 { |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6031 qf_idx = di->di_tv.vval.v_number - 1; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6032 if (qf_idx < 0 || qf_idx >= qi->qf_listcount) |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6033 qf_idx = INVALID_QFIDX; |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6034 } |
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6035 } |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6036 else if (di->di_tv.v_type == VAR_STRING |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6037 && di->di_tv.vval.v_string != NULL |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6038 && STRCMP(di->di_tv.vval.v_string, "$") == 0) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6039 // Get the last quickfix list number |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6040 qf_idx = qi->qf_listcount - 1; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6041 else |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6042 qf_idx = INVALID_QFIDX; |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6043 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6044 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6045 if ((di = dict_find(what, (char_u *)"id", -1)) != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6046 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6047 // Look for a list with the specified id |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6048 if (di->di_tv.v_type == VAR_NUMBER) |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6049 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6050 // For zero, use the current list or the list specified by 'nr' |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6051 if (di->di_tv.vval.v_number != 0) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6052 qf_idx = qf_id2nr(qi, di->di_tv.vval.v_number); |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6053 } |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6054 else |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6055 qf_idx = INVALID_QFIDX; |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6056 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6057 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6058 return qf_idx; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6059 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6060 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6061 /* |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6062 * Return default values for quickfix list properties in retdict. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6063 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6064 static int |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
6065 qf_getprop_defaults(qf_info_T *qi, int flags, int locstack, dict_T *retdict) |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6066 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6067 int status = OK; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6068 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6069 if (flags & QF_GETLIST_TITLE) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6070 status = dict_add_string(retdict, "title", (char_u *)""); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6071 if ((status == OK) && (flags & QF_GETLIST_ITEMS)) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6072 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6073 list_T *l = list_alloc(); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6074 if (l != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6075 status = dict_add_list(retdict, "items", l); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6076 else |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6077 status = FAIL; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6078 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6079 if ((status == OK) && (flags & QF_GETLIST_NR)) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6080 status = dict_add_number(retdict, "nr", 0); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6081 if ((status == OK) && (flags & QF_GETLIST_WINID)) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6082 status = dict_add_number(retdict, "winid", qf_winid(qi)); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6083 if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6084 status = dict_add_string(retdict, "context", (char_u *)""); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6085 if ((status == OK) && (flags & QF_GETLIST_ID)) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6086 status = dict_add_number(retdict, "id", 0); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6087 if ((status == OK) && (flags & QF_GETLIST_IDX)) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6088 status = dict_add_number(retdict, "idx", 0); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6089 if ((status == OK) && (flags & QF_GETLIST_SIZE)) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6090 status = dict_add_number(retdict, "size", 0); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6091 if ((status == OK) && (flags & QF_GETLIST_TICK)) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6092 status = dict_add_number(retdict, "changedtick", 0); |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
6093 if ((status == OK) && locstack && (flags & QF_GETLIST_FILEWINID)) |
14664
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6094 status = dict_add_number(retdict, "filewinid", 0); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6095 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6096 return status; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6097 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6098 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6099 /* |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6100 * Return the quickfix list title as 'title' in retdict |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6101 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6102 static int |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6103 qf_getprop_title(qf_list_T *qfl, dict_T *retdict) |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6104 { |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6105 return dict_add_string(retdict, "title", qfl->qf_title); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6106 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6107 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6108 /* |
14664
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6109 * Returns the identifier of the window used to display files from a location |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6110 * list. If there is no associated window, then returns 0. Useful only when |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6111 * called from a location list window. |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6112 */ |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6113 static int |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6114 qf_getprop_filewinid(win_T *wp, qf_info_T *qi, dict_T *retdict) |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6115 { |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6116 int winid = 0; |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6117 |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6118 if (wp != NULL && IS_LL_WINDOW(wp)) |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6119 { |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6120 win_T *ll_wp = qf_find_win_with_loclist(qi); |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6121 if (ll_wp != NULL) |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6122 winid = ll_wp->w_id; |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6123 } |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6124 |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6125 return dict_add_number(retdict, "filewinid", winid); |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6126 } |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6127 |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6128 /* |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6129 * Return the quickfix list items/entries as 'items' in retdict |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6130 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6131 static int |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6132 qf_getprop_items(qf_info_T *qi, int qf_idx, dict_T *retdict) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6133 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6134 int status = OK; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6135 list_T *l = list_alloc(); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6136 if (l != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6137 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6138 (void)get_errorlist(qi, NULL, qf_idx, l); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6139 dict_add_list(retdict, "items", l); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6140 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6141 else |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6142 status = FAIL; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6143 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6144 return status; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6145 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6146 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6147 /* |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6148 * Return the quickfix list context (if any) as 'context' in retdict. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6149 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6150 static int |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6151 qf_getprop_ctx(qf_list_T *qfl, dict_T *retdict) |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6152 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6153 int status; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6154 dictitem_T *di; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6155 |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6156 if (qfl->qf_ctx != NULL) |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6157 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6158 di = dictitem_alloc((char_u *)"context"); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6159 if (di != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6160 { |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6161 copy_tv(qfl->qf_ctx, &di->di_tv); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6162 status = dict_add(retdict, di); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6163 if (status == FAIL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6164 dictitem_free(di); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6165 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6166 else |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6167 status = FAIL; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6168 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6169 else |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6170 status = dict_add_string(retdict, "context", (char_u *)""); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6171 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6172 return status; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6173 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6174 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6175 /* |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6176 * Return the current quickfix list index as 'idx' in retdict |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6177 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6178 static int |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6179 qf_getprop_idx(qf_info_T *qi, int qf_idx, dict_T *retdict) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6180 { |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6181 int curidx = qi->qf_lists[qf_idx].qf_index; |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
6182 if (qf_list_empty(qi, qf_idx)) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6183 // For empty lists, current index is set to 0 |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6184 curidx = 0; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6185 return dict_add_number(retdict, "idx", curidx); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6186 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6187 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6188 /* |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6189 * Return quickfix/location list details (title) as a |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6190 * dictionary. 'what' contains the details to return. If 'list_idx' is -1, |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6191 * then current list is used. Otherwise the specified list is used. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6192 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6193 int |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6194 qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6195 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6196 qf_info_T *qi = &ql_info; |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6197 qf_list_T *qfl; |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6198 int status = OK; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6199 int qf_idx = INVALID_QFIDX; |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6200 dictitem_T *di; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6201 int flags = QF_GETLIST_NONE; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6202 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6203 if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6204 return qf_get_list_from_lines(what, di, retdict); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6205 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6206 if (wp != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6207 qi = GET_LOC_LIST(wp); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6208 |
14664
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6209 flags = qf_getprop_keys2flags(what, (wp != NULL)); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6210 |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
6211 if (!qf_stack_empty(qi)) |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6212 qf_idx = qf_getprop_qfidx(qi, what); |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6213 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6214 // List is not present or is empty |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
6215 if (qf_stack_empty(qi) || qf_idx == INVALID_QFIDX) |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
6216 return qf_getprop_defaults(qi, flags, wp != NULL, retdict); |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6217 |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6218 qfl = &qi->qf_lists[qf_idx]; |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6219 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6220 if (flags & QF_GETLIST_TITLE) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6221 status = qf_getprop_title(qfl, retdict); |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6222 if ((status == OK) && (flags & QF_GETLIST_NR)) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6223 status = dict_add_number(retdict, "nr", qf_idx + 1); |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6224 if ((status == OK) && (flags & QF_GETLIST_WINID)) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
6225 status = dict_add_number(retdict, "winid", qf_winid(qi)); |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
6226 if ((status == OK) && (flags & QF_GETLIST_ITEMS)) |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6227 status = qf_getprop_items(qi, qf_idx, retdict); |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6228 if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6229 status = qf_getprop_ctx(qfl, retdict); |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6230 if ((status == OK) && (flags & QF_GETLIST_ID)) |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6231 status = dict_add_number(retdict, "id", qfl->qf_id); |
12465
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
6232 if ((status == OK) && (flags & QF_GETLIST_IDX)) |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6233 status = qf_getprop_idx(qi, qf_idx, retdict); |
12465
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
6234 if ((status == OK) && (flags & QF_GETLIST_SIZE)) |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6235 status = dict_add_number(retdict, "size", qfl->qf_count); |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
6236 if ((status == OK) && (flags & QF_GETLIST_TICK)) |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6237 status = dict_add_number(retdict, "changedtick", qfl->qf_changedtick); |
14664
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6238 if ((status == OK) && (wp != NULL) && (flags & QF_GETLIST_FILEWINID)) |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
6239 status = qf_getprop_filewinid(wp, qi, retdict); |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
6240 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6241 return status; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6242 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6243 |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6244 /* |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6245 * Add a new quickfix entry to list at 'qf_idx' in the stack 'qi' from the |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6246 * items in the dict 'd'. If it is a valid error entry, then set 'valid_entry' |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6247 * to TRUE. |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6248 */ |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6249 static int |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6250 qf_add_entry_from_dict( |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6251 qf_info_T *qi, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6252 int qf_idx, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6253 dict_T *d, |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6254 int first_entry, |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6255 int *valid_entry) |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6256 { |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6257 static int did_bufnr_emsg; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6258 char_u *filename, *module, *pattern, *text, *type; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6259 int bufnum, valid, status, col, vcol, nr; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6260 long lnum; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6261 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6262 if (first_entry) |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6263 did_bufnr_emsg = FALSE; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6264 |
15146
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6265 filename = dict_get_string(d, (char_u *)"filename", TRUE); |
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6266 module = dict_get_string(d, (char_u *)"module", TRUE); |
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6267 bufnum = (int)dict_get_number(d, (char_u *)"bufnr"); |
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6268 lnum = (int)dict_get_number(d, (char_u *)"lnum"); |
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6269 col = (int)dict_get_number(d, (char_u *)"col"); |
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6270 vcol = (int)dict_get_number(d, (char_u *)"vcol"); |
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6271 nr = (int)dict_get_number(d, (char_u *)"nr"); |
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6272 type = dict_get_string(d, (char_u *)"type", TRUE); |
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6273 pattern = dict_get_string(d, (char_u *)"pattern", TRUE); |
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6274 text = dict_get_string(d, (char_u *)"text", TRUE); |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6275 if (text == NULL) |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6276 text = vim_strsave((char_u *)""); |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6277 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6278 valid = TRUE; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6279 if ((filename == NULL && bufnum == 0) || (lnum == 0 && pattern == NULL)) |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6280 valid = FALSE; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6281 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6282 // Mark entries with non-existing buffer number as not valid. Give the |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6283 // error message only once. |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6284 if (bufnum != 0 && (buflist_findnr(bufnum) == NULL)) |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6285 { |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6286 if (!did_bufnr_emsg) |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6287 { |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6288 did_bufnr_emsg = TRUE; |
15490
98c35d312987
patch 8.1.0753: printf format not checked for semsg()
Bram Moolenaar <Bram@vim.org>
parents:
15470
diff
changeset
|
6289 semsg(_("E92: Buffer %d not found"), bufnum); |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6290 } |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6291 valid = FALSE; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6292 bufnum = 0; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6293 } |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6294 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6295 // If the 'valid' field is present it overrules the detected value. |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6296 if ((dict_find(d, (char_u *)"valid", -1)) != NULL) |
15146
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6297 valid = (int)dict_get_number(d, (char_u *)"valid"); |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6298 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6299 status = qf_add_entry(qi, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6300 qf_idx, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6301 NULL, // dir |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6302 filename, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6303 module, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6304 bufnum, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6305 text, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6306 lnum, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6307 col, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6308 vcol, // vis_col |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6309 pattern, // search pattern |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6310 nr, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6311 type == NULL ? NUL : *type, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6312 valid); |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6313 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6314 vim_free(filename); |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6315 vim_free(module); |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6316 vim_free(pattern); |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6317 vim_free(text); |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6318 vim_free(type); |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6319 |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6320 if (valid) |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6321 *valid_entry = TRUE; |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6322 |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6323 return status; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6324 } |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6325 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6326 /* |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6327 * Add list of entries to quickfix/location list. Each list entry is |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6328 * a dictionary with item information. |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6329 */ |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6330 static int |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6331 qf_add_entries( |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6332 qf_info_T *qi, |
11449
d2f00eb352b9
patch 8.0.0608: cannot manipulate other than the current quickfix list
Christian Brabandt <cb@256bit.org>
parents:
11447
diff
changeset
|
6333 int qf_idx, |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6334 list_T *list, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6335 char_u *title, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6336 int action) |
230 | 6337 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6338 qf_list_T *qfl = &qi->qf_lists[qf_idx]; |
230 | 6339 listitem_T *li; |
6340 dict_T *d; | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
6341 qfline_T *old_last = NULL; |
230 | 6342 int retval = OK; |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6343 int valid_entry = FALSE; |
644 | 6344 |
11449
d2f00eb352b9
patch 8.0.0608: cannot manipulate other than the current quickfix list
Christian Brabandt <cb@256bit.org>
parents:
11447
diff
changeset
|
6345 if (action == ' ' || qf_idx == qi->qf_listcount) |
d2f00eb352b9
patch 8.0.0608: cannot manipulate other than the current quickfix list
Christian Brabandt <cb@256bit.org>
parents:
11447
diff
changeset
|
6346 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6347 // make place for a new list |
3965 | 6348 qf_new_list(qi, title); |
11449
d2f00eb352b9
patch 8.0.0608: cannot manipulate other than the current quickfix list
Christian Brabandt <cb@256bit.org>
parents:
11447
diff
changeset
|
6349 qf_idx = qi->qf_curlist; |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6350 qfl = &qi->qf_lists[qf_idx]; |
11449
d2f00eb352b9
patch 8.0.0608: cannot manipulate other than the current quickfix list
Christian Brabandt <cb@256bit.org>
parents:
11447
diff
changeset
|
6351 } |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
6352 else if (action == 'a' && !qf_list_empty(qi, qf_idx)) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6353 // Adding to existing list, use last entry. |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6354 old_last = qfl->qf_last; |
277 | 6355 else if (action == 'r') |
6079 | 6356 { |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6357 qf_free_items(qfl); |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6358 qf_store_title(qfl, title); |
6079 | 6359 } |
230 | 6360 |
6361 for (li = list->lv_first; li != NULL; li = li->li_next) | |
6362 { | |
6363 if (li->li_tv.v_type != VAR_DICT) | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6364 continue; // Skip non-dict items |
230 | 6365 |
6366 d = li->li_tv.vval.v_dict; | |
6367 if (d == NULL) | |
6368 continue; | |
6369 | |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6370 retval = qf_add_entry_from_dict(qi, qf_idx, d, li == list->lv_first, |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6371 &valid_entry); |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
6372 if (retval == FAIL) |
230 | 6373 break; |
6374 } | |
6375 | |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6376 // Check if any valid error entries are added to the list. |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6377 if (valid_entry) |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6378 qfl->qf_nonevalid = FALSE; |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6379 else if (qfl->qf_index == 0) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6380 // no valid entry |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6381 qfl->qf_nonevalid = TRUE; |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6382 |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6383 // If not appending to the list, set the current error to the first entry |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6384 if (action != 'a') |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6385 qfl->qf_ptr = qfl->qf_start; |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6386 |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6387 // Update the current error index if not appending to the list or if the |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6388 // list was empty before and it is not empty now. |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6389 if ((action != 'a' || qfl->qf_index == 0) && !qf_list_empty(qi, qf_idx)) |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
6390 qfl->qf_index = 1; |
230 | 6391 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6392 // Don't update the cursor in quickfix window when appending entries |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
6393 qf_update_buffer(qi, old_last); |
230 | 6394 |
6395 return retval; | |
6396 } | |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6397 |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6398 /* |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6399 * Get the quickfix list index from 'nr' or 'id' |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6400 */ |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6401 static int |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6402 qf_setprop_get_qfidx( |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6403 qf_info_T *qi, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6404 dict_T *what, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6405 int action, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6406 int *newlist) |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6407 { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6408 dictitem_T *di; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6409 int qf_idx = qi->qf_curlist; // default is the current list |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6410 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6411 if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6412 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6413 // Use the specified quickfix/location list |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6414 if (di->di_tv.v_type == VAR_NUMBER) |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6415 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6416 // for zero use the current list |
11445
461ac47c3793
patch 8.0.0606: cannot set the context for a specified quickfix list
Christian Brabandt <cb@256bit.org>
parents:
11443
diff
changeset
|
6417 if (di->di_tv.vval.v_number != 0) |
461ac47c3793
patch 8.0.0606: cannot set the context for a specified quickfix list
Christian Brabandt <cb@256bit.org>
parents:
11443
diff
changeset
|
6418 qf_idx = di->di_tv.vval.v_number - 1; |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
6419 |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6420 if ((action == ' ' || action == 'a') && qf_idx == qi->qf_listcount) |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6421 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6422 // When creating a new list, accept qf_idx pointing to the next |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6423 // non-available list and add the new list at the end of the |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6424 // stack. |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6425 *newlist = TRUE; |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
6426 qf_idx = qf_stack_empty(qi) ? 0 : qi->qf_listcount - 1; |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6427 } |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
6428 else if (qf_idx < 0 || qf_idx >= qi->qf_listcount) |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6429 return INVALID_QFIDX; |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6430 else if (action != ' ') |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6431 *newlist = FALSE; // use the specified list |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6432 } |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6433 else if (di->di_tv.v_type == VAR_STRING |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6434 && di->di_tv.vval.v_string != NULL |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6435 && STRCMP(di->di_tv.vval.v_string, "$") == 0) |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
6436 { |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
6437 if (!qf_stack_empty(qi)) |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6438 qf_idx = qi->qf_listcount - 1; |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6439 else if (*newlist) |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6440 qf_idx = 0; |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6441 else |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6442 return INVALID_QFIDX; |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
6443 } |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6444 else |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6445 return INVALID_QFIDX; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6446 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6447 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6448 if (!*newlist && (di = dict_find(what, (char_u *)"id", -1)) != NULL) |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6449 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6450 // Use the quickfix/location list with the specified id |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6451 if (di->di_tv.v_type != VAR_NUMBER) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6452 return INVALID_QFIDX; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6453 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6454 return qf_id2nr(qi, di->di_tv.vval.v_number); |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6455 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6456 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6457 return qf_idx; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6458 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6459 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6460 /* |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6461 * Set the quickfix list title. |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6462 */ |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6463 static int |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6464 qf_setprop_title(qf_info_T *qi, int qf_idx, dict_T *what, dictitem_T *di) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6465 { |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6466 qf_list_T *qfl = &qi->qf_lists[qf_idx]; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6467 |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6468 if (di->di_tv.v_type != VAR_STRING) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6469 return FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6470 |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6471 vim_free(qfl->qf_title); |
15146
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15042
diff
changeset
|
6472 qfl->qf_title = dict_get_string(what, (char_u *)"title", TRUE); |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6473 if (qf_idx == qi->qf_curlist) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6474 qf_update_win_titlevar(qi); |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6475 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6476 return OK; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6477 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6478 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6479 /* |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6480 * Set quickfix list items/entries. |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6481 */ |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6482 static int |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6483 qf_setprop_items(qf_info_T *qi, int qf_idx, dictitem_T *di, int action) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6484 { |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6485 int retval = FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6486 char_u *title_save; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6487 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6488 if (di->di_tv.v_type != VAR_LIST) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6489 return FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6490 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6491 title_save = vim_strsave(qi->qf_lists[qf_idx].qf_title); |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6492 retval = qf_add_entries(qi, qf_idx, di->di_tv.vval.v_list, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6493 title_save, action == ' ' ? 'a' : action); |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6494 vim_free(title_save); |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6495 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6496 return retval; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6497 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6498 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6499 /* |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6500 * Set quickfix list items/entries from a list of lines. |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6501 */ |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6502 static int |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6503 qf_setprop_items_from_lines( |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6504 qf_info_T *qi, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6505 int qf_idx, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6506 dict_T *what, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6507 dictitem_T *di, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6508 int action) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6509 { |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6510 char_u *errorformat = p_efm; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6511 dictitem_T *efm_di; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6512 int retval = FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6513 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6514 // Use the user supplied errorformat settings (if present) |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6515 if ((efm_di = dict_find(what, (char_u *)"efm", -1)) != NULL) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6516 { |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6517 if (efm_di->di_tv.v_type != VAR_STRING || |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6518 efm_di->di_tv.vval.v_string == NULL) |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6519 return FAIL; |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6520 errorformat = efm_di->di_tv.vval.v_string; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6521 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6522 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6523 // Only a List value is supported |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6524 if (di->di_tv.v_type != VAR_LIST || di->di_tv.vval.v_list == NULL) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6525 return FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6526 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6527 if (action == 'r') |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6528 qf_free_items(&qi->qf_lists[qf_idx]); |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6529 if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6530 FALSE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6531 retval = OK; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6532 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6533 return retval; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6534 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6535 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6536 /* |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6537 * Set quickfix list context. |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6538 */ |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6539 static int |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6540 qf_setprop_context(qf_list_T *qfl, dictitem_T *di) |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6541 { |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6542 typval_T *ctx; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6543 |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6544 free_tv(qfl->qf_ctx); |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6545 ctx = alloc_tv(); |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6546 if (ctx != NULL) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6547 copy_tv(&di->di_tv, ctx); |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6548 qfl->qf_ctx = ctx; |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6549 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6550 return OK; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6551 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6552 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6553 /* |
15424
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6554 * Set the current index in the specified quickfix list |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6555 */ |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6556 static int |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6557 qf_setprop_curidx(qf_info_T *qi, qf_list_T *qfl, dictitem_T *di) |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6558 { |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6559 int denote = FALSE; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6560 int newidx; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6561 int old_qfidx; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6562 qfline_T *qf_ptr; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6563 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6564 // If the specified index is '$', then use the last entry |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6565 if (di->di_tv.v_type == VAR_STRING |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6566 && di->di_tv.vval.v_string != NULL |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6567 && STRCMP(di->di_tv.vval.v_string, "$") == 0) |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6568 newidx = qfl->qf_count; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6569 else |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6570 { |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6571 // Otherwise use the specified index |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6572 newidx = tv_get_number_chk(&di->di_tv, &denote); |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6573 if (denote) |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6574 return FAIL; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6575 } |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6576 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6577 if (newidx < 1) // sanity check |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6578 return FAIL; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6579 if (newidx > qfl->qf_count) |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6580 newidx = qfl->qf_count; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6581 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6582 old_qfidx = qfl->qf_index; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6583 qf_ptr = get_nth_entry(qfl, newidx, &newidx); |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6584 if (qf_ptr == NULL) |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6585 return FAIL; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6586 qfl->qf_ptr = qf_ptr; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6587 qfl->qf_index = newidx; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6588 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6589 // If the current list is modified and it is displayed in the quickfix |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6590 // window, then Update it. |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6591 if (qi->qf_lists[qi->qf_curlist].qf_id == qfl->qf_id) |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6592 qf_win_pos_update(qi, old_qfidx); |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6593 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6594 return OK; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6595 } |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6596 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6597 /* |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6598 * Set quickfix/location list properties (title, items, context). |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6599 * Also used to add items from parsing a list of lines. |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
6600 * Used by the setqflist() and setloclist() Vim script functions. |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6601 */ |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6602 static int |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6603 qf_set_properties(qf_info_T *qi, dict_T *what, int action, char_u *title) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6604 { |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6605 dictitem_T *di; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6606 int retval = FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6607 int qf_idx; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6608 int newlist = FALSE; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6609 qf_list_T *qfl; |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6610 |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
6611 if (action == ' ' || qf_stack_empty(qi)) |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6612 newlist = TRUE; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6613 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6614 qf_idx = qf_setprop_get_qfidx(qi, what, action, &newlist); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6615 if (qf_idx == INVALID_QFIDX) // List not found |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6616 return FAIL; |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6617 |
9982
e24aa20d815c
commit https://github.com/vim/vim/commit/2b529bb6260b52246e92429375d995b9b5ce76b6
Christian Brabandt <cb@256bit.org>
parents:
9931
diff
changeset
|
6618 if (newlist) |
e24aa20d815c
commit https://github.com/vim/vim/commit/2b529bb6260b52246e92429375d995b9b5ce76b6
Christian Brabandt <cb@256bit.org>
parents:
9931
diff
changeset
|
6619 { |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6620 qi->qf_curlist = qf_idx; |
12048
ebd313aa5a6c
patch 8.0.0904: cannot set a location list from text
Christian Brabandt <cb@256bit.org>
parents:
11800
diff
changeset
|
6621 qf_new_list(qi, title); |
9982
e24aa20d815c
commit https://github.com/vim/vim/commit/2b529bb6260b52246e92429375d995b9b5ce76b6
Christian Brabandt <cb@256bit.org>
parents:
9931
diff
changeset
|
6622 qf_idx = qi->qf_curlist; |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6623 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6624 |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6625 qfl = &qi->qf_lists[qf_idx]; |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6626 if ((di = dict_find(what, (char_u *)"title", -1)) != NULL) |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6627 retval = qf_setprop_title(qi, qf_idx, what, di); |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
6628 if ((di = dict_find(what, (char_u *)"items", -1)) != NULL) |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6629 retval = qf_setprop_items(qi, qf_idx, di, action); |
12303
ec7a4fd21dd5
patch 8.0.1031: "text" argument for getqflist() is confusing
Christian Brabandt <cb@256bit.org>
parents:
12299
diff
changeset
|
6630 if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL) |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6631 retval = qf_setprop_items_from_lines(qi, qf_idx, what, di, action); |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6632 if ((di = dict_find(what, (char_u *)"context", -1)) != NULL) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6633 retval = qf_setprop_context(qfl, di); |
15424
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6634 if ((di = dict_find(what, (char_u *)"idx", -1)) != NULL) |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
6635 retval = qf_setprop_curidx(qi, qfl, di); |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6636 |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
6637 if (retval == OK) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6638 qf_list_changed(qfl); |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
6639 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6640 return retval; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6641 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6642 |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6643 /* |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6644 * Free the entire quickfix/location list stack. |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6645 * If the quickfix/location list window is open, then clear it. |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6646 */ |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6647 static void |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6648 qf_free_stack(win_T *wp, qf_info_T *qi) |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6649 { |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6650 win_T *qfwin = qf_find_win(qi); |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6651 win_T *llwin = NULL; |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6652 |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6653 if (qfwin != NULL) |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6654 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6655 // If the quickfix/location list window is open, then clear it |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6656 if (qi->qf_curlist < qi->qf_listcount) |
14790
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
6657 qf_free(&qi->qf_lists[qi->qf_curlist]); |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6658 qf_update_buffer(qi, NULL); |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6659 } |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6660 |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6661 if (wp != NULL && IS_LL_WINDOW(wp)) |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6662 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6663 // If in the location list window, then use the non-location list |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6664 // window with this location list (if present) |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
6665 llwin = qf_find_win_with_loclist(qi); |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6666 if (llwin != NULL) |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6667 wp = llwin; |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6668 } |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6669 |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6670 qf_free_all(wp); |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6671 if (wp == NULL) |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6672 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6673 // quickfix list |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6674 qi->qf_curlist = 0; |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6675 qi->qf_listcount = 0; |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6676 } |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
6677 else if (qfwin != NULL) |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6678 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6679 // If the location list window is open, then create a new empty |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6680 // location list |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
6681 qf_info_T *new_ll = qf_alloc_stack(QFLT_LOCATION); |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
6682 new_ll->qf_bufnr = qfwin->w_buffer->b_fnum; |
11378
2ed7a34ecc54
patch 8.0.0574: get only one quickfix list after :caddbuf
Christian Brabandt <cb@256bit.org>
parents:
11360
diff
changeset
|
6683 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6684 // first free the list reference in the location list window |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
6685 ll_free_all(&qfwin->w_llist_ref); |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
6686 |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
6687 qfwin->w_llist_ref = new_ll; |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
6688 if (wp != qfwin) |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6689 { |
15740
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
6690 wp->w_llist = new_ll; |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6691 new_ll->qf_refcount++; |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6692 } |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
6693 } |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6694 } |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6695 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6696 /* |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6697 * Populate the quickfix list with the items supplied in the list |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6698 * of dictionaries. "title" will be copied to w:quickfix_title. |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6699 * "action" is 'a' for add, 'r' for replace. Otherwise create a new list. |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6700 */ |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6701 int |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6702 set_errorlist( |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6703 win_T *wp, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6704 list_T *list, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6705 int action, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6706 char_u *title, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6707 dict_T *what) |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6708 { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6709 qf_info_T *qi = &ql_info; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6710 int retval = OK; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6711 |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6712 if (wp != NULL) |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6713 { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6714 qi = ll_get_or_alloc_list(wp); |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6715 if (qi == NULL) |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6716 return FAIL; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6717 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6718 |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6719 if (action == 'f') |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6720 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6721 // Free the entire quickfix or location list stack |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
6722 qf_free_stack(wp, qi); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6723 return OK; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6724 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6725 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6726 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6727 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6728 if (what != NULL) |
12048
ebd313aa5a6c
patch 8.0.0904: cannot set a location list from text
Christian Brabandt <cb@256bit.org>
parents:
11800
diff
changeset
|
6729 retval = qf_set_properties(qi, what, action, title); |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6730 else |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
6731 { |
11449
d2f00eb352b9
patch 8.0.0608: cannot manipulate other than the current quickfix list
Christian Brabandt <cb@256bit.org>
parents:
11447
diff
changeset
|
6732 retval = qf_add_entries(qi, qi->qf_curlist, list, title, action); |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
6733 if (retval == OK) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6734 qf_list_changed(&qi->qf_lists[qi->qf_curlist]); |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
6735 } |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6736 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6737 decr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6738 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6739 return retval; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6740 } |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6741 |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
6742 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
6743 * Mark the context as in use for all the lists in a quickfix stack. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
6744 */ |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6745 static int |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6746 mark_quickfix_ctx(qf_info_T *qi, int copyID) |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6747 { |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6748 int i; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6749 int abort = FALSE; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6750 typval_T *ctx; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6751 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6752 for (i = 0; i < LISTCOUNT && !abort; ++i) |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6753 { |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6754 ctx = qi->qf_lists[i].qf_ctx; |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6755 if (ctx != NULL && ctx->v_type != VAR_NUMBER |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
6756 && ctx->v_type != VAR_STRING && ctx->v_type != VAR_FLOAT) |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6757 abort = set_ref_in_item(ctx, copyID, NULL, NULL); |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6758 } |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6759 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6760 return abort; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6761 } |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6762 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6763 /* |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6764 * Mark the context of the quickfix list and the location lists (if present) as |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6765 * "in use". So that garbage collection doesn't free the context. |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6766 */ |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6767 int |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6768 set_ref_in_quickfix(int copyID) |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6769 { |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6770 int abort = FALSE; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6771 tabpage_T *tp; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6772 win_T *win; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6773 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6774 abort = mark_quickfix_ctx(&ql_info, copyID); |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6775 if (abort) |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6776 return abort; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6777 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6778 FOR_ALL_TAB_WINDOWS(tp, win) |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6779 { |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6780 if (win->w_llist != NULL) |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6781 { |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6782 abort = mark_quickfix_ctx(win->w_llist, copyID); |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6783 if (abort) |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6784 return abort; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6785 } |
13074
66c014c71dad
patch 8.0.1412: using free memory using setloclist()
Christian Brabandt <cb@256bit.org>
parents:
13066
diff
changeset
|
6786 if (IS_LL_WINDOW(win) && (win->w_llist_ref->qf_refcount == 1)) |
66c014c71dad
patch 8.0.1412: using free memory using setloclist()
Christian Brabandt <cb@256bit.org>
parents:
13066
diff
changeset
|
6787 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6788 // In a location list window and none of the other windows is |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6789 // referring to this location list. Mark the location list |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6790 // context as still in use. |
13074
66c014c71dad
patch 8.0.1412: using free memory using setloclist()
Christian Brabandt <cb@256bit.org>
parents:
13066
diff
changeset
|
6791 abort = mark_quickfix_ctx(win->w_llist_ref, copyID); |
66c014c71dad
patch 8.0.1412: using free memory using setloclist()
Christian Brabandt <cb@256bit.org>
parents:
13066
diff
changeset
|
6792 if (abort) |
66c014c71dad
patch 8.0.1412: using free memory using setloclist()
Christian Brabandt <cb@256bit.org>
parents:
13066
diff
changeset
|
6793 return abort; |
66c014c71dad
patch 8.0.1412: using free memory using setloclist()
Christian Brabandt <cb@256bit.org>
parents:
13066
diff
changeset
|
6794 } |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6795 } |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6796 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6797 return abort; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
6798 } |
170 | 6799 #endif |
6800 | |
42 | 6801 /* |
41 | 6802 * ":[range]cbuffer [bufnr]" command. |
657 | 6803 * ":[range]caddbuffer [bufnr]" command. |
798 | 6804 * ":[range]cgetbuffer [bufnr]" command. |
644 | 6805 * ":[range]lbuffer [bufnr]" command. |
657 | 6806 * ":[range]laddbuffer [bufnr]" command. |
798 | 6807 * ":[range]lgetbuffer [bufnr]" command. |
41 | 6808 */ |
6809 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
6810 ex_cbuffer(exarg_T *eap) |
41 | 6811 { |
6812 buf_T *buf = NULL; | |
644 | 6813 qf_info_T *qi = &ql_info; |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6814 char_u *au_name = NULL; |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6815 int res; |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6816 int_u save_qfid; |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6817 win_T *wp = NULL; |
644 | 6818 |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6819 switch (eap->cmdidx) |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6820 { |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6821 case CMD_cbuffer: au_name = (char_u *)"cbuffer"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6822 case CMD_cgetbuffer: au_name = (char_u *)"cgetbuffer"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6823 case CMD_caddbuffer: au_name = (char_u *)"caddbuffer"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6824 case CMD_lbuffer: au_name = (char_u *)"lbuffer"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6825 case CMD_lgetbuffer: au_name = (char_u *)"lgetbuffer"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6826 case CMD_laddbuffer: au_name = (char_u *)"laddbuffer"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6827 default: break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6828 } |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
6829 if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, |
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
6830 curbuf->b_fname, TRUE, curbuf)) |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6831 { |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
6832 #ifdef FEAT_EVAL |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
6833 if (aborting()) |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6834 return; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6835 #endif |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
6836 } |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6837 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6838 // Must come after autocommands. |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
6839 if (is_loclist_cmd(eap->cmdidx)) |
13076
7c071a3f7f8e
patch 8.0.1413: accessing freed memory in :cbuffer
Christian Brabandt <cb@256bit.org>
parents:
13074
diff
changeset
|
6840 { |
7c071a3f7f8e
patch 8.0.1413: accessing freed memory in :cbuffer
Christian Brabandt <cb@256bit.org>
parents:
13074
diff
changeset
|
6841 qi = ll_get_or_alloc_list(curwin); |
7c071a3f7f8e
patch 8.0.1413: accessing freed memory in :cbuffer
Christian Brabandt <cb@256bit.org>
parents:
13074
diff
changeset
|
6842 if (qi == NULL) |
7c071a3f7f8e
patch 8.0.1413: accessing freed memory in :cbuffer
Christian Brabandt <cb@256bit.org>
parents:
13074
diff
changeset
|
6843 return; |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6844 wp = curwin; |
13076
7c071a3f7f8e
patch 8.0.1413: accessing freed memory in :cbuffer
Christian Brabandt <cb@256bit.org>
parents:
13074
diff
changeset
|
6845 } |
7c071a3f7f8e
patch 8.0.1413: accessing freed memory in :cbuffer
Christian Brabandt <cb@256bit.org>
parents:
13074
diff
changeset
|
6846 |
41 | 6847 if (*eap->arg == NUL) |
6848 buf = curbuf; | |
6849 else if (*skipwhite(skipdigits(eap->arg)) == NUL) | |
6850 buf = buflist_findnr(atoi((char *)eap->arg)); | |
6851 if (buf == NULL) | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
6852 emsg(_(e_invarg)); |
41 | 6853 else if (buf->b_ml.ml_mfp == NULL) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
6854 emsg(_("E681: Buffer is not loaded")); |
41 | 6855 else |
6856 { | |
6857 if (eap->addr_count == 0) | |
6858 { | |
6859 eap->line1 = 1; | |
6860 eap->line2 = buf->b_ml.ml_line_count; | |
6861 } | |
6862 if (eap->line1 < 1 || eap->line1 > buf->b_ml.ml_line_count | |
6863 || eap->line2 < 1 || eap->line2 > buf->b_ml.ml_line_count) | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
6864 emsg(_(e_invrange)); |
41 | 6865 else |
661 | 6866 { |
13921
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
6867 char_u *qf_title = qf_cmdtitle(*eap->cmdlinep); |
2411
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
6868 |
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
6869 if (buf->b_sfname) |
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
6870 { |
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
6871 vim_snprintf((char *)IObuff, IOSIZE, "%s (%s)", |
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
6872 (char *)qf_title, (char *)buf->b_sfname); |
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
6873 qf_title = IObuff; |
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
6874 } |
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
6875 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6876 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6877 |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6878 res = qf_init_ext(qi, qi->qf_curlist, NULL, buf, NULL, p_efm, |
798 | 6879 (eap->cmdidx != CMD_caddbuffer |
6880 && eap->cmdidx != CMD_laddbuffer), | |
2411
68e394361ca3
Add "q" item for 'statusline'. Add w:quickfix_title. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2296
diff
changeset
|
6881 eap->line1, eap->line2, |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6882 qf_title, NULL); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6883 if (qf_stack_empty(qi)) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6884 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6885 decr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6886 return; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6887 } |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
6888 if (res >= 0) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6889 qf_list_changed(&qi->qf_lists[qi->qf_curlist]); |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6890 |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6891 // Remember the current quickfix list identifier, so that we can |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6892 // check for autocommands changing the current quickfix list. |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6893 save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6894 if (au_name != NULL) |
14085
59e76d550c10
patch 8.1.0060: crash when autocommands delete the current buffer
Christian Brabandt <cb@256bit.org>
parents:
13992
diff
changeset
|
6895 { |
59e76d550c10
patch 8.1.0060: crash when autocommands delete the current buffer
Christian Brabandt <cb@256bit.org>
parents:
13992
diff
changeset
|
6896 buf_T *curbuf_old = curbuf; |
59e76d550c10
patch 8.1.0060: crash when autocommands delete the current buffer
Christian Brabandt <cb@256bit.org>
parents:
13992
diff
changeset
|
6897 |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6898 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, |
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6899 curbuf->b_fname, TRUE, curbuf); |
14085
59e76d550c10
patch 8.1.0060: crash when autocommands delete the current buffer
Christian Brabandt <cb@256bit.org>
parents:
13992
diff
changeset
|
6900 if (curbuf != curbuf_old) |
59e76d550c10
patch 8.1.0060: crash when autocommands delete the current buffer
Christian Brabandt <cb@256bit.org>
parents:
13992
diff
changeset
|
6901 // Autocommands changed buffer, don't jump now, "qi" may |
59e76d550c10
patch 8.1.0060: crash when autocommands delete the current buffer
Christian Brabandt <cb@256bit.org>
parents:
13992
diff
changeset
|
6902 // be invalid. |
59e76d550c10
patch 8.1.0060: crash when autocommands delete the current buffer
Christian Brabandt <cb@256bit.org>
parents:
13992
diff
changeset
|
6903 res = 0; |
59e76d550c10
patch 8.1.0060: crash when autocommands delete the current buffer
Christian Brabandt <cb@256bit.org>
parents:
13992
diff
changeset
|
6904 } |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6905 // Jump to the first error for a new list and if autocmds didn't |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6906 // free the list. |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6907 if (res > 0 && (eap->cmdidx == CMD_cbuffer || |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6908 eap->cmdidx == CMD_lbuffer) |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6909 && qflist_valid(wp, save_qfid)) |
14469
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
6910 // display the first error |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
6911 qf_jump_first(qi, save_qfid, eap->forceit); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6912 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6913 decr_quickfix_busy(); |
661 | 6914 } |
41 | 6915 } |
6916 } | |
6917 | |
532 | 6918 #if defined(FEAT_EVAL) || defined(PROTO) |
41 | 6919 /* |
798 | 6920 * ":cexpr {expr}", ":cgetexpr {expr}", ":caddexpr {expr}" command. |
6921 * ":lexpr {expr}", ":lgetexpr {expr}", ":laddexpr {expr}" command. | |
446 | 6922 */ |
6923 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
6924 ex_cexpr(exarg_T *eap) |
446 | 6925 { |
6926 typval_T *tv; | |
644 | 6927 qf_info_T *qi = &ql_info; |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6928 char_u *au_name = NULL; |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6929 int res; |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6930 int_u save_qfid; |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6931 win_T *wp = NULL; |
644 | 6932 |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6933 switch (eap->cmdidx) |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6934 { |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6935 case CMD_cexpr: au_name = (char_u *)"cexpr"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6936 case CMD_cgetexpr: au_name = (char_u *)"cgetexpr"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6937 case CMD_caddexpr: au_name = (char_u *)"caddexpr"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6938 case CMD_lexpr: au_name = (char_u *)"lexpr"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6939 case CMD_lgetexpr: au_name = (char_u *)"lgetexpr"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6940 case CMD_laddexpr: au_name = (char_u *)"laddexpr"; break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6941 default: break; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6942 } |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
6943 if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, |
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
6944 curbuf->b_fname, TRUE, curbuf)) |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6945 { |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
6946 #ifdef FEAT_EVAL |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
6947 if (aborting()) |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6948 return; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6949 #endif |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
6950 } |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6951 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
6952 if (is_loclist_cmd(eap->cmdidx)) |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
6953 { |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
6954 qi = ll_get_or_alloc_list(curwin); |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
6955 if (qi == NULL) |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
6956 return; |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6957 wp = curwin; |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
6958 } |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
6959 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6960 // Evaluate the expression. When the result is a string or a list we can |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6961 // use it to fill the errorlist. |
446 | 6962 tv = eval_expr(eap->arg, NULL); |
625 | 6963 if (tv != NULL) |
6964 { | |
6965 if ((tv->v_type == VAR_STRING && tv->vval.v_string != NULL) | |
6966 || (tv->v_type == VAR_LIST && tv->vval.v_list != NULL)) | |
6967 { | |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6968 incr_quickfix_busy(); |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6969 res = qf_init_ext(qi, qi->qf_curlist, NULL, NULL, tv, p_efm, |
798 | 6970 (eap->cmdidx != CMD_caddexpr |
6971 && eap->cmdidx != CMD_laddexpr), | |
13921
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
6972 (linenr_T)0, (linenr_T)0, |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
6973 qf_cmdtitle(*eap->cmdlinep), NULL); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6974 if (qf_stack_empty(qi)) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6975 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6976 decr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6977 goto cleanup; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6978 } |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
6979 if (res >= 0) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6980 qf_list_changed(&qi->qf_lists[qi->qf_curlist]); |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6981 |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6982 // Remember the current quickfix list identifier, so that we can |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6983 // check for autocommands changing the current quickfix list. |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6984 save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6985 if (au_name != NULL) |
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6986 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, |
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
6987 curbuf->b_fname, TRUE, curbuf); |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6988 |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6989 // Jump to the first error for a new list and if autocmds didn't |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6990 // free the list. |
14111
678e326bf7eb
patch 8.1.0073: crash when autocommands call setloclist()
Christian Brabandt <cb@256bit.org>
parents:
14085
diff
changeset
|
6991 if (res > 0 && (eap->cmdidx == CMD_cexpr |
678e326bf7eb
patch 8.1.0073: crash when autocommands call setloclist()
Christian Brabandt <cb@256bit.org>
parents:
14085
diff
changeset
|
6992 || eap->cmdidx == CMD_lexpr) |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6993 && qflist_valid(wp, save_qfid)) |
14469
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
6994 // display the first error |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
6995 qf_jump_first(qi, save_qfid, eap->forceit); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6996 decr_quickfix_busy(); |
625 | 6997 } |
6998 else | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
6999 emsg(_("E777: String or List expected")); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7000 cleanup: |
625 | 7001 free_tv(tv); |
7002 } | |
446 | 7003 } |
532 | 7004 #endif |
446 | 7005 |
7006 /* | |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7007 * Get the location list for ":lhelpgrep" |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7008 */ |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7009 static qf_info_T * |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7010 hgr_get_ll(int *new_ll) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7011 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7012 win_T *wp; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7013 qf_info_T *qi; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7014 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7015 // If the current window is a help window, then use it |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7016 if (bt_help(curwin->w_buffer)) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7017 wp = curwin; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7018 else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7019 // Find an existing help window |
13882
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
7020 wp = qf_find_help_win(); |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7021 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7022 if (wp == NULL) // Help window not found |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7023 qi = NULL; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7024 else |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7025 qi = wp->w_llist; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7026 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7027 if (qi == NULL) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7028 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7029 // Allocate a new location list for help text matches |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
7030 if ((qi = qf_alloc_stack(QFLT_LOCATION)) == NULL) |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7031 return NULL; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7032 *new_ll = TRUE; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7033 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7034 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7035 return qi; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7036 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7037 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7038 /* |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7039 * Search for a pattern in a help file. |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7040 */ |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7041 static void |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7042 hgr_search_file( |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7043 qf_info_T *qi, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7044 char_u *fname, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7045 vimconv_T *p_vc, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7046 regmatch_T *p_regmatch) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7047 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7048 FILE *fd; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7049 long lnum; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7050 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7051 fd = mch_fopen((char *)fname, "r"); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7052 if (fd == NULL) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7053 return; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7054 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7055 lnum = 1; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7056 while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7057 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7058 char_u *line = IObuff; |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
7059 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7060 // Convert a line if 'encoding' is not utf-8 and |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7061 // the line contains a non-ASCII character. |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7062 if (p_vc->vc_type != CONV_NONE |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7063 && has_non_ascii(IObuff)) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7064 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7065 line = string_convert(p_vc, IObuff, NULL); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7066 if (line == NULL) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7067 line = IObuff; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7068 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7069 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7070 if (vim_regexec(p_regmatch, line, (colnr_T)0)) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7071 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7072 int l = (int)STRLEN(line); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7073 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7074 // remove trailing CR, LF, spaces, etc. |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7075 while (l > 0 && line[l - 1] <= ' ') |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7076 line[--l] = NUL; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7077 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7078 if (qf_add_entry(qi, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7079 qi->qf_curlist, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7080 NULL, // dir |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7081 fname, |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
7082 NULL, |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7083 0, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7084 line, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7085 lnum, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7086 (int)(p_regmatch->startp[0] - line) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7087 + 1, // col |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7088 FALSE, // vis_col |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7089 NULL, // search pattern |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7090 0, // nr |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7091 1, // type |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7092 TRUE // valid |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7093 ) == FAIL) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7094 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7095 got_int = TRUE; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7096 if (line != IObuff) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7097 vim_free(line); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7098 break; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7099 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7100 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7101 if (line != IObuff) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7102 vim_free(line); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7103 ++lnum; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7104 line_breakcheck(); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7105 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7106 fclose(fd); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7107 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7108 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7109 /* |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7110 * Search for a pattern in all the help files in the doc directory under |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7111 * the given directory. |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7112 */ |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7113 static void |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7114 hgr_search_files_in_dir( |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7115 qf_info_T *qi, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7116 char_u *dirname, |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
7117 regmatch_T *p_regmatch, |
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
7118 vimconv_T *p_vc |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7119 #ifdef FEAT_MULTI_LANG |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7120 , char_u *lang |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7121 #endif |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7122 ) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7123 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7124 int fcount; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7125 char_u **fnames; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7126 int fi; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7127 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7128 // Find all "*.txt" and "*.??x" files in the "doc" directory. |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7129 add_pathsep(dirname); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7130 STRCAT(dirname, "doc/*.\\(txt\\|??x\\)"); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7131 if (gen_expand_wildcards(1, &dirname, &fcount, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7132 &fnames, EW_FILE|EW_SILENT) == OK |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7133 && fcount > 0) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7134 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7135 for (fi = 0; fi < fcount && !got_int; ++fi) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7136 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7137 #ifdef FEAT_MULTI_LANG |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7138 // Skip files for a different language. |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7139 if (lang != NULL |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7140 && STRNICMP(lang, fnames[fi] |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
7141 + STRLEN(fnames[fi]) - 3, 2) != 0 |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7142 && !(STRNICMP(lang, "en", 2) == 0 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7143 && STRNICMP("txt", fnames[fi] |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7144 + STRLEN(fnames[fi]) - 3, 3) == 0)) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7145 continue; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7146 #endif |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7147 |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
7148 hgr_search_file(qi, fnames[fi], p_vc, p_regmatch); |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7149 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7150 FreeWild(fcount, fnames); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7151 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7152 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7153 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7154 /* |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
7155 * Search for a pattern in all the help files in the 'runtimepath' |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
7156 * and add the matches to a quickfix list. |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7157 * 'lang' is the language specifier. If supplied, then only matches in the |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
7158 * specified language are found. |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7159 */ |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7160 static void |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7161 hgr_search_in_rtp(qf_info_T *qi, regmatch_T *p_regmatch, char_u *lang) |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7162 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7163 char_u *p; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7164 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7165 vimconv_T vc; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7166 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7167 // Help files are in utf-8 or latin1, convert lines when 'encoding' |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7168 // differs. |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7169 vc.vc_type = CONV_NONE; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7170 if (!enc_utf8) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7171 convert_setup(&vc, (char_u *)"utf-8", p_enc); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7172 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7173 // Go through all the directories in 'runtimepath' |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7174 p = p_rtp; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7175 while (*p != NUL && !got_int) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7176 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7177 copy_option_part(&p, NameBuff, MAXPATHL, ","); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7178 |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
7179 hgr_search_files_in_dir(qi, NameBuff, p_regmatch, &vc |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7180 #ifdef FEAT_MULTI_LANG |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7181 , lang |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7182 #endif |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7183 ); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7184 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7185 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7186 if (vc.vc_type != CONV_NONE) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7187 convert_setup(&vc, NULL, NULL); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7188 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7189 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7190 /* |
7 | 7191 * ":helpgrep {pattern}" |
7192 */ | |
7193 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
7194 ex_helpgrep(exarg_T *eap) |
7 | 7195 { |
7196 regmatch_T regmatch; | |
7197 char_u *save_cpo; | |
644 | 7198 qf_info_T *qi = &ql_info; |
659 | 7199 int new_qi = FALSE; |
3269 | 7200 char_u *au_name = NULL; |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7201 char_u *lang = NULL; |
7 | 7202 |
3269 | 7203 switch (eap->cmdidx) |
7204 { | |
7205 case CMD_helpgrep: au_name = (char_u *)"helpgrep"; break; | |
7206 case CMD_lhelpgrep: au_name = (char_u *)"lhelpgrep"; break; | |
7207 default: break; | |
7208 } | |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
7209 if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, |
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
7210 curbuf->b_fname, TRUE, curbuf)) |
3269 | 7211 { |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
7212 #ifdef FEAT_EVAL |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
7213 if (aborting()) |
3269 | 7214 return; |
7215 #endif | |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
7216 } |
3269 | 7217 |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7218 // Make 'cpoptions' empty, the 'l' flag should not be used here. |
3269 | 7219 save_cpo = p_cpo; |
7220 p_cpo = empty_option; | |
7221 | |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
7222 if (is_loclist_cmd(eap->cmdidx)) |
659 | 7223 { |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7224 qi = hgr_get_ll(&new_qi); |
659 | 7225 if (qi == NULL) |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
7226 return; |
659 | 7227 } |
7228 | |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7229 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7230 |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7231 #ifdef FEAT_MULTI_LANG |
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7232 // Check for a specified language |
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7233 lang = check_help_lang(eap->arg); |
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7234 #endif |
7 | 7235 regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING); |
7236 regmatch.rm_ic = FALSE; | |
7237 if (regmatch.regprog != NULL) | |
7238 { | |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7239 qf_list_T *qfl; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7240 |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7241 // create a new quickfix list |
13921
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
7242 qf_new_list(qi, qf_cmdtitle(*eap->cmdlinep)); |
7 | 7243 |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7244 hgr_search_in_rtp(qi, ®match, lang); |
3257 | 7245 |
4805
66803af09906
updated for version 7.3.1149
Bram Moolenaar <bram@vim.org>
parents:
4371
diff
changeset
|
7246 vim_regfree(regmatch.regprog); |
7 | 7247 |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7248 qfl = &qi->qf_lists[qi->qf_curlist]; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7249 qfl->qf_nonevalid = FALSE; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7250 qfl->qf_ptr = qfl->qf_start; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7251 qfl->qf_index = 1; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7252 qf_list_changed(qfl); |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7253 qf_update_buffer(qi, NULL); |
7 | 7254 } |
7255 | |
1672 | 7256 if (p_cpo == empty_option) |
7257 p_cpo = save_cpo; | |
7258 else | |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7259 // Darn, some plugin changed the value. |
1672 | 7260 free_string_option(save_cpo); |
7 | 7261 |
3269 | 7262 if (au_name != NULL) |
7263 { | |
7264 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, | |
7265 curbuf->b_fname, TRUE, curbuf); | |
14560
8413e66d00a1
patch 8.1.0293: checks for type of stack is cryptic
Christian Brabandt <cb@256bit.org>
parents:
14552
diff
changeset
|
7266 if (!new_qi && IS_LL_STACK(qi) && qf_find_buf(qi) == NULL) |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7267 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7268 // autocommands made "qi" invalid |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7269 decr_quickfix_busy(); |
3269 | 7270 return; |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7271 } |
3269 | 7272 } |
7273 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7274 // Jump to first match. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
7275 if (!qf_list_empty(qi, qi->qf_curlist)) |
659 | 7276 qf_jump(qi, 0, 0, FALSE); |
9 | 7277 else |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
7278 semsg(_(e_nomatch2), eap->arg); |
659 | 7279 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7280 decr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7281 |
659 | 7282 if (eap->cmdidx == CMD_lhelpgrep) |
7283 { | |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7284 // If the help window is not opened or if it already points to the |
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
7285 // correct location list, then free the new location list. |
11800
5ceaecedbad2
patch 8.0.0782: using freed memory in quickfix code
Christian Brabandt <cb@256bit.org>
parents:
11788
diff
changeset
|
7286 if (!bt_help(curwin->w_buffer) || curwin->w_llist == qi) |
659 | 7287 { |
7288 if (new_qi) | |
7289 ll_free_all(&qi); | |
7290 } | |
7291 else if (curwin->w_llist == NULL) | |
7292 curwin->w_llist = qi; | |
7293 } | |
7 | 7294 } |
7295 | |
7296 #endif /* FEAT_QUICKFIX */ |