Mercurial > vim
annotate src/quickfix.c @ 25403:9203b28ab453 v8.2.3238
patch 8.2.3238: Vim9: error message does not indicate the location
Commit: https://github.com/vim/vim/commit/d47c39775b8d381005751b7b20da56412dafb5e4
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 28 20:52:13 2021 +0200
patch 8.2.3238: Vim9: error message does not indicate the location
Problem: Vim9: error message does not indicate the location.
Solution: Add the relevant text. (issue https://github.com/vim/vim/issues/8634)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 28 Jul 2021 21:00:04 +0200 |
parents | e8e2c4d33b9b |
children | db9fdfb86679 |
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 |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
33 linenr_T qf_end_lnum; // line number when the error has range or zero |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
34 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
|
35 int qf_col; // column where the error occurred |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
36 int qf_end_col; // column when the error has range or zero |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
37 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
|
38 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
|
39 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
|
40 char_u *qf_text; // description of the error |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
41 char_u qf_viscol; // set to TRUE if qf_col and qf_end_col is |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
42 // screen column |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
43 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
|
44 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
|
45 // :helpgrep |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
46 char_u qf_valid; // valid error message detected |
7 | 47 }; |
48 | |
49 /* | |
50 * There is a stack of error lists. | |
51 */ | |
52 #define LISTCOUNT 10 | |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
53 #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
|
54 #define INVALID_QFBUFNR (0) |
7 | 55 |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
56 /* |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
57 * Quickfix list type. |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
58 */ |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
59 typedef enum |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
60 { |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
61 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
|
62 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
|
63 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
|
64 } qfltype_T; |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
65 |
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
66 /* |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
67 * 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
|
68 * 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
|
69 * 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
|
70 * |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
71 * 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
|
72 * 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
|
73 * 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
|
74 */ |
644 | 75 typedef struct qf_list_S |
7 | 76 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 // 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
|
87 typval_T *qf_ctx; // context set by setqflist/setloclist |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
88 callback_T qftf_cb; // 'quickfixtextfunc' callback function |
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
|
89 |
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 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 long qf_changedtick; |
644 | 98 } qf_list_T; |
99 | |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
100 /* |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
101 * 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
|
102 * 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
|
103 */ |
644 | 104 struct qf_info_S |
105 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
106 // 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
|
107 // 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
|
108 // 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
|
109 // reaches 0, the list is freed. |
644 | 110 int qf_refcount; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
111 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
|
112 int qf_curlist; // current error list |
644 | 113 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
|
114 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
|
115 int qf_bufnr; // quickfix window buffer number |
644 | 116 }; |
117 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
118 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
|
119 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
|
120 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
121 #define FMT_PATTERNS 11 // maximum number of % recognized |
7 | 122 |
123 /* | |
124 * Structure used to hold the info of one part of 'errorformat' | |
125 */ | |
789 | 126 typedef struct efm_S efm_T; |
127 struct efm_S | |
7 | 128 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
129 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
|
130 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
|
131 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
|
132 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
|
133 // 'D' enter directory |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
134 // 'X' leave directory |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
135 // '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
|
136 // 'E' error message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
137 // 'W' warning message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
138 // 'I' informational message |
20729
ada6f26e6eb1
patch 8.2.0917: quickfix entries do not suport a "note" type
Bram Moolenaar <Bram@vim.org>
parents:
20631
diff
changeset
|
139 // 'N' note message |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
140 // 'C' continuation line |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
141 // '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
|
142 // 'G' general, unspecific message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
143 // '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
|
144 // '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
|
145 // 'O' overread (partial) message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
146 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
|
147 // '-' 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
|
148 // '+' 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
|
149 int conthere; // %> used |
7 | 150 }; |
151 | |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
152 // 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
|
153 // 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
|
154 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
|
155 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
156 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
|
157 qf_info_T *qi; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
158 } qf_delq_T; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
159 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
|
160 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
161 // 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
|
162 // still being used. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
163 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
|
164 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
165 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
|
166 |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
167 // callback function for 'quickfixtextfunc' |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
168 static callback_T qftf_cb; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
169 |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
170 static void qf_new_list(qf_info_T *qi, char_u *qf_title); |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
171 static int qf_add_entry(qf_list_T *qfl, char_u *dir, char_u *fname, char_u *module, int bufnum, char_u *mesg, long lnum, long end_lnum, int col, int end_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
|
172 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
|
173 static char_u *qf_types(int, int); |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
174 static int qf_get_fnum(qf_list_T *qfl, char_u *, char_u *); |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
175 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
|
176 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
|
177 static char_u *qf_guess_filepath(qf_list_T *qfl, char_u *); |
17789
0f7ae8010787
patch 8.1.1891: functions used in one file are global
Bram Moolenaar <Bram@vim.org>
parents:
17099
diff
changeset
|
178 static void qf_jump_newwin(qf_info_T *qi, int dir, int errornr, int forceit, int newwin); |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
179 static void qf_fmt_text(char_u *text, char_u *buf, int bufsize); |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
180 static void qf_range_text(qfline_T *qfp, char_u *buf, int bufsize); |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
181 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
|
182 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
|
183 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
|
184 static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last); |
20762
68170c89e355
patch 8.2.0933: 'quickfixtextfunc' does not get window ID of location list
Bram Moolenaar <Bram@vim.org>
parents:
20729
diff
changeset
|
185 static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid); |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7710
diff
changeset
|
186 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
|
187 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
|
188 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
|
189 static qf_info_T *ll_get_or_alloc_list(win_T *); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
190 static char_u *e_no_more_items = (char_u *)N_("E553: No more items"); |
7 | 191 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
192 // Quickfix window check helper macro |
644 | 193 #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
|
194 // Location list window check helper macro |
644 | 195 #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
|
196 |
8413e66d00a1
patch 8.1.0293: checks for type of stack is cryptic
Christian Brabandt <cb@256bit.org>
parents:
14552
diff
changeset
|
197 // 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
|
198 #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
|
199 #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
|
200 #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
|
201 #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
|
202 |
644 | 203 /* |
204 * Return location list for window 'wp' | |
205 * For location list window, return the referenced location list | |
206 */ | |
207 #define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? wp->w_llist_ref : wp->w_llist) | |
208 | |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
209 // Macro to loop through all the items in a quickfix list |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
210 // Quickfix item index starts from 1, so i below starts at 1 |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
211 #define FOR_ALL_QFL_ITEMS(qfl, qfp, i) \ |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
212 for (i = 1, qfp = qfl->qf_start; \ |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
213 !got_int && i <= qfl->qf_count && qfp != NULL; \ |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
214 ++i, qfp = qfp->qf_next) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
215 |
7 | 216 /* |
11443
30b3775addb2
patch 8.0.0605: the quickfix cached buffer may become invalid
Christian Brabandt <cb@256bit.org>
parents:
11426
diff
changeset
|
217 * 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
|
218 * 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
|
219 */ |
11447
698ee9d4fe9f
patch 8.0.0607: after :bwipe + :new bufref might still be valid
Christian Brabandt <cb@256bit.org>
parents:
11445
diff
changeset
|
220 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
|
221 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
|
222 |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
223 static char *e_current_quickfix_list_was_changed = |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
224 N_("E925: Current quickfix list was changed"); |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
225 static char *e_current_location_list_was_changed = |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
226 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
|
227 |
11443
30b3775addb2
patch 8.0.0605: the quickfix cached buffer may become invalid
Christian Brabandt <cb@256bit.org>
parents:
11426
diff
changeset
|
228 /* |
9033
0536d1469b67
commit https://github.com/vim/vim/commit/6be8c8e165204b8aa4eeb8a52be87a58d8b41b9e
Christian Brabandt <cb@256bit.org>
parents:
8932
diff
changeset
|
229 * 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
|
230 */ |
0536d1469b67
commit https://github.com/vim/vim/commit/6be8c8e165204b8aa4eeb8a52be87a58d8b41b9e
Christian Brabandt <cb@256bit.org>
parents:
8932
diff
changeset
|
231 #define LINE_MAXLEN 4096 |
0536d1469b67
commit https://github.com/vim/vim/commit/6be8c8e165204b8aa4eeb8a52be87a58d8b41b9e
Christian Brabandt <cb@256bit.org>
parents:
8932
diff
changeset
|
232 |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
233 static struct fmtpattern |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
234 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
235 char_u convchar; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
236 char *pattern; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
237 } 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
|
238 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
239 {'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
|
240 {'n', "\\d\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
241 {'l', "\\d\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
242 {'c', "\\d\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
243 {'t', "."}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
244 {'m', ".\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
245 {'r', ".*"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
246 {'p', "[- .]*"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
247 {'v', "\\d\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
248 {'s', ".\\+"}, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
249 {'o', ".\\+"} |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
250 }; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
251 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
252 /* |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
253 * 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
|
254 * 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
|
255 * 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
|
256 * 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
|
257 */ |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
258 static char_u * |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
259 efmpat_to_regpat( |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
260 char_u *efmpat, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
261 char_u *regpat, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
262 efm_T *efminfo, |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
263 int idx, |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
264 int round) |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
265 { |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
266 char_u *srcptr; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
267 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
268 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
|
269 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
270 // 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
|
271 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
|
272 return NULL; |
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 if ((idx && idx < 6 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
275 && 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
|
276 || (idx == 6 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
277 && 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
|
278 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
279 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
|
280 return NULL; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
281 } |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
282 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
|
283 *regpat++ = '\\'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
284 *regpat++ = '('; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
285 #ifdef BACKSLASH_IN_FILENAME |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
286 if (*efmpat == 'f') |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
287 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
288 // 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
|
289 // 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
|
290 // "\%(\a:\)\=" |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
291 STRCPY(regpat, "\\%(\\a:\\)\\="); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
292 regpat += 10; |
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 #endif |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
295 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
|
296 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
297 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
|
298 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
299 // 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
|
300 // 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
|
301 // 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
|
302 // 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
|
303 // follows should work. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
304 STRCPY(regpat, ".\\{-1,}"); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
305 regpat += 7; |
13984
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 else |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
308 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
309 // 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
|
310 // 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
|
311 STRCPY(regpat, "\\f\\+"); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
312 regpat += 4; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
313 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
314 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
315 else |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
316 { |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
317 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
|
318 while ((*regpat = *srcptr++) != NUL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
319 ++regpat; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
320 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
321 *regpat++ = '\\'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
322 *regpat++ = ')'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
323 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
324 return regpat; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
325 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
326 |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
327 /* |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
328 * 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
|
329 * 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
|
330 */ |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
331 static char_u * |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
332 scanf_fmt_to_regpat( |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
333 char_u **pefmp, |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
334 char_u *efm, |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
335 int len, |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
336 char_u *regpat) |
13984
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 char_u *efmp = *pefmp; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
339 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
340 if (*efmp == '[' || *efmp == '\\') |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
341 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
342 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
|
343 { |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
344 if (efmp[1] == '^') |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
345 *regpat++ = *++efmp; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
346 if (efmp < efm + len) |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
347 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
348 *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
|
349 while (efmp < efm + len |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
350 && (*regpat++ = *++efmp) != ']') |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
351 // skip ; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
352 if (efmp == efm + len) |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
353 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
354 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
|
355 return NULL; |
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 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
358 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
359 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
|
360 *regpat++ = *++efmp; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
361 *regpat++ = '\\'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
362 *regpat++ = '+'; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
363 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
364 else |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
365 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
366 // 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
|
367 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
|
368 return NULL; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
369 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
370 |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
371 *pefmp = efmp; |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
372 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
373 return regpat; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
374 } |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
375 |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
376 /* |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
377 * 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
|
378 */ |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
379 static char_u * |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
380 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
|
381 { |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
382 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
|
383 efminfo->flags = *efmp++; |
20729
ada6f26e6eb1
patch 8.2.0917: quickfix entries do not suport a "note" type
Bram Moolenaar <Bram@vim.org>
parents:
20631
diff
changeset
|
384 if (vim_strchr((char_u *)"DXAEWINCZGOPQ", *efmp) != NULL) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
385 efminfo->prefix = *efmp; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
386 else |
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
387 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
388 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
|
389 return NULL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
390 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
391 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
392 return efmp; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
393 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
394 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
395 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
396 * 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
|
397 * 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
|
398 * 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
|
399 * Returns OK or FAIL. |
9365
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 static int |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
402 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
|
403 char_u *efm, |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
404 int len, |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
405 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
|
406 char_u *regpat) |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
407 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
408 char_u *ptr; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
409 char_u *efmp; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
410 int round; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
411 int idx = 0; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
412 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
413 // 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
|
414 ptr = regpat; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
415 *ptr++ = '^'; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
416 round = 0; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
417 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
|
418 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
419 if (*efmp == '%') |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
420 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
421 ++efmp; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
422 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
|
423 if (fmt_pat[idx].convchar == *efmp) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
424 break; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
425 if (idx < FMT_PATTERNS) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
426 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
427 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
|
428 if (ptr == NULL) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
429 return FAIL; |
13984
9b1dc5c2f460
patch 8.1.0010: efm_to_regpat() is too long
Christian Brabandt <cb@256bit.org>
parents:
13948
diff
changeset
|
430 round++; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
431 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
432 else if (*efmp == '*') |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
433 { |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
434 ++efmp; |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
435 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
|
436 if (ptr == NULL) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
437 return FAIL; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
438 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
439 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
|
440 *ptr++ = *efmp; // regexp magic characters |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
441 else if (*efmp == '#') |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
442 *ptr++ = '*'; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
443 else if (*efmp == '>') |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
444 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
|
445 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
|
446 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
447 // 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
|
448 // option part |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
449 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
|
450 if (efmp == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
451 return FAIL; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
452 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
453 else |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
454 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
455 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
|
456 return FAIL; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
457 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
458 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
459 else // copy normal character |
9365
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 if (*efmp == '\\' && efmp + 1 < efm + len) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
462 ++efmp; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
463 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
|
464 *ptr++ = '\\'; // escape regexp atoms |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
465 if (*efmp) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
466 *ptr++ = *efmp; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
467 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
468 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
469 *ptr++ = '$'; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
470 *ptr = NUL; |
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 return OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
473 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
474 |
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 * Free the 'errorformat' information list |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
477 */ |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
478 static void |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
479 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
|
480 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
481 efm_T *efm_ptr; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
482 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
483 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
|
484 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
485 *efm_first = efm_ptr->next; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
486 vim_regfree(efm_ptr->prog); |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
487 vim_free(efm_ptr); |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
488 } |
10367
4e4e116e3689
commit https://github.com/vim/vim/commit/63bed3d319b5d90765dbdae93a3579b6322d79fb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
489 fmt_start = NULL; |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
490 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
491 |
14477
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 * 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
|
494 * a regular expression pattern. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
495 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
496 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
497 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
|
498 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
499 int sz; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
500 int i; |
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 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
|
503 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
|
504 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
|
505 #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
|
506 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
|
507 #else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
508 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
|
509 #endif |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
510 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
511 return sz; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
512 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
513 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
514 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
515 * 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
|
516 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
517 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
518 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
|
519 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
520 int len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
521 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
522 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
|
523 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
|
524 ++len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
525 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
526 return len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
527 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
528 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
529 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
530 * 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
|
531 * 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
|
532 * the parsed 'errorformat' option. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
533 */ |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
534 static efm_T * |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
535 parse_efm_option(char_u *efm) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
536 { |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
537 efm_T *fmt_ptr = NULL; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
538 efm_T *fmt_first = NULL; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
539 efm_T *fmt_last = NULL; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
540 char_u *fmtstr = NULL; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
541 int len; |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
542 int sz; |
9365
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 // 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
|
545 // 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
|
546 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
547 // 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
|
548 sz = efm_regpat_bufsz(efm); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
549 if ((fmtstr = alloc(sz)) == NULL) |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
550 goto parse_efm_error; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
551 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
552 while (efm[0] != NUL) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
553 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
554 // Allocate a new eformat structure and put it at the end of the list |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
555 fmt_ptr = ALLOC_CLEAR_ONE(efm_T); |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
556 if (fmt_ptr == NULL) |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
557 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
|
558 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
|
559 fmt_first = fmt_ptr; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
560 else |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
561 fmt_last->next = fmt_ptr; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
562 fmt_last = fmt_ptr; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
563 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
564 // 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
|
565 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
|
566 |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
567 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
|
568 goto parse_efm_error; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
569 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
|
570 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
|
571 // Advance to next part |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
572 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
|
573 } |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
574 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
575 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
|
576 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
|
577 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
578 goto parse_efm_end; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
579 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
580 parse_efm_error: |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
581 free_efm_list(&fmt_first); |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
582 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
583 parse_efm_end: |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
584 vim_free(fmtstr); |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
585 |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
586 return fmt_first; |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
587 } |
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
588 |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
589 enum { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
590 QF_FAIL = 0, |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
591 QF_OK = 1, |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
592 QF_END_OF_INPUT = 2, |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
593 QF_NOMEM = 3, |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
594 QF_IGNORE_LINE = 4, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
595 QF_MULTISCAN = 5, |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
596 }; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
597 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
598 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
599 * 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
|
600 * list. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
601 */ |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
602 typedef struct { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
603 char_u *linebuf; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
604 int linelen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
605 char_u *growbuf; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
606 int growbufsiz; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
607 FILE *fd; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
608 typval_T *tv; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
609 char_u *p_str; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
610 listitem_T *p_li; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
611 buf_T *buf; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
612 linenr_T buflnum; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
613 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
|
614 vimconv_T vc; |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
615 } qfstate_T; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
616 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
617 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
618 * 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
|
619 */ |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
620 static char_u * |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
621 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
|
622 { |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
623 char_u *p; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
624 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
625 // 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
|
626 // 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
|
627 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
|
628 if (state->growbuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
629 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
630 state->growbuf = alloc(state->linelen + 1); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
631 if (state->growbuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
632 return NULL; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
633 state->growbufsiz = state->linelen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
634 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
635 else if (state->linelen > state->growbufsiz) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
636 { |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
637 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
|
638 return NULL; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
639 state->growbuf = p; |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
640 state->growbufsiz = state->linelen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
641 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
642 return state->growbuf; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
643 } |
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 /* |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
646 * 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
|
647 */ |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
648 static int |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
649 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
|
650 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
651 // 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
|
652 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
|
653 char_u *p; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
654 int len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
655 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
656 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
|
657 return QF_END_OF_INPUT; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
658 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
659 p = vim_strchr(p_str, '\n'); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
660 if (p != NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
661 len = (int)(p - p_str) + 1; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
662 else |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
663 len = (int)STRLEN(p_str); |
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 if (len > IOSIZE - 2) |
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 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
|
668 if (state->linebuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
669 return QF_NOMEM; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
670 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
671 else |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
672 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
673 state->linebuf = IObuff; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
674 state->linelen = len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
675 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
676 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
|
677 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
678 // 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
|
679 // 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
|
680 p_str += len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
681 state->p_str = p_str; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
682 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
683 return QF_OK; |
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 /* |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
687 * 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
|
688 */ |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
689 static int |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
690 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
|
691 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
692 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
|
693 int len; |
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 while (p_li != NULL |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
696 && (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
|
697 || 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
|
698 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
|
699 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
700 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
|
701 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
702 state->p_li = NULL; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
703 return QF_END_OF_INPUT; |
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 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
|
707 if (len > IOSIZE - 2) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
708 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
709 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
|
710 if (state->linebuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
711 return QF_NOMEM; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
712 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
713 else |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
714 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
715 state->linebuf = IObuff; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
716 state->linelen = len; |
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 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
719 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
|
720 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
721 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
|
722 return QF_OK; |
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 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
725 /* |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
726 * 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
|
727 */ |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
728 static int |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
729 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
|
730 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
731 char_u *p_buf = NULL; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
732 int len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
733 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
734 // 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
|
735 if (state->buflnum > state->lnumlast) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
736 return QF_END_OF_INPUT; |
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 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
|
739 state->buflnum += 1; |
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 len = (int)STRLEN(p_buf); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
742 if (len > IOSIZE - 2) |
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 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
|
745 if (state->linebuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
746 return QF_NOMEM; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
747 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
748 else |
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 state->linebuf = IObuff; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
751 state->linelen = len; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
752 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
753 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
|
754 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
755 return QF_OK; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
756 } |
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 /* |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
759 * 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
|
760 */ |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
761 static int |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
762 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
|
763 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
764 int discard; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
765 int growbuflen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
766 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
767 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
|
768 return QF_END_OF_INPUT; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
769 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
770 discard = FALSE; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
771 state->linelen = (int)STRLEN(IObuff); |
9738
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
772 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
|
773 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
774 // 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
|
775 // 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
|
776 if (state->growbuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
777 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
778 state->growbufsiz = 2 * (IOSIZE - 1); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
779 state->growbuf = alloc(state->growbufsiz); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
780 if (state->growbuf == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
781 return QF_NOMEM; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
782 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
783 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
784 // 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
|
785 memcpy(state->growbuf, IObuff, IOSIZE - 1); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
786 growbuflen = state->linelen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
787 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
788 for (;;) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
789 { |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
790 char_u *p; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
791 |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
792 if (fgets((char *)state->growbuf + growbuflen, |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
793 state->growbufsiz - growbuflen, state->fd) == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
794 break; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
795 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
|
796 growbuflen += state->linelen; |
9738
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
797 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
|
798 break; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
799 if (state->growbufsiz == LINE_MAXLEN) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
800 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
801 discard = TRUE; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
802 break; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
803 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
804 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
805 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
|
806 ? 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
|
807 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
|
808 return QF_NOMEM; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
809 state->growbuf = p; |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
810 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
811 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
812 while (discard) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
813 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
814 // 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
|
815 // 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
|
816 // reached. |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
817 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
|
818 || (int)STRLEN(IObuff) < IOSIZE - 1 |
22099
b7cc5d8ea702
patch 8.2.1599: missing line end when skipping a long line with :cgetfile
Bram Moolenaar <Bram@vim.org>
parents:
22015
diff
changeset
|
819 || IObuff[IOSIZE - 2] == '\n') |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
820 break; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
821 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
822 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
823 state->linebuf = state->growbuf; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
824 state->linelen = growbuflen; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
825 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
826 else |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
827 state->linebuf = IObuff; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
828 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
829 // 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
|
830 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
|
831 { |
11063
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
832 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
|
833 |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
834 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
|
835 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
|
836 { |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
837 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
|
838 { |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
839 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
|
840 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
|
841 } |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
842 else |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
843 { |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
844 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
|
845 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
|
846 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
|
847 ? 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
|
848 } |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
849 } |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
850 } |
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
851 |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
852 return QF_OK; |
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 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
855 /* |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
856 * 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
|
857 */ |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
858 static int |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
859 qf_get_nextline(qfstate_T *state) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
860 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
861 int status = QF_FAIL; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
862 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
863 if (state->fd == NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
864 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
865 if (state->tv != NULL) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
866 { |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
867 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
|
868 // 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
|
869 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
|
870 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
|
871 // 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
|
872 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
|
873 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
874 else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
875 // 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
|
876 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
|
877 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
878 else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
879 // 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
|
880 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
|
881 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
882 if (status != QF_OK) |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
883 return status; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
884 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
885 // 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
|
886 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
|
887 { |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
888 state->linebuf[state->linelen - 1] = NUL; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
889 #ifdef USE_CRNL |
9738
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
890 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
|
891 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
|
892 #endif |
9738
6818e3c96473
commit https://github.com/vim/vim/commit/796aa9c804f09276bd3cc45123f4a191a001dec2
Christian Brabandt <cb@256bit.org>
parents:
9649
diff
changeset
|
893 } |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
894 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
895 remove_bom(state->linebuf); |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
896 |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
897 return QF_OK; |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
898 } |
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
899 |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
900 typedef struct { |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
901 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
|
902 char_u *module; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
903 char_u *errmsg; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
904 int errmsglen; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
905 long lnum; |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
906 long end_lnum; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
907 int col; |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
908 int end_col; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
909 char_u use_viscol; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
910 char_u *pattern; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
911 int enr; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
912 int type; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
913 int valid; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
914 } qffields_T; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
915 |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
916 /* |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
917 * 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
|
918 * 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
|
919 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
920 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
921 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
|
922 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
923 int c; |
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 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
|
926 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
927 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
928 // 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
|
929 c = *rmp->endp[midx]; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
930 *rmp->endp[midx] = NUL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
931 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
|
932 *rmp->endp[midx] = c; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
933 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
934 // 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
|
935 // should exist. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
936 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
|
937 && mch_getperm(fields->namebuf) == -1) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
938 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
939 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
940 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
941 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
942 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
943 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
944 * 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
|
945 * 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
|
946 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
947 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
948 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
|
949 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
950 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
951 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
952 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
|
953 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
954 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
955 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
956 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
957 * 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
|
958 * 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
|
959 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
960 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
961 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
|
962 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
963 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
964 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
965 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
|
966 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
967 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
968 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
969 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
970 * 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
|
971 * 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
|
972 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
973 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
974 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
|
975 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
976 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
977 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
978 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
|
979 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
980 } |
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 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
983 * 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
|
984 * 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
|
985 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
986 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
987 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
|
988 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
989 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
990 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
991 fields->type = *rmp->startp[midx]; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
992 return QF_OK; |
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 /* |
19405
08f4dc2ba716
patch 8.2.0260: several lines of code are duplicated
Bram Moolenaar <Bram@vim.org>
parents:
19366
diff
changeset
|
996 * Copy a non-error line into the error string. Return the matched line in |
08f4dc2ba716
patch 8.2.0260: several lines of code are duplicated
Bram Moolenaar <Bram@vim.org>
parents:
19366
diff
changeset
|
997 * "fields->errmsg". |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
998 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
999 static int |
19405
08f4dc2ba716
patch 8.2.0260: several lines of code are duplicated
Bram Moolenaar <Bram@vim.org>
parents:
19366
diff
changeset
|
1000 copy_nonerror_line(char_u *linebuf, int linelen, qffields_T *fields) |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1001 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1002 char_u *p; |
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 (linelen >= fields->errmsglen) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1005 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1006 // linelen + null terminator |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1007 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
|
1008 return QF_NOMEM; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1009 fields->errmsg = p; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1010 fields->errmsglen = linelen + 1; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1011 } |
19405
08f4dc2ba716
patch 8.2.0260: several lines of code are duplicated
Bram Moolenaar <Bram@vim.org>
parents:
19366
diff
changeset
|
1012 // copy whole line to error message |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1013 vim_strncpy(fields->errmsg, linebuf, linelen); |
19405
08f4dc2ba716
patch 8.2.0260: several lines of code are duplicated
Bram Moolenaar <Bram@vim.org>
parents:
19366
diff
changeset
|
1014 |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1015 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1016 } |
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 * 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
|
1020 * 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
|
1021 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1022 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1023 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
|
1024 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1025 char_u *p; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1026 int len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1027 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1028 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
|
1029 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1030 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
|
1031 if (len >= fields->errmsglen) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1032 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1033 // len + null terminator |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1034 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
|
1035 return QF_NOMEM; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1036 fields->errmsg = p; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1037 fields->errmsglen = len + 1; |
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 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
|
1040 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1041 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1042 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1043 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1044 * 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
|
1045 * 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
|
1046 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1047 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1048 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
|
1049 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1050 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1051 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1052 *tail = rmp->startp[midx]; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1053 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1054 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1055 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1056 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1057 * 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
|
1058 * 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
|
1059 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1060 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1061 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
|
1062 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1063 char_u *match_ptr; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1064 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1065 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
|
1066 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1067 fields->col = 0; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1068 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
|
1069 ++match_ptr) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1070 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1071 ++fields->col; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1072 if (*match_ptr == TAB) |
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 fields->col += 7; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1075 fields->col -= fields->col % 8; |
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 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1078 ++fields->col; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1079 fields->use_viscol = TRUE; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1080 return QF_OK; |
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 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1083 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1084 * 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
|
1085 * 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
|
1086 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1087 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1088 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
|
1089 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1090 if (rmp->startp[midx] == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1091 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1092 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
|
1093 fields->use_viscol = TRUE; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1094 return QF_OK; |
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 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1097 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1098 * 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
|
1099 * 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
|
1100 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1101 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1102 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
|
1103 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1104 int len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1105 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1106 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
|
1107 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1108 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
|
1109 if (len > CMDBUFFSIZE - 5) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1110 len = CMDBUFFSIZE - 5; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1111 STRCPY(fields->pattern, "^\\V"); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1112 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
|
1113 fields->pattern[len + 3] = '\\'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1114 fields->pattern[len + 4] = '$'; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1115 fields->pattern[len + 5] = NUL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1116 return QF_OK; |
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 |
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 * 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
|
1121 * 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
|
1122 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1123 static int |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1124 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
|
1125 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1126 int len; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1127 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1128 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
|
1129 return QF_FAIL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1130 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
|
1131 if (len > CMDBUFFSIZE) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1132 len = CMDBUFFSIZE; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1133 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
|
1134 return QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1135 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1136 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1137 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1138 * 'errorformat' format pattern parser functions. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1139 * 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
|
1140 * 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
|
1141 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1142 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
|
1143 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1144 NULL, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1145 qf_parse_fmt_n, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1146 qf_parse_fmt_l, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1147 qf_parse_fmt_c, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1148 qf_parse_fmt_t, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1149 qf_parse_fmt_m, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1150 NULL, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1151 qf_parse_fmt_p, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1152 qf_parse_fmt_v, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1153 qf_parse_fmt_s, |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1154 qf_parse_fmt_o |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1155 }; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1156 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1157 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1158 * 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
|
1159 * "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
|
1160 * 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
|
1161 * 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
|
1162 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1163 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1164 qf_parse_match( |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1165 char_u *linebuf, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1166 int linelen, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1167 efm_T *fmt_ptr, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1168 regmatch_T *regmatch, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1169 qffields_T *fields, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1170 int qf_multiline, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1171 int qf_multiscan, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1172 char_u **tail) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1173 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1174 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
|
1175 int i; |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1176 int midx; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1177 int status; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1178 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1179 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
|
1180 return QF_FAIL; |
20729
ada6f26e6eb1
patch 8.2.0917: quickfix entries do not suport a "note" type
Bram Moolenaar <Bram@vim.org>
parents:
20631
diff
changeset
|
1181 if (vim_strchr((char_u *)"EWIN", idx) != NULL) |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1182 fields->type = idx; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1183 else |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1184 fields->type = 0; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1185 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1186 // 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
|
1187 // 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
|
1188 // 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
|
1189 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
|
1190 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1191 status = QF_OK; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1192 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
|
1193 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
|
1194 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
|
1195 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
|
1196 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1197 if (fmt_ptr->flags == '+' && !qf_multiscan) // %+ |
19405
08f4dc2ba716
patch 8.2.0260: several lines of code are duplicated
Bram Moolenaar <Bram@vim.org>
parents:
19366
diff
changeset
|
1198 status = copy_nonerror_line(linebuf, linelen, fields); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1199 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
|
1200 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
|
1201 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1202 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
|
1203 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
|
1204 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
|
1205 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
|
1206 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1207 if (status != QF_OK) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1208 return status; |
13868
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 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1211 return QF_OK; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1212 } |
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 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1215 * 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
|
1216 * '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
|
1217 * 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
|
1218 * 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
|
1219 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1220 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1221 qf_parse_get_fields( |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1222 char_u *linebuf, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1223 int linelen, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1224 efm_T *fmt_ptr, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1225 qffields_T *fields, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1226 int qf_multiline, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1227 int qf_multiscan, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1228 char_u **tail) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1229 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1230 regmatch_T regmatch; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1231 int status = QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1232 int r; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1233 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1234 if (qf_multiscan && |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1235 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
|
1236 return QF_FAIL; |
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 fields->namebuf[0] = NUL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1239 fields->module[0] = NUL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1240 fields->pattern[0] = NUL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1241 if (!qf_multiscan) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1242 fields->errmsg[0] = NUL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1243 fields->lnum = 0; |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
1244 fields->end_lnum = 0; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1245 fields->col = 0; |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
1246 fields->end_col = 0; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1247 fields->use_viscol = FALSE; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1248 fields->enr = -1; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1249 fields->type = 0; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1250 *tail = NULL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1251 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1252 // 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
|
1253 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
|
1254 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
|
1255 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
|
1256 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
|
1257 if (r) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1258 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
|
1259 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
|
1260 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1261 return status; |
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 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
|
1266 * 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
|
1267 * names. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1268 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1269 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1270 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
|
1271 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1272 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
|
1273 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1274 if (*fields->namebuf == NUL) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1275 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
1276 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
|
1277 return QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1278 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1279 qfl->qf_directory = |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1280 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
|
1281 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
|
1282 return QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1283 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1284 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
|
1285 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
|
1286 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1287 return QF_OK; |
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 * 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
|
1292 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1293 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1294 qf_parse_file_pfx( |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1295 int idx, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1296 qffields_T *fields, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1297 qf_list_T *qfl, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1298 char_u *tail) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1299 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1300 fields->valid = FALSE; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1301 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
|
1302 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1303 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
|
1304 qfl->qf_currfile = |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1305 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
|
1306 else if (idx == 'Q') |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1307 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
|
1308 *fields->namebuf = NUL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1309 if (tail && *tail) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1310 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1311 STRMOVE(IObuff, skipwhite(tail)); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1312 qfl->qf_multiscan = TRUE; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1313 return QF_MULTISCAN; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1314 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1315 } |
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 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
|
1322 * format in 'efm'). |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1323 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1324 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1325 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
|
1326 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1327 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
|
1328 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
|
1329 fields->valid = FALSE; |
19405
08f4dc2ba716
patch 8.2.0260: several lines of code are duplicated
Bram Moolenaar <Bram@vim.org>
parents:
19366
diff
changeset
|
1330 |
08f4dc2ba716
patch 8.2.0260: several lines of code are duplicated
Bram Moolenaar <Bram@vim.org>
parents:
19366
diff
changeset
|
1331 return copy_nonerror_line(linebuf, linelen, fields); |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1332 } |
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 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1335 * 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
|
1336 */ |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1337 static int |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1338 qf_parse_multiline_pfx( |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1339 int idx, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1340 qf_list_T *qfl, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1341 qffields_T *fields) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1342 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1343 char_u *ptr; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1344 int len; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1345 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1346 if (!qfl->qf_multiignore) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1347 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1348 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
|
1349 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1350 if (qfprev == NULL) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1351 return QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1352 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
|
1353 { |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1354 len = (int)STRLEN(qfprev->qf_text); |
16764
ef00b6bc186b
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
16619
diff
changeset
|
1355 if ((ptr = alloc(len + STRLEN(fields->errmsg) + 2)) |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1356 == NULL) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1357 return QF_FAIL; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1358 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
|
1359 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
|
1360 qfprev->qf_text = ptr; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1361 *(ptr += len) = '\n'; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1362 STRCPY(++ptr, fields->errmsg); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1363 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1364 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
|
1365 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
|
1366 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
|
1367 // 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
|
1368 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
|
1369 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1370 if (!qfprev->qf_lnum) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1371 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
|
1372 if (!qfprev->qf_col) |
22645
13904ca59f96
patch 8.2.1871: using %v in 'errorformat' may fail before %Z
Bram Moolenaar <Bram@vim.org>
parents:
22454
diff
changeset
|
1373 { |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1374 qfprev->qf_col = fields->col; |
22645
13904ca59f96
patch 8.2.1871: using %v in 'errorformat' may fail before %Z
Bram Moolenaar <Bram@vim.org>
parents:
22454
diff
changeset
|
1375 qfprev->qf_viscol = fields->use_viscol; |
13904ca59f96
patch 8.2.1871: using %v in 'errorformat' may fail before %Z
Bram Moolenaar <Bram@vim.org>
parents:
22454
diff
changeset
|
1376 } |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1377 if (!qfprev->qf_fnum) |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1378 qfprev->qf_fnum = qf_get_fnum(qfl, |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1379 qfl->qf_directory, |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1380 *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
|
1381 ? fields->namebuf |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1382 : 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
|
1383 ? qfl->qf_currfile : 0); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1384 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1385 if (idx == 'Z') |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1386 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
|
1387 line_breakcheck(); |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1388 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1389 return QF_IGNORE_LINE; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1390 } |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1391 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1392 /* |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1393 * 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
|
1394 * Return the QF_ status. |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1395 */ |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1396 static int |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1397 qf_parse_line( |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1398 qf_list_T *qfl, |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1399 char_u *linebuf, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1400 int linelen, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1401 efm_T *fmt_first, |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1402 qffields_T *fields) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1403 { |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1404 efm_T *fmt_ptr; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1405 int idx = 0; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1406 char_u *tail = NULL; |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1407 int status; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1408 |
13612
89223f5d5d12
patch 8.0.1678: errorformat "%r" implies "%>"
Christian Brabandt <cb@256bit.org>
parents:
13594
diff
changeset
|
1409 restofline: |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1410 // 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
|
1411 if (fmt_start == NULL) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1412 fmt_ptr = fmt_first; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1413 else |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1414 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1415 // 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
|
1416 fmt_ptr = fmt_start; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1417 fmt_start = NULL; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1418 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1419 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1420 // 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
|
1421 // match or no match. |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1422 fields->valid = TRUE; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1423 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
|
1424 { |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1425 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
|
1426 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
|
1427 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
|
1428 if (status == QF_NOMEM) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1429 return status; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1430 if (status == QF_OK) |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1431 break; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1432 } |
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
|
1433 qfl->qf_multiscan = FALSE; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1434 |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1435 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
|
1436 { |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1437 if (fmt_ptr != NULL) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1438 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1439 // '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
|
1440 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
|
1441 if (status != QF_OK) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1442 return status; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1443 } |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1444 |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1445 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
|
1446 if (status != QF_OK) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1447 return status; |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1448 |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1449 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
|
1450 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
|
1451 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1452 else if (fmt_ptr != NULL) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1453 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1454 // honor %> item |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1455 if (fmt_ptr->conthere) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1456 fmt_start = fmt_ptr; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1457 |
20729
ada6f26e6eb1
patch 8.2.0917: quickfix entries do not suport a "note" type
Bram Moolenaar <Bram@vim.org>
parents:
20631
diff
changeset
|
1458 if (vim_strchr((char_u *)"AEWIN", idx) != NULL) |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1459 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1460 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
|
1461 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
|
1462 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1463 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
|
1464 { // continuation of multi-line msg |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1465 status = qf_parse_multiline_pfx(idx, qfl, fields); |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1466 if (status != QF_OK) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1467 return status; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1468 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1469 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
|
1470 { // global file names |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1471 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
|
1472 if (status == QF_MULTISCAN) |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1473 goto restofline; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1474 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1475 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
|
1476 { |
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
|
1477 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
|
1478 // 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
|
1479 qfl->qf_multiignore = TRUE; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1480 return QF_IGNORE_LINE; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1481 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1482 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1483 |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1484 return QF_OK; |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1485 } |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1486 |
9033
0536d1469b67
commit https://github.com/vim/vim/commit/6be8c8e165204b8aa4eeb8a52be87a58d8b41b9e
Christian Brabandt <cb@256bit.org>
parents:
8932
diff
changeset
|
1487 /* |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1488 * 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
|
1489 */ |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1490 static int |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1491 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
|
1492 { |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1493 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
|
1494 } |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1495 |
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
1496 /* |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1497 * 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
|
1498 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1499 static int |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1500 qf_list_empty(qf_list_T *qfl) |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1501 { |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1502 return qfl == NULL || qfl->qf_count <= 0; |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1503 } |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1504 |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1505 /* |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
1506 * Returns TRUE if the specified quickfix/location list is not empty and |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
1507 * has valid entries. |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
1508 */ |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
1509 static int |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
1510 qf_list_has_valid_entries(qf_list_T *qfl) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
1511 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
1512 return !qf_list_empty(qfl) && !qfl->qf_nonevalid; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
1513 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
1514 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
1515 /* |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1516 * Return a pointer to a list in the specified quickfix stack |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1517 */ |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1518 static qf_list_T * |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1519 qf_get_list(qf_info_T *qi, int idx) |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1520 { |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1521 return &qi->qf_lists[idx]; |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1522 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1523 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
1524 /* |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1525 * 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
|
1526 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1527 static int |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1528 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
|
1529 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1530 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
|
1531 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
|
1532 pfields->errmsglen = CMDBUFFSIZE + 1; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1533 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
|
1534 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
|
1535 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
|
1536 || 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
|
1537 return FAIL; |
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 return OK; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1540 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1541 |
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 * 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
|
1544 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1545 static void |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1546 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
|
1547 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1548 vim_free(pfields->namebuf); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1549 vim_free(pfields->module); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1550 vim_free(pfields->errmsg); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1551 vim_free(pfields->pattern); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1552 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1553 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1554 /* |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1555 * 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
|
1556 * quickfix list. |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1557 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1558 static int |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1559 qf_setup_state( |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1560 qfstate_T *pstate, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1561 char_u *enc, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1562 char_u *efile, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1563 typval_T *tv, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1564 buf_T *buf, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1565 linenr_T lnumfirst, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1566 linenr_T lnumlast) |
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 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
|
1569 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
|
1570 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
|
1571 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1572 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
|
1573 { |
25306
078edc1821bf
patch 8.2.3190: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1574 semsg(_(e_cant_open_errorfile_str), efile); |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1575 return FAIL; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1576 } |
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 if (tv != NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1579 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1580 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
|
1581 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
|
1582 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
|
1583 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
|
1584 pstate->tv = tv; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1585 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1586 pstate->buf = buf; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1587 pstate->buflnum = lnumfirst; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1588 pstate->lnumlast = lnumlast; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1589 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1590 return OK; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1591 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1592 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1593 /* |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1594 * 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
|
1595 * quickfix list. |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1596 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1597 static void |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1598 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
|
1599 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1600 if (pstate->fd != NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1601 fclose(pstate->fd); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1602 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1603 vim_free(pstate->growbuf); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1604 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
|
1605 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
|
1606 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1607 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1608 /* |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1609 * Process the next line from a file/buffer/list/string and add it |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1610 * to the quickfix list 'qfl'. |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1611 */ |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1612 static int |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1613 qf_init_process_nextline( |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1614 qf_list_T *qfl, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1615 efm_T *fmt_first, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1616 qfstate_T *state, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1617 qffields_T *fields) |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1618 { |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1619 int status; |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1620 |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1621 // Get the next line from a file/buffer/list/string |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1622 status = qf_get_nextline(state); |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1623 if (status != QF_OK) |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1624 return status; |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1625 |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1626 status = qf_parse_line(qfl, state->linebuf, state->linelen, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1627 fmt_first, fields); |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1628 if (status != QF_OK) |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1629 return status; |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1630 |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1631 return qf_add_entry(qfl, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1632 qfl->qf_directory, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1633 (*fields->namebuf || qfl->qf_directory != NULL) |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1634 ? fields->namebuf |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1635 : ((qfl->qf_currfile != NULL && fields->valid) |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1636 ? qfl->qf_currfile : (char_u *)NULL), |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1637 fields->module, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1638 0, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1639 fields->errmsg, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1640 fields->lnum, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
1641 fields->end_lnum, |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1642 fields->col, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
1643 fields->end_col, |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1644 fields->use_viscol, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1645 fields->pattern, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1646 fields->enr, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1647 fields->type, |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1648 fields->valid); |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1649 } |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1650 |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1651 /* |
41 | 1652 * Read the errorfile "efile" into memory, line by line, building the error |
1653 * list. | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
1654 * 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
|
1655 * Alternative: when "tv" is not NULL get errors from the string or list. |
41 | 1656 * 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
|
1657 * 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
|
1658 * Set the title of the list to "qf_title". |
41 | 1659 * Return -1 for error, number of errors for success. |
1660 */ | |
1661 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1662 qf_init_ext( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1663 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
|
1664 int qf_idx, |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1665 char_u *efile, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1666 buf_T *buf, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1667 typval_T *tv, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1668 char_u *errorformat, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1669 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
|
1670 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
|
1671 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
|
1672 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
|
1673 char_u *enc) |
41 | 1674 { |
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
|
1675 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
|
1676 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
|
1677 qffields_T fields; |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
1678 qfline_T *old_last = NULL; |
10369
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1679 int adding = FALSE; |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1680 static efm_T *fmt_first = NULL; |
7 | 1681 char_u *efm; |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1682 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
|
1683 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
|
1684 int status; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1685 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1686 // 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
|
1687 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
|
1688 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
1689 CLEAR_FIELD(state); |
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
1690 CLEAR_FIELD(fields); |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1691 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
|
1692 (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
|
1693 lnumfirst, lnumlast) == FAIL)) |
7 | 1694 goto qf_init_end; |
1695 | |
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
|
1696 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
|
1697 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1698 // make place for a new list |
3965 | 1699 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
|
1700 qf_idx = qi->qf_curlist; |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
1701 qfl = qf_get_list(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
|
1702 } |
11609
6f11697fb92c
patch 8.0.0687: minor issues related to quickfix
Christian Brabandt <cb@256bit.org>
parents:
11589
diff
changeset
|
1703 else |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
1704 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1705 // 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
|
1706 adding = TRUE; |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
1707 qfl = qf_get_list(qi, qf_idx); |
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
1708 if (!qf_list_empty(qfl)) |
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
1709 old_last = qfl->qf_last; |
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
1710 } |
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
|
1711 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1712 // Use the local value of 'errorformat' if it's set. |
446 | 1713 if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL) |
41 | 1714 efm = buf->b_p_efm; |
7 | 1715 else |
1716 efm = errorformat; | |
9365
3830a92c12bf
commit https://github.com/vim/vim/commit/688e3d1fd9b9129a5ba0e0d599ccfe6f4443daf3
Christian Brabandt <cb@256bit.org>
parents:
9334
diff
changeset
|
1717 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1718 // 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
|
1719 // previously parsed values. |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1720 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
|
1721 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1722 // 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
|
1723 VIM_CLEAR(last_efm); |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1724 free_efm_list(&fmt_first); |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1725 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1726 // parse the current 'efm' |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1727 fmt_first = parse_efm_option(efm); |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1728 if (fmt_first != NULL) |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1729 last_efm = vim_strsave(efm); |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1730 } |
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
1731 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1732 if (fmt_first == NULL) // nothing found |
7 | 1733 goto error2; |
1734 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1735 // 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
|
1736 // ":make" command, but we still want to read the errorfile then. |
7 | 1737 got_int = FALSE; |
1738 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1739 // 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
|
1740 // Try to recognize one of the error formats in each line. |
41 | 1741 while (!got_int) |
7 | 1742 { |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1743 status = qf_init_process_nextline(qfl, fmt_first, &state, &fields); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1744 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
|
1745 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
|
1746 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
|
1747 break; |
9568
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1748 if (status == QF_FAIL) |
ccbd2e604e59
commit https://github.com/vim/vim/commit/e87e6dddc2b2a99572ec0db0833c052214c4fbd3
Christian Brabandt <cb@256bit.org>
parents:
9540
diff
changeset
|
1749 goto error2; |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
1750 |
7 | 1751 line_breakcheck(); |
1752 } | |
9531
50697f3b49d6
commit https://github.com/vim/vim/commit/e0d3797664c59afc9705808f86a7cf00fd6d874d
Christian Brabandt <cb@256bit.org>
parents:
9487
diff
changeset
|
1753 if (state.fd == NULL || !ferror(state.fd)) |
7 | 1754 { |
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
|
1755 if (qfl->qf_index == 0) |
7 | 1756 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1757 // 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
|
1758 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
|
1759 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
|
1760 qfl->qf_nonevalid = TRUE; |
7 | 1761 } |
1762 else | |
1763 { | |
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
|
1764 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
|
1765 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
|
1766 qfl->qf_ptr = qfl->qf_start; |
7 | 1767 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1768 // 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
|
1769 retval = qfl->qf_count; |
9369
ce5b79b005ec
commit https://github.com/vim/vim/commit/bcf7772a23624edc0942120e564f6b4ac95604ad
Christian Brabandt <cb@256bit.org>
parents:
9365
diff
changeset
|
1770 goto qf_init_end; |
7 | 1771 } |
25320
1e6da8364a02
patch 8.2.3197: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
1772 emsg(_(e_error_while_reading_errorfile)); |
7 | 1773 error2: |
10369
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1774 if (!adding) |
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1775 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1776 // 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
|
1777 qf_free(qfl); |
10369
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1778 qi->qf_listcount--; |
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1779 if (qi->qf_curlist > 0) |
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1780 --qi->qf_curlist; |
4e5b307638cb
commit https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Christian Brabandt <cb@256bit.org>
parents:
10367
diff
changeset
|
1781 } |
9369
ce5b79b005ec
commit https://github.com/vim/vim/commit/bcf7772a23624edc0942120e564f6b4ac95604ad
Christian Brabandt <cb@256bit.org>
parents:
9365
diff
changeset
|
1782 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
|
1783 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
|
1784 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
|
1785 qf_cleanup_state(&state); |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1786 qf_free_fields(&fields); |
7 | 1787 |
1788 return retval; | |
1789 } | |
1790 | |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1791 /* |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1792 * 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
|
1793 * 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
|
1794 * 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
|
1795 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1796 int |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1797 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
|
1798 char_u *efile, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1799 char_u *errorformat, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1800 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
|
1801 char_u *qf_title, |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1802 char_u *enc) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1803 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1804 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
|
1805 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1806 if (wp != NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1807 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1808 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
|
1809 if (qi == NULL) |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1810 return FAIL; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1811 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1812 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1813 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
|
1814 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
|
1815 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1816 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
1817 /* |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1818 * 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
|
1819 * Prepends ':' to the title. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1820 */ |
6079 | 1821 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
|
1822 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
|
1823 { |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
1824 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
|
1825 |
6079 | 1826 if (title != NULL) |
1827 { | |
16782
fc58fee685e2
patch 8.1.1393: unnecessary type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
1828 char_u *p = alloc(STRLEN(title) + 2); |
6079 | 1829 |
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
|
1830 qfl->qf_title = p; |
6079 | 1831 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
|
1832 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
|
1833 } |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1834 } |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1835 |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1836 /* |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1837 * 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
|
1838 * 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
|
1839 * 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
|
1840 * 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
|
1841 */ |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1842 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
|
1843 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
|
1844 { |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1845 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
|
1846 |
3b6c29f8c1a2
patch 8.0.1831: sometimes the quickfix title is incorrectly prefixed with ':'
Christian Brabandt <cb@256bit.org>
parents:
13882
diff
changeset
|
1847 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
|
1848 return qftitle_str; |
6079 | 1849 } |
1850 | |
7 | 1851 /* |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
1852 * Return a pointer to the current list in the specified quickfix stack |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
1853 */ |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
1854 static qf_list_T * |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
1855 qf_get_curlist(qf_info_T *qi) |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
1856 { |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1857 return qf_get_list(qi, qi->qf_curlist); |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
1858 } |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
1859 |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
1860 /* |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
1861 * 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
|
1862 * 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
|
1863 * the new list is added. |
7 | 1864 */ |
1865 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1866 qf_new_list(qf_info_T *qi, char_u *qf_title) |
7 | 1867 { |
1868 int i; | |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
1869 qf_list_T *qfl; |
7 | 1870 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1871 // 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
|
1872 // the current entry. This makes it possible to browse in a tree-like |
18498
9e6d5a4abb1c
patch 8.1.2243: typos in comments
Bram Moolenaar <Bram@vim.org>
parents:
18452
diff
changeset
|
1873 // way with ":grep". |
644 | 1874 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
|
1875 qf_free(&qi->qf_lists[--qi->qf_listcount]); |
7 | 1876 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1877 // 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
|
1878 // Otherwise, add a new entry. |
644 | 1879 if (qi->qf_listcount == LISTCOUNT) |
7 | 1880 { |
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
|
1881 qf_free(&qi->qf_lists[0]); |
7 | 1882 for (i = 1; i < LISTCOUNT; ++i) |
644 | 1883 qi->qf_lists[i - 1] = qi->qf_lists[i]; |
1884 qi->qf_curlist = LISTCOUNT - 1; | |
7 | 1885 } |
1886 else | |
644 | 1887 qi->qf_curlist = qi->qf_listcount++; |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
1888 qfl = qf_get_curlist(qi); |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
1889 CLEAR_POINTER(qfl); |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
1890 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
|
1891 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
|
1892 qfl->qf_id = ++last_qf_id; |
7 | 1893 } |
1894 | |
644 | 1895 /* |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1896 * 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
|
1897 */ |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1898 static void |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1899 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
|
1900 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1901 qf_delq_T *q; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1902 |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
1903 q = ALLOC_ONE(qf_delq_T); |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1904 if (q != NULL) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1905 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1906 q->qi = qi; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1907 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
|
1908 qf_delq_head = q; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1909 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1910 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1911 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1912 /* |
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
|
1913 * 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
|
1914 */ |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1915 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
|
1916 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
|
1917 { |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1918 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
|
1919 } |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1920 |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1921 /* |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1922 * 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
|
1923 * 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
|
1924 */ |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1925 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
|
1926 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
|
1927 { |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1928 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
|
1929 |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1930 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
|
1931 { |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1932 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
|
1933 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
|
1934 { |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1935 // 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
|
1936 // wipe the buffer. |
18886
050f5eaa9e50
patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents:
18827
diff
changeset
|
1937 close_buffer(NULL, qfbuf, DOBUF_WIPE, FALSE, FALSE); |
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
|
1938 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
|
1939 } |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1940 } |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1941 } |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1942 |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
1943 /* |
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
|
1944 * Free a location list stack |
644 | 1945 */ |
1946 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1947 ll_free_all(qf_info_T **pqi) |
359 | 1948 { |
1949 int i; | |
644 | 1950 qf_info_T *qi; |
1951 | |
1952 qi = *pqi; | |
1953 if (qi == NULL) | |
1954 return; | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1955 *pqi = NULL; // Remove reference to this list |
644 | 1956 |
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
|
1957 // 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
|
1958 // 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
|
1959 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
|
1960 { |
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
|
1961 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
|
1962 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
|
1963 } |
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
|
1964 |
644 | 1965 qi->qf_refcount--; |
1966 if (qi->qf_refcount < 1) | |
1967 { | |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
1968 // 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
|
1969 // 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
|
1970 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
|
1971 |
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
|
1972 for (i = 0; i < qi->qf_listcount; ++i) |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1973 qf_free(qf_get_list(qi, i)); |
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
|
1974 vim_free(qi); |
644 | 1975 } |
359 | 1976 } |
644 | 1977 |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1978 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
1979 * 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
|
1980 */ |
644 | 1981 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1982 qf_free_all(win_T *wp) |
644 | 1983 { |
1984 int i; | |
1985 qf_info_T *qi = &ql_info; | |
1986 | |
1987 if (wp != NULL) | |
1988 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1989 // location list |
644 | 1990 ll_free_all(&wp->w_llist); |
1991 ll_free_all(&wp->w_llist_ref); | |
1992 } | |
1993 else | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
1994 // quickfix list |
644 | 1995 for (i = 0; i < qi->qf_listcount; ++i) |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
1996 qf_free(qf_get_list(qi, i)); |
644 | 1997 } |
359 | 1998 |
7 | 1999 /* |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2000 * 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
|
2001 * 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
|
2002 * 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
|
2003 * 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
|
2004 */ |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2005 static void |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2006 incr_quickfix_busy(void) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2007 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2008 quickfix_busy++; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2009 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2010 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2011 /* |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2012 * 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
|
2013 */ |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2014 static void |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2015 decr_quickfix_busy(void) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2016 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2017 if (--quickfix_busy == 0) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2018 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2019 // 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
|
2020 // delete requests. |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2021 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
|
2022 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2023 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
|
2024 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2025 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
|
2026 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
|
2027 vim_free(q); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2028 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2029 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2030 #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
|
2031 if (quickfix_busy < 0) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2032 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
2033 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
|
2034 abort(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2035 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2036 #endif |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2037 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2038 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2039 #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
|
2040 void |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2041 check_quickfix_busy(void) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2042 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2043 if (quickfix_busy != 0) |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2044 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
2045 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
|
2046 # 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
|
2047 abort(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2048 # endif |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2049 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2050 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2051 #endif |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2052 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2053 /* |
7 | 2054 * Add an entry to the end of the list of errors. |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
2055 * Returns QF_OK or QF_FAIL. |
7 | 2056 */ |
2057 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2058 qf_add_entry( |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2059 qf_list_T *qfl, // quickfix list entry |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2060 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
|
2061 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
|
2062 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
|
2063 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
|
2064 char_u *mesg, // message |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2065 long lnum, // line number |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
2066 long end_lnum, // line number for end |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2067 int col, // column |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
2068 int end_col, // column for end |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2069 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
|
2070 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
|
2071 int nr, // error number |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2072 int type, // type character |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2073 int valid) // valid entry |
7 | 2074 { |
230 | 2075 qfline_T *qfp; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2076 qfline_T **lastp; // pointer to qf_last or NULL |
7 | 2077 |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
2078 if ((qfp = ALLOC_ONE(qfline_T)) == NULL) |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
2079 return QF_FAIL; |
1065 | 2080 if (bufnum != 0) |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2081 { |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2082 buf_T *buf = buflist_findnr(bufnum); |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2083 |
1065 | 2084 qfp->qf_fnum = bufnum; |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2085 if (buf != NULL) |
9608
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
2086 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
|
2087 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
|
2088 } |
1065 | 2089 else |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2090 qfp->qf_fnum = qf_get_fnum(qfl, dir, fname); |
7 | 2091 if ((qfp->qf_text = vim_strsave(mesg)) == NULL) |
2092 { | |
2093 vim_free(qfp); | |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
2094 return QF_FAIL; |
7 | 2095 } |
2096 qfp->qf_lnum = lnum; | |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
2097 qfp->qf_end_lnum = end_lnum; |
7 | 2098 qfp->qf_col = col; |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
2099 qfp->qf_end_col = end_col; |
170 | 2100 qfp->qf_viscol = vis_col; |
230 | 2101 if (pattern == NULL || *pattern == NUL) |
2102 qfp->qf_pattern = NULL; | |
2103 else if ((qfp->qf_pattern = vim_strsave(pattern)) == NULL) | |
2104 { | |
2105 vim_free(qfp->qf_text); | |
2106 vim_free(qfp); | |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
2107 return QF_FAIL; |
230 | 2108 } |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2109 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
|
2110 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
|
2111 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
|
2112 { |
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2113 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
|
2114 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
|
2115 vim_free(qfp); |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
2116 return QF_FAIL; |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
2117 } |
7 | 2118 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
|
2119 if (type != 1 && !vim_isprintc(type)) // only printable chars allowed |
7 | 2120 type = 0; |
2121 qfp->qf_type = type; | |
2122 qfp->qf_valid = valid; | |
2123 | |
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
|
2124 lastp = &qfl->qf_last; |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2125 if (qf_list_empty(qfl)) // first element in the list |
7 | 2126 { |
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
|
2127 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
|
2128 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
|
2129 qfl->qf_index = 0; |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2130 qfp->qf_prev = NULL; |
7 | 2131 } |
2132 else | |
2133 { | |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2134 qfp->qf_prev = *lastp; |
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2135 (*lastp)->qf_next = qfp; |
7 | 2136 } |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2137 qfp->qf_next = NULL; |
7 | 2138 qfp->qf_cleared = FALSE; |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
2139 *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
|
2140 ++qfl->qf_count; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2141 if (qfl->qf_index == 0 && qfp->qf_valid) // first valid entry |
7 | 2142 { |
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
|
2143 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
|
2144 qfl->qf_ptr = qfp; |
7 | 2145 } |
2146 | |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
2147 return QF_OK; |
7 | 2148 } |
2149 | |
2150 /* | |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
2151 * Allocate a new quickfix/location list stack |
644 | 2152 */ |
659 | 2153 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
|
2154 qf_alloc_stack(qfltype_T qfltype) |
644 | 2155 { |
659 | 2156 qf_info_T *qi; |
2157 | |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
2158 qi = ALLOC_CLEAR_ONE(qf_info_T); |
659 | 2159 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
|
2160 { |
659 | 2161 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
|
2162 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
|
2163 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
|
2164 } |
659 | 2165 return qi; |
644 | 2166 } |
2167 | |
2168 /* | |
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
|
2169 * 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
|
2170 * If not present, allocate a location list stack |
644 | 2171 */ |
2172 static qf_info_T * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2173 ll_get_or_alloc_list(win_T *wp) |
644 | 2174 { |
2175 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
|
2176 // For a location list window, use the referenced location list |
644 | 2177 return wp->w_llist_ref; |
2178 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2179 // 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
|
2180 // location list. |
644 | 2181 ll_free_all(&wp->w_llist_ref); |
2182 | |
2183 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
|
2184 wp->w_llist = qf_alloc_stack(QFLT_LOCATION); // new location list |
644 | 2185 return wp->w_llist; |
2186 } | |
2187 | |
2188 /* | |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2189 * Get the quickfix/location list stack to use for the specified Ex command. |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2190 * For a location list command, returns the stack for the current window. If |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2191 * the location list is not found, then returns NULL and prints an error |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2192 * message if 'print_emsg' is TRUE. |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2193 */ |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2194 static qf_info_T * |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2195 qf_cmd_get_stack(exarg_T *eap, int print_emsg) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2196 { |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2197 qf_info_T *qi = &ql_info; |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2198 |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2199 if (is_loclist_cmd(eap->cmdidx)) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2200 { |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2201 qi = GET_LOC_LIST(curwin); |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2202 if (qi == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2203 { |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2204 if (print_emsg) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2205 emsg(_(e_loclist)); |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2206 return NULL; |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2207 } |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2208 } |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2209 |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2210 return qi; |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2211 } |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2212 |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2213 /* |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2214 * Get the quickfix/location list stack to use for the specified Ex command. |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2215 * For a location list command, returns the stack for the current window. |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2216 * If the location list is not present, then allocates a new one. |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2217 * Returns NULL if the allocation fails. For a location list command, sets |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2218 * 'pwinp' to curwin. |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2219 */ |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2220 static qf_info_T * |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2221 qf_cmd_get_or_alloc_stack(exarg_T *eap, win_T **pwinp) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2222 { |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2223 qf_info_T *qi = &ql_info; |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2224 |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2225 if (is_loclist_cmd(eap->cmdidx)) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2226 { |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2227 qi = ll_get_or_alloc_list(curwin); |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2228 if (qi == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2229 return NULL; |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2230 *pwinp = curwin; |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2231 } |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2232 |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2233 return qi; |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2234 } |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2235 |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
2236 /* |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2237 * 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
|
2238 */ |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2239 static int |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2240 copy_loclist_entries(qf_list_T *from_qfl, qf_list_T *to_qfl) |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2241 { |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2242 int i; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2243 qfline_T *from_qfp; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2244 qfline_T *prevp; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2245 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2246 // copy all the location entries in this list |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
2247 FOR_ALL_QFL_ITEMS(from_qfl, from_qfp, i) |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2248 { |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2249 if (qf_add_entry(to_qfl, |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2250 NULL, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2251 NULL, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2252 from_qfp->qf_module, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2253 0, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2254 from_qfp->qf_text, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2255 from_qfp->qf_lnum, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
2256 from_qfp->qf_end_lnum, |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2257 from_qfp->qf_col, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
2258 from_qfp->qf_end_col, |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2259 from_qfp->qf_viscol, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2260 from_qfp->qf_pattern, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2261 from_qfp->qf_nr, |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2262 0, |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
2263 from_qfp->qf_valid) == QF_FAIL) |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2264 return FAIL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2265 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2266 // 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
|
2267 // 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
|
2268 // field is copied here. |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2269 prevp = to_qfl->qf_last; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2270 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
|
2271 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
|
2272 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
|
2273 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
|
2274 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2275 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2276 return OK; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2277 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2278 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2279 /* |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2280 * 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
|
2281 */ |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2282 static int |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2283 copy_loclist(qf_list_T *from_qfl, qf_list_T *to_qfl) |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2284 { |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2285 // 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
|
2286 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
|
2287 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
|
2288 to_qfl->qf_count = 0; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2289 to_qfl->qf_index = 0; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2290 to_qfl->qf_start = NULL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2291 to_qfl->qf_last = NULL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2292 to_qfl->qf_ptr = NULL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2293 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
|
2294 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
|
2295 else |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2296 to_qfl->qf_title = NULL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2297 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
|
2298 { |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2299 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
|
2300 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
|
2301 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
|
2302 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2303 else |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2304 to_qfl->qf_ctx = NULL; |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
2305 if (from_qfl->qftf_cb.cb_name != NULL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
2306 copy_callback(&to_qfl->qftf_cb, &from_qfl->qftf_cb); |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2307 else |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
2308 to_qfl->qftf_cb.cb_name = NULL; |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2309 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2310 if (from_qfl->qf_count) |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2311 if (copy_loclist_entries(from_qfl, to_qfl) == FAIL) |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2312 return FAIL; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2313 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2314 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
|
2315 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2316 // 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
|
2317 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
|
2318 to_qfl->qf_changedtick = 0L; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2319 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2320 // 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
|
2321 // 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
|
2322 if (to_qfl->qf_nonevalid) |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2323 { |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2324 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
|
2325 to_qfl->qf_index = 1; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2326 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2327 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2328 return OK; |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2329 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2330 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2331 /* |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2332 * Copy the location list stack 'from' window to 'to' window. |
644 | 2333 */ |
2334 void | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2335 copy_loclist_stack(win_T *from, win_T *to) |
644 | 2336 { |
2337 qf_info_T *qi; | |
2338 int idx; | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2339 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2340 // 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
|
2341 // 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
|
2342 // that window. |
644 | 2343 if (IS_LL_WINDOW(from)) |
2344 qi = from->w_llist_ref; | |
2345 else | |
2346 qi = from->w_llist; | |
2347 | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2348 if (qi == NULL) // no location list to copy |
644 | 2349 return; |
2350 | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2351 // 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
|
2352 if ((to->w_llist = qf_alloc_stack(QFLT_LOCATION)) == NULL) |
644 | 2353 return; |
2354 | |
2355 to->w_llist->qf_listcount = qi->qf_listcount; | |
2356 | |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2357 // 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
|
2358 for (idx = 0; idx < qi->qf_listcount; ++idx) |
644 | 2359 { |
2360 to->w_llist->qf_curlist = idx; | |
2361 | |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2362 if (copy_loclist(qf_get_list(qi, idx), |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2363 qf_get_list(to->w_llist, idx)) == FAIL) |
644 | 2364 { |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2365 qf_free_all(to); |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2366 return; |
644 | 2367 } |
14844
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2368 } |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2369 |
a74786d0370c
patch 8.1.0434: copy_loclist() is too long
Christian Brabandt <cb@256bit.org>
parents:
14838
diff
changeset
|
2370 to->w_llist->qf_curlist = qi->qf_curlist; // current list |
644 | 2371 } |
2372 | |
2373 /* | |
10379
73e2a7abe2a3
commit https://github.com/vim/vim/commit/7618e00d3b8bfe064cfc524640d754607361f9df
Christian Brabandt <cb@256bit.org>
parents:
10369
diff
changeset
|
2374 * 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
|
2375 * Also sets the b_has_qf_entry flag. |
7 | 2376 */ |
2377 static int | |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2378 qf_get_fnum(qf_list_T *qfl, char_u *directory, char_u *fname) |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
2379 { |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2380 char_u *ptr = NULL; |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2381 buf_T *buf; |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2382 char_u *bufname; |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2383 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2384 if (fname == NULL || *fname == NUL) // no file name |
7 | 2385 return 0; |
2386 | |
2823 | 2387 #ifdef VMS |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2388 vms_remove_version(fname); |
2823 | 2389 #endif |
2390 #ifdef BACKSLASH_IN_FILENAME | |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2391 if (directory != NULL) |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2392 slash_adjust(directory); |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2393 slash_adjust(fname); |
2823 | 2394 #endif |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2395 if (directory != NULL && !vim_isAbsName(fname) |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2396 && (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
|
2397 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2398 // 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
|
2399 // 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
|
2400 // "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
|
2401 // directory change. |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2402 if (mch_getperm(ptr) < 0) |
7 | 2403 { |
2404 vim_free(ptr); | |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
2405 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
|
2406 if (directory) |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2407 ptr = concat_fnames(directory, fname, TRUE); |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2408 else |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2409 ptr = vim_strsave(fname); |
7 | 2410 } |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2411 // 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
|
2412 bufname = ptr; |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2413 } |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2414 else |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2415 bufname = fname; |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2416 |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2417 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
|
2418 && bufref_valid(&qf_last_bufref)) |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2419 { |
9475
4d8f7f8da90c
commit https://github.com/vim/vim/commit/b25f9a97e9aad3cbb4bc3fe87cdbd5700f8aa0c6
Christian Brabandt <cb@256bit.org>
parents:
9473
diff
changeset
|
2420 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
|
2421 vim_free(ptr); |
7 | 2422 } |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2423 else |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2424 { |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2425 vim_free(qf_last_bufname); |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2426 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
|
2427 if (bufname == ptr) |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2428 qf_last_bufname = bufname; |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2429 else |
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2430 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
|
2431 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
|
2432 } |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2433 if (buf == NULL) |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
2434 return 0; |
9473
bdac1019552f
commit https://github.com/vim/vim/commit/8240433f48f7383c281ba2453cc55f10b8ec47d9
Christian Brabandt <cb@256bit.org>
parents:
9458
diff
changeset
|
2435 |
9608
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
2436 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
|
2437 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
|
2438 return buf->b_fnum; |
7 | 2439 } |
2440 | |
2441 /* | |
9334
674f9e3ccd1a
commit https://github.com/vim/vim/commit/38df43bd13a2498cc96b3ddd9a20dd75126bd171
Christian Brabandt <cb@256bit.org>
parents:
9201
diff
changeset
|
2442 * 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
|
2443 * NULL on error. |
7 | 2444 */ |
2445 static char_u * | |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
2446 qf_push_dir(char_u *dirbuf, struct dir_stack_T **stackptr, int is_file_stack) |
7 | 2447 { |
2448 struct dir_stack_T *ds_new; | |
2449 struct dir_stack_T *ds_ptr; | |
2450 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2451 // allocate new stack element and hook it in |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
2452 ds_new = ALLOC_ONE(struct dir_stack_T); |
7 | 2453 if (ds_new == NULL) |
2454 return NULL; | |
2455 | |
2456 ds_new->next = *stackptr; | |
2457 *stackptr = ds_new; | |
2458 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2459 // store directory on the stack |
7 | 2460 if (vim_isAbsName(dirbuf) |
2461 || (*stackptr)->next == NULL | |
9397
e08e8b00fe48
commit https://github.com/vim/vim/commit/361c8f0e517e41f1f1d34dae328044406fde80ac
Christian Brabandt <cb@256bit.org>
parents:
9389
diff
changeset
|
2462 || (*stackptr && is_file_stack)) |
7 | 2463 (*stackptr)->dirname = vim_strsave(dirbuf); |
2464 else | |
2465 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2466 // 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
|
2467 // 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
|
2468 // Let's search... |
7 | 2469 ds_new = (*stackptr)->next; |
2470 (*stackptr)->dirname = NULL; | |
2471 while (ds_new) | |
2472 { | |
2473 vim_free((*stackptr)->dirname); | |
2474 (*stackptr)->dirname = concat_fnames(ds_new->dirname, dirbuf, | |
2475 TRUE); | |
2476 if (mch_isdir((*stackptr)->dirname) == TRUE) | |
2477 break; | |
2478 | |
2479 ds_new = ds_new->next; | |
2480 } | |
2481 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2482 // clean up all dirs we already left |
7 | 2483 while ((*stackptr)->next != ds_new) |
2484 { | |
2485 ds_ptr = (*stackptr)->next; | |
2486 (*stackptr)->next = (*stackptr)->next->next; | |
2487 vim_free(ds_ptr->dirname); | |
2488 vim_free(ds_ptr); | |
2489 } | |
2490 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2491 // Nothing found -> it must be on top level |
7 | 2492 if (ds_new == NULL) |
2493 { | |
2494 vim_free((*stackptr)->dirname); | |
2495 (*stackptr)->dirname = vim_strsave(dirbuf); | |
2496 } | |
2497 } | |
2498 | |
2499 if ((*stackptr)->dirname != NULL) | |
2500 return (*stackptr)->dirname; | |
2501 else | |
2502 { | |
2503 ds_ptr = *stackptr; | |
2504 *stackptr = (*stackptr)->next; | |
2505 vim_free(ds_ptr); | |
2506 return NULL; | |
2507 } | |
2508 } | |
2509 | |
2510 /* | |
2511 * pop dirbuf from the directory stack and return previous directory or NULL if | |
2512 * stack is empty | |
2513 */ | |
2514 static char_u * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2515 qf_pop_dir(struct dir_stack_T **stackptr) |
7 | 2516 { |
2517 struct dir_stack_T *ds_ptr; | |
2518 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2519 // 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
|
2520 // 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
|
2521 |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2522 // pop top element and free it |
7 | 2523 if (*stackptr != NULL) |
2524 { | |
2525 ds_ptr = *stackptr; | |
2526 *stackptr = (*stackptr)->next; | |
2527 vim_free(ds_ptr->dirname); | |
2528 vim_free(ds_ptr); | |
2529 } | |
2530 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2531 // return NEW top element as current dir or NULL if stack is empty |
7 | 2532 return *stackptr ? (*stackptr)->dirname : NULL; |
2533 } | |
2534 | |
2535 /* | |
2536 * clean up directory stack | |
2537 */ | |
2538 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2539 qf_clean_dir_stack(struct dir_stack_T **stackptr) |
7 | 2540 { |
2541 struct dir_stack_T *ds_ptr; | |
2542 | |
2543 while ((ds_ptr = *stackptr) != NULL) | |
2544 { | |
2545 *stackptr = (*stackptr)->next; | |
2546 vim_free(ds_ptr->dirname); | |
2547 vim_free(ds_ptr); | |
2548 } | |
2549 } | |
2550 | |
2551 /* | |
2552 * Check in which directory of the directory stack the given file can be | |
2553 * found. | |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
2554 * Returns a pointer to the directory name or NULL if not found. |
7 | 2555 * Cleans up intermediate directory entries. |
2556 * | |
2557 * 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
|
2558 * If we have this directory tree: |
7 | 2559 * ./ |
2560 * ./aa | |
2561 * ./aa/bb | |
2562 * ./bb | |
2563 * ./bb/x.c | |
2564 * and make says: | |
2565 * making all in aa | |
2566 * making all in bb | |
2567 * x.c:9: Error | |
2568 * Then qf_push_dir thinks we are in ./aa/bb, but we are in ./bb. | |
2569 * qf_guess_filepath will return NULL. | |
2570 */ | |
2571 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
|
2572 qf_guess_filepath(qf_list_T *qfl, char_u *filename) |
7 | 2573 { |
2574 struct dir_stack_T *ds_ptr; | |
2575 struct dir_stack_T *ds_tmp; | |
2576 char_u *fullname; | |
2577 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2578 // 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
|
2579 if (qfl->qf_dir_stack == NULL) |
7 | 2580 return NULL; |
2581 | |
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
|
2582 ds_ptr = qfl->qf_dir_stack->next; |
7 | 2583 fullname = NULL; |
2584 while (ds_ptr) | |
2585 { | |
2586 vim_free(fullname); | |
2587 fullname = concat_fnames(ds_ptr->dirname, filename, TRUE); | |
2588 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2589 // 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
|
2590 // is that we delete the entire stack. |
7 | 2591 if ((fullname != NULL) && (mch_getperm(fullname) >= 0)) |
2592 break; | |
2593 | |
2594 ds_ptr = ds_ptr->next; | |
2595 } | |
2596 | |
2597 vim_free(fullname); | |
2598 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2599 // 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
|
2600 while (qfl->qf_dir_stack->next != ds_ptr) |
7 | 2601 { |
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
|
2602 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
|
2603 qfl->qf_dir_stack->next = qfl->qf_dir_stack->next->next; |
7 | 2604 vim_free(ds_tmp->dirname); |
2605 vim_free(ds_tmp); | |
2606 } | |
2607 | |
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
|
2608 return ds_ptr == NULL ? NULL : ds_ptr->dirname; |
7 | 2609 } |
2610 | |
2611 /* | |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2612 * 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
|
2613 */ |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2614 static int |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
2615 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
|
2616 { |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2617 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
|
2618 int i; |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2619 |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2620 if (wp != NULL) |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2621 { |
23865
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23778
diff
changeset
|
2622 if (!win_valid(wp)) |
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23778
diff
changeset
|
2623 return FALSE; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2624 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
|
2625 if (qi == NULL) |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2626 return FALSE; |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2627 } |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2628 |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2629 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
|
2630 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
|
2631 return TRUE; |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2632 |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2633 return FALSE; |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2634 } |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2635 |
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
2636 /* |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
2637 * 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
|
2638 * 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
|
2639 * 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
|
2640 * Similar to location list. |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2641 */ |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2642 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
|
2643 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
|
2644 { |
8702
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2645 qfline_T *qfp; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2646 int i; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2647 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2648 // Search for the entry in the current list |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
2649 FOR_ALL_QFL_ITEMS(qfl, qfp, i) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
2650 if (qfp == qf_ptr) |
8702
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2651 break; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2652 |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
2653 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
|
2654 return FALSE; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2655 |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2656 return TRUE; |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2657 } |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2658 |
39d6e4f2f748
commit https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
2659 /* |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2660 * 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
|
2661 * 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
|
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 * |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2664 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
|
2665 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
|
2666 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
|
2667 int *qf_index, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2668 int dir) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2669 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2670 int idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2671 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
|
2672 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2673 idx = *qf_index; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2674 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
|
2675 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2676 do |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2677 { |
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
|
2678 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
|
2679 return NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2680 ++idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2681 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
|
2682 } 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
|
2683 || (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
|
2684 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2685 *qf_index = idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2686 return qf_ptr; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2687 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2688 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2689 /* |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2690 * 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
|
2691 * 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
|
2692 */ |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2693 static qfline_T * |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2694 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
|
2695 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
|
2696 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
|
2697 int *qf_index, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2698 int dir) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2699 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2700 int idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2701 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
|
2702 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2703 idx = *qf_index; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2704 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
|
2705 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2706 do |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2707 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2708 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
|
2709 return NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2710 --idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2711 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
|
2712 } 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
|
2713 || (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
|
2714 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2715 *qf_index = idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2716 return qf_ptr; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2717 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2718 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2719 /* |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2720 * 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
|
2721 * the quickfix list. |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2722 * 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
|
2723 * 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
|
2724 */ |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2725 static qfline_T * |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2726 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
|
2727 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
|
2728 int errornr, |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2729 int dir, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2730 int *new_qfidx) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2731 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2732 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
|
2733 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
|
2734 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
|
2735 int prev_index; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2736 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
|
2737 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2738 while (errornr--) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2739 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2740 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
|
2741 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
|
2742 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2743 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
|
2744 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
|
2745 else |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2746 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
|
2747 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
|
2748 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2749 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
|
2750 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
|
2751 if (err != NULL) |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2752 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
2753 emsg(_(err)); |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2754 return NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2755 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2756 break; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2757 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2758 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2759 err = NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2760 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2761 |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2762 *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
|
2763 return qf_ptr; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2764 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2765 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2766 /* |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2767 * 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
|
2768 * 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
|
2769 */ |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2770 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
|
2771 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
|
2772 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2773 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
|
2774 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
|
2775 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2776 // 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
|
2777 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
|
2778 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2779 --qf_idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2780 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
|
2781 } |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2782 // 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
|
2783 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
|
2784 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
|
2785 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2786 ++qf_idx; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2787 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
|
2788 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2789 |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2790 *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
|
2791 return qf_ptr; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2792 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2793 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2794 /* |
19195
2ef19eed524a
patch 8.2.0156: various typos in source files and tests
Bram Moolenaar <Bram@vim.org>
parents:
18886
diff
changeset
|
2795 * Get a entry specified by 'errornr' and 'dir' from the current |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2796 * 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
|
2797 * 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
|
2798 * 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
|
2799 * 'new_qfidx'. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2800 */ |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2801 static qfline_T * |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2802 qf_get_entry( |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2803 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
|
2804 int errornr, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2805 int dir, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2806 int *new_qfidx) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2807 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2808 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
|
2809 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
|
2810 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2811 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
|
2812 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
|
2813 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
|
2814 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
|
2815 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
2816 *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
|
2817 return qf_ptr; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2818 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2819 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2820 /* |
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
|
2821 * 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
|
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 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
|
2824 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
|
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 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
|
2827 |
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 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
|
2829 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
|
2830 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
|
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 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
|
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 |
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 /* |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2836 * Set the location list for the specified window to 'qi'. |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2837 */ |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2838 static void |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2839 win_set_loclist(win_T *wp, qf_info_T *qi) |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2840 { |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2841 wp->w_llist = qi; |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2842 qi->qf_refcount++; |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2843 } |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2844 |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2845 /* |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2846 * 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
|
2847 * window. |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2848 */ |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2849 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
|
2850 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
|
2851 { |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2852 win_T *wp; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2853 int flags; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2854 |
22699
e82579016863
patch 8.2.1898: command modifier parsing always uses global cmdmod
Bram Moolenaar <Bram@vim.org>
parents:
22645
diff
changeset
|
2855 if (cmdmod.cmod_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
|
2856 wp = NULL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2857 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
|
2858 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
|
2859 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
|
2860 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
|
2861 else |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2862 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2863 // 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
|
2864 // 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
|
2865 flags = WSP_HELP; |
22699
e82579016863
patch 8.2.1898: command modifier parsing always uses global cmdmod
Bram Moolenaar <Bram@vim.org>
parents:
22645
diff
changeset
|
2866 if (cmdmod.cmod_split == 0 && curwin->w_width != Columns |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2867 && 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
|
2868 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
|
2869 // 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
|
2870 // 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
|
2871 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
|
2872 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
|
2873 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2874 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
|
2875 return FAIL; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2876 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2877 *opened_window = TRUE; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2878 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2879 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
|
2880 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
|
2881 |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
2882 // 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
|
2883 // 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
|
2884 // 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
|
2885 if (IS_LL_STACK(qi) && !newwin) |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2886 win_set_loclist(curwin, qi); |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2887 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2888 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2889 if (!p_im) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2890 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
|
2891 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2892 return OK; |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2893 } |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2894 |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
2895 /* |
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
|
2896 * 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
|
2897 * 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
|
2898 * 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
|
2899 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2900 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
|
2901 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
|
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 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
|
2904 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2905 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
|
2906 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
|
2907 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
|
2908 |
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 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
|
2910 } |
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 |
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 * 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
|
2914 */ |
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 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
|
2916 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
|
2917 { |
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 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
|
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 FOR_ALL_WINDOWS(wp) |
14433
4a94173743d9
patch 8.1.0230: directly checking 'buftype' value
Christian Brabandt <cb@256bit.org>
parents:
14397
diff
changeset
|
2921 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
|
2922 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
|
2923 |
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 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
|
2925 } |
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 /* |
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 * 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
|
2929 * 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
|
2930 */ |
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 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
|
2932 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
|
2933 { |
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 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
|
2935 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
|
2936 |
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 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
|
2938 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
|
2939 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2940 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
|
2941 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
|
2942 } |
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 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
|
2945 } |
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 * 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
|
2949 * 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
|
2950 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2951 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
|
2952 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
|
2953 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2954 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
|
2955 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2956 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
|
2957 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
|
2958 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
|
2959 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
|
2960 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
|
2961 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
|
2962 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
|
2963 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
|
2964 if (ll_ref != NULL) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2965 // 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
|
2966 // location list window |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
2967 win_set_loclist(curwin, ll_ref); |
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
|
2968 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
|
2969 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2970 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2971 /* |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2972 * 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
|
2973 * 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
|
2974 * 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
|
2975 * 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
|
2976 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2977 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
|
2978 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
|
2979 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
2980 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
|
2981 |
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 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
|
2983 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2984 // 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
|
2985 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
|
2986 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
|
2987 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
|
2988 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
|
2989 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2990 // 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
|
2991 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
|
2992 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
|
2993 { |
14433
4a94173743d9
patch 8.1.0230: directly checking 'buftype' value
Christian Brabandt <cb@256bit.org>
parents:
14397
diff
changeset
|
2994 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
|
2995 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
|
2996 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
|
2997 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
|
2998 else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
2999 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
|
3000 } 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
|
3001 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3002 } |
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 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
|
3004 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3005 // 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
|
3006 // to the location list from the location window |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
3007 if (win->w_llist == NULL && ll_ref != NULL) |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
3008 win_set_loclist(win, ll_ref); |
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
|
3009 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3010 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3011 /* |
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
|
3012 * 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
|
3013 * 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
|
3014 * 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
|
3015 * 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
|
3016 */ |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3017 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
|
3018 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
|
3019 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3020 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
|
3021 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
|
3022 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3023 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
|
3024 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
|
3025 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
|
3026 { |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3027 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
|
3028 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
|
3029 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
|
3030 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
|
3031 else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3032 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
|
3033 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3034 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
|
3035 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3036 // Didn't find it, go to the window before the quickfix |
18646
394abd397e15
patch 8.1.2315: not always using the right window when jumping to an error
Bram Moolenaar <Bram@vim.org>
parents:
18607
diff
changeset
|
3037 // window, unless 'switchbuf' contains 'uselast': in this case we |
394abd397e15
patch 8.1.2315: not always using the right window when jumping to an error
Bram Moolenaar <Bram@vim.org>
parents:
18607
diff
changeset
|
3038 // try to jump to the previously used window first. |
394abd397e15
patch 8.1.2315: not always using the right window when jumping to an error
Bram Moolenaar <Bram@vim.org>
parents:
18607
diff
changeset
|
3039 if ((swb_flags & SWB_USELAST) && win_valid(prevwin)) |
394abd397e15
patch 8.1.2315: not always using the right window when jumping to an error
Bram Moolenaar <Bram@vim.org>
parents:
18607
diff
changeset
|
3040 win = prevwin; |
394abd397e15
patch 8.1.2315: not always using the right window when jumping to an error
Bram Moolenaar <Bram@vim.org>
parents:
18607
diff
changeset
|
3041 else if (altwin != NULL) |
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
|
3042 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
|
3043 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
|
3044 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
|
3045 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
|
3046 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
|
3047 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
|
3048 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3049 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3050 // Remember a usable window. |
14433
4a94173743d9
patch 8.1.0230: directly checking 'buftype' value
Christian Brabandt <cb@256bit.org>
parents:
14397
diff
changeset
|
3051 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
|
3052 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
|
3053 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3054 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3055 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
|
3056 } |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3057 |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3058 /* |
f48fcaa196a9
patch 8.0.1812: the qf_jump_to_usable_window() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13868
diff
changeset
|
3059 * 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
|
3060 * 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
|
3061 * 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
|
3062 * '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
|
3063 * 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
|
3064 */ |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3065 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
|
3066 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
|
3067 { |
18656
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3068 win_T *usable_wp = NULL; |
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3069 int usable_win = FALSE; |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3070 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
|
3071 |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3072 // 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
|
3073 // 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
|
3074 // location list. |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3075 if (!newwin) |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3076 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
|
3077 |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3078 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
|
3079 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3080 // Find a non-quickfix window with this location list |
18656
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3081 usable_wp = qf_find_win_with_loclist(ll_ref); |
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3082 if (usable_wp != NULL) |
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3083 usable_win = TRUE; |
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 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3086 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
|
3087 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3088 // Locate a window showing a normal buffer |
18656
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3089 win_T *win = qf_find_win_with_normal_buf(); |
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
|
3090 if (win != NULL) |
18656
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3091 usable_win = TRUE; |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3092 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3093 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3094 // 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
|
3095 // 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
|
3096 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
|
3097 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
|
3098 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3099 // 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
|
3100 // 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
|
3101 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
|
3102 { |
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
|
3103 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
|
3104 return FAIL; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3105 *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
|
3106 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3107 else |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3108 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3109 if (curwin->w_llist_ref != NULL) // In a location window |
18656
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3110 qf_goto_win_with_ll_file(usable_wp, 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
|
3111 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
|
3112 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
|
3113 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3114 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3115 return OK; |
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 |
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 * 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
|
3120 * 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
|
3121 * 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
|
3122 * 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
|
3123 */ |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3124 static int |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3125 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
|
3126 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
|
3127 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
|
3128 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
|
3129 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
|
3130 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
|
3131 { |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
3132 qf_list_T *qfl = qf_get_curlist(qi); |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3133 int old_changedtick = qfl->qf_changedtick; |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
3134 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
|
3135 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
|
3136 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
|
3137 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
|
3138 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3139 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
|
3140 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3141 // 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
|
3142 // 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
|
3143 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
|
3144 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3145 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
|
3146 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
|
3147 } |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3148 |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3149 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
|
3150 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
|
3151 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
|
3152 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3153 else |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3154 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
|
3155 (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
|
3156 |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3157 // 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
|
3158 // 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
|
3159 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
|
3160 { |
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
|
3161 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
|
3162 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
|
3163 { |
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
|
3164 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
|
3165 *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
|
3166 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
|
3167 } |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3168 } |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3169 |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
3170 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
|
3171 { |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3172 emsg(_(e_current_quickfix_list_was_changed)); |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3173 return NOTDONE; |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3174 } |
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3175 |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3176 // Check if the list was changed. The pointers may happen to be identical, |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3177 // thus also check qf_changedtick. |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3178 if (old_qf_curlist != qi->qf_curlist |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3179 || old_changedtick != qfl->qf_changedtick |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3180 || !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
|
3181 { |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
3182 if (qfl_type == QFLT_QUICKFIX) |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3183 emsg(_(e_current_quickfix_list_was_changed)); |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3184 else |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3185 emsg(_(e_current_location_list_was_changed)); |
14956
940def6df43f
patch 8.1.0489: crash when autocmd clears vimpgrep location list
Bram Moolenaar <Bram@vim.org>
parents:
14954
diff
changeset
|
3186 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
|
3187 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3188 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3189 return retval; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3190 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3191 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3192 /* |
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
|
3193 * 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
|
3194 * 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
|
3195 */ |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3196 static void |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3197 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
|
3198 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
|
3199 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
|
3200 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
|
3201 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
|
3202 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3203 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
|
3204 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3205 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
|
3206 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3207 // 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
|
3208 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
|
3209 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
|
3210 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3211 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
|
3212 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
|
3213 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
|
3214 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3215 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
|
3216 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3217 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
|
3218 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
|
3219 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
|
3220 else |
b8a2362073bb
patch 8.1.0859: "%v" in 'errorformat' does handle multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents:
15641
diff
changeset
|
3221 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
|
3222 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
|
3223 check_cursor(); |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3224 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3225 else |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3226 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
|
3227 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3228 else |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3229 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3230 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
|
3231 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3232 // 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
|
3233 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
|
3234 curwin->w_cursor.lnum = 0; |
19475
5512aa74cb62
patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents:
19405
diff
changeset
|
3235 if (!do_search(NULL, '/', '/', qf_pattern, (long)1, SEARCH_KEEP, NULL)) |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3236 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
|
3237 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3238 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3239 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3240 /* |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3241 * 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
|
3242 */ |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3243 static void |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3244 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
|
3245 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
|
3246 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
|
3247 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
|
3248 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
|
3249 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
|
3250 { |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3251 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
|
3252 int len; |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3253 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3254 // 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
|
3255 // 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
|
3256 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
|
3257 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
|
3258 sprintf((char *)IObuff, _("(%d of %d)%s%s: "), qf_index, |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
3259 qf_get_curlist(qi)->qf_count, |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3260 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
|
3261 (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
|
3262 // 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
|
3263 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
|
3264 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
|
3265 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3266 // 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
|
3267 // 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
|
3268 // 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
|
3269 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
|
3270 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
|
3271 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
|
3272 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
|
3273 msg_scroll = FALSE; |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3274 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
|
3275 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
|
3276 } |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3277 |
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3278 /* |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3279 * 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
|
3280 * 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
|
3281 * 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
|
3282 * 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
|
3283 * 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
|
3284 * with the entry. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3285 */ |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3286 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
|
3287 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
|
3288 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
|
3289 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
|
3290 int newwin, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3291 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
|
3292 { |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3293 qf_list_T *qfl = qf_get_curlist(qi); |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3294 int old_changedtick = qfl->qf_changedtick; |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3295 int old_qf_curlist = qi->qf_curlist; |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3296 qfltype_T qfl_type = qfl->qfl_type; |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3297 |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3298 // For ":helpgrep" find a help window or open one. |
22699
e82579016863
patch 8.2.1898: command modifier parsing always uses global cmdmod
Bram Moolenaar <Bram@vim.org>
parents:
22645
diff
changeset
|
3299 if (qf_ptr->qf_type == 1 && (!bt_help(curwin->w_buffer) |
e82579016863
patch 8.2.1898: command modifier parsing always uses global cmdmod
Bram Moolenaar <Bram@vim.org>
parents:
22645
diff
changeset
|
3300 || cmdmod.cmod_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
|
3301 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
|
3302 return FAIL; |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3303 if (old_qf_curlist != qi->qf_curlist |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3304 || old_changedtick != qfl->qf_changedtick |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3305 || !is_qf_entry_present(qfl, qf_ptr)) |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3306 { |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3307 if (qfl_type == QFLT_QUICKFIX) |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3308 emsg(_(e_current_quickfix_list_was_changed)); |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3309 else |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3310 emsg(_(e_current_location_list_was_changed)); |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3311 return FAIL; |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3312 } |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3313 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3314 // 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
|
3315 // file in. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3316 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
|
3317 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3318 // 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
|
3319 // 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
|
3320 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
|
3321 return NOTDONE; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3322 |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3323 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
|
3324 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
|
3325 return FAIL; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3326 } |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3327 if (old_qf_curlist != qi->qf_curlist |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3328 || old_changedtick != qfl->qf_changedtick |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3329 || !is_qf_entry_present(qfl, qf_ptr)) |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3330 { |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3331 if (qfl_type == QFLT_QUICKFIX) |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3332 emsg(_(e_current_quickfix_list_was_changed)); |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3333 else |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3334 emsg(_(e_current_location_list_was_changed)); |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3335 return FAIL; |
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
3336 } |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3337 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3338 return OK; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3339 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3340 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3341 /* |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3342 * 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
|
3343 * 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
|
3344 * jump. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3345 * 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
|
3346 * 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
|
3347 * the file. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3348 */ |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3349 static int |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3350 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
|
3351 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
|
3352 int qf_index, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3353 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
|
3354 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
|
3355 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
|
3356 int *opened_window, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3357 int openfold, |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3358 int print_message) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3359 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3360 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
|
3361 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
|
3362 int retval = OK; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3363 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3364 // 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
|
3365 // autowrite etc. |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3366 old_curbuf = curbuf; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3367 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
|
3368 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3369 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
|
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 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
|
3372 opened_window); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3373 if (retval != OK) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3374 return retval; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3375 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3376 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3377 // 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
|
3378 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
|
3379 setpcmark(); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3380 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3381 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
|
3382 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
|
3383 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3384 #ifdef FEAT_FOLDING |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3385 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
|
3386 foldOpenCursor(); |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3387 #endif |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3388 if (print_message) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3389 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
|
3390 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3391 return retval; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3392 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3393 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3394 /* |
15424
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3395 * Jump to a quickfix line and try to use an existing window. |
7 | 3396 */ |
3397 void | |
12449
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3398 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
|
3399 int dir, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3400 int errornr, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3401 int forceit) |
7 | 3402 { |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3403 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
|
3404 } |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3405 |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3406 /* |
15424
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3407 * 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
|
3408 * 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
|
3409 * 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
|
3410 * 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
|
3411 * 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
|
3412 * 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
|
3413 * 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
|
3414 * 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
|
3415 * 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
|
3416 */ |
17789
0f7ae8010787
patch 8.1.1891: functions used in one file are global
Bram Moolenaar <Bram@vim.org>
parents:
17099
diff
changeset
|
3417 static void |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3418 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
|
3419 int dir, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3420 int errornr, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3421 int forceit, |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3422 int newwin) |
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3423 { |
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
|
3424 qf_list_T *qfl; |
230 | 3425 qfline_T *qf_ptr; |
3426 qfline_T *old_qf_ptr; | |
7 | 3427 int qf_index; |
3428 int old_qf_index; | |
639 | 3429 char_u *old_swb = p_swb; |
1621 | 3430 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
|
3431 int prev_winid; |
7 | 3432 int opened_window = FALSE; |
3433 int print_message = TRUE; | |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3434 int old_KeyTyped = KeyTyped; // getting file may reset it |
12503
4d40b2644e92
patch 8.0.1130: the qf_jump() function is still too long
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
3435 int retval = OK; |
644 | 3436 |
659 | 3437 if (qi == NULL) |
3438 qi = &ql_info; | |
644 | 3439 |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
3440 if (qf_stack_empty(qi) || qf_list_empty(qf_get_curlist(qi))) |
7 | 3441 { |
25306
078edc1821bf
patch 8.2.3190: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
3442 emsg(_(e_no_errors)); |
7 | 3443 return; |
3444 } | |
3445 | |
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
|
3446 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
|
3447 |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
3448 qfl = qf_get_curlist(qi); |
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
|
3449 |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3450 qf_ptr = qfl->qf_ptr; |
7 | 3451 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
|
3452 qf_index = qfl->qf_index; |
7 | 3453 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
|
3454 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3455 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
|
3456 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
|
3457 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3458 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
|
3459 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
|
3460 goto theend; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3461 } |
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
|
3462 |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3463 qfl->qf_index = qf_index; |
25254
5127844b909b
patch 8.2.3163: location list window may open a wrong file
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
3464 qfl->qf_ptr = qf_ptr; |
644 | 3465 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
|
3466 // 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
|
3467 // window |
7 | 3468 print_message = FALSE; |
3469 | |
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
|
3470 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
|
3471 |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
3472 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
|
3473 if (retval == FAIL) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3474 goto failed; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3475 if (retval == NOTDONE) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3476 goto theend; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3477 |
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
|
3478 retval = qf_jump_to_buffer(qi, qf_index, qf_ptr, forceit, prev_winid, |
17950
bb0e25a8b5d7
patch 8.1.1971: manually enabling features causes build errors
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
3479 &opened_window, old_KeyTyped, print_message); |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3480 if (retval == NOTDONE) |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3481 { |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3482 // 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
|
3483 qi = NULL; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3484 qf_ptr = NULL; |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3485 } |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3486 |
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3487 if (retval != OK) |
7 | 3488 { |
3489 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
|
3490 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
|
3491 if (qf_ptr != NULL && qf_ptr->qf_fnum != 0) |
7 | 3492 { |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3493 // 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
|
3494 // happen if the file was readonly and we changed something. |
7 | 3495 failed: |
3496 qf_ptr = old_qf_ptr; | |
3497 qf_index = old_qf_index; | |
3498 } | |
3499 } | |
3500 theend: | |
8605
536b9b88d1ca
commit https://github.com/vim/vim/commit/0899d698030ec076eb26352cda1ea334ab0819d9
Christian Brabandt <cb@256bit.org>
parents:
8603
diff
changeset
|
3501 if (qi != NULL) |
536b9b88d1ca
commit https://github.com/vim/vim/commit/0899d698030ec076eb26352cda1ea334ab0819d9
Christian Brabandt <cb@256bit.org>
parents:
8603
diff
changeset
|
3502 { |
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
|
3503 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
|
3504 qfl->qf_index = qf_index; |
8605
536b9b88d1ca
commit https://github.com/vim/vim/commit/0899d698030ec076eb26352cda1ea334ab0819d9
Christian Brabandt <cb@256bit.org>
parents:
8603
diff
changeset
|
3505 } |
18656
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3506 if (p_swb != old_swb && p_swb == empty_option) |
7 | 3507 { |
14838
6040d93396de
patch 8.1.0431: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14796
diff
changeset
|
3508 // 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
|
3509 // modeline has changed the value. |
18656
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3510 p_swb = old_swb; |
022deb0adec9
patch 8.1.2320: insufficient test coverage for quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18646
diff
changeset
|
3511 swb_flags = old_swb_flags; |
7 | 3512 } |
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
|
3513 decr_quickfix_busy(); |
7 | 3514 } |
3515 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3516 // 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
|
3517 static int qfFileAttr; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3518 static int qfSepAttr; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3519 static int qfLineAttr; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3520 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3521 /* |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3522 * 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
|
3523 * 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
|
3524 * '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
|
3525 * quickfix list. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3526 */ |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3527 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
|
3528 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
|
3529 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3530 char_u *fname; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3531 buf_T *buf; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3532 int filter_entry; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3533 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3534 fname = NULL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3535 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
|
3536 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
|
3537 (char *)qfp->qf_module); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3538 else { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3539 if (qfp->qf_fnum != 0 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3540 && (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
|
3541 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3542 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
|
3543 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
|
3544 fname = gettail(fname); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3545 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3546 if (fname == NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3547 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
|
3548 else |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3549 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
|
3550 qf_idx, (char *)fname); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3551 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3552 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3553 // 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
|
3554 // 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
|
3555 // text of the entry. |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3556 filter_entry = TRUE; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3557 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
|
3558 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
|
3559 if (filter_entry && fname != NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3560 filter_entry &= message_filtered(fname); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3561 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
|
3562 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
|
3563 if (filter_entry) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3564 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
|
3565 if (filter_entry) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3566 return; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3567 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3568 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
|
3569 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
|
3570 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3571 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
|
3572 msg_puts_attr(":", qfSepAttr); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3573 if (qfp->qf_lnum == 0) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3574 IObuff[0] = NUL; |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3575 else |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3576 qf_range_text(qfp, IObuff, IOSIZE); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3577 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
|
3578 (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
|
3579 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
|
3580 msg_puts_attr(":", qfSepAttr); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3581 if (qfp->qf_pattern != NULL) |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3582 { |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3583 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
|
3584 msg_puts((char *)IObuff); |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3585 msg_puts_attr(":", qfSepAttr); |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3586 } |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
3587 msg_puts(" "); |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3588 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3589 // 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
|
3590 // 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
|
3591 // with ^^^^. |
14477
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3592 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
|
3593 ? 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
|
3594 IObuff, IOSIZE); |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3595 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
|
3596 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
|
3597 } |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3598 |
1ccf5dcd88ca
patch 8.1.0252: quickfix functions are too long
Christian Brabandt <cb@256bit.org>
parents:
14469
diff
changeset
|
3599 /* |
7 | 3600 * ":clist": list all errors |
644 | 3601 * ":llist": list all locations |
7 | 3602 */ |
3603 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3604 qf_list(exarg_T *eap) |
7 | 3605 { |
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
|
3606 qf_list_T *qfl; |
230 | 3607 qfline_T *qfp; |
3608 int i; | |
3609 int idx1 = 1; | |
3610 int idx2 = -1; | |
3611 char_u *arg = eap->arg; | |
9379
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3612 int plus = FALSE; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3613 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
|
3614 // recognised errors |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
3615 qf_info_T *qi; |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
3616 |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
3617 if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
3618 return; |
644 | 3619 |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
3620 if (qf_stack_empty(qi) || qf_list_empty(qf_get_curlist(qi))) |
7 | 3621 { |
25306
078edc1821bf
patch 8.2.3190: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
3622 emsg(_(e_no_errors)); |
7 | 3623 return; |
3624 } | |
9379
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3625 if (*arg == '+') |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3626 { |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3627 ++arg; |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3628 plus = TRUE; |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3629 } |
7 | 3630 if (!get_list_range(&arg, &idx1, &idx2) || *arg != NUL) |
3631 { | |
21461
4dfd00f481fb
patch 8.2.1281: the "trailing characters" error can be hard to understand
Bram Moolenaar <Bram@vim.org>
parents:
21409
diff
changeset
|
3632 semsg(_(e_trailing_arg), arg); |
7 | 3633 return; |
3634 } | |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
3635 qfl = qf_get_curlist(qi); |
9379
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3636 if (plus) |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3637 { |
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
|
3638 i = qfl->qf_index; |
9379
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3639 idx2 = i + idx1; |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3640 idx1 = i; |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3641 } |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3642 else |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3643 { |
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
|
3644 i = qfl->qf_count; |
9379
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3645 if (idx1 < 0) |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3646 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
|
3647 if (idx2 < 0) |
b398e4e12751
commit https://github.com/vim/vim/commit/e8fea0728a2fa1fe78ef0ac90dee1a84bd7ef9fb
Christian Brabandt <cb@256bit.org>
parents:
9369
diff
changeset
|
3648 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
|
3649 } |
7 | 3650 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3651 // 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
|
3652 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
|
3653 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3654 // 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
|
3655 // 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
|
3656 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
|
3657 if (qfFileAttr == 0) |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3658 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
|
3659 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
|
3660 if (qfSepAttr == 0) |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3661 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
|
3662 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
|
3663 if (qfLineAttr == 0) |
888441e8fbb0
patch 8.0.1332: highlighting in quickfix window could be better
Christian Brabandt <cb@256bit.org>
parents:
12531
diff
changeset
|
3664 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
|
3665 |
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
|
3666 if (qfl->qf_nonevalid) |
7 | 3667 all = TRUE; |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
3668 FOR_ALL_QFL_ITEMS(qfl, qfp, i) |
7 | 3669 { |
3670 if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2) | |
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
|
3671 qf_list_entry(qfp, i, i == qfl->qf_index); |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
3672 |
7 | 3673 ui_breakcheck(); |
3674 } | |
3675 } | |
3676 | |
3677 /* | |
3678 * Remove newlines and leading whitespace from an error message. | |
3679 * Put the result in "buf[bufsize]". | |
3680 */ | |
3681 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3682 qf_fmt_text(char_u *text, char_u *buf, int bufsize) |
7 | 3683 { |
3684 int i; | |
3685 char_u *p = text; | |
3686 | |
3687 for (i = 0; *p != NUL && i < bufsize - 1; ++i) | |
3688 { | |
3689 if (*p == '\n') | |
3690 { | |
3691 buf[i] = ' '; | |
3692 while (*++p != NUL) | |
11129
f4ea50924c6d
patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
11063
diff
changeset
|
3693 if (!VIM_ISWHITE(*p) && *p != '\n') |
7 | 3694 break; |
3695 } | |
3696 else | |
3697 buf[i] = *p++; | |
3698 } | |
3699 buf[i] = NUL; | |
3700 } | |
3701 | |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3702 /* |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3703 * Range information from lnum, col, end_lnum, and end_col. |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3704 * Put the result in "buf[bufsize]". |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3705 */ |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3706 static void |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3707 qf_range_text(qfline_T *qfp, char_u *buf, int bufsize) |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3708 { |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3709 int len; |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3710 vim_snprintf((char *)buf, bufsize, "%ld", qfp->qf_lnum); |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3711 len = (int)STRLEN(buf); |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3712 |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3713 if (qfp->qf_end_lnum > 0 && qfp->qf_lnum != qfp->qf_end_lnum) |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3714 { |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3715 vim_snprintf((char *)buf + len, bufsize - len, |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3716 "-%ld", qfp->qf_end_lnum); |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3717 len += (int)STRLEN(buf + len); |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3718 } |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3719 if (qfp->qf_col > 0) |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3720 { |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3721 vim_snprintf((char *)buf + len, bufsize - len, " col %d", qfp->qf_col); |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3722 len += (int)STRLEN(buf + len); |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3723 if (qfp->qf_end_col > 0 && qfp->qf_col != qfp->qf_end_col) |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3724 { |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3725 vim_snprintf((char *)buf + len, bufsize - len, |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3726 "-%d", qfp->qf_end_col); |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3727 len += (int)STRLEN(buf + len); |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3728 } |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3729 } |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3730 buf[len] = NUL; |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3731 } |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3732 |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
3733 /* |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3734 * 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
|
3735 * quickfix/location list. |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3736 */ |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3737 static void |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3738 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
|
3739 { |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3740 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
|
3741 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
|
3742 char_u buf[IOSIZE]; |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3743 |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3744 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
|
3745 lead, |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3746 which + 1, |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3747 qi->qf_listcount, |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3748 count); |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3749 |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3750 if (title != NULL) |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3751 { |
9579
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3752 size_t len = STRLEN(buf); |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3753 |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3754 if (len < 34) |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3755 { |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3756 vim_memset(buf + len, ' ', 34 - len); |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3757 buf[34] = NUL; |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3758 } |
2fb7e008ac9b
commit https://github.com/vim/vim/commit/16ec3c9be3fcdc38530bddb12978bc5a7b98c0f6
Christian Brabandt <cb@256bit.org>
parents:
9573
diff
changeset
|
3759 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
|
3760 } |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3761 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
|
3762 msg((char *)buf); |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3763 } |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3764 |
7 | 3765 /* |
3766 * ":colder [count]": Up in the quickfix stack. | |
3767 * ":cnewer [count]": Down in the quickfix stack. | |
644 | 3768 * ":lolder [count]": Up in the location list stack. |
3769 * ":lnewer [count]": Down in the location list stack. | |
7 | 3770 */ |
3771 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3772 qf_age(exarg_T *eap) |
7 | 3773 { |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
3774 qf_info_T *qi; |
7 | 3775 int count; |
3776 | |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
3777 if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
3778 return; |
644 | 3779 |
7 | 3780 if (eap->addr_count != 0) |
3781 count = eap->line2; | |
3782 else | |
3783 count = 1; | |
3784 while (count--) | |
3785 { | |
644 | 3786 if (eap->cmdidx == CMD_colder || eap->cmdidx == CMD_lolder) |
7 | 3787 { |
644 | 3788 if (qi->qf_curlist == 0) |
7 | 3789 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3790 emsg(_("E380: At bottom of quickfix stack")); |
4371 | 3791 break; |
7 | 3792 } |
644 | 3793 --qi->qf_curlist; |
7 | 3794 } |
3795 else | |
3796 { | |
644 | 3797 if (qi->qf_curlist >= qi->qf_listcount - 1) |
7 | 3798 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
3799 emsg(_("E381: At top of quickfix stack")); |
4371 | 3800 break; |
7 | 3801 } |
644 | 3802 ++qi->qf_curlist; |
7 | 3803 } |
3804 } | |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3805 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
|
3806 qf_update_buffer(qi, NULL); |
7 | 3807 } |
3808 | |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3809 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
3810 * 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
|
3811 */ |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3812 void |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3813 qf_history(exarg_T *eap) |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3814 { |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
3815 qf_info_T *qi = qf_cmd_get_stack(eap, FALSE); |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3816 int i; |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3817 |
16555
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3818 if (eap->addr_count > 0) |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3819 { |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3820 if (qi == NULL) |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3821 { |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3822 emsg(_(e_loclist)); |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3823 return; |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3824 } |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3825 |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3826 // Jump to the specified quickfix list |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3827 if (eap->line2 > 0 && eap->line2 <= qi->qf_listcount) |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3828 { |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3829 qi->qf_curlist = eap->line2 - 1; |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3830 qf_msg(qi, qi->qf_curlist, ""); |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3831 qf_update_buffer(qi, NULL); |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3832 } |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3833 else |
25064
8f2262c72178
patch 8.2.3069: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
24964
diff
changeset
|
3834 emsg(_(e_invalid_range)); |
16555
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3835 |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3836 return; |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3837 } |
1302bc0b80db
patch 8.1.1281: cannot specify a count with :chistory
Bram Moolenaar <Bram@vim.org>
parents:
16543
diff
changeset
|
3838 |
15424
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
3839 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
|
3840 msg(_("No entries")); |
9538
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3841 else |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3842 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
|
3843 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
|
3844 } |
26da1efa9e46
commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954
Christian Brabandt <cb@256bit.org>
parents:
9534
diff
changeset
|
3845 |
7 | 3846 /* |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3847 * 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
|
3848 * associated with the list like context and title are not freed. |
7 | 3849 */ |
3850 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
|
3851 qf_free_items(qf_list_T *qfl) |
7 | 3852 { |
230 | 3853 qfline_T *qfp; |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3854 qfline_T *qfpnext; |
3982 | 3855 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
|
3856 |
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
|
3857 while (qfl->qf_count && qfl->qf_start != NULL) |
7 | 3858 { |
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
|
3859 qfp = qfl->qf_start; |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3860 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
|
3861 if (!stop) |
3949 | 3862 { |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
3863 vim_free(qfp->qf_module); |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3864 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
|
3865 vim_free(qfp->qf_pattern); |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3866 stop = (qfp == qfpnext); |
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
3867 vim_free(qfp); |
3982 | 3868 if (stop) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
3869 // 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
|
3870 // 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
|
3871 // 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
|
3872 qfl->qf_count = 1; |
3949 | 3873 } |
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
|
3874 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
|
3875 --qfl->qf_count; |
7 | 3876 } |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3877 |
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
|
3878 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
|
3879 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
|
3880 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
|
3881 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
|
3882 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
|
3883 |
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
|
3884 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
|
3885 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
|
3886 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
|
3887 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
|
3888 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
|
3889 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
|
3890 qfl->qf_multiscan = FALSE; |
7 | 3891 } |
3892 | |
3893 /* | |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3894 * 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
|
3895 * 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
|
3896 */ |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3897 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
|
3898 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
|
3899 { |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
3900 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
|
3901 |
13244
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13115
diff
changeset
|
3902 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
|
3903 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
|
3904 qfl->qf_ctx = NULL; |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
3905 free_callback(&qfl->qftf_cb); |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
3906 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
|
3907 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
|
3908 } |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3909 |
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
3910 /* |
7 | 3911 * qf_mark_adjust: adjust marks |
3912 */ | |
3913 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3914 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
|
3915 win_T *wp, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3916 linenr_T line1, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3917 linenr_T line2, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3918 long amount, |
7a743053dfd6
patch 8.0.1104: the qf_jump() function is too long
Christian Brabandt <cb@256bit.org>
parents:
12427
diff
changeset
|
3919 long amount_after) |
7 | 3920 { |
230 | 3921 int i; |
3922 qfline_T *qfp; | |
3923 int idx; | |
644 | 3924 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
|
3925 int found_one = FALSE; |
9608
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
3926 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
|
3927 |
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
3928 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
|
3929 return; |
644 | 3930 if (wp != NULL) |
3931 { | |
3932 if (wp->w_llist == NULL) | |
3933 return; | |
3934 qi = wp->w_llist; | |
3935 } | |
3936 | |
3937 for (idx = 0; idx < qi->qf_listcount; ++idx) | |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
3938 { |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
3939 qf_list_T *qfl = qf_get_list(qi, idx); |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
3940 |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
3941 if (!qf_list_empty(qfl)) |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
3942 FOR_ALL_QFL_ITEMS(qfl, qfp, i) |
7 | 3943 if (qfp->qf_fnum == curbuf->b_fnum) |
3944 { | |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
3945 found_one = TRUE; |
7 | 3946 if (qfp->qf_lnum >= line1 && qfp->qf_lnum <= line2) |
3947 { | |
3948 if (amount == MAXLNUM) | |
3949 qfp->qf_cleared = TRUE; | |
3950 else | |
3951 qfp->qf_lnum += amount; | |
3952 } | |
3953 else if (amount_after && qfp->qf_lnum > line2) | |
3954 qfp->qf_lnum += amount_after; | |
3955 } | |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
3956 } |
9201
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
3957 |
692e156c7023
commit https://github.com/vim/vim/commit/2f095a4bc4d786e0ac834f48dd18a94fe2d140e3
Christian Brabandt <cb@256bit.org>
parents:
9197
diff
changeset
|
3958 if (!found_one) |
9608
fa64afb99dda
commit https://github.com/vim/vim/commit/c1542744e788d96fed24dd421f43009288092504
Christian Brabandt <cb@256bit.org>
parents:
9579
diff
changeset
|
3959 curbuf->b_has_qf_entry &= ~buf_has_flag; |
7 | 3960 } |
3961 | |
3962 /* | |
3963 * Make a nice message out of the error character and the error number: | |
3964 * char number message | |
3965 * e or E 0 " error" | |
3966 * w or W 0 " warning" | |
3967 * i or I 0 " info" | |
20729
ada6f26e6eb1
patch 8.2.0917: quickfix entries do not suport a "note" type
Bram Moolenaar <Bram@vim.org>
parents:
20631
diff
changeset
|
3968 * n or N 0 " note" |
7 | 3969 * 0 0 "" |
3970 * other 0 " c" | |
3971 * e or E n " error n" | |
3972 * w or W n " warning n" | |
3973 * i or I n " info n" | |
20729
ada6f26e6eb1
patch 8.2.0917: quickfix entries do not suport a "note" type
Bram Moolenaar <Bram@vim.org>
parents:
20631
diff
changeset
|
3974 * n or N n " note n" |
7 | 3975 * 0 n " error n" |
3976 * other n " c n" | |
3977 * 1 x "" :helpgrep | |
3978 */ | |
3979 static char_u * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3980 qf_types(int c, int nr) |
7 | 3981 { |
3982 static char_u buf[20]; | |
3983 static char_u cc[3]; | |
3984 char_u *p; | |
3985 | |
3986 if (c == 'W' || c == 'w') | |
3987 p = (char_u *)" warning"; | |
3988 else if (c == 'I' || c == 'i') | |
3989 p = (char_u *)" info"; | |
20729
ada6f26e6eb1
patch 8.2.0917: quickfix entries do not suport a "note" type
Bram Moolenaar <Bram@vim.org>
parents:
20631
diff
changeset
|
3990 else if (c == 'N' || c == 'n') |
ada6f26e6eb1
patch 8.2.0917: quickfix entries do not suport a "note" type
Bram Moolenaar <Bram@vim.org>
parents:
20631
diff
changeset
|
3991 p = (char_u *)" note"; |
7 | 3992 else if (c == 'E' || c == 'e' || (c == 0 && nr > 0)) |
3993 p = (char_u *)" error"; | |
3994 else if (c == 0 || c == 1) | |
3995 p = (char_u *)""; | |
3996 else | |
3997 { | |
3998 cc[0] = ' '; | |
3999 cc[1] = c; | |
4000 cc[2] = NUL; | |
4001 p = cc; | |
4002 } | |
4003 | |
4004 if (nr <= 0) | |
4005 return p; | |
4006 | |
4007 sprintf((char *)buf, "%s %3d", (char *)p, nr); | |
4008 return buf; | |
4009 } | |
4010 | |
4011 /* | |
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
|
4012 * 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
|
4013 * 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
|
4014 */ |
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
|
4015 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
|
4016 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
|
4017 { |
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
|
4018 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
|
4019 |
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
|
4020 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
|
4021 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
|
4022 |
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
|
4023 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
|
4024 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
|
4025 |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
4026 if (qf_list_empty(qf_get_curlist(qi))) |
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
|
4027 { |
25306
078edc1821bf
patch 8.2.3190: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
4028 emsg(_(e_no_errors)); |
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
|
4029 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
|
4030 } |
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
|
4031 |
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
|
4032 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
|
4033 { |
15024
3a3c9b638187
patch 8.1.0523: opening window from quickfix leaves empty buffer behind
Bram Moolenaar <Bram@vim.org>
parents:
14976
diff
changeset
|
4034 // 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
|
4035 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
|
4036 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
|
4037 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
|
4038 } |
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
|
4039 |
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
|
4040 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
|
4041 } |
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
|
4042 |
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
|
4043 /* |
7 | 4044 * ":cwindow": open the quickfix window if we have errors to display, |
4045 * close it if not. | |
644 | 4046 * ":lwindow": open the location list window if we have locations to display, |
4047 * close it if not. | |
7 | 4048 */ |
4049 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4050 ex_cwindow(exarg_T *eap) |
7 | 4051 { |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4052 qf_info_T *qi; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4053 qf_list_T *qfl; |
7 | 4054 win_T *win; |
4055 | |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4056 if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4057 return; |
644 | 4058 |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
4059 qfl = qf_get_curlist(qi); |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4060 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4061 // Look for an existing quickfix window. |
644 | 4062 win = qf_find_win(qi); |
7 | 4063 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4064 // 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
|
4065 // 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
|
4066 // 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
|
4067 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
|
4068 || qfl->qf_nonevalid |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
4069 || qf_list_empty(qfl)) |
7 | 4070 { |
4071 if (win != NULL) | |
4072 ex_cclose(eap); | |
4073 } | |
4074 else if (win == NULL) | |
4075 ex_copen(eap); | |
4076 } | |
4077 | |
4078 /* | |
4079 * ":cclose": close the window showing the list of errors. | |
644 | 4080 * ":lclose": close the window showing the location list |
7 | 4081 */ |
4082 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4083 ex_cclose(exarg_T *eap) |
7 | 4084 { |
644 | 4085 win_T *win = NULL; |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4086 qf_info_T *qi; |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4087 |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4088 if ((qi = qf_cmd_get_stack(eap, FALSE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4089 return; |
644 | 4090 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4091 // Find existing quickfix window and close it. |
644 | 4092 win = qf_find_win(qi); |
7 | 4093 if (win != NULL) |
4094 win_close(win, FALSE); | |
4095 } | |
4096 | |
4097 /* | |
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
|
4098 * 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
|
4099 */ |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
4100 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
|
4101 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
|
4102 { |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
4103 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
|
4104 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
|
4105 } |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
4106 |
3ca7aba1116e
patch 8.1.0407: quickfix code mixes using the stack and a list pointer
Christian Brabandt <cb@256bit.org>
parents:
14664
diff
changeset
|
4107 /* |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4108 * 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
|
4109 * 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
|
4110 */ |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4111 static int |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4112 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
|
4113 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4114 win_T *win; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4115 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4116 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
|
4117 if (win == NULL) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4118 return FAIL; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4119 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4120 win_goto(win); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4121 if (resize) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4122 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4123 if (vertsplit) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4124 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4125 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
|
4126 win_setwidth(sz); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4127 } |
18319
4cc8a1a134fc
patch 8.1.2154: quickfix window height wrong when there is a tabline
Bram Moolenaar <Bram@vim.org>
parents:
17950
diff
changeset
|
4128 else if (sz != win->w_height && win->w_height |
4cc8a1a134fc
patch 8.1.2154: quickfix window height wrong when there is a tabline
Bram Moolenaar <Bram@vim.org>
parents:
17950
diff
changeset
|
4129 + win->w_status_height + tabline_height() < cmdline_row) |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4130 win_setheight(sz); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4131 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4132 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4133 return OK; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4134 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4135 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4136 /* |
15965
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4137 * Set options for the buffer in the quickfix or location list window. |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4138 */ |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4139 static void |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4140 qf_set_cwindow_options(void) |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4141 { |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4142 // switch off 'swapfile' |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4143 set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL); |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4144 set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix", |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4145 OPT_LOCAL); |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4146 set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL); |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4147 RESET_BINDING(curwin); |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4148 #ifdef FEAT_DIFF |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4149 curwin->w_p_diff = FALSE; |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4150 #endif |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4151 #ifdef FEAT_FOLDING |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4152 set_option_value((char_u *)"fdm", 0L, (char_u *)"manual", |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4153 OPT_LOCAL); |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4154 #endif |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4155 } |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4156 |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4157 /* |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4158 * 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
|
4159 * 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
|
4160 * 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
|
4161 */ |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4162 static int |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4163 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
|
4164 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4165 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
|
4166 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
|
4167 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
|
4168 int flags = 0; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4169 win_T *win; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4170 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4171 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
|
4172 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4173 // 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
|
4174 win = curwin; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4175 |
22699
e82579016863
patch 8.2.1898: command modifier parsing always uses global cmdmod
Bram Moolenaar <Bram@vim.org>
parents:
22645
diff
changeset
|
4176 if (IS_QF_STACK(qi) && cmdmod.cmod_split == 0) |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4177 // 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
|
4178 // :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
|
4179 win_goto(lastwin); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4180 // Default is to open the window below the current window |
22699
e82579016863
patch 8.2.1898: command modifier parsing always uses global cmdmod
Bram Moolenaar <Bram@vim.org>
parents:
22645
diff
changeset
|
4181 if (cmdmod.cmod_split == 0) |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4182 flags = WSP_BELOW; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4183 flags |= WSP_NEWLOC; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4184 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
|
4185 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
|
4186 RESET_BINDING(curwin); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4187 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4188 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
|
4189 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4190 // 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
|
4191 // 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
|
4192 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
|
4193 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
|
4194 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4195 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4196 if (oldwin != curwin) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4197 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
|
4198 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
|
4199 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4200 // Use the existing quickfix buffer |
22979
fab8455af19c
patch 8.2.2036: buffer messed up if creating the quickfix window fails
Bram Moolenaar <Bram@vim.org>
parents:
22870
diff
changeset
|
4201 if (do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE, |
fab8455af19c
patch 8.2.2036: buffer messed up if creating the quickfix window fails
Bram Moolenaar <Bram@vim.org>
parents:
22870
diff
changeset
|
4202 ECMD_HIDE + ECMD_OLDBUF, oldwin) == FAIL) |
fab8455af19c
patch 8.2.2036: buffer messed up if creating the quickfix window fails
Bram Moolenaar <Bram@vim.org>
parents:
22870
diff
changeset
|
4203 return FAIL; |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4204 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4205 else |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4206 { |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4207 // Create a new quickfix buffer |
22979
fab8455af19c
patch 8.2.2036: buffer messed up if creating the quickfix window fails
Bram Moolenaar <Bram@vim.org>
parents:
22870
diff
changeset
|
4208 if (do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin) == FAIL) |
fab8455af19c
patch 8.2.2036: buffer messed up if creating the quickfix window fails
Bram Moolenaar <Bram@vim.org>
parents:
22870
diff
changeset
|
4209 return FAIL; |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4210 |
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
|
4211 // 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
|
4212 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
|
4213 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4214 |
15965
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4215 // Set the options for the quickfix buffer/window (if not already done) |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4216 // Do this even if the quickfix buffer was already present, as an autocmd |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4217 // might have previously deleted (:bdelete) the quickfix buffer. |
17099
54b3059311b5
patch 8.1.1549: quickfix test fails
Bram Moolenaar <Bram@vim.org>
parents:
17095
diff
changeset
|
4218 if (!bt_quickfix(curbuf)) |
15965
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4219 qf_set_cwindow_options(); |
f376cd250b07
patch 8.1.0988: deleting location list buffer breaks location list window
Bram Moolenaar <Bram@vim.org>
parents:
15770
diff
changeset
|
4220 |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4221 // 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
|
4222 // 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
|
4223 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
|
4224 win_setheight(height); |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4225 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
|
4226 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
|
4227 prevwin = win; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4228 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4229 return OK; |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4230 } |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4231 |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4232 /* |
7 | 4233 * ":copen": open a window that shows the list of errors. |
644 | 4234 * ":lopen": open a window that shows the location list. |
7 | 4235 */ |
4236 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4237 ex_copen(exarg_T *eap) |
7 | 4238 { |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4239 qf_info_T *qi; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4240 qf_list_T *qfl; |
7 | 4241 int height; |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4242 int status = FAIL; |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4243 int lnum; |
7 | 4244 |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4245 if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4246 return; |
644 | 4247 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4248 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4249 |
7 | 4250 if (eap->addr_count != 0) |
4251 height = eap->line2; | |
4252 else | |
4253 height = QF_WINHEIGHT; | |
4254 | |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4255 reset_VIsual_and_resel(); // stop Visual mode |
7 | 4256 #ifdef FEAT_GUI |
4257 need_mouse_correct = TRUE; | |
4258 #endif | |
4259 | |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4260 // Find an existing quickfix window, or open a new one. |
22699
e82579016863
patch 8.2.1898: command modifier parsing always uses global cmdmod
Bram Moolenaar <Bram@vim.org>
parents:
22645
diff
changeset
|
4261 if (cmdmod.cmod_tab == 0) |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4262 status = qf_goto_cwindow(qi, eap->addr_count != 0, height, |
22699
e82579016863
patch 8.2.1898: command modifier parsing always uses global cmdmod
Bram Moolenaar <Bram@vim.org>
parents:
22645
diff
changeset
|
4263 cmdmod.cmod_split & WSP_VERT); |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4264 if (status == FAIL) |
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4265 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
|
4266 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4267 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
|
4268 return; |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4269 } |
7 | 4270 |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
4271 qfl = qf_get_curlist(qi); |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4272 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
|
4273 // 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
|
4274 // the quickfix list |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4275 lnum = qfl->qf_index; |
6793 | 4276 |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4277 // Fill the buffer with the quickfix list. |
20762
68170c89e355
patch 8.2.0933: 'quickfixtextfunc' does not get window ID of location list
Bram Moolenaar <Bram@vim.org>
parents:
20729
diff
changeset
|
4278 qf_fill_buffer(qfl, curbuf, NULL, curwin->w_id); |
644 | 4279 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4280 decr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4281 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
4282 curwin->w_cursor.lnum = lnum; |
7 | 4283 curwin->w_cursor.col = 0; |
4284 check_cursor(); | |
14796
74fd69162d50
patch 8.1.0410: the ex_copen() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14790
diff
changeset
|
4285 update_topline(); // scroll to show the line |
7 | 4286 } |
4287 | |
4288 /* | |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4289 * 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
|
4290 */ |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4291 static void |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4292 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
|
4293 { |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4294 win_T *old_curwin = curwin; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4295 |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4296 curwin = win; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4297 curbuf = win->w_buffer; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4298 curwin->w_cursor.lnum = lnum; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4299 curwin->w_cursor.col = 0; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4300 curwin->w_cursor.coladd = 0; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4301 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
|
4302 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
|
4303 redraw_later(VALID); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4304 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
|
4305 curwin = old_curwin; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4306 curbuf = curwin->w_buffer; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4307 } |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4308 |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4309 /* |
9458
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4310 * :cbottom/:lbottom commands. |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4311 */ |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4312 void |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
4313 ex_cbottom(exarg_T *eap) |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4314 { |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4315 qf_info_T *qi; |
9458
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4316 win_T *win; |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4317 |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4318 if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
4319 return; |
9458
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4320 |
374afcf9d11d
commit https://github.com/vim/vim/commit/537ef08408c50e0c4104d57f74993b3b0ed9560d
Christian Brabandt <cb@256bit.org>
parents:
9432
diff
changeset
|
4321 win = qf_find_win(qi); |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4322 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
|
4323 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
|
4324 } |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4325 |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4326 /* |
7 | 4327 * Return the number of the current entry (line number in the quickfix |
4328 * window). | |
4329 */ | |
4330 linenr_T | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4331 qf_current_entry(win_T *wp) |
7 | 4332 { |
644 | 4333 qf_info_T *qi = &ql_info; |
4334 | |
4335 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
|
4336 // In the location list window, use the referenced location list |
644 | 4337 qi = wp->w_llist_ref; |
4338 | |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
4339 return qf_get_curlist(qi)->qf_index; |
7 | 4340 } |
4341 | |
4342 /* | |
4343 * Update the cursor position in the quickfix window to the current error. | |
4344 * Return TRUE if there is a quickfix window. | |
4345 */ | |
4346 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4347 qf_win_pos_update( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4348 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
|
4349 int old_qf_index) // previous qf_index or zero |
7 | 4350 { |
4351 win_T *win; | |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
4352 int qf_index = qf_get_curlist(qi)->qf_index; |
7 | 4353 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4354 // 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
|
4355 // it's viewable. |
644 | 4356 win = qf_find_win(qi); |
7 | 4357 if (win != NULL |
4358 && qf_index <= win->w_buffer->b_ml.ml_line_count | |
4359 && old_qf_index != qf_index) | |
4360 { | |
4361 if (qf_index > old_qf_index) | |
4362 { | |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4363 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
|
4364 win->w_redraw_bot = qf_index; |
7 | 4365 } |
4366 else | |
4367 { | |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4368 win->w_redraw_top = qf_index; |
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4369 win->w_redraw_bot = old_qf_index; |
7 | 4370 } |
9432
abb72f0b9e06
commit https://github.com/vim/vim/commit/dcb170018642ec144cd87d9d9fe076575b8d1263
Christian Brabandt <cb@256bit.org>
parents:
9397
diff
changeset
|
4371 qf_win_goto(win, qf_index); |
7 | 4372 } |
4373 return win != NULL; | |
4374 } | |
4375 | |
4376 /* | |
859 | 4377 * 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
|
4378 * stack. |
859 | 4379 */ |
4380 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4381 is_qf_win(win_T *win, qf_info_T *qi) |
859 | 4382 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4383 // 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
|
4384 // set to NULL. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4385 // 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
|
4386 // pointing to the location list. |
859 | 4387 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
|
4388 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
|
4389 || (IS_LL_STACK(qi) && win->w_llist_ref == qi)) |
859 | 4390 return TRUE; |
4391 | |
4392 return FALSE; | |
4393 } | |
4394 | |
4395 /* | |
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
|
4396 * 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
|
4397 * Only searches in the current tabpage. |
644 | 4398 */ |
4399 static win_T * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4400 qf_find_win(qf_info_T *qi) |
644 | 4401 { |
4402 win_T *win; | |
4403 | |
4404 FOR_ALL_WINDOWS(win) | |
859 | 4405 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
|
4406 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
|
4407 return NULL; |
644 | 4408 } |
4409 | |
4410 /* | |
859 | 4411 * Find a quickfix buffer. |
4412 * Searches in windows opened in all the tabs. | |
7 | 4413 */ |
4414 static buf_T * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4415 qf_find_buf(qf_info_T *qi) |
7 | 4416 { |
859 | 4417 tabpage_T *tp; |
644 | 4418 win_T *win; |
4419 | |
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
|
4420 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
|
4421 { |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4422 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
|
4423 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
|
4424 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
|
4425 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
|
4426 // 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
|
4427 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
|
4428 } |
2fe4a503c5ad
patch 8.1.0877: new buffer used every time the quickfix window is opened
Bram Moolenaar <Bram@vim.org>
parents:
15703
diff
changeset
|
4429 |
859 | 4430 FOR_ALL_TAB_WINDOWS(tp, win) |
4431 if (is_qf_win(win, qi)) | |
4432 return win->w_buffer; | |
4433 | |
4434 return NULL; | |
7 | 4435 } |
4436 | |
4437 /* | |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4438 * Process the 'quickfixtextfunc' option value. |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4439 */ |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4440 int |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4441 qf_process_qftf_option(void) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4442 { |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4443 typval_T *tv; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4444 callback_T cb; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4445 |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4446 if (p_qftf == NULL || *p_qftf == NUL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4447 { |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4448 free_callback(&qftf_cb); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4449 return TRUE; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4450 } |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4451 |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4452 if (*p_qftf == '{') |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4453 { |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4454 // Lambda expression |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4455 tv = eval_expr(p_qftf, NULL); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4456 if (tv == NULL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4457 return FALSE; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4458 } |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4459 else |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4460 { |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4461 // treat everything else as a function name string |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4462 tv = alloc_string_tv(vim_strsave(p_qftf)); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4463 if (tv == NULL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4464 return FALSE; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4465 } |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4466 |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4467 cb = get_callback(tv); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4468 if (cb.cb_name == NULL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4469 { |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4470 free_tv(tv); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4471 return FALSE; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4472 } |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4473 |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4474 free_callback(&qftf_cb); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4475 set_callback(&qftf_cb, &cb); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4476 free_tv(tv); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4477 return TRUE; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4478 } |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4479 |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4480 /* |
23203
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4481 * Update the w:quickfix_title variable in the quickfix/location list window in |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4482 * all the tab pages. |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4483 */ |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4484 static void |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4485 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
|
4486 { |
23203
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4487 qf_list_T *qfl = qf_get_curlist(qi); |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4488 tabpage_T *tp; |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4489 win_T *win; |
23203
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4490 win_T *save_curwin = curwin; |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4491 |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4492 FOR_ALL_TAB_WINDOWS(tp, win) |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4493 { |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4494 if (is_qf_win(win, qi)) |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4495 { |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4496 curwin = win; |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4497 qf_set_title_var(qfl); |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4498 } |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4499 } |
db97415750ce
patch 8.2.2147: quickfix window title not updated in all tab pages
Bram Moolenaar <Bram@vim.org>
parents:
23045
diff
changeset
|
4500 curwin = save_curwin; |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4501 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4502 |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4503 /* |
7 | 4504 * Find the quickfix buffer. If it exists, update the contents. |
4505 */ | |
4506 static void | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4507 qf_update_buffer(qf_info_T *qi, qfline_T *old_last) |
7 | 4508 { |
4509 buf_T *buf; | |
3016 | 4510 win_T *win; |
7 | 4511 aco_save_T aco; |
4512 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4513 // Check if a buffer for the quickfix list exists. Update it. |
644 | 4514 buf = qf_find_buf(qi); |
7 | 4515 if (buf != NULL) |
4516 { | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4517 linenr_T old_line_count = buf->b_ml.ml_line_count; |
20762
68170c89e355
patch 8.2.0933: 'quickfixtextfunc' does not get window ID of location list
Bram Moolenaar <Bram@vim.org>
parents:
20729
diff
changeset
|
4518 int qf_winid = 0; |
68170c89e355
patch 8.2.0933: 'quickfixtextfunc' does not get window ID of location list
Bram Moolenaar <Bram@vim.org>
parents:
20729
diff
changeset
|
4519 |
68170c89e355
patch 8.2.0933: 'quickfixtextfunc' does not get window ID of location list
Bram Moolenaar <Bram@vim.org>
parents:
20729
diff
changeset
|
4520 if (IS_LL_STACK(qi)) |
24962
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4521 { |
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4522 if (curwin->w_llist == qi) |
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4523 win = curwin; |
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4524 else |
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4525 { |
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4526 win = qf_find_win_with_loclist(qi); |
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4527 if (win == NULL) |
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4528 return; |
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4529 } |
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4530 qf_winid = win->w_id; |
437b8be91993
patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4531 } |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4532 |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4533 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
|
4534 // 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
|
4535 aucmd_prepbuf(&aco, buf); |
7 | 4536 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
4537 qf_update_win_titlevar(qi); |
3016 | 4538 |
20762
68170c89e355
patch 8.2.0933: 'quickfixtextfunc' does not get window ID of location list
Bram Moolenaar <Bram@vim.org>
parents:
20729
diff
changeset
|
4539 qf_fill_buffer(qf_get_curlist(qi), buf, old_last, qf_winid); |
11705
c43118ecb0a3
patch 8.0.0735: no indication that the quickfix window/buffer changed
Christian Brabandt <cb@256bit.org>
parents:
11700
diff
changeset
|
4540 ++CHANGEDTICK(buf); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4541 |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4542 if (old_last == NULL) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4543 { |
8932
25c2031e9f9f
commit https://github.com/vim/vim/commit/c1808d5822ed9534ef7f0fe509b15bee92a5cc28
Christian Brabandt <cb@256bit.org>
parents:
8751
diff
changeset
|
4544 (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
|
4545 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4546 // 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
|
4547 aucmd_restbuf(&aco); |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4548 } |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4549 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4550 // 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
|
4551 // 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
|
4552 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
|
4553 redraw_buf_later(buf, NOT_VALID); |
7 | 4554 } |
4555 } | |
4556 | |
6793 | 4557 /* |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4558 * 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
|
4559 */ |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4560 static int |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4561 qf_buf_add_line( |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4562 buf_T *buf, // quickfix window buffer |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4563 linenr_T lnum, |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4564 qfline_T *qfp, |
20762
68170c89e355
patch 8.2.0933: 'quickfixtextfunc' does not get window ID of location list
Bram Moolenaar <Bram@vim.org>
parents:
20729
diff
changeset
|
4565 char_u *dirname, |
22454
849c6f766b19
patch 8.2.1775: MS-Windows: adding a long quickfix list is slow
Bram Moolenaar <Bram@vim.org>
parents:
22256
diff
changeset
|
4566 int first_bufline, |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4567 char_u *qftf_str) |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4568 { |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4569 int len; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4570 buf_T *errbuf; |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4571 |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4572 // If the 'quickfixtextfunc' function returned an non-empty custom string |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4573 // for this entry, then use it. |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4574 if (qftf_str != NULL && *qftf_str != NUL) |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4575 vim_strncpy(IObuff, qftf_str, IOSIZE - 1); |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4576 else |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4577 { |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4578 if (qfp->qf_module != NULL) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4579 { |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4580 vim_strncpy(IObuff, qfp->qf_module, IOSIZE - 1); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4581 len = (int)STRLEN(IObuff); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4582 } |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4583 else if (qfp->qf_fnum != 0 |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4584 && (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4585 && errbuf->b_fname != NULL) |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4586 { |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4587 if (qfp->qf_type == 1) // :helpgrep |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4588 vim_strncpy(IObuff, gettail(errbuf->b_fname), IOSIZE - 1); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4589 else |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4590 { |
22454
849c6f766b19
patch 8.2.1775: MS-Windows: adding a long quickfix list is slow
Bram Moolenaar <Bram@vim.org>
parents:
22256
diff
changeset
|
4591 // Shorten the file name if not done already. |
849c6f766b19
patch 8.2.1775: MS-Windows: adding a long quickfix list is slow
Bram Moolenaar <Bram@vim.org>
parents:
22256
diff
changeset
|
4592 // For optimization, do this only for the first entry in a |
849c6f766b19
patch 8.2.1775: MS-Windows: adding a long quickfix list is slow
Bram Moolenaar <Bram@vim.org>
parents:
22256
diff
changeset
|
4593 // buffer. |
849c6f766b19
patch 8.2.1775: MS-Windows: adding a long quickfix list is slow
Bram Moolenaar <Bram@vim.org>
parents:
22256
diff
changeset
|
4594 if (first_bufline && (errbuf->b_sfname == NULL |
849c6f766b19
patch 8.2.1775: MS-Windows: adding a long quickfix list is slow
Bram Moolenaar <Bram@vim.org>
parents:
22256
diff
changeset
|
4595 || mch_isFullName(errbuf->b_sfname))) |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4596 { |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4597 if (*dirname == NUL) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4598 mch_dirname(dirname, MAXPATHL); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4599 shorten_buf_fname(errbuf, dirname, FALSE); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4600 } |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4601 vim_strncpy(IObuff, errbuf->b_fname, IOSIZE - 1); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4602 } |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4603 len = (int)STRLEN(IObuff); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4604 } |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4605 else |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4606 len = 0; |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4607 |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4608 if (len < IOSIZE - 1) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4609 IObuff[len++] = '|'; |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4610 |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4611 if (qfp->qf_lnum > 0) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4612 { |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
4613 qf_range_text(qfp, IObuff + len, IOSIZE - len); |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4614 len += (int)STRLEN(IObuff + len); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4615 |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4616 vim_snprintf((char *)IObuff + len, IOSIZE - len, "%s", |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4617 (char *)qf_types(qfp->qf_type, qfp->qf_nr)); |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4618 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
|
4619 } |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4620 else if (qfp->qf_pattern != NULL) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4621 { |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4622 qf_fmt_text(qfp->qf_pattern, IObuff + len, IOSIZE - len); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4623 len += (int)STRLEN(IObuff + len); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4624 } |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4625 if (len < IOSIZE - 2) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4626 { |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4627 IObuff[len++] = '|'; |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4628 IObuff[len++] = ' '; |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4629 } |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4630 |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4631 // Remove newlines and leading whitespace from the text. |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4632 // For an unrecognized line keep the indent, the compiler may |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4633 // mark a word with ^^^^. |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4634 qf_fmt_text(len > 3 ? skipwhite(qfp->qf_text) : qfp->qf_text, |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4635 IObuff + len, IOSIZE - len); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
4636 } |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4637 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4638 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
|
4639 (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
|
4640 return FAIL; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4641 |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4642 return OK; |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4643 } |
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4644 |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4645 /* |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4646 * Call the 'quickfixtextfunc' function to get the list of lines to display in |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4647 * the quickfix window for the entries 'start_idx' to 'end_idx'. |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4648 */ |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4649 static list_T * |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4650 call_qftf_func(qf_list_T *qfl, int qf_winid, long start_idx, long end_idx) |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4651 { |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4652 callback_T *cb = &qftf_cb; |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4653 list_T *qftf_list = NULL; |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4654 |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4655 // If 'quickfixtextfunc' is set, then use the user-supplied function to get |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4656 // the text to display. Use the local value of 'quickfixtextfunc' if it is |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4657 // set. |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4658 if (qfl->qftf_cb.cb_name != NULL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4659 cb = &qfl->qftf_cb; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4660 if (cb != NULL && cb->cb_name != NULL) |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4661 { |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4662 typval_T args[1]; |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4663 dict_T *d; |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4664 typval_T rettv; |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4665 |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4666 // create the dict argument |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4667 if ((d = dict_alloc_lock(VAR_FIXED)) == NULL) |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4668 return NULL; |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4669 dict_add_number(d, "quickfix", (long)IS_QF_LIST(qfl)); |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4670 dict_add_number(d, "winid", (long)qf_winid); |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4671 dict_add_number(d, "id", (long)qfl->qf_id); |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4672 dict_add_number(d, "start_idx", start_idx); |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4673 dict_add_number(d, "end_idx", end_idx); |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4674 ++d->dv_refcount; |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4675 args[0].v_type = VAR_DICT; |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4676 args[0].vval.v_dict = d; |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4677 |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4678 qftf_list = NULL; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4679 if (call_callback(cb, 0, &rettv, 1, args) != FAIL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4680 { |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4681 if (rettv.v_type == VAR_LIST) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4682 { |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4683 qftf_list = rettv.vval.v_list; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4684 qftf_list->lv_refcount++; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4685 } |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4686 clear_tv(&rettv); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4687 } |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4688 dict_unref(d); |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4689 } |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4690 |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4691 return qftf_list; |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4692 } |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4693 |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4694 /* |
7 | 4695 * Fill current buffer with quickfix errors, replacing any previous contents. |
4696 * 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
|
4697 * 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
|
4698 * 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
|
4699 * ml_delete() is used and autocommands will be triggered. |
7 | 4700 */ |
4701 static void | |
20762
68170c89e355
patch 8.2.0933: 'quickfixtextfunc' does not get window ID of location list
Bram Moolenaar <Bram@vim.org>
parents:
20729
diff
changeset
|
4702 qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid) |
7 | 4703 { |
230 | 4704 linenr_T lnum; |
4705 qfline_T *qfp; | |
4706 int old_KeyTyped = KeyTyped; | |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4707 list_T *qftf_list = NULL; |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4708 listitem_T *qftf_li = NULL; |
7 | 4709 |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4710 if (old_last == NULL) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4711 { |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4712 if (buf != curbuf) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4713 { |
10359
66f1b5bf3fa6
commit https://github.com/vim/vim/commit/95f096030ed1a8afea028f2ea295d6f6a70f466f
Christian Brabandt <cb@256bit.org>
parents:
10349
diff
changeset
|
4714 internal_error("qf_fill_buffer()"); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4715 return; |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4716 } |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4717 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4718 // delete all existing lines |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4719 while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0) |
20599
d571231175b4
patch 8.2.0853: ml_delete() often called with FALSE argument
Bram Moolenaar <Bram@vim.org>
parents:
20007
diff
changeset
|
4720 (void)ml_delete((linenr_T)1); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4721 } |
7 | 4722 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4723 // Check if there is anything to display |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
4724 if (qfl != NULL) |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
4725 { |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4726 char_u dirname[MAXPATHL]; |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4727 int invalid_val = FALSE; |
22454
849c6f766b19
patch 8.2.1775: MS-Windows: adding a long quickfix list is slow
Bram Moolenaar <Bram@vim.org>
parents:
22256
diff
changeset
|
4728 int prev_bufnr = -1; |
13819
31bb8e1f7625
patch 8.0.1781: file names in quickfix window are not shortened
Christian Brabandt <cb@256bit.org>
parents:
13802
diff
changeset
|
4729 |
31bb8e1f7625
patch 8.0.1781: file names in quickfix window are not shortened
Christian Brabandt <cb@256bit.org>
parents:
13802
diff
changeset
|
4730 *dirname = NUL; |
31bb8e1f7625
patch 8.0.1781: file names in quickfix window are not shortened
Christian Brabandt <cb@256bit.org>
parents:
13802
diff
changeset
|
4731 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4732 // Add one line for each error |
22870
69b48d2822ec
patch 8.2.1982: quickfix window now updated when adding invalid entries
Bram Moolenaar <Bram@vim.org>
parents:
22699
diff
changeset
|
4733 if (old_last == NULL) |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4734 { |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4735 qfp = qfl->qf_start; |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4736 lnum = 0; |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4737 } |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4738 else |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4739 { |
22870
69b48d2822ec
patch 8.2.1982: quickfix window now updated when adding invalid entries
Bram Moolenaar <Bram@vim.org>
parents:
22699
diff
changeset
|
4740 if (old_last->qf_next != NULL) |
69b48d2822ec
patch 8.2.1982: quickfix window now updated when adding invalid entries
Bram Moolenaar <Bram@vim.org>
parents:
22699
diff
changeset
|
4741 qfp = old_last->qf_next; |
69b48d2822ec
patch 8.2.1982: quickfix window now updated when adding invalid entries
Bram Moolenaar <Bram@vim.org>
parents:
22699
diff
changeset
|
4742 else |
69b48d2822ec
patch 8.2.1982: quickfix window now updated when adding invalid entries
Bram Moolenaar <Bram@vim.org>
parents:
22699
diff
changeset
|
4743 qfp = old_last; |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4744 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
|
4745 } |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4746 |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4747 qftf_list = call_qftf_func(qfl, qf_winid, (long)(lnum + 1), |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4748 (long)qfl->qf_count); |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4749 if (qftf_list != NULL) |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4750 qftf_li = qftf_list->lv_first; |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4751 |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4752 while (lnum < qfl->qf_count) |
7 | 4753 { |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4754 char_u *qftf_str = NULL; |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4755 |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4756 // Use the text supplied by the user defined function (if any). |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4757 // If the returned value is not string, then ignore the rest |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4758 // of the returned values and use the default. |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4759 if (qftf_li != NULL && !invalid_val) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4760 { |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4761 qftf_str = tv_get_string_chk(&qftf_li->li_tv); |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4762 if (qftf_str == NULL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4763 invalid_val = TRUE; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
4764 } |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4765 |
22454
849c6f766b19
patch 8.2.1775: MS-Windows: adding a long quickfix list is slow
Bram Moolenaar <Bram@vim.org>
parents:
22256
diff
changeset
|
4766 if (qf_buf_add_line(buf, lnum, qfp, dirname, |
849c6f766b19
patch 8.2.1775: MS-Windows: adding a long quickfix list is slow
Bram Moolenaar <Bram@vim.org>
parents:
22256
diff
changeset
|
4767 prev_bufnr != qfp->qf_fnum, qftf_str) == FAIL) |
7 | 4768 break; |
13992
710b1bb82f2c
patch 8.1.0014: qf_init_ext() is too long
Christian Brabandt <cb@256bit.org>
parents:
13984
diff
changeset
|
4769 |
22454
849c6f766b19
patch 8.2.1775: MS-Windows: adding a long quickfix list is slow
Bram Moolenaar <Bram@vim.org>
parents:
22256
diff
changeset
|
4770 prev_bufnr = qfp->qf_fnum; |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4771 ++lnum; |
7 | 4772 qfp = qfp->qf_next; |
9195
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
4773 if (qfp == NULL) |
543f068f3706
commit https://github.com/vim/vim/commit/83e6d7ac6a1c2a0cb5ee6c8420a5dc792f1d5ffa
Christian Brabandt <cb@256bit.org>
parents:
9175
diff
changeset
|
4774 break; |
20814
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4775 |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4776 if (qftf_li != NULL) |
f23c6543a54d
patch 8.2.0959: using 'quickfixtextfunc' is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20764
diff
changeset
|
4777 qftf_li = qftf_li->li_next; |
7 | 4778 } |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4779 |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4780 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
|
4781 // Delete the empty line which is now at the end |
20599
d571231175b4
patch 8.2.0853: ml_delete() often called with FALSE argument
Bram Moolenaar <Bram@vim.org>
parents:
20007
diff
changeset
|
4782 (void)ml_delete(lnum + 1); |
7 | 4783 } |
4784 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4785 // correct cursor position |
7 | 4786 check_lnums(TRUE); |
4787 | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4788 if (old_last == NULL) |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4789 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4790 // 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
|
4791 // 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
|
4792 // using autocommands. |
11589
39787def24bb
patch 8.0.0677: setting 'filetype' may switch buffers
Christian Brabandt <cb@256bit.org>
parents:
11549
diff
changeset
|
4793 ++curbuf_lock; |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4794 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
|
4795 curbuf->b_p_ma = FALSE; |
7 | 4796 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4797 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
|
4798 apply_autocmds(EVENT_BUFREADPOST, (char_u *)"quickfix", NULL, |
7 | 4799 FALSE, curbuf); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4800 apply_autocmds(EVENT_BUFWINENTER, (char_u *)"quickfix", NULL, |
7 | 4801 FALSE, curbuf); |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4802 keep_filetype = FALSE; |
11589
39787def24bb
patch 8.0.0677: setting 'filetype' may switch buffers
Christian Brabandt <cb@256bit.org>
parents:
11549
diff
changeset
|
4803 --curbuf_lock; |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
4804 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4805 // 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
|
4806 redraw_curbuf_later(NOT_VALID); |
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
4807 } |
7 | 4808 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
4809 // Restore KeyTyped, setting 'filetype' may reset it. |
7 | 4810 KeyTyped = old_KeyTyped; |
4811 } | |
4812 | |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
4813 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
4814 * 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
|
4815 */ |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
4816 static void |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4817 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
|
4818 { |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
4819 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
|
4820 } |
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
4821 |
7 | 4822 /* |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4823 * 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
|
4824 * 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
|
4825 */ |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4826 static int |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4827 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
|
4828 { |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4829 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
|
4830 |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4831 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
|
4832 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
|
4833 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
|
4834 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
|
4835 } |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4836 |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
4837 /* |
14495
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4838 * 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
|
4839 * 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
|
4840 * 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
|
4841 * 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
|
4842 * 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
|
4843 */ |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4844 static int |
14495
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4845 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
|
4846 { |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4847 int curlist; |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4848 |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
4849 if (qf_get_curlist(qi)->qf_id != save_qfid) |
14495
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4850 { |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4851 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
|
4852 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
|
4853 // 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
|
4854 return FAIL; |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4855 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
|
4856 } |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4857 return OK; |
14495
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4858 } |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4859 |
178162aeebeb
patch 8.1.0261: Coverity complains about a negative array index
Christian Brabandt <cb@256bit.org>
parents:
14491
diff
changeset
|
4860 /* |
14469
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4861 * 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
|
4862 */ |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4863 static void |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4864 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
|
4865 { |
14507
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4866 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
|
4867 return; |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4868 |
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
4869 // Autocommands might have cleared the list, check for that. |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
4870 if (!qf_list_empty(qf_get_curlist(qi))) |
14469
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4871 qf_jump(qi, 0, 0, forceit); |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4872 } |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4873 |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
4874 /* |
41 | 4875 * Return TRUE when using ":vimgrep" for ":grep". |
4876 */ | |
4877 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4878 grep_internal(cmdidx_T cmdidx) |
41 | 4879 { |
661 | 4880 return ((cmdidx == CMD_grep |
4881 || cmdidx == CMD_lgrep | |
4882 || cmdidx == CMD_grepadd | |
4883 || cmdidx == CMD_lgrepadd) | |
41 | 4884 && STRCMP("internal", |
4885 *curbuf->b_p_gp == NUL ? p_gp : curbuf->b_p_gp) == 0); | |
4886 } | |
4887 | |
4888 /* | |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4889 * 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
|
4890 */ |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4891 static char_u * |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4892 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
|
4893 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4894 switch (cmdidx) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4895 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4896 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
|
4897 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
|
4898 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
|
4899 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
|
4900 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
|
4901 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
|
4902 default: return NULL; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4903 } |
7 | 4904 } |
4905 | |
4906 /* | |
4907 * Return the name for the errorfile, in allocated memory. | |
4908 * Find a new unique name when 'makeef' contains "##". | |
4909 * Returns NULL for error. | |
4910 */ | |
4911 static char_u * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4912 get_mef_name(void) |
7 | 4913 { |
4914 char_u *p; | |
4915 char_u *name; | |
4916 static int start = -1; | |
4917 static int off = 0; | |
4918 #ifdef HAVE_LSTAT | |
9387
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
9379
diff
changeset
|
4919 stat_T sb; |
7 | 4920 #endif |
4921 | |
4922 if (*p_mef == NUL) | |
4923 { | |
6721 | 4924 name = vim_tempname('e', FALSE); |
7 | 4925 if (name == NULL) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
4926 emsg(_(e_notmp)); |
7 | 4927 return name; |
4928 } | |
4929 | |
4930 for (p = p_mef; *p; ++p) | |
4931 if (p[0] == '#' && p[1] == '#') | |
4932 break; | |
4933 | |
4934 if (*p == NUL) | |
4935 return vim_strsave(p_mef); | |
4936 | |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4937 // Keep trying until the name doesn't exist yet. |
7 | 4938 for (;;) |
4939 { | |
4940 if (start == -1) | |
4941 start = mch_get_pid(); | |
4942 else | |
4943 off += 19; | |
4944 | |
16764
ef00b6bc186b
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
16619
diff
changeset
|
4945 name = alloc(STRLEN(p_mef) + 30); |
7 | 4946 if (name == NULL) |
4947 break; | |
4948 STRCPY(name, p_mef); | |
4949 sprintf((char *)name + (p - p_mef), "%d%d", start, off); | |
4950 STRCAT(name, p + 2); | |
4951 if (mch_getperm(name) < 0 | |
4952 #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
|
4953 // Don't accept a symbolic link, it's a security risk. |
7 | 4954 && mch_lstat((char *)name, &sb) < 0 |
4955 #endif | |
4956 ) | |
4957 break; | |
4958 vim_free(name); | |
4959 } | |
4960 return name; | |
4961 } | |
4962 | |
4963 /* | |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4964 * 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
|
4965 * 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
|
4966 */ |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4967 static char_u * |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4968 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
|
4969 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4970 char_u *cmd; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4971 unsigned len; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4972 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4973 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
|
4974 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
|
4975 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
|
4976 cmd = alloc(len); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4977 if (cmd == NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4978 return NULL; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4979 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
|
4980 (char *)p_shq); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4981 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4982 // 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
|
4983 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
|
4984 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
|
4985 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4986 // 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
|
4987 // 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
|
4988 // in column 0). |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4989 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
|
4990 msg_didout = FALSE; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4991 msg_start(); |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
4992 msg_puts(":!"); |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4993 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
|
4994 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4995 return cmd; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4996 } |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4997 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4998 /* |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
4999 * 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
|
5000 */ |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5001 void |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5002 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
|
5003 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5004 char_u *fname; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5005 char_u *cmd; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5006 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
|
5007 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
|
5008 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
|
5009 int res; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5010 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
|
5011 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
|
5012 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5013 // 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
|
5014 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
|
5015 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5016 ex_vimgrep(eap); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5017 return; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5018 } |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5019 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5020 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
|
5021 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
|
5022 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
|
5023 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5024 #ifdef FEAT_EVAL |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5025 if (aborting()) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5026 return; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5027 #endif |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5028 } |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5029 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
|
5030 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5031 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
|
5032 wp = curwin; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5033 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5034 autowrite_all(); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5035 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
|
5036 if (fname == NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5037 return; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5038 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
|
5039 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5040 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
|
5041 if (cmd == NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5042 return; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5043 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5044 // 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
|
5045 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
|
5046 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5047 #ifdef AMIGA |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5048 out_flush(); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5049 // 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
|
5050 (void)char_avail(); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5051 #endif |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5052 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5053 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5054 |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5055 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
|
5056 && 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
|
5057 (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
|
5058 && 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
|
5059 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
|
5060 if (wp != NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5061 { |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5062 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
|
5063 if (qi == NULL) |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5064 goto cleanup; |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5065 } |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5066 if (res >= 0) |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5067 qf_list_changed(qf_get_curlist(qi)); |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5068 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5069 // 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
|
5070 // check for autocommands changing the current quickfix list. |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5071 save_qfid = qf_get_curlist(qi)->qf_id; |
14852
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5072 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
|
5073 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
|
5074 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
|
5075 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
|
5076 // 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
|
5077 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
|
5078 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5079 cleanup: |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5080 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
|
5081 mch_remove(fname); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5082 vim_free(fname); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5083 vim_free(cmd); |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5084 } |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5085 |
3c8a4b25427c
patch 8.1.0438: the ex_make() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14844
diff
changeset
|
5086 /* |
16515
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5087 * Returns the number of entries in the current quickfix/location list. |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5088 */ |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5089 int |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5090 qf_get_size(exarg_T *eap) |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5091 { |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5092 qf_info_T *qi; |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5093 |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5094 if ((qi = qf_cmd_get_stack(eap, FALSE)) == NULL) |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5095 return 0; |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5096 return qf_get_curlist(qi)->qf_count; |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5097 } |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5098 |
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5099 /* |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5100 * 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
|
5101 */ |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5102 int |
16515
6e87a69b8e0c
patch 8.1.1261: no error for quickfix commands with negative range
Bram Moolenaar <Bram@vim.org>
parents:
16505
diff
changeset
|
5103 qf_get_valid_size(exarg_T *eap) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5104 { |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5105 qf_info_T *qi; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
5106 qf_list_T *qfl; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5107 qfline_T *qfp; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5108 int i, sz = 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5109 int prev_fnum = 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5110 |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5111 if ((qi = qf_cmd_get_stack(eap, FALSE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5112 return 0; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5113 |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5114 qfl = qf_get_curlist(qi); |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5115 FOR_ALL_QFL_ITEMS(qfl, qfp, i) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5116 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5117 if (qfp->qf_valid) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5118 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5119 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
|
5120 sz++; // Count all valid entries |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5121 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
|
5122 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5123 // Count the number of files |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5124 sz++; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5125 prev_fnum = qfp->qf_fnum; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5126 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5127 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5128 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5129 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5130 return sz; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5131 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5132 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5133 /* |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5134 * 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
|
5135 * 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
|
5136 */ |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5137 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5138 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
|
5139 { |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5140 qf_info_T *qi; |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5141 |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5142 if ((qi = qf_cmd_get_stack(eap, FALSE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5143 return 0; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5144 |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5145 return qf_get_curlist(qi)->qf_index; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5146 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5147 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5148 /* |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5149 * 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
|
5150 * 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
|
5151 */ |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5152 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5153 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
|
5154 { |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5155 qf_info_T *qi; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5156 qf_list_T *qfl; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5157 qfline_T *qfp; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5158 int i, eidx = 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5159 int prev_fnum = 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5160 |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5161 if ((qi = qf_cmd_get_stack(eap, FALSE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5162 return 1; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5163 |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5164 qfl = qf_get_curlist(qi); |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5165 qfp = qfl->qf_start; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5166 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5167 // check if the list has valid errors |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5168 if (!qf_list_has_valid_entries(qfl)) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5169 return 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5170 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5171 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
|
5172 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5173 if (qfp->qf_valid) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5174 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5175 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
|
5176 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5177 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
|
5178 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5179 // Count the number of files |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5180 eidx++; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5181 prev_fnum = qfp->qf_fnum; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5182 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5183 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5184 else |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5185 eidx++; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5186 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5187 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5188 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5189 return eidx ? eidx : 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5190 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5191 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5192 /* |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5193 * 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
|
5194 * 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
|
5195 * 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
|
5196 * 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
|
5197 */ |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5198 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
|
5199 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
|
5200 { |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
5201 qfline_T *qfp; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5202 int i, eidx; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5203 int prev_fnum = 0; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5204 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5205 // check if the list has valid errors |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5206 if (!qf_list_has_valid_entries(qfl)) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5207 return 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5208 |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
5209 eidx = 0; |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
5210 FOR_ALL_QFL_ITEMS(qfl, qfp, i) |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5211 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5212 if (qfp->qf_valid) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5213 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5214 if (fdo) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5215 { |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5216 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
|
5217 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5218 // Count the number of files |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5219 eidx++; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5220 prev_fnum = qfp->qf_fnum; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5221 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5222 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5223 else |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5224 eidx++; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5225 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5226 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5227 if (eidx == n) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5228 break; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5229 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5230 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5231 if (i <= qfl->qf_count) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5232 return i; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5233 else |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5234 return 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5235 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5236 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5237 /* |
7 | 5238 * ":cc", ":crewind", ":cfirst" and ":clast". |
644 | 5239 * ":ll", ":lrewind", ":lfirst" and ":llast". |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5240 * ":cdo", ":ldo", ":cfdo" and ":lfdo" |
7 | 5241 */ |
5242 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5243 ex_cc(exarg_T *eap) |
7 | 5244 { |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5245 qf_info_T *qi; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5246 int errornr; |
659 | 5247 |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5248 if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5249 return; |
644 | 5250 |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5251 if (eap->addr_count > 0) |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5252 errornr = (int)eap->line2; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5253 else |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5254 { |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5255 switch (eap->cmdidx) |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5256 { |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5257 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
|
5258 errornr = 0; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5259 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5260 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
|
5261 case CMD_lfirst: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5262 errornr = 1; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5263 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5264 default: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5265 errornr = 32767; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5266 } |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5267 } |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5268 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5269 // 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
|
5270 // 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
|
5271 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
|
5272 || eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5273 errornr = qf_get_nth_valid_entry(qf_get_curlist(qi), |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5274 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
|
5275 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
|
5276 |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5277 qf_jump(qi, 0, errornr, eap->forceit); |
7 | 5278 } |
5279 | |
5280 /* | |
5281 * ":cnext", ":cnfile", ":cNext" and ":cprevious". | |
644 | 5282 * ":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
|
5283 * Also, used by ":cdo", ":ldo", ":cfdo" and ":lfdo" commands. |
7 | 5284 */ |
5285 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5286 ex_cnext(exarg_T *eap) |
7 | 5287 { |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5288 qf_info_T *qi; |
7092
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5289 int errornr; |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5290 int dir; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5291 |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5292 if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
5293 return; |
644 | 5294 |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
5295 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
|
5296 && (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
|
5297 && 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
|
5298 errornr = (int)eap->line2; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5299 else |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5300 errornr = 1; |
64e30831fa42
commit https://github.com/vim/vim/commit/aa23b379421aa214e6543b06c974594a25799b09
Christian Brabandt <cb@256bit.org>
parents:
6853
diff
changeset
|
5301 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5302 // 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
|
5303 switch (eap->cmdidx) |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5304 { |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5305 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
|
5306 dir = FORWARD; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5307 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5308 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
|
5309 case CMD_lNext: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5310 dir = BACKWARD; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5311 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5312 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
|
5313 dir = FORWARD_FILE; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5314 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5315 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
|
5316 dir = BACKWARD_FILE; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5317 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5318 default: |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5319 dir = FORWARD; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5320 break; |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5321 } |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5322 |
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5323 qf_jump(qi, dir, errornr, eap->forceit); |
7 | 5324 } |
5325 | |
5326 /* | |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5327 * Find the first entry in the quickfix list 'qfl' from buffer 'bnr'. |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5328 * The index of the entry is stored in 'errornr'. |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5329 * Returns NULL if an entry is not found. |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5330 */ |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5331 static qfline_T * |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5332 qf_find_first_entry_in_buf(qf_list_T *qfl, int bnr, int *errornr) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5333 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5334 qfline_T *qfp = NULL; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5335 int idx = 0; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5336 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5337 // Find the first entry in this file |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5338 FOR_ALL_QFL_ITEMS(qfl, qfp, idx) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5339 if (qfp->qf_fnum == bnr) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5340 break; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5341 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5342 *errornr = idx; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5343 return qfp; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5344 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5345 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5346 /* |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5347 * Find the first quickfix entry on the same line as 'entry'. Updates 'errornr' |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5348 * with the error number for the first entry. Assumes the entries are sorted in |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5349 * the quickfix list by line number. |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5350 */ |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5351 static qfline_T * |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5352 qf_find_first_entry_on_line(qfline_T *entry, int *errornr) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5353 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5354 while (!got_int |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5355 && entry->qf_prev != NULL |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5356 && entry->qf_fnum == entry->qf_prev->qf_fnum |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5357 && entry->qf_lnum == entry->qf_prev->qf_lnum) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5358 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5359 entry = entry->qf_prev; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5360 --*errornr; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5361 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5362 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5363 return entry; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5364 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5365 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5366 /* |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5367 * Find the last quickfix entry on the same line as 'entry'. Updates 'errornr' |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5368 * with the error number for the last entry. Assumes the entries are sorted in |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5369 * the quickfix list by line number. |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5370 */ |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5371 static qfline_T * |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5372 qf_find_last_entry_on_line(qfline_T *entry, int *errornr) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5373 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5374 while (!got_int && |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5375 entry->qf_next != NULL |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5376 && entry->qf_fnum == entry->qf_next->qf_fnum |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5377 && entry->qf_lnum == entry->qf_next->qf_lnum) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5378 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5379 entry = entry->qf_next; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5380 ++*errornr; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5381 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5382 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5383 return entry; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5384 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5385 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5386 /* |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5387 * Returns TRUE if the specified quickfix entry is |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5388 * after the given line (linewise is TRUE) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5389 * or after the line and column. |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5390 */ |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5391 static int |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5392 qf_entry_after_pos(qfline_T *qfp, pos_T *pos, int linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5393 { |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5394 if (linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5395 return qfp->qf_lnum > pos->lnum; |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5396 else |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5397 return (qfp->qf_lnum > pos->lnum || |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5398 (qfp->qf_lnum == pos->lnum && qfp->qf_col > pos->col)); |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5399 } |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5400 |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5401 /* |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5402 * Returns TRUE if the specified quickfix entry is |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5403 * before the given line (linewise is TRUE) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5404 * or before the line and column. |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5405 */ |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5406 static int |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5407 qf_entry_before_pos(qfline_T *qfp, pos_T *pos, int linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5408 { |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5409 if (linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5410 return qfp->qf_lnum < pos->lnum; |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5411 else |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5412 return (qfp->qf_lnum < pos->lnum || |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5413 (qfp->qf_lnum == pos->lnum && qfp->qf_col < pos->col)); |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5414 } |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5415 |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5416 /* |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5417 * Returns TRUE if the specified quickfix entry is |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5418 * on or after the given line (linewise is TRUE) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5419 * or on or after the line and column. |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5420 */ |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5421 static int |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5422 qf_entry_on_or_after_pos(qfline_T *qfp, pos_T *pos, int linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5423 { |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5424 if (linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5425 return qfp->qf_lnum >= pos->lnum; |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5426 else |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5427 return (qfp->qf_lnum > pos->lnum || |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5428 (qfp->qf_lnum == pos->lnum && qfp->qf_col >= pos->col)); |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5429 } |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5430 |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5431 /* |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5432 * Returns TRUE if the specified quickfix entry is |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5433 * on or before the given line (linewise is TRUE) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5434 * or on or before the line and column. |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5435 */ |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5436 static int |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5437 qf_entry_on_or_before_pos(qfline_T *qfp, pos_T *pos, int linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5438 { |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5439 if (linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5440 return qfp->qf_lnum <= pos->lnum; |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5441 else |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5442 return (qfp->qf_lnum < pos->lnum || |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5443 (qfp->qf_lnum == pos->lnum && qfp->qf_col <= pos->col)); |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5444 } |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5445 |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5446 /* |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5447 * Find the first quickfix entry after position 'pos' in buffer 'bnr'. |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5448 * If 'linewise' is TRUE, returns the entry after the specified line and treats |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5449 * multiple entries on a single line as one. Otherwise returns the entry after |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5450 * the specified line and column. |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5451 * 'qfp' points to the very first entry in the buffer and 'errornr' is the |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5452 * index of the very first entry in the quickfix list. |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5453 * Returns NULL if an entry is not found after 'pos'. |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5454 */ |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5455 static qfline_T * |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5456 qf_find_entry_after_pos( |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5457 int bnr, |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5458 pos_T *pos, |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5459 int linewise, |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5460 qfline_T *qfp, |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5461 int *errornr) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5462 { |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5463 if (qf_entry_after_pos(qfp, pos, linewise)) |
18498
9e6d5a4abb1c
patch 8.1.2243: typos in comments
Bram Moolenaar <Bram@vim.org>
parents:
18452
diff
changeset
|
5464 // First entry is after position 'pos' |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5465 return qfp; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5466 |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5467 // Find the entry just before or at the position 'pos' |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5468 while (qfp->qf_next != NULL |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5469 && qfp->qf_next->qf_fnum == bnr |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5470 && qf_entry_on_or_before_pos(qfp->qf_next, pos, linewise)) |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5471 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5472 qfp = qfp->qf_next; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5473 ++*errornr; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5474 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5475 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5476 if (qfp->qf_next == NULL || qfp->qf_next->qf_fnum != bnr) |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5477 // No entries found after position 'pos' |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5478 return NULL; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5479 |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5480 // Use the entry just after position 'pos' |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5481 qfp = qfp->qf_next; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5482 ++*errornr; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5483 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5484 return qfp; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5485 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5486 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5487 /* |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5488 * Find the first quickfix entry before position 'pos' in buffer 'bnr'. |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5489 * If 'linewise' is TRUE, returns the entry before the specified line and |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5490 * treats multiple entries on a single line as one. Otherwise returns the entry |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5491 * before the specified line and column. |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5492 * 'qfp' points to the very first entry in the buffer and 'errornr' is the |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5493 * index of the very first entry in the quickfix list. |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5494 * Returns NULL if an entry is not found before 'pos'. |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5495 */ |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5496 static qfline_T * |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5497 qf_find_entry_before_pos( |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5498 int bnr, |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5499 pos_T *pos, |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5500 int linewise, |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5501 qfline_T *qfp, |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5502 int *errornr) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5503 { |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5504 // Find the entry just before the position 'pos' |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5505 while (qfp->qf_next != NULL |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5506 && qfp->qf_next->qf_fnum == bnr |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5507 && qf_entry_before_pos(qfp->qf_next, pos, linewise)) |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5508 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5509 qfp = qfp->qf_next; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5510 ++*errornr; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5511 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5512 |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5513 if (qf_entry_on_or_after_pos(qfp, pos, linewise)) |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5514 return NULL; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5515 |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5516 if (linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5517 // If multiple entries are on the same line, then use the first entry |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5518 qfp = qf_find_first_entry_on_line(qfp, errornr); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5519 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5520 return qfp; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5521 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5522 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5523 /* |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5524 * Find a quickfix entry in 'qfl' closest to position 'pos' in buffer 'bnr' in |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5525 * the direction 'dir'. |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5526 */ |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5527 static qfline_T * |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5528 qf_find_closest_entry( |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5529 qf_list_T *qfl, |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5530 int bnr, |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5531 pos_T *pos, |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5532 int dir, |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5533 int linewise, |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5534 int *errornr) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5535 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5536 qfline_T *qfp; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5537 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5538 *errornr = 0; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5539 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5540 // Find the first entry in this file |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5541 qfp = qf_find_first_entry_in_buf(qfl, bnr, errornr); |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5542 if (qfp == NULL) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5543 return NULL; // no entry in this file |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5544 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5545 if (dir == FORWARD) |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5546 qfp = qf_find_entry_after_pos(bnr, pos, linewise, qfp, errornr); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5547 else |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5548 qfp = qf_find_entry_before_pos(bnr, pos, linewise, qfp, errornr); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5549 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5550 return qfp; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5551 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5552 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5553 /* |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5554 * Get the nth quickfix entry below the specified entry. Searches forward in |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5555 * the list. If linewise is TRUE, then treat multiple entries on a single line |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5556 * as one. |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5557 */ |
16978
15bc5a64bd50
patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
5558 static void |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
5559 qf_get_nth_below_entry(qfline_T *entry_arg, int n, int linewise, int *errornr) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
5560 { |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
5561 qfline_T *entry = entry_arg; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
5562 |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5563 while (n-- > 0 && !got_int) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5564 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5565 int first_errornr = *errornr; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5566 |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5567 if (linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5568 // Treat all the entries on the same line in this file as one |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5569 entry = qf_find_last_entry_on_line(entry, errornr); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5570 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5571 if (entry->qf_next == NULL |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5572 || entry->qf_next->qf_fnum != entry->qf_fnum) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5573 { |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5574 if (linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5575 *errornr = first_errornr; |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5576 break; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5577 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5578 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5579 entry = entry->qf_next; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5580 ++*errornr; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5581 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5582 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5583 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5584 /* |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5585 * Get the nth quickfix entry above the specified entry. Searches backwards in |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5586 * the list. If linewise is TRUE, then treat multiple entries on a single line |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5587 * as one. |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5588 */ |
16978
15bc5a64bd50
patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
5589 static void |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5590 qf_get_nth_above_entry(qfline_T *entry, int n, int linewise, int *errornr) |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5591 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5592 while (n-- > 0 && !got_int) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5593 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5594 if (entry->qf_prev == NULL |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5595 || entry->qf_prev->qf_fnum != entry->qf_fnum) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5596 break; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5597 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5598 entry = entry->qf_prev; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5599 --*errornr; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5600 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5601 // If multiple entries are on the same line, then use the first entry |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5602 if (linewise) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5603 entry = qf_find_first_entry_on_line(entry, errornr); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5604 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5605 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5606 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5607 /* |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5608 * Find the n'th quickfix entry adjacent to position 'pos' in buffer 'bnr' in |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5609 * the specified direction. Returns the error number in the quickfix list or 0 |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5610 * if an entry is not found. |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5611 */ |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5612 static int |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5613 qf_find_nth_adj_entry( |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5614 qf_list_T *qfl, |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5615 int bnr, |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5616 pos_T *pos, |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5617 int n, |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5618 int dir, |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5619 int linewise) |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5620 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5621 qfline_T *adj_entry; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5622 int errornr; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5623 |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5624 // Find an entry closest to the specified position |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5625 adj_entry = qf_find_closest_entry(qfl, bnr, pos, dir, linewise, &errornr); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5626 if (adj_entry == NULL) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5627 return 0; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5628 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5629 if (--n > 0) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5630 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5631 // Go to the n'th entry in the current buffer |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5632 if (dir == FORWARD) |
16978
15bc5a64bd50
patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
5633 qf_get_nth_below_entry(adj_entry, n, linewise, &errornr); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5634 else |
16978
15bc5a64bd50
patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
5635 qf_get_nth_above_entry(adj_entry, n, linewise, &errornr); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5636 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5637 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5638 return errornr; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5639 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5640 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5641 /* |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5642 * Jump to a quickfix entry in the current file nearest to the current line or |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5643 * current line/col. |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5644 * ":cabove", ":cbelow", ":labove", ":lbelow", ":cafter", ":cbefore", |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5645 * ":lafter" and ":lbefore" commands |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5646 */ |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5647 void |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5648 ex_cbelow(exarg_T *eap) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5649 { |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5650 qf_info_T *qi; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5651 qf_list_T *qfl; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5652 int dir; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5653 int buf_has_flag; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5654 int errornr = 0; |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5655 pos_T pos; |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5656 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5657 if (eap->addr_count > 0 && eap->line2 <= 0) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5658 { |
25064
8f2262c72178
patch 8.2.3069: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
24964
diff
changeset
|
5659 emsg(_(e_invalid_range)); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5660 return; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5661 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5662 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5663 // Check whether the current buffer has any quickfix entries |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5664 if (eap->cmdidx == CMD_cabove || eap->cmdidx == CMD_cbelow |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5665 || eap->cmdidx == CMD_cbefore || eap->cmdidx == CMD_cafter) |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5666 buf_has_flag = BUF_HAS_QF_ENTRY; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5667 else |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5668 buf_has_flag = BUF_HAS_LL_ENTRY; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5669 if (!(curbuf->b_has_qf_entry & buf_has_flag)) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5670 { |
25306
078edc1821bf
patch 8.2.3190: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
5671 emsg(_(e_no_errors)); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5672 return; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5673 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5674 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5675 if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5676 return; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5677 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5678 qfl = qf_get_curlist(qi); |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5679 // check if the list has valid errors |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5680 if (!qf_list_has_valid_entries(qfl)) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5681 { |
25306
078edc1821bf
patch 8.2.3190: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
5682 emsg(_(e_no_errors)); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5683 return; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5684 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5685 |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5686 if (eap->cmdidx == CMD_cbelow |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5687 || eap->cmdidx == CMD_lbelow |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5688 || eap->cmdidx == CMD_cafter |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5689 || eap->cmdidx == CMD_lafter) |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5690 // Forward motion commands |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5691 dir = FORWARD; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5692 else |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5693 dir = BACKWARD; |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5694 |
16543
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5695 pos = curwin->w_cursor; |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5696 // A quickfix entry column number is 1 based whereas cursor column |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5697 // number is 0 based. Adjust the column number. |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5698 pos.col++; |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5699 errornr = qf_find_nth_adj_entry(qfl, curbuf->b_fnum, &pos, |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5700 eap->addr_count > 0 ? eap->line2 : 0, dir, |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5701 eap->cmdidx == CMD_cbelow |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5702 || eap->cmdidx == CMD_lbelow |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5703 || eap->cmdidx == CMD_cabove |
1d2b3bb35414
patch 8.1.1275: cannot navigate to errors before/after the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16515
diff
changeset
|
5704 || eap->cmdidx == CMD_labove); |
16505
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5705 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5706 if (errornr > 0) |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5707 qf_jump(qi, 0, errornr, FALSE); |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5708 else |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5709 emsg(_(e_no_more_items)); |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5710 } |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5711 |
28e3ba82d8c8
patch 8.1.1256: cannot navigate through errors relative to the cursor
Bram Moolenaar <Bram@vim.org>
parents:
16483
diff
changeset
|
5712 /* |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5713 * Return the autocmd name for the :cfile Ex commands |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5714 */ |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5715 static char_u * |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5716 cfile_get_auname(cmdidx_T cmdidx) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5717 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5718 switch (cmdidx) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5719 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5720 case CMD_cfile: return (char_u *)"cfile"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5721 case CMD_cgetfile: return (char_u *)"cgetfile"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5722 case CMD_caddfile: return (char_u *)"caddfile"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5723 case CMD_lfile: return (char_u *)"lfile"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5724 case CMD_lgetfile: return (char_u *)"lgetfile"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5725 case CMD_laddfile: return (char_u *)"laddfile"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5726 default: return NULL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5727 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5728 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5729 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5730 /* |
446 | 5731 * ":cfile"/":cgetfile"/":caddfile" commands. |
644 | 5732 * ":lfile"/":lgetfile"/":laddfile" commands. |
7 | 5733 */ |
5734 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
5735 ex_cfile(exarg_T *eap) |
7 | 5736 { |
11063
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
5737 char_u *enc = NULL; |
644 | 5738 win_T *wp = NULL; |
659 | 5739 qf_info_T *qi = &ql_info; |
3404 | 5740 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
|
5741 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
|
5742 int res; |
644 | 5743 |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5744 au_name = cfile_get_auname(eap->cmdidx); |
18452
0ac9e720a56e
patch 8.1.2220: :cfile does not abort like other quickfix commands
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
5745 if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, |
0ac9e720a56e
patch 8.1.2220: :cfile does not abort like other quickfix commands
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
5746 NULL, FALSE, curbuf)) |
0ac9e720a56e
patch 8.1.2220: :cfile does not abort like other quickfix commands
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
5747 { |
0ac9e720a56e
patch 8.1.2220: :cfile does not abort like other quickfix commands
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
5748 #ifdef FEAT_EVAL |
0ac9e720a56e
patch 8.1.2220: :cfile does not abort like other quickfix commands
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
5749 if (aborting()) |
0ac9e720a56e
patch 8.1.2220: :cfile does not abort like other quickfix commands
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
5750 return; |
0ac9e720a56e
patch 8.1.2220: :cfile does not abort like other quickfix commands
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
5751 #endif |
0ac9e720a56e
patch 8.1.2220: :cfile does not abort like other quickfix commands
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
5752 } |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
5753 |
11063
e71d3bdf3bc3
patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
10379
diff
changeset
|
5754 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
|
5755 #ifdef FEAT_BROWSE |
22699
e82579016863
patch 8.2.1898: command modifier parsing always uses global cmdmod
Bram Moolenaar <Bram@vim.org>
parents:
22645
diff
changeset
|
5756 if (cmdmod.cmod_flags & CMOD_BROWSE) |
2296
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5757 { |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5758 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
|
5759 NULL, NULL, |
378f9f8e6d8f
patch 8.0.1773: dialog messages are not translated
Christian Brabandt <cb@256bit.org>
parents:
13800
diff
changeset
|
5760 (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
|
5761 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
|
5762 return; |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5763 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
|
5764 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
|
5765 } |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5766 else |
eb7be7b075a6
Support :browse for commands that use an error file argument. (Lech Lorens)
Bram Moolenaar <bram@vim.org>
parents:
2146
diff
changeset
|
5767 #endif |
7 | 5768 if (*eap->arg != NUL) |
694 | 5769 set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0); |
446 | 5770 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
5771 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
|
5772 wp = curwin; |
a1f8939a4644
patch 8.0.1414: accessing freed memory in :lfile.
Christian Brabandt <cb@256bit.org>
parents:
13076
diff
changeset
|
5773 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5774 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5775 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5776 // 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
|
5777 // commands. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5778 // :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
|
5779 // first error. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5780 // :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
|
5781 // first error. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5782 // :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
|
5783 // 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
|
5784 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
|
5785 && 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
|
5786 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
|
5787 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
|
5788 { |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
5789 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
|
5790 if (qi == NULL) |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5791 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5792 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
|
5793 return; |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5794 } |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5795 } |
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5796 if (res >= 0) |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5797 qf_list_changed(qf_get_curlist(qi)); |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5798 save_qfid = qf_get_curlist(qi)->qf_id; |
12954
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
5799 if (au_name != NULL) |
49e136457c66
patch 8.0.1353: QuickFixCmdPost is not used consistently
Christian Brabandt <cb@256bit.org>
parents:
12912
diff
changeset
|
5800 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
|
5801 |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
5802 // 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
|
5803 // 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
|
5804 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
|
5805 && qflist_valid(wp, save_qfid)) |
14469
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
5806 // display the first error |
0211e295835e
patch 8.1.0248: duplicated quickfix code
Christian Brabandt <cb@256bit.org>
parents:
14433
diff
changeset
|
5807 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
|
5808 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
5809 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
|
5810 } |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5811 |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5812 /* |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5813 * 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
|
5814 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5815 static char_u * |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5816 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
|
5817 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5818 switch (cmdidx) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5819 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5820 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
|
5821 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
|
5822 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
|
5823 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
|
5824 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
|
5825 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
|
5826 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
|
5827 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
|
5828 default: return NULL; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5829 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5830 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5831 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5832 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5833 * 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
|
5834 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5835 static void |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5836 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
|
5837 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5838 // 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
|
5839 regmatch->regprog = NULL; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5840 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5841 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
|
5842 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5843 // 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
|
5844 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
|
5845 { |
25306
078edc1821bf
patch 8.2.3190: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
5846 emsg(_(e_no_previous_regular_expression)); |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5847 return; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5848 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5849 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
|
5850 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5851 else |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5852 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
|
5853 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5854 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
|
5855 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
|
5856 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5857 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5858 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5859 * 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
|
5860 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5861 static void |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5862 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
|
5863 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5864 char_u *p; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5865 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5866 msg_start(); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5867 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
|
5868 if (p == NULL) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5869 msg_outtrans(fname); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5870 else |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5871 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5872 msg_outtrans(p); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5873 vim_free(p); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5874 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5875 msg_clr_eos(); |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5876 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
|
5877 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
|
5878 msg_col = 0; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5879 out_flush(); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5880 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5881 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5882 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5883 * 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
|
5884 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5885 static buf_T * |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5886 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
|
5887 char_u *fname, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5888 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
|
5889 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
|
5890 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5891 int save_mls; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5892 #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
|
5893 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
|
5894 #endif |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5895 buf_T *buf; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5896 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5897 #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
|
5898 // 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
|
5899 // 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
|
5900 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
|
5901 #endif |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5902 // 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
|
5903 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
|
5904 p_mls = 0; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5905 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5906 // 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
|
5907 // 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
|
5908 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
|
5909 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5910 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
|
5911 #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
|
5912 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
|
5913 #endif |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5914 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5915 return buf; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5916 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5917 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5918 /* |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5919 * Check whether a quickfix/location list is valid. Autocmds may remove or |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5920 * change a quickfix list when vimgrep is running. If the list is not found, |
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
5921 * create a new list. |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5922 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5923 static int |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5924 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
|
5925 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
|
5926 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
|
5927 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
|
5928 char_u *title) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5929 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5930 // 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
|
5931 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
|
5932 { |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5933 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
|
5934 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5935 // An autocmd has freed the location list. |
22256
c3c9830c7cdc
patch 8.2.1677: memory access errors when calling setloclist() in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
22137
diff
changeset
|
5936 emsg(_(e_current_location_list_was_changed)); |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5937 return FALSE; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5938 } |
13594
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5939 else |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5940 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
5941 // 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
|
5942 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
|
5943 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
|
5944 } |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5945 } |
4d55eb79178b
patch 8.0.1669: :vimgrep may add entries to the wrong quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13521
diff
changeset
|
5946 |
14507
5a10a0020c3e
patch 8.1.0267: no good check if restoring quickfix list worked
Christian Brabandt <cb@256bit.org>
parents:
14495
diff
changeset
|
5947 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
|
5948 return FALSE; |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5949 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5950 return TRUE; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5951 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5952 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5953 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5954 * 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
|
5955 * 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
|
5956 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5957 static int |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5958 vgr_match_buflines( |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
5959 qf_list_T *qfl, |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5960 char_u *fname, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5961 buf_T *buf, |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5962 char_u *spat, |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5963 regmmatch_T *regmatch, |
14976
676db1b7fc35
patch 8.1.0499: :2vimgrep causes an ml_get error
Bram Moolenaar <Bram@vim.org>
parents:
14956
diff
changeset
|
5964 long *tomatch, |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5965 int duplicate_name, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5966 int flags) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5967 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5968 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
|
5969 long lnum; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5970 colnr_T col; |
24574
3a3d5ee00574
patch 8.2.2826: compiler warnings for int to size_t conversion
Bram Moolenaar <Bram@vim.org>
parents:
24547
diff
changeset
|
5971 int pat_len = (int)STRLEN(spat); |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5972 |
14976
676db1b7fc35
patch 8.1.0499: :2vimgrep causes an ml_get error
Bram Moolenaar <Bram@vim.org>
parents:
14956
diff
changeset
|
5973 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
|
5974 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5975 col = 0; |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5976 if (!(flags & VGR_FUZZY)) |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5977 { |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5978 // Regular expression match |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5979 while (vim_regexec_multi(regmatch, curwin, buf, lnum, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5980 col, NULL, NULL) > 0) |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
5981 { |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5982 // Pass the buffer number so that it gets used even for a |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5983 // dummy buffer, unless duplicate_name is set, then the |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5984 // buffer will be wiped out below. |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5985 if (qf_add_entry(qfl, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5986 NULL, // dir |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5987 fname, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5988 NULL, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5989 duplicate_name ? 0 : buf->b_fnum, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5990 ml_get_buf(buf, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5991 regmatch->startpos[0].lnum + lnum, FALSE), |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5992 regmatch->startpos[0].lnum + lnum, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
5993 regmatch->endpos[0].lnum + lnum, |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5994 regmatch->startpos[0].col + 1, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
5995 regmatch->endpos[0].col + 1, |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5996 FALSE, // vis_col |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5997 NULL, // search pattern |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5998 0, // nr |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
5999 0, // type |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6000 TRUE // valid |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6001 ) == QF_FAIL) |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6002 { |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6003 got_int = TRUE; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6004 break; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6005 } |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6006 found_match = TRUE; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6007 if (--*tomatch == 0) |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6008 break; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6009 if ((flags & VGR_GLOBAL) == 0 |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6010 || regmatch->endpos[0].lnum > 0) |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6011 break; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6012 col = regmatch->endpos[0].col |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6013 + (col == regmatch->endpos[0].col); |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6014 if (col > (colnr_T)STRLEN(ml_get_buf(buf, lnum, FALSE))) |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6015 break; |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6016 } |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6017 } |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6018 else |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6019 { |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6020 char_u *str = ml_get_buf(buf, lnum, FALSE); |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6021 int score; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6022 int_u matches[MAX_FUZZY_MATCHES]; |
24768
7334bf933510
patch 8.2.2922: computing array length is done in various ways
Bram Moolenaar <Bram@vim.org>
parents:
24590
diff
changeset
|
6023 int_u sz = ARRAY_LENGTH(matches); |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6024 |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6025 // Fuzzy string match |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6026 while (fuzzy_match(str + col, spat, FALSE, &score, matches, sz) > 0) |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6027 { |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6028 // Pass the buffer number so that it gets used even for a |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6029 // dummy buffer, unless duplicate_name is set, then the |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6030 // buffer will be wiped out below. |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6031 if (qf_add_entry(qfl, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6032 NULL, // dir |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6033 fname, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6034 NULL, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6035 duplicate_name ? 0 : buf->b_fnum, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6036 str, |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6037 lnum, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
6038 0, |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6039 matches[0] + col + 1, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
6040 0, |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6041 FALSE, // vis_col |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6042 NULL, // search pattern |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6043 0, // nr |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6044 0, // type |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6045 TRUE // valid |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6046 ) == QF_FAIL) |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6047 { |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6048 got_int = TRUE; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6049 break; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6050 } |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6051 found_match = TRUE; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6052 if (--*tomatch == 0) |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6053 break; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6054 if ((flags & VGR_GLOBAL) == 0) |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6055 break; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6056 col = matches[pat_len - 1] + col + 1; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6057 if (col > (colnr_T)STRLEN(str)) |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6058 break; |
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6059 } |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6060 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6061 line_breakcheck(); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6062 if (got_int) |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6063 break; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6064 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6065 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6066 return found_match; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6067 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6068 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6069 /* |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6070 * 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
|
6071 */ |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6072 static void |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6073 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
|
6074 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
|
6075 int forceit, |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6076 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
|
6077 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
|
6078 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
|
6079 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6080 buf_T *buf; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6081 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6082 buf = curbuf; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6083 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
|
6084 if (buf != curbuf) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6085 // 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
|
6086 // 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
|
6087 *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
|
6088 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6089 // 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
|
6090 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
|
6091 { |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6092 exarg_T ea; |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6093 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
6094 CLEAR_FIELD(ea); |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6095 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
|
6096 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
|
6097 ex_cd(&ea); |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6098 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6099 } |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6100 |
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6101 /* |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6102 * :vimgrep command arguments |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6103 */ |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6104 typedef struct |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6105 { |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6106 long tomatch; // maximum number of matches to find |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6107 char_u *spat; // search pattern |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6108 int flags; // search modifier |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6109 char_u **fnames; // list of files to search |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6110 int fcount; // number of files |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6111 regmmatch_T regmatch; // compiled search pattern |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6112 char_u *qf_title; // quickfix list title |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6113 } vgr_args_T; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6114 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6115 /* |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6116 * Process :vimgrep command arguments. The command syntax is: |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6117 * |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6118 * :{count}vimgrep /{pattern}/[g][j] {file} ... |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6119 */ |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6120 static int |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6121 vgr_process_args( |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6122 exarg_T *eap, |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6123 vgr_args_T *args) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6124 { |
153 | 6125 char_u *p; |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6126 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6127 vim_memset(args, 0, sizeof(*args)); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6128 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6129 args->regmatch.regprog = NULL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6130 args->qf_title = vim_strsave(qf_cmdtitle(*eap->cmdlinep)); |
657 | 6131 |
716 | 6132 if (eap->addr_count > 0) |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6133 args->tomatch = eap->line2; |
716 | 6134 else |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6135 args->tomatch = MAXLNUM; |
716 | 6136 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6137 // Get the search pattern: either white-separated or enclosed in // |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6138 p = skip_vimgrep_pat(eap->arg, &args->spat, &args->flags); |
153 | 6139 if (p == NULL) |
41 | 6140 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
6141 emsg(_(e_invalpat)); |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6142 return FAIL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6143 } |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6144 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6145 vgr_init_regmatch(&args->regmatch, args->spat); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6146 if (args->regmatch.regprog == NULL) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6147 return FAIL; |
41 | 6148 |
6149 p = skipwhite(p); | |
6150 if (*p == NUL) | |
6151 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
6152 emsg(_("E683: File name missing or invalid pattern")); |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6153 return FAIL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6154 } |
41 | 6155 |
23778
8b682f6f3709
patch 8.2.2430: :vimgrep expands wildcards twice
Bram Moolenaar <Bram@vim.org>
parents:
23493
diff
changeset
|
6156 // Parse the list of arguments, wildcards have already been expanded. |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6157 if (get_arglist_exp(p, &args->fcount, &args->fnames, TRUE) == FAIL) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6158 return FAIL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6159 if (args->fcount == 0) |
41 | 6160 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
6161 emsg(_(e_nomatch)); |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6162 return FAIL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6163 } |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6164 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6165 return OK; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6166 } |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6167 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6168 /* |
21668
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6169 * Return TRUE if "buf" had an existing swap file, the current swap file does |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6170 * not end in ".swp". |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6171 */ |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6172 static int |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6173 existing_swapfile(buf_T *buf) |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6174 { |
22015
d8065205ea82
patch 8.2.1557: crash in :vimgrep when started as "vim -n"
Bram Moolenaar <Bram@vim.org>
parents:
21668
diff
changeset
|
6175 if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL) |
21668
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6176 { |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6177 char_u *fname = buf->b_ml.ml_mfp->mf_fname; |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6178 size_t len = STRLEN(fname); |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6179 |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6180 return fname[len - 1] != 'p' || fname[len - 2] != 'w'; |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6181 } |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6182 return FALSE; |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6183 } |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6184 |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6185 /* |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6186 * Search for a pattern in a list of files and populate the quickfix list with |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6187 * the matches. |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6188 */ |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6189 static int |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6190 vgr_process_files( |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6191 win_T *wp, |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6192 qf_info_T *qi, |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6193 vgr_args_T *cmd_args, |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6194 int *redraw_for_dummy, |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6195 buf_T **first_match_buf, |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6196 char_u **target_dir) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6197 { |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6198 int status = FAIL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6199 int_u save_qfid = qf_get_curlist(qi)->qf_id; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6200 time_t seconds = 0; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6201 char_u *fname; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6202 int fi; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6203 buf_T *buf; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6204 int duplicate_name = FALSE; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6205 int using_dummy; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6206 char_u *dirname_start = NULL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6207 char_u *dirname_now = NULL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6208 int found_match; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6209 aco_save_T aco; |
41 | 6210 |
7558
9a4c9dccd603
commit https://github.com/vim/vim/commit/b86a343280b08d6701da68ee0651e960a0a7a61c
Christian Brabandt <cb@256bit.org>
parents:
7515
diff
changeset
|
6211 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
|
6212 dirname_now = alloc_id(MAXPATHL, aid_qf_dirname_now); |
2770 | 6213 if (dirname_start == NULL || dirname_now == NULL) |
6214 goto theend; | |
6215 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6216 // 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
|
6217 // ":lcd %:p:h" changes the meaning of short path names. |
1411 | 6218 mch_dirname(dirname_start, MAXPATHL); |
6219 | |
123 | 6220 seconds = (time_t)0; |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6221 for (fi = 0; fi < cmd_args->fcount && !got_int && cmd_args->tomatch > 0; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6222 ++fi) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6223 { |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6224 fname = shorten_fname1(cmd_args->fnames[fi]); |
123 | 6225 if (time(NULL) > seconds) |
6226 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6227 // 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
|
6228 // working on it. |
123 | 6229 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
|
6230 vgr_display_fname(fname); |
123 | 6231 } |
6232 | |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6233 buf = buflist_findname_exp(cmd_args->fnames[fi]); |
42 | 6234 if (buf == NULL || buf->b_ml.ml_mfp == NULL) |
6235 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6236 // Remember that a buffer with this name already exists. |
42 | 6237 duplicate_name = (buf != NULL); |
123 | 6238 using_dummy = TRUE; |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6239 *redraw_for_dummy = TRUE; |
123 | 6240 |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6241 buf = vgr_load_dummy_buf(fname, dirname_start, dirname_now); |
42 | 6242 } |
6243 else | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6244 // Use existing, loaded buffer. |
42 | 6245 using_dummy = FALSE; |
123 | 6246 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6247 // 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
|
6248 // buffer above, autocommands might have changed the quickfix list. |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6249 if (!vgr_qflist_valid(wp, qi, save_qfid, cmd_args->qf_title)) |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6250 goto theend; |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6251 |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
6252 save_qfid = qf_get_curlist(qi)->qf_id; |
4003 | 6253 |
42 | 6254 if (buf == NULL) |
123 | 6255 { |
6256 if (!got_int) | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
6257 smsg(_("Cannot open file \"%s\""), fname); |
123 | 6258 } |
41 | 6259 else |
6260 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6261 // 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
|
6262 // For ":1vimgrep" look for first match only. |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
6263 found_match = vgr_match_buflines(qf_get_curlist(qi), |
24547
192058cad081
patch 8.2.2813: cannot grep using fuzzy matching
Bram Moolenaar <Bram@vim.org>
parents:
23865
diff
changeset
|
6264 fname, buf, cmd_args->spat, &cmd_args->regmatch, |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6265 &cmd_args->tomatch, duplicate_name, cmd_args->flags); |
13521
15c856a1617b
patch 8.0.1634: the ex_vimgrep() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13497
diff
changeset
|
6266 |
42 | 6267 if (using_dummy) |
6268 { | |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6269 if (found_match && *first_match_buf == NULL) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6270 *first_match_buf = buf; |
42 | 6271 if (duplicate_name) |
123 | 6272 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6273 // 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
|
6274 // with the same name. |
3490 | 6275 wipe_dummy_buffer(buf, dirname_start); |
123 | 6276 buf = NULL; |
6277 } | |
22699
e82579016863
patch 8.2.1898: command modifier parsing always uses global cmdmod
Bram Moolenaar <Bram@vim.org>
parents:
22645
diff
changeset
|
6278 else if ((cmdmod.cmod_flags & CMOD_HIDE) == 0 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6279 || 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
|
6280 || 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
|
6281 || buf->b_p_bh[0] == 'd') // "delete" |
42 | 6282 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6283 // 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
|
6284 // 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
|
6285 // 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
|
6286 // unload the buffer. |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6287 // 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
|
6288 // many swap files. |
42 | 6289 if (!found_match) |
123 | 6290 { |
3490 | 6291 wipe_dummy_buffer(buf, dirname_start); |
123 | 6292 buf = NULL; |
6293 } | |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6294 else if (buf != *first_match_buf |
21668
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6295 || (cmd_args->flags & VGR_NOJUMP) |
0843f244e547
patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents:
21461
diff
changeset
|
6296 || existing_swapfile(buf)) |
123 | 6297 { |
3490 | 6298 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
|
6299 // 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
|
6300 buf->b_flags &= ~BF_DUMMY; |
123 | 6301 buf = NULL; |
6302 } | |
42 | 6303 } |
123 | 6304 |
6305 if (buf != NULL) | |
6306 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6307 // 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
|
6308 buf->b_flags &= ~BF_DUMMY; |
64a791c53418
commit https://github.com/vim/vim/commit/015102e91e978a0bb42a14461c132a85e8f7e1ea
Christian Brabandt <cb@256bit.org>
parents:
9538
diff
changeset
|
6309 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6310 // 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
|
6311 // directory we jumped to below. |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6312 if (buf == *first_match_buf |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6313 && *target_dir == NULL |
1411 | 6314 && STRCMP(dirname_start, dirname_now) != 0) |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6315 *target_dir = vim_strsave(dirname_now); |
1411 | 6316 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6317 // 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
|
6318 // 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
|
6319 // 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
|
6320 // options! |
123 | 6321 aucmd_prepbuf(&aco, buf); |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
6322 #if defined(FEAT_SYN_HL) |
123 | 6323 apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, |
6324 buf->b_fname, TRUE, buf); | |
677 | 6325 #endif |
717 | 6326 do_modelines(OPT_NOWIN); |
123 | 6327 aucmd_restbuf(&aco); |
6328 } | |
42 | 6329 } |
41 | 6330 } |
6331 } | |
6332 | |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6333 status = OK; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6334 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6335 theend: |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6336 vim_free(dirname_now); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6337 vim_free(dirname_start); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6338 return status; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6339 } |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6340 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6341 /* |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6342 * ":vimgrep {pattern} file(s)" |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6343 * ":vimgrepadd {pattern} file(s)" |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6344 * ":lvimgrep {pattern} file(s)" |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6345 * ":lvimgrepadd {pattern} file(s)" |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6346 */ |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6347 void |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6348 ex_vimgrep(exarg_T *eap) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6349 { |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6350 vgr_args_T args; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6351 qf_info_T *qi; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6352 qf_list_T *qfl; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6353 int_u save_qfid; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6354 win_T *wp = NULL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6355 int redraw_for_dummy = FALSE; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6356 buf_T *first_match_buf = NULL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6357 char_u *target_dir = NULL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6358 char_u *au_name = NULL; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6359 int status; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6360 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6361 au_name = vgr_get_auname(eap->cmdidx); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6362 if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6363 curbuf->b_fname, TRUE, curbuf)) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6364 { |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6365 #ifdef FEAT_EVAL |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6366 if (aborting()) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6367 return; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6368 #endif |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6369 } |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6370 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6371 qi = qf_cmd_get_or_alloc_stack(eap, &wp); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6372 if (qi == NULL) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6373 return; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6374 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6375 if (vgr_process_args(eap, &args) == FAIL) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6376 goto theend; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6377 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6378 if ((eap->cmdidx != CMD_grepadd && eap->cmdidx != CMD_lgrepadd |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6379 && eap->cmdidx != CMD_vimgrepadd |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6380 && eap->cmdidx != CMD_lvimgrepadd) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6381 || qf_stack_empty(qi)) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6382 // make place for a new list |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6383 qf_new_list(qi, args.qf_title); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6384 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6385 incr_quickfix_busy(); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6386 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6387 status = vgr_process_files(wp, qi, &args, &redraw_for_dummy, |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6388 &first_match_buf, &target_dir); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6389 if (status != OK) |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6390 { |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6391 FreeWild(args.fcount, args.fnames); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6392 decr_quickfix_busy(); |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6393 goto theend; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6394 } |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6395 |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6396 FreeWild(args.fcount, args.fnames); |
41 | 6397 |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
6398 qfl = qf_get_curlist(qi); |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6399 qfl->qf_nonevalid = FALSE; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6400 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
|
6401 qfl->qf_index = 1; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6402 qf_list_changed(qfl); |
41 | 6403 |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
6404 qf_update_buffer(qi, NULL); |
41 | 6405 |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6406 // Remember the current quickfix list identifier, so that we can check for |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6407 // autocommands changing the current quickfix list. |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6408 save_qfid = qf_get_curlist(qi)->qf_id; |
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6409 |
842 | 6410 if (au_name != NULL) |
6411 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, | |
6412 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
|
6413 // 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
|
6414 // is still valid. |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6415 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
|
6416 || 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
|
6417 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6418 decr_quickfix_busy(); |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
6419 goto theend; |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6420 } |
14250
ca6ccee4823f
patch 8.1.0141: :cexpr no longer jumps to the first error
Christian Brabandt <cb@256bit.org>
parents:
14113
diff
changeset
|
6421 |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
6422 // Jump to first match. |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
6423 if (!qf_list_empty(qf_get_curlist(qi))) |
170 | 6424 { |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6425 if ((args.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
|
6426 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
|
6427 first_match_buf, target_dir); |
170 | 6428 } |
42 | 6429 else |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6430 semsg(_(e_nomatch2), args.spat); |
41 | 6431 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6432 decr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
6433 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6434 // 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
|
6435 // may have messed up things, need to redraw and recompute folds. |
1396 | 6436 if (redraw_for_dummy) |
6437 { | |
6438 #ifdef FEAT_FOLDING | |
6439 foldUpdateAll(curwin); | |
6440 #else | |
6441 redraw_later(NOT_VALID); | |
6442 #endif | |
6443 } | |
6444 | |
41 | 6445 theend: |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6446 vim_free(args.qf_title); |
1411 | 6447 vim_free(target_dir); |
18607
fbeb1bf0cea8
patch 8.1.2297: the ex_vimgrep() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
6448 vim_regfree(args.regmatch.regprog); |
41 | 6449 } |
6450 | |
6451 /* | |
3490 | 6452 * Restore current working directory to "dirname_start" if they differ, taking |
6453 * into account whether it is set locally or globally. | |
6454 */ | |
6455 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
6456 restore_start_dir(char_u *dirname_start) |
3490 | 6457 { |
6458 char_u *dirname_now = alloc(MAXPATHL); | |
6459 | |
6460 if (NULL != dirname_now) | |
6461 { | |
6462 mch_dirname(dirname_now, MAXPATHL); | |
6463 if (STRCMP(dirname_start, dirname_now) != 0) | |
6464 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6465 // 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
|
6466 // appropriate ex command and executing it. |
3490 | 6467 exarg_T ea; |
6468 | |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
6469 CLEAR_FIELD(ea); |
3490 | 6470 ea.arg = dirname_start; |
6471 ea.cmdidx = (curwin->w_localdir == NULL) ? CMD_cd : CMD_lcd; | |
6472 ex_cd(&ea); | |
6473 } | |
3974 | 6474 vim_free(dirname_now); |
3490 | 6475 } |
6476 } | |
6477 | |
6478 /* | |
6479 * Load file "fname" into a dummy buffer and return the buffer pointer, | |
6480 * placing the directory resulting from the buffer load into the | |
6481 * "resulting_dir" pointer. "resulting_dir" must be allocated by the caller | |
6482 * prior to calling this function. Restores directory to "dirname_start" prior | |
6483 * to returning, if autocmds or the 'autochdir' option have changed it. | |
6484 * | |
6485 * If creating the dummy buffer does not fail, must call unload_dummy_buffer() | |
6486 * or wipe_dummy_buffer() later! | |
6487 * | |
42 | 6488 * Returns NULL if it fails. |
6489 */ | |
6490 static buf_T * | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
6491 load_dummy_buffer( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
6492 char_u *fname, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6493 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
|
6494 char_u *resulting_dir) // out: new directory |
42 | 6495 { |
6496 buf_T *newbuf; | |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
6497 bufref_T newbufref; |
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
6498 bufref_T newbuf_to_wipe; |
42 | 6499 int failed = TRUE; |
6500 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
|
6501 int readfile_result; |
42 | 6502 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6503 // Allocate a buffer without putting it in the buffer list. |
42 | 6504 newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY); |
6505 if (newbuf == NULL) | |
6506 return NULL; | |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
6507 set_bufref(&newbufref, newbuf); |
42 | 6508 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6509 // Init the options. |
177 | 6510 buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP); |
6511 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6512 // need to open the memfile before putting the buffer in a window |
1918 | 6513 if (ml_open(newbuf) == OK) |
42 | 6514 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6515 // 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
|
6516 ++newbuf->b_locked; |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13026
diff
changeset
|
6517 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6518 // set curwin/curbuf to buf and save a few things |
1918 | 6519 aucmd_prepbuf(&aco, newbuf); |
6520 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6521 // Need to set the filename for autocommands. |
1918 | 6522 (void)setfname(curbuf, fname, NULL, FALSE); |
6523 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6524 // Create swap file now to avoid the ATTENTION message. |
42 | 6525 check_need_swap(TRUE); |
6526 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6527 // 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
|
6528 // work. |
42 | 6529 curbuf->b_flags &= ~BF_DUMMY; |
6530 | |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
6531 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
|
6532 readfile_result = readfile(fname, NULL, |
42 | 6533 (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
|
6534 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
|
6535 --newbuf->b_locked; |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13026
diff
changeset
|
6536 if (readfile_result == OK |
857 | 6537 && !got_int |
42 | 6538 && !(curbuf->b_flags & BF_NEW)) |
6539 { | |
6540 failed = FALSE; | |
6541 if (curbuf != newbuf) | |
6542 { | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6543 // 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
|
6544 // 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
|
6545 // 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
|
6546 // window stuff. |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
6547 set_bufref(&newbuf_to_wipe, newbuf); |
42 | 6548 newbuf = curbuf; |
6549 } | |
6550 } | |
1918 | 6551 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6552 // restore curwin/curbuf and a few other things |
1918 | 6553 aucmd_restbuf(&aco); |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
6554 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
|
6555 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
|
6556 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6557 // 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
|
6558 // skip it. |
9485
c16e207dc465
commit https://github.com/vim/vim/commit/ea3f2e7be447a8f0c4436869620f908de5e8ef1e
Christian Brabandt <cb@256bit.org>
parents:
9475
diff
changeset
|
6559 newbuf->b_flags |= BF_DUMMY; |
42 | 6560 } |
6561 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6562 // 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
|
6563 // 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
|
6564 // important. |
3490 | 6565 mch_dirname(resulting_dir, MAXPATHL); |
6566 restore_start_dir(dirname_start); | |
6567 | |
9487
69ed2c9d34a6
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Christian Brabandt <cb@256bit.org>
parents:
9485
diff
changeset
|
6568 if (!bufref_valid(&newbufref)) |
42 | 6569 return NULL; |
6570 if (failed) | |
6571 { | |
3490 | 6572 wipe_dummy_buffer(newbuf, dirname_start); |
42 | 6573 return NULL; |
6574 } | |
6575 return newbuf; | |
6576 } | |
6577 | |
6578 /* | |
3490 | 6579 * Wipe out the dummy buffer that load_dummy_buffer() created. Restores |
6580 * directory to "dirname_start" prior to returning, if autocmds or the | |
6581 * 'autochdir' option have changed it. | |
42 | 6582 */ |
6583 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
6584 wipe_dummy_buffer(buf_T *buf, char_u *dirname_start) |
42 | 6585 { |
19649
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6586 // If any autocommand opened a window on the dummy buffer, close that |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6587 // window. If we can't close them all then give up. |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6588 while (buf->b_nwindows > 0) |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6589 { |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6590 int did_one = FALSE; |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6591 win_T *wp; |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6592 |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6593 if (firstwin->w_next != NULL) |
19934
3ff714d765ba
patch 8.2.0523: loops are repeated
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
6594 FOR_ALL_WINDOWS(wp) |
19649
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6595 if (wp->w_buffer == buf) |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6596 { |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6597 if (win_close(wp, FALSE) == OK) |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6598 did_one = TRUE; |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6599 break; |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6600 } |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6601 if (!did_one) |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6602 return; |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6603 } |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6604 |
d4baa35fea5d
patch 8.2.0381: using freed memory with :lvimgrep and autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19475
diff
changeset
|
6605 if (curbuf != buf && buf->b_nwindows == 0) // safety check |
857 | 6606 { |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
6607 #if defined(FEAT_EVAL) |
857 | 6608 cleanup_T cs; |
6609 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6610 // 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
|
6611 // 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
|
6612 // work when got_int is set. |
857 | 6613 enter_cleanup(&cs); |
6614 #endif | |
6615 | |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23203
diff
changeset
|
6616 wipe_buffer(buf, TRUE); |
857 | 6617 |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
6618 #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
|
6619 // 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
|
6620 // new aborting error, interrupt, or uncaught exception. |
857 | 6621 leave_cleanup(&cs); |
6622 #endif | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6623 // When autocommands/'autochdir' option changed directory: go back. |
3490 | 6624 restore_start_dir(dirname_start); |
857 | 6625 } |
42 | 6626 } |
6627 | |
6628 /* | |
3490 | 6629 * Unload the dummy buffer that load_dummy_buffer() created. Restores |
6630 * directory to "dirname_start" prior to returning, if autocmds or the | |
6631 * 'autochdir' option have changed it. | |
42 | 6632 */ |
6633 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
6634 unload_dummy_buffer(buf_T *buf, char_u *dirname_start) |
42 | 6635 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6636 if (curbuf != buf) // safety check |
3490 | 6637 { |
18886
050f5eaa9e50
patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents:
18827
diff
changeset
|
6638 close_buffer(NULL, buf, DOBUF_UNLOAD, FALSE, TRUE); |
3490 | 6639 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6640 // When autocommands/'autochdir' option changed directory: go back. |
3490 | 6641 restore_start_dir(dirname_start); |
6642 } | |
42 | 6643 } |
6644 | |
170 | 6645 #if defined(FEAT_EVAL) || defined(PROTO) |
6646 /* | |
19195
2ef19eed524a
patch 8.2.0156: various typos in source files and tests
Bram Moolenaar <Bram@vim.org>
parents:
18886
diff
changeset
|
6647 * Copy the specified quickfix entry items into a new dict and append the dict |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6648 * to 'list'. Returns OK on success. |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6649 */ |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6650 static int |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6651 get_qfline_items(qfline_T *qfp, list_T *list) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6652 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6653 int bufnum; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6654 dict_T *dict; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6655 char_u buf[2]; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6656 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6657 // Handle entries with a non-existing buffer number. |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6658 bufnum = qfp->qf_fnum; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6659 if (bufnum != 0 && (buflist_findnr(bufnum) == NULL)) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6660 bufnum = 0; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6661 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6662 if ((dict = dict_alloc()) == NULL) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6663 return FAIL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6664 if (list_append_dict(list, dict) == FAIL) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6665 return FAIL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6666 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6667 buf[0] = qfp->qf_type; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6668 buf[1] = NUL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6669 if (dict_add_number(dict, "bufnr", (long)bufnum) == FAIL |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
6670 || dict_add_number(dict, "lnum", (long)qfp->qf_lnum) == FAIL |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
6671 || dict_add_number(dict, "end_lnum", (long)qfp->qf_end_lnum) == FAIL |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
6672 || dict_add_number(dict, "col", (long)qfp->qf_col) == FAIL |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
6673 || dict_add_number(dict, "end_col", (long)qfp->qf_end_col) == FAIL |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
6674 || dict_add_number(dict, "vcol", (long)qfp->qf_viscol) == FAIL |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
6675 || dict_add_number(dict, "nr", (long)qfp->qf_nr) == FAIL |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6676 || dict_add_string(dict, "module", qfp->qf_module) == FAIL |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6677 || dict_add_string(dict, "pattern", qfp->qf_pattern) == FAIL |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6678 || dict_add_string(dict, "text", qfp->qf_text) == FAIL |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6679 || dict_add_string(dict, "type", buf) == FAIL |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6680 || dict_add_number(dict, "valid", (long)qfp->qf_valid) == FAIL) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6681 return FAIL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6682 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6683 return OK; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6684 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6685 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6686 /* |
170 | 6687 * 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
|
6688 * If qf_idx is -1, use the current list. Otherwise, use the specified list. |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6689 * If eidx is not 0, then return only the specified entry. Otherwise return |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6690 * all the entries. |
170 | 6691 */ |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
6692 static int |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6693 get_errorlist( |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6694 qf_info_T *qi_arg, |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6695 win_T *wp, |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6696 int qf_idx, |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6697 int eidx, |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6698 list_T *list) |
170 | 6699 { |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6700 qf_info_T *qi = qi_arg; |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
6701 qf_list_T *qfl; |
230 | 6702 qfline_T *qfp; |
6703 int i; | |
170 | 6704 |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6705 if (qi == NULL) |
647 | 6706 { |
12252
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6707 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
|
6708 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
|
6709 { |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6710 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
|
6711 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
|
6712 return FAIL; |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6713 } |
647 | 6714 } |
6715 | |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6716 if (eidx < 0) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6717 return OK; |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6718 |
13800
e4dc4ede9ef8
patch 8.0.1772: quickfix: mixup of FALSE and FAIL, returning -1
Christian Brabandt <cb@256bit.org>
parents:
13764
diff
changeset
|
6719 if (qf_idx == INVALID_QFIDX) |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6720 qf_idx = qi->qf_curlist; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6721 |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
6722 if (qf_idx >= qi->qf_listcount) |
170 | 6723 return FAIL; |
6724 | |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
6725 qfl = qf_get_list(qi, qf_idx); |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
6726 if (qf_list_empty(qfl)) |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
6727 return FAIL; |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
6728 |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6729 FOR_ALL_QFL_ITEMS(qfl, qfp, i) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6730 { |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6731 if (eidx > 0) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6732 { |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6733 if (eidx == i) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6734 return get_qfline_items(qfp, list); |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6735 } |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6736 else if (get_qfline_items(qfp, list) == FAIL) |
170 | 6737 return FAIL; |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6738 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
6739 |
170 | 6740 return OK; |
6741 } | |
230 | 6742 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6743 // 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
|
6744 enum { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6745 QF_GETLIST_NONE = 0x0, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6746 QF_GETLIST_TITLE = 0x1, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6747 QF_GETLIST_ITEMS = 0x2, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6748 QF_GETLIST_NR = 0x4, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6749 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
|
6750 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
|
6751 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
|
6752 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
|
6753 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
|
6754 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
|
6755 QF_GETLIST_FILEWINID = 0x200, |
16019
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6756 QF_GETLIST_QFBUFNR = 0x400, |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
6757 QF_GETLIST_QFTF = 0x800, |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
6758 QF_GETLIST_ALL = 0xFFF, |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6759 }; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6760 |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6761 /* |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6762 * 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
|
6763 * 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
|
6764 */ |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6765 static int |
12321
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
6766 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
|
6767 { |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6768 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
|
6769 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
|
6770 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
|
6771 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
|
6772 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
|
6773 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6774 // 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
|
6775 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
|
6776 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6777 // 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
|
6778 // option setting |
12321
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
6779 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
|
6780 { |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
6781 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
|
6782 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
|
6783 return FAIL; |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
6784 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
|
6785 } |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
6786 |
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
6787 l = list_alloc(); |
12299
f4d00472e617
patch 8.0.1029: return value of getqflist() is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
12287
diff
changeset
|
6788 if (l == NULL) |
f4d00472e617
patch 8.0.1029: return value of getqflist() is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
12287
diff
changeset
|
6789 return FAIL; |
f4d00472e617
patch 8.0.1029: return value of getqflist() is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
12287
diff
changeset
|
6790 |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
6791 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
|
6792 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
|
6793 { |
12321
2779d593a706
patch 8.0.1040: cannot use another error format in getqflist()
Christian Brabandt <cb@256bit.org>
parents:
12303
diff
changeset
|
6794 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
|
6795 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
|
6796 { |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
6797 (void)get_errorlist(qi, NULL, 0, 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
|
6798 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
|
6799 } |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6800 free(qi); |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6801 } |
12299
f4d00472e617
patch 8.0.1029: return value of getqflist() is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
12287
diff
changeset
|
6802 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
|
6803 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
|
6804 } |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6805 |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6806 return status; |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6807 } |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6808 |
3d0e042ec13c
patch 8.0.1006: quickfix list changes when parsing text with 'erroformat'
Christian Brabandt <cb@256bit.org>
parents:
12146
diff
changeset
|
6809 /* |
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
|
6810 * 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
|
6811 */ |
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
|
6812 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
|
6813 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
|
6814 { |
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
|
6815 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
|
6816 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6817 // 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
|
6818 // 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
|
6819 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
|
6820 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
|
6821 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
|
6822 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
|
6823 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
|
6824 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
|
6825 } |
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
|
6826 |
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
|
6827 /* |
16019
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6828 * Returns the number of the buffer displayed in the quickfix/location list |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6829 * window. If there is no buffer associated with the list, then returns 0. |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6830 */ |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6831 static int |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6832 qf_getprop_qfbufnr(qf_info_T *qi, dict_T *retdict) |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6833 { |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6834 return dict_add_number(retdict, "qfbufnr", |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6835 (qi == NULL) ? 0 : qi->qf_bufnr); |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6836 } |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6837 |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6838 /* |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6839 * Convert the keys in 'what' to quickfix list property flags. |
230 | 6840 */ |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6841 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
|
6842 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
|
6843 { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6844 int flags = QF_GETLIST_NONE; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
6845 |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6846 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
|
6847 { |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6848 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
|
6849 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
|
6850 // 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
|
6851 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
|
6852 } |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6853 |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6854 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
|
6855 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
|
6856 |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6857 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
|
6858 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
|
6859 |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6860 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
|
6861 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
|
6862 |
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6863 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
|
6864 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
|
6865 |
13026
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6866 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
|
6867 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
|
6868 |
12287
20641a7e1fc9
patch 8.0.1023: it is not easy to identify a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
6869 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
|
6870 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
|
6871 |
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
|
6872 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
|
6873 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
|
6874 |
805f7fd40e0d
patch 8.0.1112: can't get size or current index from quickfix list
Christian Brabandt <cb@256bit.org>
parents:
12449
diff
changeset
|
6875 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
|
6876 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
|
6877 |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
6878 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
|
6879 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
|
6880 |
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
|
6881 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
|
6882 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
|
6883 |
16019
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6884 if (dict_find(what, (char_u *)"qfbufnr", -1) != NULL) |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6885 flags |= QF_GETLIST_QFBUFNR; |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6886 |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
6887 if (dict_find(what, (char_u *)"quickfixtextfunc", -1) != NULL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
6888 flags |= QF_GETLIST_QFTF; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
6889 |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6890 return flags; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6891 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6892 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6893 /* |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6894 * 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
|
6895 * 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
|
6896 * quickfix list index. |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6897 * 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
|
6898 * 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
|
6899 * 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
|
6900 * 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
|
6901 * 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
|
6902 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6903 static int |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6904 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
|
6905 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6906 int qf_idx; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6907 dictitem_T *di; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6908 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6909 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
|
6910 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
|
6911 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6912 // 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
|
6913 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
|
6914 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6915 // 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
|
6916 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
|
6917 { |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6918 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
|
6919 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
|
6920 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
|
6921 } |
7c0e0e923537
patch 8.0.1389: getqflist() items are missing if not set
Christian Brabandt <cb@256bit.org>
parents:
13016
diff
changeset
|
6922 } |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6923 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
|
6924 && 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
|
6925 && 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
|
6926 // 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
|
6927 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
|
6928 else |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6929 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
|
6930 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6931 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6932 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
|
6933 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6934 // 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
|
6935 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
|
6936 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
6937 // 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
|
6938 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
|
6939 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
|
6940 } |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6941 else |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
6942 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
|
6943 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6944 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6945 return qf_idx; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6946 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6947 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6948 /* |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6949 * 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
|
6950 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6951 static int |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
6952 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
|
6953 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6954 int status = OK; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6955 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6956 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
|
6957 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
|
6958 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
|
6959 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6960 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
|
6961 if (l != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6962 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
|
6963 else |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6964 status = FAIL; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6965 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6966 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
|
6967 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
|
6968 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
|
6969 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
|
6970 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
|
6971 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
|
6972 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
|
6973 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
|
6974 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
|
6975 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
|
6976 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
|
6977 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
|
6978 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
|
6979 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
|
6980 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
|
6981 status = dict_add_number(retdict, "filewinid", 0); |
16019
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6982 if ((status == OK) && (flags & QF_GETLIST_QFBUFNR)) |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
6983 status = qf_getprop_qfbufnr(qi, retdict); |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
6984 if ((status == OK) && (flags & QF_GETLIST_QFTF)) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
6985 status = dict_add_string(retdict, "quickfixtextfunc", (char_u *)""); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6986 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6987 return status; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6988 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6989 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6990 /* |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6991 * 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
|
6992 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6993 static int |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6994 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
|
6995 { |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
6996 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
|
6997 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6998 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
6999 /* |
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
|
7000 * 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
|
7001 * 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
|
7002 * 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
|
7003 */ |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
7004 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
|
7005 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
|
7006 { |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
7007 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
|
7008 |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
7009 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
|
7010 { |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
7011 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
|
7012 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
|
7013 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
|
7014 } |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
7015 |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
7016 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
|
7017 } |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
7018 |
8770189c3e22
patch 8.1.0345: cannot get the window id associated with the location list
Christian Brabandt <cb@256bit.org>
parents:
14633
diff
changeset
|
7019 /* |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7020 * Return the quickfix list items/entries as 'items' in retdict. |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7021 * If eidx is not 0, then return the item at the specified index. |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7022 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7023 static int |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7024 qf_getprop_items(qf_info_T *qi, int qf_idx, int eidx, 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
|
7025 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7026 int status = OK; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7027 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
|
7028 if (l != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7029 { |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7030 (void)get_errorlist(qi, NULL, qf_idx, eidx, l); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7031 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
|
7032 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7033 else |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7034 status = FAIL; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7035 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7036 return status; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7037 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7038 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7039 /* |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7040 * 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
|
7041 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7042 static int |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7043 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
|
7044 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7045 int status; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7046 dictitem_T *di; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7047 |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7048 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
|
7049 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7050 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
|
7051 if (di != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7052 { |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7053 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
|
7054 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
|
7055 if (status == FAIL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7056 dictitem_free(di); |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7057 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7058 else |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7059 status = FAIL; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7060 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7061 else |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14299
diff
changeset
|
7062 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
|
7063 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7064 return status; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7065 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7066 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7067 /* |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7068 * Return the current quickfix list index as 'idx' in retdict. |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7069 * If a specific entry index (eidx) is supplied, then use that. |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7070 */ |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7071 static int |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7072 qf_getprop_idx(qf_list_T *qfl, int eidx, dict_T *retdict) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7073 { |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7074 if (eidx == 0) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7075 { |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7076 eidx = qfl->qf_index; |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7077 if (qf_list_empty(qfl)) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7078 // For empty lists, current index is set to 0 |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7079 eidx = 0; |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7080 } |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7081 return dict_add_number(retdict, "idx", eidx); |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7082 } |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7083 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7084 /* |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7085 * Return the 'quickfixtextfunc' function of a quickfix/location list |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7086 */ |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7087 static int |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7088 qf_getprop_qftf(qf_list_T *qfl, dict_T *retdict) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7089 { |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7090 int status; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7091 |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7092 if (qfl->qftf_cb.cb_name != NULL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7093 { |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7094 typval_T tv; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7095 |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7096 put_callback(&qfl->qftf_cb, &tv); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7097 status = dict_add_tv(retdict, "quickfixtextfunc", &tv); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7098 clear_tv(&tv); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7099 } |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7100 else |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7101 status = dict_add_string(retdict, "quickfixtextfunc", (char_u *)""); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7102 |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7103 return status; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7104 } |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7105 |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7106 /* |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7107 * 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
|
7108 * 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
|
7109 * 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
|
7110 */ |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
7111 static int |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7112 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
|
7113 { |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7114 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
|
7115 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
|
7116 int status = OK; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7117 int qf_idx = INVALID_QFIDX; |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7118 int eidx = 0; |
13710
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7119 dictitem_T *di; |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7120 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
|
7121 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7122 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
|
7123 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
|
7124 |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7125 if (wp != NULL) |
b33f04873475
patch 8.0.1727: qf_get_properties() function is too long
Christian Brabandt <cb@256bit.org>
parents:
13660
diff
changeset
|
7126 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
|
7127 |
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
|
7128 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
|
7129 |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
7130 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
|
7131 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
|
7132 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7133 // 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
|
7134 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
|
7135 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
|
7136 |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7137 qfl = qf_get_list(qi, qf_idx); |
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
|
7138 |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7139 // If an entry index is specified, use that |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7140 if ((di = dict_find(what, (char_u *)"idx", -1)) != NULL) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7141 { |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7142 if (di->di_tv.v_type != VAR_NUMBER) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7143 return FAIL; |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7144 eidx = di->di_tv.vval.v_number; |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7145 } |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7146 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7147 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
|
7148 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
|
7149 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
|
7150 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
|
7151 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
|
7152 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
|
7153 if ((status == OK) && (flags & QF_GETLIST_ITEMS)) |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7154 status = qf_getprop_items(qi, qf_idx, eidx, retdict); |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7155 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
|
7156 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
|
7157 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
|
7158 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
|
7159 if ((status == OK) && (flags & QF_GETLIST_IDX)) |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7160 status = qf_getprop_idx(qfl, eidx, 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
|
7161 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
|
7162 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
|
7163 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
|
7164 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
|
7165 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
|
7166 status = qf_getprop_filewinid(wp, qi, retdict); |
16019
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
7167 if ((status == OK) && (flags & QF_GETLIST_QFBUFNR)) |
096b8ccd855e
patch 8.1.1015: quickfix buffer shows up in list, can't get buffer number
Bram Moolenaar <Bram@vim.org>
parents:
16001
diff
changeset
|
7168 status = qf_getprop_qfbufnr(qi, retdict); |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7169 if ((status == OK) && (flags & QF_GETLIST_QFTF)) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7170 status = qf_getprop_qftf(qfl, retdict); |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
7171 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7172 return status; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7173 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7174 |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7175 /* |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7176 * 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
|
7177 * 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
|
7178 * 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
|
7179 */ |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7180 static int |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7181 qf_add_entry_from_dict( |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7182 qf_list_T *qfl, |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7183 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
|
7184 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
|
7185 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
|
7186 { |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7187 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
|
7188 char_u *filename, *module, *pattern, *text, *type; |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
7189 int bufnum, valid, status, col, end_col, vcol, nr; |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
7190 long lnum, end_lnum; |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7191 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7192 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
|
7193 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
|
7194 |
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
|
7195 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
|
7196 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
|
7197 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
|
7198 lnum = (int)dict_get_number(d, (char_u *)"lnum"); |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
7199 end_lnum = (int)dict_get_number(d, (char_u *)"end_lnum"); |
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
|
7200 col = (int)dict_get_number(d, (char_u *)"col"); |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
7201 end_col = (int)dict_get_number(d, (char_u *)"end_col"); |
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
|
7202 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
|
7203 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
|
7204 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
|
7205 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
|
7206 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
|
7207 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
|
7208 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
|
7209 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7210 valid = TRUE; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7211 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
|
7212 valid = FALSE; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7213 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7214 // 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
|
7215 // 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
|
7216 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
|
7217 { |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7218 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
|
7219 { |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7220 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
|
7221 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
|
7222 } |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7223 valid = FALSE; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7224 bufnum = 0; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7225 } |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7226 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7227 // 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
|
7228 if ((dict_find(d, (char_u *)"valid", -1)) != NULL) |
22137
faaf88167b58
patch 8.2.1618: Vim9: cannot pass "true" to setloclist()
Bram Moolenaar <Bram@vim.org>
parents:
22099
diff
changeset
|
7229 valid = (int)dict_get_bool(d, (char_u *)"valid", FALSE); |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7230 |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7231 status = qf_add_entry(qfl, |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7232 NULL, // dir |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7233 filename, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7234 module, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7235 bufnum, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7236 text, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7237 lnum, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
7238 end_lnum, |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7239 col, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
7240 end_col, |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7241 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
|
7242 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
|
7243 nr, |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7244 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
|
7245 valid); |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7246 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7247 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
|
7248 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
|
7249 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
|
7250 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
|
7251 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
|
7252 |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
7253 if (valid) |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
7254 *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
|
7255 |
14633
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7256 return status; |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7257 } |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7258 |
462087b5c415
patch 8.1.0330: the qf_add_entries() function is too long
Christian Brabandt <cb@256bit.org>
parents:
14603
diff
changeset
|
7259 /* |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7260 * 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
|
7261 * a dictionary with item information. |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7262 */ |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7263 static int |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7264 qf_add_entries( |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7265 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
|
7266 int qf_idx, |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7267 list_T *list, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7268 char_u *title, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7269 int action) |
230 | 7270 { |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7271 qf_list_T *qfl = qf_get_list(qi, qf_idx); |
230 | 7272 listitem_T *li; |
7273 dict_T *d; | |
9175
d415c079f84e
commit https://github.com/vim/vim/commit/864293abb72d62604d8d6b458addfb43c14230c3
Christian Brabandt <cb@256bit.org>
parents:
9114
diff
changeset
|
7274 qfline_T *old_last = NULL; |
230 | 7275 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
|
7276 int valid_entry = FALSE; |
644 | 7277 |
11449
d2f00eb352b9
patch 8.0.0608: cannot manipulate other than the current quickfix list
Christian Brabandt <cb@256bit.org>
parents:
11447
diff
changeset
|
7278 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
|
7279 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7280 // make place for a new list |
3965 | 7281 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
|
7282 qf_idx = qi->qf_curlist; |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7283 qfl = qf_get_list(qi, qf_idx); |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7284 } |
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7285 else if (action == 'a' && !qf_list_empty(qfl)) |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7286 // 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
|
7287 old_last = qfl->qf_last; |
277 | 7288 else if (action == 'r') |
6079 | 7289 { |
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
|
7290 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
|
7291 qf_store_title(qfl, title); |
6079 | 7292 } |
230 | 7293 |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19649
diff
changeset
|
7294 FOR_ALL_LIST_ITEMS(list, li) |
230 | 7295 { |
7296 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
|
7297 continue; // Skip non-dict items |
230 | 7298 |
7299 d = li->li_tv.vval.v_dict; | |
7300 if (d == NULL) | |
7301 continue; | |
7302 | |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7303 retval = qf_add_entry_from_dict(qfl, d, li == list->lv_first, |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
7304 &valid_entry); |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7305 if (retval == QF_FAIL) |
230 | 7306 break; |
7307 } | |
7308 | |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
7309 // 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
|
7310 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
|
7311 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
|
7312 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
|
7313 // 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
|
7314 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
|
7315 |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
7316 // 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
|
7317 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
|
7318 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
|
7319 |
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
7320 // 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
|
7321 // list was empty before and it is not empty now. |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7322 if ((action != 'a' || qfl->qf_index == 0) && !qf_list_empty(qfl)) |
15225
a413374825dd
patch 8.1.0622: adding quickfix items marks items as valid errors
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
7323 qfl->qf_index = 1; |
230 | 7324 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7325 // 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
|
7326 qf_update_buffer(qi, old_last); |
230 | 7327 |
7328 return retval; | |
7329 } | |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7330 |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7331 /* |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7332 * 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
|
7333 */ |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7334 static int |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7335 qf_setprop_get_qfidx( |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7336 qf_info_T *qi, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7337 dict_T *what, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7338 int action, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7339 int *newlist) |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7340 { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7341 dictitem_T *di; |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7342 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
|
7343 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7344 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
|
7345 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7346 // 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
|
7347 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
|
7348 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7349 // 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
|
7350 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
|
7351 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
|
7352 |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
7353 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
|
7354 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7355 // 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
|
7356 // 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
|
7357 // stack. |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7358 *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
|
7359 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
|
7360 } |
11549
f5add45f9848
patch 8.0.0657: cannot get and set quickfix list items
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
7361 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
|
7362 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
|
7363 else if (action != ' ') |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7364 *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
|
7365 } |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
7366 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
|
7367 && 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
|
7368 && 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
|
7369 { |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
7370 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
|
7371 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
|
7372 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
|
7373 qf_idx = 0; |
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
7374 else |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7375 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
|
7376 } |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7377 else |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7378 return INVALID_QFIDX; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7379 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7380 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7381 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
|
7382 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7383 // 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
|
7384 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
|
7385 return INVALID_QFIDX; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7386 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7387 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
|
7388 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7389 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7390 return qf_idx; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7391 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7392 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7393 /* |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7394 * 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
|
7395 */ |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7396 static int |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7397 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
|
7398 { |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7399 qf_list_T *qfl = qf_get_list(qi, qf_idx); |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7400 |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7401 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
|
7402 return FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7403 |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7404 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
|
7405 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
|
7406 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
|
7407 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
|
7408 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7409 return OK; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7410 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7411 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7412 /* |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7413 * 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
|
7414 */ |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7415 static int |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7416 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
|
7417 { |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7418 int retval = FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7419 char_u *title_save; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7420 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7421 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
|
7422 return FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7423 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7424 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
|
7425 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
|
7426 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
|
7427 vim_free(title_save); |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7428 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7429 return retval; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7430 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7431 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7432 /* |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7433 * 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
|
7434 */ |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7435 static int |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7436 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
|
7437 qf_info_T *qi, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7438 int qf_idx, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7439 dict_T *what, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7440 dictitem_T *di, |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7441 int action) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7442 { |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7443 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
|
7444 dictitem_T *efm_di; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7445 int retval = FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7446 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7447 // 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
|
7448 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
|
7449 { |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7450 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
|
7451 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
|
7452 return FAIL; |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7453 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
|
7454 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7455 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7456 // 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
|
7457 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
|
7458 return FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7459 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7460 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
|
7461 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
|
7462 if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat, |
23045
450d6e4992e1
patch 8.2.2069: the quickfix window is not updated after setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
22979
diff
changeset
|
7463 FALSE, (linenr_T)0, (linenr_T)0, NULL, NULL) >= 0) |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7464 retval = OK; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7465 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7466 return retval; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7467 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7468 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7469 /* |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7470 * Set quickfix list context. |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7471 */ |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7472 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
|
7473 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
|
7474 { |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7475 typval_T *ctx; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7476 |
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
|
7477 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
|
7478 ctx = alloc_tv(); |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7479 if (ctx != NULL) |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7480 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
|
7481 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
|
7482 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7483 return OK; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7484 } |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7485 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7486 /* |
15424
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7487 * 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
|
7488 */ |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7489 static int |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7490 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
|
7491 { |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7492 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
|
7493 int newidx; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7494 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
|
7495 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
|
7496 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7497 // 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
|
7498 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
|
7499 && 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
|
7500 && 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
|
7501 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
|
7502 else |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7503 { |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7504 // 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
|
7505 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
|
7506 if (denote) |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7507 return FAIL; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7508 } |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7509 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7510 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
|
7511 return FAIL; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7512 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
|
7513 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
|
7514 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7515 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
|
7516 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
|
7517 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
|
7518 return FAIL; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7519 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
|
7520 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
|
7521 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7522 // 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
|
7523 // window, then Update it. |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
7524 if (qf_get_curlist(qi)->qf_id == qfl->qf_id) |
15424
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7525 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
|
7526 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7527 return OK; |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7528 } |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7529 |
90c8ff9c19ee
patch 8.1.0720: cannot easily change the current quickfx list index
Bram Moolenaar <Bram@vim.org>
parents:
15225
diff
changeset
|
7530 /* |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7531 * Set the current index in the specified quickfix list |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7532 */ |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7533 static int |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7534 qf_setprop_qftf(qf_info_T *qi UNUSED, qf_list_T *qfl, dictitem_T *di) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7535 { |
21409
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7536 callback_T cb; |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7537 |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7538 free_callback(&qfl->qftf_cb); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7539 cb = get_callback(&di->di_tv); |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7540 if (cb.cb_name != NULL && *cb.cb_name != NUL) |
2c40e60017a8
patch 8.2.1255: cannot use a lambda with quickfix functions
Bram Moolenaar <Bram@vim.org>
parents:
21102
diff
changeset
|
7541 set_callback(&qfl->qftf_cb, &cb); |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7542 |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7543 return OK; |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7544 } |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7545 |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7546 /* |
13760
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7547 * 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
|
7548 * 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
|
7549 * 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
|
7550 */ |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7551 static int |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7552 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
|
7553 { |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7554 dictitem_T *di; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7555 int retval = FAIL; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7556 int qf_idx; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7557 int newlist = FALSE; |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7558 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
|
7559 |
14887
863bdbc8465b
patch 8.1.0455: checking for empty quickfix stack is not consistent
Bram Moolenaar <Bram@vim.org>
parents:
14852
diff
changeset
|
7560 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
|
7561 newlist = TRUE; |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7562 |
aef8ba129a4f
patch 8.0.1752: qf_set_properties() is to long
Christian Brabandt <cb@256bit.org>
parents:
13756
diff
changeset
|
7563 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
|
7564 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
|
7565 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
|
7566 |
9982
e24aa20d815c
commit https://github.com/vim/vim/commit/2b529bb6260b52246e92429375d995b9b5ce76b6
Christian Brabandt <cb@256bit.org>
parents:
9931
diff
changeset
|
7567 if (newlist) |
e24aa20d815c
commit https://github.com/vim/vim/commit/2b529bb6260b52246e92429375d995b9b5ce76b6
Christian Brabandt <cb@256bit.org>
parents:
9931
diff
changeset
|
7568 { |
12084
69ce6b3f0834
patch 8.0.0922: quickfix list always added after current one
Christian Brabandt <cb@256bit.org>
parents:
12048
diff
changeset
|
7569 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
|
7570 qf_new_list(qi, title); |
9982
e24aa20d815c
commit https://github.com/vim/vim/commit/2b529bb6260b52246e92429375d995b9b5ce76b6
Christian Brabandt <cb@256bit.org>
parents:
9931
diff
changeset
|
7571 qf_idx = qi->qf_curlist; |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7572 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7573 |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
7574 qfl = qf_get_list(qi, qf_idx); |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7575 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
|
7576 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
|
7577 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
|
7578 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
|
7579 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
|
7580 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
|
7581 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
|
7582 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
|
7583 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
|
7584 retval = qf_setprop_curidx(qi, qfl, di); |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7585 if ((di = dict_find(what, (char_u *)"quickfixtextfunc", -1)) != NULL) |
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
7586 retval = qf_setprop_qftf(qi, qfl, di); |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7587 |
23045
450d6e4992e1
patch 8.2.2069: the quickfix window is not updated after setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
22979
diff
changeset
|
7588 if (newlist || retval == OK) |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
7589 qf_list_changed(qfl); |
23045
450d6e4992e1
patch 8.2.2069: the quickfix window is not updated after setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
22979
diff
changeset
|
7590 if (newlist) |
450d6e4992e1
patch 8.2.2069: the quickfix window is not updated after setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
22979
diff
changeset
|
7591 qf_update_buffer(qi, NULL); |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
7592 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7593 return retval; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7594 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7595 |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
7596 /* |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
7597 * 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
|
7598 * 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
|
7599 */ |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
7600 static void |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
7601 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
|
7602 { |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
7603 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
|
7604 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
|
7605 |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
7606 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
|
7607 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7608 // 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
|
7609 if (qi->qf_curlist < qi->qf_listcount) |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
7610 qf_free(qf_get_curlist(qi)); |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
7611 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
|
7612 } |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
7613 |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
7614 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
|
7615 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7616 // 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
|
7617 // 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
|
7618 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
|
7619 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
|
7620 wp = llwin; |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
7621 } |
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
7622 |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
7623 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
|
7624 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
|
7625 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7626 // 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
|
7627 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
|
7628 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
|
7629 } |
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
|
7630 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
|
7631 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7632 // 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
|
7633 // location list |
15042
e95e8b356a65
patch 8.1.0532: cannot distinguish between quickfix and location list
Bram Moolenaar <Bram@vim.org>
parents:
15024
diff
changeset
|
7634 qf_info_T *new_ll = qf_alloc_stack(QFLT_LOCATION); |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7635 |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7636 if (new_ll != NULL) |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7637 { |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7638 new_ll->qf_bufnr = qfwin->w_buffer->b_fnum; |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7639 |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7640 // first free the list reference in the location list window |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7641 ll_free_all(&qfwin->w_llist_ref); |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7642 |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7643 qfwin->w_llist_ref = new_ll; |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7644 if (wp != qfwin) |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7645 win_set_loclist(wp, new_ll); |
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
7646 } |
11301
cc8ece2aa389
patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Christian Brabandt <cb@256bit.org>
parents:
11263
diff
changeset
|
7647 } |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
7648 } |
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
7649 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7650 /* |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7651 * 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
|
7652 * 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
|
7653 * "action" is 'a' for add, 'r' for replace. Otherwise create a new list. |
21102
ebacf460b1b3
patch 8.2.1102: Coverity gets confused by an unnecessary NULL check
Bram Moolenaar <Bram@vim.org>
parents:
21100
diff
changeset
|
7654 * When "what" is not NULL then only set some properties. |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7655 */ |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7656 int |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7657 set_errorlist( |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7658 win_T *wp, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7659 list_T *list, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7660 int action, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7661 char_u *title, |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7662 dict_T *what) |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7663 { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7664 qf_info_T *qi = &ql_info; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7665 int retval = OK; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7666 |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7667 if (wp != NULL) |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7668 { |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7669 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
|
7670 if (qi == NULL) |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7671 return FAIL; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7672 } |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7673 |
11263
ae5f9f26f81c
patch 8.0.0517: there is no way to remove quickfix lists
Christian Brabandt <cb@256bit.org>
parents:
11195
diff
changeset
|
7674 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
|
7675 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7676 // 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
|
7677 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
|
7678 return OK; |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7679 } |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7680 |
21100
acfda84f5661
patch 8.2.1101: no error when using wrong arguments for setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
7681 // A dict argument cannot be specified with a non-empty list argument |
21102
ebacf460b1b3
patch 8.2.1102: Coverity gets confused by an unnecessary NULL check
Bram Moolenaar <Bram@vim.org>
parents:
21100
diff
changeset
|
7682 if (list->lv_len != 0 && what != NULL) |
21100
acfda84f5661
patch 8.2.1101: no error when using wrong arguments for setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
7683 { |
acfda84f5661
patch 8.2.1101: no error when using wrong arguments for setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
7684 semsg(_(e_invarg2), |
acfda84f5661
patch 8.2.1101: no error when using wrong arguments for setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
7685 _("cannot have both a list and a \"what\" argument")); |
acfda84f5661
patch 8.2.1101: no error when using wrong arguments for setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
7686 return FAIL; |
acfda84f5661
patch 8.2.1101: no error when using wrong arguments for setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
7687 } |
acfda84f5661
patch 8.2.1101: no error when using wrong arguments for setqflist()
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
7688 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7689 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7690 |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7691 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
|
7692 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
|
7693 else |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
7694 { |
11449
d2f00eb352b9
patch 8.0.0608: cannot manipulate other than the current quickfix list
Christian Brabandt <cb@256bit.org>
parents:
11447
diff
changeset
|
7695 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
|
7696 if (retval == OK) |
16001
416e067411ab
patch 8.1.1006: repeated code in quickfix support
Bram Moolenaar <Bram@vim.org>
parents:
15965
diff
changeset
|
7697 qf_list_changed(qf_get_curlist(qi)); |
13062
6479dadcf214
patch 8.0.1406: difficult to track changes to a quickfix list
Christian Brabandt <cb@256bit.org>
parents:
13056
diff
changeset
|
7698 } |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7699 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7700 decr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
7701 |
9850
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7702 return retval; |
67781bb0a61a
commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
Christian Brabandt <cb@256bit.org>
parents:
9738
diff
changeset
|
7703 } |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7704 |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
7705 /* |
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
7706 * 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
|
7707 */ |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7708 static int |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7709 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
|
7710 { |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7711 int i; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7712 int abort = FALSE; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7713 typval_T *ctx; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7714 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7715 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
|
7716 { |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7717 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
|
7718 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
|
7719 && 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
|
7720 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
|
7721 } |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7722 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7723 return abort; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7724 } |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7725 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7726 /* |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7727 * 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
|
7728 * "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
|
7729 */ |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7730 int |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7731 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
|
7732 { |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7733 int abort = FALSE; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7734 tabpage_T *tp; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7735 win_T *win; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7736 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7737 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
|
7738 if (abort) |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7739 return abort; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7740 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7741 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
|
7742 { |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7743 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
|
7744 { |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7745 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
|
7746 if (abort) |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7747 return abort; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7748 } |
13074
66c014c71dad
patch 8.0.1412: using free memory using setloclist()
Christian Brabandt <cb@256bit.org>
parents:
13066
diff
changeset
|
7749 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
|
7750 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7751 // 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
|
7752 // 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
|
7753 // 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
|
7754 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
|
7755 if (abort) |
66c014c71dad
patch 8.0.1412: using free memory using setloclist()
Christian Brabandt <cb@256bit.org>
parents:
13066
diff
changeset
|
7756 return abort; |
66c014c71dad
patch 8.0.1412: using free memory using setloclist()
Christian Brabandt <cb@256bit.org>
parents:
13066
diff
changeset
|
7757 } |
11412
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7758 } |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7759 |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7760 return abort; |
84baca75b7f2
patch 8.0.0590: cannot add a context to locations
Christian Brabandt <cb@256bit.org>
parents:
11398
diff
changeset
|
7761 } |
170 | 7762 #endif |
7763 | |
42 | 7764 /* |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7765 * Return the autocmd name for the :cbuffer Ex commands |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7766 */ |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7767 static char_u * |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7768 cbuffer_get_auname(cmdidx_T cmdidx) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7769 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7770 switch (cmdidx) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7771 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7772 case CMD_cbuffer: return (char_u *)"cbuffer"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7773 case CMD_cgetbuffer: return (char_u *)"cgetbuffer"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7774 case CMD_caddbuffer: return (char_u *)"caddbuffer"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7775 case CMD_lbuffer: return (char_u *)"lbuffer"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7776 case CMD_lgetbuffer: return (char_u *)"lgetbuffer"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7777 case CMD_laddbuffer: return (char_u *)"laddbuffer"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7778 default: return NULL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7779 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7780 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7781 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7782 /* |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7783 * Process and validate the arguments passed to the :cbuffer, :caddbuffer, |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7784 * :cgetbuffer, :lbuffer, :laddbuffer, :lgetbuffer Ex commands. |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7785 */ |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7786 static int |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7787 cbuffer_process_args( |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7788 exarg_T *eap, |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7789 buf_T **bufp, |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7790 linenr_T *line1, |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7791 linenr_T *line2) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7792 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7793 buf_T *buf = NULL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7794 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7795 if (*eap->arg == NUL) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7796 buf = curbuf; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7797 else if (*skipwhite(skipdigits(eap->arg)) == NUL) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7798 buf = buflist_findnr(atoi((char *)eap->arg)); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7799 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7800 if (buf == NULL) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7801 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7802 emsg(_(e_invarg)); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7803 return FAIL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7804 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7805 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7806 if (buf->b_ml.ml_mfp == NULL) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7807 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7808 emsg(_("E681: Buffer is not loaded")); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7809 return FAIL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7810 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7811 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7812 if (eap->addr_count == 0) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7813 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7814 eap->line1 = 1; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7815 eap->line2 = buf->b_ml.ml_line_count; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7816 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7817 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7818 if (eap->line1 < 1 || eap->line1 > buf->b_ml.ml_line_count |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7819 || eap->line2 < 1 || eap->line2 > buf->b_ml.ml_line_count) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7820 { |
25064
8f2262c72178
patch 8.2.3069: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
24964
diff
changeset
|
7821 emsg(_(e_invalid_range)); |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7822 return FAIL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7823 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7824 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7825 *line1 = eap->line1; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7826 *line2 = eap->line2; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7827 *bufp = buf; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7828 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7829 return OK; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7830 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7831 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7832 /* |
41 | 7833 * ":[range]cbuffer [bufnr]" command. |
657 | 7834 * ":[range]caddbuffer [bufnr]" command. |
798 | 7835 * ":[range]cgetbuffer [bufnr]" command. |
644 | 7836 * ":[range]lbuffer [bufnr]" command. |
657 | 7837 * ":[range]laddbuffer [bufnr]" command. |
798 | 7838 * ":[range]lgetbuffer [bufnr]" command. |
41 | 7839 */ |
7840 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
7841 ex_cbuffer(exarg_T *eap) |
41 | 7842 { |
7843 buf_T *buf = NULL; | |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
7844 qf_info_T *qi; |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7845 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
|
7846 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
|
7847 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
|
7848 win_T *wp = NULL; |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7849 char_u *qf_title; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7850 linenr_T line1; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7851 linenr_T line2; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7852 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7853 au_name = cbuffer_get_auname(eap->cmdidx); |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
7854 if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7855 curbuf->b_fname, TRUE, curbuf)) |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7856 { |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
7857 #ifdef FEAT_EVAL |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
7858 if (aborting()) |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7859 return; |
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7860 #endif |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
7861 } |
10056
21f685af3fc1
commit https://github.com/vim/vim/commit/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7862 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
7863 // Must come after autocommands. |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
7864 qi = qf_cmd_get_or_alloc_stack(eap, &wp); |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
7865 if (qi == NULL) |
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
7866 return; |
13076
7c071a3f7f8e
patch 8.0.1413: accessing freed memory in :cbuffer
Christian Brabandt <cb@256bit.org>
parents:
13074
diff
changeset
|
7867 |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7868 if (cbuffer_process_args(eap, &buf, &line1, &line2) == FAIL) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7869 return; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7870 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7871 qf_title = qf_cmdtitle(*eap->cmdlinep); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7872 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7873 if (buf->b_sfname) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7874 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7875 vim_snprintf((char *)IObuff, IOSIZE, "%s (%s)", |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7876 (char *)qf_title, (char *)buf->b_sfname); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7877 qf_title = IObuff; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7878 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7879 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7880 incr_quickfix_busy(); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7881 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7882 res = qf_init_ext(qi, qi->qf_curlist, NULL, buf, NULL, p_efm, |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7883 (eap->cmdidx != CMD_caddbuffer |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7884 && eap->cmdidx != CMD_laddbuffer), |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7885 line1, line2, |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7886 qf_title, NULL); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7887 if (qf_stack_empty(qi)) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7888 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7889 decr_quickfix_busy(); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7890 return; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7891 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7892 if (res >= 0) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7893 qf_list_changed(qf_get_curlist(qi)); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7894 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7895 // Remember the current quickfix list identifier, so that we can |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7896 // check for autocommands changing the current quickfix list. |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7897 save_qfid = qf_get_curlist(qi)->qf_id; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7898 if (au_name != NULL) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7899 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7900 buf_T *curbuf_old = curbuf; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7901 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7902 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7903 TRUE, curbuf); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7904 if (curbuf != curbuf_old) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7905 // Autocommands changed buffer, don't jump now, "qi" may |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7906 // be invalid. |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7907 res = 0; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7908 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7909 // Jump to the first error for a new list and if autocmds didn't |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7910 // free the list. |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7911 if (res > 0 && (eap->cmdidx == CMD_cbuffer || |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7912 eap->cmdidx == CMD_lbuffer) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7913 && qflist_valid(wp, save_qfid)) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7914 // display the first error |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7915 qf_jump_first(qi, save_qfid, eap->forceit); |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7916 |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7917 decr_quickfix_busy(); |
41 | 7918 } |
7919 | |
532 | 7920 #if defined(FEAT_EVAL) || defined(PROTO) |
41 | 7921 /* |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7922 * Return the autocmd name for the :cexpr Ex commands. |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7923 */ |
24590
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7924 char_u * |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7925 cexpr_get_auname(cmdidx_T cmdidx) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7926 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7927 switch (cmdidx) |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7928 { |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7929 case CMD_cexpr: return (char_u *)"cexpr"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7930 case CMD_cgetexpr: return (char_u *)"cgetexpr"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7931 case CMD_caddexpr: return (char_u *)"caddexpr"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7932 case CMD_lexpr: return (char_u *)"lexpr"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7933 case CMD_lgetexpr: return (char_u *)"lgetexpr"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7934 case CMD_laddexpr: return (char_u *)"laddexpr"; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7935 default: return NULL; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7936 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7937 } |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
7938 |
24590
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7939 int |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7940 trigger_cexpr_autocmd(int cmdidx) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7941 { |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7942 char_u *au_name = cexpr_get_auname(cmdidx); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7943 |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7944 if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7945 curbuf->b_fname, TRUE, curbuf)) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7946 { |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7947 if (aborting()) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7948 return FAIL; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7949 } |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7950 return OK; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7951 } |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7952 |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7953 int |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7954 cexpr_core(exarg_T *eap, typval_T *tv) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7955 { |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7956 qf_info_T *qi; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7957 win_T *wp = NULL; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7958 |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7959 qi = qf_cmd_get_or_alloc_stack(eap, &wp); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7960 if (qi == NULL) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7961 return FAIL; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7962 |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7963 if ((tv->v_type == VAR_STRING && tv->vval.v_string != NULL) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7964 || (tv->v_type == VAR_LIST && tv->vval.v_list != NULL)) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7965 { |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7966 int res; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7967 int_u save_qfid; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7968 char_u *au_name = cexpr_get_auname(eap->cmdidx); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7969 |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7970 incr_quickfix_busy(); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7971 res = qf_init_ext(qi, qi->qf_curlist, NULL, NULL, tv, p_efm, |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7972 (eap->cmdidx != CMD_caddexpr |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7973 && eap->cmdidx != CMD_laddexpr), |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7974 (linenr_T)0, (linenr_T)0, |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7975 qf_cmdtitle(*eap->cmdlinep), NULL); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7976 if (qf_stack_empty(qi)) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7977 { |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7978 decr_quickfix_busy(); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7979 return FAIL; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7980 } |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7981 if (res >= 0) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7982 qf_list_changed(qf_get_curlist(qi)); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7983 |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7984 // Remember the current quickfix list identifier, so that we can |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7985 // check for autocommands changing the current quickfix list. |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7986 save_qfid = qf_get_curlist(qi)->qf_id; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7987 if (au_name != NULL) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7988 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7989 curbuf->b_fname, TRUE, curbuf); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7990 |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7991 // Jump to the first error for a new list and if autocmds didn't |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7992 // free the list. |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7993 if (res > 0 && (eap->cmdidx == CMD_cexpr || eap->cmdidx == CMD_lexpr) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7994 && qflist_valid(wp, save_qfid)) |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7995 // display the first error |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7996 qf_jump_first(qi, save_qfid, eap->forceit); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7997 decr_quickfix_busy(); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7998 return OK; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
7999 } |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
8000 |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
8001 emsg(_("E777: String or List expected")); |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
8002 return FAIL; |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
8003 } |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
8004 |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
8005 /* |
798 | 8006 * ":cexpr {expr}", ":cgetexpr {expr}", ":caddexpr {expr}" command. |
8007 * ":lexpr {expr}", ":lgetexpr {expr}", ":laddexpr {expr}" command. | |
24590
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
8008 * Also: ":caddexpr", ":cgetexpr", "laddexpr" and "laddexpr". |
446 | 8009 */ |
8010 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
8011 ex_cexpr(exarg_T *eap) |
446 | 8012 { |
8013 typval_T *tv; | |
24590
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
8014 |
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
8015 if (trigger_cexpr_autocmd(eap->cmdidx) == FAIL) |
16215
4202f556aefe
patch 8.1.1112: duplicate code in quickfix file
Bram Moolenaar <Bram@vim.org>
parents:
16186
diff
changeset
|
8016 return; |
13090
a0c6910e7fa4
patch 8.0.1420: accessing freed memory in vimgrep
Christian Brabandt <cb@256bit.org>
parents:
13078
diff
changeset
|
8017 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8018 // 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
|
8019 // use it to fill the errorlist. |
20996
3af71cbcfdbe
patch 8.2.1049: Vim9: leaking memory when using continuation line
Bram Moolenaar <Bram@vim.org>
parents:
20814
diff
changeset
|
8020 tv = eval_expr(eap->arg, eap); |
625 | 8021 if (tv != NULL) |
8022 { | |
24590
2818f846f099
patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents:
24574
diff
changeset
|
8023 (void)cexpr_core(eap, tv); |
625 | 8024 free_tv(tv); |
8025 } | |
446 | 8026 } |
532 | 8027 #endif |
446 | 8028 |
8029 /* | |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8030 * 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
|
8031 */ |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8032 static qf_info_T * |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8033 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
|
8034 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8035 win_T *wp; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8036 qf_info_T *qi; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8037 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8038 // 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
|
8039 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
|
8040 wp = curwin; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8041 else |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8042 // 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
|
8043 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
|
8044 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8045 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
|
8046 qi = NULL; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8047 else |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8048 qi = wp->w_llist; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8049 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8050 if (qi == NULL) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8051 { |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8052 // 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
|
8053 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
|
8054 return NULL; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8055 *new_ll = TRUE; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8056 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8057 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8058 return qi; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8059 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8060 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8061 /* |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8062 * 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
|
8063 */ |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8064 static void |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8065 hgr_search_file( |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
8066 qf_list_T *qfl, |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8067 char_u *fname, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8068 vimconv_T *p_vc, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8069 regmatch_T *p_regmatch) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8070 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8071 FILE *fd; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8072 long lnum; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8073 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8074 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
|
8075 if (fd == NULL) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8076 return; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8077 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8078 lnum = 1; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8079 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
|
8080 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8081 char_u *line = IObuff; |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
8082 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8083 // 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
|
8084 // 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
|
8085 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
|
8086 && has_non_ascii(IObuff)) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8087 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8088 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
|
8089 if (line == NULL) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8090 line = IObuff; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8091 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8092 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8093 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
|
8094 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8095 int l = (int)STRLEN(line); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8096 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8097 // 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
|
8098 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
|
8099 line[--l] = NUL; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8100 |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
8101 if (qf_add_entry(qfl, |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8102 NULL, // dir |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8103 fname, |
13821
98274127d675
patch 8.0.1782: no simple way to label quickfix entries
Christian Brabandt <cb@256bit.org>
parents:
13819
diff
changeset
|
8104 NULL, |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8105 0, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8106 line, |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8107 lnum, |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
8108 0, |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8109 (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
|
8110 + 1, // col |
24964
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
8111 (int)(p_regmatch->endp[0] - line) |
f4aa891a5ab8
patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents:
24962
diff
changeset
|
8112 + 1, // end_col |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8113 FALSE, // vis_col |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8114 NULL, // search pattern |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8115 0, // nr |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8116 1, // type |
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8117 TRUE // valid |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16115
diff
changeset
|
8118 ) == QF_FAIL) |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8119 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8120 got_int = TRUE; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8121 if (line != IObuff) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8122 vim_free(line); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8123 break; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8124 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8125 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8126 if (line != IObuff) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8127 vim_free(line); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8128 ++lnum; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8129 line_breakcheck(); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8130 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8131 fclose(fd); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8132 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8133 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8134 /* |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8135 * 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
|
8136 * the given directory. |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8137 */ |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8138 static void |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8139 hgr_search_files_in_dir( |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
8140 qf_list_T *qfl, |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8141 char_u *dirname, |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
8142 regmatch_T *p_regmatch, |
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
8143 vimconv_T *p_vc |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8144 #ifdef FEAT_MULTI_LANG |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8145 , char_u *lang |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8146 #endif |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8147 ) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8148 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8149 int fcount; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8150 char_u **fnames; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8151 int fi; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8152 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8153 // 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
|
8154 add_pathsep(dirname); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8155 STRCAT(dirname, "doc/*.\\(txt\\|??x\\)"); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8156 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
|
8157 &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
|
8158 && fcount > 0) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8159 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8160 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
|
8161 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8162 #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
|
8163 // 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
|
8164 if (lang != NULL |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8165 && 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
|
8166 + 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
|
8167 && !(STRNICMP(lang, "en", 2) == 0 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8168 && STRNICMP("txt", fnames[fi] |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8169 + 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
|
8170 continue; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8171 #endif |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8172 |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
8173 hgr_search_file(qfl, 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
|
8174 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8175 FreeWild(fcount, fnames); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8176 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8177 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8178 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8179 /* |
13868
1282a54c1f5a
patch 8.0.1805: qf_parse_line() is too long
Christian Brabandt <cb@256bit.org>
parents:
13821
diff
changeset
|
8180 * 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
|
8181 * 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
|
8182 * '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
|
8183 * specified language are found. |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8184 */ |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8185 static void |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
8186 hgr_search_in_rtp(qf_list_T *qfl, 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
|
8187 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8188 char_u *p; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8189 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8190 vimconv_T vc; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8191 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8192 // 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
|
8193 // differs. |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8194 vc.vc_type = CONV_NONE; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8195 if (!enc_utf8) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8196 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
|
8197 |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8198 // 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
|
8199 p = p_rtp; |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8200 while (*p != NUL && !got_int) |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8201 { |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8202 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
|
8203 |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
8204 hgr_search_files_in_dir(qfl, NameBuff, p_regmatch, &vc |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8205 #ifdef FEAT_MULTI_LANG |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8206 , lang |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8207 #endif |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8208 ); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8209 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8210 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8211 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
|
8212 convert_setup(&vc, NULL, NULL); |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8213 } |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8214 |
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8215 /* |
7 | 8216 * ":helpgrep {pattern}" |
8217 */ | |
8218 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
8219 ex_helpgrep(exarg_T *eap) |
7 | 8220 { |
8221 regmatch_T regmatch; | |
8222 char_u *save_cpo; | |
644 | 8223 qf_info_T *qi = &ql_info; |
659 | 8224 int new_qi = FALSE; |
3269 | 8225 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
|
8226 char_u *lang = NULL; |
23493
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8227 int updated = FALSE; |
7 | 8228 |
3269 | 8229 switch (eap->cmdidx) |
8230 { | |
8231 case CMD_helpgrep: au_name = (char_u *)"helpgrep"; break; | |
8232 case CMD_lhelpgrep: au_name = (char_u *)"lhelpgrep"; break; | |
8233 default: break; | |
8234 } | |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
8235 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
|
8236 curbuf->b_fname, TRUE, curbuf)) |
3269 | 8237 { |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
8238 #ifdef FEAT_EVAL |
10346
d52d97bf675e
commit https://github.com/vim/vim/commit/21662be2211675824df1771c7f169948ede40c41
Christian Brabandt <cb@256bit.org>
parents:
10281
diff
changeset
|
8239 if (aborting()) |
3269 | 8240 return; |
8241 #endif | |
13380
69517d67421f
patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
13252
diff
changeset
|
8242 } |
3269 | 8243 |
14550
60b9b6196644
patch 8.1.0288: quickfix code uses cmdidx too often
Christian Brabandt <cb@256bit.org>
parents:
14507
diff
changeset
|
8244 if (is_loclist_cmd(eap->cmdidx)) |
659 | 8245 { |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8246 qi = hgr_get_ll(&new_qi); |
659 | 8247 if (qi == NULL) |
13764
7bba231fdddc
patch 8.0.1754: ex_helpgrep() is too long
Christian Brabandt <cb@256bit.org>
parents:
13760
diff
changeset
|
8248 return; |
659 | 8249 } |
8250 | |
16115
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
8251 // Make 'cpoptions' empty, the 'l' flag should not be used here. |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
8252 save_cpo = p_cpo; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
8253 p_cpo = empty_option; |
91da8cd462ef
patch 8.1.1062: quickfix code is repeated
Bram Moolenaar <Bram@vim.org>
parents:
16062
diff
changeset
|
8254 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
8255 incr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
8256 |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
8257 #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
|
8258 // 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
|
8259 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
|
8260 #endif |
7 | 8261 regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING); |
8262 regmatch.rm_ic = FALSE; | |
8263 if (regmatch.regprog != NULL) | |
8264 { | |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
8265 qf_list_T *qfl; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
8266 |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
8267 // 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
|
8268 qf_new_list(qi, qf_cmdtitle(*eap->cmdlinep)); |
16062
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
8269 qfl = qf_get_curlist(qi); |
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
8270 |
d1efe0dbe6b0
patch 8.1.1036: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16050
diff
changeset
|
8271 hgr_search_in_rtp(qfl, ®match, lang); |
3257 | 8272 |
4805
66803af09906
updated for version 7.3.1149
Bram Moolenaar <bram@vim.org>
parents:
4371
diff
changeset
|
8273 vim_regfree(regmatch.regprog); |
7 | 8274 |
14915
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
8275 qfl->qf_nonevalid = FALSE; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
8276 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
|
8277 qfl->qf_index = 1; |
f508bb2fb808
patch 8.1.0469: too often indexing in qf_lists[]
Bram Moolenaar <Bram@vim.org>
parents:
14899
diff
changeset
|
8278 qf_list_changed(qfl); |
23493
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8279 updated = TRUE; |
7 | 8280 } |
8281 | |
1672 | 8282 if (p_cpo == empty_option) |
8283 p_cpo = save_cpo; | |
8284 else | |
23493
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8285 { |
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8286 // Darn, some plugin changed the value. If it's still empty it was |
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8287 // changed and restored, need to restore in the complicated way. |
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8288 if (*p_cpo == NUL) |
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8289 set_option_value((char_u *)"cpo", 0L, save_cpo, 0); |
1672 | 8290 free_string_option(save_cpo); |
23493
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8291 } |
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8292 |
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8293 if (updated) |
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8294 // This may open a window and source scripts, do this after 'cpo' was |
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8295 // restored. |
f8382c4e6551
patch 8.2.2289: Vim9: 'cpo' can become empty
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
8296 qf_update_buffer(qi, NULL); |
7 | 8297 |
3269 | 8298 if (au_name != NULL) |
8299 { | |
8300 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, | |
8301 curbuf->b_fname, TRUE, curbuf); | |
20764
3c61d8ec36af
patch 8.2.0934: lhelpgrep twice in help window doesn't jump to the help topic
Bram Moolenaar <Bram@vim.org>
parents:
20762
diff
changeset
|
8302 // When adding a location list to an existing location list stack, |
3c61d8ec36af
patch 8.2.0934: lhelpgrep twice in help window doesn't jump to the help topic
Bram Moolenaar <Bram@vim.org>
parents:
20762
diff
changeset
|
8303 // if the autocmd made the stack invalid, then just return. |
3c61d8ec36af
patch 8.2.0934: lhelpgrep twice in help window doesn't jump to the help topic
Bram Moolenaar <Bram@vim.org>
parents:
20762
diff
changeset
|
8304 if (!new_qi && IS_LL_STACK(qi) && qf_find_win_with_loclist(qi) == NULL) |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
8305 { |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
8306 decr_quickfix_busy(); |
3269 | 8307 return; |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
8308 } |
3269 | 8309 } |
8310 | |
14899
e35d98651e56
patch 8.1.0461: quickfix code uses too many /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
14887
diff
changeset
|
8311 // Jump to first match. |
16050
c19853508d3e
patch 8.1.1030: quickfix function arguments are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16019
diff
changeset
|
8312 if (!qf_list_empty(qf_get_curlist(qi))) |
659 | 8313 qf_jump(qi, 0, 0, FALSE); |
9 | 8314 else |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15424
diff
changeset
|
8315 semsg(_(e_nomatch2), eap->arg); |
659 | 8316 |
14954
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
8317 decr_quickfix_busy(); |
69d2749a6a2f
patch 8.1.0488: using freed memory in quickfix code
Bram Moolenaar <Bram@vim.org>
parents:
14915
diff
changeset
|
8318 |
659 | 8319 if (eap->cmdidx == CMD_lhelpgrep) |
8320 { | |
14603
d1b69129db99
patch 8.1.0315: helpgrep with language doesn't work properly
Christian Brabandt <cb@256bit.org>
parents:
14560
diff
changeset
|
8321 // 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
|
8322 // 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
|
8323 if (!bt_help(curwin->w_buffer) || curwin->w_llist == qi) |
659 | 8324 { |
8325 if (new_qi) | |
8326 ll_free_all(&qi); | |
8327 } | |
8328 else if (curwin->w_llist == NULL) | |
8329 curwin->w_llist = qi; | |
8330 } | |
7 | 8331 } |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18697
diff
changeset
|
8332 #endif // FEAT_QUICKFIX |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8333 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8334 #if defined(FEAT_EVAL) || defined(PROTO) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8335 # ifdef FEAT_QUICKFIX |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8336 static void |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8337 get_qf_loc_list(int is_qf, win_T *wp, typval_T *what_arg, typval_T *rettv) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8338 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8339 if (what_arg->v_type == VAR_UNKNOWN) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8340 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8341 if (rettv_list_alloc(rettv) == OK) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8342 if (is_qf || wp != NULL) |
20631
d6827bd31d1d
patch 8.2.0869: it is not possible to customize the quickfix window contents
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
8343 (void)get_errorlist(NULL, wp, -1, 0, rettv->vval.v_list); |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8344 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8345 else |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8346 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8347 if (rettv_dict_alloc(rettv) == OK) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8348 if (is_qf || (wp != NULL)) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8349 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8350 if (what_arg->v_type == VAR_DICT) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8351 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8352 dict_T *d = what_arg->vval.v_dict; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8353 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8354 if (d != NULL) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8355 qf_get_properties(wp, d, rettv->vval.v_dict); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8356 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8357 else |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8358 emsg(_(e_dictreq)); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8359 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8360 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8361 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8362 # endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8363 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8364 /* |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8365 * "getloclist()" function |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8366 */ |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8367 void |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8368 f_getloclist(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8369 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8370 # ifdef FEAT_QUICKFIX |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8371 win_T *wp; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8372 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25320
diff
changeset
|
8373 if (in_vim9script() |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25320
diff
changeset
|
8374 && (check_for_number_arg(argvars, 0) == FAIL |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25320
diff
changeset
|
8375 || check_for_opt_dict_arg(argvars, 1) == FAIL)) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25320
diff
changeset
|
8376 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25320
diff
changeset
|
8377 |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8378 wp = find_win_by_nr_or_id(&argvars[0]); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8379 get_qf_loc_list(FALSE, wp, &argvars[1], rettv); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8380 # endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8381 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8382 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8383 /* |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8384 * "getqflist()" function |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8385 */ |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8386 void |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8387 f_getqflist(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8388 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8389 # ifdef FEAT_QUICKFIX |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25320
diff
changeset
|
8390 if (in_vim9script() && check_for_opt_dict_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25320
diff
changeset
|
8391 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25320
diff
changeset
|
8392 |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8393 get_qf_loc_list(TRUE, NULL, &argvars[0], rettv); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8394 # endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8395 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8396 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8397 /* |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8398 * Used by "setqflist()" and "setloclist()" functions |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8399 */ |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8400 static void |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8401 set_qf_ll_list( |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8402 win_T *wp UNUSED, |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8403 typval_T *list_arg UNUSED, |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8404 typval_T *action_arg UNUSED, |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8405 typval_T *what_arg UNUSED, |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8406 typval_T *rettv) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8407 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8408 # ifdef FEAT_QUICKFIX |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8409 static char *e_invact = N_("E927: Invalid action: '%s'"); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8410 char_u *act; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8411 int action = 0; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8412 static int recursive = 0; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8413 # endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8414 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8415 rettv->vval.v_number = -1; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8416 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8417 # ifdef FEAT_QUICKFIX |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8418 if (list_arg->v_type != VAR_LIST) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8419 emsg(_(e_listreq)); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8420 else if (recursive != 0) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8421 emsg(_(e_au_recursive)); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8422 else |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8423 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8424 list_T *l = list_arg->vval.v_list; |
21102
ebacf460b1b3
patch 8.2.1102: Coverity gets confused by an unnecessary NULL check
Bram Moolenaar <Bram@vim.org>
parents:
21100
diff
changeset
|
8425 dict_T *what = NULL; |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8426 int valid_dict = TRUE; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8427 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8428 if (action_arg->v_type == VAR_STRING) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8429 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8430 act = tv_get_string_chk(action_arg); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8431 if (act == NULL) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8432 return; // type error; errmsg already given |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8433 if ((*act == 'a' || *act == 'r' || *act == ' ' || *act == 'f') && |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8434 act[1] == NUL) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8435 action = *act; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8436 else |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8437 semsg(_(e_invact), act); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8438 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8439 else if (action_arg->v_type == VAR_UNKNOWN) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8440 action = ' '; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8441 else |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8442 emsg(_(e_stringreq)); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8443 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8444 if (action_arg->v_type != VAR_UNKNOWN |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8445 && what_arg->v_type != VAR_UNKNOWN) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8446 { |
21102
ebacf460b1b3
patch 8.2.1102: Coverity gets confused by an unnecessary NULL check
Bram Moolenaar <Bram@vim.org>
parents:
21100
diff
changeset
|
8447 if (what_arg->v_type == VAR_DICT && what_arg->vval.v_dict != NULL) |
ebacf460b1b3
patch 8.2.1102: Coverity gets confused by an unnecessary NULL check
Bram Moolenaar <Bram@vim.org>
parents:
21100
diff
changeset
|
8448 what = what_arg->vval.v_dict; |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8449 else |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8450 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8451 emsg(_(e_dictreq)); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8452 valid_dict = FALSE; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8453 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8454 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8455 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8456 ++recursive; |
21102
ebacf460b1b3
patch 8.2.1102: Coverity gets confused by an unnecessary NULL check
Bram Moolenaar <Bram@vim.org>
parents:
21100
diff
changeset
|
8457 if (l != NULL && action && valid_dict |
ebacf460b1b3
patch 8.2.1102: Coverity gets confused by an unnecessary NULL check
Bram Moolenaar <Bram@vim.org>
parents:
21100
diff
changeset
|
8458 && set_errorlist(wp, l, action, |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8459 (char_u *)(wp == NULL ? ":setqflist()" : ":setloclist()"), |
21102
ebacf460b1b3
patch 8.2.1102: Coverity gets confused by an unnecessary NULL check
Bram Moolenaar <Bram@vim.org>
parents:
21100
diff
changeset
|
8460 what) == OK) |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8461 rettv->vval.v_number = 0; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8462 --recursive; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8463 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8464 # endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8465 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8466 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8467 /* |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8468 * "setloclist()" function |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8469 */ |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8470 void |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8471 f_setloclist(typval_T *argvars, typval_T *rettv) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8472 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8473 win_T *win; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8474 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8475 rettv->vval.v_number = -1; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8476 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8477 if (in_vim9script() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8478 && (check_for_number_arg(argvars, 0) == FAIL |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8479 || check_for_list_arg(argvars, 1) == FAIL |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8480 || check_for_opt_string_arg(argvars, 2) == FAIL |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8481 || (argvars[2].v_type != VAR_UNKNOWN |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8482 && check_for_opt_dict_arg(argvars, 3) == FAIL))) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8483 return; |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8484 |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8485 win = find_win_by_nr_or_id(&argvars[0]); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8486 if (win != NULL) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8487 set_qf_ll_list(win, &argvars[1], &argvars[2], &argvars[3], rettv); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8488 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8489 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8490 /* |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8491 * "setqflist()" function |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8492 */ |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8493 void |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8494 f_setqflist(typval_T *argvars, typval_T *rettv) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8495 { |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8496 if (in_vim9script() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8497 && (check_for_list_arg(argvars, 0) == FAIL |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8498 || check_for_opt_string_arg(argvars, 1) == FAIL |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8499 || (argvars[1].v_type != VAR_UNKNOWN |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8500 && check_for_opt_dict_arg(argvars, 2) == FAIL))) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8501 return; |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25254
diff
changeset
|
8502 |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8503 set_qf_ll_list(NULL, &argvars[0], &argvars[1], &argvars[2], rettv); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8504 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
8505 #endif |