]>
Commit | Line | Data |
---|---|---|
fa254b05 AG |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.072 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.072 | |
11 | Problem: Can't complete file names while ignoring case. | |
12 | Solution: Add 'wildignorecase'. | |
13 | Files: src/ex_docmd.c, src/ex_getln.c, src/misc1.c, src/option.c, | |
14 | src/option.h, src/vim.h, runtime/doc/options.txt | |
15 | ||
16 | ||
17 | *** ../vim-7.3.071/src/ex_docmd.c 2010-11-24 15:50:54.000000000 +0100 | |
18 | --- src/ex_docmd.c 2010-12-02 15:58:10.000000000 +0100 | |
19 | *************** | |
20 | *** 4524,4535 **** | |
21 | else /* n == 2 */ | |
22 | { | |
23 | expand_T xpc; | |
24 | ||
25 | ExpandInit(&xpc); | |
26 | xpc.xp_context = EXPAND_FILES; | |
27 | p = ExpandOne(&xpc, eap->arg, NULL, | |
28 | ! WILD_LIST_NOTFOUND|WILD_ADD_SLASH, | |
29 | ! WILD_EXPAND_FREE); | |
30 | if (p == NULL) | |
31 | return FAIL; | |
32 | } | |
33 | --- 4524,4537 ---- | |
34 | else /* n == 2 */ | |
35 | { | |
36 | expand_T xpc; | |
37 | + int options = WILD_LIST_NOTFOUND|WILD_ADD_SLASH; | |
38 | ||
39 | ExpandInit(&xpc); | |
40 | xpc.xp_context = EXPAND_FILES; | |
41 | + if (p_wic) | |
42 | + options += WILD_ICASE; | |
43 | p = ExpandOne(&xpc, eap->arg, NULL, | |
44 | ! options, WILD_EXPAND_FREE); | |
45 | if (p == NULL) | |
46 | return FAIL; | |
47 | } | |
48 | *** ../vim-7.3.071/src/ex_getln.c 2010-11-16 14:05:48.000000000 +0100 | |
49 | --- src/ex_getln.c 2010-11-28 15:07:49.000000000 +0100 | |
50 | *************** | |
51 | *** 3339,3348 **** | |
52 | p2 = NULL; | |
53 | else | |
54 | { | |
55 | p2 = ExpandOne(xp, p1, | |
56 | vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len), | |
57 | ! WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE | |
58 | ! |options, type); | |
59 | vim_free(p1); | |
60 | /* longest match: make sure it is not shorter, happens with :help */ | |
61 | if (p2 != NULL && type == WILD_LONGEST) | |
62 | --- 3339,3352 ---- | |
63 | p2 = NULL; | |
64 | else | |
65 | { | |
66 | + int use_options = options | | |
67 | + WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE; | |
68 | + | |
69 | + if (p_wic) | |
70 | + use_options += WILD_ICASE; | |
71 | p2 = ExpandOne(xp, p1, | |
72 | vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len), | |
73 | ! use_options, type); | |
74 | vim_free(p1); | |
75 | /* longest match: make sure it is not shorter, happens with :help */ | |
76 | if (p2 != NULL && type == WILD_LONGEST) | |
77 | *************** | |
78 | *** 3428,3433 **** | |
79 | --- 3432,3438 ---- | |
80 | * options = WILD_KEEP_ALL: don't remove 'wildignore' entries | |
81 | * options = WILD_SILENT: don't print warning messages | |
82 | * options = WILD_ESCAPE: put backslash before special chars | |
83 | + * options = WILD_ICASE: ignore case for files | |
84 | * | |
85 | * The variables xp->xp_context and xp->xp_backslash must have been set! | |
86 | */ | |
87 | *************** | |
88 | *** 4361,4366 **** | |
89 | --- 4366,4372 ---- | |
90 | char_u ***matches; /* return: array of pointers to matches */ | |
91 | { | |
92 | char_u *file_str = NULL; | |
93 | + int options = WILD_ADD_SLASH|WILD_SILENT; | |
94 | ||
95 | if (xp->xp_context == EXPAND_UNSUCCESSFUL) | |
96 | { | |
97 | *************** | |
98 | *** 4379,4387 **** | |
99 | if (file_str == NULL) | |
100 | return EXPAND_UNSUCCESSFUL; | |
101 | ||
102 | /* find all files that match the description */ | |
103 | ! if (ExpandFromContext(xp, file_str, matchcount, matches, | |
104 | ! WILD_ADD_SLASH|WILD_SILENT) == FAIL) | |
105 | { | |
106 | *matchcount = 0; | |
107 | *matches = NULL; | |
108 | --- 4385,4395 ---- | |
109 | if (file_str == NULL) | |
110 | return EXPAND_UNSUCCESSFUL; | |
111 | ||
112 | + if (p_wic) | |
113 | + options += WILD_ICASE; | |
114 | + | |
115 | /* find all files that match the description */ | |
116 | ! if (ExpandFromContext(xp, file_str, matchcount, matches, options) == FAIL) | |
117 | { | |
118 | *matchcount = 0; | |
119 | *matches = NULL; | |
120 | *************** | |
121 | *** 4433,4439 **** | |
122 | char_u *pat; | |
123 | int *num_file; | |
124 | char_u ***file; | |
125 | ! int options; | |
126 | { | |
127 | #ifdef FEAT_CMDL_COMPL | |
128 | regmatch_T regmatch; | |
129 | --- 4441,4447 ---- | |
130 | char_u *pat; | |
131 | int *num_file; | |
132 | char_u ***file; | |
133 | ! int options; /* EW_ flags */ | |
134 | { | |
135 | #ifdef FEAT_CMDL_COMPL | |
136 | regmatch_T regmatch; | |
137 | *************** | |
138 | *** 4487,4492 **** | |
139 | --- 4495,4503 ---- | |
140 | flags |= (EW_FILE | EW_PATH); | |
141 | else | |
142 | flags = (flags | EW_DIR) & ~EW_FILE; | |
143 | + if (options & WILD_ICASE) | |
144 | + flags |= EW_ICASE; | |
145 | + | |
146 | /* Expand wildcards, supporting %:h and the like. */ | |
147 | ret = expand_wildcards_eval(&pat, num_file, file, flags); | |
148 | if (free_pat) | |
149 | *** ../vim-7.3.071/src/misc1.c 2010-08-16 21:46:12.000000000 +0200 | |
150 | --- src/misc1.c 2010-11-28 15:02:57.000000000 +0100 | |
151 | *************** | |
152 | *** 9161,9167 **** | |
153 | #ifdef CASE_INSENSITIVE_FILENAME | |
154 | regmatch.rm_ic = TRUE; /* Behave like Terminal.app */ | |
155 | #else | |
156 | ! regmatch.rm_ic = FALSE; /* Don't ever ignore case */ | |
157 | #endif | |
158 | regmatch.regprog = vim_regcomp(pat, RE_MAGIC); | |
159 | vim_free(pat); | |
160 | --- 9161,9170 ---- | |
161 | #ifdef CASE_INSENSITIVE_FILENAME | |
162 | regmatch.rm_ic = TRUE; /* Behave like Terminal.app */ | |
163 | #else | |
164 | ! if (flags & EW_ICASE) | |
165 | ! regmatch.rm_ic = TRUE; /* 'wildignorecase' set */ | |
166 | ! else | |
167 | ! regmatch.rm_ic = FALSE; /* Don't ignore case */ | |
168 | #endif | |
169 | regmatch.regprog = vim_regcomp(pat, RE_MAGIC); | |
170 | vim_free(pat); | |
171 | *************** | |
172 | *** 9643,9649 **** | |
173 | if (paths == NULL) | |
174 | return 0; | |
175 | ||
176 | ! files = globpath(paths, pattern, 0); | |
177 | vim_free(paths); | |
178 | if (files == NULL) | |
179 | return 0; | |
180 | --- 9646,9652 ---- | |
181 | if (paths == NULL) | |
182 | return 0; | |
183 | ||
184 | ! files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0); | |
185 | vim_free(paths); | |
186 | if (files == NULL) | |
187 | return 0; | |
188 | *** ../vim-7.3.071/src/option.c 2010-12-02 15:33:10.000000000 +0100 | |
189 | --- src/option.c 2010-12-02 15:12:02.000000000 +0100 | |
190 | *************** | |
191 | *** 2740,2746 **** | |
192 | (char_u *)&p_wc, PV_NONE, | |
193 | {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB} | |
194 | SCRIPTID_INIT}, | |
195 | ! {"wildcharm", "wcm", P_NUM|P_VI_DEF, | |
196 | (char_u *)&p_wcm, PV_NONE, | |
197 | {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, | |
198 | {"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, | |
199 | --- 2740,2746 ---- | |
200 | (char_u *)&p_wc, PV_NONE, | |
201 | {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB} | |
202 | SCRIPTID_INIT}, | |
203 | ! {"wildcharm", "wcm", P_NUM|P_VI_DEF, | |
204 | (char_u *)&p_wcm, PV_NONE, | |
205 | {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, | |
206 | {"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, | |
207 | *************** | |
208 | *** 2750,2755 **** | |
209 | --- 2750,2758 ---- | |
210 | (char_u *)NULL, PV_NONE, | |
211 | #endif | |
212 | {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, | |
213 | + {"wildignorecase", "wic", P_BOOL|P_VI_DEF, | |
214 | + (char_u *)&p_wic, PV_NONE, | |
215 | + {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, | |
216 | {"wildmenu", "wmnu", P_BOOL|P_VI_DEF, | |
217 | #ifdef FEAT_WILDMENU | |
218 | (char_u *)&p_wmnu, PV_NONE, | |
219 | *** ../vim-7.3.071/src/option.h 2010-08-15 21:57:28.000000000 +0200 | |
220 | --- src/option.h 2010-11-28 14:29:18.000000000 +0100 | |
221 | *************** | |
222 | *** 872,877 **** | |
223 | --- 872,878 ---- | |
224 | EXTERN char_u *p_ww; /* 'whichwrap' */ | |
225 | EXTERN long p_wc; /* 'wildchar' */ | |
226 | EXTERN long p_wcm; /* 'wildcharm' */ | |
227 | + EXTERN long p_wic; /* 'wildignorecase' */ | |
228 | EXTERN char_u *p_wim; /* 'wildmode' */ | |
229 | #ifdef FEAT_WILDMENU | |
230 | EXTERN int p_wmnu; /* 'wildmenu' */ | |
231 | *** ../vim-7.3.071/src/vim.h 2010-10-20 19:17:43.000000000 +0200 | |
232 | --- src/vim.h 2010-11-28 14:49:02.000000000 +0100 | |
233 | *************** | |
234 | *** 798,803 **** | |
235 | --- 798,804 ---- | |
236 | #define WILD_KEEP_ALL 32 | |
237 | #define WILD_SILENT 64 | |
238 | #define WILD_ESCAPE 128 | |
239 | + #define WILD_ICASE 256 | |
240 | ||
241 | /* Flags for expand_wildcards() */ | |
242 | #define EW_DIR 0x01 /* include directory names */ | |
243 | *************** | |
244 | *** 808,813 **** | |
245 | --- 809,815 ---- | |
246 | #define EW_SILENT 0x20 /* don't print "1 returned" from shell */ | |
247 | #define EW_EXEC 0x40 /* executable files */ | |
248 | #define EW_PATH 0x80 /* search in 'path' too */ | |
249 | + #define EW_ICASE 0x100 /* ignore case */ | |
250 | /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND | |
251 | * is used when executing commands and EW_SILENT for interactive expanding. */ | |
252 | ||
253 | *** ../vim-7.3.071/runtime/doc/options.txt 2010-10-20 17:44:01.000000000 +0200 | |
254 | --- runtime/doc/options.txt 2010-12-02 11:15:01.000000000 +0100 | |
255 | *************** | |
256 | *** 7748,7753 **** | |
257 | --- 7756,7772 ---- | |
258 | a pattern from the list. This avoids problems when a future version | |
259 | uses another default. | |
260 | ||
261 | + | |
262 | + *'wildignorecase* *'wic'* *'nowildignorecase* *'nowic'* | |
263 | + 'wildignorecase' 'wic' boolean (default off) | |
264 | + global | |
265 | + {not in Vi} | |
266 | + When set case is ignored when completing file names and directories. | |
267 | + Has no effect on systems where file name case is generally ignored. | |
268 | + Does not apply when the shell is used to expand wildcards, which | |
269 | + happens when there are special characters. | |
270 | + | |
271 | + | |
272 | *'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'* | |
273 | 'wildmenu' 'wmnu' boolean (default off) | |
274 | global | |
275 | *** ../vim-7.3.071/src/version.c 2010-12-02 15:33:10.000000000 +0100 | |
276 | --- src/version.c 2010-12-02 15:57:14.000000000 +0100 | |
277 | *************** | |
278 | *** 716,717 **** | |
279 | --- 716,719 ---- | |
280 | { /* Add new patch number below this line */ | |
281 | + /**/ | |
282 | + 72, | |
283 | /**/ | |
284 | ||
285 | -- | |
286 | I recommend ordering large cargo containers of paper towels to make up | |
287 | whatever budget underruns you have. Paper products are always useful and they | |
288 | have the advantage of being completely flushable if you need to make room in | |
289 | the storage area later. | |
290 | (Scott Adams - The Dilbert principle) | |
291 | ||
292 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
293 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
294 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
295 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |