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

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 4c565d8 was 9a875fd, checked in by Jim Gifford <clfs@…>, 16 years ago

Updated Vim Branch Update Patch to -7

  • Property mode set to 100644
File size: 188.6 KB
RevLine 
[43c52a1]1Submitted By: Jim Gifford (jim at cross-lfs dot org)
[9a875fd]2Date: 02-07-2009
[76dd250]3Initial Package Version: 7.2
4Origin: Upstream
5Upstream Status: Applied
[9a875fd]6Description: Contains all upstream patches up to 7.2.102
[76dd250]7 The following patches were skipped
[9a875fd]8 007 036 041 049 071 072 074 088 089 093 101
[76dd250]9
10diff -Naur vim72.orig/Filelist vim72/Filelist
11--- vim72.orig/Filelist 2008-07-06 11:02:23.000000000 -0700
[9a875fd]12+++ vim72/Filelist 2009-02-07 22:14:24.920315687 -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
[9a875fd]23+++ vim72/runtime/doc/cmdline.txt 2009-02-07 22:14:49.082537505 -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
[9a875fd]82+++ vim72/runtime/doc/eval.txt 2009-02-07 22:16:31.313639335 -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
[9a875fd]202+++ vim72/runtime/doc/netbeans.txt 2009-02-07 22:17:10.442415701 -0800
[43c52a1]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
[9a875fd]224+++ vim72/runtime/doc/options.txt 2009-02-07 22:15:46.012035201 -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
[9a875fd]244+++ vim72/runtime/doc/spell.txt 2009-02-07 22:16:14.222486660 -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
[9a875fd]374+++ vim72/runtime/doc/starting.txt 2009-02-07 22:14:49.086641151 -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
[9a875fd]436+++ vim72/runtime/doc/usr_21.txt 2009-02-07 22:14:49.086641151 -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
[9a875fd]503+++ vim72/runtime/scripts.vim 2009-02-07 22:13:32.395881827 -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
[9a875fd]517+++ vim72/src/auto/configure 2009-02-07 22:15:25.364839224 -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
[9a875fd]558+++ vim72/src/buffer.c 2009-02-07 22:17:10.446515715 -0800
[43c52a1]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
[9a875fd]676+++ vim72/src/configure.in 2009-02-07 22:15:25.364839224 -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
[9a875fd]711+++ vim72/src/diff.c 2009-02-07 22:17:31.848396425 -0800
[5f4a45c9]712@@ -8,7 +8,7 @@
713 */
714
715 /*
716- * diff.c: code for diff'ing two or three buffers.
717+ * diff.c: code for diff'ing two, three or four buffers.
718 */
719
720 #include "vim.h"
[76dd250]721@@ -73,6 +73,8 @@
722 {
723 tp->tp_diffbuf[i] = NULL;
724 tp->tp_diff_invalid = TRUE;
725+ if (tp == curtab)
726+ diff_redraw(TRUE);
727 }
728 }
729 }
730@@ -102,6 +104,7 @@
731 {
732 curtab->tp_diffbuf[i] = NULL;
733 curtab->tp_diff_invalid = TRUE;
734+ diff_redraw(TRUE);
735 }
736 }
737 }
[5f4a45c9]738@@ -113,7 +116,7 @@
739 * Add a buffer to make diffs for.
740 * Call this when a new buffer is being edited in the current window where
741 * 'diff' is set.
742- * Marks the current buffer as being part of the diff and requireing updating.
743+ * Marks the current buffer as being part of the diff and requiring updating.
744 * This must be done before any autocmd, because a command may use info
745 * about the screen contents.
746 */
[76dd250]747@@ -131,6 +134,7 @@
748 {
749 curtab->tp_diffbuf[i] = buf;
750 curtab->tp_diff_invalid = TRUE;
751+ diff_redraw(TRUE);
752 return;
753 }
754
755@@ -661,6 +665,7 @@
756 char_u *tmp_diff;
757 FILE *fd;
758 int ok;
759+ int io_error = FALSE;
760
761 /* Delete all diffblocks. */
762 diff_clear(curtab);
763@@ -697,18 +702,26 @@
764 {
765 ok = FALSE;
766 fd = mch_fopen((char *)tmp_orig, "w");
767- if (fd != NULL)
768+ if (fd == NULL)
769+ io_error = TRUE;
770+ else
771 {
772- fwrite("line1\n", (size_t)6, (size_t)1, fd);
773+ if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1)
774+ io_error = TRUE;
775 fclose(fd);
776 fd = mch_fopen((char *)tmp_new, "w");
777- if (fd != NULL)
778+ if (fd == NULL)
779+ io_error = TRUE;
780+ else
781 {
782- fwrite("line2\n", (size_t)6, (size_t)1, fd);
783+ if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1)
784+ io_error = TRUE;
785 fclose(fd);
786 diff_file(tmp_orig, tmp_new, tmp_diff);
787 fd = mch_fopen((char *)tmp_diff, "r");
788- if (fd != NULL)
789+ if (fd == NULL)
790+ io_error = TRUE;
791+ else
792 {
793 char_u linebuf[LBUFLEN];
794
795@@ -761,6 +774,8 @@
796 }
797 if (!ok)
798 {
799+ if (io_error)
800+ EMSG(_("E810: Cannot read or write temp files"));
801 EMSG(_("E97: Cannot create diffs"));
802 diff_a_works = MAYBE;
803 #if defined(MSWIN) || defined(MSDOS)
[5f4a45c9]804@@ -914,7 +929,7 @@
805 goto theend;
806
807 #ifdef UNIX
808- /* Temporaraly chdir to /tmp, to avoid patching files in the current
809+ /* Temporarily chdir to /tmp, to avoid patching files in the current
810 * directory when the patch file contains more than one patch. When we
811 * have our own temp dir use that instead, it will be cleaned up when we
812 * exit (any .rej files created). Don't change directory if we can't
[76dd250]813@@ -925,10 +940,10 @@
814 {
815 # ifdef TEMPDIRNAMES
816 if (vim_tempdir != NULL)
817- mch_chdir((char *)vim_tempdir);
818+ ignored = mch_chdir((char *)vim_tempdir);
819 else
820 # endif
821- mch_chdir("/tmp");
822+ ignored = mch_chdir("/tmp");
823 shorten_fnames(TRUE);
824 }
825 #endif
[5f4a45c9]826@@ -2114,6 +2129,8 @@
827 EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg);
828 return;
829 }
830+ if (buf == curbuf)
831+ return; /* nothing to do */
832 idx_other = diff_buf_idx(buf);
833 if (idx_other == DB_COUNT)
834 {
[7352c10]835diff -Naur vim72.orig/src/edit.c vim72/src/edit.c
836--- vim72.orig/src/edit.c 2008-08-06 05:51:17.000000000 -0700
[9a875fd]837+++ vim72/src/edit.c 2009-02-07 22:17:53.553792150 -0800
[7352c10]838@@ -147,6 +147,7 @@
839 static int ins_compl_bs __ARGS((void));
840 static void ins_compl_new_leader __ARGS((void));
841 static void ins_compl_addleader __ARGS((int c));
842+static int ins_compl_len __ARGS((void));
843 static void ins_compl_restart __ARGS((void));
844 static void ins_compl_set_original_text __ARGS((char_u *str));
845 static void ins_compl_addfrommatch __ARGS((void));
846@@ -197,7 +198,8 @@
847 static void mb_replace_pop_ins __ARGS((int cc));
848 #endif
849 static void replace_flush __ARGS((void));
850-static void replace_do_bs __ARGS((void));
851+static void replace_do_bs __ARGS((int limit_col));
852+static int del_char_after_col __ARGS((int limit_col));
853 #ifdef FEAT_CINDENT
854 static int cindent_on __ARGS((void));
855 #endif
856@@ -1933,6 +1935,8 @@
857 /*
858 * Backspace the cursor until the given column. Handles REPLACE and VREPLACE
859 * modes correctly. May also be used when not in insert mode at all.
860+ * Will attempt not to go before "col" even when there is a composing
861+ * character.
862 */
863 void
864 backspace_until_column(col)
[9a875fd]865@@ -1942,13 +1946,50 @@
[7352c10]866 {
867 curwin->w_cursor.col--;
868 if (State & REPLACE_FLAG)
869- replace_do_bs();
870- else
871- (void)del_char(FALSE);
872+ replace_do_bs(col);
873+ else if (!del_char_after_col(col))
874+ break;
875 }
876 }
877 #endif
878
879+/*
880+ * Like del_char(), but make sure not to go before column "limit_col".
881+ * Only matters when there are composing characters.
882+ * Return TRUE when something was deleted.
883+ */
[9a875fd]884+/*ARGSUSED*/
[7352c10]885+ static int
886+del_char_after_col(limit_col)
887+ int limit_col;
888+{
889+#ifdef FEAT_MBYTE
890+ if (enc_utf8 && limit_col >= 0)
891+ {
892+ int ecol = curwin->w_cursor.col + 1;
893+
894+ /* Make sure the cursor is at the start of a character, but
895+ * skip forward again when going too far back because of a
896+ * composing character. */
897+ mb_adjust_cursor();
[9a875fd]898+ while (curwin->w_cursor.col < (colnr_T)limit_col)
[7352c10]899+ {
900+ int l = utf_ptr2len(ml_get_cursor());
901+
902+ if (l == 0) /* end of line */
903+ break;
904+ curwin->w_cursor.col += l;
905+ }
906+ if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol)
907+ return FALSE;
908+ del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE);
909+ }
910+ else
911+#endif
912+ (void)del_char(FALSE);
913+ return TRUE;
914+}
915+
916 #if defined(FEAT_INS_EXPAND) || defined(PROTO)
917 /*
918 * CTRL-X pressed in Insert mode.
[9a875fd]919@@ -2418,7 +2459,7 @@
[7352c10]920 {
921 had_match = (curwin->w_cursor.col > compl_col);
922 ins_compl_delete();
923- ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
924+ ins_bytes(compl_leader + ins_compl_len());
925 ins_redraw(FALSE);
926
927 /* When the match isn't there (to avoid matching itself) remove it
[9a875fd]928@@ -2470,7 +2511,7 @@
[7352c10]929 *p = NUL;
930 had_match = (curwin->w_cursor.col > compl_col);
931 ins_compl_delete();
932- ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
933+ ins_bytes(compl_leader + ins_compl_len());
934 ins_redraw(FALSE);
935
936 /* When the match isn't there (to avoid matching itself) remove it
[9a875fd]937@@ -3209,7 +3250,7 @@
[7352c10]938 {
939 ins_compl_del_pum();
940 ins_compl_delete();
941- ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
942+ ins_bytes(compl_leader + ins_compl_len());
943 compl_used_match = FALSE;
944
945 if (compl_started)
[9a875fd]946@@ -3264,6 +3305,20 @@
[7352c10]947 }
948
949 /*
950+ * Return the length of the completion, from the completion start column to
951+ * the cursor column. Making sure it never goes below zero.
952+ */
953+ static int
954+ins_compl_len()
955+{
956+ int off = curwin->w_cursor.col - compl_col;
957+
958+ if (off < 0)
959+ return 0;
960+ return off;
961+}
962+
963+/*
964 * Append one character to the match leader. May reduce the number of
965 * matches.
966 */
[9a875fd]967@@ -3621,10 +3676,9 @@
[7352c10]968 {
969 ins_compl_delete();
970 if (compl_leader != NULL)
971- ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
972+ ins_bytes(compl_leader + ins_compl_len());
973 else if (compl_first_match != NULL)
974- ins_bytes(compl_orig_text
975- + curwin->w_cursor.col - compl_col);
976+ ins_bytes(compl_orig_text + ins_compl_len());
977 retval = TRUE;
978 }
979
[9a875fd]980@@ -4187,7 +4241,7 @@
981 }
982
983 /* check if compl_curr_match has changed, (e.g. other type of
984- * expansion added somenthing) */
985+ * expansion added something) */
986 if (type != 0 && compl_curr_match != old_match)
987 found_new_match = OK;
988
989@@ -4256,7 +4310,7 @@
[7352c10]990 static void
991 ins_compl_insert()
992 {
993- ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col);
994+ ins_bytes(compl_shown_match->cp_str + ins_compl_len());
995 if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
996 compl_used_match = FALSE;
997 else
[9a875fd]998@@ -4425,7 +4479,7 @@
[7352c10]999 if (!compl_get_longest || compl_used_match)
1000 ins_compl_insert();
1001 else
1002- ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
1003+ ins_bytes(compl_leader + ins_compl_len());
1004 }
1005 else
1006 compl_used_match = FALSE;
[9a875fd]1007@@ -4688,7 +4742,7 @@
1008 }
1009 compl_length = curwin->w_cursor.col - (int)compl_col;
1010 /* IObuff is used to add a "word from the next line" would we
1011- * have enough space? just being paranoic */
1012+ * have enough space? just being paranoid */
1013 #define MIN_SPACE 75
1014 if (compl_length > (IOSIZE - MIN_SPACE))
1015 {
1016@@ -7123,9 +7177,12 @@
[7352c10]1017 * cc == 0: character was inserted, delete it
1018 * cc > 0: character was replaced, put cc (first byte of original char) back
1019 * and check for more characters to be put back
1020+ * When "limit_col" is >= 0, don't delete before this column. Matters when
1021+ * using composing characters, use del_char_after_col() instead of del_char().
1022 */
1023 static void
1024-replace_do_bs()
1025+replace_do_bs(limit_col)
1026+ int limit_col;
1027 {
1028 int cc;
1029 #ifdef FEAT_VREPLACE
[9a875fd]1030@@ -7153,7 +7210,7 @@
[7352c10]1031 #ifdef FEAT_MBYTE
1032 if (has_mbyte)
1033 {
1034- del_char(FALSE);
1035+ (void)del_char_after_col(limit_col);
1036 # ifdef FEAT_VREPLACE
1037 if (State & VREPLACE_FLAG)
1038 orig_len = (int)STRLEN(ml_get_cursor());
[9a875fd]1039@@ -7203,7 +7260,7 @@
[7352c10]1040 changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
1041 }
1042 else if (cc == 0)
1043- (void)del_char(FALSE);
1044+ (void)del_char_after_col(limit_col);
1045 }
1046
1047 #ifdef FEAT_CINDENT
[9a875fd]1048@@ -8150,7 +8207,7 @@
1049 /*
1050 * If the cursor is on an indent, ^T/^D insert/delete one
1051 * shiftwidth. Otherwise ^T/^D behave like a "<<" or ">>".
1052- * Always round the indent to 'shiftwith', this is compatible
1053+ * Always round the indent to 'shiftwidth', this is compatible
1054 * with vi. But vi only supports ^T and ^D after an
1055 * autoindent, we support it everywhere.
1056 */
1057@@ -8239,7 +8296,7 @@
[7352c10]1058 * Replace mode */
1059 if (curwin->w_cursor.lnum != Insstart.lnum
1060 || curwin->w_cursor.col >= Insstart.col)
1061- replace_do_bs();
1062+ replace_do_bs(-1);
1063 }
1064 else
1065 (void)del_char(FALSE);
[9a875fd]1066@@ -8556,7 +8613,7 @@
[7352c10]1067 break;
1068 }
1069 if (State & REPLACE_FLAG)
1070- replace_do_bs();
1071+ replace_do_bs(-1);
1072 else
1073 {
1074 #ifdef FEAT_MBYTE
[76dd250]1075diff -Naur vim72.orig/src/eval.c vim72/src/eval.c
1076--- vim72.orig/src/eval.c 2008-08-07 12:37:22.000000000 -0700
[9a875fd]1077+++ vim72/src/eval.c 2009-02-07 22:18:04.431097639 -0800
[1f22c7c]1078@@ -32,6 +32,9 @@
1079
1080 #define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
1081
1082+#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not
1083+ be freed. */
1084+
1085 /*
1086 * In a hashtab item "hi_key" points to "di_key" in a dictitem.
1087 * This avoids adding a pointer to the hashtab item.
1088@@ -348,6 +351,7 @@
[76dd250]1089 {VV_NAME("mouse_col", VAR_NUMBER), 0},
1090 {VV_NAME("operator", VAR_STRING), VV_RO},
1091 {VV_NAME("searchforward", VAR_NUMBER), 0},
1092+ {VV_NAME("oldfiles", VAR_LIST), 0},
1093 };
1094
1095 /* shorthand */
[1f22c7c]1096@@ -355,6 +359,7 @@
[76dd250]1097 #define vv_nr vv_di.di_tv.vval.v_number
1098 #define vv_float vv_di.di_tv.vval.v_float
1099 #define vv_str vv_di.di_tv.vval.v_string
1100+#define vv_list vv_di.di_tv.vval.v_list
1101 #define vv_tv vv_di.di_tv
1102
1103 /*
[1f22c7c]1104@@ -426,7 +431,6 @@
[76dd250]1105 static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
1106 static void list_append __ARGS((list_T *l, listitem_T *item));
1107 static int list_append_tv __ARGS((list_T *l, typval_T *tv));
1108-static int list_append_string __ARGS((list_T *l, char_u *str, int len));
1109 static int list_append_number __ARGS((list_T *l, varnumber_T n));
1110 static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
1111 static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef));
[1f22c7c]1112@@ -788,6 +792,8 @@
1113 static void func_unref __ARGS((char_u *name));
1114 static void func_ref __ARGS((char_u *name));
1115 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));
1116+static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ;
1117+static void free_funccal __ARGS((funccall_T *fc, int free_val));
1118 static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr));
1119 static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp));
1120 static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
1121@@ -845,11 +851,17 @@
[76dd250]1122 p = &vimvars[i];
1123 if (p->vv_di.di_tv.v_type == VAR_STRING)
1124 {
1125- vim_free(p->vv_di.di_tv.vval.v_string);
1126- p->vv_di.di_tv.vval.v_string = NULL;
1127+ vim_free(p->vv_str);
1128+ p->vv_str = NULL;
1129+ }
1130+ else if (p->vv_di.di_tv.v_type == VAR_LIST)
1131+ {
1132+ list_unref(p->vv_list);
1133+ p->vv_list = NULL;
1134 }
1135 }
1136 hash_clear(&vimvarht);
1137+ hash_init(&vimvarht); /* garbage_collect() will access it */
1138 hash_clear(&compat_hashtab);
1139
1140 /* script-local variables */
[1f22c7c]1141@@ -916,6 +928,10 @@
1142 /* pointer to funccal for currently active function */
1143 funccall_T *current_funccal = NULL;
1144
1145+/* pointer to list of previously used funccal, still around because some
1146+ * item in it is still being used. */
1147+funccall_T *previous_funccal = NULL;
1148+
1149 /*
1150 * Return TRUE when a function was ended by a ":return" command.
1151 */
1152@@ -1256,23 +1272,26 @@
[76dd250]1153
1154 /*
1155 * Top level evaluation function, returning a string.
1156+ * When "convert" is TRUE convert a List into a sequence of lines and convert
1157+ * a Float to a String.
1158 * Return pointer to allocated memory, or NULL for failure.
1159 */
1160 char_u *
1161-eval_to_string(arg, nextcmd, dolist)
1162+eval_to_string(arg, nextcmd, convert)
1163 char_u *arg;
1164 char_u **nextcmd;
1165- int dolist; /* turn List into sequence of lines */
1166+ int convert;
1167 {
1168 typval_T tv;
1169 char_u *retval;
1170 garray_T ga;
1171+ char_u numbuf[NUMBUFLEN];
1172
1173 if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
1174 retval = NULL;
1175 else
1176 {
1177- if (dolist && tv.v_type == VAR_LIST)
1178+ if (convert && tv.v_type == VAR_LIST)
1179 {
1180 ga_init2(&ga, (int)sizeof(char), 80);
1181 if (tv.vval.v_list != NULL)
[1f22c7c]1182@@ -1280,6 +1299,13 @@
[76dd250]1183 ga_append(&ga, NUL);
1184 retval = (char_u *)ga.ga_data;
1185 }
1186+#ifdef FEAT_FLOAT
1187+ else if (convert && tv.v_type == VAR_FLOAT)
1188+ {
1189+ vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
1190+ retval = vim_strsave(numbuf);
1191+ }
1192+#endif
1193 else
1194 retval = vim_strsave(get_tv_string(&tv));
1195 clear_tv(&tv);
[1f22c7c]1196@@ -3277,7 +3303,7 @@
[76dd250]1197
1198 if (*startarg != '(')
1199 {
1200- EMSG2(_("E107: Missing braces: %s"), eap->arg);
1201+ EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
1202 goto end;
1203 }
1204
[1f22c7c]1205@@ -3657,8 +3683,8 @@
[76dd250]1206 }
1207
1208 /*
1209- * Return TRUE if typeval "tv" is locked: Either tha value is locked itself or
1210- * it refers to a List or Dictionary that is locked.
1211+ * Return TRUE if typeval "tv" is locked: Either that value is locked itself
1212+ * or it refers to a List or Dictionary that is locked.
1213 */
1214 static int
1215 tv_islocked(tv)
[9a875fd]1216@@ -3902,7 +3928,7 @@
1217
1218 /*
1219 * Handle top level expression:
1220- * expr1 ? expr0 : expr0
1221+ * expr2 ? expr1 : expr1
1222 *
1223 * "arg" must point to the first non-white of the expression.
1224 * "arg" is advanced to the next non-white after the recognized expression.
[1f22c7c]1225@@ -6047,6 +6073,25 @@
[76dd250]1226 }
1227
1228 /*
1229+ * Get list item "l[idx - 1]" as a string. Returns NULL for failure.
1230+ */
1231+ char_u *
1232+list_find_str(l, idx)
1233+ list_T *l;
1234+ long idx;
1235+{
1236+ listitem_T *li;
1237+
1238+ li = list_find(l, idx - 1);
1239+ if (li == NULL)
1240+ {
1241+ EMSGN(_(e_listidx), idx);
1242+ return NULL;
1243+ }
1244+ return get_tv_string(&li->li_tv);
1245+}
1246+
1247+/*
1248 * Locate "item" list "l" and return its index.
1249 * Returns -1 when "item" is not in the list.
1250 */
[1f22c7c]1251@@ -6137,7 +6182,7 @@
[76dd250]1252 * When "len" >= 0 use "str[len]".
1253 * Returns FAIL when out of memory.
1254 */
1255- static int
1256+ int
1257 list_append_string(l, str, len)
1258 list_T *l;
1259 char_u *str;
[1f22c7c]1260@@ -6454,7 +6499,7 @@
1261 buf_T *buf;
1262 win_T *wp;
1263 int i;
1264- funccall_T *fc;
1265+ funccall_T *fc, **pfc;
1266 int did_free = FALSE;
1267 #ifdef FEAT_WINDOWS
1268 tabpage_T *tp;
1269@@ -6497,6 +6542,9 @@
[76dd250]1270 set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
1271 }
1272
1273+ /* v: vars */
1274+ set_ref_in_ht(&vimvarht, copyID);
1275+
1276 /*
1277 * 2. Go through the list of dicts and free items without the copyID.
1278 */
[1f22c7c]1279@@ -6535,6 +6583,20 @@
1280 else
1281 ll = ll->lv_used_next;
1282
1283+ /* check if any funccal can be freed now */
1284+ for (pfc = &previous_funccal; *pfc != NULL; )
1285+ {
1286+ if (can_free_funccal(*pfc, copyID))
1287+ {
1288+ fc = *pfc;
1289+ *pfc = fc->caller;
1290+ free_funccal(fc, TRUE);
1291+ did_free = TRUE;
1292+ }
1293+ else
1294+ pfc = &(*pfc)->caller;
1295+ }
1296+
1297 return did_free;
1298 }
1299
1300@@ -6587,7 +6649,7 @@
[76dd250]1301 {
1302 case VAR_DICT:
1303 dd = tv->vval.v_dict;
1304- if (dd->dv_copyID != copyID)
1305+ if (dd != NULL && dd->dv_copyID != copyID)
1306 {
1307 /* Didn't see this dict yet. */
1308 dd->dv_copyID = copyID;
[1f22c7c]1309@@ -6597,7 +6659,7 @@
[76dd250]1310
1311 case VAR_LIST:
1312 ll = tv->vval.v_list;
1313- if (ll->lv_copyID != copyID)
1314+ if (ll != NULL && ll->lv_copyID != copyID)
1315 {
1316 /* Didn't see this list yet. */
1317 ll->lv_copyID = copyID;
[1f22c7c]1318@@ -7525,8 +7587,8 @@
[76dd250]1319 {"getwinposx", 0, 0, f_getwinposx},
1320 {"getwinposy", 0, 0, f_getwinposy},
1321 {"getwinvar", 2, 2, f_getwinvar},
1322- {"glob", 1, 1, f_glob},
1323- {"globpath", 2, 2, f_globpath},
1324+ {"glob", 1, 2, f_glob},
1325+ {"globpath", 2, 3, f_globpath},
1326 {"has", 1, 1, f_has},
1327 {"has_key", 2, 2, f_has_key},
1328 {"haslocaldir", 0, 0, f_haslocaldir},
[5f4a45c9]1329@@ -7856,9 +7918,9 @@
1330 else if (!aborting())
1331 {
1332 if (argcount == MAX_FUNC_ARGS)
1333- emsg_funcname("E740: Too many arguments for function %s", name);
1334+ emsg_funcname(N_("E740: Too many arguments for function %s"), name);
1335 else
1336- emsg_funcname("E116: Invalid arguments for function %s", name);
1337+ emsg_funcname(N_("E116: Invalid arguments for function %s"), name);
1338 }
1339
1340 while (--argcount >= 0)
1341@@ -8091,6 +8153,7 @@
1342
1343 /*
1344 * Give an error message with a function name. Handle <SNR> things.
1345+ * "ermsg" is to be passed without translation, use N_() instead of _().
1346 */
1347 static void
1348 emsg_funcname(ermsg, name)
1349@@ -9518,7 +9581,7 @@
[76dd250]1350 else
1351 {
1352 /* When the optional second argument is non-zero, don't remove matches
1353- * for 'suffixes' and 'wildignore' */
1354+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1355 if (argvars[1].v_type != VAR_UNKNOWN
1356 && get_tv_number_chk(&argvars[1], &error))
1357 flags |= WILD_KEEP_ALL;
[5f4a45c9]1358@@ -10300,7 +10363,8 @@
[76dd250]1359 s = get_tv_string(&argvars[0]);
1360 if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
1361 EMSG2(_(e_invarg2), s);
1362- else if (!function_exists(s))
1363+ /* Don't check an autoload name for existence here. */
1364+ else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
1365 EMSG2(_("E700: Unknown function: %s"), s);
1366 else
1367 {
[5f4a45c9]1368@@ -10602,7 +10666,7 @@
[76dd250]1369 # ifdef FEAT_WINDOWS
1370 win_T *wp;
1371 # endif
1372- int n = 1;
1373+ int winnr = 1;
1374
1375 if (row >= 0 && col >= 0)
1376 {
[5f4a45c9]1377@@ -10612,9 +10676,9 @@
[76dd250]1378 (void)mouse_comp_pos(win, &row, &col, &lnum);
1379 # ifdef FEAT_WINDOWS
1380 for (wp = firstwin; wp != win; wp = wp->w_next)
1381- ++n;
1382+ ++winnr;
1383 # endif
1384- vimvars[VV_MOUSE_WIN].vv_nr = n;
1385+ vimvars[VV_MOUSE_WIN].vv_nr = winnr;
1386 vimvars[VV_MOUSE_LNUM].vv_nr = lnum;
1387 vimvars[VV_MOUSE_COL].vv_nr = col + 1;
1388 }
[5f4a45c9]1389@@ -11284,13 +11348,25 @@
[76dd250]1390 typval_T *argvars;
1391 typval_T *rettv;
1392 {
1393+ int flags = WILD_SILENT|WILD_USE_NL;
1394 expand_T xpc;
1395+ int error = FALSE;
1396
1397- ExpandInit(&xpc);
1398- xpc.xp_context = EXPAND_FILES;
1399+ /* When the optional second argument is non-zero, don't remove matches
1400+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1401+ if (argvars[1].v_type != VAR_UNKNOWN
1402+ && get_tv_number_chk(&argvars[1], &error))
1403+ flags |= WILD_KEEP_ALL;
1404 rettv->v_type = VAR_STRING;
1405- rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1406- NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
1407+ if (!error)
1408+ {
1409+ ExpandInit(&xpc);
1410+ xpc.xp_context = EXPAND_FILES;
1411+ rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1412+ NULL, flags, WILD_ALL);
1413+ }
1414+ else
1415+ rettv->vval.v_string = NULL;
1416 }
1417
1418 /*
[5f4a45c9]1419@@ -11301,14 +11377,22 @@
[76dd250]1420 typval_T *argvars;
1421 typval_T *rettv;
1422 {
1423+ int flags = 0;
1424 char_u buf1[NUMBUFLEN];
1425 char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
1426+ int error = FALSE;
1427
1428+ /* When the optional second argument is non-zero, don't remove matches
1429+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1430+ if (argvars[2].v_type != VAR_UNKNOWN
1431+ && get_tv_number_chk(&argvars[2], &error))
1432+ flags |= WILD_KEEP_ALL;
1433 rettv->v_type = VAR_STRING;
1434- if (file == NULL)
1435+ if (file == NULL || error)
1436 rettv->vval.v_string = NULL;
1437 else
1438- rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
1439+ rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
1440+ flags);
1441 }
1442
1443 /*
[5f4a45c9]1444@@ -11782,6 +11866,10 @@
[76dd250]1445 n = has_patch(atoi((char *)name + 5));
1446 else if (STRICMP(name, "vim_starting") == 0)
1447 n = (starting != 0);
1448+#ifdef FEAT_MBYTE
1449+ else if (STRICMP(name, "multi_byte_encoding") == 0)
1450+ n = has_mbyte;
1451+#endif
1452 #if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32)
1453 else if (STRICMP(name, "balloon_multiline") == 0)
1454 n = multiline_balloon_available();
[5f4a45c9]1455@@ -15838,10 +15926,9 @@
[76dd250]1456 if (res == FAIL)
1457 res = ITEM_COMPARE_FAIL;
1458 else
1459- /* return value has wrong type */
1460 res = get_tv_number_chk(&rettv, &item_compare_func_err);
1461 if (item_compare_func_err)
1462- res = ITEM_COMPARE_FAIL;
1463+ res = ITEM_COMPARE_FAIL; /* return value has wrong type */
1464 clear_tv(&rettv);
1465 return res;
1466 }
[5f4a45c9]1467@@ -16590,8 +16677,11 @@
[76dd250]1468 p = highlight_has_attr(id, HL_INVERSE, modec);
1469 break;
1470
1471- case 's': /* standout */
1472- p = highlight_has_attr(id, HL_STANDOUT, modec);
1473+ case 's':
1474+ if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */
1475+ p = highlight_color(id, what, modec);
1476+ else /* standout */
1477+ p = highlight_has_attr(id, HL_STANDOUT, modec);
1478 break;
1479
1480 case 'u':
[5f4a45c9]1481@@ -16658,7 +16748,7 @@
[76dd250]1482 col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
1483
1484 if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
1485- && col >= 0 && col < (long)STRLEN(ml_get(lnum))
1486+ && col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum)))
1487 && rettv_list_alloc(rettv) != FAIL)
1488 {
1489 (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
[5f4a45c9]1490@@ -18097,14 +18187,28 @@
[76dd250]1491 }
1492
1493 /*
1494- * Set v:count, v:count1 and v:prevcount.
1495+ * Get List v: variable value. Caller must take care of reference count when
1496+ * needed.
1497+ */
1498+ list_T *
1499+get_vim_var_list(idx)
1500+ int idx;
1501+{
1502+ return vimvars[idx].vv_list;
1503+}
1504+
1505+/*
1506+ * Set v:count to "count" and v:count1 to "count1".
1507+ * When "set_prevcount" is TRUE first set v:prevcount from v:count.
1508 */
1509 void
1510-set_vcount(count, count1)
1511+set_vcount(count, count1, set_prevcount)
1512 long count;
1513 long count1;
1514+ int set_prevcount;
1515 {
1516- vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
1517+ if (set_prevcount)
1518+ vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
1519 vimvars[VV_COUNT].vv_nr = count;
1520 vimvars[VV_COUNT1].vv_nr = count1;
1521 }
[5f4a45c9]1522@@ -18132,6 +18236,20 @@
[76dd250]1523 }
1524
1525 /*
1526+ * Set List v: variable to "val".
1527+ */
1528+ void
1529+set_vim_var_list(idx, val)
1530+ int idx;
1531+ list_T *val;
1532+{
1533+ list_unref(vimvars[idx].vv_list);
1534+ vimvars[idx].vv_list = val;
1535+ if (val != NULL)
1536+ ++val->lv_refcount;
1537+}
1538+
1539+/*
1540 * Set v:register if needed.
1541 */
1542 void
[5f4a45c9]1543@@ -18868,7 +18986,7 @@
[1f22c7c]1544 dictitem_T *dict_var;
1545 {
1546 hash_init(&dict->dv_hashtab);
1547- dict->dv_refcount = 99999;
1548+ dict->dv_refcount = DO_NOT_FREE_CNT;
1549 dict_var->di_tv.vval.v_dict = dict;
1550 dict_var->di_tv.v_type = VAR_DICT;
1551 dict_var->di_tv.v_lock = VAR_FIXED;
[5f4a45c9]1552@@ -19205,6 +19323,8 @@
[1f22c7c]1553 * Copy the values from typval_T "from" to typval_T "to".
1554 * When needed allocates string or increases reference count.
1555 * Does not make a copy of a list or dict but copies the reference!
1556+ * It is OK for "from" and "to" to point to the same item. This is used to
1557+ * make a copy later.
1558 */
1559 static void
1560 copy_tv(from, to)
[5f4a45c9]1561@@ -19748,7 +19868,7 @@
1562 }
1563 }
1564 else
1565- emsg_funcname("E123: Undefined function: %s", name);
1566+ emsg_funcname(N_("E123: Undefined function: %s"), name);
1567 }
1568 goto ret_free;
1569 }
1570@@ -19792,7 +19912,7 @@
1571 : eval_isnamec(arg[j])))
1572 ++j;
1573 if (arg[j] != NUL)
1574- emsg_funcname(_(e_invarg2), arg);
[9a875fd]1575+ emsg_funcname((char *)e_invarg2, arg);
[5f4a45c9]1576 }
1577 }
1578
1579@@ -20064,7 +20184,7 @@
1580 v = find_var(name, &ht);
1581 if (v != NULL && v->di_tv.v_type == VAR_FUNC)
1582 {
1583- emsg_funcname("E707: Function name conflicts with variable: %s",
1584+ emsg_funcname(N_("E707: Function name conflicts with variable: %s"),
1585 name);
1586 goto erret;
1587 }
1588@@ -20079,7 +20199,7 @@
1589 }
1590 if (fp->uf_calls > 0)
1591 {
1592- emsg_funcname("E127: Cannot redefine function %s: It is in use",
1593+ emsg_funcname(N_("E127: Cannot redefine function %s: It is in use"),
1594 name);
1595 goto erret;
1596 }
1597@@ -20590,6 +20710,9 @@
[76dd250]1598 int st_len = 0;
1599
1600 todo = (int)func_hashtab.ht_used;
1601+ if (todo == 0)
1602+ return; /* nothing to dump */
1603+
1604 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
1605
1606 for (hi = func_hashtab.ht_array; todo > 0; ++hi)
[5f4a45c9]1607@@ -20638,6 +20761,8 @@
[76dd250]1608 prof_self_cmp);
1609 prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
1610 }
1611+
1612+ vim_free(sorttab);
1613 }
1614
1615 static void
[5f4a45c9]1616@@ -21012,7 +21137,7 @@
[1f22c7c]1617 char_u *save_sourcing_name;
1618 linenr_T save_sourcing_lnum;
1619 scid_T save_current_SID;
1620- funccall_T fc;
1621+ funccall_T *fc;
1622 int save_did_emsg;
1623 static int depth = 0;
1624 dictitem_T *v;
[5f4a45c9]1625@@ -21038,36 +21163,37 @@
[1f22c7c]1626
1627 line_breakcheck(); /* check for CTRL-C hit */
1628
1629- fc.caller = current_funccal;
1630- current_funccal = &fc;
1631- fc.func = fp;
1632- fc.rettv = rettv;
1633+ fc = (funccall_T *)alloc(sizeof(funccall_T));
1634+ fc->caller = current_funccal;
1635+ current_funccal = fc;
1636+ fc->func = fp;
1637+ fc->rettv = rettv;
1638 rettv->vval.v_number = 0;
1639- fc.linenr = 0;
1640- fc.returned = FALSE;
1641- fc.level = ex_nesting_level;
1642+ fc->linenr = 0;
1643+ fc->returned = FALSE;
1644+ fc->level = ex_nesting_level;
1645 /* Check if this function has a breakpoint. */
1646- fc.breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
1647- fc.dbg_tick = debug_tick;
1648+ fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
1649+ fc->dbg_tick = debug_tick;
1650
1651 /*
1652- * Note about using fc.fixvar[]: This is an array of FIXVAR_CNT variables
1653+ * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables
1654 * with names up to VAR_SHORT_LEN long. This avoids having to alloc/free
1655 * each argument variable and saves a lot of time.
1656 */
1657 /*
1658 * Init l: variables.
1659 */
1660- init_var_dict(&fc.l_vars, &fc.l_vars_var);
1661+ init_var_dict(&fc->l_vars, &fc->l_vars_var);
1662 if (selfdict != NULL)
1663 {
1664 /* Set l:self to "selfdict". Use "name" to avoid a warning from
1665 * some compiler that checks the destination size. */
1666- v = &fc.fixvar[fixvar_idx++].var;
1667+ v = &fc->fixvar[fixvar_idx++].var;
1668 name = v->di_key;
1669 STRCPY(name, "self");
1670 v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX;
1671- hash_add(&fc.l_vars.dv_hashtab, DI2HIKEY(v));
1672+ hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
1673 v->di_tv.v_type = VAR_DICT;
1674 v->di_tv.v_lock = 0;
1675 v->di_tv.vval.v_dict = selfdict;
[5f4a45c9]1676@@ -21079,28 +21205,31 @@
[1f22c7c]1677 * Set a:0 to "argcount".
1678 * Set a:000 to a list with room for the "..." arguments.
1679 */
1680- init_var_dict(&fc.l_avars, &fc.l_avars_var);
1681- add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
1682+ init_var_dict(&fc->l_avars, &fc->l_avars_var);
1683+ add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0",
[76dd250]1684 (varnumber_T)(argcount - fp->uf_args.ga_len));
[1f22c7c]1685- v = &fc.fixvar[fixvar_idx++].var;
1686- STRCPY(v->di_key, "000");
[76dd250]1687+ /* Use "name" to avoid a warning from some compiler that checks the
1688+ * destination size. */
[1f22c7c]1689+ v = &fc->fixvar[fixvar_idx++].var;
[76dd250]1690+ name = v->di_key;
1691+ STRCPY(name, "000");
1692 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
[1f22c7c]1693- hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
1694+ hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
[76dd250]1695 v->di_tv.v_type = VAR_LIST;
[1f22c7c]1696 v->di_tv.v_lock = VAR_FIXED;
1697- v->di_tv.vval.v_list = &fc.l_varlist;
1698- vim_memset(&fc.l_varlist, 0, sizeof(list_T));
1699- fc.l_varlist.lv_refcount = 99999;
1700- fc.l_varlist.lv_lock = VAR_FIXED;
1701+ v->di_tv.vval.v_list = &fc->l_varlist;
1702+ vim_memset(&fc->l_varlist, 0, sizeof(list_T));
1703+ fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
1704+ fc->l_varlist.lv_lock = VAR_FIXED;
1705
1706 /*
1707 * Set a:firstline to "firstline" and a:lastline to "lastline".
1708 * Set a:name to named arguments.
1709 * Set a:N to the "..." arguments.
1710 */
1711- add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "firstline",
1712+ add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline",
1713 (varnumber_T)firstline);
1714- add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "lastline",
1715+ add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline",
1716 (varnumber_T)lastline);
1717 for (i = 0; i < argcount; ++i)
1718 {
[5f4a45c9]1719@@ -21116,7 +21245,7 @@
[1f22c7c]1720 }
1721 if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN)
1722 {
1723- v = &fc.fixvar[fixvar_idx++].var;
1724+ v = &fc->fixvar[fixvar_idx++].var;
1725 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
1726 }
1727 else
[5f4a45c9]1728@@ -21128,7 +21257,7 @@
[1f22c7c]1729 v->di_flags = DI_FLAGS_RO;
1730 }
1731 STRCPY(v->di_key, name);
1732- hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
1733+ hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
1734
1735 /* Note: the values are copied directly to avoid alloc/free.
1736 * "argvars" must have VAR_FIXED for v_lock. */
[5f4a45c9]1737@@ -21137,9 +21266,9 @@
[1f22c7c]1738
1739 if (ai >= 0 && ai < MAX_FUNC_ARGS)
1740 {
1741- list_append(&fc.l_varlist, &fc.l_listitems[ai]);
1742- fc.l_listitems[ai].li_tv = argvars[i];
1743- fc.l_listitems[ai].li_tv.v_lock = VAR_FIXED;
1744+ list_append(&fc->l_varlist, &fc->l_listitems[ai]);
1745+ fc->l_listitems[ai].li_tv = argvars[i];
1746+ fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED;
1747 }
1748 }
1749
[5f4a45c9]1750@@ -21204,7 +21333,7 @@
[76dd250]1751 if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
1752 func_do_profile(fp);
1753 if (fp->uf_profiling
1754- || (fc.caller != NULL && &fc.caller->func->uf_profiling))
[1f22c7c]1755+ || (fc->caller != NULL && fc->caller->func->uf_profiling))
[76dd250]1756 {
1757 ++fp->uf_tm_count;
1758 profile_start(&call_start);
[5f4a45c9]1759@@ -21220,7 +21349,7 @@
[1f22c7c]1760 did_emsg = FALSE;
1761
1762 /* call do_cmdline() to execute the lines */
1763- do_cmdline(NULL, get_func_line, (void *)&fc,
1764+ do_cmdline(NULL, get_func_line, (void *)fc,
1765 DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
1766
1767 --RedrawingDisabled;
[5f4a45c9]1768@@ -21235,16 +21364,16 @@
[76dd250]1769
1770 #ifdef FEAT_PROFILE
1771 if (do_profiling == PROF_YES && (fp->uf_profiling
1772- || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
[1f22c7c]1773+ || (fc->caller != NULL && fc->caller->func->uf_profiling)))
[76dd250]1774 {
1775 profile_end(&call_start);
1776 profile_sub_wait(&wait_start, &call_start);
1777 profile_add(&fp->uf_tm_total, &call_start);
1778 profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
1779- if (fc.caller != NULL && &fc.caller->func->uf_profiling)
[1f22c7c]1780+ if (fc->caller != NULL && fc->caller->func->uf_profiling)
[76dd250]1781 {
[1f22c7c]1782- profile_add(&fc.caller->func->uf_tm_children, &call_start);
1783- profile_add(&fc.caller->func->uf_tml_children, &call_start);
1784+ profile_add(&fc->caller->func->uf_tm_children, &call_start);
1785+ profile_add(&fc->caller->func->uf_tml_children, &call_start);
1786 }
1787 }
1788 #endif
[5f4a45c9]1789@@ -21257,9 +21386,9 @@
[1f22c7c]1790
1791 if (aborting())
1792 smsg((char_u *)_("%s aborted"), sourcing_name);
1793- else if (fc.rettv->v_type == VAR_NUMBER)
1794+ else if (fc->rettv->v_type == VAR_NUMBER)
1795 smsg((char_u *)_("%s returning #%ld"), sourcing_name,
1796- (long)fc.rettv->vval.v_number);
1797+ (long)fc->rettv->vval.v_number);
1798 else
1799 {
1800 char_u buf[MSG_BUF_LEN];
[5f4a45c9]1801@@ -21270,7 +21399,7 @@
[1f22c7c]1802 /* The value may be very long. Skip the middle part, so that we
1803 * have some idea how it starts and ends. smsg() would always
1804 * truncate it at the end. */
1805- s = tv2string(fc.rettv, &tofree, numbuf2, 0);
1806+ s = tv2string(fc->rettv, &tofree, numbuf2, 0);
1807 if (s != NULL)
1808 {
1809 trunc_string(s, buf, MSG_BUF_CLEN);
[5f4a45c9]1810@@ -21306,14 +21435,84 @@
[1f22c7c]1811 }
1812
1813 did_emsg |= save_did_emsg;
1814- current_funccal = fc.caller;
1815+ current_funccal = fc->caller;
1816+ --depth;
1817
1818- /* The a: variables typevals were not allocated, only free the allocated
1819- * variables. */
1820- vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE);
1821+ /* if the a:000 list and the a: dict are not referenced we can free the
1822+ * funccall_T and what's in it. */
1823+ if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT
1824+ && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT
1825+ && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT)
1826+ {
1827+ free_funccal(fc, FALSE);
1828+ }
1829+ else
1830+ {
1831+ hashitem_T *hi;
1832+ listitem_T *li;
1833+ int todo;
1834
1835- vars_clear(&fc.l_vars.dv_hashtab); /* free all l: variables */
1836- --depth;
1837+ /* "fc" is still in use. This can happen when returning "a:000" or
1838+ * assigning "l:" to a global variable.
1839+ * Link "fc" in the list for garbage collection later. */
1840+ fc->caller = previous_funccal;
1841+ previous_funccal = fc;
1842+
1843+ /* Make a copy of the a: variables, since we didn't do that above. */
1844+ todo = (int)fc->l_avars.dv_hashtab.ht_used;
1845+ for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
1846+ {
1847+ if (!HASHITEM_EMPTY(hi))
1848+ {
1849+ --todo;
1850+ v = HI2DI(hi);
1851+ copy_tv(&v->di_tv, &v->di_tv);
1852+ }
1853+ }
1854+
1855+ /* Make a copy of the a:000 items, since we didn't do that above. */
1856+ for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
1857+ copy_tv(&li->li_tv, &li->li_tv);
1858+ }
1859+}
1860+
1861+/*
1862+ * Return TRUE if items in "fc" do not have "copyID". That means they are not
[5f4a45c9]1863+ * referenced from anywhere.
[1f22c7c]1864+ */
1865+ static int
1866+can_free_funccal(fc, copyID)
1867+ funccall_T *fc;
1868+ int copyID;
1869+{
1870+ return (fc->l_varlist.lv_copyID != copyID
1871+ && fc->l_vars.dv_copyID != copyID
1872+ && fc->l_avars.dv_copyID != copyID);
1873+}
1874+
1875+/*
1876+ * Free "fc" and what it contains.
1877+ */
1878+ static void
1879+free_funccal(fc, free_val)
1880+ funccall_T *fc;
1881+ int free_val; /* a: vars were allocated */
1882+{
1883+ listitem_T *li;
1884+
1885+ /* The a: variables typevals may not have been allocated, only free the
1886+ * allocated variables. */
1887+ vars_clear_ext(&fc->l_avars.dv_hashtab, free_val);
1888+
1889+ /* free all l: variables */
1890+ vars_clear(&fc->l_vars.dv_hashtab);
1891+
1892+ /* Free the a:000 variables if they were allocated. */
1893+ if (free_val)
1894+ for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
1895+ clear_tv(&li->li_tv);
1896+
1897+ vim_free(fc);
1898 }
1899
1900 /*
[5f4a45c9]1901@@ -21886,6 +22085,62 @@
[76dd250]1902 }
1903 }
1904
1905+/*
1906+ * List v:oldfiles in a nice way.
1907+ */
1908+/*ARGSUSED*/
1909+ void
1910+ex_oldfiles(eap)
1911+ exarg_T *eap;
1912+{
1913+ list_T *l = vimvars[VV_OLDFILES].vv_list;
1914+ listitem_T *li;
1915+ int nr = 0;
1916+
1917+ if (l == NULL)
1918+ msg((char_u *)_("No old files"));
1919+ else
1920+ {
1921+ msg_start();
1922+ msg_scroll = TRUE;
1923+ for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
1924+ {
1925+ msg_outnum((long)++nr);
1926+ MSG_PUTS(": ");
1927+ msg_outtrans(get_tv_string(&li->li_tv));
1928+ msg_putchar('\n');
1929+ out_flush(); /* output one line at a time */
1930+ ui_breakcheck();
1931+ }
1932+ /* Assume "got_int" was set to truncate the listing. */
1933+ got_int = FALSE;
1934+
1935+#ifdef FEAT_BROWSE_CMD
1936+ if (cmdmod.browse)
1937+ {
1938+ quit_more = FALSE;
1939+ nr = prompt_for_number(FALSE);
1940+ msg_starthere();
1941+ if (nr > 0)
1942+ {
1943+ char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
1944+ (long)nr);
1945+
1946+ if (p != NULL)
1947+ {
1948+ p = expand_env_save(p);
1949+ eap->arg = p;
1950+ eap->cmdidx = CMD_edit;
1951+ cmdmod.browse = FALSE;
1952+ do_exedit(eap, NULL);
1953+ vim_free(p);
1954+ }
1955+ }
1956+ }
1957+#endif
1958+ }
1959+}
1960+
1961 #endif /* FEAT_EVAL */
1962
1963
[5f4a45c9]1964diff -Naur vim72.orig/src/ex_cmds2.c vim72/src/ex_cmds2.c
1965--- vim72.orig/src/ex_cmds2.c 2008-07-13 09:18:22.000000000 -0700
[9a875fd]1966+++ vim72/src/ex_cmds2.c 2009-02-07 22:18:15.152545887 -0800
1967@@ -2842,6 +2842,7 @@
1968 linenr_T save_sourcing_lnum;
1969 char_u *p;
1970 char_u *fname_exp;
1971+ char_u *firstline = NULL;
1972 int retval = FAIL;
1973 #ifdef FEAT_EVAL
1974 scid_T save_current_SID;
1975@@ -2992,23 +2993,6 @@
1976
1977 cookie.level = ex_nesting_level;
1978 #endif
1979-#ifdef FEAT_MBYTE
1980- cookie.conv.vc_type = CONV_NONE; /* no conversion */
1981-
1982- /* Try reading the first few bytes to check for a UTF-8 BOM. */
1983- {
1984- char_u buf[3];
1985-
1986- if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)
1987- == (size_t)3
1988- && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
1989- /* Found BOM, setup conversion and skip over it. */
1990- convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
1991- else
1992- /* No BOM found, rewind. */
1993- fseek(cookie.fp, 0L, SEEK_SET);
1994- }
1995-#endif
1996
1997 /*
1998 * Keep the sourcing name/lnum, for recursive calls.
1999@@ -3018,6 +3002,27 @@
2000 save_sourcing_lnum = sourcing_lnum;
2001 sourcing_lnum = 0;
2002
2003+#ifdef FEAT_MBYTE
2004+ cookie.conv.vc_type = CONV_NONE; /* no conversion */
2005+
2006+ /* Read the first line so we can check for a UTF-8 BOM. */
2007+ firstline = getsourceline(0, (void *)&cookie, 0);
2008+ if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
2009+ && firstline[1] == 0xbb && firstline[2] == 0xbf)
2010+ {
2011+ /* Found BOM; setup conversion, skip over BOM and recode the line. */
2012+ convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
2013+ p = string_convert(&cookie.conv, firstline + 3, NULL);
2014+ if (p == NULL)
2015+ p = vim_strsave(firstline + 3);
2016+ if (p != NULL)
2017+ {
2018+ vim_free(firstline);
2019+ firstline = p;
2020+ }
2021+ }
2022+#endif
2023+
2024 #ifdef STARTUPTIME
2025 time_push(&tv_rel, &tv_start);
2026 #endif
2027@@ -3111,9 +3116,8 @@
2028 /*
2029 * Call do_cmdline, which will call getsourceline() to get the lines.
2030 */
2031- do_cmdline(NULL, getsourceline, (void *)&cookie,
2032+ do_cmdline(firstline, getsourceline, (void *)&cookie,
2033 DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
2034-
2035 retval = OK;
2036
2037 #ifdef FEAT_PROFILE
2038@@ -3145,8 +3149,8 @@
[5f4a45c9]2039 verbose_leave();
2040 }
2041 #ifdef STARTUPTIME
2042- vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname);
2043- time_msg(IObuff, &tv_start);
2044+ vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
2045+ time_msg((char *)IObuff, &tv_start);
2046 time_pop(&tv_rel);
2047 #endif
2048
[9a875fd]2049@@ -3171,6 +3175,7 @@
2050 #endif
2051 fclose(cookie.fp);
2052 vim_free(cookie.nextline);
2053+ vim_free(firstline);
2054 #ifdef FEAT_MBYTE
2055 convert_setup(&cookie.conv, NULL, NULL);
2056 #endif
[76dd250]2057diff -Naur vim72.orig/src/ex_cmds.c vim72/src/ex_cmds.c
2058--- vim72.orig/src/ex_cmds.c 2008-08-04 12:15:00.000000000 -0700
[9a875fd]2059+++ vim72/src/ex_cmds.c 2009-02-07 22:17:58.717640174 -0800
[76dd250]2060@@ -24,7 +24,7 @@
2061 static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out));
2062 #ifdef FEAT_VIMINFO
2063 static char_u *viminfo_filename __ARGS((char_u *));
2064-static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read));
2065+static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags));
2066 static int viminfo_encoding __ARGS((vir_T *virp));
2067 static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing));
2068 #endif
[7352c10]2069@@ -49,6 +49,7 @@
2070 exarg_T *eap;
2071 {
2072 int c;
2073+ int cval;
2074 char buf1[20];
2075 char buf2[20];
2076 char_u buf3[7];
2077@@ -75,6 +76,10 @@
2078 {
2079 if (c == NL) /* NUL is stored as NL */
2080 c = NUL;
2081+ if (c == CAR && get_fileformat(curbuf) == EOL_MAC)
2082+ cval = NL; /* NL is stored as CR */
2083+ else
2084+ cval = c;
2085 if (vim_isprintc_strict(c) && (c < ' '
2086 #ifndef EBCDIC
2087 || c > '~'
2088@@ -94,7 +99,7 @@
2089 buf2[0] = NUL;
2090 vim_snprintf((char *)IObuff, IOSIZE,
2091 _("<%s>%s%s %d, Hex %02x, Octal %03o"),
2092- transchar(c), buf1, buf2, c, c, c);
2093+ transchar(c), buf1, buf2, cval, cval, cval);
2094 #ifdef FEAT_MBYTE
2095 if (enc_utf8)
2096 c = cc[ci++];
2097@@ -1676,14 +1681,12 @@
[76dd250]2098
2099 /*
2100 * read_viminfo() -- Read the viminfo file. Registers etc. which are already
2101- * set are not over-written unless force is TRUE. -- webb
2102+ * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb
2103 */
2104 int
2105-read_viminfo(file, want_info, want_marks, forceit)
2106- char_u *file;
2107- int want_info;
2108- int want_marks;
2109- int forceit;
2110+read_viminfo(file, flags)
2111+ char_u *file; /* file name or NULL to use default name */
2112+ int flags; /* VIF_WANT_INFO et al. */
2113 {
2114 FILE *fp;
2115 char_u *fname;
[7352c10]2116@@ -1691,7 +1694,7 @@
[76dd250]2117 if (no_viminfo())
2118 return FAIL;
2119
2120- fname = viminfo_filename(file); /* may set to default if NULL */
2121+ fname = viminfo_filename(file); /* get file name in allocated buffer */
2122 if (fname == NULL)
2123 return FAIL;
2124 fp = mch_fopen((char *)fname, READBIN);
[7352c10]2125@@ -1701,8 +1704,9 @@
[76dd250]2126 verbose_enter();
2127 smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
2128 fname,
2129- want_info ? _(" info") : "",
2130- want_marks ? _(" marks") : "",
2131+ (flags & VIF_WANT_INFO) ? _(" info") : "",
2132+ (flags & VIF_WANT_MARKS) ? _(" marks") : "",
2133+ (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "",
2134 fp == NULL ? _(" FAILED") : "");
2135 verbose_leave();
2136 }
[7352c10]2137@@ -1712,10 +1716,9 @@
[76dd250]2138 return FAIL;
2139
2140 viminfo_errcnt = 0;
2141- do_viminfo(fp, NULL, want_info, want_marks, forceit);
2142+ do_viminfo(fp, NULL, flags);
2143
2144 fclose(fp);
2145-
2146 return OK;
2147 }
2148
[7352c10]2149@@ -1943,7 +1946,7 @@
[76dd250]2150 * root.
2151 */
2152 if (fp_out != NULL)
2153- (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
2154+ ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
2155 #endif
2156 }
2157 }
[7352c10]2158@@ -1968,7 +1971,7 @@
[76dd250]2159 }
2160
2161 viminfo_errcnt = 0;
2162- do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);
2163+ do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS));
2164
2165 fclose(fp_out); /* errors are ignored !? */
2166 if (fp_in != NULL)
[7352c10]2167@@ -2041,12 +2044,10 @@
[76dd250]2168 * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
2169 */
2170 static void
2171-do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
2172+do_viminfo(fp_in, fp_out, flags)
2173 FILE *fp_in;
2174 FILE *fp_out;
2175- int want_info;
2176- int want_marks;
2177- int force_read;
2178+ int flags;
2179 {
2180 int count = 0;
2181 int eof = FALSE;
[7352c10]2182@@ -2061,8 +2062,9 @@
[76dd250]2183
2184 if (fp_in != NULL)
2185 {
2186- if (want_info)
2187- eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL);
2188+ if (flags & VIF_WANT_INFO)
2189+ eof = read_viminfo_up_to_marks(&vir,
2190+ flags & VIF_FORCEIT, fp_out != NULL);
2191 else
2192 /* Skip info, find start of marks */
2193 while (!(eof = viminfo_readline(&vir))
[7352c10]2194@@ -2092,8 +2094,9 @@
[76dd250]2195 write_viminfo_bufferlist(fp_out);
2196 count = write_viminfo_marks(fp_out);
2197 }
2198- if (fp_in != NULL && want_marks)
2199- copy_viminfo_marks(&vir, fp_out, count, eof);
2200+ if (fp_in != NULL
2201+ && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
2202+ copy_viminfo_marks(&vir, fp_out, count, eof, flags);
2203
2204 vim_free(vir.vir_line);
2205 #ifdef FEAT_MBYTE
[9a875fd]2206@@ -2414,8 +2417,8 @@
2207 cursor_on(); /* msg_start() switches it off */
2208 out_flush();
2209 silent_mode = save_silent;
2210- info_message = FALSE;
2211 }
2212+ info_message = FALSE;
2213 }
2214
2215 /*
[7352c10]2216@@ -5059,6 +5062,7 @@
[76dd250]2217
2218 if (did_sub)
2219 ++sub_nlines;
2220+ vim_free(new_start); /* for when substitute was cancelled */
2221 vim_free(sub_firstline); /* free the copy of the original line */
2222 sub_firstline = NULL;
2223 }
2224diff -Naur vim72.orig/src/ex_cmds.h vim72/src/ex_cmds.h
2225--- vim72.orig/src/ex_cmds.h 2008-06-21 11:47:57.000000000 -0700
[9a875fd]2226+++ vim72/src/ex_cmds.h 2009-02-07 22:14:49.094844532 -0800
[76dd250]2227@@ -278,7 +278,7 @@
2228 EX(CMD_crewind, "crewind", ex_cc,
2229 RANGE|NOTADR|COUNT|TRLBAR|BANG),
2230 EX(CMD_cscope, "cscope", do_cscope,
2231- EXTRA|NOTRLCOM|SBOXOK|XFILE),
2232+ EXTRA|NOTRLCOM|XFILE),
2233 EX(CMD_cstag, "cstag", do_cstag,
2234 BANG|TRLBAR|WORD1),
2235 EX(CMD_cunmap, "cunmap", ex_unmap,
2236@@ -506,7 +506,7 @@
2237 EX(CMD_lclose, "lclose", ex_cclose,
2238 RANGE|NOTADR|COUNT|TRLBAR),
2239 EX(CMD_lcscope, "lcscope", do_cscope,
2240- EXTRA|NOTRLCOM|SBOXOK|XFILE),
2241+ EXTRA|NOTRLCOM|XFILE),
2242 EX(CMD_left, "left", ex_align,
2243 TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
2244 EX(CMD_leftabove, "leftabove", ex_wrongmodifier,
2245@@ -635,6 +635,8 @@
2246 RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2247 EX(CMD_noremap, "noremap", ex_map,
2248 BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2249+EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier,
2250+ NEEDARG|EXTRA|NOTRLCOM),
2251 EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch,
2252 TRLBAR|SBOXOK|CMDWIN),
2253 EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate,
2254@@ -651,6 +653,8 @@
2255 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2256 EX(CMD_open, "open", ex_open,
2257 RANGE|EXTRA),
2258+EX(CMD_oldfiles, "oldfiles", ex_oldfiles,
2259+ BANG|TRLBAR|SBOXOK|CMDWIN),
2260 EX(CMD_omap, "omap", ex_map,
2261 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2262 EX(CMD_omapclear, "omapclear", ex_mapclear,
2263@@ -802,7 +806,7 @@
2264 EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
2265 WORD1|TRLBAR|CMDWIN),
2266 EX(CMD_scscope, "scscope", do_scscope,
2267- EXTRA|NOTRLCOM|SBOXOK),
2268+ EXTRA|NOTRLCOM),
2269 EX(CMD_set, "set", ex_set,
2270 TRLBAR|EXTRA|CMDWIN|SBOXOK),
2271 EX(CMD_setfiletype, "setfiletype", ex_setfiletype,
2272diff -Naur vim72.orig/src/ex_docmd.c vim72/src/ex_docmd.c
2273--- vim72.orig/src/ex_docmd.c 2008-07-26 04:51:05.000000000 -0700
[9a875fd]2274+++ vim72/src/ex_docmd.c 2009-02-07 22:17:42.541134237 -0800
[76dd250]2275@@ -364,6 +364,7 @@
2276 # define ex_function ex_ni
2277 # define ex_delfunction ex_ni
2278 # define ex_return ex_ni
2279+# define ex_oldfiles ex_ni
2280 #endif
2281 static char_u *arg_all __ARGS((void));
2282 #ifdef FEAT_SESSION
2283@@ -1770,7 +1771,7 @@
2284 }
2285 if (checkforcmd(&ea.cmd, "browse", 3))
2286 {
2287-#ifdef FEAT_BROWSE
2288+#ifdef FEAT_BROWSE_CMD
2289 cmdmod.browse = TRUE;
2290 #endif
2291 continue;
2292@@ -2978,6 +2979,7 @@
2293 {"keepmarks", 3, FALSE},
2294 {"leftabove", 5, FALSE},
2295 {"lockmarks", 3, FALSE},
2296+ {"noautocmd", 3, FALSE},
2297 {"rightbelow", 6, FALSE},
2298 {"sandbox", 3, FALSE},
2299 {"silent", 3, FALSE},
2300@@ -3608,6 +3610,7 @@
2301 return set_context_in_autocmd(xp, arg, FALSE);
2302
2303 case CMD_doautocmd:
2304+ case CMD_doautoall:
2305 return set_context_in_autocmd(xp, arg, TRUE);
2306 #endif
2307 case CMD_set:
[5f4a45c9]2308@@ -5479,6 +5482,9 @@
2309 return OK;
2310 }
2311
2312+/*
2313+ * ":command ..."
2314+ */
2315 static void
2316 ex_command(eap)
2317 exarg_T *eap;
2318@@ -5911,6 +5917,7 @@
2319
2320 char_u *start;
2321 char_u *end;
2322+ char_u *ksp;
2323 size_t len, totlen;
2324
2325 size_t split_len = 0;
2326@@ -5927,16 +5934,51 @@
2327
2328 /*
2329 * Replace <> in the command by the arguments.
2330+ * First round: "buf" is NULL, compute length, allocate "buf".
2331+ * Second round: copy result into "buf".
2332 */
2333 buf = NULL;
2334 for (;;)
2335 {
2336- p = cmd->uc_rep;
2337- q = buf;
2338+ p = cmd->uc_rep; /* source */
2339+ q = buf; /* destinateion */
2340 totlen = 0;
2341- while ((start = vim_strchr(p, '<')) != NULL
2342- && (end = vim_strchr(start + 1, '>')) != NULL)
2343+
2344+ for (;;)
2345 {
2346+ start = vim_strchr(p, '<');
2347+ if (start != NULL)
2348+ end = vim_strchr(start + 1, '>');
2349+ if (buf != NULL)
2350+ {
2351+ ksp = vim_strchr(p, K_SPECIAL);
2352+ if (ksp != NULL && (start == NULL || ksp < start || end == NULL)
2353+ && ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER)
2354+# ifdef FEAT_GUI
2355+ || (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI)
2356+# endif
2357+ ))
2358+ {
2359+ /* K_SPECIAL han been put in the buffer as K_SPECIAL
2360+ * KS_SPECIAL KE_FILLER, like for mappings, but
2361+ * do_cmdline() doesn't handle that, so convert it back.
2362+ * Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */
2363+ len = ksp - p;
2364+ if (len > 0)
2365+ {
2366+ mch_memmove(q, p, len);
2367+ q += len;
2368+ }
2369+ *q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI;
2370+ p = ksp + 3;
2371+ continue;
2372+ }
2373+ }
2374+
2375+ /* break if there no <item> is found */
2376+ if (start == NULL || end == NULL)
2377+ break;
2378+
2379 /* Include the '>' */
2380 ++end;
2381
2382@@ -8749,8 +8791,8 @@
[76dd250]2383 else if (*dirnow != NUL
2384 && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
2385 {
2386- (void)mch_chdir((char *)globaldir);
2387- shorten_fnames(TRUE);
2388+ if (mch_chdir((char *)globaldir) == OK)
2389+ shorten_fnames(TRUE);
2390 }
2391
2392 failed |= (makeopens(fd, dirnow) == FAIL);
[5f4a45c9]2393@@ -9506,24 +9548,50 @@
[76dd250]2394 break;
2395 }
2396 s = src + 1;
2397+ if (*s == '<') /* "#<99" uses v:oldfiles */
2398+ ++s;
2399 i = (int)getdigits(&s);
2400 *usedlen = (int)(s - src); /* length of what we expand */
2401
2402- buf = buflist_findnr(i);
2403- if (buf == NULL)
2404+ if (src[1] == '<')
2405 {
2406- *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
2407+ if (*usedlen < 2)
2408+ {
2409+ /* Should we give an error message for #<text? */
2410+ *usedlen = 1;
2411+ return NULL;
2412+ }
2413+#ifdef FEAT_EVAL
2414+ result = list_find_str(get_vim_var_list(VV_OLDFILES),
2415+ (long)i);
2416+ if (result == NULL)
2417+ {
2418+ *errormsg = (char_u *)"";
2419+ return NULL;
2420+ }
2421+#else
2422+ *errormsg = (char_u *)_("E809: #< is not available without the +eval feature");
2423 return NULL;
2424+#endif
2425 }
2426- if (lnump != NULL)
2427- *lnump = ECMD_LAST;
2428- if (buf->b_fname == NULL)
2429+ else
2430 {
2431- result = (char_u *)"";
2432- valid = 0; /* Must have ":p:h" to be valid */
2433+ buf = buflist_findnr(i);
2434+ if (buf == NULL)
2435+ {
2436+ *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
2437+ return NULL;
2438+ }
2439+ if (lnump != NULL)
2440+ *lnump = ECMD_LAST;
2441+ if (buf->b_fname == NULL)
2442+ {
2443+ result = (char_u *)"";
2444+ valid = 0; /* Must have ":p:h" to be valid */
2445+ }
2446+ else
2447+ result = buf->b_fname;
2448 }
2449- else
2450- result = buf->b_fname;
2451 break;
2452
2453 #ifdef FEAT_SEARCHPATH
[5f4a45c9]2454@@ -9541,6 +9609,15 @@
[76dd250]2455 #ifdef FEAT_AUTOCMD
2456 case SPEC_AFILE: /* file name for autocommand */
2457 result = autocmd_fname;
2458+ if (result != NULL && !autocmd_fname_full)
2459+ {
2460+ /* Still need to turn the fname into a full path. It is
2461+ * postponed to avoid a delay when <afile> is not used. */
2462+ autocmd_fname_full = TRUE;
2463+ result = FullName_save(autocmd_fname, FALSE);
2464+ vim_free(autocmd_fname);
2465+ autocmd_fname = result;
2466+ }
2467 if (result == NULL)
2468 {
2469 *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
[5f4a45c9]2470@@ -10067,7 +10144,7 @@
[76dd250]2471 */
2472 if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
2473 || put_line(fd, "if file_readable(s:sx)") == FAIL
2474- || put_line(fd, " exe \"source \" . s:sx") == FAIL
2475+ || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL
2476 || put_line(fd, "endif") == FAIL)
2477 return FAIL;
2478
[5f4a45c9]2479@@ -10689,7 +10766,8 @@
[76dd250]2480 p_viminfo = (char_u *)"'100";
2481 if (eap->cmdidx == CMD_rviminfo)
2482 {
2483- if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL)
2484+ if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS
2485+ | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL)
2486 EMSG(_("E195: Cannot open viminfo file for reading"));
2487 }
2488 else
2489diff -Naur vim72.orig/src/ex_getln.c vim72/src/ex_getln.c
2490--- vim72.orig/src/ex_getln.c 2008-08-08 02:31:33.000000000 -0700
[9a875fd]2491+++ vim72/src/ex_getln.c 2009-02-07 22:15:46.007933510 -0800
[76dd250]2492@@ -31,6 +31,8 @@
2493 int cmdattr; /* attributes for prompt */
2494 int overstrike; /* Typing mode on the command line. Shared by
2495 getcmdline() and put_on_cmdline(). */
2496+ expand_T *xpc; /* struct being used for expansion, xp_pattern
2497+ may point into cmdbuff */
2498 int xp_context; /* type of expansion */
2499 # ifdef FEAT_EVAL
2500 char_u *xp_arg; /* user-defined expansion arg */
2501@@ -38,7 +40,11 @@
2502 # endif
2503 };
2504
2505-static struct cmdline_info ccline; /* current cmdline_info */
2506+/* The current cmdline_info. It is initialized in getcmdline() and after that
2507+ * used by other functions. When invoking getcmdline() recursively it needs
2508+ * to be saved with save_cmdline() and restored with restore_cmdline().
2509+ * TODO: make it local to getcmdline() and pass it around. */
2510+static struct cmdline_info ccline;
2511
2512 static int cmd_showtail; /* Only show path tail in lists ? */
2513
2514@@ -238,6 +244,7 @@
2515 }
2516
2517 ExpandInit(&xpc);
2518+ ccline.xpc = &xpc;
2519
2520 #ifdef FEAT_RIGHTLEFT
2521 if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
2522@@ -408,9 +415,10 @@
2523 #endif
2524
2525 /*
2526- * <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>).
2527+ * When there are matching completions to select <S-Tab> works like
2528+ * CTRL-P (unless 'wc' is <S-Tab>).
2529 */
2530- if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)
2531+ if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
2532 c = Ctrl_P;
2533
2534 #ifdef FEAT_WILDMENU
2535@@ -1513,6 +1521,7 @@
2536 int old_firstc;
2537
2538 vim_free(ccline.cmdbuff);
2539+ xpc.xp_context = EXPAND_NOTHING;
2540 if (hiscnt == hislen)
2541 p = lookfor; /* back to the old one */
2542 else
2543@@ -1839,6 +1848,7 @@
2544 #endif
2545
2546 ExpandCleanup(&xpc);
2547+ ccline.xpc = NULL;
2548
2549 #ifdef FEAT_SEARCH_EXTRA
2550 if (did_incsearch)
2551@@ -2508,6 +2518,20 @@
2552 }
2553 mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
2554 vim_free(p);
2555+
2556+ if (ccline.xpc != NULL
2557+ && ccline.xpc->xp_pattern != NULL
2558+ && ccline.xpc->xp_context != EXPAND_NOTHING
2559+ && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
2560+ {
2561+ int i = (int)(ccline.xpc->xp_pattern - p);
2562+
2563+ /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
2564+ * to point into the newly allocated memory. */
2565+ if (i >= 0 && i <= ccline.cmdlen)
2566+ ccline.xpc->xp_pattern = ccline.cmdbuff + i;
2567+ }
2568+
2569 return OK;
2570 }
2571
2572@@ -2875,6 +2899,7 @@
2573 prev_ccline = ccline;
2574 ccline.cmdbuff = NULL;
2575 ccline.cmdprompt = NULL;
2576+ ccline.xpc = NULL;
2577 }
2578
2579 /*
2580@@ -3582,6 +3607,7 @@
2581 ExpandInit(xp)
2582 expand_T *xp;
2583 {
2584+ xp->xp_pattern = NULL;
2585 xp->xp_backslash = XP_BS_NONE;
2586 #ifndef BACKSLASH_IN_FILENAME
2587 xp->xp_shell = FALSE;
2588@@ -4871,7 +4897,7 @@
2589 if (s == NULL)
2590 return FAIL;
2591 sprintf((char *)s, "%s/%s*.vim", dirname, pat);
2592- all = globpath(p_rtp, s);
2593+ all = globpath(p_rtp, s, 0);
2594 vim_free(s);
2595 if (all == NULL)
2596 return FAIL;
2597@@ -4912,9 +4938,10 @@
2598 * newlines. Returns NULL for an error or no matches.
2599 */
2600 char_u *
2601-globpath(path, file)
2602+globpath(path, file, expand_options)
2603 char_u *path;
2604 char_u *file;
2605+ int expand_options;
2606 {
2607 expand_T xpc;
2608 char_u *buf;
2609@@ -4943,10 +4970,10 @@
2610 {
2611 add_pathsep(buf);
2612 STRCAT(buf, file);
2613- if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
2614- && num_p > 0)
2615+ if (ExpandFromContext(&xpc, buf, &num_p, &p,
2616+ WILD_SILENT|expand_options) != FAIL && num_p > 0)
2617 {
2618- ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
2619+ ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
2620 for (len = 0, i = 0; i < num_p; ++i)
2621 len += (int)STRLEN(p[i]) + 1;
2622
2623diff -Naur vim72.orig/src/feature.h vim72/src/feature.h
2624--- vim72.orig/src/feature.h 2008-08-06 04:00:39.000000000 -0700
[9a875fd]2625+++ vim72/src/feature.h 2009-02-07 22:14:49.098945384 -0800
[76dd250]2626@@ -767,9 +767,13 @@
2627
2628 /*
2629 * +browse ":browse" command.
2630+ * or just the ":browse" command modifier
2631 */
2632-#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))
2633-# define FEAT_BROWSE
2634+#if defined(FEAT_NORMAL)
2635+# define FEAT_BROWSE_CMD
2636+# 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)
2637+# define FEAT_BROWSE
2638+# endif
2639 #endif
2640
2641 /*
2642diff -Naur vim72.orig/src/fileio.c vim72/src/fileio.c
2643--- vim72.orig/src/fileio.c 2008-08-06 04:01:03.000000000 -0700
[9a875fd]2644+++ vim72/src/fileio.c 2009-02-07 22:17:04.228567398 -0800
[76dd250]2645@@ -932,7 +932,10 @@
2646 else
2647 {
2648 if (eap != NULL && eap->force_ff != 0)
2649+ {
2650 fileformat = get_fileformat_force(curbuf, eap);
2651+ try_unix = try_dos = try_mac = FALSE;
2652+ }
2653 else if (curbuf->b_p_bin)
2654 fileformat = EOL_UNIX; /* binary: use Unix format */
2655 else if (*p_ffs == NUL)
2656@@ -2211,7 +2214,7 @@
2657 {
2658 /* Use stderr for stdin, makes shell commands work. */
2659 close(0);
2660- dup(2);
2661+ ignored = dup(2);
2662 }
2663 #endif
2664
2665@@ -2341,11 +2344,6 @@
2666 STRCAT(IObuff, _("[CR missing]"));
2667 c = TRUE;
2668 }
2669- if (ff_error == EOL_MAC)
2670- {
2671- STRCAT(IObuff, _("[NL found]"));
2672- c = TRUE;
2673- }
2674 if (split)
2675 {
2676 STRCAT(IObuff, _("[long lines split]"));
2677@@ -2711,7 +2709,7 @@
2678 {
2679 if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
2680 && curbuf->b_ffname != NULL)
2681- read_viminfo(NULL, FALSE, TRUE, FALSE);
2682+ read_viminfo(NULL, VIF_WANT_MARKS);
2683
2684 /* Always set b_marks_read; needed when 'viminfo' is changed to include
2685 * the ' parameter after opening a buffer. */
2686@@ -3451,7 +3449,7 @@
2687 {
2688 # ifdef UNIX
2689 # ifdef HAVE_FCHOWN
2690- fchown(fd, st_old.st_uid, st_old.st_gid);
2691+ ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
2692 # endif
2693 if (mch_stat((char *)IObuff, &st) < 0
2694 || st.st_uid != st_old.st_uid
2695@@ -4367,7 +4365,7 @@
2696 || st.st_uid != st_old.st_uid
2697 || st.st_gid != st_old.st_gid)
2698 {
2699- fchown(fd, st_old.st_uid, st_old.st_gid);
2700+ ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
2701 if (perm >= 0) /* set permission again, may have changed */
2702 (void)mch_setperm(wfname, perm);
2703 }
2704@@ -5550,9 +5548,10 @@
2705 name = "ucs-4le"; /* FF FE 00 00 */
2706 len = 4;
2707 }
2708- else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L))
2709+ else if (flags == (FIO_UCS2 | FIO_ENDIAN_L))
2710 name = "ucs-2le"; /* FF FE */
2711- else if (flags == (FIO_UTF16 | FIO_ENDIAN_L))
2712+ else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L))
2713+ /* utf-16le is preferred, it also works for ucs-2le text */
2714 name = "utf-16le"; /* FF FE */
2715 }
2716 else if (p[0] == 0xfe && p[1] == 0xff
2717@@ -6031,9 +6030,9 @@
2718 {
2719 tbuf[FGETS_SIZE - 2] = NUL;
2720 #ifdef USE_CR
2721- fgets_cr((char *)tbuf, FGETS_SIZE, fp);
2722+ ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
2723 #else
2724- fgets((char *)tbuf, FGETS_SIZE, fp);
2725+ ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
2726 #endif
2727 } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
2728 }
[43c52a1]2729@@ -6107,12 +6106,24 @@
2730 #ifdef HAVE_ACL
2731 vim_acl_T acl; /* ACL from original file */
2732 #endif
2733+#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
2734+ int use_tmp_file = FALSE;
2735+#endif
2736
2737 /*
2738- * When the names are identical, there is nothing to do.
2739+ * When the names are identical, there is nothing to do. When they refer
2740+ * to the same file (ignoring case and slash/backslash differences) but
2741+ * the file name differs we need to go through a temp file.
2742 */
2743 if (fnamecmp(from, to) == 0)
2744- return 0;
2745+ {
2746+#ifdef CASE_INSENSITIVE_FILENAME
2747+ if (STRCMP(gettail(from), gettail(to)) != 0)
2748+ use_tmp_file = TRUE;
2749+ else
2750+#endif
2751+ return 0;
2752+ }
2753
2754 /*
2755 * Fail if the "from" file doesn't exist. Avoids that "to" is deleted.
2756@@ -6120,6 +6131,55 @@
[1f22c7c]2757 if (mch_stat((char *)from, &st) < 0)
2758 return -1;
2759
2760+#ifdef UNIX
2761+ {
2762+ struct stat st_to;
2763+
2764+ /* It's possible for the source and destination to be the same file.
2765+ * This happens when "from" and "to" differ in case and are on a FAT32
2766+ * filesystem. In that case go through a temp file name. */
2767+ if (mch_stat((char *)to, &st_to) >= 0
2768+ && st.st_dev == st_to.st_dev
2769+ && st.st_ino == st_to.st_ino)
[43c52a1]2770+ use_tmp_file = TRUE;
2771+ }
2772+#endif
2773+
2774+#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
2775+ if (use_tmp_file)
2776+ {
2777+ char tempname[MAXPATHL + 1];
2778+
2779+ /*
2780+ * Find a name that doesn't exist and is in the same directory.
2781+ * Rename "from" to "tempname" and then rename "tempname" to "to".
2782+ */
2783+ if (STRLEN(from) >= MAXPATHL - 5)
2784+ return -1;
2785+ STRCPY(tempname, from);
2786+ for (n = 123; n < 99999; ++n)
[1f22c7c]2787+ {
[43c52a1]2788+ sprintf((char *)gettail((char_u *)tempname), "%d", n);
2789+ if (mch_stat(tempname, &st) < 0)
[1f22c7c]2790+ {
[43c52a1]2791+ if (mch_rename((char *)from, tempname) == 0)
[1f22c7c]2792+ {
[43c52a1]2793+ if (mch_rename(tempname, (char *)to) == 0)
2794+ return 0;
2795+ /* Strange, the second step failed. Try moving the
2796+ * file back and return failure. */
2797+ mch_rename(tempname, (char *)from);
[1f22c7c]2798+ return -1;
2799+ }
[43c52a1]2800+ /* If it fails for one temp name it will most likely fail
2801+ * for any temp name, give up. */
2802+ return -1;
[1f22c7c]2803+ }
2804+ }
[43c52a1]2805+ return -1;
[1f22c7c]2806+ }
2807+#endif
2808+
2809 /*
2810 * Delete the "to" file, this is required on some systems to make the
2811 * mch_rename() work, on other systems it makes sure that we don't have
[43c52a1]2812@@ -8523,6 +8583,7 @@
[76dd250]2813 char_u *save_sourcing_name;
2814 linenr_T save_sourcing_lnum;
2815 char_u *save_autocmd_fname;
2816+ int save_autocmd_fname_full;
2817 int save_autocmd_bufnr;
2818 char_u *save_autocmd_match;
2819 int save_autocmd_busy;
[43c52a1]2820@@ -8601,6 +8662,7 @@
[76dd250]2821 * Save the autocmd_* variables and info about the current buffer.
2822 */
2823 save_autocmd_fname = autocmd_fname;
2824+ save_autocmd_fname_full = autocmd_fname_full;
2825 save_autocmd_bufnr = autocmd_bufnr;
2826 save_autocmd_match = autocmd_match;
2827 save_autocmd_busy = autocmd_busy;
[43c52a1]2828@@ -8618,14 +8680,15 @@
[76dd250]2829 if (fname != NULL && *fname != NUL)
2830 autocmd_fname = fname;
2831 else if (buf != NULL)
2832- autocmd_fname = buf->b_fname;
2833+ autocmd_fname = buf->b_ffname;
2834 else
2835 autocmd_fname = NULL;
2836 }
2837 else
2838 autocmd_fname = fname_io;
2839 if (autocmd_fname != NULL)
2840- autocmd_fname = FullName_save(autocmd_fname, FALSE);
2841+ autocmd_fname = vim_strsave(autocmd_fname);
2842+ autocmd_fname_full = FALSE; /* call FullName_save() later */
2843
2844 /*
2845 * Set the buffer number to be used for <abuf>.
[43c52a1]2846@@ -8810,6 +8873,7 @@
[76dd250]2847 sourcing_lnum = save_sourcing_lnum;
2848 vim_free(autocmd_fname);
2849 autocmd_fname = save_autocmd_fname;
2850+ autocmd_fname_full = save_autocmd_fname_full;
2851 autocmd_bufnr = save_autocmd_bufnr;
2852 autocmd_match = save_autocmd_match;
2853 #ifdef FEAT_EVAL
[43c52a1]2854@@ -8918,7 +8982,7 @@
[76dd250]2855 {
2856 apc->curpat = NULL;
2857
2858- /* only use a pattern when it has not been removed, has commands and
2859+ /* Only use a pattern when it has not been removed, has commands and
2860 * the group matches. For buffer-local autocommands only check the
2861 * buffer number. */
2862 if (ap->pat != NULL && ap->cmds != NULL
[43c52a1]2863@@ -9104,7 +9168,7 @@
[76dd250]2864 set_context_in_autocmd(xp, arg, doautocmd)
2865 expand_T *xp;
2866 char_u *arg;
2867- int doautocmd; /* TRUE for :doautocmd, FALSE for :autocmd */
2868+ int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */
2869 {
2870 char_u *p;
2871 int group;
2872diff -Naur vim72.orig/src/fold.c vim72/src/fold.c
2873--- vim72.orig/src/fold.c 2008-08-06 04:01:12.000000000 -0700
[9a875fd]2874+++ vim72/src/fold.c 2009-02-07 22:17:06.755120268 -0800
[76dd250]2875@@ -48,7 +48,7 @@
2876 static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp));
2877 static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum));
2878 static void checkupdate __ARGS((win_T *wp));
2879-static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open));
2880+static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open));
2881 static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep));
2882 static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep));
2883 static void foldOpenNested __ARGS((fold_T *fpr));
[43c52a1]2884@@ -740,7 +740,7 @@
2885 garray_T *found_ga;
2886 fold_T *found_fp = NULL;
2887 linenr_T found_off = 0;
2888- int use_level = FALSE;
2889+ int use_level;
2890 int maybe_small = FALSE;
2891 int level = 0;
2892 linenr_T lnum = start;
2893@@ -757,6 +757,7 @@
2894 gap = &curwin->w_folds;
2895 found_ga = NULL;
2896 lnum_off = 0;
2897+ use_level = FALSE;
2898 for (;;)
2899 {
2900 if (!foldFind(gap, lnum - lnum_off, &fp))
2901@@ -783,20 +784,21 @@
2902 else
2903 {
2904 lnum = found_fp->fd_top + found_fp->fd_len + found_off;
2905- did_one = TRUE;
2906
2907 if (foldmethodIsManual(curwin))
2908 deleteFoldEntry(found_ga,
2909 (int)(found_fp - (fold_T *)found_ga->ga_data), recursive);
2910 else
2911 {
2912- if (found_fp->fd_top + found_off < first_lnum)
2913- first_lnum = found_fp->fd_top;
2914- if (lnum > last_lnum)
2915+ if (first_lnum > found_fp->fd_top + found_off)
2916+ first_lnum = found_fp->fd_top + found_off;
2917+ if (last_lnum < lnum)
2918 last_lnum = lnum;
2919- parseMarker(curwin);
2920+ if (!did_one)
2921+ parseMarker(curwin);
2922 deleteFoldMarkers(found_fp, recursive, found_off);
2923 }
2924+ did_one = TRUE;
2925
2926 /* redraw window */
2927 changed_window_setting();
2928@@ -811,6 +813,10 @@
2929 redraw_curbuf_later(INVERTED);
2930 #endif
2931 }
2932+ else
2933+ /* Deleting markers may make cursor column invalid. */
2934+ check_cursor_col();
2935+
2936 if (last_lnum > 0)
2937 changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L);
2938 }
2939@@ -1241,10 +1247,10 @@
[76dd250]2940 * Repeat "count" times.
2941 */
2942 static void
2943-setFoldRepeat(lnum, count, open)
2944+setFoldRepeat(lnum, count, do_open)
2945 linenr_T lnum;
2946 long count;
2947- int open;
2948+ int do_open;
2949 {
2950 int done;
2951 long n;
[43c52a1]2952@@ -1252,7 +1258,7 @@
[76dd250]2953 for (n = 0; n < count; ++n)
2954 {
2955 done = DONE_NOTHING;
2956- (void)setManualFold(lnum, open, FALSE, &done);
2957+ (void)setManualFold(lnum, do_open, FALSE, &done);
2958 if (!(done & DONE_ACTION))
2959 {
2960 /* Only give an error message when no fold could be opened. */
2961diff -Naur vim72.orig/src/getchar.c vim72/src/getchar.c
2962--- vim72.orig/src/getchar.c 2008-07-22 09:57:48.000000000 -0700
[9a875fd]2963+++ vim72/src/getchar.c 2009-02-07 22:15:56.893443498 -0800
[76dd250]2964@@ -4702,7 +4702,7 @@
2965 return FAIL;
2966 if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0)
2967 return FAIL;
2968- if (fprintf(fd, cmd) < 0)
2969+ if (fputs(cmd, fd) < 0)
2970 return FAIL;
2971 if (buf != NULL && fputs(" <buffer>", fd) < 0)
2972 return FAIL;
2973@@ -4801,7 +4801,7 @@
2974 }
2975 if (IS_SPECIAL(c) || modifiers) /* special key */
2976 {
2977- if (fprintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)
2978+ if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0)
2979 return FAIL;
2980 continue;
2981 }
2982diff -Naur vim72.orig/src/globals.h vim72/src/globals.h
2983--- vim72.orig/src/globals.h 2008-07-26 04:53:29.000000000 -0700
[9a875fd]2984+++ vim72/src/globals.h 2009-02-07 22:17:10.446515715 -0800
[76dd250]2985@@ -1022,6 +1022,7 @@
2986 #endif
2987 #ifdef FEAT_AUTOCMD
2988 EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
2989+EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
2990 EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
2991 EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
2992 EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
[43c52a1]2993@@ -1339,7 +1340,6 @@
2994
2995 #ifdef FEAT_NETBEANS_INTG
2996 EXTERN char *netbeansArg INIT(= NULL); /* the -nb[:host:port:passwd] arg */
2997-EXTERN int netbeansCloseFile INIT(= 0); /* send killed if != 0 */
2998 EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */
2999 EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */
3000 EXTERN int netbeansReadFile INIT(= 1); /* OK to read from disk if != 0 */
3001@@ -1548,6 +1548,14 @@
[76dd250]3002 EXTERN time_t starttime;
3003
3004 /*
3005+ * Some compilers warn for not using a return value, but in some situations we
3006+ * can't do anything useful with the value. Assign to this variable to avoid
3007+ * the warning.
3008+ */
3009+EXTERN int ignored;
3010+EXTERN char *ignoredp;
3011+
3012+/*
3013 * Optional Farsi support. Include it here, so EXTERN and INIT are defined.
3014 */
3015 #ifdef FEAT_FKMAP
[5f4a45c9]3016diff -Naur vim72.orig/src/gui_at_sb.c vim72/src/gui_at_sb.c
3017--- vim72.orig/src/gui_at_sb.c 2004-06-07 07:32:25.000000000 -0700
[9a875fd]3018+++ vim72/src/gui_at_sb.c 2009-02-07 22:16:00.129565861 -0800
[5f4a45c9]3019@@ -1078,6 +1078,12 @@
3020 Cardinal *num_params; /* unused */
3021 {
3022 ScrollbarWidget sbw = (ScrollbarWidget)w;
3023+ /* Use a union to avoid a warning for the weird conversion from float to
3024+ * XtPointer. Comes from Xaw/Scrollbar.c. */
3025+ union {
3026+ XtPointer xtp;
3027+ float xtf;
3028+ } xtpf;
3029
3030 if (LookAhead(w, event))
3031 return;
3032@@ -1085,7 +1091,8 @@
3033 /* thumbProc is not pretty, but is necessary for backwards
3034 compatibility on those architectures for which it work{s,ed};
3035 the intent is to pass a (truncated) float by value. */
3036- XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top);
3037+ xtpf.xtf = sbw->scrollbar.top;
3038+ XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
3039 XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
3040 }
3041
[76dd250]3042diff -Naur vim72.orig/src/gui.c vim72/src/gui.c
3043--- vim72.orig/src/gui.c 2008-07-27 12:32:14.000000000 -0700
[9a875fd]3044+++ vim72/src/gui.c 2009-02-07 22:16:28.052906831 -0800
[76dd250]3045@@ -139,7 +139,7 @@
3046 /* The read returns when the child closes the pipe (or when
3047 * the child dies for some reason). */
3048 close(pipefd[1]);
3049- (void)read(pipefd[0], &dummy, (size_t)1);
3050+ ignored = (int)read(pipefd[0], &dummy, (size_t)1);
3051 close(pipefd[0]);
3052 }
3053
3054@@ -3241,7 +3241,7 @@
3055 i = Rows;
3056 gui_update_tabline();
3057 Rows = i;
3058- need_set_size = RESIZE_VERT;
3059+ need_set_size |= RESIZE_VERT;
3060 if (using_tabline)
3061 fix_size = TRUE;
3062 if (!gui_use_tabline())
3063@@ -3275,9 +3275,9 @@
3064 if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
3065 {
3066 if (i == SBAR_BOTTOM)
3067- need_set_size = RESIZE_VERT;
3068+ need_set_size |= RESIZE_VERT;
3069 else
3070- need_set_size = RESIZE_HOR;
3071+ need_set_size |= RESIZE_HOR;
3072 if (gui.which_scrollbars[i])
3073 fix_size = TRUE;
3074 }
3075@@ -3297,7 +3297,7 @@
3076 gui_mch_enable_menu(gui.menu_is_active);
3077 Rows = i;
3078 prev_menu_is_active = gui.menu_is_active;
3079- need_set_size = RESIZE_VERT;
3080+ need_set_size |= RESIZE_VERT;
3081 if (gui.menu_is_active)
3082 fix_size = TRUE;
3083 }
3084@@ -3308,7 +3308,7 @@
3085 {
3086 gui_mch_show_toolbar(using_toolbar);
3087 prev_toolbar = using_toolbar;
3088- need_set_size = RESIZE_VERT;
3089+ need_set_size |= RESIZE_VERT;
3090 if (using_toolbar)
3091 fix_size = TRUE;
3092 }
3093@@ -3318,7 +3318,7 @@
3094 {
3095 gui_mch_enable_footer(using_footer);
3096 prev_footer = using_footer;
3097- need_set_size = RESIZE_VERT;
3098+ need_set_size |= RESIZE_VERT;
3099 if (using_footer)
3100 fix_size = TRUE;
3101 }
3102@@ -3330,10 +3330,11 @@
3103 prev_tearoff = using_tearoff;
3104 }
3105 #endif
3106- if (need_set_size)
3107+ if (need_set_size != 0)
3108 {
3109 #ifdef FEAT_GUI_GTK
3110- long c = Columns;
3111+ long prev_Columns = Columns;
3112+ long prev_Rows = Rows;
3113 #endif
3114 /* Adjust the size of the window to make the text area keep the
3115 * same size and to avoid that part of our window is off-screen
3116@@ -3349,11 +3350,14 @@
3117 * If you remove this, please test this command for resizing
3118 * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
3119 * Don't do this while starting up though.
3120- * And don't change Rows, it may have be reduced intentionally
3121- * when adding menu/toolbar/tabline. */
3122- if (!gui.starting)
3123+ * Don't change Rows when adding menu/toolbar/tabline.
3124+ * Don't change Columns when adding vertical toolbar. */
3125+ if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
3126 (void)char_avail();
3127- Columns = c;
3128+ if ((need_set_size & RESIZE_VERT) == 0)
3129+ Rows = prev_Rows;
3130+ if ((need_set_size & RESIZE_HOR) == 0)
3131+ Columns = prev_Columns;
3132 #endif
3133 }
3134 #ifdef FEAT_WINDOWS
3135diff -Naur vim72.orig/src/gui_gtk_x11.c vim72/src/gui_gtk_x11.c
3136--- vim72.orig/src/gui_gtk_x11.c 2008-07-04 03:46:24.000000000 -0700
[9a875fd]3137+++ vim72/src/gui_gtk_x11.c 2009-02-07 22:16:00.133666993 -0800
[76dd250]3138@@ -4070,14 +4070,14 @@
3139
3140 if (mask & (XValue | YValue))
3141 {
3142- int w, h;
3143- gui_mch_get_screen_dimensions(&w, &h);
3144- h += p_ghr + get_menu_tool_height();
3145- w += get_menu_tool_width();
3146+ int ww, hh;
3147+ gui_mch_get_screen_dimensions(&ww, &hh);
3148+ hh += p_ghr + get_menu_tool_height();
3149+ ww += get_menu_tool_width();
3150 if (mask & XNegative)
3151- x += w - pixel_width;
3152+ x += ww - pixel_width;
3153 if (mask & YNegative)
3154- y += h - pixel_height;
3155+ y += hh - pixel_height;
3156 #ifdef HAVE_GTK2
3157 gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
3158 #else
3159diff -Naur vim72.orig/src/gui_x11.c vim72/src/gui_x11.c
3160--- vim72.orig/src/gui_x11.c 2008-06-08 08:13:45.000000000 -0700
[9a875fd]3161+++ vim72/src/gui_x11.c 2009-02-07 22:15:00.616092472 -0800
[76dd250]3162@@ -2450,7 +2450,7 @@
3163 *colorPtr = colortable[closest];
3164 }
3165
3166- free(colortable);
3167+ vim_free(colortable);
3168 return OK;
3169 }
3170
3171diff -Naur vim72.orig/src/gui_xmdlg.c vim72/src/gui_xmdlg.c
3172--- vim72.orig/src/gui_xmdlg.c 2008-06-21 09:05:32.000000000 -0700
[9a875fd]3173+++ vim72/src/gui_xmdlg.c 2009-02-07 22:16:00.133666993 -0800
[76dd250]3174@@ -369,10 +369,10 @@
3175 char buf[TEMP_BUF_SIZE];
3176 XmString items[MAX_ENTRIES_IN_LIST];
3177 int i;
3178- int index;
3179+ int idx;
3180
3181- for (index = (int)ENCODING; index < (int)NONE; ++index)
3182- count[index] = 0;
3183+ for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
3184+ count[idx] = 0;
3185
3186 /* First we insert the wild char into every single list. */
3187 if (fix != ENCODING)
3188@@ -503,14 +503,14 @@
3189 /*
3190 * Now loop trough the remaining lists and set them up.
3191 */
3192- for (index = (int)NAME; index < (int)NONE; ++index)
3193+ for (idx = (int)NAME; idx < (int)NONE; ++idx)
3194 {
3195 Widget w;
3196
3197- if (fix == (enum ListSpecifier)index)
3198+ if (fix == (enum ListSpecifier)idx)
3199 continue;
3200
3201- switch ((enum ListSpecifier)index)
3202+ switch ((enum ListSpecifier)idx)
3203 {
3204 case NAME:
3205 w = data->list[NAME];
3206@@ -525,21 +525,21 @@
3207 w = (Widget)0; /* for lint */
3208 }
3209
3210- for (i = 0; i < count[index]; ++i)
3211+ for (i = 0; i < count[idx]; ++i)
3212 {
3213- items[i] = XmStringCreateLocalized(list[index][i]);
3214- XtFree(list[index][i]);
3215+ items[i] = XmStringCreateLocalized(list[idx][i]);
3216+ XtFree(list[idx][i]);
3217 }
3218 XmListDeleteAllItems(w);
3219- XmListAddItems(w, items, count[index], 1);
3220- if (data->sel[index])
3221+ XmListAddItems(w, items, count[idx], 1);
3222+ if (data->sel[idx])
3223 {
3224 XmStringFree(items[0]);
3225- items[0] = XmStringCreateLocalized(data->sel[index]);
3226+ items[0] = XmStringCreateLocalized(data->sel[idx]);
3227 XmListSelectItem(w, items[0], False);
3228 XmListSetBottomItem(w, items[0]);
3229 }
3230- for (i = 0; i < count[index]; ++i)
3231+ for (i = 0; i < count[idx]; ++i)
3232 XmStringFree(items[i]);
3233 }
3234 }
3235@@ -695,14 +695,14 @@
3236 int n;
3237 XmString str;
3238 Arg args[4];
3239- char *msg = _("no specific match");
3240+ char *nomatch_msg = _("no specific match");
3241
3242 n = 0;
3243- str = XmStringCreateLocalized(msg);
3244+ str = XmStringCreateLocalized(nomatch_msg);
3245 XtSetArg(args[n], XmNlabelString, str); ++n;
3246 XtSetValues(data->sample, args, n);
3247 apply_fontlist(data->sample);
3248- XmTextSetString(data->name, msg);
3249+ XmTextSetString(data->name, nomatch_msg);
3250 XmStringFree(str);
3251
3252 return False;
3253@@ -886,21 +886,21 @@
3254 {
3255 int i;
3256 int max;
3257- int index = 0;
3258+ int idx = 0;
3259 int size;
3260- char str[128];
3261+ char buf[128];
3262
3263 for (i = 0, max = 0; i < data->num; i++)
3264 {
3265- get_part(fn(data, i), 7, str);
3266- size = atoi(str);
3267+ get_part(fn(data, i), 7, buf);
3268+ size = atoi(buf);
3269 if ((size > max) && (size < MAX_DISPLAY_SIZE))
3270 {
3271- index = i;
3272+ idx = i;
3273 max = size;
3274 }
3275 }
3276- strcpy(big_font, fn(data, index));
3277+ strcpy(big_font, fn(data, idx));
3278 }
3279 data->old = XLoadQueryFont(XtDisplay(parent), big_font);
3280 data->old_list = gui_motif_create_fontlist(data->old);
3281@@ -1217,28 +1217,28 @@
3282
3283 if (i != 0)
3284 {
3285- char name[TEMP_BUF_SIZE];
3286- char style[TEMP_BUF_SIZE];
3287- char size[TEMP_BUF_SIZE];
3288- char encoding[TEMP_BUF_SIZE];
3289+ char namebuf[TEMP_BUF_SIZE];
3290+ char stylebuf[TEMP_BUF_SIZE];
3291+ char sizebuf[TEMP_BUF_SIZE];
3292+ char encodingbuf[TEMP_BUF_SIZE];
3293 char *found;
3294
3295 found = names[0];
3296
3297- name_part(found, name);
3298- style_part(found, style);
3299- size_part(found, size, data->in_pixels);
3300- encoding_part(found, encoding);
3301-
3302- if (strlen(name) > 0
3303- && strlen(style) > 0
3304- && strlen(size) > 0
3305- && strlen(encoding) > 0)
3306+ name_part(found, namebuf);
3307+ style_part(found, stylebuf);
3308+ size_part(found, sizebuf, data->in_pixels);
3309+ encoding_part(found, encodingbuf);
3310+
3311+ if (strlen(namebuf) > 0
3312+ && strlen(stylebuf) > 0
3313+ && strlen(sizebuf) > 0
3314+ && strlen(encodingbuf) > 0)
3315 {
3316- data->sel[NAME] = XtNewString(name);
3317- data->sel[STYLE] = XtNewString(style);
3318- data->sel[SIZE] = XtNewString(size);
3319- data->sel[ENCODING] = XtNewString(encoding);
3320+ data->sel[NAME] = XtNewString(namebuf);
3321+ data->sel[STYLE] = XtNewString(stylebuf);
3322+ data->sel[SIZE] = XtNewString(sizebuf);
3323+ data->sel[ENCODING] = XtNewString(encodingbuf);
3324 data->font_name = XtNewString(names[0]);
3325 display_sample(data);
3326 XmTextSetString(data->name, data->font_name);
3327diff -Naur vim72.orig/src/gui_xmebw.c vim72/src/gui_xmebw.c
3328--- vim72.orig/src/gui_xmebw.c 2007-09-06 03:57:51.000000000 -0700
[9a875fd]3329+++ vim72/src/gui_xmebw.c 2009-02-07 22:16:00.133666993 -0800
[76dd250]3330@@ -1256,7 +1256,7 @@
3331 }
3332 else
3333 {
3334- int adjust = 0;
3335+ adjust = 0;
3336
3337 #if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
3338 /*
3339@@ -1268,12 +1268,11 @@
3340 {
3341 case XmEXTERNAL_HIGHLIGHT:
3342 adjust = (eb->primitive.highlight_thickness -
3343- (eb->pushbutton.default_button_shadow_thickness ?
3344- Xm3D_ENHANCE_PIXEL : 0));
3345+ (eb->pushbutton.default_button_shadow_thickness
3346+ ? Xm3D_ENHANCE_PIXEL : 0));
3347 break;
3348
3349 case XmINTERNAL_HIGHLIGHT:
3350- adjust = 0;
3351 break;
3352
3353 default:
3354diff -Naur vim72.orig/src/if_cscope.c vim72/src/if_cscope.c
3355--- vim72.orig/src/if_cscope.c 2008-06-24 09:32:34.000000000 -0700
[9a875fd]3356+++ vim72/src/if_cscope.c 2009-02-07 22:17:45.055382037 -0800
[76dd250]3357@@ -74,7 +74,7 @@
3358 { "add", cs_add,
3359 N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 },
3360 { "find", cs_find,
3361- N_("Query for a pattern"), FIND_USAGE, 1 },
3362+ N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 },
3363 { "help", cs_help,
3364 N_("Show this message"), "help", 0 },
3365 { "kill", cs_kill,
[5f4a45c9]3366@@ -1177,10 +1177,27 @@
3367 (void)MSG_PUTS(_("cscope commands:\n"));
3368 while (cmdp->name != NULL)
3369 {
3370- (void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
3371- cmdp->name, _(cmdp->help), cmdp->usage);
3372+ char *help = _(cmdp->help);
3373+ int space_cnt = 30 - vim_strsize((char_u *)help);
3374+
3375+ /* Use %*s rather than %30s to ensure proper alignment in utf-8 */
3376+ if (space_cnt < 0)
3377+ space_cnt = 0;
3378+ (void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"),
3379+ cmdp->name,
3380+ help, space_cnt, " ",
3381+ cmdp->usage);
[76dd250]3382 if (strcmp(cmdp->name, "find") == 0)
3383- MSG_PUTS(FIND_HELP);
3384+ MSG_PUTS(_("\n"
3385+ " c: Find functions calling this function\n"
3386+ " d: Find functions called by this function\n"
3387+ " e: Find this egrep pattern\n"
3388+ " f: Find this file\n"
3389+ " g: Find this definition\n"
3390+ " i: Find files #including this file\n"
3391+ " s: Find this C symbol\n"
3392+ " t: Find assignments to\n"));
3393+
3394 cmdp++;
3395 }
3396
3397diff -Naur vim72.orig/src/if_cscope.h vim72/src/if_cscope.h
3398--- vim72.orig/src/if_cscope.h 2007-09-02 07:51:08.000000000 -0700
[9a875fd]3399+++ vim72/src/if_cscope.h 2009-02-07 22:13:26.206645342 -0800
[76dd250]3400@@ -42,17 +42,6 @@
3401 * f 7name Find this file
3402 * i 8name Find files #including this file
3403 */
3404-#define FIND_USAGE "find c|d|e|f|g|i|s|t name"
3405-#define FIND_HELP "\n\
3406- c: Find functions calling this function\n\
3407- d: Find functions called by this function\n\
3408- e: Find this egrep pattern\n\
3409- f: Find this file\n\
3410- g: Find this definition\n\
3411- i: Find files #including this file\n\
3412- s: Find this C symbol\n\
3413- t: Find assignments to\n"
3414-
3415
3416 typedef struct {
3417 char * name;
3418diff -Naur vim72.orig/src/if_perl.xs vim72/src/if_perl.xs
3419--- vim72.orig/src/if_perl.xs 2008-07-17 13:55:09.000000000 -0700
[9a875fd]3420+++ vim72/src/if_perl.xs 2009-02-07 22:16:22.052343345 -0800
[76dd250]3421@@ -136,6 +136,9 @@
3422 # define Perl_newXS_flags dll_Perl_newXS_flags
3423 #endif
3424 # define Perl_sv_free dll_Perl_sv_free
3425+# if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
3426+# define Perl_sv_free2 dll_Perl_sv_free2
3427+# endif
3428 # define Perl_sv_isa dll_Perl_sv_isa
3429 # define Perl_sv_magic dll_Perl_sv_magic
3430 # define Perl_sv_setiv dll_Perl_sv_setiv
3431@@ -163,7 +166,7 @@
3432 # define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr
3433 # define boot_DynaLoader dll_boot_DynaLoader
3434
3435-# define Perl_sys_init3 dll_Perl_sys_init3
3436+# define Perl_sys_init dll_Perl_sys_init
3437 # define Perl_sys_term dll_Perl_sys_term
3438 # define Perl_ISv_ptr dll_Perl_ISv_ptr
3439 # define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr
3440@@ -268,7 +271,8 @@
3441 static void (*boot_DynaLoader)_((pTHX_ CV*));
3442
3443 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
3444-static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
3445+static void (*Perl_sv_free2)(pTHX_ SV*);
3446+static void (*Perl_sys_init)(int* argc, char*** argv);
3447 static void (*Perl_sys_term)(void);
3448 static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
3449 static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*);
3450@@ -367,7 +371,8 @@
3451 {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr},
3452 {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
3453 #else
3454- {"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
3455+ {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
3456+ {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init},
3457 {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
3458 {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
3459 {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr},
3460@@ -455,7 +460,7 @@
3461 static char *argv[] = { "", "-e", "" };
3462
3463 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
3464- Perl_sys_init3(&argc, (char***)&argv, NULL);
3465+ Perl_sys_init(&argc, (char***)&argv);
3466 #endif
3467 perl_interp = perl_alloc();
3468 perl_construct(perl_interp);
3469diff -Naur vim72.orig/src/if_python.c vim72/src/if_python.c
3470--- vim72.orig/src/if_python.c 2008-07-17 14:09:32.000000000 -0700
[9a875fd]3471+++ vim72/src/if_python.c 2009-02-07 22:17:23.579673139 -0800
[76dd250]3472@@ -531,6 +531,12 @@
3473 if (PythonMod_Init())
3474 goto fail;
3475
3476+ /* Remove the element from sys.path that was added because of our
3477+ * argv[0] value in PythonMod_Init(). Previously we used an empty
3478+ * string, but dependinding on the OS we then get an empty entry or
3479+ * the current directory in sys.path. */
3480+ PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
3481+
3482 /* the first python thread is vim's, release the lock */
3483 Python_SaveThread();
3484
[7352c10]3485@@ -1145,14 +1151,23 @@
3486
3487 /* Check if we run into a recursive loop. The item must be in lookupDict
3488 * then and we can use it again. */
3489- sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv);
3490- result = PyDict_GetItemString(lookupDict, ptrBuf);
3491- if (result != NULL)
3492- Py_INCREF(result);
3493- else if (our_tv->v_type == VAR_STRING)
3494+ if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
3495+ || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
3496+ {
3497+ sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U,
3498+ our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list
3499+ : (long_u)our_tv->vval.v_dict);
3500+ result = PyDict_GetItemString(lookupDict, ptrBuf);
3501+ if (result != NULL)
3502+ {
3503+ Py_INCREF(result);
3504+ return result;
3505+ }
3506+ }
3507+
3508+ if (our_tv->v_type == VAR_STRING)
3509 {
3510 result = Py_BuildValue("s", our_tv->vval.v_string);
3511- PyDict_SetItemString(lookupDict, ptrBuf, result);
3512 }
3513 else if (our_tv->v_type == VAR_NUMBER)
3514 {
3515@@ -1161,7 +1176,6 @@
3516 /* For backwards compatibility numbers are stored as strings. */
3517 sprintf(buf, "%ld", (long)our_tv->vval.v_number);
3518 result = Py_BuildValue("s", buf);
3519- PyDict_SetItemString(lookupDict, ptrBuf, result);
3520 }
3521 # ifdef FEAT_FLOAT
3522 else if (our_tv->v_type == VAR_FLOAT)
3523@@ -1170,7 +1184,6 @@
3524
3525 sprintf(buf, "%f", our_tv->vval.v_float);
3526 result = Py_BuildValue("s", buf);
3527- PyDict_SetItemString(lookupDict, ptrBuf, result);
3528 }
3529 # endif
3530 else if (our_tv->v_type == VAR_LIST)
3531@@ -1179,10 +1192,11 @@
3532 listitem_T *curr;
3533
3534 result = PyList_New(0);
3535- PyDict_SetItemString(lookupDict, ptrBuf, result);
3536
3537 if (list != NULL)
3538 {
3539+ PyDict_SetItemString(lookupDict, ptrBuf, result);
3540+
3541 for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
3542 {
3543 newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
3544@@ -1194,7 +1208,6 @@
3545 else if (our_tv->v_type == VAR_DICT)
3546 {
3547 result = PyDict_New();
3548- PyDict_SetItemString(lookupDict, ptrBuf, result);
3549
3550 if (our_tv->vval.v_dict != NULL)
3551 {
3552@@ -1203,6 +1216,8 @@
3553 hashitem_T *hi;
3554 dictitem_T *di;
3555
3556+ PyDict_SetItemString(lookupDict, ptrBuf, result);
3557+
3558 for (hi = ht->ht_array; todo > 0; ++hi)
3559 {
3560 if (!HASHITEM_EMPTY(hi))
3561@@ -2345,7 +2360,8 @@
[76dd250]3562 {
3563 PyObject *mod;
3564 PyObject *dict;
3565- static char *(argv[2]) = {"", NULL};
3566+ /* The special value is removed from sys.path in Python_Init(). */
3567+ static char *(argv[2]) = {"/must>not&exist/foo", NULL};
3568
3569 /* Fixups... */
3570 BufferType.ob_type = &PyType_Type;
3571diff -Naur vim72.orig/src/if_xcmdsrv.c vim72/src/if_xcmdsrv.c
3572--- vim72.orig/src/if_xcmdsrv.c 2008-07-18 06:05:03.000000000 -0700
[9a875fd]3573+++ vim72/src/if_xcmdsrv.c 2009-02-07 22:15:09.294969689 -0800
[76dd250]3574@@ -736,7 +736,7 @@
3575 + serverReply.ga_len;
3576 e.id = w;
3577 ga_init2(&e.strings, 1, 100);
3578- memcpy(p, &e, sizeof(e));
3579+ mch_memmove(p, &e, sizeof(e));
3580 serverReply.ga_len++;
3581 }
3582 }
3583@@ -1018,7 +1018,7 @@
3584 p++;
3585 count = numItems - (p - regProp);
3586 if (count > 0)
3587- memcpy(entry, p, count);
3588+ mch_memmove(entry, p, count);
3589 XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
3590 8, PropModeReplace, regProp,
3591 (int)(numItems - (p - entry)));
3592@@ -1072,7 +1072,7 @@
3593 p++;
3594 lastHalf = numItems - (p - regProp);
3595 if (lastHalf > 0)
3596- memcpy(entry, p, lastHalf);
3597+ mch_memmove(entry, p, lastHalf);
3598 numItems = (entry - regProp) + lastHalf;
3599 p = entry;
3600 continue;
3601diff -Naur vim72.orig/src/main.c vim72/src/main.c
3602--- vim72.orig/src/main.c 2008-07-24 01:40:56.000000000 -0700
[9a875fd]3603+++ vim72/src/main.c 2009-02-07 22:16:00.133666993 -0800
[76dd250]3604@@ -645,11 +645,12 @@
3605
3606 #ifdef FEAT_VIMINFO
3607 /*
3608- * Read in registers, history etc, but not marks, from the viminfo file
3609+ * Read in registers, history etc, but not marks, from the viminfo file.
3610+ * This is where v:oldfiles gets filled.
3611 */
3612 if (*p_viminfo != NUL)
3613 {
3614- read_viminfo(NULL, TRUE, FALSE, FALSE);
3615+ read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
3616 TIME_MSG("reading viminfo");
3617 }
3618 #endif
3619@@ -1457,7 +1458,8 @@
3620 ++initstr;
3621 }
3622
3623- if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k')
3624+ /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */
3625+ if (TOLOWER_ASC(initstr[0]) == 'g')
3626 {
3627 main_start_gui();
3628 #ifdef FEAT_GUI
3629@@ -1508,7 +1510,8 @@
3630 early_arg_scan(parmp)
3631 mparm_T *parmp;
3632 {
3633-#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER)
3634+#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
3635+ || !defined(FEAT_NETBEANS_INTG)
3636 int argc = parmp->argc;
3637 char **argv = parmp->argv;
3638 int i;
3639@@ -1580,6 +1583,14 @@
3640 else if (STRICMP(argv[i], "--echo-wid") == 0)
3641 echo_wid_arg = TRUE;
3642 # endif
3643+# ifndef FEAT_NETBEANS_INTG
3644+ else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
3645+ {
3646+ mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
3647+ mch_exit(2);
3648+ }
3649+# endif
3650+
3651 }
3652 #endif
3653 }
3654@@ -2361,7 +2372,7 @@
3655 * Is there any other system that cannot do this?
3656 */
3657 close(0);
3658- dup(2);
3659+ ignored = dup(2);
3660 #endif
3661 }
3662
3663diff -Naur vim72.orig/src/mark.c vim72/src/mark.c
3664--- vim72.orig/src/mark.c 2008-08-08 15:06:49.000000000 -0700
[9a875fd]3665+++ vim72/src/mark.c 2009-02-07 22:14:49.103047074 -0800
[76dd250]3666@@ -1627,15 +1627,17 @@
3667
3668 /*
3669 * Handle marks in the viminfo file:
3670- * fp_out == NULL read marks for current buffer only
3671- * fp_out != NULL copy marks for buffers not in buffer list
3672+ * fp_out != NULL: copy marks for buffers not in buffer list
3673+ * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
3674+ * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
3675 */
3676 void
3677-copy_viminfo_marks(virp, fp_out, count, eof)
3678+copy_viminfo_marks(virp, fp_out, count, eof, flags)
3679 vir_T *virp;
3680 FILE *fp_out;
3681 int count;
3682 int eof;
3683+ int flags;
3684 {
3685 char_u *line = virp->vir_line;
3686 buf_T *buf;
3687@@ -1647,10 +1649,23 @@
3688 char_u *p;
3689 char_u *name_buf;
3690 pos_T pos;
3691+#ifdef FEAT_EVAL
3692+ list_T *list = NULL;
3693+#endif
3694
3695 if ((name_buf = alloc(LSIZE)) == NULL)
3696 return;
3697 *name_buf = NUL;
3698+
3699+#ifdef FEAT_EVAL
3700+ if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT)))
3701+ {
3702+ list = list_alloc();
3703+ if (list != NULL)
3704+ set_vim_var_list(VV_OLDFILES, list);
3705+ }
3706+#endif
3707+
3708 num_marked_files = get_viminfo_parameter('\'');
3709 while (!eof && (count < num_marked_files || fp_out == NULL))
3710 {
3711@@ -1681,6 +1696,11 @@
3712 p++;
3713 *p = NUL;
3714
3715+#ifdef FEAT_EVAL
3716+ if (list != NULL)
3717+ list_append_string(list, str, -1);
3718+#endif
3719+
3720 /*
3721 * If fp_out == NULL, load marks for current buffer.
3722 * If fp_out != NULL, copy marks for buffers not in buflist.
3723@@ -1688,7 +1708,7 @@
3724 load_marks = copy_marks_out = FALSE;
3725 if (fp_out == NULL)
3726 {
3727- if (curbuf->b_ffname != NULL)
3728+ if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL)
3729 {
3730 if (*name_buf == NUL) /* only need to do this once */
3731 home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE);
3732diff -Naur vim72.orig/src/mbyte.c vim72/src/mbyte.c
3733--- vim72.orig/src/mbyte.c 2008-07-14 05:38:05.000000000 -0700
[9a875fd]3734+++ vim72/src/mbyte.c 2009-02-07 22:16:00.137768683 -0800
[76dd250]3735@@ -717,7 +717,7 @@
3736 * where mblen() returns 0 for invalid character.
3737 * Therefore, following condition includes 0.
3738 */
3739- (void)mblen(NULL, 0); /* First reset the state. */
3740+ ignored = mblen(NULL, 0); /* First reset the state. */
3741 if (mblen(buf, (size_t)1) <= 0)
3742 n = 2;
3743 else
3744@@ -2540,7 +2540,6 @@
3745 return (int)(p - q);
3746 }
3747
3748-#if defined(FEAT_EVAL) || defined(PROTO)
3749 /*
3750 * Copy a character from "*fp" to "*tp" and advance the pointers.
3751 */
3752@@ -2555,7 +2554,6 @@
3753 *tp += l;
3754 *fp += l;
3755 }
3756-#endif
3757
3758 /*
3759 * Return the offset from "p" to the first byte of a character. When "p" is
3760@@ -3133,7 +3131,7 @@
3761 else
3762 s = p + 1;
3763 }
3764- for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i)
3765+ for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i)
3766 {
3767 if (s[i] == '_' || s[i] == '-')
3768 buf[i] = '-';
3769@@ -5280,7 +5278,7 @@
3770
3771 /*ARGSUSED*/
3772 static void
3773-preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3774+preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3775 {
3776 #ifdef XIM_DEBUG
3777 xim_log("xim_decide_input_style()\n");
3778@@ -5314,7 +5312,7 @@
3779
3780 /*ARGSUSED*/
3781 static void
3782-preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3783+preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3784 {
3785 XIMPreeditDrawCallbackStruct *draw_data;
3786 XIMText *text;
3787@@ -5386,7 +5384,7 @@
3788 draw_feedback = (char *)alloc(draw_data->chg_first
3789 + text->length);
3790 else
3791- draw_feedback = realloc(draw_feedback,
3792+ draw_feedback = vim_realloc(draw_feedback,
3793 draw_data->chg_first + text->length);
3794 if (draw_feedback != NULL)
3795 {
3796@@ -5455,7 +5453,7 @@
3797
3798 /*ARGSUSED*/
3799 static void
3800-preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3801+preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3802 {
3803 #ifdef XIM_DEBUG
3804 xim_log("preedit_caret_cbproc()\n");
3805@@ -5464,7 +5462,7 @@
3806
3807 /*ARGSUSED*/
3808 static void
3809-preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3810+preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3811 {
3812 #ifdef XIM_DEBUG
3813 xim_log("preedit_done_cbproc()\n");
3814diff -Naur vim72.orig/src/menu.c vim72/src/menu.c
3815--- vim72.orig/src/menu.c 2008-06-21 12:53:43.000000000 -0700
[9a875fd]3816+++ vim72/src/menu.c 2009-02-07 22:13:20.029714486 -0800
[76dd250]3817@@ -1120,6 +1120,7 @@
3818 parent = menu;
3819 menu = menu->children;
3820 }
3821+ vim_free(path_name);
3822
3823 /* Now we have found the matching menu, and we list the mappings */
3824 /* Highlight title */
3825diff -Naur vim72.orig/src/message.c vim72/src/message.c
3826--- vim72.orig/src/message.c 2008-07-09 11:24:55.000000000 -0700
[9a875fd]3827+++ vim72/src/message.c 2009-02-07 22:17:15.799035061 -0800
[7352c10]3828@@ -4556,7 +4556,13 @@
3829 remove_trailing_zeroes = TRUE;
3830 }
3831
3832- if (fmt_spec == 'f' && abs_f > 1.0e307)
3833+ if (fmt_spec == 'f' &&
3834+#ifdef VAX
3835+ abs_f > 1.0e38
3836+#else
3837+ abs_f > 1.0e307
3838+#endif
3839+ )
3840 {
3841 /* Avoid a buffer overflow */
3842 strcpy(tmp, "inf");
3843@@ -4585,61 +4591,62 @@
[76dd250]3844 if (remove_trailing_zeroes)
3845 {
3846 int i;
3847- char *p;
3848+ char *tp;
3849
3850 /* Using %g or %G: remove superfluous zeroes. */
3851 if (fmt_spec == 'f')
3852- p = tmp + str_arg_l - 1;
3853+ tp = tmp + str_arg_l - 1;
3854 else
3855 {
3856- p = (char *)vim_strchr((char_u *)tmp,
3857+ tp = (char *)vim_strchr((char_u *)tmp,
3858 fmt_spec == 'e' ? 'e' : 'E');
3859- if (p != NULL)
3860+ if (tp != NULL)
3861 {
3862 /* Remove superfluous '+' and leading
3863 * zeroes from the exponent. */
3864- if (p[1] == '+')
3865+ if (tp[1] == '+')
3866 {
3867 /* Change "1.0e+07" to "1.0e07" */
3868- STRMOVE(p + 1, p + 2);
3869+ STRMOVE(tp + 1, tp + 2);
3870 --str_arg_l;
3871 }
3872- i = (p[1] == '-') ? 2 : 1;
3873- while (p[i] == '0')
3874+ i = (tp[1] == '-') ? 2 : 1;
3875+ while (tp[i] == '0')
3876 {
3877 /* Change "1.0e07" to "1.0e7" */
3878- STRMOVE(p + i, p + i + 1);
3879+ STRMOVE(tp + i, tp + i + 1);
3880 --str_arg_l;
3881 }
3882- --p;
3883+ --tp;
3884 }
3885 }
3886
3887- if (p != NULL && !precision_specified)
3888+ if (tp != NULL && !precision_specified)
3889 /* Remove trailing zeroes, but keep the one
3890 * just after a dot. */
3891- while (p > tmp + 2 && *p == '0' && p[-1] != '.')
3892+ while (tp > tmp + 2 && *tp == '0'
3893+ && tp[-1] != '.')
3894 {
3895- STRMOVE(p, p + 1);
3896- --p;
3897+ STRMOVE(tp, tp + 1);
3898+ --tp;
3899 --str_arg_l;
3900 }
3901 }
3902 else
3903 {
3904- char *p;
3905+ char *tp;
3906
3907 /* Be consistent: some printf("%e") use 1.0e+12
3908 * and some 1.0e+012. Remove one zero in the last
3909 * case. */
3910- p = (char *)vim_strchr((char_u *)tmp,
3911+ tp = (char *)vim_strchr((char_u *)tmp,
3912 fmt_spec == 'e' ? 'e' : 'E');
3913- if (p != NULL && (p[1] == '+' || p[1] == '-')
3914- && p[2] == '0'
3915- && vim_isdigit(p[3])
3916- && vim_isdigit(p[4]))
3917+ if (tp != NULL && (tp[1] == '+' || tp[1] == '-')
3918+ && tp[2] == '0'
3919+ && vim_isdigit(tp[3])
3920+ && vim_isdigit(tp[4]))
3921 {
3922- STRMOVE(p + 2, p + 3);
3923+ STRMOVE(tp + 2, tp + 3);
3924 --str_arg_l;
3925 }
3926 }
3927diff -Naur vim72.orig/src/misc1.c vim72/src/misc1.c
3928--- vim72.orig/src/misc1.c 2008-07-12 12:20:53.000000000 -0700
[9a875fd]3929+++ vim72/src/misc1.c 2009-02-07 22:14:49.107148764 -0800
[76dd250]3930@@ -3245,9 +3245,9 @@
3931
3932 /* When using ":silent" assume that <CR> was entered. */
3933 if (mouse_used != NULL)
3934- MSG_PUTS(_("Type number or click with mouse (<Enter> cancels): "));
3935+ MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): "));
3936 else
3937- MSG_PUTS(_("Choice number (<Enter> cancels): "));
3938+ MSG_PUTS(_("Type number and <Enter> (empty cancels): "));
3939
3940 /* Set the state such that text can be selected/copied/pasted and we still
3941 * get mouse events. */
3942diff -Naur vim72.orig/src/misc2.c vim72/src/misc2.c
3943--- vim72.orig/src/misc2.c 2008-07-23 12:12:56.000000000 -0700
[9a875fd]3944+++ vim72/src/misc2.c 2009-02-07 22:17:34.370847325 -0800
[76dd250]3945@@ -873,7 +873,7 @@
3946 /* 3. check for available memory: call mch_avail_mem() */
3947 if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
3948 {
3949- vim_free((char *)p); /* System is low... no go! */
3950+ free((char *)p); /* System is low... no go! */
3951 p = NULL;
3952 }
3953 else
3954@@ -1257,7 +1257,6 @@
3955 return escaped_string;
3956 }
3957
3958-#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
3959 /*
3960 * Return TRUE when 'shell' has "csh" in the tail.
3961 */
3962@@ -1266,9 +1265,7 @@
3963 {
3964 return (strstr((char *)gettail(p_sh), "csh") != NULL);
3965 }
3966-#endif
3967
3968-#if defined(FEAT_EVAL) || defined(PROTO)
3969 /*
3970 * Escape "string" for use as a shell argument with system().
3971 * This uses single quotes, except when we know we need to use double qoutes
3972@@ -1391,7 +1388,6 @@
3973
3974 return escaped_string;
3975 }
3976-#endif
3977
3978 /*
3979 * Like vim_strsave(), but make all characters uppercase.
[1f22c7c]3980@@ -2565,7 +2561,7 @@
3981 int key;
3982 int dlen = 0;
3983
3984- key = find_special_key(srcp, &modifiers, keycode);
3985+ key = find_special_key(srcp, &modifiers, keycode, FALSE);
3986 if (key == 0)
3987 return 0;
3988
3989@@ -2601,10 +2597,11 @@
3990 * returns 0 if there is no match.
3991 */
3992 int
3993-find_special_key(srcp, modp, keycode)
3994+find_special_key(srcp, modp, keycode, keep_x_key)
3995 char_u **srcp;
3996 int *modp;
3997- int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
3998+ int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
3999+ int keep_x_key; /* don't translate xHome to Home key */
4000 {
4001 char_u *last_dash;
4002 char_u *end_of_name;
4003@@ -2672,7 +2669,8 @@
4004 else
4005 {
4006 key = get_special_key_code(last_dash + 1);
4007- key = handle_x_keys(key);
4008+ if (!keep_x_key)
4009+ key = handle_x_keys(key);
4010 }
4011
4012 /*
[5f4a45c9]4013@@ -4698,7 +4696,8 @@
4014 stackp->ffs_filearray_cur = i + 1;
4015 ff_push(search_ctx, stackp);
4016
4017- simplify_filename(file_path);
4018+ if (!path_with_url(file_path))
4019+ simplify_filename(file_path);
4020 if (mch_dirname(ff_expand_buffer, MAXPATHL)
4021 == OK)
4022 {
[76dd250]4023diff -Naur vim72.orig/src/move.c vim72/src/move.c
4024--- vim72.orig/src/move.c 2008-07-12 09:26:47.000000000 -0700
[9a875fd]4025+++ vim72/src/move.c 2009-02-07 22:15:20.110754575 -0800
[76dd250]4026@@ -280,18 +280,20 @@
4027
4028 if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
4029 {
4030- if (curwin->w_cursor.lnum < curwin->w_botline
4031- && ((long)curwin->w_cursor.lnum
4032+ if (curwin->w_cursor.lnum < curwin->w_botline)
4033+ {
4034+ if (((long)curwin->w_cursor.lnum
4035 >= (long)curwin->w_botline - p_so
4036 #ifdef FEAT_FOLDING
4037 || hasAnyFolding(curwin)
4038 #endif
4039 ))
4040- {
4041+ {
4042 lineoff_T loff;
4043
4044- /* Cursor is above botline, check if there are 'scrolloff'
4045- * window lines below the cursor. If not, need to scroll. */
4046+ /* Cursor is (a few lines) above botline, check if there are
4047+ * 'scrolloff' window lines below the cursor. If not, need to
4048+ * scroll. */
4049 n = curwin->w_empty_rows;
4050 loff.lnum = curwin->w_cursor.lnum;
4051 #ifdef FEAT_FOLDING
4052@@ -317,6 +319,10 @@
4053 if (n >= p_so)
4054 /* sufficient context, no need to scroll */
4055 check_botline = FALSE;
4056+ }
4057+ else
4058+ /* sufficient context, no need to scroll */
4059+ check_botline = FALSE;
4060 }
4061 if (check_botline)
4062 {
4063@@ -509,6 +515,9 @@
4064 /* Approximate the value of w_botline */
4065 wp->w_botline += lnum - wp->w_topline;
4066 wp->w_topline = lnum;
4067+#ifdef FEAT_AUTOCMD
4068+ wp->w_topline_was_set = TRUE;
4069+#endif
4070 #ifdef FEAT_DIFF
4071 wp->w_topfill = 0;
4072 #endif
4073diff -Naur vim72.orig/src/netbeans.c vim72/src/netbeans.c
4074--- vim72.orig/src/netbeans.c 2008-07-13 09:19:54.000000000 -0700
[9a875fd]4075+++ vim72/src/netbeans.c 2009-02-07 22:17:10.446515715 -0800
[76dd250]4076@@ -1043,7 +1043,7 @@
4077 nbdebug(("EVT: %s", buf));
4078 /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */
4079 if (sd >= 0)
4080- sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */
4081+ ignored = sock_write(sd, buf, (int)STRLEN(buf));
4082 }
4083 }
4084
4085@@ -2277,9 +2277,6 @@
4086 int serNum;
4087 int localTypeNum;
4088 int typeNum;
4089-# ifdef NBDEBUG
4090- int len;
4091-# endif
4092 pos_T *pos;
4093
4094 if (buf == NULL || buf->bufp == NULL)
4095@@ -2303,13 +2300,10 @@
4096 pos = get_off_or_lnum(buf->bufp, &args);
4097
4098 cp = (char *)args;
4099-# ifdef NBDEBUG
4100- len =
4101-# endif
4102- strtol(cp, &cp, 10);
4103+ ignored = (int)strtol(cp, &cp, 10);
4104 args = (char_u *)cp;
4105 # ifdef NBDEBUG
4106- if (len != -1)
4107+ if (ignored != -1)
4108 {
4109 nbdebug((" partial line annotation -- Not Yet Implemented!\n"));
4110 }
[43c52a1]4111@@ -2924,44 +2918,26 @@
4112 }
4113
4114 /*
4115- * Tell netbeans a file was closed.
4116+ * Tell netbeans that a file was deleted or wiped out.
4117 */
4118 void
4119-netbeans_file_closed(buf_T *bufp)
4120+netbeans_file_killed(buf_T *bufp)
4121 {
4122 int bufno = nb_getbufno(bufp);
4123 nbbuf_T *nbbuf = nb_get_buf(bufno);
4124 char buffer[2*MAXPATHL];
4125
4126- if (!haveConnection || bufno < 0)
4127- return;
4128-
4129- if (!netbeansCloseFile)
4130- {
4131- nbdebug(("Ignoring file_closed for %s. File was closed from IDE\n",
4132- bufp->b_ffname));
4133+ if (!haveConnection || bufno == -1)
4134 return;
4135- }
4136-
4137- nbdebug(("netbeans_file_closed:\n"));
4138- nbdebug((" Closing bufno: %d", bufno));
4139- if (curbuf != NULL && curbuf != bufp)
4140- {
4141- nbdebug((" Curbuf bufno: %d\n", nb_getbufno(curbuf)));
4142- }
4143- else if (curbuf == bufp)
4144- {
4145- nbdebug((" curbuf == bufp\n"));
4146- }
4147
4148- if (bufno <= 0)
4149- return;
4150+ nbdebug(("netbeans_file_killed:\n"));
4151+ nbdebug((" Killing bufno: %d", bufno));
4152
4153 sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno);
4154
4155 nbdebug(("EVT: %s", buffer));
4156
4157- nb_send(buffer, "netbeans_file_closed");
4158+ nb_send(buffer, "netbeans_file_killed");
4159
4160 if (nbbuf != NULL)
4161 nbbuf->bufp = NULL;
[76dd250]4162diff -Naur vim72.orig/src/normal.c vim72/src/normal.c
4163--- vim72.orig/src/normal.c 2008-07-31 13:03:08.000000000 -0700
[9a875fd]4164+++ vim72/src/normal.c 2009-02-07 22:17:56.080346418 -0800
[76dd250]4165@@ -183,6 +183,8 @@
4166 static void nv_cursorhold __ARGS((cmdarg_T *cap));
4167 #endif
4168
4169+static char *e_noident = N_("E349: No identifier under cursor");
4170+
4171 /*
4172 * Function to be called for a Normal or Visual mode command.
4173 * The argument is a cmdarg_T.
4174@@ -578,6 +580,9 @@
4175 static int old_mapped_len = 0;
4176 #endif
4177 int idx;
4178+#ifdef FEAT_EVAL
4179+ int set_prevcount = FALSE;
4180+#endif
4181
4182 vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
4183 ca.oap = oap;
4184@@ -613,7 +618,12 @@
4185 /* When not finishing an operator and no register name typed, reset the
4186 * count. */
4187 if (!finish_op && !oap->regname)
4188+ {
4189 ca.opcount = 0;
4190+#ifdef FEAT_EVAL
4191+ set_prevcount = TRUE;
4192+#endif
4193+ }
4194
4195 #ifdef FEAT_AUTOCMD
4196 /* Restore counts from before receiving K_CURSORHOLD. This means after
4197@@ -717,7 +727,15 @@
4198 * command, so that v:count can be used in an expression mapping
4199 * right after the count. */
4200 if (toplevel && stuff_empty())
4201- set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0);
4202+ {
4203+ long count = ca.count0;
4204+
4205+ /* multiply with ca.opcount the same way as below */
4206+ if (ca.opcount != 0)
4207+ count = ca.opcount * (count == 0 ? 1 : count);
4208+ set_vcount(count, count == 0 ? 1 : count, set_prevcount);
4209+ set_prevcount = FALSE; /* only set v:prevcount once */
4210+ }
4211 #endif
4212 if (ctrl_w)
4213 {
4214@@ -804,7 +822,7 @@
4215 * Only set v:count when called from main() and not a stuffed command.
4216 */
4217 if (toplevel && stuff_empty())
4218- set_vcount(ca.count0, ca.count1);
4219+ set_vcount(ca.count0, ca.count1, set_prevcount);
4220 #endif
4221
4222 /*
4223@@ -1132,7 +1150,8 @@
4224 out_flush();
4225 #endif
4226 #ifdef FEAT_AUTOCMD
4227- did_cursorhold = FALSE;
4228+ if (ca.cmdchar != K_IGNORE)
4229+ did_cursorhold = FALSE;
4230 #endif
4231
4232 State = NORMAL;
4233@@ -3509,7 +3528,7 @@
4234 if (find_type & FIND_STRING)
4235 EMSG(_("E348: No string under cursor"));
4236 else
4237- EMSG(_("E349: No identifier under cursor"));
4238+ EMSG(_(e_noident));
4239 return 0;
4240 }
4241 ptr += col;
4242@@ -5469,6 +5488,20 @@
4243 STRCPY(buf, "he! ");
4244 else
4245 {
4246+ /* An external command will probably use an argument starting
4247+ * with "-" as an option. To avoid trouble we skip the "-". */
4248+ while (*ptr == '-' && n > 0)
4249+ {
4250+ ++ptr;
4251+ --n;
4252+ }
4253+ if (n == 0)
4254+ {
4255+ EMSG(_(e_noident)); /* found dashes only */
4256+ vim_free(buf);
4257+ return;
4258+ }
4259+
4260 /* When a count is given, turn it into a range. Is this
4261 * really what we want? */
4262 isman = (STRCMP(kp, "man") == 0);
4263@@ -5511,37 +5544,59 @@
4264 /*
4265 * Now grab the chars in the identifier
4266 */
4267- if (cmdchar == '*')
4268- aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
4269- else if (cmdchar == '#')
4270- aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
4271- else if (cmdchar == 'K' && !kp_help)
4272- aux_ptr = (char_u *)" \t\\\"|!";
4273- else
4274- /* Don't escape spaces and Tabs in a tag with a backslash */
4275- aux_ptr = (char_u *)"\\|\"";
4276-
4277- p = buf + STRLEN(buf);
4278- while (n-- > 0)
4279- {
4280- /* put a backslash before \ and some others */
4281- if (vim_strchr(aux_ptr, *ptr) != NULL)
4282- *p++ = '\\';
4283-#ifdef FEAT_MBYTE
4284- /* When current byte is a part of multibyte character, copy all bytes
4285- * of that character. */
4286- if (has_mbyte)
4287+ if (cmdchar == 'K' && !kp_help)
4288+ {
4289+ /* Escape the argument properly for a shell command */
4290+ ptr = vim_strnsave(ptr, n);
4291+ p = vim_strsave_shellescape(ptr, TRUE);
4292+ vim_free(ptr);
4293+ if (p == NULL)
4294 {
4295- int i;
4296- int len = (*mb_ptr2len)(ptr) - 1;
4297-
4298- for (i = 0; i < len && n >= 1; ++i, --n)
4299- *p++ = *ptr++;
4300+ vim_free(buf);
4301+ return;
4302 }
4303+ buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
4304+ if (buf == NULL)
4305+ {
4306+ vim_free(buf);
4307+ vim_free(p);
4308+ return;
4309+ }
4310+ STRCAT(buf, p);
4311+ vim_free(p);
4312+ }
4313+ else
4314+ {
4315+ if (cmdchar == '*')
4316+ aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
4317+ else if (cmdchar == '#')
4318+ aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
4319+ else
4320+ /* Don't escape spaces and Tabs in a tag with a backslash */
4321+ aux_ptr = (char_u *)"\\|\"\n*?[";
4322+
4323+ p = buf + STRLEN(buf);
4324+ while (n-- > 0)
4325+ {
4326+ /* put a backslash before \ and some others */
4327+ if (vim_strchr(aux_ptr, *ptr) != NULL)
4328+ *p++ = '\\';
4329+#ifdef FEAT_MBYTE
4330+ /* When current byte is a part of multibyte character, copy all
4331+ * bytes of that character. */
4332+ if (has_mbyte)
4333+ {
4334+ int i;
4335+ int len = (*mb_ptr2len)(ptr) - 1;
4336+
4337+ for (i = 0; i < len && n >= 1; ++i, --n)
4338+ *p++ = *ptr++;
4339+ }
4340 #endif
4341- *p++ = *ptr++;
4342+ *p++ = *ptr++;
4343+ }
4344+ *p = NUL;
4345 }
4346- *p = NUL;
4347
4348 /*
4349 * Execute the command.
[9a875fd]4350@@ -6728,6 +6783,8 @@
4351 /* Visual mode "r" */
4352 if (VIsual_active)
4353 {
4354+ if (got_int)
4355+ reset_VIsual();
4356 nv_operator(cap);
4357 return;
4358 }
4359@@ -7784,7 +7841,7 @@
4360 else
4361 i = curwin->w_leftcol;
4362 /* Go to the middle of the screen line. When 'number' is on and lines
4363- * are wrapping the middle can be more to the left.*/
4364+ * are wrapping the middle can be more to the left. */
4365 if (cap->nchar == 'm')
4366 i += (W_WIDTH(curwin) - curwin_col_off()
4367 + ((curwin->w_p_wrap && i > 0)
[76dd250]4368diff -Naur vim72.orig/src/ops.c vim72/src/ops.c
4369--- vim72.orig/src/ops.c 2008-06-21 13:08:59.000000000 -0700
[9a875fd]4370+++ vim72/src/ops.c 2009-02-07 22:16:25.009559715 -0800
[76dd250]4371@@ -2209,12 +2209,15 @@
4372 {
4373 for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
4374 {
4375+ int one_change;
4376+
4377 block_prep(oap, &bd, pos.lnum, FALSE);
4378 pos.col = bd.textcol;
4379- did_change = swapchars(oap->op_type, &pos, bd.textlen);
4380+ one_change = swapchars(oap->op_type, &pos, bd.textlen);
4381+ did_change |= one_change;
4382
4383 # ifdef FEAT_NETBEANS_INTG
4384- if (usingNetbeans && did_change)
4385+ if (usingNetbeans && one_change)
4386 {
4387 char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
4388
4389diff -Naur vim72.orig/src/option.c vim72/src/option.c
4390--- vim72.orig/src/option.c 2008-07-18 06:05:33.000000000 -0700
[9a875fd]4391+++ vim72/src/option.c 2009-02-07 22:18:06.941245984 -0800
[76dd250]4392@@ -2593,13 +2593,13 @@
4393 #ifdef FEAT_VIMINFO
4394 (char_u *)&p_viminfo, PV_NONE,
4395 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
4396- {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
4397+ {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
4398 #else
4399 # ifdef AMIGA
4400 {(char_u *)"",
4401- (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
4402+ (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
4403 # else
4404- {(char_u *)"", (char_u *)"'20,<50,s10,h"}
4405+ {(char_u *)"", (char_u *)"'100,<50,s10,h"}
4406 # endif
4407 #endif
4408 #else
[9a875fd]4409@@ -5407,6 +5407,10 @@
4410 int did_chartab = FALSE;
4411 char_u **gvarp;
4412 long_u free_oldval = (options[opt_idx].flags & P_ALLOCED);
4413+#ifdef FEAT_GUI
4414+ /* set when changing an option that only requires a redraw in the GUI */
4415+ int redraw_gui_only = FALSE;
4416+#endif
4417
4418 /* Get the global option to compare with, otherwise we would have to check
4419 * two values for all local options. */
4420@@ -6055,6 +6059,7 @@
4421 errmsg = (char_u *)N_("E596: Invalid font(s)");
4422 }
4423 }
4424+ redraw_gui_only = TRUE;
4425 }
4426 # ifdef FEAT_XFONTSET
4427 else if (varp == &p_guifontset)
4428@@ -6063,6 +6068,7 @@
4429 errmsg = (char_u *)N_("E597: can't select fontset");
4430 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
4431 errmsg = (char_u *)N_("E598: Invalid fontset");
4432+ redraw_gui_only = TRUE;
4433 }
4434 # endif
4435 # ifdef FEAT_MBYTE
4436@@ -6072,6 +6078,7 @@
4437 errmsg = (char_u *)N_("E533: can't select wide font");
4438 else if (gui_get_wide_font() == FAIL)
4439 errmsg = (char_u *)N_("E534: Invalid wide font");
4440+ redraw_gui_only = TRUE;
4441 }
4442 # endif
4443 #endif
4444@@ -6133,13 +6140,24 @@
4445 #ifdef FEAT_GUI
4446 /* 'guioptions' */
4447 else if (varp == &p_go)
4448+ {
4449 gui_init_which_components(oldval);
4450+ redraw_gui_only = TRUE;
4451+ }
4452 #endif
4453
4454 #if defined(FEAT_GUI_TABLINE)
4455 /* 'guitablabel' */
4456 else if (varp == &p_gtl)
4457+ {
4458 redraw_tabline = TRUE;
4459+ redraw_gui_only = TRUE;
4460+ }
4461+ /* 'guitabtooltip' */
4462+ else if (varp == &p_gtt)
4463+ {
4464+ redraw_gui_only = TRUE;
4465+ }
4466 #endif
4467
4468 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
4469@@ -6717,7 +6735,11 @@
4470
4471 if (curwin->w_curswant != MAXCOL)
4472 curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */
4473- check_redraw(options[opt_idx].flags);
4474+#ifdef FEAT_GUI
4475+ /* check redraw when it's not a GUI option or the GUI is active. */
4476+ if (!redraw_gui_only || gui.in_use)
4477+#endif
4478+ check_redraw(options[opt_idx].flags);
4479
4480 return errmsg;
4481 }
4482@@ -7974,6 +7996,11 @@
[76dd250]4483 else /* curwin->w_p_scr > curwin->w_height */
4484 curwin->w_p_scr = curwin->w_height;
4485 }
4486+ if (p_hi < 0)
4487+ {
4488+ errmsg = e_positive;
4489+ p_hi = 0;
4490+ }
4491 if (p_report < 0)
4492 {
4493 errmsg = e_positive;
[9a875fd]4494@@ -8227,13 +8254,13 @@
[76dd250]4495 {
4496 if (number == 0 && string != NULL)
4497 {
4498- int index;
4499+ int idx;
4500
4501 /* Either we are given a string or we are setting option
4502 * to zero. */
4503- for (index = 0; string[index] == '0'; ++index)
4504+ for (idx = 0; string[idx] == '0'; ++idx)
4505 ;
4506- if (string[index] != NUL || index == 0)
4507+ if (string[idx] != NUL || idx == 0)
4508 {
4509 /* There's another character after zeros or the string
4510 * is empty. In both cases, we are trying to set a
[9a875fd]4511@@ -8323,7 +8350,7 @@
[1f22c7c]4512 {
4513 --arg; /* put arg at the '<' */
4514 modifiers = 0;
4515- key = find_special_key(&arg, &modifiers, TRUE);
4516+ key = find_special_key(&arg, &modifiers, TRUE, TRUE);
4517 if (modifiers) /* can't handle modifiers here */
4518 key = 0;
4519 }
[76dd250]4520diff -Naur vim72.orig/src/os_unix.c vim72/src/os_unix.c
4521--- vim72.orig/src/os_unix.c 2008-08-06 04:01:40.000000000 -0700
[9a875fd]4522+++ vim72/src/os_unix.c 2009-02-07 22:18:01.281110211 -0800
[76dd250]4523@@ -315,12 +315,15 @@
4524 {-1, "Unknown!", FALSE}
4525 };
4526
4527+/*
4528+ * Write s[len] to the screen.
4529+ */
4530 void
4531 mch_write(s, len)
4532 char_u *s;
4533 int len;
4534 {
4535- write(1, (char *)s, len);
4536+ ignored = (int)write(1, (char *)s, len);
4537 if (p_wd) /* Unix is too fast, slow down a bit more */
4538 RealWaitForChar(read_cmd_fd, p_wd, NULL);
4539 }
4540@@ -2905,7 +2908,7 @@
4541 * Ignore any errors.
4542 */
4543 #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
4544- signal_stack = malloc(SIGSTKSZ);
4545+ signal_stack = (char *)alloc(SIGSTKSZ);
4546 init_signal_stack();
4547 #endif
4548 }
4549@@ -2936,7 +2939,8 @@
4550 }
4551 # endif
4552 # endif
4553-# ifdef FEAT_X11
4554+ /* Don't close the display for GTK 1, it is done in exit(). */
4555+# if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2))
4556 if (x11_display != NULL
4557 # ifdef FEAT_XCLIPBOARD
4558 && x11_display != xterm_dpy
4559@@ -3926,9 +3930,9 @@
4560 */
4561 if (fd >= 0)
4562 {
4563- dup(fd); /* To replace stdin (file descriptor 0) */
4564- dup(fd); /* To replace stdout (file descriptor 1) */
4565- dup(fd); /* To replace stderr (file descriptor 2) */
4566+ ignored = dup(fd); /* To replace stdin (fd 0) */
4567+ ignored = dup(fd); /* To replace stdout (fd 1) */
4568+ ignored = dup(fd); /* To replace stderr (fd 2) */
4569
4570 /* Don't need this now that we've duplicated it */
4571 close(fd);
[9a875fd]4572@@ -3946,7 +3950,17 @@
4573 * children can be kill()ed. Don't do this when using pipes,
4574 * because stdin is not a tty, we would lose /dev/tty. */
4575 if (p_stmp)
4576+ {
4577 (void)setsid();
4578+# if defined(SIGHUP)
4579+ /* When doing "!xterm&" and 'shell' is bash: the shell
4580+ * will exit and send SIGHUP to all processes in its
4581+ * group, killing the just started process. Ignore SIGHUP
4582+ * to avoid that. (suggested by Simon Schubert)
4583+ */
4584+ signal(SIGHUP, SIG_IGN);
4585+# endif
4586+ }
4587 # endif
4588 # ifdef FEAT_GUI
4589 if (pty_slave_fd >= 0)
4590@@ -3996,13 +4010,13 @@
[76dd250]4591
4592 /* set up stdin/stdout/stderr for the child */
4593 close(0);
4594- dup(pty_slave_fd);
4595+ ignored = dup(pty_slave_fd);
4596 close(1);
4597- dup(pty_slave_fd);
4598+ ignored = dup(pty_slave_fd);
4599 if (gui.in_use)
4600 {
4601 close(2);
4602- dup(pty_slave_fd);
4603+ ignored = dup(pty_slave_fd);
4604 }
4605
4606 close(pty_slave_fd); /* has been dupped, close it now */
[9a875fd]4607@@ -4013,13 +4027,13 @@
[76dd250]4608 /* set up stdin for the child */
4609 close(fd_toshell[1]);
4610 close(0);
4611- dup(fd_toshell[0]);
4612+ ignored = dup(fd_toshell[0]);
4613 close(fd_toshell[0]);
4614
4615 /* set up stdout for the child */
4616 close(fd_fromshell[0]);
4617 close(1);
4618- dup(fd_fromshell[1]);
4619+ ignored = dup(fd_fromshell[1]);
4620 close(fd_fromshell[1]);
4621
4622 # ifdef FEAT_GUI
[9a875fd]4623@@ -4027,7 +4041,7 @@
[76dd250]4624 {
4625 /* set up stderr for the child */
4626 close(2);
4627- dup(1);
4628+ ignored = dup(1);
4629 }
4630 # endif
4631 }
[9a875fd]4632@@ -4158,7 +4172,8 @@
[76dd250]4633 && (lnum !=
4634 curbuf->b_ml.ml_line_count
4635 || curbuf->b_p_eol)))
4636- write(toshell_fd, "\n", (size_t)1);
4637+ ignored = write(toshell_fd, "\n",
4638+ (size_t)1);
4639 ++lnum;
4640 if (lnum > curbuf->b_op_end.lnum)
4641 {
[9a875fd]4642@@ -6814,7 +6829,8 @@
[76dd250]4643 if (xsmp_icefd != -1)
4644 {
4645 SmcCloseConnection(xsmp.smcconn, 0, NULL);
4646- vim_free(xsmp.clientid);
4647+ if (xsmp.clientid != NULL)
4648+ free(xsmp.clientid);
4649 xsmp.clientid = NULL;
4650 xsmp_icefd = -1;
4651 }
4652diff -Naur vim72.orig/src/proto/eval.pro vim72/src/proto/eval.pro
4653--- vim72.orig/src/proto/eval.pro 2008-08-09 07:31:25.000000000 -0700
[9a875fd]4654+++ vim72/src/proto/eval.pro 2009-02-07 22:15:36.283161615 -0800
[76dd250]4655@@ -17,7 +17,7 @@
4656 int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip));
4657 char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip));
4658 int skip_expr __ARGS((char_u **pp));
4659-char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));
4660+char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert));
4661 char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox));
4662 int eval_to_number __ARGS((char_u *expr));
4663 list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
4664@@ -46,7 +46,9 @@
4665 void list_unref __ARGS((list_T *l));
4666 void list_free __ARGS((list_T *l, int recurse));
4667 dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
4668+char_u *list_find_str __ARGS((list_T *l, long idx));
4669 int list_append_dict __ARGS((list_T *list, dict_T *dict));
4670+int list_append_string __ARGS((list_T *l, char_u *str, int len));
4671 int garbage_collect __ARGS((void));
4672 dict_T *dict_alloc __ARGS((void));
4673 int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
4674@@ -58,8 +60,10 @@
4675 void set_vim_var_nr __ARGS((int idx, long val));
4676 long get_vim_var_nr __ARGS((int idx));
4677 char_u *get_vim_var_str __ARGS((int idx));
4678-void set_vcount __ARGS((long count, long count1));
4679+list_T *get_vim_var_list __ARGS((int idx));
4680+void set_vcount __ARGS((long count, long count1, int set_prevcount));
4681 void set_vim_var_string __ARGS((int idx, char_u *val, int len));
4682+void set_vim_var_list __ARGS((int idx, list_T *val));
4683 void set_reg_var __ARGS((int c));
4684 char_u *v_exception __ARGS((char_u *oldval));
4685 char_u *v_throwpoint __ARGS((char_u *oldval));
4686@@ -94,6 +98,7 @@
4687 void write_viminfo_varlist __ARGS((FILE *fp));
4688 int store_session_globals __ARGS((FILE *fd));
4689 void last_set_msg __ARGS((scid_T scriptID));
4690+void ex_oldfiles __ARGS((exarg_T *eap));
4691 int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
4692 char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
4693 /* vim: set ft=c : */
4694diff -Naur vim72.orig/src/proto/ex_cmds.pro vim72/src/proto/ex_cmds.pro
4695--- vim72.orig/src/proto/ex_cmds.pro 2008-08-09 07:31:25.000000000 -0700
[9a875fd]4696+++ vim72/src/proto/ex_cmds.pro 2009-02-07 22:14:49.107148764 -0800
[76dd250]4697@@ -11,7 +11,7 @@
4698 char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
4699 void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
4700 int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
4701-int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
4702+int read_viminfo __ARGS((char_u *file, int flags));
4703 void write_viminfo __ARGS((char_u *file, int forceit));
4704 int viminfo_readline __ARGS((vir_T *virp));
4705 char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
4706diff -Naur vim72.orig/src/proto/ex_getln.pro vim72/src/proto/ex_getln.pro
4707--- vim72.orig/src/proto/ex_getln.pro 2008-08-09 07:31:28.000000000 -0700
[9a875fd]4708+++ vim72/src/proto/ex_getln.pro 2009-02-07 22:15:46.007933510 -0800
[76dd250]4709@@ -31,7 +31,7 @@
4710 void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
4711 int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
4712 int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
4713-char_u *globpath __ARGS((char_u *path, char_u *file));
4714+char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
4715 void init_history __ARGS((void));
4716 int get_histtype __ARGS((char_u *name));
4717 void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
4718diff -Naur vim72.orig/src/proto/mark.pro vim72/src/proto/mark.pro
4719--- vim72.orig/src/proto/mark.pro 2008-08-09 07:31:36.000000000 -0700
[9a875fd]4720+++ vim72/src/proto/mark.pro 2009-02-07 22:14:49.107148764 -0800
[76dd250]4721@@ -26,5 +26,5 @@
4722 void write_viminfo_filemarks __ARGS((FILE *fp));
4723 int removable __ARGS((char_u *name));
4724 int write_viminfo_marks __ARGS((FILE *fp_out));
4725-void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof));
4726+void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags));
4727 /* vim: set ft=c : */
[1f22c7c]4728diff -Naur vim72.orig/src/proto/misc2.pro vim72/src/proto/misc2.pro
4729--- vim72.orig/src/proto/misc2.pro 2008-08-09 07:31:40.000000000 -0700
[9a875fd]4730+++ vim72/src/proto/misc2.pro 2009-02-07 22:16:52.932903479 -0800
[1f22c7c]4731@@ -59,7 +59,7 @@
4732 int handle_x_keys __ARGS((int key));
4733 char_u *get_special_key_name __ARGS((int c, int modifiers));
4734 int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode));
4735-int find_special_key __ARGS((char_u **srcp, int *modp, int keycode));
4736+int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key));
4737 int extract_modifiers __ARGS((int key, int *modp));
4738 int find_special_key_in_table __ARGS((int c));
4739 int get_special_key_code __ARGS((char_u *name));
[43c52a1]4740diff -Naur vim72.orig/src/proto/netbeans.pro vim72/src/proto/netbeans.pro
4741--- vim72.orig/src/proto/netbeans.pro 2008-08-09 07:31:56.000000000 -0700
[9a875fd]4742+++ vim72/src/proto/netbeans.pro 2009-02-07 22:17:10.446515715 -0800
[43c52a1]4743@@ -11,7 +11,7 @@
4744 void netbeans_frame_moved __ARGS((int new_x, int new_y));
4745 void netbeans_file_activated __ARGS((buf_T *bufp));
4746 void netbeans_file_opened __ARGS((buf_T *bufp));
4747-void netbeans_file_closed __ARGS((buf_T *bufp));
4748+void netbeans_file_killed __ARGS((buf_T *bufp));
4749 void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen));
4750 void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
4751 void netbeans_unmodified __ARGS((buf_T *bufp));
[76dd250]4752diff -Naur vim72.orig/src/pty.c vim72/src/pty.c
4753--- vim72.orig/src/pty.c 2008-06-21 11:52:58.000000000 -0700
[9a875fd]4754+++ vim72/src/pty.c 2009-02-07 22:13:17.113511664 -0800
[76dd250]4755@@ -270,9 +270,10 @@
4756 }
4757 #endif
4758
4759-#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux)
4760+#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X)
4761
4762-/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */
4763+/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
4764+ * Same for Mac OS X Leopard. */
4765 #define PTY_DONE
4766 int
4767 OpenPTY(ttyn)
4768diff -Naur vim72.orig/src/screen.c vim72/src/screen.c
4769--- vim72.orig/src/screen.c 2008-07-24 07:45:07.000000000 -0700
[9a875fd]4770+++ vim72/src/screen.c 2009-02-07 22:14:27.770892024 -0800
[76dd250]4771@@ -2439,9 +2439,17 @@
4772
4773 #ifdef FEAT_SYN_HL
4774 /* Show 'cursorcolumn' in the fold line. */
4775- if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp))
4776- ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr(
4777- ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC));
4778+ if (wp->w_p_cuc)
4779+ {
4780+ txtcol += wp->w_virtcol;
4781+ if (wp->w_p_wrap)
4782+ txtcol -= wp->w_skipcol;
4783+ else
4784+ txtcol -= wp->w_leftcol;
4785+ if (txtcol >= 0 && txtcol < W_WIDTH(wp))
4786+ ScreenAttrs[off + txtcol] = hl_combine_attr(
4787+ ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
4788+ }
4789 #endif
4790
4791 SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
4792diff -Naur vim72.orig/src/spell.c vim72/src/spell.c
4793--- vim72.orig/src/spell.c 2008-07-12 12:20:55.000000000 -0700
[9a875fd]4794+++ vim72/src/spell.c 2009-02-07 22:16:39.143494343 -0800
[76dd250]4795@@ -77,7 +77,7 @@
4796
4797 /*
4798 * Do the opposite: based on a maximum end score and a known sound score,
4799- * compute the the maximum word score that can be used.
4800+ * compute the maximum word score that can be used.
4801 */
4802 #define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3)
4803
4804@@ -469,6 +469,7 @@
4805 garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */
4806 regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm
4807 * (NULL when no compounding) */
4808+ char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */
4809 char_u *sl_compstartflags; /* flags for first compound word */
4810 char_u *sl_compallflags; /* all flags for compound words */
4811 char_u sl_nobreak; /* When TRUE: no spaces between words */
4812@@ -625,7 +626,7 @@
4813 /* TRUE if a word appears in the list of banned words. */
4814 #define WAS_BANNED(su, word) (!HASHITEM_EMPTY(hash_find(&su->su_banned, word)))
4815
4816-/* Number of suggestions kept when cleaning up. we need to keep more than
4817+/* Number of suggestions kept when cleaning up. We need to keep more than
4818 * what is displayed, because when rescore_suggestions() is called the score
4819 * may change and wrong suggestions may be removed later. */
4820 #define SUG_CLEAN_COUNT(su) ((su)->su_maxcount < 130 ? 150 : (su)->su_maxcount + 20)
4821@@ -839,7 +840,10 @@
4822 static void slang_clear __ARGS((slang_T *lp));
4823 static void slang_clear_sug __ARGS((slang_T *lp));
4824 static void find_word __ARGS((matchinf_T *mip, int mode));
4825+static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap));
4826 static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags));
4827+static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag));
4828+static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags));
4829 static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req));
4830 static void find_prefix __ARGS((matchinf_T *mip, int mode));
4831 static int fold_more __ARGS((matchinf_T *mip));
4832@@ -1519,6 +1523,11 @@
4833 ((unsigned)flags >> 24)))
4834 continue;
4835
4836+ /* If there is a match with a CHECKCOMPOUNDPATTERN rule
4837+ * discard the compound word. */
4838+ if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
4839+ continue;
4840+
4841 if (mode == FIND_COMPOUND)
4842 {
4843 int capflags;
4844@@ -1577,6 +1586,11 @@
4845 if (!can_compound(slang, fword, mip->mi_compflags))
4846 continue;
4847 }
4848+ else if (slang->sl_comprules != NULL
4849+ && !match_compoundrule(slang, mip->mi_compflags))
4850+ /* The compound flags collected so far do not match any
4851+ * COMPOUNDRULE, discard the compounded word. */
4852+ continue;
4853 }
4854
4855 /* Check NEEDCOMPOUND: can't use word without compounding. */
4856@@ -1727,6 +1741,39 @@
4857 }
4858
4859 /*
4860+ * Return TRUE if there is a match between the word ptr[wlen] and
4861+ * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
4862+ * word.
4863+ * A match means that the first part of CHECKCOMPOUNDPATTERN matches at the
4864+ * end of ptr[wlen] and the second part matches after it.
4865+ */
4866+ static int
4867+match_checkcompoundpattern(ptr, wlen, gap)
4868+ char_u *ptr;
4869+ int wlen;
4870+ garray_T *gap; /* &sl_comppat */
4871+{
4872+ int i;
4873+ char_u *p;
4874+ int len;
4875+
4876+ for (i = 0; i + 1 < gap->ga_len; i += 2)
4877+ {
4878+ p = ((char_u **)gap->ga_data)[i + 1];
4879+ if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
4880+ {
4881+ /* Second part matches at start of following compound word, now
4882+ * check if first part matches at end of previous word. */
4883+ p = ((char_u **)gap->ga_data)[i];
4884+ len = (int)STRLEN(p);
4885+ if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
4886+ return TRUE;
4887+ }
4888+ }
4889+ return FALSE;
4890+}
4891+
4892+/*
4893 * Return TRUE if "flags" is a valid sequence of compound flags and "word"
4894 * does not have too many syllables.
4895 */
4896@@ -1773,6 +1820,98 @@
4897 }
4898
4899 /*
4900+ * Return TRUE when the sequence of flags in "compflags" plus "flag" can
4901+ * possibly form a valid compounded word. This also checks the COMPOUNDRULE
4902+ * lines if they don't contain wildcards.
4903+ */
4904+ static int
4905+can_be_compound(sp, slang, compflags, flag)
4906+ trystate_T *sp;
4907+ slang_T *slang;
4908+ char_u *compflags;
4909+ int flag;
4910+{
4911+ /* If the flag doesn't appear in sl_compstartflags or sl_compallflags
4912+ * then it can't possibly compound. */
4913+ if (!byte_in_str(sp->ts_complen == sp->ts_compsplit
4914+ ? slang->sl_compstartflags : slang->sl_compallflags, flag))
4915+ return FALSE;
4916+
4917+ /* If there are no wildcards, we can check if the flags collected so far
4918+ * possibly can form a match with COMPOUNDRULE patterns. This only
4919+ * makes sense when we have two or more words. */
4920+ if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit)
4921+ {
4922+ int v;
4923+
4924+ compflags[sp->ts_complen] = flag;
4925+ compflags[sp->ts_complen + 1] = NUL;
4926+ v = match_compoundrule(slang, compflags + sp->ts_compsplit);
4927+ compflags[sp->ts_complen] = NUL;
4928+ return v;
4929+ }
4930+
4931+ return TRUE;
4932+}
4933+
4934+
4935+/*
4936+ * Return TRUE if the compound flags in compflags[] match the start of any
4937+ * compound rule. This is used to stop trying a compound if the flags
4938+ * collected so far can't possibly match any compound rule.
4939+ * Caller must check that slang->sl_comprules is not NULL.
4940+ */
4941+ static int
4942+match_compoundrule(slang, compflags)
4943+ slang_T *slang;
4944+ char_u *compflags;
4945+{
4946+ char_u *p;
4947+ int i;
4948+ int c;
4949+
4950+ /* loop over all the COMPOUNDRULE entries */
4951+ for (p = slang->sl_comprules; *p != NUL; ++p)
4952+ {
4953+ /* loop over the flags in the compound word we have made, match
4954+ * them against the current rule entry */
4955+ for (i = 0; ; ++i)
4956+ {
4957+ c = compflags[i];
4958+ if (c == NUL)
4959+ /* found a rule that matches for the flags we have so far */
4960+ return TRUE;
4961+ if (*p == '/' || *p == NUL)
4962+ break; /* end of rule, it's too short */
4963+ if (*p == '[')
4964+ {
4965+ int match = FALSE;
4966+
4967+ /* compare against all the flags in [] */
4968+ ++p;
4969+ while (*p != ']' && *p != NUL)
4970+ if (*p++ == c)
4971+ match = TRUE;
4972+ if (!match)
4973+ break; /* none matches */
4974+ }
4975+ else if (*p != c)
4976+ break; /* flag of word doesn't match flag in pattern */
4977+ ++p;
4978+ }
4979+
4980+ /* Skip to the next "/", where the next pattern starts. */
4981+ p = vim_strchr(p, '/');
4982+ if (p == NULL)
4983+ break;
4984+ }
4985+
4986+ /* Checked all the rules and none of them match the flags, so there
4987+ * can't possibly be a compound starting with these flags. */
4988+ return FALSE;
4989+}
4990+
4991+/*
4992 * Return non-zero if the prefix indicated by "arridx" matches with the prefix
4993 * ID in "flags" for the word "word".
4994 * The WF_RAREPFX flag is included in the return value for a rare prefix.
4995@@ -2513,9 +2652,11 @@
4996 lp->sl_midword = NULL;
4997
4998 vim_free(lp->sl_compprog);
4999+ vim_free(lp->sl_comprules);
5000 vim_free(lp->sl_compstartflags);
5001 vim_free(lp->sl_compallflags);
5002 lp->sl_compprog = NULL;
5003+ lp->sl_comprules = NULL;
5004 lp->sl_compstartflags = NULL;
5005 lp->sl_compallflags = NULL;
5006
5007@@ -3460,6 +3601,7 @@
5008 char_u *pp;
5009 char_u *cp;
5010 char_u *ap;
5011+ char_u *crp;
5012 int cnt;
5013 garray_T *gap;
5014
5015@@ -3545,6 +3687,12 @@
5016 slang->sl_compallflags = ap;
5017 *ap = NUL;
5018
5019+ /* And a list of all patterns in their original form, for checking whether
5020+ * compounding may work in match_compoundrule(). This is freed when we
5021+ * encounter a wildcard, the check doesn't work then. */
5022+ crp = alloc(todo + 1);
5023+ slang->sl_comprules = crp;
5024+
5025 pp = pat;
5026 *pp++ = '^';
5027 *pp++ = '\\';
5028@@ -3587,6 +3735,20 @@
5029 atstart = 0;
5030 }
5031 }
5032+
5033+ /* Copy flag to "sl_comprules", unless we run into a wildcard. */
5034+ if (crp != NULL)
5035+ {
5036+ if (c == '+' || c == '*')
5037+ {
5038+ vim_free(slang->sl_comprules);
5039+ slang->sl_comprules = NULL;
5040+ crp = NULL;
5041+ }
5042+ else
5043+ *crp++ = c;
5044+ }
5045+
5046 if (c == '/') /* slash separates two items */
5047 {
5048 *pp++ = '\\';
5049@@ -3611,6 +3773,9 @@
5050 *pp++ = '$';
5051 *pp = NUL;
5052
5053+ if (crp != NULL)
5054+ *crp = NUL;
5055+
5056 slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
5057 vim_free(pat);
5058 if (slang->sl_compprog == NULL)
5059@@ -4915,6 +5080,7 @@
5060 } spellinfo_T;
5061
5062 static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
5063+static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount));
5064 static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry));
5065 static int spell_info_item __ARGS((char_u *s));
5066 static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
5067@@ -4950,7 +5116,7 @@
5068 static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd));
5069 static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname));
5070 static void clear_node __ARGS((wordnode_T *node));
5071-static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree));
5072+static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree));
5073 static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname));
5074 static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang));
5075 static int sug_maketable __ARGS((spellinfo_T *spin));
5076@@ -5223,8 +5389,7 @@
5077 /* Handle non-empty lines. */
5078 if (itemcnt > 0)
5079 {
5080- if (STRCMP(items[0], "SET") == 0 && itemcnt == 2
5081- && aff->af_enc == NULL)
5082+ if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
5083 {
5084 #ifdef FEAT_MBYTE
5085 /* Setup for conversion from "ENC" to 'encoding'. */
5086@@ -5239,7 +5404,7 @@
5087 smsg((char_u *)_("Conversion in %s not supported"), fname);
5088 #endif
5089 }
5090- else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2
5091+ else if (is_aff_rule(items, itemcnt, "FLAG", 2)
5092 && aff->af_flagtype == AFT_CHAR)
5093 {
5094 if (STRCMP(items[1], "long") == 0)
5095@@ -5284,69 +5449,71 @@
5096 spin->si_info = p;
5097 }
5098 }
5099- else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
5100+ else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
5101 && midword == NULL)
5102 {
5103 midword = getroom_save(spin, items[1]);
5104 }
5105- else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
5106+ else if (is_aff_rule(items, itemcnt, "TRY", 2))
5107 {
5108 /* ignored, we look in the tree for what chars may appear */
5109 }
5110 /* TODO: remove "RAR" later */
5111- else if ((STRCMP(items[0], "RAR") == 0
5112- || STRCMP(items[0], "RARE") == 0) && itemcnt == 2
5113- && aff->af_rare == 0)
5114+ else if ((is_aff_rule(items, itemcnt, "RAR", 2)
5115+ || is_aff_rule(items, itemcnt, "RARE", 2))
5116+ && aff->af_rare == 0)
5117 {
5118 aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
5119 fname, lnum);
5120 }
5121 /* TODO: remove "KEP" later */
5122- else if ((STRCMP(items[0], "KEP") == 0
5123- || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2
5124+ else if ((is_aff_rule(items, itemcnt, "KEP", 2)
5125+ || is_aff_rule(items, itemcnt, "KEEPCASE", 2))
5126 && aff->af_keepcase == 0)
5127 {
5128 aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
5129 fname, lnum);
5130 }
5131- else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2
5132- && aff->af_bad == 0)
5133+ else if ((is_aff_rule(items, itemcnt, "BAD", 2)
5134+ || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2))
5135+ && aff->af_bad == 0)
5136 {
5137 aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
5138 fname, lnum);
5139 }
5140- else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2
5141+ else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2)
5142 && aff->af_needaffix == 0)
5143 {
5144 aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
5145 fname, lnum);
5146 }
5147- else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2
5148+ else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2)
5149 && aff->af_circumfix == 0)
5150 {
5151 aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
5152 fname, lnum);
5153 }
5154- else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2
5155+ else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2)
5156 && aff->af_nosuggest == 0)
5157 {
5158 aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
5159 fname, lnum);
5160 }
5161- else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2
5162+ else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2)
5163+ || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2))
5164 && aff->af_needcomp == 0)
5165 {
5166 aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
5167 fname, lnum);
5168 }
5169- else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2
5170+ else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2)
5171 && aff->af_comproot == 0)
5172 {
5173 aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
5174 fname, lnum);
5175 }
5176- else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0
5177- && itemcnt == 2 && aff->af_compforbid == 0)
5178+ else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2)
5179+ && aff->af_compforbid == 0)
5180 {
5181 aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
5182 fname, lnum);
5183@@ -5354,8 +5521,8 @@
5184 smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
5185 fname, lnum);
5186 }
5187- else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0
5188- && itemcnt == 2 && aff->af_comppermit == 0)
5189+ else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
5190+ && aff->af_comppermit == 0)
5191 {
5192 aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
5193 fname, lnum);
5194@@ -5363,7 +5530,7 @@
5195 smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
5196 fname, lnum);
5197 }
5198- else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
5199+ else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
5200 && compflags == NULL)
5201 {
5202 /* Turn flag "c" into COMPOUNDRULE compatible string "c+",
5203@@ -5376,7 +5543,15 @@
5204 compflags = p;
5205 }
5206 }
5207- else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
5208+ else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
5209+ {
5210+ /* We don't use the count, but do check that it's a number and
5211+ * not COMPOUNDRULE mistyped. */
5212+ if (atoi((char *)items[1]) == 0)
5213+ smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"),
5214+ fname, lnum, items[1]);
5215+ }
5216+ else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
5217 {
5218 /* Concatenate this string to previously defined ones, using a
5219 * slash to separate them. */
5220@@ -5395,7 +5570,7 @@
5221 compflags = p;
5222 }
5223 }
5224- else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
5225+ else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
5226 && compmax == 0)
5227 {
5228 compmax = atoi((char *)items[1]);
5229@@ -5403,7 +5578,7 @@
5230 smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
5231 fname, lnum, items[1]);
5232 }
5233- else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
5234+ else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
5235 && compminlen == 0)
5236 {
5237 compminlen = atoi((char *)items[1]);
5238@@ -5411,7 +5586,7 @@
5239 smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
5240 fname, lnum, items[1]);
5241 }
5242- else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
5243+ else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
5244 && compsylmax == 0)
5245 {
5246 compsylmax = atoi((char *)items[1]);
5247@@ -5419,32 +5594,29 @@
5248 smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
5249 fname, lnum, items[1]);
5250 }
5251- else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
5252+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
5253 {
5254 compoptions |= COMP_CHECKDUP;
5255 }
5256- else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
5257+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
5258 {
5259 compoptions |= COMP_CHECKREP;
5260 }
5261- else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
5262+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
5263 {
5264 compoptions |= COMP_CHECKCASE;
5265 }
5266- else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
5267- && itemcnt == 1)
5268+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
5269 {
5270 compoptions |= COMP_CHECKTRIPLE;
5271 }
5272- else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
5273- && itemcnt == 2)
5274+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
5275 {
5276 if (atoi((char *)items[1]) == 0)
5277 smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
5278 fname, lnum, items[1]);
5279 }
5280- else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
5281- && itemcnt == 3)
5282+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
5283 {
5284 garray_T *gap = &spin->si_comppat;
5285 int i;
5286@@ -5463,24 +5635,24 @@
5287 = getroom_save(spin, items[2]);
5288 }
5289 }
5290- else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
5291+ else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
5292 && syllable == NULL)
5293 {
5294 syllable = getroom_save(spin, items[1]);
5295 }
5296- else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
5297+ else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
5298 {
5299 spin->si_nobreak = TRUE;
5300 }
5301- else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
5302+ else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
5303 {
5304 spin->si_nosplitsugs = TRUE;
5305 }
5306- else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
5307+ else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
5308 {
5309 spin->si_nosugfile = TRUE;
5310 }
5311- else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
5312+ else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
5313 {
5314 aff->af_pfxpostpone = TRUE;
5315 }
5316@@ -5771,24 +5943,20 @@
5317 }
5318 }
5319 }
5320- else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
5321- && fol == NULL)
5322+ else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
5323 {
5324 fol = vim_strsave(items[1]);
5325 }
5326- else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
5327- && low == NULL)
5328+ else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
5329 {
5330 low = vim_strsave(items[1]);
5331 }
5332- else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
5333- && upp == NULL)
5334+ else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
5335 {
5336 upp = vim_strsave(items[1]);
5337 }
5338- else if ((STRCMP(items[0], "REP") == 0
5339- || STRCMP(items[0], "REPSAL") == 0)
5340- && itemcnt == 2)
5341+ else if (is_aff_rule(items, itemcnt, "REP", 2)
5342+ || is_aff_rule(items, itemcnt, "REPSAL", 2))
5343 {
5344 /* Ignore REP/REPSAL count */;
5345 if (!isdigit(*items[1]))
5346@@ -5819,7 +5987,7 @@
5347 : &spin->si_rep, items[1], items[2]);
5348 }
5349 }
5350- else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
5351+ else if (is_aff_rule(items, itemcnt, "MAP", 2))
5352 {
5353 /* MAP item or count */
5354 if (!found_map)
5355@@ -5856,9 +6024,8 @@
5356 ga_append(&spin->si_map, '/');
5357 }
5358 }
5359- /* Accept "SAL from to" and "SAL from to # comment". */
5360- else if (STRCMP(items[0], "SAL") == 0
5361- && (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#')))
5362+ /* Accept "SAL from to" and "SAL from to #comment". */
5363+ else if (is_aff_rule(items, itemcnt, "SAL", 3))
5364 {
5365 if (do_sal)
5366 {
5367@@ -5877,12 +6044,12 @@
5368 : items[2]);
5369 }
5370 }
5371- else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
5372+ else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
5373 && sofofrom == NULL)
5374 {
5375 sofofrom = getroom_save(spin, items[1]);
5376 }
5377- else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
5378+ else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
5379 && sofoto == NULL)
5380 {
5381 sofoto = getroom_save(spin, items[1]);
5382@@ -5980,7 +6147,7 @@
5383 else if (spin->si_newprefID == 0 || spin->si_newprefID == 127)
5384 MSG(_("Too many compound flags"));
5385 else
5386- MSG(_("Too many posponed prefixes and/or compound flags"));
5387+ MSG(_("Too many postponed prefixes and/or compound flags"));
5388 }
5389
5390 if (syllable != NULL)
5391@@ -6017,6 +6184,22 @@
5392 }
5393
5394 /*
5395+ * Return TRUE when items[0] equals "rulename", there are "mincount" items or
5396+ * a comment is following after item "mincount".
5397+ */
5398+ static int
5399+is_aff_rule(items, itemcnt, rulename, mincount)
5400+ char_u **items;
5401+ int itemcnt;
5402+ char *rulename;
5403+ int mincount;
5404+{
5405+ return (STRCMP(items[0], rulename) == 0
5406+ && (itemcnt == mincount
5407+ || (itemcnt > mincount && items[mincount][0] == '#')));
5408+}
5409+
5410+/*
5411 * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
5412 * ae_flags to ae_comppermit and ae_compforbid.
5413 */
5414@@ -7926,6 +8109,8 @@
5415 char_u *p;
5416 int rr;
5417 int retval = OK;
5418+ size_t fwv = 1; /* collect return value of fwrite() to avoid
5419+ warnings from picky compiler */
5420
5421 fd = mch_fopen((char *)fname, "w");
5422 if (fd == NULL)
5423@@ -7936,11 +8121,11 @@
5424
5425 /* <HEADER>: <fileID> <versionnr> */
5426 /* <fileID> */
5427- if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)
5428- {
5429- EMSG(_(e_write));
5430- retval = FAIL;
5431- }
5432+ fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
5433+ if (fwv != (size_t)1)
5434+ /* Catch first write error, don't try writing more. */
5435+ goto theend;
5436+
5437 putc(VIMSPELLVERSION, fd); /* <versionnr> */
5438
5439 /*
5440@@ -7955,7 +8140,7 @@
5441
5442 i = (int)STRLEN(spin->si_info);
5443 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
5444- fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
5445+ fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
5446 }
5447
5448 /* SN_REGION: <regionname> ...
5449@@ -7966,7 +8151,7 @@
5450 putc(SNF_REQUIRED, fd); /* <sectionflags> */
5451 l = spin->si_region_count * 2;
5452 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
5453- fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
5454+ fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
5455 /* <regionname> ... */
5456 regionmask = (1 << spin->si_region_count) - 1;
5457 }
5458@@ -8016,7 +8201,7 @@
5459 }
5460
5461 put_bytes(fd, (long_u)l, 2); /* <folcharslen> */
5462- fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
5463+ fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
5464 }
5465
5466 /* SN_MIDWORD: <midword> */
5467@@ -8027,7 +8212,8 @@
5468
5469 i = (int)STRLEN(spin->si_midword);
5470 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
5471- fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */
5472+ fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd);
5473+ /* <midword> */
5474 }
5475
5476 /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
5477@@ -8113,7 +8299,8 @@
5478 p = rr == 1 ? ftp->ft_from : ftp->ft_to;
5479 l = (int)STRLEN(p);
5480 putc(l, fd);
5481- fwrite(p, l, (size_t)1, fd);
5482+ if (l > 0)
5483+ fwv &= fwrite(p, l, (size_t)1, fd);
5484 }
5485 }
5486
5487@@ -8131,11 +8318,11 @@
5488 /* <sectionlen> */
5489
5490 put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
5491- fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
5492+ fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
5493
5494 l = (int)STRLEN(spin->si_sofoto);
5495 put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
5496- fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
5497+ fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
5498 }
5499
5500 /* SN_WORDS: <word> ...
5501@@ -8160,7 +8347,7 @@
5502 l = (int)STRLEN(hi->hi_key) + 1;
5503 len += l;
5504 if (round == 2) /* <word> */
5505- fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
5506+ fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
5507 --todo;
5508 }
5509 if (round == 1)
5510@@ -8176,7 +8363,7 @@
5511 putc(0, fd); /* <sectionflags> */
5512 l = spin->si_map.ga_len;
5513 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
5514- fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
5515+ fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
5516 /* <mapstr> */
5517 }
5518
5519@@ -8232,10 +8419,11 @@
5520 {
5521 p = ((char_u **)(spin->si_comppat.ga_data))[i];
5522 putc((int)STRLEN(p), fd); /* <comppatlen> */
5523- fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */
5524+ fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);
5525+ /* <comppattext> */
5526 }
5527 /* <compflags> */
5528- fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
5529+ fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
5530 (size_t)1, fd);
5531 }
5532
5533@@ -8259,7 +8447,8 @@
5534
5535 l = (int)STRLEN(spin->si_syllable);
5536 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
5537- fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */
5538+ fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd);
5539+ /* <syllable> */
5540 }
5541
5542 /* end of <SECTIONS> */
5543@@ -8295,13 +8484,18 @@
5544 (void)put_node(fd, tree, 0, regionmask, round == 3);
5545 }
5546
5547- /* Write another byte to check for errors. */
5548+ /* Write another byte to check for errors (file system full). */
5549 if (putc(0, fd) == EOF)
5550 retval = FAIL;
5551-
5552+theend:
5553 if (fclose(fd) == EOF)
5554 retval = FAIL;
5555
5556+ if (fwv != (size_t)1)
5557+ retval = FAIL;
5558+ if (retval == FAIL)
5559+ EMSG(_(e_write));
5560+
5561 return retval;
5562 }
5563
5564@@ -9890,6 +10084,7 @@
5565 char_u *p;
5566 int len;
5567 int totlen;
5568+ size_t x = 1; /* collect return value of fwrite() */
5569
5570 if (fd != NULL)
5571 put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
5572@@ -9906,7 +10101,7 @@
5573 if (fd != NULL)
5574 {
5575 fputc(len, fd);
5576- fwrite(p, (size_t)len, (size_t)1, fd);
5577+ x &= fwrite(p, (size_t)len, (size_t)1, fd);
5578 }
5579 totlen += len;
5580 }
5581@@ -11480,15 +11675,24 @@
5582 vim_strncpy(preword + sp->ts_prewordlen,
5583 tword + sp->ts_splitoff,
5584 sp->ts_twordlen - sp->ts_splitoff);
5585- p = preword;
5586- while (*skiptowhite(p) != NUL)
5587- p = skipwhite(skiptowhite(p));
5588- if (fword_ends && !can_compound(slang, p,
5589- compflags + sp->ts_compsplit))
5590- /* Compound is not allowed. But it may still be
5591- * possible if we add another (short) word. */
5592+
5593+ /* Verify CHECKCOMPOUNDPATTERN rules. */
5594+ if (match_checkcompoundpattern(preword, sp->ts_prewordlen,
5595+ &slang->sl_comppat))
5596 compound_ok = FALSE;
5597
5598+ if (compound_ok)
5599+ {
5600+ p = preword;
5601+ while (*skiptowhite(p) != NUL)
5602+ p = skipwhite(skiptowhite(p));
5603+ if (fword_ends && !can_compound(slang, p,
5604+ compflags + sp->ts_compsplit))
5605+ /* Compound is not allowed. But it may still be
5606+ * possible if we add another (short) word. */
5607+ compound_ok = FALSE;
5608+ }
5609+
5610 /* Get pointer to last char of previous word. */
5611 p = preword + sp->ts_prewordlen;
5612 mb_ptr_back(preword, p);
5613@@ -11685,10 +11889,9 @@
5614 && (slang->sl_compsylmax < MAXWLEN
5615 || sp->ts_complen + 1 - sp->ts_compsplit
5616 < slang->sl_compmax)
5617- && (byte_in_str(sp->ts_complen == sp->ts_compsplit
5618- ? slang->sl_compstartflags
5619- : slang->sl_compallflags,
5620- ((unsigned)flags >> 24))))
5621+ && (can_be_compound(sp, slang,
5622+ compflags, ((unsigned)flags >> 24))))
5623+
5624 {
5625 try_compound = TRUE;
5626 compflags[sp->ts_complen] = ((unsigned)flags >> 24);
5627diff -Naur vim72.orig/src/structs.h vim72/src/structs.h
5628--- vim72.orig/src/structs.h 2008-07-30 13:02:50.000000000 -0700
[9a875fd]5629+++ vim72/src/structs.h 2009-02-07 22:15:20.110754575 -0800
[76dd250]5630@@ -459,7 +459,7 @@
5631 typedef struct
5632 {
5633 int hide; /* TRUE when ":hide" was used */
5634-# ifdef FEAT_BROWSE
5635+# ifdef FEAT_BROWSE_CMD
5636 int browse; /* TRUE to invoke file dialog */
5637 # endif
5638 # ifdef FEAT_WINDOWS
5639@@ -1784,10 +1784,15 @@
5640 #endif
5641
5642 /*
5643- * The next three specify the offsets for displaying the buffer:
5644+ * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
5645+ * displaying the buffer.
5646 */
5647 linenr_T w_topline; /* buffer line number of the line at the
5648 top of the window */
5649+#ifdef FEAT_AUTOCMD
5650+ char w_topline_was_set; /* flag set to TRUE when topline is set,
5651+ e.g. by winrestview() */
5652+#endif
5653 #ifdef FEAT_DIFF
5654 int w_topfill; /* number of filler lines above w_topline */
5655 int w_old_topfill; /* w_topfill at last redraw */
5656diff -Naur vim72.orig/src/tag.c vim72/src/tag.c
5657--- vim72.orig/src/tag.c 2008-07-16 14:31:30.000000000 -0700
[9a875fd]5658+++ vim72/src/tag.c 2009-02-07 22:17:21.020306747 -0800
[7352c10]5659@@ -515,7 +515,7 @@
5660 * If a count is supplied to the ":tag <name>" command, then
5661 * jump to count'th matching tag.
5662 */
5663- if (type == DT_TAG && count > 0)
5664+ if (type == DT_TAG && *tag != NUL && count > 0)
5665 cur_match = count - 1;
5666
5667 if (type == DT_SELECT || type == DT_JUMP
[76dd250]5668@@ -2725,7 +2725,24 @@
5669 */
5670 p_7f = vim_strchr(lbuf, 0x7f);
5671 if (p_7f == NULL)
5672+ {
5673+etag_fail:
5674+ if (vim_strchr(lbuf, '\n') == NULL)
5675+ {
5676+ /* Truncated line. Ignore it. */
5677+ if (p_verbose >= 5)
5678+ {
5679+ verbose_enter();
5680+ MSG(_("Ignoring long line in tags file"));
5681+ verbose_leave();
5682+ }
5683+ tagp->command = lbuf;
5684+ tagp->tagname = lbuf;
5685+ tagp->tagname_end = lbuf;
5686+ return OK;
5687+ }
5688 return FAIL;
5689+ }
5690
5691 /* Find ^A. If not found the line number is after the 0x7f */
5692 p = vim_strchr(p_7f, Ctrl_A);
5693@@ -2735,7 +2752,7 @@
5694 ++p;
5695
5696 if (!VIM_ISDIGIT(*p)) /* check for start of line number */
5697- return FAIL;
5698+ goto etag_fail;
5699 tagp->command = p;
5700
5701
5702@@ -2749,7 +2766,7 @@
5703 /* find end of tagname */
5704 for (p = p_7f - 1; !vim_iswordc(*p); --p)
5705 if (p == lbuf)
5706- return FAIL;
5707+ goto etag_fail;
5708 tagp->tagname_end = p + 1;
5709 while (p >= lbuf && vim_iswordc(*p))
5710 --p;
[5f4a45c9]5711diff -Naur vim72.orig/src/term.c vim72/src/term.c
5712--- vim72.orig/src/term.c 2008-07-27 04:48:06.000000000 -0700
[9a875fd]5713+++ vim72/src/term.c 2009-02-07 22:17:26.245680123 -0800
[5f4a45c9]5714@@ -4920,7 +4920,15 @@
5715 key_name[0] = KEY2TERMCAP0(key);
5716 key_name[1] = KEY2TERMCAP1(key);
5717 if (key_name[0] == KS_KEY)
5718- string[new_slen++] = key_name[1]; /* from ":set <M-b>=xx" */
5719+ {
5720+ /* from ":set <M-b>=xx" */
5721+#ifdef FEAT_MBYTE
5722+ if (has_mbyte)
5723+ new_slen += (*mb_char2bytes)(key_name[1], string + new_slen);
5724+ else
5725+#endif
5726+ string[new_slen++] = key_name[1];
5727+ }
5728 else
5729 {
5730 string[new_slen++] = K_SPECIAL;
5731diff -Naur vim72.orig/src/testdir/Makefile vim72/src/testdir/Makefile
5732--- vim72.orig/src/testdir/Makefile 2008-06-19 13:29:46.000000000 -0700
[9a875fd]5733+++ vim72/src/testdir/Makefile 2009-02-07 22:14:04.798116497 -0800
[5f4a45c9]5734@@ -26,15 +26,17 @@
5735
5736 .SUFFIXES: .in .out
5737
5738-nongui: nolog $(SCRIPTS)
5739- @echo
5740- @cat test.log
5741- @echo ALL DONE
5742+nongui: nolog $(SCRIPTS) report
5743+
5744+gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
5745
5746-gui: nolog $(SCRIPTS) $(SCRIPTS_GUI)
5747+report:
5748 @echo
5749- @cat test.log
5750- @echo ALL DONE
5751+ @echo 'Test results:'
5752+ @/bin/sh -c "if test -f test.log; \
5753+ then cat test.log; echo TEST FAILURE; exit 1; \
5754+ else echo ALL DONE; \
5755+ fi"
5756
5757 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
5758
5759@@ -71,4 +73,4 @@
5760 test60.out: test60.vim
5761
5762 nolog:
5763- -echo Test results: >test.log
5764+ -rm -f test.log
[76dd250]5765diff -Naur vim72.orig/src/testdir/Make_ming.mak vim72/src/testdir/Make_ming.mak
5766--- vim72.orig/src/testdir/Make_ming.mak 1969-12-31 16:00:00.000000000 -0800
[9a875fd]5767+++ vim72/src/testdir/Make_ming.mak 2009-02-07 22:14:24.920315687 -0800
[76dd250]5768@@ -0,0 +1,91 @@
5769+# Makefile to run tests for Vim, on Dos-like machines
5770+# with sh.exe or zsh.exe in the path or not.
5771+#
5772+# Author: Bill McCarthy
5773+#
5774+# Note that test54 has been removed until it is fixed.
5775+#
5776+# Requires a set of Unix tools: echo, diff, etc.
5777+
5778+ifneq (sh.exe, $(SHELL))
5779+DEL = rm -f
5780+MV = mv
5781+CP = cp
5782+DIRSLASH = /
5783+else
5784+DEL = del
5785+MV = rename
5786+CP = copy
5787+DIRSLASH = \\
5788+endif
5789+
5790+VIMPROG = ..$(DIRSLASH)vim
5791+
5792+# Omitted:
5793+# test2 "\\tmp" doesn't work.
5794+# test10 'errorformat' is different
5795+# test12 can't unlink a swap file
5796+# test25 uses symbolic link
5797+# test27 can't edit file with "*" in file name
5798+# test31 16 bit version runs out of memory...
5799+
5800+SCRIPTS16 = test1.out test19.out test20.out test22.out \
5801+ test23.out test24.out test28.out test29.out \
5802+ test35.out test36.out test43.out \
5803+ test44.out test45.out test46.out test47.out \
5804+ test48.out test51.out test53.out \
5805+ test55.out test56.out test57.out test58.out test59.out \
5806+ test60.out test61.out test62.out test63.out test64.out
5807+
5808+# Had to remove test54 which doesn't work yet.
5809+# test54.out
5810+
5811+SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
5812+ test8.out test9.out test11.out test13.out test14.out \
5813+ test15.out test17.out test18.out test21.out test26.out \
5814+ test30.out test31.out test32.out test33.out test34.out \
5815+ test37.out test38.out test39.out test40.out test41.out \
5816+ test42.out test52.out test65.out
5817+
5818+SCRIPTS32 = test50.out
5819+
5820+SCRIPTS_GUI = test16.out
5821+
5822+.SUFFIXES: .in .out
5823+
5824+vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
5825+ echo ALL DONE
5826+
5827+nongui: fixff $(SCRIPTS16) $(SCRIPTS)
5828+ echo ALL DONE
5829+
5830+small:
5831+ echo ALL DONE
5832+
5833+gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
5834+ echo ALL DONE
5835+
5836+win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
5837+ echo ALL DONE
5838+
5839+fixff:
5840+ -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
5841+
5842+clean:
5843+ -$(DEL) *.out
5844+ -$(DEL) test.ok
5845+ -$(DEL) small.vim
5846+ -$(DEL) tiny.vim
5847+ -$(DEL) mbyte.vim
5848+ -$(DEL) X*
5849+ -$(DEL) viminfo
5850+
5851+.in.out:
5852+ $(CP) $*.ok test.ok
5853+ $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
5854+ diff test.out $*.ok
5855+ -$(DEL) $*.out
5856+ $(MV) test.out $*.out
5857+ -$(DEL) X*
5858+ -$(DEL) test.ok
5859+ -$(DEL) viminfo
5860diff -Naur vim72.orig/src/testdir/test42.ok vim72/src/testdir/test42.ok
5861--- vim72.orig/src/testdir/test42.ok 2008-02-20 04:27:37.000000000 -0800
[9a875fd]5862+++ vim72/src/testdir/test42.ok 2009-02-07 22:14:55.472752061 -0800
[76dd250]5863@@ -20,7 +20,7 @@
5864 ucs-2
5865
5866
5867- fileencoding=ucs-2le
5868+ fileencoding=utf-16le
5869 bomb
5870 ucs-2le
5871
5872diff -Naur vim72.orig/src/ui.c vim72/src/ui.c
5873--- vim72.orig/src/ui.c 2008-07-14 11:14:56.000000000 -0700
[9a875fd]5874+++ vim72/src/ui.c 2009-02-07 22:16:00.150072915 -0800
[76dd250]5875@@ -1820,7 +1820,7 @@
5876 #ifdef HAVE_DUP
5877 /* Use stderr for stdin, also works for shell commands. */
5878 close(0);
5879- dup(2);
5880+ ignored = dup(2);
5881 #else
5882 read_cmd_fd = 2; /* read from stderr instead of stdin */
5883 #endif
5884@@ -2020,7 +2020,7 @@
5885
5886 if (value == NULL || *length == 0)
5887 {
5888- clip_free_selection(cbd); /* ??? [what's the query?] */
5889+ clip_free_selection(cbd); /* nothing received, clear register */
5890 *(int *)success = FALSE;
5891 return;
5892 }
5893@@ -2076,7 +2076,7 @@
5894 text_prop.value = (unsigned char *)value;
5895 text_prop.encoding = *type;
5896 text_prop.format = *format;
5897- text_prop.nitems = STRLEN(value);
5898+ text_prop.nitems = len;
5899 status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
5900 &text_list, &n_text);
5901 if (status != Success || n_text < 1)
5902@@ -2110,6 +2110,8 @@
5903 int i;
5904 int nbytes = 0;
5905 char_u *buffer;
5906+ time_t start_time;
5907+ int timed_out = FALSE;
5908
5909 for (i =
5910 #ifdef FEAT_MBYTE
5911@@ -2129,6 +2131,7 @@
5912 case 3: type = text_atom; break;
5913 default: type = XA_STRING;
5914 }
5915+ success = MAYBE;
5916 XtGetSelectionValue(myShell, cbd->sel_atom, type,
5917 clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
5918
5919@@ -2141,27 +2144,48 @@
5920 * characters, then they will appear before the one that requested the
5921 * paste! Don't worry, we will catch up with any other events later.
5922 */
5923- for (;;)
5924+ start_time = time(NULL);
5925+ while (success == MAYBE)
5926 {
5927- if (XCheckTypedEvent(dpy, SelectionNotify, &event))
5928- break;
5929- if (XCheckTypedEvent(dpy, SelectionRequest, &event))
5930- /* We may get a SelectionRequest here and if we don't handle
5931- * it we hang. KDE klipper does this, for example. */
5932+ if (XCheckTypedEvent(dpy, SelectionNotify, &event)
5933+ || XCheckTypedEvent(dpy, SelectionRequest, &event)
5934+ || XCheckTypedEvent(dpy, PropertyNotify, &event))
5935+ {
5936+ /* This is where clip_x11_request_selection_cb() should be
5937+ * called. It may actually happen a bit later, so we loop
5938+ * until "success" changes.
5939+ * We may get a SelectionRequest here and if we don't handle
5940+ * it we hang. KDE klipper does this, for example.
5941+ * We need to handle a PropertyNotify for large selections. */
5942 XtDispatchEvent(&event);
5943+ continue;
5944+ }
5945+
5946+ /* Time out after 2 to 3 seconds to avoid that we hang when the
5947+ * other process doesn't respond. Note that the SelectionNotify
5948+ * event may still come later when the selection owner comes back
5949+ * to life and the text gets inserted unexpectedly. Don't know
5950+ * why that happens or how to avoid that :-(. */
5951+ if (time(NULL) > start_time + 2)
5952+ {
5953+ timed_out = TRUE;
5954+ break;
5955+ }
5956
5957 /* Do we need this? Probably not. */
5958 XSync(dpy, False);
5959
5960- /* Bernhard Walle solved a slow paste response in an X terminal by
5961- * adding: usleep(10000); here. */
5962+ /* Wait for 1 msec to avoid that we eat up all CPU time. */
5963+ ui_delay(1L, TRUE);
5964 }
5965
5966- /* this is where clip_x11_request_selection_cb() is actually called */
5967- XtDispatchEvent(&event);
5968-
5969- if (success)
5970+ if (success == TRUE)
5971 return;
5972+
5973+ /* don't do a retry with another type after timing out, otherwise we
5974+ * hang for 15 seconds. */
5975+ if (timed_out)
5976+ break;
5977 }
5978
5979 /* Final fallback position - use the X CUT_BUFFER0 store */
5980diff -Naur vim72.orig/src/version.c vim72/src/version.c
5981--- vim72.orig/src/version.c 2008-08-09 07:24:52.000000000 -0700
[9a875fd]5982+++ vim72/src/version.c 2009-02-07 22:18:15.152545887 -0800
5983@@ -677,9 +677,204 @@
[76dd250]5984 static int included_patches[] =
5985 { /* Add new patch number below this line */
5986 /**/
[9a875fd]5987+ 102,
5988+/**/
5989+ 100,
5990+/**/
5991+ 99,
5992+/**/
5993+ 98,
5994+/**/
5995+ 97,
5996+/**/
5997+ 96,
5998+/**/
5999+ 95,
6000+/**/
6001+ 94,
6002+/**/
[5f4a45c9]6003+ 92,
6004+/**/
6005+ 91,
6006+/**/
6007+ 90,
6008+/**/
6009+ 87,
6010+/**/
6011+ 86,
6012+/**/
6013+ 85,
6014+/**/
[7352c10]6015+ 84,
6016+/**/
6017+ 83,
6018+/**/
6019+ 82,
6020+/**/
6021+ 81,
6022+/**/
6023+ 80,
6024+/**/
[43c52a1]6025+ 79,
6026+/**/
6027+ 78,
6028+/**/
6029+ 77,
6030+/**/
[1f22c7c]6031+ 76,
6032+/**/
6033+ 75,
6034+/**/
6035+ 73,
6036+/**/
6037+ 70,
6038+/**/
[76dd250]6039+ 69,
6040+/**/
6041+ 68,
6042+/**/
6043+ 67,
6044+/**/
6045+ 66,
6046+/**/
6047+ 65,
6048+/**/
6049+ 64,
6050+/**/
6051+ 63,
6052+/**/
6053+ 62,
6054+/**/
6055+ 61,
6056+/**/
6057+ 60,
6058+/**/
6059+ 59,
6060+/**/
6061+ 58,
6062+/**/
6063+ 57,
6064+/**/
6065+ 56,
6066+/**/
6067+ 55,
6068+/**/
6069+ 54,
6070+/**/
6071+ 53,
6072+/**/
6073+ 52,
6074+/**/
6075+ 51,
6076+/**/
6077+ 50,
6078+/**/
6079+ 48,
6080+/**/
6081+ 47,
6082+/**/
6083+ 46,
6084+/**/
6085+ 45,
6086+/**/
6087+ 44,
6088+/**/
6089+ 43,
6090+/**/
6091+ 42,
6092+/**/
6093+ 40,
6094+/**/
6095+ 39,
6096+/**/
6097+ 38,
6098+/**/
6099+ 37,
6100+/**/
6101+ 35,
6102+/**/
6103+ 34,
6104+/**/
6105+ 33,
6106+/**/
6107+ 32,
6108+/**/
6109+ 31,
6110+/**/
6111+ 30,
6112+/**/
6113+ 29,
6114+/**/
6115+ 28,
6116+/**/
6117+ 27,
6118+/**/
6119+ 26,
6120+/**/
6121+ 25,
6122+/**/
6123+ 24,
6124+/**/
6125+ 23,
6126+/**/
6127+ 22,
6128+/**/
6129+ 21,
6130+/**/
6131+ 20,
6132+/**/
6133+ 19,
6134+/**/
6135+ 18,
6136+/**/
6137+ 17,
6138+/**/
6139+ 16,
6140+/**/
6141+ 15,
6142+/**/
6143+ 14,
6144+/**/
6145+ 13,
6146+/**/
6147+ 12,
6148+/**/
6149+ 11,
6150+/**/
6151+ 10,
6152+/**/
6153+ 9,
6154+/**/
6155+ 8,
6156+/**/
6157+ 6,
6158+/**/
6159+ 5,
6160+/**/
6161+ 4,
6162+/**/
6163+ 3,
6164+/**/
6165+ 2,
6166+/**/
6167+ 1,
6168+/**/
6169 0
6170 };
6171
6172+/*
6173+ * Place to put a short description when adding a feature with a patch.
6174+ * Keep it short, e.g.,: "relative numbers", "persistent undo".
6175+ * Also add a comment marker to separate the lines.
6176+ * See the official Vim patches for the diff format: It must use a context of
[1f22c7c]6177+ * one line only. Create it by hand or use "diff -C2" and edit the patch.
[76dd250]6178+ */
6179+static char *(extra_patches[]) =
6180+{ /* Add your patch description below this line */
6181+/**/
6182+ NULL
6183+};
6184+
6185 int
6186 highest_patch()
6187 {
[9a875fd]6188@@ -786,7 +981,7 @@
[76dd250]6189 MSG_PUTS(_("\nRISC OS version"));
6190 #endif
6191 #ifdef VMS
6192- MSG_PUTS("\nOpenVMS version");
6193+ MSG_PUTS(_("\nOpenVMS version"));
6194 # ifdef HAVE_PATHDEF
6195 if (*compiled_arch != NUL)
6196 {
[9a875fd]6197@@ -825,6 +1020,19 @@
[76dd250]6198 }
6199 }
6200
6201+ /* Print the list of extra patch descriptions if there is at least one. */
6202+ if (extra_patches[0] != NULL)
6203+ {
6204+ MSG_PUTS(_("\nExtra patches: "));
6205+ s = "";
6206+ for (i = 0; extra_patches[i] != NULL; ++i)
6207+ {
6208+ MSG_PUTS(s);
6209+ s = ", ";
6210+ MSG_PUTS(extra_patches[i]);
6211+ }
6212+ }
6213+
6214 #ifdef MODIFIED_BY
6215 MSG_PUTS("\n");
6216 MSG_PUTS(_("Modified by "));
6217diff -Naur vim72.orig/src/vim.h vim72/src/vim.h
6218--- vim72.orig/src/vim.h 2008-08-09 09:03:38.000000000 -0700
[9a875fd]6219+++ vim72/src/vim.h 2009-02-07 22:15:33.719691856 -0800
[76dd250]6220@@ -341,8 +341,14 @@
6221 #ifdef BACKSLASH_IN_FILENAME
6222 # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<")
6223 #else
6224-# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
6225-# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
6226+# ifdef VMS
6227+ /* VMS allows a lot of characters in the file name */
6228+# define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!")
6229+# define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&")
6230+# else
6231+# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
6232+# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
6233+# endif
6234 #endif
6235
6236 #define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */
6237@@ -370,7 +376,7 @@
6238 * Define __w64 as an empty token for everything but MSVC 7.x or later.
6239 */
6240 # if !defined(_MSC_VER) || (_MSC_VER < 1300)
6241-# define __w64
6242+# define __w64
6243 # endif
6244 typedef unsigned long __w64 long_u;
6245 typedef long __w64 long_i;
6246@@ -1728,7 +1734,8 @@
6247 #define VV_MOUSE_COL 51
6248 #define VV_OP 52
6249 #define VV_SEARCHFORWARD 53
6250-#define VV_LEN 54 /* number of v: vars */
6251+#define VV_OLDFILES 54
6252+#define VV_LEN 55 /* number of v: vars */
6253
6254 #ifdef FEAT_CLIPBOARD
6255
6256@@ -1979,6 +1986,9 @@
6257 # endif
6258 #endif
6259
6260+#ifndef FEAT_NETBEANS_INTG
6261+# undef NBDEBUG
6262+#endif
6263 #ifdef NBDEBUG /* Netbeans debugging. */
6264 # include "nbdebug.h"
6265 #else
6266@@ -2054,4 +2064,10 @@
6267 #define DOSO_VIMRC 1 /* loading vimrc file */
6268 #define DOSO_GVIMRC 2 /* loading gvimrc file */
6269
6270+/* flags for read_viminfo() and children */
6271+#define VIF_WANT_INFO 1 /* load non-mark info */
6272+#define VIF_WANT_MARKS 2 /* load file marks */
6273+#define VIF_FORCEIT 4 /* overwrite info already read */
6274+#define VIF_GET_OLDFILES 8 /* load v:oldfiles */
6275+
6276 #endif /* VIM__H */
6277diff -Naur vim72.orig/src/window.c vim72/src/window.c
6278--- vim72.orig/src/window.c 2008-08-06 04:00:30.000000000 -0700
[9a875fd]6279+++ vim72/src/window.c 2009-02-07 22:16:00.150072915 -0800
[76dd250]6280@@ -4028,14 +4028,14 @@
6281 if (mch_dirname(cwd, MAXPATHL) == OK)
6282 globaldir = vim_strsave(cwd);
6283 }
6284- mch_chdir((char *)curwin->w_localdir);
6285- shorten_fnames(TRUE);
6286+ if (mch_chdir((char *)curwin->w_localdir) == 0)
6287+ shorten_fnames(TRUE);
6288 }
6289 else if (globaldir != NULL)
6290 {
6291 /* Window doesn't have a local directory and we are not in the global
6292 * directory: Change to the global directory. */
6293- mch_chdir((char *)globaldir);
6294+ ignored = mch_chdir((char *)globaldir);
6295 vim_free(globaldir);
6296 globaldir = NULL;
6297 shorten_fnames(TRUE);
6298diff -Naur vim72.orig/src/workshop.c vim72/src/workshop.c
6299--- vim72.orig/src/workshop.c 2008-06-21 11:53:26.000000000 -0700
[9a875fd]6300+++ vim72/src/workshop.c 2009-02-07 22:15:51.274319877 -0800
[76dd250]6301@@ -1121,8 +1121,12 @@
6302 ? (char *)curbuf->b_sfname : "<None>");
6303 #endif
6304
6305- strcpy(ffname, (char *) curbuf->b_ffname);
6306- *filename = ffname; /* copy so nobody can change b_ffname */
6307+ if (curbuf->b_ffname == NULL)
6308+ ffname[0] = NUL;
6309+ else
6310+ /* copy so nobody can change b_ffname */
6311+ strcpy(ffname, (char *) curbuf->b_ffname);
6312+ *filename = ffname;
6313 *curLine = curwin->w_cursor.lnum;
6314 *curCol = curwin->w_cursor.col;
6315
Note: See TracBrowser for help on using the repository browser.