summaryrefslogtreecommitdiff
path: root/source/ap/vim/patches/7.3.072
blob: 88e54f9e103c55fdabe2d10e89dd3cc20da3f463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
To: vim_dev@googlegroups.com
Subject: Patch 7.3.072
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.072
Problem:    Can't complete file names while ignoring case.
Solution:   Add 'wildignorecase'.
Files:	    src/ex_docmd.c, src/ex_getln.c, src/misc1.c, src/option.c,
	    src/option.h, src/vim.h, runtime/doc/options.txt


*** ../vim-7.3.071/src/ex_docmd.c	2010-11-24 15:50:54.000000000 +0100
--- src/ex_docmd.c	2010-12-02 15:58:10.000000000 +0100
***************
*** 4524,4535 ****
  		else /* n == 2 */
  		{
  		    expand_T	xpc;
  
  		    ExpandInit(&xpc);
  		    xpc.xp_context = EXPAND_FILES;
  		    p = ExpandOne(&xpc, eap->arg, NULL,
! 					    WILD_LIST_NOTFOUND|WILD_ADD_SLASH,
! 						   WILD_EXPAND_FREE);
  		    if (p == NULL)
  			return FAIL;
  		}
--- 4524,4537 ----
  		else /* n == 2 */
  		{
  		    expand_T	xpc;
+ 		    int		options = WILD_LIST_NOTFOUND|WILD_ADD_SLASH;
  
  		    ExpandInit(&xpc);
  		    xpc.xp_context = EXPAND_FILES;
+ 		    if (p_wic)
+ 			options += WILD_ICASE;
  		    p = ExpandOne(&xpc, eap->arg, NULL,
! 						   options, WILD_EXPAND_FREE);
  		    if (p == NULL)
  			return FAIL;
  		}
*** ../vim-7.3.071/src/ex_getln.c	2010-11-16 14:05:48.000000000 +0100
--- src/ex_getln.c	2010-11-28 15:07:49.000000000 +0100
***************
*** 3339,3348 ****
  	    p2 = NULL;
  	else
  	{
  	    p2 = ExpandOne(xp, p1,
  			 vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
! 		    WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
! 							      |options, type);
  	    vim_free(p1);
  	    /* longest match: make sure it is not shorter, happens with :help */
  	    if (p2 != NULL && type == WILD_LONGEST)
--- 3339,3352 ----
  	    p2 = NULL;
  	else
  	{
+ 	    int use_options = options |
+ 		    WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE;
+ 
+ 	    if (p_wic)
+ 		use_options += WILD_ICASE;
  	    p2 = ExpandOne(xp, p1,
  			 vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
! 							   use_options, type);
  	    vim_free(p1);
  	    /* longest match: make sure it is not shorter, happens with :help */
  	    if (p2 != NULL && type == WILD_LONGEST)
***************
*** 3428,3433 ****
--- 3432,3438 ----
   * options = WILD_KEEP_ALL:	    don't remove 'wildignore' entries
   * options = WILD_SILENT:	    don't print warning messages
   * options = WILD_ESCAPE:	    put backslash before special chars
+  * options = WILD_ICASE:	    ignore case for files
   *
   * The variables xp->xp_context and xp->xp_backslash must have been set!
   */
***************
*** 4361,4366 ****
--- 4366,4372 ----
      char_u	***matches;	/* return: array of pointers to matches */
  {
      char_u	*file_str = NULL;
+     int		options = WILD_ADD_SLASH|WILD_SILENT;
  
      if (xp->xp_context == EXPAND_UNSUCCESSFUL)
      {
***************
*** 4379,4387 ****
      if (file_str == NULL)
  	return EXPAND_UNSUCCESSFUL;
  
      /* find all files that match the description */
!     if (ExpandFromContext(xp, file_str, matchcount, matches,
! 					  WILD_ADD_SLASH|WILD_SILENT) == FAIL)
      {
  	*matchcount = 0;
  	*matches = NULL;
--- 4385,4395 ----
      if (file_str == NULL)
  	return EXPAND_UNSUCCESSFUL;
  
+     if (p_wic)
+ 	options += WILD_ICASE;
+ 
      /* find all files that match the description */
!     if (ExpandFromContext(xp, file_str, matchcount, matches, options) == FAIL)
      {
  	*matchcount = 0;
  	*matches = NULL;
***************
*** 4433,4439 ****
      char_u	*pat;
      int		*num_file;
      char_u	***file;
!     int		options;
  {
  #ifdef FEAT_CMDL_COMPL
      regmatch_T	regmatch;
--- 4441,4447 ----
      char_u	*pat;
      int		*num_file;
      char_u	***file;
!     int		options;  /* EW_ flags */
  {
  #ifdef FEAT_CMDL_COMPL
      regmatch_T	regmatch;
***************
*** 4487,4492 ****
--- 4495,4503 ----
  	    flags |= (EW_FILE | EW_PATH);
  	else
  	    flags = (flags | EW_DIR) & ~EW_FILE;
+ 	if (options & WILD_ICASE)
+ 	    flags |= EW_ICASE;
+ 
  	/* Expand wildcards, supporting %:h and the like. */
  	ret = expand_wildcards_eval(&pat, num_file, file, flags);
  	if (free_pat)
*** ../vim-7.3.071/src/misc1.c	2010-08-16 21:46:12.000000000 +0200
--- src/misc1.c	2010-11-28 15:02:57.000000000 +0100
***************
*** 9161,9167 ****
  #ifdef CASE_INSENSITIVE_FILENAME
      regmatch.rm_ic = TRUE;		/* Behave like Terminal.app */
  #else
!     regmatch.rm_ic = FALSE;		/* Don't ever ignore case */
  #endif
      regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
      vim_free(pat);
--- 9161,9170 ----
  #ifdef CASE_INSENSITIVE_FILENAME
      regmatch.rm_ic = TRUE;		/* Behave like Terminal.app */
  #else
!     if (flags & EW_ICASE)
! 	regmatch.rm_ic = TRUE;		/* 'wildignorecase' set */
!     else
! 	regmatch.rm_ic = FALSE;		/* Don't ignore case */
  #endif
      regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
      vim_free(pat);
***************
*** 9643,9649 ****
      if (paths == NULL)
  	return 0;
  
!     files = globpath(paths, pattern, 0);
      vim_free(paths);
      if (files == NULL)
  	return 0;
--- 9646,9652 ----
      if (paths == NULL)
  	return 0;
  
!     files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0);
      vim_free(paths);
      if (files == NULL)
  	return 0;
*** ../vim-7.3.071/src/option.c	2010-12-02 15:33:10.000000000 +0100
--- src/option.c	2010-12-02 15:12:02.000000000 +0100
***************
*** 2740,2746 ****
  			    (char_u *)&p_wc, PV_NONE,
  			    {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
  			    SCRIPTID_INIT},
!     {"wildcharm",   "wcm",   P_NUM|P_VI_DEF,
  			    (char_u *)&p_wcm, PV_NONE,
  			    {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
      {"wildignore",  "wig",  P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
--- 2740,2746 ----
  			    (char_u *)&p_wc, PV_NONE,
  			    {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
  			    SCRIPTID_INIT},
!     {"wildcharm",   "wcm",  P_NUM|P_VI_DEF,
  			    (char_u *)&p_wcm, PV_NONE,
  			    {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
      {"wildignore",  "wig",  P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
***************
*** 2750,2755 ****
--- 2750,2758 ----
  			    (char_u *)NULL, PV_NONE,
  #endif
  			    {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
+     {"wildignorecase", "wic", P_BOOL|P_VI_DEF,
+ 			    (char_u *)&p_wic, PV_NONE,
+ 			    {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
      {"wildmenu",    "wmnu", P_BOOL|P_VI_DEF,
  #ifdef FEAT_WILDMENU
  			    (char_u *)&p_wmnu, PV_NONE,
*** ../vim-7.3.071/src/option.h	2010-08-15 21:57:28.000000000 +0200
--- src/option.h	2010-11-28 14:29:18.000000000 +0100
***************
*** 872,877 ****
--- 872,878 ----
  EXTERN char_u	*p_ww;		/* 'whichwrap' */
  EXTERN long	p_wc;		/* 'wildchar' */
  EXTERN long	p_wcm;		/* 'wildcharm' */
+ EXTERN long	p_wic;		/* 'wildignorecase' */
  EXTERN char_u	*p_wim;		/* 'wildmode' */
  #ifdef FEAT_WILDMENU
  EXTERN int	p_wmnu;		/* 'wildmenu' */
*** ../vim-7.3.071/src/vim.h	2010-10-20 19:17:43.000000000 +0200
--- src/vim.h	2010-11-28 14:49:02.000000000 +0100
***************
*** 798,803 ****
--- 798,804 ----
  #define WILD_KEEP_ALL		32
  #define WILD_SILENT		64
  #define WILD_ESCAPE		128
+ #define WILD_ICASE		256
  
  /* Flags for expand_wildcards() */
  #define EW_DIR		0x01	/* include directory names */
***************
*** 808,813 ****
--- 809,815 ----
  #define EW_SILENT	0x20	/* don't print "1 returned" from shell */
  #define EW_EXEC		0x40	/* executable files */
  #define EW_PATH		0x80	/* search in 'path' too */
+ #define EW_ICASE	0x100	/* ignore case */
  /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
   * is used when executing commands and EW_SILENT for interactive expanding. */
  
*** ../vim-7.3.071/runtime/doc/options.txt	2010-10-20 17:44:01.000000000 +0200
--- runtime/doc/options.txt	2010-12-02 11:15:01.000000000 +0100
***************
*** 7748,7753 ****
--- 7756,7772 ----
  	a pattern from the list.  This avoids problems when a future version
  	uses another default.
  
+ 
+ 			*'wildignorecase* *'wic'* *'nowildignorecase* *'nowic'*
+ 'wildignorecase' 'wic'	boolean	(default off)
+ 			global
+ 			{not in Vi}
+ 	When set case is ignored when completing file names and directories.
+ 	Has no effect on systems where file name case is generally ignored.
+ 	Does not apply when the shell is used to expand wildcards, which
+ 	happens when there are special characters.
+ 
+ 
  				*'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
  'wildmenu' 'wmnu'	boolean	(default off)
  			global
*** ../vim-7.3.071/src/version.c	2010-12-02 15:33:10.000000000 +0100
--- src/version.c	2010-12-02 15:57:14.000000000 +0100
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     72,
  /**/

-- 
I recommend ordering large cargo containers of paper towels to make up
whatever budget underruns you have.  Paper products are always useful and they
have the advantage of being completely flushable if you need to make room in
the storage area later.
				(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///