source: patches/vim-7.2-branch_update-3.patch@ bf8339f

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

Update VIM Patch to -3

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