source: patches/vim-7.2-branch_update-6.patch@ 51fa34f

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 51fa34f was 5f4a45c9, checked in by Jim Gifford <clfs@…>, 16 years ago

Updated Vim Branch Update Patch to -6

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