source: patches/vim-7.2-branch_update-8.patch@ 81370ca

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 81370ca was 61a83e8, checked in by Jim Gifford <clfs@…>, 16 years ago

Updated Vim Branch Update Patch to -8.

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