source: patches/vim-7.2-branch_update-4.patch@ b609dca

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since b609dca was 43c52a1, checked in by Jim Gifford <clfs@…>, 16 years ago

VIM Branch Update Patch to -4

  • Property mode set to 100644
File size: 166.8 KB
RevLine 
[43c52a1]1Submitted By: Jim Gifford (jim at cross-lfs dot org)
2Date: 01-08-2009
[76dd250]3Initial Package Version: 7.2
4Origin: Upstream
5Upstream Status: Applied
[43c52a1]6Description: Contains all upstream patches up to 7.2.079
[76dd250]7 The following patches were skipped
[1f22c7c]8 007 036 041 049 071 072 074
[76dd250]9
10diff -Naur vim72.orig/Filelist vim72/Filelist
11--- vim72.orig/Filelist 2008-07-06 11:02:23.000000000 -0700
[43c52a1]12+++ vim72/Filelist 2009-01-08 20:57:31.000000000 -0800
[76dd250]13@@ -285,6 +285,7 @@
14 src/proto/os_win32.pro \
15 src/proto/os_mswin.pro \
16 src/testdir/Make_dos.mak \
17+ src/testdir/Make_ming.mak \
18 src/testdir/dos.vim \
19 src/uninstal.c \
20 src/vim.def \
21diff -Naur vim72.orig/runtime/doc/cmdline.txt vim72/runtime/doc/cmdline.txt
22--- vim72.orig/runtime/doc/cmdline.txt 2008-08-09 07:22:59.000000000 -0700
[43c52a1]23+++ vim72/runtime/doc/cmdline.txt 2009-01-08 20:57:32.000000000 -0800
[76dd250]24@@ -1,4 +1,4 @@
25-*cmdline.txt* For Vim version 7.2. Last change: 2008 Jul 29
26+*cmdline.txt* For Vim version 7.2. Last change: 2008 Sep 18
27
28
29 VIM REFERENCE MANUAL by Bram Moolenaar
30@@ -157,6 +157,11 @@
31 (doesn't work at the expression prompt; some
32 things such as changing the buffer or current
33 window are not allowed to avoid side effects)
34+ When the result is a |List| the items are used
35+ as lines. They can have line breaks inside
36+ too.
37+ When the result is a Float it's automatically
38+ converted to a String.
39 See |registers| about registers. {not in Vi}
40 Implementation detail: When using the |expression| register
41 and invoking setcmdpos(), this sets the position before
42@@ -730,19 +735,29 @@
43 In Ex commands, at places where a file name can be used, the following
44 characters have a special meaning. These can also be used in the expression
45 function expand() |expand()|.
46- % is replaced with the current file name *:_%*
47- # is replaced with the alternate file name *:_#*
48+ % Is replaced with the current file name. *:_%* *c_%*
49+ # Is replaced with the alternate file name. *:_#* *c_#*
50 #n (where n is a number) is replaced with the file name of
51- buffer n. "#0" is the same as "#"
52- ## is replaced with all names in the argument list *:_##*
53+ buffer n. "#0" is the same as "#".
54+ ## Is replaced with all names in the argument list *:_##* *c_##*
55 concatenated, separated by spaces. Each space in a name
56 is preceded with a backslash.
57-Note that these give the file name as it was typed. If an absolute path is
58-needed (when using the file name from a different directory), you need to add
59-":p". See |filename-modifiers|.
60+ #<n (where n is a number > 0) is replaced with old *:_#<* *c_#<*
61+ file name n. See |:oldfiles| or |v:oldfiles| to get the
62+ number. *E809*
63+ {only when compiled with the +eval and +viminfo features}
64+
65+Note that these, except "#<n", give the file name as it was typed. If an
66+absolute path is needed (when using the file name from a different directory),
67+you need to add ":p". See |filename-modifiers|.
68+
69+The "#<n" item returns an absolute path, but it will start with "~/" for files
70+below your home directory.
71+
72 Note that backslashes are inserted before spaces, so that the command will
73 correctly interpret the file name. But this doesn't happen for shell
74-commands. For those you probably have to use quotes: >
75+commands. For those you probably have to use quotes (this fails for files
76+that contain a quote and wildcards): >
77 :!ls "%"
78 :r !spell "%"
79
80diff -Naur vim72.orig/runtime/doc/eval.txt vim72/runtime/doc/eval.txt
81--- vim72.orig/runtime/doc/eval.txt 2008-08-09 07:22:59.000000000 -0700
[43c52a1]82+++ vim72/runtime/doc/eval.txt 2009-01-08 20:57:45.000000000 -0800
[76dd250]83@@ -1,4 +1,4 @@
84-*eval.txt* For Vim version 7.2. Last change: 2008 Aug 09
85+*eval.txt* For Vim version 7.2. Last change: 2008 Nov 27
86
87
88 VIM REFERENCE MANUAL by Bram Moolenaar
89@@ -1484,6 +1484,17 @@
90 This is the screen column number, like with |virtcol()|. The
91 value is zero when there was no mouse button click.
92
93+ *v:oldfiles* *oldfiles-variable*
94+v:oldfiles List of file names that is loaded from the |viminfo| file on
95+ startup. These are the files that Vim remembers marks for.
96+ The length of the List is limited by the ' argument of the
97+ 'viminfo' option (default is 100).
98+ Also see |:oldfiles| and |c_#<|.
99+ The List can be modified, but this has no effect on what is
100+ stored in the |viminfo| file later. If you use values other
101+ than String this will cause trouble.
102+ {only when compiled with the +viminfo feature}
103+
104 *v:operator* *operator-variable*
105 v:operator The last operator given in Normal mode. This is a single
106 character except for commands starting with <g> or <z>,
107@@ -1695,7 +1706,7 @@
108 exists( {expr}) Number TRUE if {expr} exists
109 extend({expr1}, {expr2} [, {expr3}])
110 List/Dict insert items of {expr2} into {expr1}
111-expand( {expr}) String expand special keywords in {expr}
112+expand( {expr} [, {flag}]) String expand special keywords in {expr}
113 feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer
114 filereadable( {file}) Number TRUE if {file} is a readable file
115 filewritable( {file}) Number TRUE if {file} is a writable file
116@@ -1747,8 +1758,9 @@
117 getwinposx() Number X coord in pixels of GUI Vim window
118 getwinposy() Number Y coord in pixels of GUI Vim window
119 getwinvar( {nr}, {varname}) any variable {varname} in window {nr}
120-glob( {expr}) String expand file wildcards in {expr}
121-globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path}
122+glob( {expr} [, {flag}]) String expand file wildcards in {expr}
123+globpath( {path}, {expr} [, {flag}])
124+ String do glob({expr}) for all dirs in {path}
125 has( {feature}) Number TRUE if feature {feature} supported
126 has_key( {dict}, {key}) Number TRUE if {dict} has entry {key}
127 haslocaldir() Number TRUE if current window executed |:lcd|
128@@ -3275,14 +3287,16 @@
129 :let list_is_on = getwinvar(2, '&list')
130 :echo "myvar = " . getwinvar(1, 'myvar')
131 <
132- *glob()*
133-glob({expr}) Expand the file wildcards in {expr}. See |wildcards| for the
134+glob({expr} [, {flag}]) *glob()*
135+ Expand the file wildcards in {expr}. See |wildcards| for the
136 use of special characters.
137 The result is a String.
138 When there are several matches, they are separated by <NL>
139 characters.
140- The 'wildignore' option applies: Names matching one of the
141- patterns in 'wildignore' will be skipped.
142+ Unless the optional {flag} argument is given and is non-zero,
143+ the 'suffixes' and 'wildignore' options apply: Names matching
144+ one of the patterns in 'wildignore' will be skipped and
145+ 'suffixes' affect the ordering of matches.
146 If the expansion fails, the result is an empty string.
147 A name for a non-existing file is not included.
148
149@@ -3296,20 +3310,22 @@
150 See |expand()| for expanding special Vim variables. See
151 |system()| for getting the raw output of an external command.
152
153-globpath({path}, {expr}) *globpath()*
154+globpath({path}, {expr} [, {flag}]) *globpath()*
155 Perform glob() on all directories in {path} and concatenate
156 the results. Example: >
157 :echo globpath(&rtp, "syntax/c.vim")
158 < {path} is a comma-separated list of directory names. Each
159 directory name is prepended to {expr} and expanded like with
160- glob(). A path separator is inserted when needed.
161+ |glob()|. A path separator is inserted when needed.
162 To add a comma inside a directory name escape it with a
163 backslash. Note that on MS-Windows a directory may have a
164 trailing backslash, remove it if you put a comma after it.
165 If the expansion fails for one of the directories, there is no
166 error message.
167- The 'wildignore' option applies: Names matching one of the
168- patterns in 'wildignore' will be skipped.
169+ Unless the optional {flag} argument is given and is non-zero,
170+ the 'suffixes' and 'wildignore' options apply: Names matching
171+ one of the patterns in 'wildignore' will be skipped and
172+ 'suffixes' affect the ordering of matches.
173
174 The "**" item can be used to search in a directory tree.
175 For example, to find all "README.txt" files in the directories
176@@ -5332,10 +5348,12 @@
177 "fg" foreground color (GUI: color name used to set
178 the color, cterm: color number as a string,
179 term: empty string)
180- "bg" background color (like "fg")
181+ "bg" background color (as with "fg")
182+ "sp" special color (as with "fg") |highlight-guisp|
183 "fg#" like "fg", but for the GUI and the GUI is
184 running the name in "#RRGGBB" form
185 "bg#" like "fg#" for "bg"
186+ "sp#" like "fg#" for "sp"
187 "bold" "1" if bold
188 "italic" "1" if italic
189 "reverse" "1" if reverse
190@@ -5823,7 +5841,8 @@
191 mouse_pterm Compiled with support for qnx pterm mouse.
192 mouse_sysmouse Compiled with support for sysmouse (*BSD console mouse)
193 mouse_xterm Compiled with support for xterm mouse.
194-multi_byte Compiled with support for editing Korean et al.
195+multi_byte Compiled with support for 'encoding'
196+multi_byte_encoding 'encoding' is set to a multi-byte encoding.
197 multi_byte_ime Compiled with support for IME input method.
198 multi_lang Compiled with support for multiple languages.
199 mzscheme Compiled with MzScheme interface |mzscheme|.
[43c52a1]200diff -Naur vim72.orig/runtime/doc/netbeans.txt vim72/runtime/doc/netbeans.txt
201--- vim72.orig/runtime/doc/netbeans.txt 2008-08-09 07:22:59.000000000 -0700
202+++ vim72/runtime/doc/netbeans.txt 2009-01-08 20:57:54.000000000 -0800
203@@ -1,4 +1,4 @@
204-*netbeans.txt* For Vim version 7.2. Last change: 2008 Jun 28
205+*netbeans.txt* For Vim version 7.2. Last change: 2009 Jan 06
206
207
208 VIM REFERENCE MANUAL by Gordon Prieur et al.
209@@ -722,8 +722,10 @@
210 of the cursor.
211 New in version 2.1.
212
213-killed A file was closed by the user. Only for files that have been
214- assigned a number by the IDE.
215+killed A file was deleted or wiped out by the user and the buffer
216+ annotations have been removed. The bufID number for this
217+ buffer has become invalid. Only for files that have been
218+ assigned a bufID number by the IDE.
219
220 newDotAndMark off off
221 Reports the position of the cursor being at "off" bytes into
[76dd250]222diff -Naur vim72.orig/runtime/doc/options.txt vim72/runtime/doc/options.txt
223--- vim72.orig/runtime/doc/options.txt 2008-08-09 07:22:59.000000000 -0700
[43c52a1]224+++ vim72/runtime/doc/options.txt 2009-01-08 20:57:43.000000000 -0800
[76dd250]225@@ -1,4 +1,4 @@
226-*options.txt* For Vim version 7.2. Last change: 2008 Aug 06
227+*options.txt* For Vim version 7.2. Last change: 2008 Nov 25
228
229
230 VIM REFERENCE MANUAL by Bram Moolenaar
231@@ -7472,7 +7472,9 @@
232 {not available when compiled without the |+wildignore|
233 feature}
234 A list of file patterns. A file that matches with one of these
235- patterns is ignored when completing file or directory names.
236+ patterns is ignored when completing file or directory names, and
237+ influences the result of |expand()|, |glob()| and |globpath()| unless
238+ a flag is passed to disable this.
239 The pattern is used like with |:autocmd|, see |autocmd-patterns|.
240 Also see 'suffixes'.
241 Example: >
242diff -Naur vim72.orig/runtime/doc/spell.txt vim72/runtime/doc/spell.txt
243--- vim72.orig/runtime/doc/spell.txt 2008-08-09 07:23:00.000000000 -0700
[43c52a1]244+++ vim72/runtime/doc/spell.txt 2009-01-08 20:57:45.000000000 -0800
[76dd250]245@@ -1,4 +1,4 @@
246-*spell.txt* For Vim version 7.2. Last change: 2008 Jun 21
247+*spell.txt* For Vim version 7.2. Last change: 2008 Nov 30
248
249
250 VIM REFERENCE MANUAL by Bram Moolenaar
251@@ -831,8 +831,11 @@
252
253 # comment line ~
254
255-With some items it's also possible to put a comment after it, but this isn't
256-supported in general.
257+Items with a fixed number of arguments can be followed by a comment. But only
258+if none of the arguments can contain white space. The comment must start with
259+a "#" character. Example:
260+
261+ KEEPCASE = # fix case for words with this flag ~
262
263
264 ENCODING *spell-SET*
265@@ -965,6 +968,9 @@
266
267 Note: When using utf-8 only characters up to 65000 may be used for flags.
268
269+Note: even when using "num" or "long" the number of flags available to
270+compounding and prefixes is limited to about 250.
271+
272
273 AFFIXES
274 *spell-PFX* *spell-SFX*
275@@ -1178,6 +1184,9 @@
276 The flag also applies to the word with affixes, thus this can be used to mark
277 a whole bunch of related words as bad.
278
279+ *spell-FORBIDDENWORD*
280+FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell.
281+
282 *spell-NEEDAFFIX*
283 The NEEDAFFIX flag is used to require that a word is used with an affix. The
284 word itself is not a good word (unless there is an empty affix). Example:
285@@ -1268,6 +1277,10 @@
286
287 NEEDCOMPOUND & ~
288
289+ *spell-ONLYINCOMPOUND*
290+The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for
291+compatiblity with Hunspell.
292+
293 *spell-COMPOUNDMIN*
294 The minimal character length of a word used for compounding is specified with
295 COMPOUNDMIN. Example:
296@@ -1328,6 +1341,20 @@
297 rules. Can also be used for an affix to count the affix as a compounding
298 word.
299
300+ *spell-CHECKCOMPOUNDPATTERN*
301+CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
302+position where two words are compounded together forbids the compound.
303+For example:
304+ CHECKCOMPOUNDPATTERN o e ~
305+
306+This forbids compounding if the first word ends in "o" and the second word
307+starts with "e".
308+
309+The arguments must be plain text, no patterns are actually supported, despite
310+the item name. Case is always ignored.
311+
312+The Hunspell feature to use three arguments and flags is not supported.
313+
314 *spell-SYLLABLE*
315 The SYLLABLE item defines characters or character sequences that are used to
316 count the number of syllables in a word. Example:
317@@ -1496,6 +1523,10 @@
318 ACCENT (Hunspell) *spell-ACCENT*
319 Use MAP instead. |spell-MAP|
320
321+BREAK (Hunspell) *spell-BREAK*
322+ Define break points. Unclear how it works exactly.
323+ Not supported.
324+
325 CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE*
326 Disallow uppercase letters at compound word boundaries.
327 Not supported.
328@@ -1512,9 +1543,6 @@
329 Forbid three identical characters when compounding. Not
330 supported.
331
332-CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN*
333- Forbid compounding when patterns match. Not supported.
334-
335 COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES*
336 Enables using two prefixes. Not supported.
337
338@@ -1536,13 +1564,18 @@
339 COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
340 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
341
342+COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES*
343+ Number of COMPOUNDRULE lines following. Ignored, but the
344+ argument must be a number.
345+
346 COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
347 Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
348 |spell-COMPOUNDSYLMAX|
349
350-FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD*
351- Use BAD instead. |spell-BAD|
352-
353+KEY (Hunspell) *spell-KEY*
354+ Define characters that are close together on the keyboard.
355+ Used to give better suggestions. Not supported.
356+
357 LANG (Hunspell) *spell-LANG*
358 This specifies language-specific behavior. This actually
359 moves part of the language knowledge into the program,
360@@ -1553,10 +1586,7 @@
361 Only needed for morphological analysis.
362
363 MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
364- Not supported.
365-
366-ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND*
367- Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND|
368+ Set number of n-gram suggestions. Not supported.
369
370 PSEUDOROOT (Hunspell) *spell-PSEUDOROOT*
371 Use NEEDAFFIX instead. |spell-NEEDAFFIX|
372diff -Naur vim72.orig/runtime/doc/starting.txt vim72/runtime/doc/starting.txt
373--- vim72.orig/runtime/doc/starting.txt 2008-08-09 07:23:00.000000000 -0700
[43c52a1]374+++ vim72/runtime/doc/starting.txt 2009-01-08 20:57:32.000000000 -0800
[76dd250]375@@ -1,4 +1,4 @@
376-*starting.txt* For Vim version 7.2. Last change: 2008 Jun 21
377+*starting.txt* For Vim version 7.2. Last change: 2008 Nov 09
378
379
380 VIM REFERENCE MANUAL by Bram Moolenaar
381@@ -1337,8 +1337,9 @@
382 *viminfo-read*
383 When Vim is started and the 'viminfo' option is non-empty, the contents of
384 the viminfo file are read and the info can be used in the appropriate places.
385-The marks are not read in at startup (but file marks are). See
386-|initialization| for how to set the 'viminfo' option upon startup.
387+The |v:oldfiles| variable is filled. The marks are not read in at startup
388+(but file marks are). See |initialization| for how to set the 'viminfo'
389+option upon startup.
390
391 *viminfo-write*
392 When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo
393@@ -1372,6 +1373,8 @@
394 that start with any string given with the "r" flag in 'viminfo'. This can be
395 used to avoid saving marks for files on removable media (for MS-DOS you would
396 use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:").
397+The |v:oldfiles| variable is filled with the file names that the viminfo file
398+has marks for.
399
400 *viminfo-file-marks*
401 Uppercase marks ('A to 'Z) are stored when writing the viminfo file. The
402@@ -1463,8 +1466,8 @@
403 *:rv* *:rviminfo* *E195*
404 :rv[iminfo][!] [file] Read from viminfo file [file] (default: see above).
405 If [!] is given, then any information that is
406- already set (registers, marks, etc.) will be
407- overwritten. {not in Vi}
408+ already set (registers, marks, |v:oldfiles|, etc.)
409+ will be overwritten {not in Vi}
410
411 *:wv* *:wviminfo* *E137* *E138* *E574*
412 :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
413@@ -1479,4 +1482,20 @@
414 the .viminfo file.
415 {not in Vi}
416
417+ *:ol* *:oldfiles*
418+:ol[dfiles] List the files that have marks stored in the viminfo
419+ file. This list is read on startup and only changes
420+ afterwards with ":rviminfo!". Also see |v:oldfiles|.
421+ The number can be used with |c_#<|.
422+ {not in Vi, only when compiled with the +eval feature}
423+
424+:bro[wse] ol[dfiles][!]
425+ List file names as with |:oldfiles|, and then prompt
426+ for a number. When the number is valid that file from
427+ the list is edited.
428+ If you get the |press-enter| prompt you can press "q"
429+ and still get the prompt to enter a file number.
430+ Use ! to abondon a modified buffer. |abandon|
431+ {not when compiled with tiny or small features}
432+
433 vim:tw=78:ts=8:ft=help:norl:
434diff -Naur vim72.orig/runtime/doc/usr_21.txt vim72/runtime/doc/usr_21.txt
435--- vim72.orig/runtime/doc/usr_21.txt 2008-08-09 07:23:01.000000000 -0700
[43c52a1]436+++ vim72/runtime/doc/usr_21.txt 2009-01-08 20:57:32.000000000 -0800
[76dd250]437@@ -1,4 +1,4 @@
438-*usr_21.txt* For Vim version 7.2. Last change: 2007 May 01
439+*usr_21.txt* For Vim version 7.2. Last change: 2008 Nov 09
440
441 VIM USER MANUAL - by Bram Moolenaar
442
443@@ -153,7 +153,7 @@
444 to be lost. Each item can be remembered only once.
445
446
447-GETTING BACK TO WHERE YOU WERE
448+GETTING BACK TO WHERE YOU STOPPED VIM
449
450 You are halfway editing a file and it's time to leave for holidays. You exit
451 Vim and go enjoy yourselves, forgetting all about your work. After a couple
452@@ -168,6 +168,48 @@
453 The |:marks| command is useful to find out where '0 to '9 will take you.
454
455
456+GETTING BACK TO SOME FILE
457+
458+If you want to go back to a file that you edited recently, but not when
459+exiting Vim, there is a slightly more complicated way. You can see a list of
460+files by typing the command: >
461+
462+ :oldfiles
463+< 1: ~/.viminfo ~
464+ 2: ~/text/resume.txt ~
465+ 3: /tmp/draft ~
466+
467+Now you would like to edit the second file, which is in the list preceded by
468+"2:". You type: >
469+
470+ :e #<2
471+
472+Instead of ":e" you can use any command that has a file name argument, the
473+"#<2" item works in the same place as "%" (current file name) and "#"
474+(alternate file name). So you can also split the window to edit the third
475+file: >
476+
477+ :split #<3
478+
479+That #<123 thing is a bit complicated when you just want to edit a file.
480+Fortunately there is a simpler way: >
481+
482+ :browse oldfiles
483+< 1: ~/.viminfo ~
484+ 2: ~/text/resume.txt ~
485+ 3: /tmp/draft ~
486+ -- More --
487+
488+You get the same list of files as with |:oldfiles|. If you want to edit
489+"resume.txt" first press "q" to stop the listing. You will get a prompt:
490+
491+ Type number and <Enter> (empty cancels): ~
492+
493+Type "2" and press <Enter> to edit the second file.
494+
495+More info at |:oldfiles|, |v:oldfiles| and |c_#<|.
496+
497+
498 MOVE INFO FROM ONE VIM TO ANOTHER
499
500 You can use the ":wviminfo" and ":rviminfo" commands to save and restore the
501diff -Naur vim72.orig/runtime/scripts.vim vim72/runtime/scripts.vim
502--- vim72.orig/runtime/scripts.vim 2008-08-08 15:27:21.000000000 -0700
[43c52a1]503+++ vim72/runtime/scripts.vim 2009-01-08 20:57:27.000000000 -0800
[76dd250]504@@ -234,6 +234,10 @@
505 elseif s:line1 =~ '\<DTD\s\+XHTML\s'
506 set ft=xhtml
507
508+ " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
509+ elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
510+ set ft=html
511+
512 " PDF
513 elseif s:line1 =~ '^%PDF-'
514 set ft=pdf
515diff -Naur vim72.orig/src/auto/configure vim72/src/auto/configure
516--- vim72.orig/src/auto/configure 2008-07-24 05:40:36.000000000 -0700
[43c52a1]517+++ vim72/src/auto/configure 2009-01-08 20:57:39.000000000 -0800
[76dd250]518@@ -16819,21 +16819,29 @@
519 LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
520 fi
521
522-{ $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
523-$as_echo_n "checking for GCC 3 or later... " >&6; }
524 DEPEND_CFLAGS_FILTER=
525 if test "$GCC" = yes; then
526+ { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
527+$as_echo_n "checking for GCC 3 or later... " >&6; }
528 gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
529 if test "$gccmajor" -gt "2"; then
530 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
531- fi
532-fi
533-if test "$DEPEND_CFLAGS_FILTER" = ""; then
534- { $as_echo "$as_me:$LINENO: result: no" >&5
535+ { $as_echo "$as_me:$LINENO: result: yes" >&5
536+$as_echo "yes" >&6; }
537+ else
538+ { $as_echo "$as_me:$LINENO: result: no" >&5
539 $as_echo "no" >&6; }
540-else
541- { $as_echo "$as_me:$LINENO: result: yes" >&5
542+ fi
543+ { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5
544+$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
545+ if test "$gccmajor" -gt "3"; then
546+ CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
547+ { $as_echo "$as_me:$LINENO: result: yes" >&5
548 $as_echo "yes" >&6; }
549+ else
550+ { $as_echo "$as_me:$LINENO: result: no" >&5
551+$as_echo "no" >&6; }
552+ fi
553 fi
554
555
556diff -Naur vim72.orig/src/buffer.c vim72/src/buffer.c
557--- vim72.orig/src/buffer.c 2008-08-06 04:00:48.000000000 -0700
[43c52a1]558+++ vim72/src/buffer.c 2009-01-08 20:57:54.000000000 -0800
559@@ -437,10 +437,6 @@
560 return;
561 #endif
562
563-#ifdef FEAT_NETBEANS_INTG
564- if (usingNetbeans)
565- netbeans_file_closed(buf);
566-#endif
567 /* Change directories when the 'acd' option is set. */
568 DO_AUTOCHDIR
569
570@@ -639,6 +635,10 @@
571 #ifdef FEAT_SIGNS
572 buf_delete_signs(buf); /* delete any signs */
573 #endif
574+#ifdef FEAT_NETBEANS_INTG
575+ if (usingNetbeans)
576+ netbeans_file_killed(buf);
577+#endif
578 #ifdef FEAT_LOCALMAP
579 map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
580 map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
[76dd250]581@@ -647,6 +647,9 @@
582 vim_free(buf->b_start_fenc);
583 buf->b_start_fenc = NULL;
584 #endif
585+#ifdef FEAT_SPELL
586+ ga_clear(&buf->b_langp);
587+#endif
588 }
589
590 /*
[43c52a1]591@@ -812,9 +815,6 @@
592 int bnr; /* buffer number */
593 char_u *p;
594
595-#ifdef FEAT_NETBEANS_INTG
596- netbeansCloseFile = 1;
597-#endif
598 if (addr_count == 0)
599 {
600 (void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit);
601@@ -909,9 +909,6 @@
602 }
603 }
604
605-#ifdef FEAT_NETBEANS_INTG
606- netbeansCloseFile = 0;
607-#endif
608
609 return errormsg;
610 }
611@@ -1237,7 +1234,7 @@
[76dd250]612 * "buf" if one exists */
613 if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
614 return OK;
615- /* If 'switchbuf' contians "usetab": jump to first window in any tab
616+ /* If 'switchbuf' contains "usetab": jump to first window in any tab
617 * page containing "buf" if one exists */
618 if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
619 return OK;
[43c52a1]620@@ -1351,11 +1348,12 @@
[76dd250]621 }
622 }
623 #ifdef FEAT_AUTOCMD
624+ /* An autocommand may have deleted "buf", already entered it (e.g., when
625+ * it did ":bunload") or aborted the script processing! */
626 # ifdef FEAT_EVAL
627- /* An autocommand may have deleted buf or aborted the script processing! */
628- if (buf_valid(buf) && !aborting())
629+ if (buf_valid(buf) && buf != curbuf && !aborting())
630 # else
631- if (buf_valid(buf)) /* an autocommand may have deleted buf! */
632+ if (buf_valid(buf) && buf != curbuf)
633 # endif
634 #endif
635 enter_buffer(buf);
[43c52a1]636@@ -1397,6 +1395,9 @@
[76dd250]637 curwin->w_cursor.coladd = 0;
638 #endif
639 curwin->w_set_curswant = TRUE;
640+#ifdef FEAT_AUTOCMD
641+ curwin->w_topline_was_set = FALSE;
642+#endif
643
644 /* Make sure the buffer is loaded. */
645 if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
[43c52a1]646@@ -1436,7 +1437,8 @@
[76dd250]647 maketitle();
648 #endif
649 #ifdef FEAT_AUTOCMD
650- if (curwin->w_topline == 1) /* when autocmds didn't change it */
651+ /* when autocmds didn't change it */
652+ if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
653 #endif
654 scroll_cursor_halfway(FALSE); /* redisplay at correct position */
655
[43c52a1]656@@ -3963,7 +3965,7 @@
[76dd250]657 width = vim_strsize(out);
658 if (maxwidth > 0 && width > maxwidth)
659 {
660- /* Result is too long, must trunctate somewhere. */
661+ /* Result is too long, must truncate somewhere. */
662 l = 0;
663 if (itemcnt == 0)
664 s = out;
[43c52a1]665@@ -5062,7 +5064,7 @@
[76dd250]666 {
667 if (buf->b_sfname != NULL)
668 return (char *)buf->b_sfname;
669- return "[Scratch]";
670+ return _("[Scratch]");
671 }
672 #endif
673 if (buf->b_fname == NULL)
674diff -Naur vim72.orig/src/configure.in vim72/src/configure.in
675--- vim72.orig/src/configure.in 2008-07-24 05:40:26.000000000 -0700
[43c52a1]676+++ vim72/src/configure.in 2009-01-08 20:57:39.000000000 -0800
[76dd250]677@@ -3152,18 +3152,25 @@
678 dnl But only when making dependencies, cproto and lint don't take "-isystem".
679 dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
680 dnl the number before the version number.
681-AC_MSG_CHECKING(for GCC 3 or later)
682 DEPEND_CFLAGS_FILTER=
683 if test "$GCC" = yes; then
684+ AC_MSG_CHECKING(for GCC 3 or later)
685 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
686 if test "$gccmajor" -gt "2"; then
687 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
688+ AC_MSG_RESULT(yes)
689+ else
690+ AC_MSG_RESULT(no)
691+ fi
692+ dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
693+ dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
694+ AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
695+ if test "$gccmajor" -gt "3"; then
696+ CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
697+ AC_MSG_RESULT(yes)
698+ else
699+ AC_MSG_RESULT(no)
700 fi
701-fi
702-if test "$DEPEND_CFLAGS_FILTER" = ""; then
703- AC_MSG_RESULT(no)
704-else
705- AC_MSG_RESULT(yes)
706 fi
707 AC_SUBST(DEPEND_CFLAGS_FILTER)
708
709diff -Naur vim72.orig/src/diff.c vim72/src/diff.c
710--- vim72.orig/src/diff.c 2008-03-05 03:16:56.000000000 -0800
[43c52a1]711+++ vim72/src/diff.c 2009-01-08 20:57:45.000000000 -0800
[76dd250]712@@ -73,6 +73,8 @@
713 {
714 tp->tp_diffbuf[i] = NULL;
715 tp->tp_diff_invalid = TRUE;
716+ if (tp == curtab)
717+ diff_redraw(TRUE);
718 }
719 }
720 }
721@@ -102,6 +104,7 @@
722 {
723 curtab->tp_diffbuf[i] = NULL;
724 curtab->tp_diff_invalid = TRUE;
725+ diff_redraw(TRUE);
726 }
727 }
728 }
729@@ -131,6 +134,7 @@
730 {
731 curtab->tp_diffbuf[i] = buf;
732 curtab->tp_diff_invalid = TRUE;
733+ diff_redraw(TRUE);
734 return;
735 }
736
737@@ -661,6 +665,7 @@
738 char_u *tmp_diff;
739 FILE *fd;
740 int ok;
741+ int io_error = FALSE;
742
743 /* Delete all diffblocks. */
744 diff_clear(curtab);
745@@ -697,18 +702,26 @@
746 {
747 ok = FALSE;
748 fd = mch_fopen((char *)tmp_orig, "w");
749- if (fd != NULL)
750+ if (fd == NULL)
751+ io_error = TRUE;
752+ else
753 {
754- fwrite("line1\n", (size_t)6, (size_t)1, fd);
755+ if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1)
756+ io_error = TRUE;
757 fclose(fd);
758 fd = mch_fopen((char *)tmp_new, "w");
759- if (fd != NULL)
760+ if (fd == NULL)
761+ io_error = TRUE;
762+ else
763 {
764- fwrite("line2\n", (size_t)6, (size_t)1, fd);
765+ if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1)
766+ io_error = TRUE;
767 fclose(fd);
768 diff_file(tmp_orig, tmp_new, tmp_diff);
769 fd = mch_fopen((char *)tmp_diff, "r");
770- if (fd != NULL)
771+ if (fd == NULL)
772+ io_error = TRUE;
773+ else
774 {
775 char_u linebuf[LBUFLEN];
776
777@@ -761,6 +774,8 @@
778 }
779 if (!ok)
780 {
781+ if (io_error)
782+ EMSG(_("E810: Cannot read or write temp files"));
783 EMSG(_("E97: Cannot create diffs"));
784 diff_a_works = MAYBE;
785 #if defined(MSWIN) || defined(MSDOS)
786@@ -925,10 +940,10 @@
787 {
788 # ifdef TEMPDIRNAMES
789 if (vim_tempdir != NULL)
790- mch_chdir((char *)vim_tempdir);
791+ ignored = mch_chdir((char *)vim_tempdir);
792 else
793 # endif
794- mch_chdir("/tmp");
795+ ignored = mch_chdir("/tmp");
796 shorten_fnames(TRUE);
797 }
798 #endif
799diff -Naur vim72.orig/src/eval.c vim72/src/eval.c
800--- vim72.orig/src/eval.c 2008-08-07 12:37:22.000000000 -0700
[43c52a1]801+++ vim72/src/eval.c 2009-01-08 20:57:46.000000000 -0800
[1f22c7c]802@@ -32,6 +32,9 @@
803
804 #define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
805
806+#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not
807+ be freed. */
808+
809 /*
810 * In a hashtab item "hi_key" points to "di_key" in a dictitem.
811 * This avoids adding a pointer to the hashtab item.
812@@ -348,6 +351,7 @@
[76dd250]813 {VV_NAME("mouse_col", VAR_NUMBER), 0},
814 {VV_NAME("operator", VAR_STRING), VV_RO},
815 {VV_NAME("searchforward", VAR_NUMBER), 0},
816+ {VV_NAME("oldfiles", VAR_LIST), 0},
817 };
818
819 /* shorthand */
[1f22c7c]820@@ -355,6 +359,7 @@
[76dd250]821 #define vv_nr vv_di.di_tv.vval.v_number
822 #define vv_float vv_di.di_tv.vval.v_float
823 #define vv_str vv_di.di_tv.vval.v_string
824+#define vv_list vv_di.di_tv.vval.v_list
825 #define vv_tv vv_di.di_tv
826
827 /*
[1f22c7c]828@@ -426,7 +431,6 @@
[76dd250]829 static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
830 static void list_append __ARGS((list_T *l, listitem_T *item));
831 static int list_append_tv __ARGS((list_T *l, typval_T *tv));
832-static int list_append_string __ARGS((list_T *l, char_u *str, int len));
833 static int list_append_number __ARGS((list_T *l, varnumber_T n));
834 static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
835 static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef));
[1f22c7c]836@@ -788,6 +792,8 @@
837 static void func_unref __ARGS((char_u *name));
838 static void func_ref __ARGS((char_u *name));
839 static void call_user_func __ARGS((ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rettv, linenr_T firstline, linenr_T lastline, dict_T *selfdict));
840+static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ;
841+static void free_funccal __ARGS((funccall_T *fc, int free_val));
842 static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr));
843 static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp));
844 static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
845@@ -845,11 +851,17 @@
[76dd250]846 p = &vimvars[i];
847 if (p->vv_di.di_tv.v_type == VAR_STRING)
848 {
849- vim_free(p->vv_di.di_tv.vval.v_string);
850- p->vv_di.di_tv.vval.v_string = NULL;
851+ vim_free(p->vv_str);
852+ p->vv_str = NULL;
853+ }
854+ else if (p->vv_di.di_tv.v_type == VAR_LIST)
855+ {
856+ list_unref(p->vv_list);
857+ p->vv_list = NULL;
858 }
859 }
860 hash_clear(&vimvarht);
861+ hash_init(&vimvarht); /* garbage_collect() will access it */
862 hash_clear(&compat_hashtab);
863
864 /* script-local variables */
[1f22c7c]865@@ -916,6 +928,10 @@
866 /* pointer to funccal for currently active function */
867 funccall_T *current_funccal = NULL;
868
869+/* pointer to list of previously used funccal, still around because some
870+ * item in it is still being used. */
871+funccall_T *previous_funccal = NULL;
872+
873 /*
874 * Return TRUE when a function was ended by a ":return" command.
875 */
876@@ -1256,23 +1272,26 @@
[76dd250]877
878 /*
879 * Top level evaluation function, returning a string.
880+ * When "convert" is TRUE convert a List into a sequence of lines and convert
881+ * a Float to a String.
882 * Return pointer to allocated memory, or NULL for failure.
883 */
884 char_u *
885-eval_to_string(arg, nextcmd, dolist)
886+eval_to_string(arg, nextcmd, convert)
887 char_u *arg;
888 char_u **nextcmd;
889- int dolist; /* turn List into sequence of lines */
890+ int convert;
891 {
892 typval_T tv;
893 char_u *retval;
894 garray_T ga;
895+ char_u numbuf[NUMBUFLEN];
896
897 if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
898 retval = NULL;
899 else
900 {
901- if (dolist && tv.v_type == VAR_LIST)
902+ if (convert && tv.v_type == VAR_LIST)
903 {
904 ga_init2(&ga, (int)sizeof(char), 80);
905 if (tv.vval.v_list != NULL)
[1f22c7c]906@@ -1280,6 +1299,13 @@
[76dd250]907 ga_append(&ga, NUL);
908 retval = (char_u *)ga.ga_data;
909 }
910+#ifdef FEAT_FLOAT
911+ else if (convert && tv.v_type == VAR_FLOAT)
912+ {
913+ vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
914+ retval = vim_strsave(numbuf);
915+ }
916+#endif
917 else
918 retval = vim_strsave(get_tv_string(&tv));
919 clear_tv(&tv);
[1f22c7c]920@@ -3277,7 +3303,7 @@
[76dd250]921
922 if (*startarg != '(')
923 {
924- EMSG2(_("E107: Missing braces: %s"), eap->arg);
925+ EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
926 goto end;
927 }
928
[1f22c7c]929@@ -3657,8 +3683,8 @@
[76dd250]930 }
931
932 /*
933- * Return TRUE if typeval "tv" is locked: Either tha value is locked itself or
934- * it refers to a List or Dictionary that is locked.
935+ * Return TRUE if typeval "tv" is locked: Either that value is locked itself
936+ * or it refers to a List or Dictionary that is locked.
937 */
938 static int
939 tv_islocked(tv)
[1f22c7c]940@@ -6047,6 +6073,25 @@
[76dd250]941 }
942
943 /*
944+ * Get list item "l[idx - 1]" as a string. Returns NULL for failure.
945+ */
946+ char_u *
947+list_find_str(l, idx)
948+ list_T *l;
949+ long idx;
950+{
951+ listitem_T *li;
952+
953+ li = list_find(l, idx - 1);
954+ if (li == NULL)
955+ {
956+ EMSGN(_(e_listidx), idx);
957+ return NULL;
958+ }
959+ return get_tv_string(&li->li_tv);
960+}
961+
962+/*
963 * Locate "item" list "l" and return its index.
964 * Returns -1 when "item" is not in the list.
965 */
[1f22c7c]966@@ -6137,7 +6182,7 @@
[76dd250]967 * When "len" >= 0 use "str[len]".
968 * Returns FAIL when out of memory.
969 */
970- static int
971+ int
972 list_append_string(l, str, len)
973 list_T *l;
974 char_u *str;
[1f22c7c]975@@ -6454,7 +6499,7 @@
976 buf_T *buf;
977 win_T *wp;
978 int i;
979- funccall_T *fc;
980+ funccall_T *fc, **pfc;
981 int did_free = FALSE;
982 #ifdef FEAT_WINDOWS
983 tabpage_T *tp;
984@@ -6497,6 +6542,9 @@
[76dd250]985 set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
986 }
987
988+ /* v: vars */
989+ set_ref_in_ht(&vimvarht, copyID);
990+
991 /*
992 * 2. Go through the list of dicts and free items without the copyID.
993 */
[1f22c7c]994@@ -6535,6 +6583,20 @@
995 else
996 ll = ll->lv_used_next;
997
998+ /* check if any funccal can be freed now */
999+ for (pfc = &previous_funccal; *pfc != NULL; )
1000+ {
1001+ if (can_free_funccal(*pfc, copyID))
1002+ {
1003+ fc = *pfc;
1004+ *pfc = fc->caller;
1005+ free_funccal(fc, TRUE);
1006+ did_free = TRUE;
1007+ }
1008+ else
1009+ pfc = &(*pfc)->caller;
1010+ }
1011+
1012 return did_free;
1013 }
1014
1015@@ -6587,7 +6649,7 @@
[76dd250]1016 {
1017 case VAR_DICT:
1018 dd = tv->vval.v_dict;
1019- if (dd->dv_copyID != copyID)
1020+ if (dd != NULL && dd->dv_copyID != copyID)
1021 {
1022 /* Didn't see this dict yet. */
1023 dd->dv_copyID = copyID;
[1f22c7c]1024@@ -6597,7 +6659,7 @@
[76dd250]1025
1026 case VAR_LIST:
1027 ll = tv->vval.v_list;
1028- if (ll->lv_copyID != copyID)
1029+ if (ll != NULL && ll->lv_copyID != copyID)
1030 {
1031 /* Didn't see this list yet. */
1032 ll->lv_copyID = copyID;
[1f22c7c]1033@@ -7525,8 +7587,8 @@
[76dd250]1034 {"getwinposx", 0, 0, f_getwinposx},
1035 {"getwinposy", 0, 0, f_getwinposy},
1036 {"getwinvar", 2, 2, f_getwinvar},
1037- {"glob", 1, 1, f_glob},
1038- {"globpath", 2, 2, f_globpath},
1039+ {"glob", 1, 2, f_glob},
1040+ {"globpath", 2, 3, f_globpath},
1041 {"has", 1, 1, f_has},
1042 {"has_key", 2, 2, f_has_key},
1043 {"haslocaldir", 0, 0, f_haslocaldir},
[1f22c7c]1044@@ -9518,7 +9580,7 @@
[76dd250]1045 else
1046 {
1047 /* When the optional second argument is non-zero, don't remove matches
1048- * for 'suffixes' and 'wildignore' */
1049+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1050 if (argvars[1].v_type != VAR_UNKNOWN
1051 && get_tv_number_chk(&argvars[1], &error))
1052 flags |= WILD_KEEP_ALL;
[1f22c7c]1053@@ -10300,7 +10362,8 @@
[76dd250]1054 s = get_tv_string(&argvars[0]);
1055 if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
1056 EMSG2(_(e_invarg2), s);
1057- else if (!function_exists(s))
1058+ /* Don't check an autoload name for existence here. */
1059+ else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
1060 EMSG2(_("E700: Unknown function: %s"), s);
1061 else
1062 {
[1f22c7c]1063@@ -10602,7 +10665,7 @@
[76dd250]1064 # ifdef FEAT_WINDOWS
1065 win_T *wp;
1066 # endif
1067- int n = 1;
1068+ int winnr = 1;
1069
1070 if (row >= 0 && col >= 0)
1071 {
[1f22c7c]1072@@ -10612,9 +10675,9 @@
[76dd250]1073 (void)mouse_comp_pos(win, &row, &col, &lnum);
1074 # ifdef FEAT_WINDOWS
1075 for (wp = firstwin; wp != win; wp = wp->w_next)
1076- ++n;
1077+ ++winnr;
1078 # endif
1079- vimvars[VV_MOUSE_WIN].vv_nr = n;
1080+ vimvars[VV_MOUSE_WIN].vv_nr = winnr;
1081 vimvars[VV_MOUSE_LNUM].vv_nr = lnum;
1082 vimvars[VV_MOUSE_COL].vv_nr = col + 1;
1083 }
[1f22c7c]1084@@ -11284,13 +11347,25 @@
[76dd250]1085 typval_T *argvars;
1086 typval_T *rettv;
1087 {
1088+ int flags = WILD_SILENT|WILD_USE_NL;
1089 expand_T xpc;
1090+ int error = FALSE;
1091
1092- ExpandInit(&xpc);
1093- xpc.xp_context = EXPAND_FILES;
1094+ /* When the optional second argument is non-zero, don't remove matches
1095+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1096+ if (argvars[1].v_type != VAR_UNKNOWN
1097+ && get_tv_number_chk(&argvars[1], &error))
1098+ flags |= WILD_KEEP_ALL;
1099 rettv->v_type = VAR_STRING;
1100- rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1101- NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
1102+ if (!error)
1103+ {
1104+ ExpandInit(&xpc);
1105+ xpc.xp_context = EXPAND_FILES;
1106+ rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1107+ NULL, flags, WILD_ALL);
1108+ }
1109+ else
1110+ rettv->vval.v_string = NULL;
1111 }
1112
1113 /*
[1f22c7c]1114@@ -11301,14 +11376,22 @@
[76dd250]1115 typval_T *argvars;
1116 typval_T *rettv;
1117 {
1118+ int flags = 0;
1119 char_u buf1[NUMBUFLEN];
1120 char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
1121+ int error = FALSE;
1122
1123+ /* When the optional second argument is non-zero, don't remove matches
1124+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1125+ if (argvars[2].v_type != VAR_UNKNOWN
1126+ && get_tv_number_chk(&argvars[2], &error))
1127+ flags |= WILD_KEEP_ALL;
1128 rettv->v_type = VAR_STRING;
1129- if (file == NULL)
1130+ if (file == NULL || error)
1131 rettv->vval.v_string = NULL;
1132 else
1133- rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
1134+ rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
1135+ flags);
1136 }
1137
1138 /*
[1f22c7c]1139@@ -11782,6 +11865,10 @@
[76dd250]1140 n = has_patch(atoi((char *)name + 5));
1141 else if (STRICMP(name, "vim_starting") == 0)
1142 n = (starting != 0);
1143+#ifdef FEAT_MBYTE
1144+ else if (STRICMP(name, "multi_byte_encoding") == 0)
1145+ n = has_mbyte;
1146+#endif
1147 #if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32)
1148 else if (STRICMP(name, "balloon_multiline") == 0)
1149 n = multiline_balloon_available();
[1f22c7c]1150@@ -15838,10 +15925,9 @@
[76dd250]1151 if (res == FAIL)
1152 res = ITEM_COMPARE_FAIL;
1153 else
1154- /* return value has wrong type */
1155 res = get_tv_number_chk(&rettv, &item_compare_func_err);
1156 if (item_compare_func_err)
1157- res = ITEM_COMPARE_FAIL;
1158+ res = ITEM_COMPARE_FAIL; /* return value has wrong type */
1159 clear_tv(&rettv);
1160 return res;
1161 }
[1f22c7c]1162@@ -16590,8 +16676,11 @@
[76dd250]1163 p = highlight_has_attr(id, HL_INVERSE, modec);
1164 break;
1165
1166- case 's': /* standout */
1167- p = highlight_has_attr(id, HL_STANDOUT, modec);
1168+ case 's':
1169+ if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */
1170+ p = highlight_color(id, what, modec);
1171+ else /* standout */
1172+ p = highlight_has_attr(id, HL_STANDOUT, modec);
1173 break;
1174
1175 case 'u':
[1f22c7c]1176@@ -16658,7 +16747,7 @@
[76dd250]1177 col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
1178
1179 if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
1180- && col >= 0 && col < (long)STRLEN(ml_get(lnum))
1181+ && col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum)))
1182 && rettv_list_alloc(rettv) != FAIL)
1183 {
1184 (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
[1f22c7c]1185@@ -18097,14 +18186,28 @@
[76dd250]1186 }
1187
1188 /*
1189- * Set v:count, v:count1 and v:prevcount.
1190+ * Get List v: variable value. Caller must take care of reference count when
1191+ * needed.
1192+ */
1193+ list_T *
1194+get_vim_var_list(idx)
1195+ int idx;
1196+{
1197+ return vimvars[idx].vv_list;
1198+}
1199+
1200+/*
1201+ * Set v:count to "count" and v:count1 to "count1".
1202+ * When "set_prevcount" is TRUE first set v:prevcount from v:count.
1203 */
1204 void
1205-set_vcount(count, count1)
1206+set_vcount(count, count1, set_prevcount)
1207 long count;
1208 long count1;
1209+ int set_prevcount;
1210 {
1211- vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
1212+ if (set_prevcount)
1213+ vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
1214 vimvars[VV_COUNT].vv_nr = count;
1215 vimvars[VV_COUNT1].vv_nr = count1;
1216 }
[1f22c7c]1217@@ -18132,6 +18235,20 @@
[76dd250]1218 }
1219
1220 /*
1221+ * Set List v: variable to "val".
1222+ */
1223+ void
1224+set_vim_var_list(idx, val)
1225+ int idx;
1226+ list_T *val;
1227+{
1228+ list_unref(vimvars[idx].vv_list);
1229+ vimvars[idx].vv_list = val;
1230+ if (val != NULL)
1231+ ++val->lv_refcount;
1232+}
1233+
1234+/*
1235 * Set v:register if needed.
1236 */
1237 void
[1f22c7c]1238@@ -18868,7 +18985,7 @@
1239 dictitem_T *dict_var;
1240 {
1241 hash_init(&dict->dv_hashtab);
1242- dict->dv_refcount = 99999;
1243+ dict->dv_refcount = DO_NOT_FREE_CNT;
1244 dict_var->di_tv.vval.v_dict = dict;
1245 dict_var->di_tv.v_type = VAR_DICT;
1246 dict_var->di_tv.v_lock = VAR_FIXED;
1247@@ -19205,6 +19322,8 @@
1248 * Copy the values from typval_T "from" to typval_T "to".
1249 * When needed allocates string or increases reference count.
1250 * Does not make a copy of a list or dict but copies the reference!
1251+ * It is OK for "from" and "to" to point to the same item. This is used to
1252+ * make a copy later.
1253 */
1254 static void
1255 copy_tv(from, to)
1256@@ -20590,6 +20709,9 @@
[76dd250]1257 int st_len = 0;
1258
1259 todo = (int)func_hashtab.ht_used;
1260+ if (todo == 0)
1261+ return; /* nothing to dump */
1262+
1263 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
1264
1265 for (hi = func_hashtab.ht_array; todo > 0; ++hi)
[1f22c7c]1266@@ -20638,6 +20760,8 @@
[76dd250]1267 prof_self_cmp);
1268 prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
1269 }
1270+
1271+ vim_free(sorttab);
1272 }
1273
1274 static void
[1f22c7c]1275@@ -21012,7 +21136,7 @@
1276 char_u *save_sourcing_name;
1277 linenr_T save_sourcing_lnum;
1278 scid_T save_current_SID;
1279- funccall_T fc;
1280+ funccall_T *fc;
1281 int save_did_emsg;
1282 static int depth = 0;
1283 dictitem_T *v;
1284@@ -21038,36 +21162,37 @@
1285
1286 line_breakcheck(); /* check for CTRL-C hit */
1287
1288- fc.caller = current_funccal;
1289- current_funccal = &fc;
1290- fc.func = fp;
1291- fc.rettv = rettv;
1292+ fc = (funccall_T *)alloc(sizeof(funccall_T));
1293+ fc->caller = current_funccal;
1294+ current_funccal = fc;
1295+ fc->func = fp;
1296+ fc->rettv = rettv;
1297 rettv->vval.v_number = 0;
1298- fc.linenr = 0;
1299- fc.returned = FALSE;
1300- fc.level = ex_nesting_level;
1301+ fc->linenr = 0;
1302+ fc->returned = FALSE;
1303+ fc->level = ex_nesting_level;
1304 /* Check if this function has a breakpoint. */
1305- fc.breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
1306- fc.dbg_tick = debug_tick;
1307+ fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
1308+ fc->dbg_tick = debug_tick;
1309
1310 /*
1311- * Note about using fc.fixvar[]: This is an array of FIXVAR_CNT variables
1312+ * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables
1313 * with names up to VAR_SHORT_LEN long. This avoids having to alloc/free
1314 * each argument variable and saves a lot of time.
1315 */
1316 /*
1317 * Init l: variables.
1318 */
1319- init_var_dict(&fc.l_vars, &fc.l_vars_var);
1320+ init_var_dict(&fc->l_vars, &fc->l_vars_var);
1321 if (selfdict != NULL)
1322 {
1323 /* Set l:self to "selfdict". Use "name" to avoid a warning from
1324 * some compiler that checks the destination size. */
1325- v = &fc.fixvar[fixvar_idx++].var;
1326+ v = &fc->fixvar[fixvar_idx++].var;
1327 name = v->di_key;
1328 STRCPY(name, "self");
1329 v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX;
1330- hash_add(&fc.l_vars.dv_hashtab, DI2HIKEY(v));
1331+ hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
1332 v->di_tv.v_type = VAR_DICT;
1333 v->di_tv.v_lock = 0;
1334 v->di_tv.vval.v_dict = selfdict;
1335@@ -21079,28 +21204,31 @@
1336 * Set a:0 to "argcount".
1337 * Set a:000 to a list with room for the "..." arguments.
1338 */
1339- init_var_dict(&fc.l_avars, &fc.l_avars_var);
1340- add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
1341+ init_var_dict(&fc->l_avars, &fc->l_avars_var);
1342+ add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0",
[76dd250]1343 (varnumber_T)(argcount - fp->uf_args.ga_len));
[1f22c7c]1344- v = &fc.fixvar[fixvar_idx++].var;
1345- STRCPY(v->di_key, "000");
[76dd250]1346+ /* Use "name" to avoid a warning from some compiler that checks the
1347+ * destination size. */
[1f22c7c]1348+ v = &fc->fixvar[fixvar_idx++].var;
[76dd250]1349+ name = v->di_key;
1350+ STRCPY(name, "000");
1351 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
[1f22c7c]1352- hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
1353+ hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
[76dd250]1354 v->di_tv.v_type = VAR_LIST;
[1f22c7c]1355 v->di_tv.v_lock = VAR_FIXED;
1356- v->di_tv.vval.v_list = &fc.l_varlist;
1357- vim_memset(&fc.l_varlist, 0, sizeof(list_T));
1358- fc.l_varlist.lv_refcount = 99999;
1359- fc.l_varlist.lv_lock = VAR_FIXED;
1360+ v->di_tv.vval.v_list = &fc->l_varlist;
1361+ vim_memset(&fc->l_varlist, 0, sizeof(list_T));
1362+ fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
1363+ fc->l_varlist.lv_lock = VAR_FIXED;
1364
1365 /*
1366 * Set a:firstline to "firstline" and a:lastline to "lastline".
1367 * Set a:name to named arguments.
1368 * Set a:N to the "..." arguments.
1369 */
1370- add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "firstline",
1371+ add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline",
1372 (varnumber_T)firstline);
1373- add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "lastline",
1374+ add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline",
1375 (varnumber_T)lastline);
1376 for (i = 0; i < argcount; ++i)
1377 {
1378@@ -21116,7 +21244,7 @@
1379 }
1380 if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN)
1381 {
1382- v = &fc.fixvar[fixvar_idx++].var;
1383+ v = &fc->fixvar[fixvar_idx++].var;
1384 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
1385 }
1386 else
1387@@ -21128,7 +21256,7 @@
1388 v->di_flags = DI_FLAGS_RO;
1389 }
1390 STRCPY(v->di_key, name);
1391- hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
1392+ hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
1393
1394 /* Note: the values are copied directly to avoid alloc/free.
1395 * "argvars" must have VAR_FIXED for v_lock. */
1396@@ -21137,9 +21265,9 @@
1397
1398 if (ai >= 0 && ai < MAX_FUNC_ARGS)
1399 {
1400- list_append(&fc.l_varlist, &fc.l_listitems[ai]);
1401- fc.l_listitems[ai].li_tv = argvars[i];
1402- fc.l_listitems[ai].li_tv.v_lock = VAR_FIXED;
1403+ list_append(&fc->l_varlist, &fc->l_listitems[ai]);
1404+ fc->l_listitems[ai].li_tv = argvars[i];
1405+ fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED;
1406 }
1407 }
1408
1409@@ -21204,7 +21332,7 @@
[76dd250]1410 if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
1411 func_do_profile(fp);
1412 if (fp->uf_profiling
1413- || (fc.caller != NULL && &fc.caller->func->uf_profiling))
[1f22c7c]1414+ || (fc->caller != NULL && fc->caller->func->uf_profiling))
[76dd250]1415 {
1416 ++fp->uf_tm_count;
1417 profile_start(&call_start);
[1f22c7c]1418@@ -21220,7 +21348,7 @@
1419 did_emsg = FALSE;
1420
1421 /* call do_cmdline() to execute the lines */
1422- do_cmdline(NULL, get_func_line, (void *)&fc,
1423+ do_cmdline(NULL, get_func_line, (void *)fc,
1424 DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
1425
1426 --RedrawingDisabled;
1427@@ -21235,16 +21363,16 @@
[76dd250]1428
1429 #ifdef FEAT_PROFILE
1430 if (do_profiling == PROF_YES && (fp->uf_profiling
1431- || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
[1f22c7c]1432+ || (fc->caller != NULL && fc->caller->func->uf_profiling)))
[76dd250]1433 {
1434 profile_end(&call_start);
1435 profile_sub_wait(&wait_start, &call_start);
1436 profile_add(&fp->uf_tm_total, &call_start);
1437 profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
1438- if (fc.caller != NULL && &fc.caller->func->uf_profiling)
[1f22c7c]1439+ if (fc->caller != NULL && fc->caller->func->uf_profiling)
[76dd250]1440 {
[1f22c7c]1441- profile_add(&fc.caller->func->uf_tm_children, &call_start);
1442- profile_add(&fc.caller->func->uf_tml_children, &call_start);
1443+ profile_add(&fc->caller->func->uf_tm_children, &call_start);
1444+ profile_add(&fc->caller->func->uf_tml_children, &call_start);
1445 }
1446 }
1447 #endif
1448@@ -21257,9 +21385,9 @@
1449
1450 if (aborting())
1451 smsg((char_u *)_("%s aborted"), sourcing_name);
1452- else if (fc.rettv->v_type == VAR_NUMBER)
1453+ else if (fc->rettv->v_type == VAR_NUMBER)
1454 smsg((char_u *)_("%s returning #%ld"), sourcing_name,
1455- (long)fc.rettv->vval.v_number);
1456+ (long)fc->rettv->vval.v_number);
1457 else
1458 {
1459 char_u buf[MSG_BUF_LEN];
1460@@ -21270,7 +21398,7 @@
1461 /* The value may be very long. Skip the middle part, so that we
1462 * have some idea how it starts and ends. smsg() would always
1463 * truncate it at the end. */
1464- s = tv2string(fc.rettv, &tofree, numbuf2, 0);
1465+ s = tv2string(fc->rettv, &tofree, numbuf2, 0);
1466 if (s != NULL)
1467 {
1468 trunc_string(s, buf, MSG_BUF_CLEN);
1469@@ -21306,14 +21434,84 @@
1470 }
1471
1472 did_emsg |= save_did_emsg;
1473- current_funccal = fc.caller;
1474+ current_funccal = fc->caller;
1475+ --depth;
1476
1477- /* The a: variables typevals were not allocated, only free the allocated
1478- * variables. */
1479- vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE);
1480+ /* if the a:000 list and the a: dict are not referenced we can free the
1481+ * funccall_T and what's in it. */
1482+ if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT
1483+ && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT
1484+ && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT)
1485+ {
1486+ free_funccal(fc, FALSE);
1487+ }
1488+ else
1489+ {
1490+ hashitem_T *hi;
1491+ listitem_T *li;
1492+ int todo;
1493
1494- vars_clear(&fc.l_vars.dv_hashtab); /* free all l: variables */
1495- --depth;
1496+ /* "fc" is still in use. This can happen when returning "a:000" or
1497+ * assigning "l:" to a global variable.
1498+ * Link "fc" in the list for garbage collection later. */
1499+ fc->caller = previous_funccal;
1500+ previous_funccal = fc;
1501+
1502+ /* Make a copy of the a: variables, since we didn't do that above. */
1503+ todo = (int)fc->l_avars.dv_hashtab.ht_used;
1504+ for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
1505+ {
1506+ if (!HASHITEM_EMPTY(hi))
1507+ {
1508+ --todo;
1509+ v = HI2DI(hi);
1510+ copy_tv(&v->di_tv, &v->di_tv);
1511+ }
1512+ }
1513+
1514+ /* Make a copy of the a:000 items, since we didn't do that above. */
1515+ for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
1516+ copy_tv(&li->li_tv, &li->li_tv);
1517+ }
1518+}
1519+
1520+/*
1521+ * Return TRUE if items in "fc" do not have "copyID". That means they are not
1522+ * referenced from anywyere.
1523+ */
1524+ static int
1525+can_free_funccal(fc, copyID)
1526+ funccall_T *fc;
1527+ int copyID;
1528+{
1529+ return (fc->l_varlist.lv_copyID != copyID
1530+ && fc->l_vars.dv_copyID != copyID
1531+ && fc->l_avars.dv_copyID != copyID);
1532+}
1533+
1534+/*
1535+ * Free "fc" and what it contains.
1536+ */
1537+ static void
1538+free_funccal(fc, free_val)
1539+ funccall_T *fc;
1540+ int free_val; /* a: vars were allocated */
1541+{
1542+ listitem_T *li;
1543+
1544+ /* The a: variables typevals may not have been allocated, only free the
1545+ * allocated variables. */
1546+ vars_clear_ext(&fc->l_avars.dv_hashtab, free_val);
1547+
1548+ /* free all l: variables */
1549+ vars_clear(&fc->l_vars.dv_hashtab);
1550+
1551+ /* Free the a:000 variables if they were allocated. */
1552+ if (free_val)
1553+ for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
1554+ clear_tv(&li->li_tv);
1555+
1556+ vim_free(fc);
1557 }
1558
1559 /*
1560@@ -21886,6 +22084,62 @@
[76dd250]1561 }
1562 }
1563
1564+/*
1565+ * List v:oldfiles in a nice way.
1566+ */
1567+/*ARGSUSED*/
1568+ void
1569+ex_oldfiles(eap)
1570+ exarg_T *eap;
1571+{
1572+ list_T *l = vimvars[VV_OLDFILES].vv_list;
1573+ listitem_T *li;
1574+ int nr = 0;
1575+
1576+ if (l == NULL)
1577+ msg((char_u *)_("No old files"));
1578+ else
1579+ {
1580+ msg_start();
1581+ msg_scroll = TRUE;
1582+ for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
1583+ {
1584+ msg_outnum((long)++nr);
1585+ MSG_PUTS(": ");
1586+ msg_outtrans(get_tv_string(&li->li_tv));
1587+ msg_putchar('\n');
1588+ out_flush(); /* output one line at a time */
1589+ ui_breakcheck();
1590+ }
1591+ /* Assume "got_int" was set to truncate the listing. */
1592+ got_int = FALSE;
1593+
1594+#ifdef FEAT_BROWSE_CMD
1595+ if (cmdmod.browse)
1596+ {
1597+ quit_more = FALSE;
1598+ nr = prompt_for_number(FALSE);
1599+ msg_starthere();
1600+ if (nr > 0)
1601+ {
1602+ char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
1603+ (long)nr);
1604+
1605+ if (p != NULL)
1606+ {
1607+ p = expand_env_save(p);
1608+ eap->arg = p;
1609+ eap->cmdidx = CMD_edit;
1610+ cmdmod.browse = FALSE;
1611+ do_exedit(eap, NULL);
1612+ vim_free(p);
1613+ }
1614+ }
1615+ }
1616+#endif
1617+ }
1618+}
1619+
1620 #endif /* FEAT_EVAL */
1621
1622
1623diff -Naur vim72.orig/src/ex_cmds.c vim72/src/ex_cmds.c
1624--- vim72.orig/src/ex_cmds.c 2008-08-04 12:15:00.000000000 -0700
[43c52a1]1625+++ vim72/src/ex_cmds.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]1626@@ -24,7 +24,7 @@
1627 static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out));
1628 #ifdef FEAT_VIMINFO
1629 static char_u *viminfo_filename __ARGS((char_u *));
1630-static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read));
1631+static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags));
1632 static int viminfo_encoding __ARGS((vir_T *virp));
1633 static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing));
1634 #endif
1635@@ -1676,14 +1676,12 @@
1636
1637 /*
1638 * read_viminfo() -- Read the viminfo file. Registers etc. which are already
1639- * set are not over-written unless force is TRUE. -- webb
1640+ * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb
1641 */
1642 int
1643-read_viminfo(file, want_info, want_marks, forceit)
1644- char_u *file;
1645- int want_info;
1646- int want_marks;
1647- int forceit;
1648+read_viminfo(file, flags)
1649+ char_u *file; /* file name or NULL to use default name */
1650+ int flags; /* VIF_WANT_INFO et al. */
1651 {
1652 FILE *fp;
1653 char_u *fname;
1654@@ -1691,7 +1689,7 @@
1655 if (no_viminfo())
1656 return FAIL;
1657
1658- fname = viminfo_filename(file); /* may set to default if NULL */
1659+ fname = viminfo_filename(file); /* get file name in allocated buffer */
1660 if (fname == NULL)
1661 return FAIL;
1662 fp = mch_fopen((char *)fname, READBIN);
1663@@ -1701,8 +1699,9 @@
1664 verbose_enter();
1665 smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
1666 fname,
1667- want_info ? _(" info") : "",
1668- want_marks ? _(" marks") : "",
1669+ (flags & VIF_WANT_INFO) ? _(" info") : "",
1670+ (flags & VIF_WANT_MARKS) ? _(" marks") : "",
1671+ (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "",
1672 fp == NULL ? _(" FAILED") : "");
1673 verbose_leave();
1674 }
1675@@ -1712,10 +1711,9 @@
1676 return FAIL;
1677
1678 viminfo_errcnt = 0;
1679- do_viminfo(fp, NULL, want_info, want_marks, forceit);
1680+ do_viminfo(fp, NULL, flags);
1681
1682 fclose(fp);
1683-
1684 return OK;
1685 }
1686
1687@@ -1943,7 +1941,7 @@
1688 * root.
1689 */
1690 if (fp_out != NULL)
1691- (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
1692+ ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
1693 #endif
1694 }
1695 }
1696@@ -1968,7 +1966,7 @@
1697 }
1698
1699 viminfo_errcnt = 0;
1700- do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);
1701+ do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS));
1702
1703 fclose(fp_out); /* errors are ignored !? */
1704 if (fp_in != NULL)
1705@@ -2041,12 +2039,10 @@
1706 * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
1707 */
1708 static void
1709-do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
1710+do_viminfo(fp_in, fp_out, flags)
1711 FILE *fp_in;
1712 FILE *fp_out;
1713- int want_info;
1714- int want_marks;
1715- int force_read;
1716+ int flags;
1717 {
1718 int count = 0;
1719 int eof = FALSE;
1720@@ -2061,8 +2057,9 @@
1721
1722 if (fp_in != NULL)
1723 {
1724- if (want_info)
1725- eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL);
1726+ if (flags & VIF_WANT_INFO)
1727+ eof = read_viminfo_up_to_marks(&vir,
1728+ flags & VIF_FORCEIT, fp_out != NULL);
1729 else
1730 /* Skip info, find start of marks */
1731 while (!(eof = viminfo_readline(&vir))
1732@@ -2092,8 +2089,9 @@
1733 write_viminfo_bufferlist(fp_out);
1734 count = write_viminfo_marks(fp_out);
1735 }
1736- if (fp_in != NULL && want_marks)
1737- copy_viminfo_marks(&vir, fp_out, count, eof);
1738+ if (fp_in != NULL
1739+ && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
1740+ copy_viminfo_marks(&vir, fp_out, count, eof, flags);
1741
1742 vim_free(vir.vir_line);
1743 #ifdef FEAT_MBYTE
1744@@ -5059,6 +5057,7 @@
1745
1746 if (did_sub)
1747 ++sub_nlines;
1748+ vim_free(new_start); /* for when substitute was cancelled */
1749 vim_free(sub_firstline); /* free the copy of the original line */
1750 sub_firstline = NULL;
1751 }
1752diff -Naur vim72.orig/src/ex_cmds.h vim72/src/ex_cmds.h
1753--- vim72.orig/src/ex_cmds.h 2008-06-21 11:47:57.000000000 -0700
[43c52a1]1754+++ vim72/src/ex_cmds.h 2009-01-08 20:57:32.000000000 -0800
[76dd250]1755@@ -278,7 +278,7 @@
1756 EX(CMD_crewind, "crewind", ex_cc,
1757 RANGE|NOTADR|COUNT|TRLBAR|BANG),
1758 EX(CMD_cscope, "cscope", do_cscope,
1759- EXTRA|NOTRLCOM|SBOXOK|XFILE),
1760+ EXTRA|NOTRLCOM|XFILE),
1761 EX(CMD_cstag, "cstag", do_cstag,
1762 BANG|TRLBAR|WORD1),
1763 EX(CMD_cunmap, "cunmap", ex_unmap,
1764@@ -506,7 +506,7 @@
1765 EX(CMD_lclose, "lclose", ex_cclose,
1766 RANGE|NOTADR|COUNT|TRLBAR),
1767 EX(CMD_lcscope, "lcscope", do_cscope,
1768- EXTRA|NOTRLCOM|SBOXOK|XFILE),
1769+ EXTRA|NOTRLCOM|XFILE),
1770 EX(CMD_left, "left", ex_align,
1771 TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
1772 EX(CMD_leftabove, "leftabove", ex_wrongmodifier,
1773@@ -635,6 +635,8 @@
1774 RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
1775 EX(CMD_noremap, "noremap", ex_map,
1776 BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
1777+EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier,
1778+ NEEDARG|EXTRA|NOTRLCOM),
1779 EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch,
1780 TRLBAR|SBOXOK|CMDWIN),
1781 EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate,
1782@@ -651,6 +653,8 @@
1783 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
1784 EX(CMD_open, "open", ex_open,
1785 RANGE|EXTRA),
1786+EX(CMD_oldfiles, "oldfiles", ex_oldfiles,
1787+ BANG|TRLBAR|SBOXOK|CMDWIN),
1788 EX(CMD_omap, "omap", ex_map,
1789 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
1790 EX(CMD_omapclear, "omapclear", ex_mapclear,
1791@@ -802,7 +806,7 @@
1792 EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
1793 WORD1|TRLBAR|CMDWIN),
1794 EX(CMD_scscope, "scscope", do_scscope,
1795- EXTRA|NOTRLCOM|SBOXOK),
1796+ EXTRA|NOTRLCOM),
1797 EX(CMD_set, "set", ex_set,
1798 TRLBAR|EXTRA|CMDWIN|SBOXOK),
1799 EX(CMD_setfiletype, "setfiletype", ex_setfiletype,
1800diff -Naur vim72.orig/src/ex_cmds2.c vim72/src/ex_cmds2.c
1801--- vim72.orig/src/ex_cmds2.c 2008-07-13 09:18:22.000000000 -0700
[43c52a1]1802+++ vim72/src/ex_cmds2.c 2009-01-08 20:57:30.000000000 -0800
[76dd250]1803@@ -3145,8 +3145,8 @@
1804 verbose_leave();
1805 }
1806 #ifdef STARTUPTIME
1807- vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname);
1808- time_msg(IObuff, &tv_start);
1809+ vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
1810+ time_msg((char *)IObuff, &tv_start);
1811 time_pop(&tv_rel);
1812 #endif
1813
1814diff -Naur vim72.orig/src/ex_docmd.c vim72/src/ex_docmd.c
1815--- vim72.orig/src/ex_docmd.c 2008-07-26 04:51:05.000000000 -0700
[43c52a1]1816+++ vim72/src/ex_docmd.c 2009-01-08 20:57:45.000000000 -0800
[76dd250]1817@@ -364,6 +364,7 @@
1818 # define ex_function ex_ni
1819 # define ex_delfunction ex_ni
1820 # define ex_return ex_ni
1821+# define ex_oldfiles ex_ni
1822 #endif
1823 static char_u *arg_all __ARGS((void));
1824 #ifdef FEAT_SESSION
1825@@ -1770,7 +1771,7 @@
1826 }
1827 if (checkforcmd(&ea.cmd, "browse", 3))
1828 {
1829-#ifdef FEAT_BROWSE
1830+#ifdef FEAT_BROWSE_CMD
1831 cmdmod.browse = TRUE;
1832 #endif
1833 continue;
1834@@ -2978,6 +2979,7 @@
1835 {"keepmarks", 3, FALSE},
1836 {"leftabove", 5, FALSE},
1837 {"lockmarks", 3, FALSE},
1838+ {"noautocmd", 3, FALSE},
1839 {"rightbelow", 6, FALSE},
1840 {"sandbox", 3, FALSE},
1841 {"silent", 3, FALSE},
1842@@ -3608,6 +3610,7 @@
1843 return set_context_in_autocmd(xp, arg, FALSE);
1844
1845 case CMD_doautocmd:
1846+ case CMD_doautoall:
1847 return set_context_in_autocmd(xp, arg, TRUE);
1848 #endif
1849 case CMD_set:
1850@@ -8749,8 +8752,8 @@
1851 else if (*dirnow != NUL
1852 && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
1853 {
1854- (void)mch_chdir((char *)globaldir);
1855- shorten_fnames(TRUE);
1856+ if (mch_chdir((char *)globaldir) == OK)
1857+ shorten_fnames(TRUE);
1858 }
1859
1860 failed |= (makeopens(fd, dirnow) == FAIL);
1861@@ -9506,24 +9509,50 @@
1862 break;
1863 }
1864 s = src + 1;
1865+ if (*s == '<') /* "#<99" uses v:oldfiles */
1866+ ++s;
1867 i = (int)getdigits(&s);
1868 *usedlen = (int)(s - src); /* length of what we expand */
1869
1870- buf = buflist_findnr(i);
1871- if (buf == NULL)
1872+ if (src[1] == '<')
1873 {
1874- *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
1875+ if (*usedlen < 2)
1876+ {
1877+ /* Should we give an error message for #<text? */
1878+ *usedlen = 1;
1879+ return NULL;
1880+ }
1881+#ifdef FEAT_EVAL
1882+ result = list_find_str(get_vim_var_list(VV_OLDFILES),
1883+ (long)i);
1884+ if (result == NULL)
1885+ {
1886+ *errormsg = (char_u *)"";
1887+ return NULL;
1888+ }
1889+#else
1890+ *errormsg = (char_u *)_("E809: #< is not available without the +eval feature");
1891 return NULL;
1892+#endif
1893 }
1894- if (lnump != NULL)
1895- *lnump = ECMD_LAST;
1896- if (buf->b_fname == NULL)
1897+ else
1898 {
1899- result = (char_u *)"";
1900- valid = 0; /* Must have ":p:h" to be valid */
1901+ buf = buflist_findnr(i);
1902+ if (buf == NULL)
1903+ {
1904+ *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
1905+ return NULL;
1906+ }
1907+ if (lnump != NULL)
1908+ *lnump = ECMD_LAST;
1909+ if (buf->b_fname == NULL)
1910+ {
1911+ result = (char_u *)"";
1912+ valid = 0; /* Must have ":p:h" to be valid */
1913+ }
1914+ else
1915+ result = buf->b_fname;
1916 }
1917- else
1918- result = buf->b_fname;
1919 break;
1920
1921 #ifdef FEAT_SEARCHPATH
1922@@ -9541,6 +9570,15 @@
1923 #ifdef FEAT_AUTOCMD
1924 case SPEC_AFILE: /* file name for autocommand */
1925 result = autocmd_fname;
1926+ if (result != NULL && !autocmd_fname_full)
1927+ {
1928+ /* Still need to turn the fname into a full path. It is
1929+ * postponed to avoid a delay when <afile> is not used. */
1930+ autocmd_fname_full = TRUE;
1931+ result = FullName_save(autocmd_fname, FALSE);
1932+ vim_free(autocmd_fname);
1933+ autocmd_fname = result;
1934+ }
1935 if (result == NULL)
1936 {
1937 *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
1938@@ -10067,7 +10105,7 @@
1939 */
1940 if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
1941 || put_line(fd, "if file_readable(s:sx)") == FAIL
1942- || put_line(fd, " exe \"source \" . s:sx") == FAIL
1943+ || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL
1944 || put_line(fd, "endif") == FAIL)
1945 return FAIL;
1946
1947@@ -10689,7 +10727,8 @@
1948 p_viminfo = (char_u *)"'100";
1949 if (eap->cmdidx == CMD_rviminfo)
1950 {
1951- if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL)
1952+ if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS
1953+ | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL)
1954 EMSG(_("E195: Cannot open viminfo file for reading"));
1955 }
1956 else
1957diff -Naur vim72.orig/src/ex_getln.c vim72/src/ex_getln.c
1958--- vim72.orig/src/ex_getln.c 2008-08-08 02:31:33.000000000 -0700
[43c52a1]1959+++ vim72/src/ex_getln.c 2009-01-08 20:57:43.000000000 -0800
[76dd250]1960@@ -31,6 +31,8 @@
1961 int cmdattr; /* attributes for prompt */
1962 int overstrike; /* Typing mode on the command line. Shared by
1963 getcmdline() and put_on_cmdline(). */
1964+ expand_T *xpc; /* struct being used for expansion, xp_pattern
1965+ may point into cmdbuff */
1966 int xp_context; /* type of expansion */
1967 # ifdef FEAT_EVAL
1968 char_u *xp_arg; /* user-defined expansion arg */
1969@@ -38,7 +40,11 @@
1970 # endif
1971 };
1972
1973-static struct cmdline_info ccline; /* current cmdline_info */
1974+/* The current cmdline_info. It is initialized in getcmdline() and after that
1975+ * used by other functions. When invoking getcmdline() recursively it needs
1976+ * to be saved with save_cmdline() and restored with restore_cmdline().
1977+ * TODO: make it local to getcmdline() and pass it around. */
1978+static struct cmdline_info ccline;
1979
1980 static int cmd_showtail; /* Only show path tail in lists ? */
1981
1982@@ -238,6 +244,7 @@
1983 }
1984
1985 ExpandInit(&xpc);
1986+ ccline.xpc = &xpc;
1987
1988 #ifdef FEAT_RIGHTLEFT
1989 if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
1990@@ -408,9 +415,10 @@
1991 #endif
1992
1993 /*
1994- * <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>).
1995+ * When there are matching completions to select <S-Tab> works like
1996+ * CTRL-P (unless 'wc' is <S-Tab>).
1997 */
1998- if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)
1999+ if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
2000 c = Ctrl_P;
2001
2002 #ifdef FEAT_WILDMENU
2003@@ -1513,6 +1521,7 @@
2004 int old_firstc;
2005
2006 vim_free(ccline.cmdbuff);
2007+ xpc.xp_context = EXPAND_NOTHING;
2008 if (hiscnt == hislen)
2009 p = lookfor; /* back to the old one */
2010 else
2011@@ -1839,6 +1848,7 @@
2012 #endif
2013
2014 ExpandCleanup(&xpc);
2015+ ccline.xpc = NULL;
2016
2017 #ifdef FEAT_SEARCH_EXTRA
2018 if (did_incsearch)
2019@@ -2508,6 +2518,20 @@
2020 }
2021 mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
2022 vim_free(p);
2023+
2024+ if (ccline.xpc != NULL
2025+ && ccline.xpc->xp_pattern != NULL
2026+ && ccline.xpc->xp_context != EXPAND_NOTHING
2027+ && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
2028+ {
2029+ int i = (int)(ccline.xpc->xp_pattern - p);
2030+
2031+ /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
2032+ * to point into the newly allocated memory. */
2033+ if (i >= 0 && i <= ccline.cmdlen)
2034+ ccline.xpc->xp_pattern = ccline.cmdbuff + i;
2035+ }
2036+
2037 return OK;
2038 }
2039
2040@@ -2875,6 +2899,7 @@
2041 prev_ccline = ccline;
2042 ccline.cmdbuff = NULL;
2043 ccline.cmdprompt = NULL;
2044+ ccline.xpc = NULL;
2045 }
2046
2047 /*
2048@@ -3582,6 +3607,7 @@
2049 ExpandInit(xp)
2050 expand_T *xp;
2051 {
2052+ xp->xp_pattern = NULL;
2053 xp->xp_backslash = XP_BS_NONE;
2054 #ifndef BACKSLASH_IN_FILENAME
2055 xp->xp_shell = FALSE;
2056@@ -4871,7 +4897,7 @@
2057 if (s == NULL)
2058 return FAIL;
2059 sprintf((char *)s, "%s/%s*.vim", dirname, pat);
2060- all = globpath(p_rtp, s);
2061+ all = globpath(p_rtp, s, 0);
2062 vim_free(s);
2063 if (all == NULL)
2064 return FAIL;
2065@@ -4912,9 +4938,10 @@
2066 * newlines. Returns NULL for an error or no matches.
2067 */
2068 char_u *
2069-globpath(path, file)
2070+globpath(path, file, expand_options)
2071 char_u *path;
2072 char_u *file;
2073+ int expand_options;
2074 {
2075 expand_T xpc;
2076 char_u *buf;
2077@@ -4943,10 +4970,10 @@
2078 {
2079 add_pathsep(buf);
2080 STRCAT(buf, file);
2081- if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
2082- && num_p > 0)
2083+ if (ExpandFromContext(&xpc, buf, &num_p, &p,
2084+ WILD_SILENT|expand_options) != FAIL && num_p > 0)
2085 {
2086- ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
2087+ ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
2088 for (len = 0, i = 0; i < num_p; ++i)
2089 len += (int)STRLEN(p[i]) + 1;
2090
2091diff -Naur vim72.orig/src/feature.h vim72/src/feature.h
2092--- vim72.orig/src/feature.h 2008-08-06 04:00:39.000000000 -0700
[43c52a1]2093+++ vim72/src/feature.h 2009-01-08 20:57:32.000000000 -0800
[76dd250]2094@@ -767,9 +767,13 @@
2095
2096 /*
2097 * +browse ":browse" command.
2098+ * or just the ":browse" command modifier
2099 */
2100-#if defined(FEAT_NORMAL) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC))
2101-# define FEAT_BROWSE
2102+#if defined(FEAT_NORMAL)
2103+# define FEAT_BROWSE_CMD
2104+# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)
2105+# define FEAT_BROWSE
2106+# endif
2107 #endif
2108
2109 /*
2110diff -Naur vim72.orig/src/fileio.c vim72/src/fileio.c
2111--- vim72.orig/src/fileio.c 2008-08-06 04:01:03.000000000 -0700
[43c52a1]2112+++ vim72/src/fileio.c 2009-01-08 20:57:54.000000000 -0800
[76dd250]2113@@ -932,7 +932,10 @@
2114 else
2115 {
2116 if (eap != NULL && eap->force_ff != 0)
2117+ {
2118 fileformat = get_fileformat_force(curbuf, eap);
2119+ try_unix = try_dos = try_mac = FALSE;
2120+ }
2121 else if (curbuf->b_p_bin)
2122 fileformat = EOL_UNIX; /* binary: use Unix format */
2123 else if (*p_ffs == NUL)
2124@@ -2211,7 +2214,7 @@
2125 {
2126 /* Use stderr for stdin, makes shell commands work. */
2127 close(0);
2128- dup(2);
2129+ ignored = dup(2);
2130 }
2131 #endif
2132
2133@@ -2341,11 +2344,6 @@
2134 STRCAT(IObuff, _("[CR missing]"));
2135 c = TRUE;
2136 }
2137- if (ff_error == EOL_MAC)
2138- {
2139- STRCAT(IObuff, _("[NL found]"));
2140- c = TRUE;
2141- }
2142 if (split)
2143 {
2144 STRCAT(IObuff, _("[long lines split]"));
2145@@ -2711,7 +2709,7 @@
2146 {
2147 if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
2148 && curbuf->b_ffname != NULL)
2149- read_viminfo(NULL, FALSE, TRUE, FALSE);
2150+ read_viminfo(NULL, VIF_WANT_MARKS);
2151
2152 /* Always set b_marks_read; needed when 'viminfo' is changed to include
2153 * the ' parameter after opening a buffer. */
2154@@ -3451,7 +3449,7 @@
2155 {
2156 # ifdef UNIX
2157 # ifdef HAVE_FCHOWN
2158- fchown(fd, st_old.st_uid, st_old.st_gid);
2159+ ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
2160 # endif
2161 if (mch_stat((char *)IObuff, &st) < 0
2162 || st.st_uid != st_old.st_uid
2163@@ -4367,7 +4365,7 @@
2164 || st.st_uid != st_old.st_uid
2165 || st.st_gid != st_old.st_gid)
2166 {
2167- fchown(fd, st_old.st_uid, st_old.st_gid);
2168+ ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
2169 if (perm >= 0) /* set permission again, may have changed */
2170 (void)mch_setperm(wfname, perm);
2171 }
2172@@ -5550,9 +5548,10 @@
2173 name = "ucs-4le"; /* FF FE 00 00 */
2174 len = 4;
2175 }
2176- else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L))
2177+ else if (flags == (FIO_UCS2 | FIO_ENDIAN_L))
2178 name = "ucs-2le"; /* FF FE */
2179- else if (flags == (FIO_UTF16 | FIO_ENDIAN_L))
2180+ else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L))
2181+ /* utf-16le is preferred, it also works for ucs-2le text */
2182 name = "utf-16le"; /* FF FE */
2183 }
2184 else if (p[0] == 0xfe && p[1] == 0xff
2185@@ -6031,9 +6030,9 @@
2186 {
2187 tbuf[FGETS_SIZE - 2] = NUL;
2188 #ifdef USE_CR
2189- fgets_cr((char *)tbuf, FGETS_SIZE, fp);
2190+ ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
2191 #else
2192- fgets((char *)tbuf, FGETS_SIZE, fp);
2193+ ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
2194 #endif
2195 } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
2196 }
[43c52a1]2197@@ -6107,12 +6106,24 @@
2198 #ifdef HAVE_ACL
2199 vim_acl_T acl; /* ACL from original file */
2200 #endif
2201+#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
2202+ int use_tmp_file = FALSE;
2203+#endif
2204
2205 /*
2206- * When the names are identical, there is nothing to do.
2207+ * When the names are identical, there is nothing to do. When they refer
2208+ * to the same file (ignoring case and slash/backslash differences) but
2209+ * the file name differs we need to go through a temp file.
2210 */
2211 if (fnamecmp(from, to) == 0)
2212- return 0;
2213+ {
2214+#ifdef CASE_INSENSITIVE_FILENAME
2215+ if (STRCMP(gettail(from), gettail(to)) != 0)
2216+ use_tmp_file = TRUE;
2217+ else
2218+#endif
2219+ return 0;
2220+ }
2221
2222 /*
2223 * Fail if the "from" file doesn't exist. Avoids that "to" is deleted.
2224@@ -6120,6 +6131,55 @@
[1f22c7c]2225 if (mch_stat((char *)from, &st) < 0)
2226 return -1;
2227
2228+#ifdef UNIX
2229+ {
2230+ struct stat st_to;
2231+
2232+ /* It's possible for the source and destination to be the same file.
2233+ * This happens when "from" and "to" differ in case and are on a FAT32
2234+ * filesystem. In that case go through a temp file name. */
2235+ if (mch_stat((char *)to, &st_to) >= 0
2236+ && st.st_dev == st_to.st_dev
2237+ && st.st_ino == st_to.st_ino)
[43c52a1]2238+ use_tmp_file = TRUE;
2239+ }
2240+#endif
2241+
2242+#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
2243+ if (use_tmp_file)
2244+ {
2245+ char tempname[MAXPATHL + 1];
2246+
2247+ /*
2248+ * Find a name that doesn't exist and is in the same directory.
2249+ * Rename "from" to "tempname" and then rename "tempname" to "to".
2250+ */
2251+ if (STRLEN(from) >= MAXPATHL - 5)
2252+ return -1;
2253+ STRCPY(tempname, from);
2254+ for (n = 123; n < 99999; ++n)
[1f22c7c]2255+ {
[43c52a1]2256+ sprintf((char *)gettail((char_u *)tempname), "%d", n);
2257+ if (mch_stat(tempname, &st) < 0)
[1f22c7c]2258+ {
[43c52a1]2259+ if (mch_rename((char *)from, tempname) == 0)
[1f22c7c]2260+ {
[43c52a1]2261+ if (mch_rename(tempname, (char *)to) == 0)
2262+ return 0;
2263+ /* Strange, the second step failed. Try moving the
2264+ * file back and return failure. */
2265+ mch_rename(tempname, (char *)from);
[1f22c7c]2266+ return -1;
2267+ }
[43c52a1]2268+ /* If it fails for one temp name it will most likely fail
2269+ * for any temp name, give up. */
2270+ return -1;
[1f22c7c]2271+ }
2272+ }
[43c52a1]2273+ return -1;
[1f22c7c]2274+ }
2275+#endif
2276+
2277 /*
2278 * Delete the "to" file, this is required on some systems to make the
2279 * mch_rename() work, on other systems it makes sure that we don't have
[43c52a1]2280@@ -8523,6 +8583,7 @@
[76dd250]2281 char_u *save_sourcing_name;
2282 linenr_T save_sourcing_lnum;
2283 char_u *save_autocmd_fname;
2284+ int save_autocmd_fname_full;
2285 int save_autocmd_bufnr;
2286 char_u *save_autocmd_match;
2287 int save_autocmd_busy;
[43c52a1]2288@@ -8601,6 +8662,7 @@
[76dd250]2289 * Save the autocmd_* variables and info about the current buffer.
2290 */
2291 save_autocmd_fname = autocmd_fname;
2292+ save_autocmd_fname_full = autocmd_fname_full;
2293 save_autocmd_bufnr = autocmd_bufnr;
2294 save_autocmd_match = autocmd_match;
2295 save_autocmd_busy = autocmd_busy;
[43c52a1]2296@@ -8618,14 +8680,15 @@
[76dd250]2297 if (fname != NULL && *fname != NUL)
2298 autocmd_fname = fname;
2299 else if (buf != NULL)
2300- autocmd_fname = buf->b_fname;
2301+ autocmd_fname = buf->b_ffname;
2302 else
2303 autocmd_fname = NULL;
2304 }
2305 else
2306 autocmd_fname = fname_io;
2307 if (autocmd_fname != NULL)
2308- autocmd_fname = FullName_save(autocmd_fname, FALSE);
2309+ autocmd_fname = vim_strsave(autocmd_fname);
2310+ autocmd_fname_full = FALSE; /* call FullName_save() later */
2311
2312 /*
2313 * Set the buffer number to be used for <abuf>.
[43c52a1]2314@@ -8810,6 +8873,7 @@
[76dd250]2315 sourcing_lnum = save_sourcing_lnum;
2316 vim_free(autocmd_fname);
2317 autocmd_fname = save_autocmd_fname;
2318+ autocmd_fname_full = save_autocmd_fname_full;
2319 autocmd_bufnr = save_autocmd_bufnr;
2320 autocmd_match = save_autocmd_match;
2321 #ifdef FEAT_EVAL
[43c52a1]2322@@ -8918,7 +8982,7 @@
[76dd250]2323 {
2324 apc->curpat = NULL;
2325
2326- /* only use a pattern when it has not been removed, has commands and
2327+ /* Only use a pattern when it has not been removed, has commands and
2328 * the group matches. For buffer-local autocommands only check the
2329 * buffer number. */
2330 if (ap->pat != NULL && ap->cmds != NULL
[43c52a1]2331@@ -9104,7 +9168,7 @@
[76dd250]2332 set_context_in_autocmd(xp, arg, doautocmd)
2333 expand_T *xp;
2334 char_u *arg;
2335- int doautocmd; /* TRUE for :doautocmd, FALSE for :autocmd */
2336+ int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */
2337 {
2338 char_u *p;
2339 int group;
2340diff -Naur vim72.orig/src/fold.c vim72/src/fold.c
2341--- vim72.orig/src/fold.c 2008-08-06 04:01:12.000000000 -0700
[43c52a1]2342+++ vim72/src/fold.c 2009-01-08 20:57:54.000000000 -0800
[76dd250]2343@@ -48,7 +48,7 @@
2344 static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp));
2345 static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum));
2346 static void checkupdate __ARGS((win_T *wp));
2347-static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open));
2348+static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open));
2349 static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep));
2350 static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep));
2351 static void foldOpenNested __ARGS((fold_T *fpr));
[43c52a1]2352@@ -740,7 +740,7 @@
2353 garray_T *found_ga;
2354 fold_T *found_fp = NULL;
2355 linenr_T found_off = 0;
2356- int use_level = FALSE;
2357+ int use_level;
2358 int maybe_small = FALSE;
2359 int level = 0;
2360 linenr_T lnum = start;
2361@@ -757,6 +757,7 @@
2362 gap = &curwin->w_folds;
2363 found_ga = NULL;
2364 lnum_off = 0;
2365+ use_level = FALSE;
2366 for (;;)
2367 {
2368 if (!foldFind(gap, lnum - lnum_off, &fp))
2369@@ -783,20 +784,21 @@
2370 else
2371 {
2372 lnum = found_fp->fd_top + found_fp->fd_len + found_off;
2373- did_one = TRUE;
2374
2375 if (foldmethodIsManual(curwin))
2376 deleteFoldEntry(found_ga,
2377 (int)(found_fp - (fold_T *)found_ga->ga_data), recursive);
2378 else
2379 {
2380- if (found_fp->fd_top + found_off < first_lnum)
2381- first_lnum = found_fp->fd_top;
2382- if (lnum > last_lnum)
2383+ if (first_lnum > found_fp->fd_top + found_off)
2384+ first_lnum = found_fp->fd_top + found_off;
2385+ if (last_lnum < lnum)
2386 last_lnum = lnum;
2387- parseMarker(curwin);
2388+ if (!did_one)
2389+ parseMarker(curwin);
2390 deleteFoldMarkers(found_fp, recursive, found_off);
2391 }
2392+ did_one = TRUE;
2393
2394 /* redraw window */
2395 changed_window_setting();
2396@@ -811,6 +813,10 @@
2397 redraw_curbuf_later(INVERTED);
2398 #endif
2399 }
2400+ else
2401+ /* Deleting markers may make cursor column invalid. */
2402+ check_cursor_col();
2403+
2404 if (last_lnum > 0)
2405 changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L);
2406 }
2407@@ -1241,10 +1247,10 @@
[76dd250]2408 * Repeat "count" times.
2409 */
2410 static void
2411-setFoldRepeat(lnum, count, open)
2412+setFoldRepeat(lnum, count, do_open)
2413 linenr_T lnum;
2414 long count;
2415- int open;
2416+ int do_open;
2417 {
2418 int done;
2419 long n;
[43c52a1]2420@@ -1252,7 +1258,7 @@
[76dd250]2421 for (n = 0; n < count; ++n)
2422 {
2423 done = DONE_NOTHING;
2424- (void)setManualFold(lnum, open, FALSE, &done);
2425+ (void)setManualFold(lnum, do_open, FALSE, &done);
2426 if (!(done & DONE_ACTION))
2427 {
2428 /* Only give an error message when no fold could be opened. */
2429diff -Naur vim72.orig/src/getchar.c vim72/src/getchar.c
2430--- vim72.orig/src/getchar.c 2008-07-22 09:57:48.000000000 -0700
[43c52a1]2431+++ vim72/src/getchar.c 2009-01-08 20:57:43.000000000 -0800
[76dd250]2432@@ -4702,7 +4702,7 @@
2433 return FAIL;
2434 if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0)
2435 return FAIL;
2436- if (fprintf(fd, cmd) < 0)
2437+ if (fputs(cmd, fd) < 0)
2438 return FAIL;
2439 if (buf != NULL && fputs(" <buffer>", fd) < 0)
2440 return FAIL;
2441@@ -4801,7 +4801,7 @@
2442 }
2443 if (IS_SPECIAL(c) || modifiers) /* special key */
2444 {
2445- if (fprintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)
2446+ if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0)
2447 return FAIL;
2448 continue;
2449 }
2450diff -Naur vim72.orig/src/globals.h vim72/src/globals.h
2451--- vim72.orig/src/globals.h 2008-07-26 04:53:29.000000000 -0700
[43c52a1]2452+++ vim72/src/globals.h 2009-01-08 20:57:54.000000000 -0800
[76dd250]2453@@ -1022,6 +1022,7 @@
2454 #endif
2455 #ifdef FEAT_AUTOCMD
2456 EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
2457+EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
2458 EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
2459 EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
2460 EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
[43c52a1]2461@@ -1339,7 +1340,6 @@
2462
2463 #ifdef FEAT_NETBEANS_INTG
2464 EXTERN char *netbeansArg INIT(= NULL); /* the -nb[:host:port:passwd] arg */
2465-EXTERN int netbeansCloseFile INIT(= 0); /* send killed if != 0 */
2466 EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */
2467 EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */
2468 EXTERN int netbeansReadFile INIT(= 1); /* OK to read from disk if != 0 */
2469@@ -1548,6 +1548,14 @@
[76dd250]2470 EXTERN time_t starttime;
2471
2472 /*
2473+ * Some compilers warn for not using a return value, but in some situations we
2474+ * can't do anything useful with the value. Assign to this variable to avoid
2475+ * the warning.
2476+ */
2477+EXTERN int ignored;
2478+EXTERN char *ignoredp;
2479+
2480+/*
2481 * Optional Farsi support. Include it here, so EXTERN and INIT are defined.
2482 */
2483 #ifdef FEAT_FKMAP
2484diff -Naur vim72.orig/src/gui.c vim72/src/gui.c
2485--- vim72.orig/src/gui.c 2008-07-27 12:32:14.000000000 -0700
[43c52a1]2486+++ vim72/src/gui.c 2009-01-08 20:57:45.000000000 -0800
[76dd250]2487@@ -139,7 +139,7 @@
2488 /* The read returns when the child closes the pipe (or when
2489 * the child dies for some reason). */
2490 close(pipefd[1]);
2491- (void)read(pipefd[0], &dummy, (size_t)1);
2492+ ignored = (int)read(pipefd[0], &dummy, (size_t)1);
2493 close(pipefd[0]);
2494 }
2495
2496@@ -3241,7 +3241,7 @@
2497 i = Rows;
2498 gui_update_tabline();
2499 Rows = i;
2500- need_set_size = RESIZE_VERT;
2501+ need_set_size |= RESIZE_VERT;
2502 if (using_tabline)
2503 fix_size = TRUE;
2504 if (!gui_use_tabline())
2505@@ -3275,9 +3275,9 @@
2506 if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
2507 {
2508 if (i == SBAR_BOTTOM)
2509- need_set_size = RESIZE_VERT;
2510+ need_set_size |= RESIZE_VERT;
2511 else
2512- need_set_size = RESIZE_HOR;
2513+ need_set_size |= RESIZE_HOR;
2514 if (gui.which_scrollbars[i])
2515 fix_size = TRUE;
2516 }
2517@@ -3297,7 +3297,7 @@
2518 gui_mch_enable_menu(gui.menu_is_active);
2519 Rows = i;
2520 prev_menu_is_active = gui.menu_is_active;
2521- need_set_size = RESIZE_VERT;
2522+ need_set_size |= RESIZE_VERT;
2523 if (gui.menu_is_active)
2524 fix_size = TRUE;
2525 }
2526@@ -3308,7 +3308,7 @@
2527 {
2528 gui_mch_show_toolbar(using_toolbar);
2529 prev_toolbar = using_toolbar;
2530- need_set_size = RESIZE_VERT;
2531+ need_set_size |= RESIZE_VERT;
2532 if (using_toolbar)
2533 fix_size = TRUE;
2534 }
2535@@ -3318,7 +3318,7 @@
2536 {
2537 gui_mch_enable_footer(using_footer);
2538 prev_footer = using_footer;
2539- need_set_size = RESIZE_VERT;
2540+ need_set_size |= RESIZE_VERT;
2541 if (using_footer)
2542 fix_size = TRUE;
2543 }
2544@@ -3330,10 +3330,11 @@
2545 prev_tearoff = using_tearoff;
2546 }
2547 #endif
2548- if (need_set_size)
2549+ if (need_set_size != 0)
2550 {
2551 #ifdef FEAT_GUI_GTK
2552- long c = Columns;
2553+ long prev_Columns = Columns;
2554+ long prev_Rows = Rows;
2555 #endif
2556 /* Adjust the size of the window to make the text area keep the
2557 * same size and to avoid that part of our window is off-screen
2558@@ -3349,11 +3350,14 @@
2559 * If you remove this, please test this command for resizing
2560 * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
2561 * Don't do this while starting up though.
2562- * And don't change Rows, it may have be reduced intentionally
2563- * when adding menu/toolbar/tabline. */
2564- if (!gui.starting)
2565+ * Don't change Rows when adding menu/toolbar/tabline.
2566+ * Don't change Columns when adding vertical toolbar. */
2567+ if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
2568 (void)char_avail();
2569- Columns = c;
2570+ if ((need_set_size & RESIZE_VERT) == 0)
2571+ Rows = prev_Rows;
2572+ if ((need_set_size & RESIZE_HOR) == 0)
2573+ Columns = prev_Columns;
2574 #endif
2575 }
2576 #ifdef FEAT_WINDOWS
2577diff -Naur vim72.orig/src/gui_at_sb.c vim72/src/gui_at_sb.c
2578--- vim72.orig/src/gui_at_sb.c 2004-06-07 07:32:25.000000000 -0700
[43c52a1]2579+++ vim72/src/gui_at_sb.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]2580@@ -1078,6 +1078,12 @@
2581 Cardinal *num_params; /* unused */
2582 {
2583 ScrollbarWidget sbw = (ScrollbarWidget)w;
2584+ /* Use a union to avoid a warning for the weird conversion from float to
2585+ * XtPointer. Comes from Xaw/Scrollbar.c. */
2586+ union {
2587+ XtPointer xtp;
2588+ float xtf;
2589+ } xtpf;
2590
2591 if (LookAhead(w, event))
2592 return;
2593@@ -1085,7 +1091,8 @@
2594 /* thumbProc is not pretty, but is necessary for backwards
2595 compatibility on those architectures for which it work{s,ed};
2596 the intent is to pass a (truncated) float by value. */
2597- XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top);
2598+ xtpf.xtf = sbw->scrollbar.top;
2599+ XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
2600 XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
2601 }
2602
2603diff -Naur vim72.orig/src/gui_gtk_x11.c vim72/src/gui_gtk_x11.c
2604--- vim72.orig/src/gui_gtk_x11.c 2008-07-04 03:46:24.000000000 -0700
[43c52a1]2605+++ vim72/src/gui_gtk_x11.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]2606@@ -4070,14 +4070,14 @@
2607
2608 if (mask & (XValue | YValue))
2609 {
2610- int w, h;
2611- gui_mch_get_screen_dimensions(&w, &h);
2612- h += p_ghr + get_menu_tool_height();
2613- w += get_menu_tool_width();
2614+ int ww, hh;
2615+ gui_mch_get_screen_dimensions(&ww, &hh);
2616+ hh += p_ghr + get_menu_tool_height();
2617+ ww += get_menu_tool_width();
2618 if (mask & XNegative)
2619- x += w - pixel_width;
2620+ x += ww - pixel_width;
2621 if (mask & YNegative)
2622- y += h - pixel_height;
2623+ y += hh - pixel_height;
2624 #ifdef HAVE_GTK2
2625 gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
2626 #else
2627diff -Naur vim72.orig/src/gui_x11.c vim72/src/gui_x11.c
2628--- vim72.orig/src/gui_x11.c 2008-06-08 08:13:45.000000000 -0700
[43c52a1]2629+++ vim72/src/gui_x11.c 2009-01-08 20:57:33.000000000 -0800
[76dd250]2630@@ -2450,7 +2450,7 @@
2631 *colorPtr = colortable[closest];
2632 }
2633
2634- free(colortable);
2635+ vim_free(colortable);
2636 return OK;
2637 }
2638
2639diff -Naur vim72.orig/src/gui_xmdlg.c vim72/src/gui_xmdlg.c
2640--- vim72.orig/src/gui_xmdlg.c 2008-06-21 09:05:32.000000000 -0700
[43c52a1]2641+++ vim72/src/gui_xmdlg.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]2642@@ -369,10 +369,10 @@
2643 char buf[TEMP_BUF_SIZE];
2644 XmString items[MAX_ENTRIES_IN_LIST];
2645 int i;
2646- int index;
2647+ int idx;
2648
2649- for (index = (int)ENCODING; index < (int)NONE; ++index)
2650- count[index] = 0;
2651+ for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
2652+ count[idx] = 0;
2653
2654 /* First we insert the wild char into every single list. */
2655 if (fix != ENCODING)
2656@@ -503,14 +503,14 @@
2657 /*
2658 * Now loop trough the remaining lists and set them up.
2659 */
2660- for (index = (int)NAME; index < (int)NONE; ++index)
2661+ for (idx = (int)NAME; idx < (int)NONE; ++idx)
2662 {
2663 Widget w;
2664
2665- if (fix == (enum ListSpecifier)index)
2666+ if (fix == (enum ListSpecifier)idx)
2667 continue;
2668
2669- switch ((enum ListSpecifier)index)
2670+ switch ((enum ListSpecifier)idx)
2671 {
2672 case NAME:
2673 w = data->list[NAME];
2674@@ -525,21 +525,21 @@
2675 w = (Widget)0; /* for lint */
2676 }
2677
2678- for (i = 0; i < count[index]; ++i)
2679+ for (i = 0; i < count[idx]; ++i)
2680 {
2681- items[i] = XmStringCreateLocalized(list[index][i]);
2682- XtFree(list[index][i]);
2683+ items[i] = XmStringCreateLocalized(list[idx][i]);
2684+ XtFree(list[idx][i]);
2685 }
2686 XmListDeleteAllItems(w);
2687- XmListAddItems(w, items, count[index], 1);
2688- if (data->sel[index])
2689+ XmListAddItems(w, items, count[idx], 1);
2690+ if (data->sel[idx])
2691 {
2692 XmStringFree(items[0]);
2693- items[0] = XmStringCreateLocalized(data->sel[index]);
2694+ items[0] = XmStringCreateLocalized(data->sel[idx]);
2695 XmListSelectItem(w, items[0], False);
2696 XmListSetBottomItem(w, items[0]);
2697 }
2698- for (i = 0; i < count[index]; ++i)
2699+ for (i = 0; i < count[idx]; ++i)
2700 XmStringFree(items[i]);
2701 }
2702 }
2703@@ -695,14 +695,14 @@
2704 int n;
2705 XmString str;
2706 Arg args[4];
2707- char *msg = _("no specific match");
2708+ char *nomatch_msg = _("no specific match");
2709
2710 n = 0;
2711- str = XmStringCreateLocalized(msg);
2712+ str = XmStringCreateLocalized(nomatch_msg);
2713 XtSetArg(args[n], XmNlabelString, str); ++n;
2714 XtSetValues(data->sample, args, n);
2715 apply_fontlist(data->sample);
2716- XmTextSetString(data->name, msg);
2717+ XmTextSetString(data->name, nomatch_msg);
2718 XmStringFree(str);
2719
2720 return False;
2721@@ -886,21 +886,21 @@
2722 {
2723 int i;
2724 int max;
2725- int index = 0;
2726+ int idx = 0;
2727 int size;
2728- char str[128];
2729+ char buf[128];
2730
2731 for (i = 0, max = 0; i < data->num; i++)
2732 {
2733- get_part(fn(data, i), 7, str);
2734- size = atoi(str);
2735+ get_part(fn(data, i), 7, buf);
2736+ size = atoi(buf);
2737 if ((size > max) && (size < MAX_DISPLAY_SIZE))
2738 {
2739- index = i;
2740+ idx = i;
2741 max = size;
2742 }
2743 }
2744- strcpy(big_font, fn(data, index));
2745+ strcpy(big_font, fn(data, idx));
2746 }
2747 data->old = XLoadQueryFont(XtDisplay(parent), big_font);
2748 data->old_list = gui_motif_create_fontlist(data->old);
2749@@ -1217,28 +1217,28 @@
2750
2751 if (i != 0)
2752 {
2753- char name[TEMP_BUF_SIZE];
2754- char style[TEMP_BUF_SIZE];
2755- char size[TEMP_BUF_SIZE];
2756- char encoding[TEMP_BUF_SIZE];
2757+ char namebuf[TEMP_BUF_SIZE];
2758+ char stylebuf[TEMP_BUF_SIZE];
2759+ char sizebuf[TEMP_BUF_SIZE];
2760+ char encodingbuf[TEMP_BUF_SIZE];
2761 char *found;
2762
2763 found = names[0];
2764
2765- name_part(found, name);
2766- style_part(found, style);
2767- size_part(found, size, data->in_pixels);
2768- encoding_part(found, encoding);
2769-
2770- if (strlen(name) > 0
2771- && strlen(style) > 0
2772- && strlen(size) > 0
2773- && strlen(encoding) > 0)
2774+ name_part(found, namebuf);
2775+ style_part(found, stylebuf);
2776+ size_part(found, sizebuf, data->in_pixels);
2777+ encoding_part(found, encodingbuf);
2778+
2779+ if (strlen(namebuf) > 0
2780+ && strlen(stylebuf) > 0
2781+ && strlen(sizebuf) > 0
2782+ && strlen(encodingbuf) > 0)
2783 {
2784- data->sel[NAME] = XtNewString(name);
2785- data->sel[STYLE] = XtNewString(style);
2786- data->sel[SIZE] = XtNewString(size);
2787- data->sel[ENCODING] = XtNewString(encoding);
2788+ data->sel[NAME] = XtNewString(namebuf);
2789+ data->sel[STYLE] = XtNewString(stylebuf);
2790+ data->sel[SIZE] = XtNewString(sizebuf);
2791+ data->sel[ENCODING] = XtNewString(encodingbuf);
2792 data->font_name = XtNewString(names[0]);
2793 display_sample(data);
2794 XmTextSetString(data->name, data->font_name);
2795diff -Naur vim72.orig/src/gui_xmebw.c vim72/src/gui_xmebw.c
2796--- vim72.orig/src/gui_xmebw.c 2007-09-06 03:57:51.000000000 -0700
[43c52a1]2797+++ vim72/src/gui_xmebw.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]2798@@ -1256,7 +1256,7 @@
2799 }
2800 else
2801 {
2802- int adjust = 0;
2803+ adjust = 0;
2804
2805 #if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
2806 /*
2807@@ -1268,12 +1268,11 @@
2808 {
2809 case XmEXTERNAL_HIGHLIGHT:
2810 adjust = (eb->primitive.highlight_thickness -
2811- (eb->pushbutton.default_button_shadow_thickness ?
2812- Xm3D_ENHANCE_PIXEL : 0));
2813+ (eb->pushbutton.default_button_shadow_thickness
2814+ ? Xm3D_ENHANCE_PIXEL : 0));
2815 break;
2816
2817 case XmINTERNAL_HIGHLIGHT:
2818- adjust = 0;
2819 break;
2820
2821 default:
2822diff -Naur vim72.orig/src/if_cscope.c vim72/src/if_cscope.c
2823--- vim72.orig/src/if_cscope.c 2008-06-24 09:32:34.000000000 -0700
[43c52a1]2824+++ vim72/src/if_cscope.c 2009-01-08 20:57:27.000000000 -0800
[76dd250]2825@@ -74,7 +74,7 @@
2826 { "add", cs_add,
2827 N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 },
2828 { "find", cs_find,
2829- N_("Query for a pattern"), FIND_USAGE, 1 },
2830+ N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 },
2831 { "help", cs_help,
2832 N_("Show this message"), "help", 0 },
2833 { "kill", cs_kill,
2834@@ -1180,7 +1180,16 @@
2835 (void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
2836 cmdp->name, _(cmdp->help), cmdp->usage);
2837 if (strcmp(cmdp->name, "find") == 0)
2838- MSG_PUTS(FIND_HELP);
2839+ MSG_PUTS(_("\n"
2840+ " c: Find functions calling this function\n"
2841+ " d: Find functions called by this function\n"
2842+ " e: Find this egrep pattern\n"
2843+ " f: Find this file\n"
2844+ " g: Find this definition\n"
2845+ " i: Find files #including this file\n"
2846+ " s: Find this C symbol\n"
2847+ " t: Find assignments to\n"));
2848+
2849 cmdp++;
2850 }
2851
2852diff -Naur vim72.orig/src/if_cscope.h vim72/src/if_cscope.h
2853--- vim72.orig/src/if_cscope.h 2007-09-02 07:51:08.000000000 -0700
[43c52a1]2854+++ vim72/src/if_cscope.h 2009-01-08 20:57:27.000000000 -0800
[76dd250]2855@@ -42,17 +42,6 @@
2856 * f 7name Find this file
2857 * i 8name Find files #including this file
2858 */
2859-#define FIND_USAGE "find c|d|e|f|g|i|s|t name"
2860-#define FIND_HELP "\n\
2861- c: Find functions calling this function\n\
2862- d: Find functions called by this function\n\
2863- e: Find this egrep pattern\n\
2864- f: Find this file\n\
2865- g: Find this definition\n\
2866- i: Find files #including this file\n\
2867- s: Find this C symbol\n\
2868- t: Find assignments to\n"
2869-
2870
2871 typedef struct {
2872 char * name;
2873diff -Naur vim72.orig/src/if_perl.xs vim72/src/if_perl.xs
2874--- vim72.orig/src/if_perl.xs 2008-07-17 13:55:09.000000000 -0700
[43c52a1]2875+++ vim72/src/if_perl.xs 2009-01-08 20:57:45.000000000 -0800
[76dd250]2876@@ -136,6 +136,9 @@
2877 # define Perl_newXS_flags dll_Perl_newXS_flags
2878 #endif
2879 # define Perl_sv_free dll_Perl_sv_free
2880+# if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
2881+# define Perl_sv_free2 dll_Perl_sv_free2
2882+# endif
2883 # define Perl_sv_isa dll_Perl_sv_isa
2884 # define Perl_sv_magic dll_Perl_sv_magic
2885 # define Perl_sv_setiv dll_Perl_sv_setiv
2886@@ -163,7 +166,7 @@
2887 # define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr
2888 # define boot_DynaLoader dll_boot_DynaLoader
2889
2890-# define Perl_sys_init3 dll_Perl_sys_init3
2891+# define Perl_sys_init dll_Perl_sys_init
2892 # define Perl_sys_term dll_Perl_sys_term
2893 # define Perl_ISv_ptr dll_Perl_ISv_ptr
2894 # define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr
2895@@ -268,7 +271,8 @@
2896 static void (*boot_DynaLoader)_((pTHX_ CV*));
2897
2898 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
2899-static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
2900+static void (*Perl_sv_free2)(pTHX_ SV*);
2901+static void (*Perl_sys_init)(int* argc, char*** argv);
2902 static void (*Perl_sys_term)(void);
2903 static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
2904 static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*);
2905@@ -367,7 +371,8 @@
2906 {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr},
2907 {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
2908 #else
2909- {"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
2910+ {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
2911+ {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init},
2912 {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
2913 {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
2914 {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr},
2915@@ -455,7 +460,7 @@
2916 static char *argv[] = { "", "-e", "" };
2917
2918 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
2919- Perl_sys_init3(&argc, (char***)&argv, NULL);
2920+ Perl_sys_init(&argc, (char***)&argv);
2921 #endif
2922 perl_interp = perl_alloc();
2923 perl_construct(perl_interp);
2924diff -Naur vim72.orig/src/if_python.c vim72/src/if_python.c
2925--- vim72.orig/src/if_python.c 2008-07-17 14:09:32.000000000 -0700
[43c52a1]2926+++ vim72/src/if_python.c 2009-01-08 20:57:39.000000000 -0800
[76dd250]2927@@ -531,6 +531,12 @@
2928 if (PythonMod_Init())
2929 goto fail;
2930
2931+ /* Remove the element from sys.path that was added because of our
2932+ * argv[0] value in PythonMod_Init(). Previously we used an empty
2933+ * string, but dependinding on the OS we then get an empty entry or
2934+ * the current directory in sys.path. */
2935+ PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
2936+
2937 /* the first python thread is vim's, release the lock */
2938 Python_SaveThread();
2939
2940@@ -2345,7 +2351,8 @@
2941 {
2942 PyObject *mod;
2943 PyObject *dict;
2944- static char *(argv[2]) = {"", NULL};
2945+ /* The special value is removed from sys.path in Python_Init(). */
2946+ static char *(argv[2]) = {"/must>not&exist/foo", NULL};
2947
2948 /* Fixups... */
2949 BufferType.ob_type = &PyType_Type;
2950diff -Naur vim72.orig/src/if_xcmdsrv.c vim72/src/if_xcmdsrv.c
2951--- vim72.orig/src/if_xcmdsrv.c 2008-07-18 06:05:03.000000000 -0700
[43c52a1]2952+++ vim72/src/if_xcmdsrv.c 2009-01-08 20:57:36.000000000 -0800
[76dd250]2953@@ -736,7 +736,7 @@
2954 + serverReply.ga_len;
2955 e.id = w;
2956 ga_init2(&e.strings, 1, 100);
2957- memcpy(p, &e, sizeof(e));
2958+ mch_memmove(p, &e, sizeof(e));
2959 serverReply.ga_len++;
2960 }
2961 }
2962@@ -1018,7 +1018,7 @@
2963 p++;
2964 count = numItems - (p - regProp);
2965 if (count > 0)
2966- memcpy(entry, p, count);
2967+ mch_memmove(entry, p, count);
2968 XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
2969 8, PropModeReplace, regProp,
2970 (int)(numItems - (p - entry)));
2971@@ -1072,7 +1072,7 @@
2972 p++;
2973 lastHalf = numItems - (p - regProp);
2974 if (lastHalf > 0)
2975- memcpy(entry, p, lastHalf);
2976+ mch_memmove(entry, p, lastHalf);
2977 numItems = (entry - regProp) + lastHalf;
2978 p = entry;
2979 continue;
2980diff -Naur vim72.orig/src/main.c vim72/src/main.c
2981--- vim72.orig/src/main.c 2008-07-24 01:40:56.000000000 -0700
[43c52a1]2982+++ vim72/src/main.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]2983@@ -645,11 +645,12 @@
2984
2985 #ifdef FEAT_VIMINFO
2986 /*
2987- * Read in registers, history etc, but not marks, from the viminfo file
2988+ * Read in registers, history etc, but not marks, from the viminfo file.
2989+ * This is where v:oldfiles gets filled.
2990 */
2991 if (*p_viminfo != NUL)
2992 {
2993- read_viminfo(NULL, TRUE, FALSE, FALSE);
2994+ read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
2995 TIME_MSG("reading viminfo");
2996 }
2997 #endif
2998@@ -1457,7 +1458,8 @@
2999 ++initstr;
3000 }
3001
3002- if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k')
3003+ /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */
3004+ if (TOLOWER_ASC(initstr[0]) == 'g')
3005 {
3006 main_start_gui();
3007 #ifdef FEAT_GUI
3008@@ -1508,7 +1510,8 @@
3009 early_arg_scan(parmp)
3010 mparm_T *parmp;
3011 {
3012-#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER)
3013+#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
3014+ || !defined(FEAT_NETBEANS_INTG)
3015 int argc = parmp->argc;
3016 char **argv = parmp->argv;
3017 int i;
3018@@ -1580,6 +1583,14 @@
3019 else if (STRICMP(argv[i], "--echo-wid") == 0)
3020 echo_wid_arg = TRUE;
3021 # endif
3022+# ifndef FEAT_NETBEANS_INTG
3023+ else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
3024+ {
3025+ mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
3026+ mch_exit(2);
3027+ }
3028+# endif
3029+
3030 }
3031 #endif
3032 }
3033@@ -2361,7 +2372,7 @@
3034 * Is there any other system that cannot do this?
3035 */
3036 close(0);
3037- dup(2);
3038+ ignored = dup(2);
3039 #endif
3040 }
3041
3042diff -Naur vim72.orig/src/mark.c vim72/src/mark.c
3043--- vim72.orig/src/mark.c 2008-08-08 15:06:49.000000000 -0700
[43c52a1]3044+++ vim72/src/mark.c 2009-01-08 20:57:32.000000000 -0800
[76dd250]3045@@ -1627,15 +1627,17 @@
3046
3047 /*
3048 * Handle marks in the viminfo file:
3049- * fp_out == NULL read marks for current buffer only
3050- * fp_out != NULL copy marks for buffers not in buffer list
3051+ * fp_out != NULL: copy marks for buffers not in buffer list
3052+ * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
3053+ * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
3054 */
3055 void
3056-copy_viminfo_marks(virp, fp_out, count, eof)
3057+copy_viminfo_marks(virp, fp_out, count, eof, flags)
3058 vir_T *virp;
3059 FILE *fp_out;
3060 int count;
3061 int eof;
3062+ int flags;
3063 {
3064 char_u *line = virp->vir_line;
3065 buf_T *buf;
3066@@ -1647,10 +1649,23 @@
3067 char_u *p;
3068 char_u *name_buf;
3069 pos_T pos;
3070+#ifdef FEAT_EVAL
3071+ list_T *list = NULL;
3072+#endif
3073
3074 if ((name_buf = alloc(LSIZE)) == NULL)
3075 return;
3076 *name_buf = NUL;
3077+
3078+#ifdef FEAT_EVAL
3079+ if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT)))
3080+ {
3081+ list = list_alloc();
3082+ if (list != NULL)
3083+ set_vim_var_list(VV_OLDFILES, list);
3084+ }
3085+#endif
3086+
3087 num_marked_files = get_viminfo_parameter('\'');
3088 while (!eof && (count < num_marked_files || fp_out == NULL))
3089 {
3090@@ -1681,6 +1696,11 @@
3091 p++;
3092 *p = NUL;
3093
3094+#ifdef FEAT_EVAL
3095+ if (list != NULL)
3096+ list_append_string(list, str, -1);
3097+#endif
3098+
3099 /*
3100 * If fp_out == NULL, load marks for current buffer.
3101 * If fp_out != NULL, copy marks for buffers not in buflist.
3102@@ -1688,7 +1708,7 @@
3103 load_marks = copy_marks_out = FALSE;
3104 if (fp_out == NULL)
3105 {
3106- if (curbuf->b_ffname != NULL)
3107+ if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL)
3108 {
3109 if (*name_buf == NUL) /* only need to do this once */
3110 home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE);
3111diff -Naur vim72.orig/src/mbyte.c vim72/src/mbyte.c
3112--- vim72.orig/src/mbyte.c 2008-07-14 05:38:05.000000000 -0700
[43c52a1]3113+++ vim72/src/mbyte.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]3114@@ -717,7 +717,7 @@
3115 * where mblen() returns 0 for invalid character.
3116 * Therefore, following condition includes 0.
3117 */
3118- (void)mblen(NULL, 0); /* First reset the state. */
3119+ ignored = mblen(NULL, 0); /* First reset the state. */
3120 if (mblen(buf, (size_t)1) <= 0)
3121 n = 2;
3122 else
3123@@ -2540,7 +2540,6 @@
3124 return (int)(p - q);
3125 }
3126
3127-#if defined(FEAT_EVAL) || defined(PROTO)
3128 /*
3129 * Copy a character from "*fp" to "*tp" and advance the pointers.
3130 */
3131@@ -2555,7 +2554,6 @@
3132 *tp += l;
3133 *fp += l;
3134 }
3135-#endif
3136
3137 /*
3138 * Return the offset from "p" to the first byte of a character. When "p" is
3139@@ -3133,7 +3131,7 @@
3140 else
3141 s = p + 1;
3142 }
3143- for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i)
3144+ for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i)
3145 {
3146 if (s[i] == '_' || s[i] == '-')
3147 buf[i] = '-';
3148@@ -5280,7 +5278,7 @@
3149
3150 /*ARGSUSED*/
3151 static void
3152-preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3153+preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3154 {
3155 #ifdef XIM_DEBUG
3156 xim_log("xim_decide_input_style()\n");
3157@@ -5314,7 +5312,7 @@
3158
3159 /*ARGSUSED*/
3160 static void
3161-preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3162+preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3163 {
3164 XIMPreeditDrawCallbackStruct *draw_data;
3165 XIMText *text;
3166@@ -5386,7 +5384,7 @@
3167 draw_feedback = (char *)alloc(draw_data->chg_first
3168 + text->length);
3169 else
3170- draw_feedback = realloc(draw_feedback,
3171+ draw_feedback = vim_realloc(draw_feedback,
3172 draw_data->chg_first + text->length);
3173 if (draw_feedback != NULL)
3174 {
3175@@ -5455,7 +5453,7 @@
3176
3177 /*ARGSUSED*/
3178 static void
3179-preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3180+preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3181 {
3182 #ifdef XIM_DEBUG
3183 xim_log("preedit_caret_cbproc()\n");
3184@@ -5464,7 +5462,7 @@
3185
3186 /*ARGSUSED*/
3187 static void
3188-preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3189+preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3190 {
3191 #ifdef XIM_DEBUG
3192 xim_log("preedit_done_cbproc()\n");
3193diff -Naur vim72.orig/src/menu.c vim72/src/menu.c
3194--- vim72.orig/src/menu.c 2008-06-21 12:53:43.000000000 -0700
[43c52a1]3195+++ vim72/src/menu.c 2009-01-08 20:57:27.000000000 -0800
[76dd250]3196@@ -1120,6 +1120,7 @@
3197 parent = menu;
3198 menu = menu->children;
3199 }
3200+ vim_free(path_name);
3201
3202 /* Now we have found the matching menu, and we list the mappings */
3203 /* Highlight title */
3204diff -Naur vim72.orig/src/message.c vim72/src/message.c
3205--- vim72.orig/src/message.c 2008-07-09 11:24:55.000000000 -0700
[43c52a1]3206+++ vim72/src/message.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]3207@@ -4585,61 +4585,62 @@
3208 if (remove_trailing_zeroes)
3209 {
3210 int i;
3211- char *p;
3212+ char *tp;
3213
3214 /* Using %g or %G: remove superfluous zeroes. */
3215 if (fmt_spec == 'f')
3216- p = tmp + str_arg_l - 1;
3217+ tp = tmp + str_arg_l - 1;
3218 else
3219 {
3220- p = (char *)vim_strchr((char_u *)tmp,
3221+ tp = (char *)vim_strchr((char_u *)tmp,
3222 fmt_spec == 'e' ? 'e' : 'E');
3223- if (p != NULL)
3224+ if (tp != NULL)
3225 {
3226 /* Remove superfluous '+' and leading
3227 * zeroes from the exponent. */
3228- if (p[1] == '+')
3229+ if (tp[1] == '+')
3230 {
3231 /* Change "1.0e+07" to "1.0e07" */
3232- STRMOVE(p + 1, p + 2);
3233+ STRMOVE(tp + 1, tp + 2);
3234 --str_arg_l;
3235 }
3236- i = (p[1] == '-') ? 2 : 1;
3237- while (p[i] == '0')
3238+ i = (tp[1] == '-') ? 2 : 1;
3239+ while (tp[i] == '0')
3240 {
3241 /* Change "1.0e07" to "1.0e7" */
3242- STRMOVE(p + i, p + i + 1);
3243+ STRMOVE(tp + i, tp + i + 1);
3244 --str_arg_l;
3245 }
3246- --p;
3247+ --tp;
3248 }
3249 }
3250
3251- if (p != NULL && !precision_specified)
3252+ if (tp != NULL && !precision_specified)
3253 /* Remove trailing zeroes, but keep the one
3254 * just after a dot. */
3255- while (p > tmp + 2 && *p == '0' && p[-1] != '.')
3256+ while (tp > tmp + 2 && *tp == '0'
3257+ && tp[-1] != '.')
3258 {
3259- STRMOVE(p, p + 1);
3260- --p;
3261+ STRMOVE(tp, tp + 1);
3262+ --tp;
3263 --str_arg_l;
3264 }
3265 }
3266 else
3267 {
3268- char *p;
3269+ char *tp;
3270
3271 /* Be consistent: some printf("%e") use 1.0e+12
3272 * and some 1.0e+012. Remove one zero in the last
3273 * case. */
3274- p = (char *)vim_strchr((char_u *)tmp,
3275+ tp = (char *)vim_strchr((char_u *)tmp,
3276 fmt_spec == 'e' ? 'e' : 'E');
3277- if (p != NULL && (p[1] == '+' || p[1] == '-')
3278- && p[2] == '0'
3279- && vim_isdigit(p[3])
3280- && vim_isdigit(p[4]))
3281+ if (tp != NULL && (tp[1] == '+' || tp[1] == '-')
3282+ && tp[2] == '0'
3283+ && vim_isdigit(tp[3])
3284+ && vim_isdigit(tp[4]))
3285 {
3286- STRMOVE(p + 2, p + 3);
3287+ STRMOVE(tp + 2, tp + 3);
3288 --str_arg_l;
3289 }
3290 }
3291diff -Naur vim72.orig/src/misc1.c vim72/src/misc1.c
3292--- vim72.orig/src/misc1.c 2008-07-12 12:20:53.000000000 -0700
[43c52a1]3293+++ vim72/src/misc1.c 2009-01-08 20:57:32.000000000 -0800
[76dd250]3294@@ -3245,9 +3245,9 @@
3295
3296 /* When using ":silent" assume that <CR> was entered. */
3297 if (mouse_used != NULL)
3298- MSG_PUTS(_("Type number or click with mouse (<Enter> cancels): "));
3299+ MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): "));
3300 else
3301- MSG_PUTS(_("Choice number (<Enter> cancels): "));
3302+ MSG_PUTS(_("Type number and <Enter> (empty cancels): "));
3303
3304 /* Set the state such that text can be selected/copied/pasted and we still
3305 * get mouse events. */
3306diff -Naur vim72.orig/src/misc2.c vim72/src/misc2.c
3307--- vim72.orig/src/misc2.c 2008-07-23 12:12:56.000000000 -0700
[43c52a1]3308+++ vim72/src/misc2.c 2009-01-08 20:57:52.000000000 -0800
[76dd250]3309@@ -873,7 +873,7 @@
3310 /* 3. check for available memory: call mch_avail_mem() */
3311 if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
3312 {
3313- vim_free((char *)p); /* System is low... no go! */
3314+ free((char *)p); /* System is low... no go! */
3315 p = NULL;
3316 }
3317 else
3318@@ -1257,7 +1257,6 @@
3319 return escaped_string;
3320 }
3321
3322-#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
3323 /*
3324 * Return TRUE when 'shell' has "csh" in the tail.
3325 */
3326@@ -1266,9 +1265,7 @@
3327 {
3328 return (strstr((char *)gettail(p_sh), "csh") != NULL);
3329 }
3330-#endif
3331
3332-#if defined(FEAT_EVAL) || defined(PROTO)
3333 /*
3334 * Escape "string" for use as a shell argument with system().
3335 * This uses single quotes, except when we know we need to use double qoutes
3336@@ -1391,7 +1388,6 @@
3337
3338 return escaped_string;
3339 }
3340-#endif
3341
3342 /*
3343 * Like vim_strsave(), but make all characters uppercase.
[1f22c7c]3344@@ -2565,7 +2561,7 @@
3345 int key;
3346 int dlen = 0;
3347
3348- key = find_special_key(srcp, &modifiers, keycode);
3349+ key = find_special_key(srcp, &modifiers, keycode, FALSE);
3350 if (key == 0)
3351 return 0;
3352
3353@@ -2601,10 +2597,11 @@
3354 * returns 0 if there is no match.
3355 */
3356 int
3357-find_special_key(srcp, modp, keycode)
3358+find_special_key(srcp, modp, keycode, keep_x_key)
3359 char_u **srcp;
3360 int *modp;
3361- int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
3362+ int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
3363+ int keep_x_key; /* don't translate xHome to Home key */
3364 {
3365 char_u *last_dash;
3366 char_u *end_of_name;
3367@@ -2672,7 +2669,8 @@
3368 else
3369 {
3370 key = get_special_key_code(last_dash + 1);
3371- key = handle_x_keys(key);
3372+ if (!keep_x_key)
3373+ key = handle_x_keys(key);
3374 }
3375
3376 /*
[76dd250]3377diff -Naur vim72.orig/src/move.c vim72/src/move.c
3378--- vim72.orig/src/move.c 2008-07-12 09:26:47.000000000 -0700
[43c52a1]3379+++ vim72/src/move.c 2009-01-08 20:57:39.000000000 -0800
[76dd250]3380@@ -280,18 +280,20 @@
3381
3382 if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
3383 {
3384- if (curwin->w_cursor.lnum < curwin->w_botline
3385- && ((long)curwin->w_cursor.lnum
3386+ if (curwin->w_cursor.lnum < curwin->w_botline)
3387+ {
3388+ if (((long)curwin->w_cursor.lnum
3389 >= (long)curwin->w_botline - p_so
3390 #ifdef FEAT_FOLDING
3391 || hasAnyFolding(curwin)
3392 #endif
3393 ))
3394- {
3395+ {
3396 lineoff_T loff;
3397
3398- /* Cursor is above botline, check if there are 'scrolloff'
3399- * window lines below the cursor. If not, need to scroll. */
3400+ /* Cursor is (a few lines) above botline, check if there are
3401+ * 'scrolloff' window lines below the cursor. If not, need to
3402+ * scroll. */
3403 n = curwin->w_empty_rows;
3404 loff.lnum = curwin->w_cursor.lnum;
3405 #ifdef FEAT_FOLDING
3406@@ -317,6 +319,10 @@
3407 if (n >= p_so)
3408 /* sufficient context, no need to scroll */
3409 check_botline = FALSE;
3410+ }
3411+ else
3412+ /* sufficient context, no need to scroll */
3413+ check_botline = FALSE;
3414 }
3415 if (check_botline)
3416 {
3417@@ -509,6 +515,9 @@
3418 /* Approximate the value of w_botline */
3419 wp->w_botline += lnum - wp->w_topline;
3420 wp->w_topline = lnum;
3421+#ifdef FEAT_AUTOCMD
3422+ wp->w_topline_was_set = TRUE;
3423+#endif
3424 #ifdef FEAT_DIFF
3425 wp->w_topfill = 0;
3426 #endif
3427diff -Naur vim72.orig/src/netbeans.c vim72/src/netbeans.c
3428--- vim72.orig/src/netbeans.c 2008-07-13 09:19:54.000000000 -0700
[43c52a1]3429+++ vim72/src/netbeans.c 2009-01-08 20:57:54.000000000 -0800
[76dd250]3430@@ -1043,7 +1043,7 @@
3431 nbdebug(("EVT: %s", buf));
3432 /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */
3433 if (sd >= 0)
3434- sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */
3435+ ignored = sock_write(sd, buf, (int)STRLEN(buf));
3436 }
3437 }
3438
3439@@ -2277,9 +2277,6 @@
3440 int serNum;
3441 int localTypeNum;
3442 int typeNum;
3443-# ifdef NBDEBUG
3444- int len;
3445-# endif
3446 pos_T *pos;
3447
3448 if (buf == NULL || buf->bufp == NULL)
3449@@ -2303,13 +2300,10 @@
3450 pos = get_off_or_lnum(buf->bufp, &args);
3451
3452 cp = (char *)args;
3453-# ifdef NBDEBUG
3454- len =
3455-# endif
3456- strtol(cp, &cp, 10);
3457+ ignored = (int)strtol(cp, &cp, 10);
3458 args = (char_u *)cp;
3459 # ifdef NBDEBUG
3460- if (len != -1)
3461+ if (ignored != -1)
3462 {
3463 nbdebug((" partial line annotation -- Not Yet Implemented!\n"));
3464 }
[43c52a1]3465@@ -2924,44 +2918,26 @@
3466 }
3467
3468 /*
3469- * Tell netbeans a file was closed.
3470+ * Tell netbeans that a file was deleted or wiped out.
3471 */
3472 void
3473-netbeans_file_closed(buf_T *bufp)
3474+netbeans_file_killed(buf_T *bufp)
3475 {
3476 int bufno = nb_getbufno(bufp);
3477 nbbuf_T *nbbuf = nb_get_buf(bufno);
3478 char buffer[2*MAXPATHL];
3479
3480- if (!haveConnection || bufno < 0)
3481- return;
3482-
3483- if (!netbeansCloseFile)
3484- {
3485- nbdebug(("Ignoring file_closed for %s. File was closed from IDE\n",
3486- bufp->b_ffname));
3487+ if (!haveConnection || bufno == -1)
3488 return;
3489- }
3490-
3491- nbdebug(("netbeans_file_closed:\n"));
3492- nbdebug((" Closing bufno: %d", bufno));
3493- if (curbuf != NULL && curbuf != bufp)
3494- {
3495- nbdebug((" Curbuf bufno: %d\n", nb_getbufno(curbuf)));
3496- }
3497- else if (curbuf == bufp)
3498- {
3499- nbdebug((" curbuf == bufp\n"));
3500- }
3501
3502- if (bufno <= 0)
3503- return;
3504+ nbdebug(("netbeans_file_killed:\n"));
3505+ nbdebug((" Killing bufno: %d", bufno));
3506
3507 sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno);
3508
3509 nbdebug(("EVT: %s", buffer));
3510
3511- nb_send(buffer, "netbeans_file_closed");
3512+ nb_send(buffer, "netbeans_file_killed");
3513
3514 if (nbbuf != NULL)
3515 nbbuf->bufp = NULL;
[76dd250]3516diff -Naur vim72.orig/src/normal.c vim72/src/normal.c
3517--- vim72.orig/src/normal.c 2008-07-31 13:03:08.000000000 -0700
[43c52a1]3518+++ vim72/src/normal.c 2009-01-08 20:57:40.000000000 -0800
[76dd250]3519@@ -183,6 +183,8 @@
3520 static void nv_cursorhold __ARGS((cmdarg_T *cap));
3521 #endif
3522
3523+static char *e_noident = N_("E349: No identifier under cursor");
3524+
3525 /*
3526 * Function to be called for a Normal or Visual mode command.
3527 * The argument is a cmdarg_T.
3528@@ -578,6 +580,9 @@
3529 static int old_mapped_len = 0;
3530 #endif
3531 int idx;
3532+#ifdef FEAT_EVAL
3533+ int set_prevcount = FALSE;
3534+#endif
3535
3536 vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
3537 ca.oap = oap;
3538@@ -613,7 +618,12 @@
3539 /* When not finishing an operator and no register name typed, reset the
3540 * count. */
3541 if (!finish_op && !oap->regname)
3542+ {
3543 ca.opcount = 0;
3544+#ifdef FEAT_EVAL
3545+ set_prevcount = TRUE;
3546+#endif
3547+ }
3548
3549 #ifdef FEAT_AUTOCMD
3550 /* Restore counts from before receiving K_CURSORHOLD. This means after
3551@@ -717,7 +727,15 @@
3552 * command, so that v:count can be used in an expression mapping
3553 * right after the count. */
3554 if (toplevel && stuff_empty())
3555- set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0);
3556+ {
3557+ long count = ca.count0;
3558+
3559+ /* multiply with ca.opcount the same way as below */
3560+ if (ca.opcount != 0)
3561+ count = ca.opcount * (count == 0 ? 1 : count);
3562+ set_vcount(count, count == 0 ? 1 : count, set_prevcount);
3563+ set_prevcount = FALSE; /* only set v:prevcount once */
3564+ }
3565 #endif
3566 if (ctrl_w)
3567 {
3568@@ -804,7 +822,7 @@
3569 * Only set v:count when called from main() and not a stuffed command.
3570 */
3571 if (toplevel && stuff_empty())
3572- set_vcount(ca.count0, ca.count1);
3573+ set_vcount(ca.count0, ca.count1, set_prevcount);
3574 #endif
3575
3576 /*
3577@@ -1132,7 +1150,8 @@
3578 out_flush();
3579 #endif
3580 #ifdef FEAT_AUTOCMD
3581- did_cursorhold = FALSE;
3582+ if (ca.cmdchar != K_IGNORE)
3583+ did_cursorhold = FALSE;
3584 #endif
3585
3586 State = NORMAL;
3587@@ -3509,7 +3528,7 @@
3588 if (find_type & FIND_STRING)
3589 EMSG(_("E348: No string under cursor"));
3590 else
3591- EMSG(_("E349: No identifier under cursor"));
3592+ EMSG(_(e_noident));
3593 return 0;
3594 }
3595 ptr += col;
3596@@ -5469,6 +5488,20 @@
3597 STRCPY(buf, "he! ");
3598 else
3599 {
3600+ /* An external command will probably use an argument starting
3601+ * with "-" as an option. To avoid trouble we skip the "-". */
3602+ while (*ptr == '-' && n > 0)
3603+ {
3604+ ++ptr;
3605+ --n;
3606+ }
3607+ if (n == 0)
3608+ {
3609+ EMSG(_(e_noident)); /* found dashes only */
3610+ vim_free(buf);
3611+ return;
3612+ }
3613+
3614 /* When a count is given, turn it into a range. Is this
3615 * really what we want? */
3616 isman = (STRCMP(kp, "man") == 0);
3617@@ -5511,37 +5544,59 @@
3618 /*
3619 * Now grab the chars in the identifier
3620 */
3621- if (cmdchar == '*')
3622- aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
3623- else if (cmdchar == '#')
3624- aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
3625- else if (cmdchar == 'K' && !kp_help)
3626- aux_ptr = (char_u *)" \t\\\"|!";
3627- else
3628- /* Don't escape spaces and Tabs in a tag with a backslash */
3629- aux_ptr = (char_u *)"\\|\"";
3630-
3631- p = buf + STRLEN(buf);
3632- while (n-- > 0)
3633- {
3634- /* put a backslash before \ and some others */
3635- if (vim_strchr(aux_ptr, *ptr) != NULL)
3636- *p++ = '\\';
3637-#ifdef FEAT_MBYTE
3638- /* When current byte is a part of multibyte character, copy all bytes
3639- * of that character. */
3640- if (has_mbyte)
3641+ if (cmdchar == 'K' && !kp_help)
3642+ {
3643+ /* Escape the argument properly for a shell command */
3644+ ptr = vim_strnsave(ptr, n);
3645+ p = vim_strsave_shellescape(ptr, TRUE);
3646+ vim_free(ptr);
3647+ if (p == NULL)
3648 {
3649- int i;
3650- int len = (*mb_ptr2len)(ptr) - 1;
3651-
3652- for (i = 0; i < len && n >= 1; ++i, --n)
3653- *p++ = *ptr++;
3654+ vim_free(buf);
3655+ return;
3656 }
3657+ buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
3658+ if (buf == NULL)
3659+ {
3660+ vim_free(buf);
3661+ vim_free(p);
3662+ return;
3663+ }
3664+ STRCAT(buf, p);
3665+ vim_free(p);
3666+ }
3667+ else
3668+ {
3669+ if (cmdchar == '*')
3670+ aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
3671+ else if (cmdchar == '#')
3672+ aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
3673+ else
3674+ /* Don't escape spaces and Tabs in a tag with a backslash */
3675+ aux_ptr = (char_u *)"\\|\"\n*?[";
3676+
3677+ p = buf + STRLEN(buf);
3678+ while (n-- > 0)
3679+ {
3680+ /* put a backslash before \ and some others */
3681+ if (vim_strchr(aux_ptr, *ptr) != NULL)
3682+ *p++ = '\\';
3683+#ifdef FEAT_MBYTE
3684+ /* When current byte is a part of multibyte character, copy all
3685+ * bytes of that character. */
3686+ if (has_mbyte)
3687+ {
3688+ int i;
3689+ int len = (*mb_ptr2len)(ptr) - 1;
3690+
3691+ for (i = 0; i < len && n >= 1; ++i, --n)
3692+ *p++ = *ptr++;
3693+ }
3694 #endif
3695- *p++ = *ptr++;
3696+ *p++ = *ptr++;
3697+ }
3698+ *p = NUL;
3699 }
3700- *p = NUL;
3701
3702 /*
3703 * Execute the command.
3704diff -Naur vim72.orig/src/ops.c vim72/src/ops.c
3705--- vim72.orig/src/ops.c 2008-06-21 13:08:59.000000000 -0700
[43c52a1]3706+++ vim72/src/ops.c 2009-01-08 20:57:45.000000000 -0800
[76dd250]3707@@ -2209,12 +2209,15 @@
3708 {
3709 for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
3710 {
3711+ int one_change;
3712+
3713 block_prep(oap, &bd, pos.lnum, FALSE);
3714 pos.col = bd.textcol;
3715- did_change = swapchars(oap->op_type, &pos, bd.textlen);
3716+ one_change = swapchars(oap->op_type, &pos, bd.textlen);
3717+ did_change |= one_change;
3718
3719 # ifdef FEAT_NETBEANS_INTG
3720- if (usingNetbeans && did_change)
3721+ if (usingNetbeans && one_change)
3722 {
3723 char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
3724
3725diff -Naur vim72.orig/src/option.c vim72/src/option.c
3726--- vim72.orig/src/option.c 2008-07-18 06:05:33.000000000 -0700
[43c52a1]3727+++ vim72/src/option.c 2009-01-08 20:57:52.000000000 -0800
[76dd250]3728@@ -2593,13 +2593,13 @@
3729 #ifdef FEAT_VIMINFO
3730 (char_u *)&p_viminfo, PV_NONE,
3731 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
3732- {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
3733+ {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
3734 #else
3735 # ifdef AMIGA
3736 {(char_u *)"",
3737- (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
3738+ (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
3739 # else
3740- {(char_u *)"", (char_u *)"'20,<50,s10,h"}
3741+ {(char_u *)"", (char_u *)"'100,<50,s10,h"}
3742 # endif
3743 #endif
3744 #else
3745@@ -7974,6 +7974,11 @@
3746 else /* curwin->w_p_scr > curwin->w_height */
3747 curwin->w_p_scr = curwin->w_height;
3748 }
3749+ if (p_hi < 0)
3750+ {
3751+ errmsg = e_positive;
3752+ p_hi = 0;
3753+ }
3754 if (p_report < 0)
3755 {
3756 errmsg = e_positive;
3757@@ -8227,13 +8232,13 @@
3758 {
3759 if (number == 0 && string != NULL)
3760 {
3761- int index;
3762+ int idx;
3763
3764 /* Either we are given a string or we are setting option
3765 * to zero. */
3766- for (index = 0; string[index] == '0'; ++index)
3767+ for (idx = 0; string[idx] == '0'; ++idx)
3768 ;
3769- if (string[index] != NUL || index == 0)
3770+ if (string[idx] != NUL || idx == 0)
3771 {
3772 /* There's another character after zeros or the string
3773 * is empty. In both cases, we are trying to set a
[1f22c7c]3774@@ -8323,7 +8328,7 @@
3775 {
3776 --arg; /* put arg at the '<' */
3777 modifiers = 0;
3778- key = find_special_key(&arg, &modifiers, TRUE);
3779+ key = find_special_key(&arg, &modifiers, TRUE, TRUE);
3780 if (modifiers) /* can't handle modifiers here */
3781 key = 0;
3782 }
[76dd250]3783diff -Naur vim72.orig/src/os_unix.c vim72/src/os_unix.c
3784--- vim72.orig/src/os_unix.c 2008-08-06 04:01:40.000000000 -0700
[43c52a1]3785+++ vim72/src/os_unix.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]3786@@ -315,12 +315,15 @@
3787 {-1, "Unknown!", FALSE}
3788 };
3789
3790+/*
3791+ * Write s[len] to the screen.
3792+ */
3793 void
3794 mch_write(s, len)
3795 char_u *s;
3796 int len;
3797 {
3798- write(1, (char *)s, len);
3799+ ignored = (int)write(1, (char *)s, len);
3800 if (p_wd) /* Unix is too fast, slow down a bit more */
3801 RealWaitForChar(read_cmd_fd, p_wd, NULL);
3802 }
3803@@ -2905,7 +2908,7 @@
3804 * Ignore any errors.
3805 */
3806 #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
3807- signal_stack = malloc(SIGSTKSZ);
3808+ signal_stack = (char *)alloc(SIGSTKSZ);
3809 init_signal_stack();
3810 #endif
3811 }
3812@@ -2936,7 +2939,8 @@
3813 }
3814 # endif
3815 # endif
3816-# ifdef FEAT_X11
3817+ /* Don't close the display for GTK 1, it is done in exit(). */
3818+# if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2))
3819 if (x11_display != NULL
3820 # ifdef FEAT_XCLIPBOARD
3821 && x11_display != xterm_dpy
3822@@ -3926,9 +3930,9 @@
3823 */
3824 if (fd >= 0)
3825 {
3826- dup(fd); /* To replace stdin (file descriptor 0) */
3827- dup(fd); /* To replace stdout (file descriptor 1) */
3828- dup(fd); /* To replace stderr (file descriptor 2) */
3829+ ignored = dup(fd); /* To replace stdin (fd 0) */
3830+ ignored = dup(fd); /* To replace stdout (fd 1) */
3831+ ignored = dup(fd); /* To replace stderr (fd 2) */
3832
3833 /* Don't need this now that we've duplicated it */
3834 close(fd);
3835@@ -3996,13 +4000,13 @@
3836
3837 /* set up stdin/stdout/stderr for the child */
3838 close(0);
3839- dup(pty_slave_fd);
3840+ ignored = dup(pty_slave_fd);
3841 close(1);
3842- dup(pty_slave_fd);
3843+ ignored = dup(pty_slave_fd);
3844 if (gui.in_use)
3845 {
3846 close(2);
3847- dup(pty_slave_fd);
3848+ ignored = dup(pty_slave_fd);
3849 }
3850
3851 close(pty_slave_fd); /* has been dupped, close it now */
3852@@ -4013,13 +4017,13 @@
3853 /* set up stdin for the child */
3854 close(fd_toshell[1]);
3855 close(0);
3856- dup(fd_toshell[0]);
3857+ ignored = dup(fd_toshell[0]);
3858 close(fd_toshell[0]);
3859
3860 /* set up stdout for the child */
3861 close(fd_fromshell[0]);
3862 close(1);
3863- dup(fd_fromshell[1]);
3864+ ignored = dup(fd_fromshell[1]);
3865 close(fd_fromshell[1]);
3866
3867 # ifdef FEAT_GUI
3868@@ -4027,7 +4031,7 @@
3869 {
3870 /* set up stderr for the child */
3871 close(2);
3872- dup(1);
3873+ ignored = dup(1);
3874 }
3875 # endif
3876 }
3877@@ -4158,7 +4162,8 @@
3878 && (lnum !=
3879 curbuf->b_ml.ml_line_count
3880 || curbuf->b_p_eol)))
3881- write(toshell_fd, "\n", (size_t)1);
3882+ ignored = write(toshell_fd, "\n",
3883+ (size_t)1);
3884 ++lnum;
3885 if (lnum > curbuf->b_op_end.lnum)
3886 {
3887@@ -6814,7 +6819,8 @@
3888 if (xsmp_icefd != -1)
3889 {
3890 SmcCloseConnection(xsmp.smcconn, 0, NULL);
3891- vim_free(xsmp.clientid);
3892+ if (xsmp.clientid != NULL)
3893+ free(xsmp.clientid);
3894 xsmp.clientid = NULL;
3895 xsmp_icefd = -1;
3896 }
3897diff -Naur vim72.orig/src/proto/eval.pro vim72/src/proto/eval.pro
3898--- vim72.orig/src/proto/eval.pro 2008-08-09 07:31:25.000000000 -0700
[43c52a1]3899+++ vim72/src/proto/eval.pro 2009-01-08 20:57:40.000000000 -0800
[76dd250]3900@@ -17,7 +17,7 @@
3901 int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip));
3902 char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip));
3903 int skip_expr __ARGS((char_u **pp));
3904-char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));
3905+char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert));
3906 char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox));
3907 int eval_to_number __ARGS((char_u *expr));
3908 list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
3909@@ -46,7 +46,9 @@
3910 void list_unref __ARGS((list_T *l));
3911 void list_free __ARGS((list_T *l, int recurse));
3912 dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
3913+char_u *list_find_str __ARGS((list_T *l, long idx));
3914 int list_append_dict __ARGS((list_T *list, dict_T *dict));
3915+int list_append_string __ARGS((list_T *l, char_u *str, int len));
3916 int garbage_collect __ARGS((void));
3917 dict_T *dict_alloc __ARGS((void));
3918 int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
3919@@ -58,8 +60,10 @@
3920 void set_vim_var_nr __ARGS((int idx, long val));
3921 long get_vim_var_nr __ARGS((int idx));
3922 char_u *get_vim_var_str __ARGS((int idx));
3923-void set_vcount __ARGS((long count, long count1));
3924+list_T *get_vim_var_list __ARGS((int idx));
3925+void set_vcount __ARGS((long count, long count1, int set_prevcount));
3926 void set_vim_var_string __ARGS((int idx, char_u *val, int len));
3927+void set_vim_var_list __ARGS((int idx, list_T *val));
3928 void set_reg_var __ARGS((int c));
3929 char_u *v_exception __ARGS((char_u *oldval));
3930 char_u *v_throwpoint __ARGS((char_u *oldval));
3931@@ -94,6 +98,7 @@
3932 void write_viminfo_varlist __ARGS((FILE *fp));
3933 int store_session_globals __ARGS((FILE *fd));
3934 void last_set_msg __ARGS((scid_T scriptID));
3935+void ex_oldfiles __ARGS((exarg_T *eap));
3936 int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
3937 char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
3938 /* vim: set ft=c : */
3939diff -Naur vim72.orig/src/proto/ex_cmds.pro vim72/src/proto/ex_cmds.pro
3940--- vim72.orig/src/proto/ex_cmds.pro 2008-08-09 07:31:25.000000000 -0700
[43c52a1]3941+++ vim72/src/proto/ex_cmds.pro 2009-01-08 20:57:32.000000000 -0800
[76dd250]3942@@ -11,7 +11,7 @@
3943 char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
3944 void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
3945 int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
3946-int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
3947+int read_viminfo __ARGS((char_u *file, int flags));
3948 void write_viminfo __ARGS((char_u *file, int forceit));
3949 int viminfo_readline __ARGS((vir_T *virp));
3950 char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
3951diff -Naur vim72.orig/src/proto/ex_getln.pro vim72/src/proto/ex_getln.pro
3952--- vim72.orig/src/proto/ex_getln.pro 2008-08-09 07:31:28.000000000 -0700
[43c52a1]3953+++ vim72/src/proto/ex_getln.pro 2009-01-08 20:57:43.000000000 -0800
[76dd250]3954@@ -31,7 +31,7 @@
3955 void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
3956 int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
3957 int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
3958-char_u *globpath __ARGS((char_u *path, char_u *file));
3959+char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
3960 void init_history __ARGS((void));
3961 int get_histtype __ARGS((char_u *name));
3962 void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
3963diff -Naur vim72.orig/src/proto/mark.pro vim72/src/proto/mark.pro
3964--- vim72.orig/src/proto/mark.pro 2008-08-09 07:31:36.000000000 -0700
[43c52a1]3965+++ vim72/src/proto/mark.pro 2009-01-08 20:57:32.000000000 -0800
[76dd250]3966@@ -26,5 +26,5 @@
3967 void write_viminfo_filemarks __ARGS((FILE *fp));
3968 int removable __ARGS((char_u *name));
3969 int write_viminfo_marks __ARGS((FILE *fp_out));
3970-void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof));
3971+void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags));
3972 /* vim: set ft=c : */
[1f22c7c]3973diff -Naur vim72.orig/src/proto/misc2.pro vim72/src/proto/misc2.pro
3974--- vim72.orig/src/proto/misc2.pro 2008-08-09 07:31:40.000000000 -0700
[43c52a1]3975+++ vim72/src/proto/misc2.pro 2009-01-08 20:57:52.000000000 -0800
[1f22c7c]3976@@ -59,7 +59,7 @@
3977 int handle_x_keys __ARGS((int key));
3978 char_u *get_special_key_name __ARGS((int c, int modifiers));
3979 int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode));
3980-int find_special_key __ARGS((char_u **srcp, int *modp, int keycode));
3981+int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key));
3982 int extract_modifiers __ARGS((int key, int *modp));
3983 int find_special_key_in_table __ARGS((int c));
3984 int get_special_key_code __ARGS((char_u *name));
[43c52a1]3985diff -Naur vim72.orig/src/proto/netbeans.pro vim72/src/proto/netbeans.pro
3986--- vim72.orig/src/proto/netbeans.pro 2008-08-09 07:31:56.000000000 -0700
3987+++ vim72/src/proto/netbeans.pro 2009-01-08 20:57:54.000000000 -0800
3988@@ -11,7 +11,7 @@
3989 void netbeans_frame_moved __ARGS((int new_x, int new_y));
3990 void netbeans_file_activated __ARGS((buf_T *bufp));
3991 void netbeans_file_opened __ARGS((buf_T *bufp));
3992-void netbeans_file_closed __ARGS((buf_T *bufp));
3993+void netbeans_file_killed __ARGS((buf_T *bufp));
3994 void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen));
3995 void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
3996 void netbeans_unmodified __ARGS((buf_T *bufp));
[76dd250]3997diff -Naur vim72.orig/src/pty.c vim72/src/pty.c
3998--- vim72.orig/src/pty.c 2008-06-21 11:52:58.000000000 -0700
[43c52a1]3999+++ vim72/src/pty.c 2009-01-08 20:57:27.000000000 -0800
[76dd250]4000@@ -270,9 +270,10 @@
4001 }
4002 #endif
4003
4004-#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux)
4005+#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X)
4006
4007-/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */
4008+/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
4009+ * Same for Mac OS X Leopard. */
4010 #define PTY_DONE
4011 int
4012 OpenPTY(ttyn)
4013diff -Naur vim72.orig/src/screen.c vim72/src/screen.c
4014--- vim72.orig/src/screen.c 2008-07-24 07:45:07.000000000 -0700
[43c52a1]4015+++ vim72/src/screen.c 2009-01-08 20:57:31.000000000 -0800
[76dd250]4016@@ -2439,9 +2439,17 @@
4017
4018 #ifdef FEAT_SYN_HL
4019 /* Show 'cursorcolumn' in the fold line. */
4020- if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp))
4021- ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr(
4022- ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC));
4023+ if (wp->w_p_cuc)
4024+ {
4025+ txtcol += wp->w_virtcol;
4026+ if (wp->w_p_wrap)
4027+ txtcol -= wp->w_skipcol;
4028+ else
4029+ txtcol -= wp->w_leftcol;
4030+ if (txtcol >= 0 && txtcol < W_WIDTH(wp))
4031+ ScreenAttrs[off + txtcol] = hl_combine_attr(
4032+ ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
4033+ }
4034 #endif
4035
4036 SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
4037diff -Naur vim72.orig/src/spell.c vim72/src/spell.c
4038--- vim72.orig/src/spell.c 2008-07-12 12:20:55.000000000 -0700
[43c52a1]4039+++ vim72/src/spell.c 2009-01-08 20:57:46.000000000 -0800
[76dd250]4040@@ -77,7 +77,7 @@
4041
4042 /*
4043 * Do the opposite: based on a maximum end score and a known sound score,
4044- * compute the the maximum word score that can be used.
4045+ * compute the maximum word score that can be used.
4046 */
4047 #define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3)
4048
4049@@ -469,6 +469,7 @@
4050 garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */
4051 regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm
4052 * (NULL when no compounding) */
4053+ char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */
4054 char_u *sl_compstartflags; /* flags for first compound word */
4055 char_u *sl_compallflags; /* all flags for compound words */
4056 char_u sl_nobreak; /* When TRUE: no spaces between words */
4057@@ -625,7 +626,7 @@
4058 /* TRUE if a word appears in the list of banned words. */
4059 #define WAS_BANNED(su, word) (!HASHITEM_EMPTY(hash_find(&su->su_banned, word)))
4060
4061-/* Number of suggestions kept when cleaning up. we need to keep more than
4062+/* Number of suggestions kept when cleaning up. We need to keep more than
4063 * what is displayed, because when rescore_suggestions() is called the score
4064 * may change and wrong suggestions may be removed later. */
4065 #define SUG_CLEAN_COUNT(su) ((su)->su_maxcount < 130 ? 150 : (su)->su_maxcount + 20)
4066@@ -839,7 +840,10 @@
4067 static void slang_clear __ARGS((slang_T *lp));
4068 static void slang_clear_sug __ARGS((slang_T *lp));
4069 static void find_word __ARGS((matchinf_T *mip, int mode));
4070+static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap));
4071 static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags));
4072+static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag));
4073+static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags));
4074 static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req));
4075 static void find_prefix __ARGS((matchinf_T *mip, int mode));
4076 static int fold_more __ARGS((matchinf_T *mip));
4077@@ -1519,6 +1523,11 @@
4078 ((unsigned)flags >> 24)))
4079 continue;
4080
4081+ /* If there is a match with a CHECKCOMPOUNDPATTERN rule
4082+ * discard the compound word. */
4083+ if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
4084+ continue;
4085+
4086 if (mode == FIND_COMPOUND)
4087 {
4088 int capflags;
4089@@ -1577,6 +1586,11 @@
4090 if (!can_compound(slang, fword, mip->mi_compflags))
4091 continue;
4092 }
4093+ else if (slang->sl_comprules != NULL
4094+ && !match_compoundrule(slang, mip->mi_compflags))
4095+ /* The compound flags collected so far do not match any
4096+ * COMPOUNDRULE, discard the compounded word. */
4097+ continue;
4098 }
4099
4100 /* Check NEEDCOMPOUND: can't use word without compounding. */
4101@@ -1727,6 +1741,39 @@
4102 }
4103
4104 /*
4105+ * Return TRUE if there is a match between the word ptr[wlen] and
4106+ * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
4107+ * word.
4108+ * A match means that the first part of CHECKCOMPOUNDPATTERN matches at the
4109+ * end of ptr[wlen] and the second part matches after it.
4110+ */
4111+ static int
4112+match_checkcompoundpattern(ptr, wlen, gap)
4113+ char_u *ptr;
4114+ int wlen;
4115+ garray_T *gap; /* &sl_comppat */
4116+{
4117+ int i;
4118+ char_u *p;
4119+ int len;
4120+
4121+ for (i = 0; i + 1 < gap->ga_len; i += 2)
4122+ {
4123+ p = ((char_u **)gap->ga_data)[i + 1];
4124+ if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
4125+ {
4126+ /* Second part matches at start of following compound word, now
4127+ * check if first part matches at end of previous word. */
4128+ p = ((char_u **)gap->ga_data)[i];
4129+ len = (int)STRLEN(p);
4130+ if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
4131+ return TRUE;
4132+ }
4133+ }
4134+ return FALSE;
4135+}
4136+
4137+/*
4138 * Return TRUE if "flags" is a valid sequence of compound flags and "word"
4139 * does not have too many syllables.
4140 */
4141@@ -1773,6 +1820,98 @@
4142 }
4143
4144 /*
4145+ * Return TRUE when the sequence of flags in "compflags" plus "flag" can
4146+ * possibly form a valid compounded word. This also checks the COMPOUNDRULE
4147+ * lines if they don't contain wildcards.
4148+ */
4149+ static int
4150+can_be_compound(sp, slang, compflags, flag)
4151+ trystate_T *sp;
4152+ slang_T *slang;
4153+ char_u *compflags;
4154+ int flag;
4155+{
4156+ /* If the flag doesn't appear in sl_compstartflags or sl_compallflags
4157+ * then it can't possibly compound. */
4158+ if (!byte_in_str(sp->ts_complen == sp->ts_compsplit
4159+ ? slang->sl_compstartflags : slang->sl_compallflags, flag))
4160+ return FALSE;
4161+
4162+ /* If there are no wildcards, we can check if the flags collected so far
4163+ * possibly can form a match with COMPOUNDRULE patterns. This only
4164+ * makes sense when we have two or more words. */
4165+ if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit)
4166+ {
4167+ int v;
4168+
4169+ compflags[sp->ts_complen] = flag;
4170+ compflags[sp->ts_complen + 1] = NUL;
4171+ v = match_compoundrule(slang, compflags + sp->ts_compsplit);
4172+ compflags[sp->ts_complen] = NUL;
4173+ return v;
4174+ }
4175+
4176+ return TRUE;
4177+}
4178+
4179+
4180+/*
4181+ * Return TRUE if the compound flags in compflags[] match the start of any
4182+ * compound rule. This is used to stop trying a compound if the flags
4183+ * collected so far can't possibly match any compound rule.
4184+ * Caller must check that slang->sl_comprules is not NULL.
4185+ */
4186+ static int
4187+match_compoundrule(slang, compflags)
4188+ slang_T *slang;
4189+ char_u *compflags;
4190+{
4191+ char_u *p;
4192+ int i;
4193+ int c;
4194+
4195+ /* loop over all the COMPOUNDRULE entries */
4196+ for (p = slang->sl_comprules; *p != NUL; ++p)
4197+ {
4198+ /* loop over the flags in the compound word we have made, match
4199+ * them against the current rule entry */
4200+ for (i = 0; ; ++i)
4201+ {
4202+ c = compflags[i];
4203+ if (c == NUL)
4204+ /* found a rule that matches for the flags we have so far */
4205+ return TRUE;
4206+ if (*p == '/' || *p == NUL)
4207+ break; /* end of rule, it's too short */
4208+ if (*p == '[')
4209+ {
4210+ int match = FALSE;
4211+
4212+ /* compare against all the flags in [] */
4213+ ++p;
4214+ while (*p != ']' && *p != NUL)
4215+ if (*p++ == c)
4216+ match = TRUE;
4217+ if (!match)
4218+ break; /* none matches */
4219+ }
4220+ else if (*p != c)
4221+ break; /* flag of word doesn't match flag in pattern */
4222+ ++p;
4223+ }
4224+
4225+ /* Skip to the next "/", where the next pattern starts. */
4226+ p = vim_strchr(p, '/');
4227+ if (p == NULL)
4228+ break;
4229+ }
4230+
4231+ /* Checked all the rules and none of them match the flags, so there
4232+ * can't possibly be a compound starting with these flags. */
4233+ return FALSE;
4234+}
4235+
4236+/*
4237 * Return non-zero if the prefix indicated by "arridx" matches with the prefix
4238 * ID in "flags" for the word "word".
4239 * The WF_RAREPFX flag is included in the return value for a rare prefix.
4240@@ -2513,9 +2652,11 @@
4241 lp->sl_midword = NULL;
4242
4243 vim_free(lp->sl_compprog);
4244+ vim_free(lp->sl_comprules);
4245 vim_free(lp->sl_compstartflags);
4246 vim_free(lp->sl_compallflags);
4247 lp->sl_compprog = NULL;
4248+ lp->sl_comprules = NULL;
4249 lp->sl_compstartflags = NULL;
4250 lp->sl_compallflags = NULL;
4251
4252@@ -3460,6 +3601,7 @@
4253 char_u *pp;
4254 char_u *cp;
4255 char_u *ap;
4256+ char_u *crp;
4257 int cnt;
4258 garray_T *gap;
4259
4260@@ -3545,6 +3687,12 @@
4261 slang->sl_compallflags = ap;
4262 *ap = NUL;
4263
4264+ /* And a list of all patterns in their original form, for checking whether
4265+ * compounding may work in match_compoundrule(). This is freed when we
4266+ * encounter a wildcard, the check doesn't work then. */
4267+ crp = alloc(todo + 1);
4268+ slang->sl_comprules = crp;
4269+
4270 pp = pat;
4271 *pp++ = '^';
4272 *pp++ = '\\';
4273@@ -3587,6 +3735,20 @@
4274 atstart = 0;
4275 }
4276 }
4277+
4278+ /* Copy flag to "sl_comprules", unless we run into a wildcard. */
4279+ if (crp != NULL)
4280+ {
4281+ if (c == '+' || c == '*')
4282+ {
4283+ vim_free(slang->sl_comprules);
4284+ slang->sl_comprules = NULL;
4285+ crp = NULL;
4286+ }
4287+ else
4288+ *crp++ = c;
4289+ }
4290+
4291 if (c == '/') /* slash separates two items */
4292 {
4293 *pp++ = '\\';
4294@@ -3611,6 +3773,9 @@
4295 *pp++ = '$';
4296 *pp = NUL;
4297
4298+ if (crp != NULL)
4299+ *crp = NUL;
4300+
4301 slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
4302 vim_free(pat);
4303 if (slang->sl_compprog == NULL)
4304@@ -4915,6 +5080,7 @@
4305 } spellinfo_T;
4306
4307 static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
4308+static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount));
4309 static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry));
4310 static int spell_info_item __ARGS((char_u *s));
4311 static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
4312@@ -4950,7 +5116,7 @@
4313 static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd));
4314 static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname));
4315 static void clear_node __ARGS((wordnode_T *node));
4316-static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree));
4317+static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree));
4318 static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname));
4319 static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang));
4320 static int sug_maketable __ARGS((spellinfo_T *spin));
4321@@ -5223,8 +5389,7 @@
4322 /* Handle non-empty lines. */
4323 if (itemcnt > 0)
4324 {
4325- if (STRCMP(items[0], "SET") == 0 && itemcnt == 2
4326- && aff->af_enc == NULL)
4327+ if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
4328 {
4329 #ifdef FEAT_MBYTE
4330 /* Setup for conversion from "ENC" to 'encoding'. */
4331@@ -5239,7 +5404,7 @@
4332 smsg((char_u *)_("Conversion in %s not supported"), fname);
4333 #endif
4334 }
4335- else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2
4336+ else if (is_aff_rule(items, itemcnt, "FLAG", 2)
4337 && aff->af_flagtype == AFT_CHAR)
4338 {
4339 if (STRCMP(items[1], "long") == 0)
4340@@ -5284,69 +5449,71 @@
4341 spin->si_info = p;
4342 }
4343 }
4344- else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
4345+ else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
4346 && midword == NULL)
4347 {
4348 midword = getroom_save(spin, items[1]);
4349 }
4350- else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
4351+ else if (is_aff_rule(items, itemcnt, "TRY", 2))
4352 {
4353 /* ignored, we look in the tree for what chars may appear */
4354 }
4355 /* TODO: remove "RAR" later */
4356- else if ((STRCMP(items[0], "RAR") == 0
4357- || STRCMP(items[0], "RARE") == 0) && itemcnt == 2
4358- && aff->af_rare == 0)
4359+ else if ((is_aff_rule(items, itemcnt, "RAR", 2)
4360+ || is_aff_rule(items, itemcnt, "RARE", 2))
4361+ && aff->af_rare == 0)
4362 {
4363 aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
4364 fname, lnum);
4365 }
4366 /* TODO: remove "KEP" later */
4367- else if ((STRCMP(items[0], "KEP") == 0
4368- || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2
4369+ else if ((is_aff_rule(items, itemcnt, "KEP", 2)
4370+ || is_aff_rule(items, itemcnt, "KEEPCASE", 2))
4371 && aff->af_keepcase == 0)
4372 {
4373 aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
4374 fname, lnum);
4375 }
4376- else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2
4377- && aff->af_bad == 0)
4378+ else if ((is_aff_rule(items, itemcnt, "BAD", 2)
4379+ || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2))
4380+ && aff->af_bad == 0)
4381 {
4382 aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
4383 fname, lnum);
4384 }
4385- else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2
4386+ else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2)
4387 && aff->af_needaffix == 0)
4388 {
4389 aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
4390 fname, lnum);
4391 }
4392- else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2
4393+ else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2)
4394 && aff->af_circumfix == 0)
4395 {
4396 aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
4397 fname, lnum);
4398 }
4399- else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2
4400+ else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2)
4401 && aff->af_nosuggest == 0)
4402 {
4403 aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
4404 fname, lnum);
4405 }
4406- else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2
4407+ else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2)
4408+ || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2))
4409 && aff->af_needcomp == 0)
4410 {
4411 aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
4412 fname, lnum);
4413 }
4414- else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2
4415+ else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2)
4416 && aff->af_comproot == 0)
4417 {
4418 aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
4419 fname, lnum);
4420 }
4421- else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0
4422- && itemcnt == 2 && aff->af_compforbid == 0)
4423+ else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2)
4424+ && aff->af_compforbid == 0)
4425 {
4426 aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
4427 fname, lnum);
4428@@ -5354,8 +5521,8 @@
4429 smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
4430 fname, lnum);
4431 }
4432- else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0
4433- && itemcnt == 2 && aff->af_comppermit == 0)
4434+ else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
4435+ && aff->af_comppermit == 0)
4436 {
4437 aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
4438 fname, lnum);
4439@@ -5363,7 +5530,7 @@
4440 smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
4441 fname, lnum);
4442 }
4443- else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
4444+ else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
4445 && compflags == NULL)
4446 {
4447 /* Turn flag "c" into COMPOUNDRULE compatible string "c+",
4448@@ -5376,7 +5543,15 @@
4449 compflags = p;
4450 }
4451 }
4452- else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
4453+ else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
4454+ {
4455+ /* We don't use the count, but do check that it's a number and
4456+ * not COMPOUNDRULE mistyped. */
4457+ if (atoi((char *)items[1]) == 0)
4458+ smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"),
4459+ fname, lnum, items[1]);
4460+ }
4461+ else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
4462 {
4463 /* Concatenate this string to previously defined ones, using a
4464 * slash to separate them. */
4465@@ -5395,7 +5570,7 @@
4466 compflags = p;
4467 }
4468 }
4469- else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
4470+ else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
4471 && compmax == 0)
4472 {
4473 compmax = atoi((char *)items[1]);
4474@@ -5403,7 +5578,7 @@
4475 smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
4476 fname, lnum, items[1]);
4477 }
4478- else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
4479+ else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
4480 && compminlen == 0)
4481 {
4482 compminlen = atoi((char *)items[1]);
4483@@ -5411,7 +5586,7 @@
4484 smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
4485 fname, lnum, items[1]);
4486 }
4487- else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
4488+ else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
4489 && compsylmax == 0)
4490 {
4491 compsylmax = atoi((char *)items[1]);
4492@@ -5419,32 +5594,29 @@
4493 smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
4494 fname, lnum, items[1]);
4495 }
4496- else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
4497+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
4498 {
4499 compoptions |= COMP_CHECKDUP;
4500 }
4501- else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
4502+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
4503 {
4504 compoptions |= COMP_CHECKREP;
4505 }
4506- else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
4507+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
4508 {
4509 compoptions |= COMP_CHECKCASE;
4510 }
4511- else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
4512- && itemcnt == 1)
4513+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
4514 {
4515 compoptions |= COMP_CHECKTRIPLE;
4516 }
4517- else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
4518- && itemcnt == 2)
4519+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
4520 {
4521 if (atoi((char *)items[1]) == 0)
4522 smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
4523 fname, lnum, items[1]);
4524 }
4525- else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
4526- && itemcnt == 3)
4527+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
4528 {
4529 garray_T *gap = &spin->si_comppat;
4530 int i;
4531@@ -5463,24 +5635,24 @@
4532 = getroom_save(spin, items[2]);
4533 }
4534 }
4535- else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
4536+ else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
4537 && syllable == NULL)
4538 {
4539 syllable = getroom_save(spin, items[1]);
4540 }
4541- else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
4542+ else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
4543 {
4544 spin->si_nobreak = TRUE;
4545 }
4546- else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
4547+ else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
4548 {
4549 spin->si_nosplitsugs = TRUE;
4550 }
4551- else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
4552+ else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
4553 {
4554 spin->si_nosugfile = TRUE;
4555 }
4556- else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
4557+ else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
4558 {
4559 aff->af_pfxpostpone = TRUE;
4560 }
4561@@ -5771,24 +5943,20 @@
4562 }
4563 }
4564 }
4565- else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
4566- && fol == NULL)
4567+ else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
4568 {
4569 fol = vim_strsave(items[1]);
4570 }
4571- else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
4572- && low == NULL)
4573+ else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
4574 {
4575 low = vim_strsave(items[1]);
4576 }
4577- else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
4578- && upp == NULL)
4579+ else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
4580 {
4581 upp = vim_strsave(items[1]);
4582 }
4583- else if ((STRCMP(items[0], "REP") == 0
4584- || STRCMP(items[0], "REPSAL") == 0)
4585- && itemcnt == 2)
4586+ else if (is_aff_rule(items, itemcnt, "REP", 2)
4587+ || is_aff_rule(items, itemcnt, "REPSAL", 2))
4588 {
4589 /* Ignore REP/REPSAL count */;
4590 if (!isdigit(*items[1]))
4591@@ -5819,7 +5987,7 @@
4592 : &spin->si_rep, items[1], items[2]);
4593 }
4594 }
4595- else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
4596+ else if (is_aff_rule(items, itemcnt, "MAP", 2))
4597 {
4598 /* MAP item or count */
4599 if (!found_map)
4600@@ -5856,9 +6024,8 @@
4601 ga_append(&spin->si_map, '/');
4602 }
4603 }
4604- /* Accept "SAL from to" and "SAL from to # comment". */
4605- else if (STRCMP(items[0], "SAL") == 0
4606- && (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#')))
4607+ /* Accept "SAL from to" and "SAL from to #comment". */
4608+ else if (is_aff_rule(items, itemcnt, "SAL", 3))
4609 {
4610 if (do_sal)
4611 {
4612@@ -5877,12 +6044,12 @@
4613 : items[2]);
4614 }
4615 }
4616- else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
4617+ else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
4618 && sofofrom == NULL)
4619 {
4620 sofofrom = getroom_save(spin, items[1]);
4621 }
4622- else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
4623+ else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
4624 && sofoto == NULL)
4625 {
4626 sofoto = getroom_save(spin, items[1]);
4627@@ -5980,7 +6147,7 @@
4628 else if (spin->si_newprefID == 0 || spin->si_newprefID == 127)
4629 MSG(_("Too many compound flags"));
4630 else
4631- MSG(_("Too many posponed prefixes and/or compound flags"));
4632+ MSG(_("Too many postponed prefixes and/or compound flags"));
4633 }
4634
4635 if (syllable != NULL)
4636@@ -6017,6 +6184,22 @@
4637 }
4638
4639 /*
4640+ * Return TRUE when items[0] equals "rulename", there are "mincount" items or
4641+ * a comment is following after item "mincount".
4642+ */
4643+ static int
4644+is_aff_rule(items, itemcnt, rulename, mincount)
4645+ char_u **items;
4646+ int itemcnt;
4647+ char *rulename;
4648+ int mincount;
4649+{
4650+ return (STRCMP(items[0], rulename) == 0
4651+ && (itemcnt == mincount
4652+ || (itemcnt > mincount && items[mincount][0] == '#')));
4653+}
4654+
4655+/*
4656 * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
4657 * ae_flags to ae_comppermit and ae_compforbid.
4658 */
4659@@ -7926,6 +8109,8 @@
4660 char_u *p;
4661 int rr;
4662 int retval = OK;
4663+ size_t fwv = 1; /* collect return value of fwrite() to avoid
4664+ warnings from picky compiler */
4665
4666 fd = mch_fopen((char *)fname, "w");
4667 if (fd == NULL)
4668@@ -7936,11 +8121,11 @@
4669
4670 /* <HEADER>: <fileID> <versionnr> */
4671 /* <fileID> */
4672- if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)
4673- {
4674- EMSG(_(e_write));
4675- retval = FAIL;
4676- }
4677+ fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
4678+ if (fwv != (size_t)1)
4679+ /* Catch first write error, don't try writing more. */
4680+ goto theend;
4681+
4682 putc(VIMSPELLVERSION, fd); /* <versionnr> */
4683
4684 /*
4685@@ -7955,7 +8140,7 @@
4686
4687 i = (int)STRLEN(spin->si_info);
4688 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
4689- fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
4690+ fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
4691 }
4692
4693 /* SN_REGION: <regionname> ...
4694@@ -7966,7 +8151,7 @@
4695 putc(SNF_REQUIRED, fd); /* <sectionflags> */
4696 l = spin->si_region_count * 2;
4697 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
4698- fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
4699+ fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
4700 /* <regionname> ... */
4701 regionmask = (1 << spin->si_region_count) - 1;
4702 }
4703@@ -8016,7 +8201,7 @@
4704 }
4705
4706 put_bytes(fd, (long_u)l, 2); /* <folcharslen> */
4707- fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
4708+ fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
4709 }
4710
4711 /* SN_MIDWORD: <midword> */
4712@@ -8027,7 +8212,8 @@
4713
4714 i = (int)STRLEN(spin->si_midword);
4715 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
4716- fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */
4717+ fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd);
4718+ /* <midword> */
4719 }
4720
4721 /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
4722@@ -8113,7 +8299,8 @@
4723 p = rr == 1 ? ftp->ft_from : ftp->ft_to;
4724 l = (int)STRLEN(p);
4725 putc(l, fd);
4726- fwrite(p, l, (size_t)1, fd);
4727+ if (l > 0)
4728+ fwv &= fwrite(p, l, (size_t)1, fd);
4729 }
4730 }
4731
4732@@ -8131,11 +8318,11 @@
4733 /* <sectionlen> */
4734
4735 put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
4736- fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
4737+ fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
4738
4739 l = (int)STRLEN(spin->si_sofoto);
4740 put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
4741- fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
4742+ fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
4743 }
4744
4745 /* SN_WORDS: <word> ...
4746@@ -8160,7 +8347,7 @@
4747 l = (int)STRLEN(hi->hi_key) + 1;
4748 len += l;
4749 if (round == 2) /* <word> */
4750- fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
4751+ fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
4752 --todo;
4753 }
4754 if (round == 1)
4755@@ -8176,7 +8363,7 @@
4756 putc(0, fd); /* <sectionflags> */
4757 l = spin->si_map.ga_len;
4758 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
4759- fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
4760+ fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
4761 /* <mapstr> */
4762 }
4763
4764@@ -8232,10 +8419,11 @@
4765 {
4766 p = ((char_u **)(spin->si_comppat.ga_data))[i];
4767 putc((int)STRLEN(p), fd); /* <comppatlen> */
4768- fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */
4769+ fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);
4770+ /* <comppattext> */
4771 }
4772 /* <compflags> */
4773- fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
4774+ fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
4775 (size_t)1, fd);
4776 }
4777
4778@@ -8259,7 +8447,8 @@
4779
4780 l = (int)STRLEN(spin->si_syllable);
4781 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
4782- fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */
4783+ fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd);
4784+ /* <syllable> */
4785 }
4786
4787 /* end of <SECTIONS> */
4788@@ -8295,13 +8484,18 @@
4789 (void)put_node(fd, tree, 0, regionmask, round == 3);
4790 }
4791
4792- /* Write another byte to check for errors. */
4793+ /* Write another byte to check for errors (file system full). */
4794 if (putc(0, fd) == EOF)
4795 retval = FAIL;
4796-
4797+theend:
4798 if (fclose(fd) == EOF)
4799 retval = FAIL;
4800
4801+ if (fwv != (size_t)1)
4802+ retval = FAIL;
4803+ if (retval == FAIL)
4804+ EMSG(_(e_write));
4805+
4806 return retval;
4807 }
4808
4809@@ -9890,6 +10084,7 @@
4810 char_u *p;
4811 int len;
4812 int totlen;
4813+ size_t x = 1; /* collect return value of fwrite() */
4814
4815 if (fd != NULL)
4816 put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
4817@@ -9906,7 +10101,7 @@
4818 if (fd != NULL)
4819 {
4820 fputc(len, fd);
4821- fwrite(p, (size_t)len, (size_t)1, fd);
4822+ x &= fwrite(p, (size_t)len, (size_t)1, fd);
4823 }
4824 totlen += len;
4825 }
4826@@ -11480,15 +11675,24 @@
4827 vim_strncpy(preword + sp->ts_prewordlen,
4828 tword + sp->ts_splitoff,
4829 sp->ts_twordlen - sp->ts_splitoff);
4830- p = preword;
4831- while (*skiptowhite(p) != NUL)
4832- p = skipwhite(skiptowhite(p));
4833- if (fword_ends && !can_compound(slang, p,
4834- compflags + sp->ts_compsplit))
4835- /* Compound is not allowed. But it may still be
4836- * possible if we add another (short) word. */
4837+
4838+ /* Verify CHECKCOMPOUNDPATTERN rules. */
4839+ if (match_checkcompoundpattern(preword, sp->ts_prewordlen,
4840+ &slang->sl_comppat))
4841 compound_ok = FALSE;
4842
4843+ if (compound_ok)
4844+ {
4845+ p = preword;
4846+ while (*skiptowhite(p) != NUL)
4847+ p = skipwhite(skiptowhite(p));
4848+ if (fword_ends && !can_compound(slang, p,
4849+ compflags + sp->ts_compsplit))
4850+ /* Compound is not allowed. But it may still be
4851+ * possible if we add another (short) word. */
4852+ compound_ok = FALSE;
4853+ }
4854+
4855 /* Get pointer to last char of previous word. */
4856 p = preword + sp->ts_prewordlen;
4857 mb_ptr_back(preword, p);
4858@@ -11685,10 +11889,9 @@
4859 && (slang->sl_compsylmax < MAXWLEN
4860 || sp->ts_complen + 1 - sp->ts_compsplit
4861 < slang->sl_compmax)
4862- && (byte_in_str(sp->ts_complen == sp->ts_compsplit
4863- ? slang->sl_compstartflags
4864- : slang->sl_compallflags,
4865- ((unsigned)flags >> 24))))
4866+ && (can_be_compound(sp, slang,
4867+ compflags, ((unsigned)flags >> 24))))
4868+
4869 {
4870 try_compound = TRUE;
4871 compflags[sp->ts_complen] = ((unsigned)flags >> 24);
4872diff -Naur vim72.orig/src/structs.h vim72/src/structs.h
4873--- vim72.orig/src/structs.h 2008-07-30 13:02:50.000000000 -0700
[43c52a1]4874+++ vim72/src/structs.h 2009-01-08 20:57:39.000000000 -0800
[76dd250]4875@@ -459,7 +459,7 @@
4876 typedef struct
4877 {
4878 int hide; /* TRUE when ":hide" was used */
4879-# ifdef FEAT_BROWSE
4880+# ifdef FEAT_BROWSE_CMD
4881 int browse; /* TRUE to invoke file dialog */
4882 # endif
4883 # ifdef FEAT_WINDOWS
4884@@ -1784,10 +1784,15 @@
4885 #endif
4886
4887 /*
4888- * The next three specify the offsets for displaying the buffer:
4889+ * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
4890+ * displaying the buffer.
4891 */
4892 linenr_T w_topline; /* buffer line number of the line at the
4893 top of the window */
4894+#ifdef FEAT_AUTOCMD
4895+ char w_topline_was_set; /* flag set to TRUE when topline is set,
4896+ e.g. by winrestview() */
4897+#endif
4898 #ifdef FEAT_DIFF
4899 int w_topfill; /* number of filler lines above w_topline */
4900 int w_old_topfill; /* w_topfill at last redraw */
4901diff -Naur vim72.orig/src/tag.c vim72/src/tag.c
4902--- vim72.orig/src/tag.c 2008-07-16 14:31:30.000000000 -0700
[43c52a1]4903+++ vim72/src/tag.c 2009-01-08 20:57:45.000000000 -0800
[76dd250]4904@@ -2725,7 +2725,24 @@
4905 */
4906 p_7f = vim_strchr(lbuf, 0x7f);
4907 if (p_7f == NULL)
4908+ {
4909+etag_fail:
4910+ if (vim_strchr(lbuf, '\n') == NULL)
4911+ {
4912+ /* Truncated line. Ignore it. */
4913+ if (p_verbose >= 5)
4914+ {
4915+ verbose_enter();
4916+ MSG(_("Ignoring long line in tags file"));
4917+ verbose_leave();
4918+ }
4919+ tagp->command = lbuf;
4920+ tagp->tagname = lbuf;
4921+ tagp->tagname_end = lbuf;
4922+ return OK;
4923+ }
4924 return FAIL;
4925+ }
4926
4927 /* Find ^A. If not found the line number is after the 0x7f */
4928 p = vim_strchr(p_7f, Ctrl_A);
4929@@ -2735,7 +2752,7 @@
4930 ++p;
4931
4932 if (!VIM_ISDIGIT(*p)) /* check for start of line number */
4933- return FAIL;
4934+ goto etag_fail;
4935 tagp->command = p;
4936
4937
4938@@ -2749,7 +2766,7 @@
4939 /* find end of tagname */
4940 for (p = p_7f - 1; !vim_iswordc(*p); --p)
4941 if (p == lbuf)
4942- return FAIL;
4943+ goto etag_fail;
4944 tagp->tagname_end = p + 1;
4945 while (p >= lbuf && vim_iswordc(*p))
4946 --p;
4947diff -Naur vim72.orig/src/testdir/Make_ming.mak vim72/src/testdir/Make_ming.mak
4948--- vim72.orig/src/testdir/Make_ming.mak 1969-12-31 16:00:00.000000000 -0800
[43c52a1]4949+++ vim72/src/testdir/Make_ming.mak 2009-01-08 20:57:31.000000000 -0800
[76dd250]4950@@ -0,0 +1,91 @@
4951+# Makefile to run tests for Vim, on Dos-like machines
4952+# with sh.exe or zsh.exe in the path or not.
4953+#
4954+# Author: Bill McCarthy
4955+#
4956+# Note that test54 has been removed until it is fixed.
4957+#
4958+# Requires a set of Unix tools: echo, diff, etc.
4959+
4960+ifneq (sh.exe, $(SHELL))
4961+DEL = rm -f
4962+MV = mv
4963+CP = cp
4964+DIRSLASH = /
4965+else
4966+DEL = del
4967+MV = rename
4968+CP = copy
4969+DIRSLASH = \\
4970+endif
4971+
4972+VIMPROG = ..$(DIRSLASH)vim
4973+
4974+# Omitted:
4975+# test2 "\\tmp" doesn't work.
4976+# test10 'errorformat' is different
4977+# test12 can't unlink a swap file
4978+# test25 uses symbolic link
4979+# test27 can't edit file with "*" in file name
4980+# test31 16 bit version runs out of memory...
4981+
4982+SCRIPTS16 = test1.out test19.out test20.out test22.out \
4983+ test23.out test24.out test28.out test29.out \
4984+ test35.out test36.out test43.out \
4985+ test44.out test45.out test46.out test47.out \
4986+ test48.out test51.out test53.out \
4987+ test55.out test56.out test57.out test58.out test59.out \
4988+ test60.out test61.out test62.out test63.out test64.out
4989+
4990+# Had to remove test54 which doesn't work yet.
4991+# test54.out
4992+
4993+SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
4994+ test8.out test9.out test11.out test13.out test14.out \
4995+ test15.out test17.out test18.out test21.out test26.out \
4996+ test30.out test31.out test32.out test33.out test34.out \
4997+ test37.out test38.out test39.out test40.out test41.out \
4998+ test42.out test52.out test65.out
4999+
5000+SCRIPTS32 = test50.out
5001+
5002+SCRIPTS_GUI = test16.out
5003+
5004+.SUFFIXES: .in .out
5005+
5006+vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
5007+ echo ALL DONE
5008+
5009+nongui: fixff $(SCRIPTS16) $(SCRIPTS)
5010+ echo ALL DONE
5011+
5012+small:
5013+ echo ALL DONE
5014+
5015+gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
5016+ echo ALL DONE
5017+
5018+win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
5019+ echo ALL DONE
5020+
5021+fixff:
5022+ -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
5023+
5024+clean:
5025+ -$(DEL) *.out
5026+ -$(DEL) test.ok
5027+ -$(DEL) small.vim
5028+ -$(DEL) tiny.vim
5029+ -$(DEL) mbyte.vim
5030+ -$(DEL) X*
5031+ -$(DEL) viminfo
5032+
5033+.in.out:
5034+ $(CP) $*.ok test.ok
5035+ $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
5036+ diff test.out $*.ok
5037+ -$(DEL) $*.out
5038+ $(MV) test.out $*.out
5039+ -$(DEL) X*
5040+ -$(DEL) test.ok
5041+ -$(DEL) viminfo
5042diff -Naur vim72.orig/src/testdir/Makefile vim72/src/testdir/Makefile
5043--- vim72.orig/src/testdir/Makefile 2008-06-19 13:29:46.000000000 -0700
[43c52a1]5044+++ vim72/src/testdir/Makefile 2009-01-08 20:57:31.000000000 -0800
[76dd250]5045@@ -26,15 +26,17 @@
5046
5047 .SUFFIXES: .in .out
5048
5049-nongui: nolog $(SCRIPTS)
5050- @echo
5051- @cat test.log
5052- @echo ALL DONE
5053+nongui: nolog $(SCRIPTS) report
5054+
5055+gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
5056
5057-gui: nolog $(SCRIPTS) $(SCRIPTS_GUI)
5058+report:
5059 @echo
5060- @cat test.log
5061- @echo ALL DONE
5062+ @echo 'Test results:'
5063+ @/bin/sh -c "if test -f test.log; \
5064+ then cat test.log; echo TEST FAILURE; exit 1; \
5065+ else echo ALL DONE; \
5066+ fi"
5067
5068 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
5069
5070@@ -71,4 +73,4 @@
5071 test60.out: test60.vim
5072
5073 nolog:
5074- -echo Test results: >test.log
5075+ -rm -f test.log
5076diff -Naur vim72.orig/src/testdir/test42.ok vim72/src/testdir/test42.ok
5077--- vim72.orig/src/testdir/test42.ok 2008-02-20 04:27:37.000000000 -0800
[43c52a1]5078+++ vim72/src/testdir/test42.ok 2009-01-08 20:57:32.000000000 -0800
[76dd250]5079@@ -20,7 +20,7 @@
5080 ucs-2
5081
5082
5083- fileencoding=ucs-2le
5084+ fileencoding=utf-16le
5085 bomb
5086 ucs-2le
5087
5088diff -Naur vim72.orig/src/ui.c vim72/src/ui.c
5089--- vim72.orig/src/ui.c 2008-07-14 11:14:56.000000000 -0700
[43c52a1]5090+++ vim72/src/ui.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]5091@@ -1820,7 +1820,7 @@
5092 #ifdef HAVE_DUP
5093 /* Use stderr for stdin, also works for shell commands. */
5094 close(0);
5095- dup(2);
5096+ ignored = dup(2);
5097 #else
5098 read_cmd_fd = 2; /* read from stderr instead of stdin */
5099 #endif
5100@@ -2020,7 +2020,7 @@
5101
5102 if (value == NULL || *length == 0)
5103 {
5104- clip_free_selection(cbd); /* ??? [what's the query?] */
5105+ clip_free_selection(cbd); /* nothing received, clear register */
5106 *(int *)success = FALSE;
5107 return;
5108 }
5109@@ -2076,7 +2076,7 @@
5110 text_prop.value = (unsigned char *)value;
5111 text_prop.encoding = *type;
5112 text_prop.format = *format;
5113- text_prop.nitems = STRLEN(value);
5114+ text_prop.nitems = len;
5115 status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
5116 &text_list, &n_text);
5117 if (status != Success || n_text < 1)
5118@@ -2110,6 +2110,8 @@
5119 int i;
5120 int nbytes = 0;
5121 char_u *buffer;
5122+ time_t start_time;
5123+ int timed_out = FALSE;
5124
5125 for (i =
5126 #ifdef FEAT_MBYTE
5127@@ -2129,6 +2131,7 @@
5128 case 3: type = text_atom; break;
5129 default: type = XA_STRING;
5130 }
5131+ success = MAYBE;
5132 XtGetSelectionValue(myShell, cbd->sel_atom, type,
5133 clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
5134
5135@@ -2141,27 +2144,48 @@
5136 * characters, then they will appear before the one that requested the
5137 * paste! Don't worry, we will catch up with any other events later.
5138 */
5139- for (;;)
5140+ start_time = time(NULL);
5141+ while (success == MAYBE)
5142 {
5143- if (XCheckTypedEvent(dpy, SelectionNotify, &event))
5144- break;
5145- if (XCheckTypedEvent(dpy, SelectionRequest, &event))
5146- /* We may get a SelectionRequest here and if we don't handle
5147- * it we hang. KDE klipper does this, for example. */
5148+ if (XCheckTypedEvent(dpy, SelectionNotify, &event)
5149+ || XCheckTypedEvent(dpy, SelectionRequest, &event)
5150+ || XCheckTypedEvent(dpy, PropertyNotify, &event))
5151+ {
5152+ /* This is where clip_x11_request_selection_cb() should be
5153+ * called. It may actually happen a bit later, so we loop
5154+ * until "success" changes.
5155+ * We may get a SelectionRequest here and if we don't handle
5156+ * it we hang. KDE klipper does this, for example.
5157+ * We need to handle a PropertyNotify for large selections. */
5158 XtDispatchEvent(&event);
5159+ continue;
5160+ }
5161+
5162+ /* Time out after 2 to 3 seconds to avoid that we hang when the
5163+ * other process doesn't respond. Note that the SelectionNotify
5164+ * event may still come later when the selection owner comes back
5165+ * to life and the text gets inserted unexpectedly. Don't know
5166+ * why that happens or how to avoid that :-(. */
5167+ if (time(NULL) > start_time + 2)
5168+ {
5169+ timed_out = TRUE;
5170+ break;
5171+ }
5172
5173 /* Do we need this? Probably not. */
5174 XSync(dpy, False);
5175
5176- /* Bernhard Walle solved a slow paste response in an X terminal by
5177- * adding: usleep(10000); here. */
5178+ /* Wait for 1 msec to avoid that we eat up all CPU time. */
5179+ ui_delay(1L, TRUE);
5180 }
5181
5182- /* this is where clip_x11_request_selection_cb() is actually called */
5183- XtDispatchEvent(&event);
5184-
5185- if (success)
5186+ if (success == TRUE)
5187 return;
5188+
5189+ /* don't do a retry with another type after timing out, otherwise we
5190+ * hang for 15 seconds. */
5191+ if (timed_out)
5192+ break;
5193 }
5194
5195 /* Final fallback position - use the X CUT_BUFFER0 store */
5196diff -Naur vim72.orig/src/version.c vim72/src/version.c
5197--- vim72.orig/src/version.c 2008-08-09 07:24:52.000000000 -0700
[43c52a1]5198+++ vim72/src/version.c 2009-01-08 20:57:54.000000000 -0800
5199@@ -677,9 +677,166 @@
[76dd250]5200 static int included_patches[] =
5201 { /* Add new patch number below this line */
5202 /**/
[43c52a1]5203+ 79,
5204+/**/
5205+ 78,
5206+/**/
5207+ 77,
5208+/**/
[1f22c7c]5209+ 76,
5210+/**/
5211+ 75,
5212+/**/
5213+ 73,
5214+/**/
5215+ 70,
5216+/**/
[76dd250]5217+ 69,
5218+/**/
5219+ 68,
5220+/**/
5221+ 67,
5222+/**/
5223+ 66,
5224+/**/
5225+ 65,
5226+/**/
5227+ 64,
5228+/**/
5229+ 63,
5230+/**/
5231+ 62,
5232+/**/
5233+ 61,
5234+/**/
5235+ 60,
5236+/**/
5237+ 59,
5238+/**/
5239+ 58,
5240+/**/
5241+ 57,
5242+/**/
5243+ 56,
5244+/**/
5245+ 55,
5246+/**/
5247+ 54,
5248+/**/
5249+ 53,
5250+/**/
5251+ 52,
5252+/**/
5253+ 51,
5254+/**/
5255+ 50,
5256+/**/
5257+ 48,
5258+/**/
5259+ 47,
5260+/**/
5261+ 46,
5262+/**/
5263+ 45,
5264+/**/
5265+ 44,
5266+/**/
5267+ 43,
5268+/**/
5269+ 42,
5270+/**/
5271+ 40,
5272+/**/
5273+ 39,
5274+/**/
5275+ 38,
5276+/**/
5277+ 37,
5278+/**/
5279+ 35,
5280+/**/
5281+ 34,
5282+/**/
5283+ 33,
5284+/**/
5285+ 32,
5286+/**/
5287+ 31,
5288+/**/
5289+ 30,
5290+/**/
5291+ 29,
5292+/**/
5293+ 28,
5294+/**/
5295+ 27,
5296+/**/
5297+ 26,
5298+/**/
5299+ 25,
5300+/**/
5301+ 24,
5302+/**/
5303+ 23,
5304+/**/
5305+ 22,
5306+/**/
5307+ 21,
5308+/**/
5309+ 20,
5310+/**/
5311+ 19,
5312+/**/
5313+ 18,
5314+/**/
5315+ 17,
5316+/**/
5317+ 16,
5318+/**/
5319+ 15,
5320+/**/
5321+ 14,
5322+/**/
5323+ 13,
5324+/**/
5325+ 12,
5326+/**/
5327+ 11,
5328+/**/
5329+ 10,
5330+/**/
5331+ 9,
5332+/**/
5333+ 8,
5334+/**/
5335+ 6,
5336+/**/
5337+ 5,
5338+/**/
5339+ 4,
5340+/**/
5341+ 3,
5342+/**/
5343+ 2,
5344+/**/
5345+ 1,
5346+/**/
5347 0
5348 };
5349
5350+/*
5351+ * Place to put a short description when adding a feature with a patch.
5352+ * Keep it short, e.g.,: "relative numbers", "persistent undo".
5353+ * Also add a comment marker to separate the lines.
5354+ * See the official Vim patches for the diff format: It must use a context of
[1f22c7c]5355+ * one line only. Create it by hand or use "diff -C2" and edit the patch.
[76dd250]5356+ */
5357+static char *(extra_patches[]) =
5358+{ /* Add your patch description below this line */
5359+/**/
5360+ NULL
5361+};
5362+
5363 int
5364 highest_patch()
5365 {
[43c52a1]5366@@ -786,7 +943,7 @@
[76dd250]5367 MSG_PUTS(_("\nRISC OS version"));
5368 #endif
5369 #ifdef VMS
5370- MSG_PUTS("\nOpenVMS version");
5371+ MSG_PUTS(_("\nOpenVMS version"));
5372 # ifdef HAVE_PATHDEF
5373 if (*compiled_arch != NUL)
5374 {
[43c52a1]5375@@ -825,6 +982,19 @@
[76dd250]5376 }
5377 }
5378
5379+ /* Print the list of extra patch descriptions if there is at least one. */
5380+ if (extra_patches[0] != NULL)
5381+ {
5382+ MSG_PUTS(_("\nExtra patches: "));
5383+ s = "";
5384+ for (i = 0; extra_patches[i] != NULL; ++i)
5385+ {
5386+ MSG_PUTS(s);
5387+ s = ", ";
5388+ MSG_PUTS(extra_patches[i]);
5389+ }
5390+ }
5391+
5392 #ifdef MODIFIED_BY
5393 MSG_PUTS("\n");
5394 MSG_PUTS(_("Modified by "));
5395diff -Naur vim72.orig/src/vim.h vim72/src/vim.h
5396--- vim72.orig/src/vim.h 2008-08-09 09:03:38.000000000 -0700
[43c52a1]5397+++ vim72/src/vim.h 2009-01-08 20:57:39.000000000 -0800
[76dd250]5398@@ -341,8 +341,14 @@
5399 #ifdef BACKSLASH_IN_FILENAME
5400 # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<")
5401 #else
5402-# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
5403-# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
5404+# ifdef VMS
5405+ /* VMS allows a lot of characters in the file name */
5406+# define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!")
5407+# define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&")
5408+# else
5409+# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
5410+# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
5411+# endif
5412 #endif
5413
5414 #define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */
5415@@ -370,7 +376,7 @@
5416 * Define __w64 as an empty token for everything but MSVC 7.x or later.
5417 */
5418 # if !defined(_MSC_VER) || (_MSC_VER < 1300)
5419-# define __w64
5420+# define __w64
5421 # endif
5422 typedef unsigned long __w64 long_u;
5423 typedef long __w64 long_i;
5424@@ -1728,7 +1734,8 @@
5425 #define VV_MOUSE_COL 51
5426 #define VV_OP 52
5427 #define VV_SEARCHFORWARD 53
5428-#define VV_LEN 54 /* number of v: vars */
5429+#define VV_OLDFILES 54
5430+#define VV_LEN 55 /* number of v: vars */
5431
5432 #ifdef FEAT_CLIPBOARD
5433
5434@@ -1979,6 +1986,9 @@
5435 # endif
5436 #endif
5437
5438+#ifndef FEAT_NETBEANS_INTG
5439+# undef NBDEBUG
5440+#endif
5441 #ifdef NBDEBUG /* Netbeans debugging. */
5442 # include "nbdebug.h"
5443 #else
5444@@ -2054,4 +2064,10 @@
5445 #define DOSO_VIMRC 1 /* loading vimrc file */
5446 #define DOSO_GVIMRC 2 /* loading gvimrc file */
5447
5448+/* flags for read_viminfo() and children */
5449+#define VIF_WANT_INFO 1 /* load non-mark info */
5450+#define VIF_WANT_MARKS 2 /* load file marks */
5451+#define VIF_FORCEIT 4 /* overwrite info already read */
5452+#define VIF_GET_OLDFILES 8 /* load v:oldfiles */
5453+
5454 #endif /* VIM__H */
5455diff -Naur vim72.orig/src/window.c vim72/src/window.c
5456--- vim72.orig/src/window.c 2008-08-06 04:00:30.000000000 -0700
[43c52a1]5457+++ vim72/src/window.c 2009-01-08 20:57:44.000000000 -0800
[76dd250]5458@@ -4028,14 +4028,14 @@
5459 if (mch_dirname(cwd, MAXPATHL) == OK)
5460 globaldir = vim_strsave(cwd);
5461 }
5462- mch_chdir((char *)curwin->w_localdir);
5463- shorten_fnames(TRUE);
5464+ if (mch_chdir((char *)curwin->w_localdir) == 0)
5465+ shorten_fnames(TRUE);
5466 }
5467 else if (globaldir != NULL)
5468 {
5469 /* Window doesn't have a local directory and we are not in the global
5470 * directory: Change to the global directory. */
5471- mch_chdir((char *)globaldir);
5472+ ignored = mch_chdir((char *)globaldir);
5473 vim_free(globaldir);
5474 globaldir = NULL;
5475 shorten_fnames(TRUE);
5476diff -Naur vim72.orig/src/workshop.c vim72/src/workshop.c
5477--- vim72.orig/src/workshop.c 2008-06-21 11:53:26.000000000 -0700
[43c52a1]5478+++ vim72/src/workshop.c 2009-01-08 20:57:43.000000000 -0800
[76dd250]5479@@ -1121,8 +1121,12 @@
5480 ? (char *)curbuf->b_sfname : "<None>");
5481 #endif
5482
5483- strcpy(ffname, (char *) curbuf->b_ffname);
5484- *filename = ffname; /* copy so nobody can change b_ffname */
5485+ if (curbuf->b_ffname == NULL)
5486+ ffname[0] = NUL;
5487+ else
5488+ /* copy so nobody can change b_ffname */
5489+ strcpy(ffname, (char *) curbuf->b_ffname);
5490+ *filename = ffname;
5491 *curLine = curwin->w_cursor.lnum;
5492 *curCol = curwin->w_cursor.col;
5493
Note: See TracBrowser for help on using the repository browser.