source: patches/vim-7.2-branch_update-10.patch@ 7d2671a

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

Updated Vim Branch Update Patch to -10

  • Property mode set to 100644
File size: 223.9 KB
RevLine 
[43c52a1]1Submitted By: Jim Gifford (jim at cross-lfs dot org)
[4635005]2Date: 03-01-2009
[76dd250]3Initial Package Version: 7.2
4Origin: Upstream
5Upstream Status: Applied
[4635005]6Description: Contains all upstream patches up to 7.2.128
[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
[4635005]12+++ vim72/Filelist 2009-03-01 11:06:57.584431903 -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
[4635005]23+++ vim72/runtime/doc/cmdline.txt 2009-03-01 11:07:42.747327559 -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
[4635005]82+++ vim72/runtime/doc/eval.txt 2009-03-01 11:10:05.720489174 -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
[4635005]202+++ vim72/runtime/doc/netbeans.txt 2009-03-01 11:10:39.066624388 -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
[4635005]224+++ vim72/runtime/doc/options.txt 2009-03-01 11:11:54.531461377 -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
[54f612f]231@@ -4175,9 +4175,6 @@
232 be able to execute Normal mode commands.
233 This is the opposite of the 'keymap' option, where characters are
234 mapped in Insert mode.
235- This only works for 8-bit characters. The value of 'langmap' may be
236- specified with multi-byte characters (e.g., UTF-8), but only the lower
237- 8 bits of each character will be used.
238
239 Example (for Greek, in UTF-8): *greek* >
240 :set langmap=ΑA,ΒB,ΚC,ΔD,ΕE,ΊF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,΀T,ΘU,ΩV,WW,ΧX,Î¥Y,ΖZ,αa,βb,ψc,ÎŽd,εe,φf,γg,ηh,ιi,Οj,κk,λl,ÎŒm,Îœn,οo,πp,qq,ρr,σs,τt,Ξu,ωv,ςw,χx,υ
241y,ζz
[76dd250]242@@ -7472,7 +7469,9 @@
243 {not available when compiled without the |+wildignore|
244 feature}
245 A list of file patterns. A file that matches with one of these
246- patterns is ignored when completing file or directory names.
247+ patterns is ignored when completing file or directory names, and
248+ influences the result of |expand()|, |glob()| and |globpath()| unless
249+ a flag is passed to disable this.
250 The pattern is used like with |:autocmd|, see |autocmd-patterns|.
251 Also see 'suffixes'.
252 Example: >
253diff -Naur vim72.orig/runtime/doc/spell.txt vim72/runtime/doc/spell.txt
[4635005]254--- vim72.orig/runtime/doc/spell.txt 2008-08-09 07:23:00.000000000 -0700
[76dd250]255+++ vim72/runtime/doc/spell.txt 2009-03-01 11:09:50.439508031 -0800
256@@ -1,4 +1,4 @@
257-*spell.txt* For Vim version 7.2. Last change: 2008 Jun 21
258+*spell.txt* For Vim version 7.2. Last change: 2008 Nov 30
259
260
261 VIM REFERENCE MANUAL by Bram Moolenaar
262@@ -831,8 +831,11 @@
263
264 # comment line ~
265
266-With some items it's also possible to put a comment after it, but this isn't
267-supported in general.
268+Items with a fixed number of arguments can be followed by a comment. But only
269+if none of the arguments can contain white space. The comment must start with
270+a "#" character. Example:
271+
272+ KEEPCASE = # fix case for words with this flag ~
273
274
275 ENCODING *spell-SET*
276@@ -965,6 +968,9 @@
277
278 Note: When using utf-8 only characters up to 65000 may be used for flags.
279
280+Note: even when using "num" or "long" the number of flags available to
281+compounding and prefixes is limited to about 250.
282+
283
284 AFFIXES
285 *spell-PFX* *spell-SFX*
286@@ -1178,6 +1184,9 @@
287 The flag also applies to the word with affixes, thus this can be used to mark
288 a whole bunch of related words as bad.
289
290+ *spell-FORBIDDENWORD*
291+FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell.
292+
293 *spell-NEEDAFFIX*
294 The NEEDAFFIX flag is used to require that a word is used with an affix. The
295 word itself is not a good word (unless there is an empty affix). Example:
296@@ -1268,6 +1277,10 @@
297
298 NEEDCOMPOUND & ~
299
300+ *spell-ONLYINCOMPOUND*
301+The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for
302+compatiblity with Hunspell.
303+
304 *spell-COMPOUNDMIN*
305 The minimal character length of a word used for compounding is specified with
306 COMPOUNDMIN. Example:
307@@ -1328,6 +1341,20 @@
308 rules. Can also be used for an affix to count the affix as a compounding
309 word.
310
311+ *spell-CHECKCOMPOUNDPATTERN*
312+CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
313+position where two words are compounded together forbids the compound.
314+For example:
315+ CHECKCOMPOUNDPATTERN o e ~
316+
317+This forbids compounding if the first word ends in "o" and the second word
318+starts with "e".
319+
320+The arguments must be plain text, no patterns are actually supported, despite
321+the item name. Case is always ignored.
322+
323+The Hunspell feature to use three arguments and flags is not supported.
324+
325 *spell-SYLLABLE*
326 The SYLLABLE item defines characters or character sequences that are used to
327 count the number of syllables in a word. Example:
328@@ -1496,6 +1523,10 @@
329 ACCENT (Hunspell) *spell-ACCENT*
330 Use MAP instead. |spell-MAP|
331
332+BREAK (Hunspell) *spell-BREAK*
333+ Define break points. Unclear how it works exactly.
334+ Not supported.
335+
336 CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE*
337 Disallow uppercase letters at compound word boundaries.
338 Not supported.
339@@ -1512,9 +1543,6 @@
340 Forbid three identical characters when compounding. Not
341 supported.
342
343-CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN*
344- Forbid compounding when patterns match. Not supported.
345-
346 COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES*
347 Enables using two prefixes. Not supported.
348
349@@ -1536,13 +1564,18 @@
350 COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
351 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
352
353+COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES*
354+ Number of COMPOUNDRULE lines following. Ignored, but the
355+ argument must be a number.
356+
357 COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
358 Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
359 |spell-COMPOUNDSYLMAX|
360
361-FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD*
362- Use BAD instead. |spell-BAD|
363-
364+KEY (Hunspell) *spell-KEY*
365+ Define characters that are close together on the keyboard.
366+ Used to give better suggestions. Not supported.
367+
368 LANG (Hunspell) *spell-LANG*
369 This specifies language-specific behavior. This actually
370 moves part of the language knowledge into the program,
371@@ -1553,10 +1586,7 @@
372 Only needed for morphological analysis.
373
374 MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
375- Not supported.
376-
377-ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND*
378- Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND|
379+ Set number of n-gram suggestions. Not supported.
380
381 PSEUDOROOT (Hunspell) *spell-PSEUDOROOT*
382 Use NEEDAFFIX instead. |spell-NEEDAFFIX|
383diff -Naur vim72.orig/runtime/doc/starting.txt vim72/runtime/doc/starting.txt
[4635005]384--- vim72.orig/runtime/doc/starting.txt 2008-08-09 07:23:00.000000000 -0700
[76dd250]385+++ vim72/runtime/doc/starting.txt 2009-03-01 11:07:42.747327559 -0800
386@@ -1,4 +1,4 @@
387-*starting.txt* For Vim version 7.2. Last change: 2008 Jun 21
388+*starting.txt* For Vim version 7.2. Last change: 2008 Nov 09
389
390
391 VIM REFERENCE MANUAL by Bram Moolenaar
392@@ -1337,8 +1337,9 @@
393 *viminfo-read*
394 When Vim is started and the 'viminfo' option is non-empty, the contents of
395 the viminfo file are read and the info can be used in the appropriate places.
396-The marks are not read in at startup (but file marks are). See
397-|initialization| for how to set the 'viminfo' option upon startup.
398+The |v:oldfiles| variable is filled. The marks are not read in at startup
399+(but file marks are). See |initialization| for how to set the 'viminfo'
400+option upon startup.
401
402 *viminfo-write*
403 When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo
404@@ -1372,6 +1373,8 @@
405 that start with any string given with the "r" flag in 'viminfo'. This can be
406 used to avoid saving marks for files on removable media (for MS-DOS you would
407 use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:").
408+The |v:oldfiles| variable is filled with the file names that the viminfo file
409+has marks for.
410
411 *viminfo-file-marks*
412 Uppercase marks ('A to 'Z) are stored when writing the viminfo file. The
413@@ -1463,8 +1466,8 @@
414 *:rv* *:rviminfo* *E195*
415 :rv[iminfo][!] [file] Read from viminfo file [file] (default: see above).
416 If [!] is given, then any information that is
417- already set (registers, marks, etc.) will be
418- overwritten. {not in Vi}
419+ already set (registers, marks, |v:oldfiles|, etc.)
420+ will be overwritten {not in Vi}
421
422 *:wv* *:wviminfo* *E137* *E138* *E574*
423 :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
424@@ -1479,4 +1482,20 @@
425 the .viminfo file.
426 {not in Vi}
427
428+ *:ol* *:oldfiles*
429+:ol[dfiles] List the files that have marks stored in the viminfo
430+ file. This list is read on startup and only changes
431+ afterwards with ":rviminfo!". Also see |v:oldfiles|.
432+ The number can be used with |c_#<|.
433+ {not in Vi, only when compiled with the +eval feature}
434+
435+:bro[wse] ol[dfiles][!]
436+ List file names as with |:oldfiles|, and then prompt
437+ for a number. When the number is valid that file from
438+ the list is edited.
439+ If you get the |press-enter| prompt you can press "q"
440+ and still get the prompt to enter a file number.
441+ Use ! to abondon a modified buffer. |abandon|
442+ {not when compiled with tiny or small features}
443+
444 vim:tw=78:ts=8:ft=help:norl:
445diff -Naur vim72.orig/runtime/doc/usr_21.txt vim72/runtime/doc/usr_21.txt
[4635005]446--- vim72.orig/runtime/doc/usr_21.txt 2008-08-09 07:23:01.000000000 -0700
[76dd250]447+++ vim72/runtime/doc/usr_21.txt 2009-03-01 11:07:42.751325883 -0800
448@@ -1,4 +1,4 @@
449-*usr_21.txt* For Vim version 7.2. Last change: 2007 May 01
450+*usr_21.txt* For Vim version 7.2. Last change: 2008 Nov 09
451
452 VIM USER MANUAL - by Bram Moolenaar
453
454@@ -153,7 +153,7 @@
455 to be lost. Each item can be remembered only once.
456
457
458-GETTING BACK TO WHERE YOU WERE
459+GETTING BACK TO WHERE YOU STOPPED VIM
460
461 You are halfway editing a file and it's time to leave for holidays. You exit
462 Vim and go enjoy yourselves, forgetting all about your work. After a couple
463@@ -168,6 +168,48 @@
464 The |:marks| command is useful to find out where '0 to '9 will take you.
465
466
467+GETTING BACK TO SOME FILE
468+
469+If you want to go back to a file that you edited recently, but not when
470+exiting Vim, there is a slightly more complicated way. You can see a list of
471+files by typing the command: >
472+
473+ :oldfiles
474+< 1: ~/.viminfo ~
475+ 2: ~/text/resume.txt ~
476+ 3: /tmp/draft ~
477+
478+Now you would like to edit the second file, which is in the list preceded by
479+"2:". You type: >
480+
481+ :e #<2
482+
483+Instead of ":e" you can use any command that has a file name argument, the
484+"#<2" item works in the same place as "%" (current file name) and "#"
485+(alternate file name). So you can also split the window to edit the third
486+file: >
487+
488+ :split #<3
489+
490+That #<123 thing is a bit complicated when you just want to edit a file.
491+Fortunately there is a simpler way: >
492+
493+ :browse oldfiles
494+< 1: ~/.viminfo ~
495+ 2: ~/text/resume.txt ~
496+ 3: /tmp/draft ~
497+ -- More --
498+
499+You get the same list of files as with |:oldfiles|. If you want to edit
500+"resume.txt" first press "q" to stop the listing. You will get a prompt:
501+
502+ Type number and <Enter> (empty cancels): ~
503+
504+Type "2" and press <Enter> to edit the second file.
505+
506+More info at |:oldfiles|, |v:oldfiles| and |c_#<|.
507+
508+
509 MOVE INFO FROM ONE VIM TO ANOTHER
510
511 You can use the ":wviminfo" and ":rviminfo" commands to save and restore the
512diff -Naur vim72.orig/runtime/scripts.vim vim72/runtime/scripts.vim
[4635005]513--- vim72.orig/runtime/scripts.vim 2008-08-08 15:27:21.000000000 -0700
[76dd250]514+++ vim72/runtime/scripts.vim 2009-03-01 11:05:28.166702332 -0800
515@@ -234,6 +234,10 @@
516 elseif s:line1 =~ '\<DTD\s\+XHTML\s'
517 set ft=xhtml
518
519+ " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
520+ elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
521+ set ft=html
522+
523 " PDF
524 elseif s:line1 =~ '^%PDF-'
525 set ft=pdf
526diff -Naur vim72.orig/src/auto/configure vim72/src/auto/configure
[4635005]527--- vim72.orig/src/auto/configure 2008-07-24 05:40:36.000000000 -0700
[76dd250]528+++ vim72/src/auto/configure 2009-03-01 11:08:15.605433440 -0800
529@@ -16819,21 +16819,29 @@
530 LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
531 fi
532
533-{ $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
534-$as_echo_n "checking for GCC 3 or later... " >&6; }
535 DEPEND_CFLAGS_FILTER=
536 if test "$GCC" = yes; then
537+ { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
538+$as_echo_n "checking for GCC 3 or later... " >&6; }
539 gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
540 if test "$gccmajor" -gt "2"; then
541 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
542- fi
543-fi
544-if test "$DEPEND_CFLAGS_FILTER" = ""; then
545- { $as_echo "$as_me:$LINENO: result: no" >&5
546+ { $as_echo "$as_me:$LINENO: result: yes" >&5
547+$as_echo "yes" >&6; }
548+ else
549+ { $as_echo "$as_me:$LINENO: result: no" >&5
550 $as_echo "no" >&6; }
551-else
552- { $as_echo "$as_me:$LINENO: result: yes" >&5
553+ fi
554+ { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5
555+$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
556+ if test "$gccmajor" -gt "3"; then
557+ CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
558+ { $as_echo "$as_me:$LINENO: result: yes" >&5
559 $as_echo "yes" >&6; }
560+ else
561+ { $as_echo "$as_me:$LINENO: result: no" >&5
562+$as_echo "no" >&6; }
563+ fi
564 fi
565
566
567diff -Naur vim72.orig/src/buffer.c vim72/src/buffer.c
[4635005]568--- vim72.orig/src/buffer.c 2008-08-06 04:00:48.000000000 -0700
[43c52a1]569+++ vim72/src/buffer.c 2009-03-01 11:12:14.420733621 -0800
570@@ -437,10 +437,6 @@
571 return;
572 #endif
573
574-#ifdef FEAT_NETBEANS_INTG
575- if (usingNetbeans)
576- netbeans_file_closed(buf);
577-#endif
578 /* Change directories when the 'acd' option is set. */
579 DO_AUTOCHDIR
580
581@@ -639,6 +635,10 @@
582 #ifdef FEAT_SIGNS
583 buf_delete_signs(buf); /* delete any signs */
584 #endif
585+#ifdef FEAT_NETBEANS_INTG
586+ if (usingNetbeans)
587+ netbeans_file_killed(buf);
588+#endif
589 #ifdef FEAT_LOCALMAP
590 map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
[76dd250]591 map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
592@@ -647,6 +647,9 @@
593 vim_free(buf->b_start_fenc);
594 buf->b_start_fenc = NULL;
595 #endif
596+#ifdef FEAT_SPELL
597+ ga_clear(&buf->b_langp);
598+#endif
599 }
600
[43c52a1]601 /*
602@@ -812,9 +815,6 @@
603 int bnr; /* buffer number */
604 char_u *p;
605
606-#ifdef FEAT_NETBEANS_INTG
607- netbeansCloseFile = 1;
608-#endif
609 if (addr_count == 0)
610 {
611 (void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit);
612@@ -909,9 +909,6 @@
613 }
614 }
615
616-#ifdef FEAT_NETBEANS_INTG
617- netbeansCloseFile = 0;
618-#endif
619
620 return errormsg;
621 }
[76dd250]622@@ -1237,7 +1234,7 @@
623 * "buf" if one exists */
624 if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
625 return OK;
626- /* If 'switchbuf' contians "usetab": jump to first window in any tab
627+ /* If 'switchbuf' contains "usetab": jump to first window in any tab
628 * page containing "buf" if one exists */
629 if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
[43c52a1]630 return OK;
[76dd250]631@@ -1351,11 +1348,12 @@
632 }
633 }
634 #ifdef FEAT_AUTOCMD
635+ /* An autocommand may have deleted "buf", already entered it (e.g., when
636+ * it did ":bunload") or aborted the script processing! */
637 # ifdef FEAT_EVAL
638- /* An autocommand may have deleted buf or aborted the script processing! */
639- if (buf_valid(buf) && !aborting())
640+ if (buf_valid(buf) && buf != curbuf && !aborting())
641 # else
642- if (buf_valid(buf)) /* an autocommand may have deleted buf! */
643+ if (buf_valid(buf) && buf != curbuf)
644 # endif
645 #endif
[43c52a1]646 enter_buffer(buf);
[76dd250]647@@ -1397,6 +1395,9 @@
648 curwin->w_cursor.coladd = 0;
649 #endif
650 curwin->w_set_curswant = TRUE;
651+#ifdef FEAT_AUTOCMD
652+ curwin->w_topline_was_set = FALSE;
653+#endif
654
655 /* Make sure the buffer is loaded. */
[43c52a1]656 if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
[76dd250]657@@ -1436,7 +1437,8 @@
658 maketitle();
659 #endif
660 #ifdef FEAT_AUTOCMD
661- if (curwin->w_topline == 1) /* when autocmds didn't change it */
662+ /* when autocmds didn't change it */
663+ if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
664 #endif
665 scroll_cursor_halfway(FALSE); /* redisplay at correct position */
[43c52a1]666
[76dd250]667@@ -3963,7 +3965,7 @@
668 width = vim_strsize(out);
669 if (maxwidth > 0 && width > maxwidth)
670 {
671- /* Result is too long, must trunctate somewhere. */
672+ /* Result is too long, must truncate somewhere. */
673 l = 0;
674 if (itemcnt == 0)
[54f612f]675 s = out;
676@@ -5048,7 +5050,8 @@
677 */
678 FOR_ALL_TAB_WINDOWS(tp, win)
679 if (win->w_buffer == buf)
680- break;
681+ goto win_found;
682+win_found:
683 if (win != NULL && win->w_llist_ref != NULL)
684 return _("[Location List]");
685 else
[76dd250]686@@ -5062,7 +5065,7 @@
687 {
688 if (buf->b_sfname != NULL)
689 return (char *)buf->b_sfname;
690- return "[Scratch]";
691+ return _("[Scratch]");
692 }
693 #endif
694 if (buf->b_fname == NULL)
695diff -Naur vim72.orig/src/configure.in vim72/src/configure.in
[4635005]696--- vim72.orig/src/configure.in 2008-07-24 05:40:26.000000000 -0700
[76dd250]697+++ vim72/src/configure.in 2009-03-01 11:08:15.605433440 -0800
698@@ -3152,18 +3152,25 @@
699 dnl But only when making dependencies, cproto and lint don't take "-isystem".
700 dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
701 dnl the number before the version number.
702-AC_MSG_CHECKING(for GCC 3 or later)
703 DEPEND_CFLAGS_FILTER=
704 if test "$GCC" = yes; then
705+ AC_MSG_CHECKING(for GCC 3 or later)
706 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
707 if test "$gccmajor" -gt "2"; then
708 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
709+ AC_MSG_RESULT(yes)
710+ else
711+ AC_MSG_RESULT(no)
712+ fi
713+ dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
714+ dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
715+ AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
716+ if test "$gccmajor" -gt "3"; then
717+ CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
718+ AC_MSG_RESULT(yes)
719+ else
720+ AC_MSG_RESULT(no)
721 fi
722-fi
723-if test "$DEPEND_CFLAGS_FILTER" = ""; then
724- AC_MSG_RESULT(no)
725-else
726- AC_MSG_RESULT(yes)
727 fi
728 AC_SUBST(DEPEND_CFLAGS_FILTER)
729
730diff -Naur vim72.orig/src/diff.c vim72/src/diff.c
[4635005]731--- vim72.orig/src/diff.c 2008-03-05 03:16:56.000000000 -0800
[5f4a45c9]732+++ vim72/src/diff.c 2009-03-01 11:10:56.831763654 -0800
733@@ -8,7 +8,7 @@
734 */
735
736 /*
737- * diff.c: code for diff'ing two or three buffers.
738+ * diff.c: code for diff'ing two, three or four buffers.
739 */
740
[76dd250]741 #include "vim.h"
742@@ -73,6 +73,8 @@
743 {
744 tp->tp_diffbuf[i] = NULL;
745 tp->tp_diff_invalid = TRUE;
746+ if (tp == curtab)
747+ diff_redraw(TRUE);
748 }
749 }
750 }
751@@ -102,6 +104,7 @@
752 {
753 curtab->tp_diffbuf[i] = NULL;
754 curtab->tp_diff_invalid = TRUE;
755+ diff_redraw(TRUE);
756 }
757 }
[5f4a45c9]758 }
759@@ -113,7 +116,7 @@
760 * Add a buffer to make diffs for.
761 * Call this when a new buffer is being edited in the current window where
762 * 'diff' is set.
763- * Marks the current buffer as being part of the diff and requireing updating.
764+ * Marks the current buffer as being part of the diff and requiring updating.
765 * This must be done before any autocmd, because a command may use info
766 * about the screen contents.
[76dd250]767 */
768@@ -131,6 +134,7 @@
769 {
770 curtab->tp_diffbuf[i] = buf;
771 curtab->tp_diff_invalid = TRUE;
772+ diff_redraw(TRUE);
773 return;
774 }
775
776@@ -661,6 +665,7 @@
777 char_u *tmp_diff;
778 FILE *fd;
779 int ok;
780+ int io_error = FALSE;
781
782 /* Delete all diffblocks. */
783 diff_clear(curtab);
784@@ -697,18 +702,26 @@
785 {
786 ok = FALSE;
787 fd = mch_fopen((char *)tmp_orig, "w");
788- if (fd != NULL)
789+ if (fd == NULL)
790+ io_error = TRUE;
791+ else
792 {
793- fwrite("line1\n", (size_t)6, (size_t)1, fd);
794+ if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1)
795+ io_error = TRUE;
796 fclose(fd);
797 fd = mch_fopen((char *)tmp_new, "w");
798- if (fd != NULL)
799+ if (fd == NULL)
800+ io_error = TRUE;
801+ else
802 {
803- fwrite("line2\n", (size_t)6, (size_t)1, fd);
804+ if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1)
805+ io_error = TRUE;
806 fclose(fd);
807 diff_file(tmp_orig, tmp_new, tmp_diff);
808 fd = mch_fopen((char *)tmp_diff, "r");
809- if (fd != NULL)
810+ if (fd == NULL)
811+ io_error = TRUE;
812+ else
813 {
814 char_u linebuf[LBUFLEN];
815
816@@ -761,6 +774,8 @@
817 }
818 if (!ok)
819 {
820+ if (io_error)
821+ EMSG(_("E810: Cannot read or write temp files"));
822 EMSG(_("E97: Cannot create diffs"));
823 diff_a_works = MAYBE;
[5f4a45c9]824 #if defined(MSWIN) || defined(MSDOS)
825@@ -914,7 +929,7 @@
826 goto theend;
827
828 #ifdef UNIX
829- /* Temporaraly chdir to /tmp, to avoid patching files in the current
830+ /* Temporarily chdir to /tmp, to avoid patching files in the current
831 * directory when the patch file contains more than one patch. When we
832 * have our own temp dir use that instead, it will be cleaned up when we
[76dd250]833 * exit (any .rej files created). Don't change directory if we can't
834@@ -925,10 +940,10 @@
835 {
836 # ifdef TEMPDIRNAMES
837 if (vim_tempdir != NULL)
838- mch_chdir((char *)vim_tempdir);
839+ ignored = mch_chdir((char *)vim_tempdir);
840 else
841 # endif
842- mch_chdir("/tmp");
843+ ignored = mch_chdir("/tmp");
844 shorten_fnames(TRUE);
845 }
[5f4a45c9]846 #endif
847@@ -2114,6 +2129,8 @@
848 EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg);
849 return;
850 }
851+ if (buf == curbuf)
852+ return; /* nothing to do */
853 idx_other = diff_buf_idx(buf);
854 if (idx_other == DB_COUNT)
[7352c10]855 {
856diff -Naur vim72.orig/src/edit.c vim72/src/edit.c
[4635005]857--- vim72.orig/src/edit.c 2008-08-06 05:51:17.000000000 -0700
[7352c10]858+++ vim72/src/edit.c 2009-03-01 11:11:54.531461377 -0800
859@@ -147,6 +147,7 @@
860 static int ins_compl_bs __ARGS((void));
861 static void ins_compl_new_leader __ARGS((void));
862 static void ins_compl_addleader __ARGS((int c));
863+static int ins_compl_len __ARGS((void));
864 static void ins_compl_restart __ARGS((void));
865 static void ins_compl_set_original_text __ARGS((char_u *str));
866 static void ins_compl_addfrommatch __ARGS((void));
867@@ -197,7 +198,8 @@
868 static void mb_replace_pop_ins __ARGS((int cc));
869 #endif
870 static void replace_flush __ARGS((void));
871-static void replace_do_bs __ARGS((void));
872+static void replace_do_bs __ARGS((int limit_col));
873+static int del_char_after_col __ARGS((int limit_col));
874 #ifdef FEAT_CINDENT
875 static int cindent_on __ARGS((void));
876 #endif
877@@ -1933,6 +1935,8 @@
878 /*
879 * Backspace the cursor until the given column. Handles REPLACE and VREPLACE
880 * modes correctly. May also be used when not in insert mode at all.
881+ * Will attempt not to go before "col" even when there is a composing
882+ * character.
883 */
884 void
[9a875fd]885 backspace_until_column(col)
[7352c10]886@@ -1942,13 +1946,50 @@
887 {
888 curwin->w_cursor.col--;
889 if (State & REPLACE_FLAG)
890- replace_do_bs();
891- else
892- (void)del_char(FALSE);
893+ replace_do_bs(col);
894+ else if (!del_char_after_col(col))
895+ break;
896 }
897 }
898 #endif
899
900+/*
901+ * Like del_char(), but make sure not to go before column "limit_col".
902+ * Only matters when there are composing characters.
903+ * Return TRUE when something was deleted.
[9a875fd]904+ */
[7352c10]905+/*ARGSUSED*/
906+ static int
907+del_char_after_col(limit_col)
908+ int limit_col;
909+{
910+#ifdef FEAT_MBYTE
911+ if (enc_utf8 && limit_col >= 0)
912+ {
913+ int ecol = curwin->w_cursor.col + 1;
914+
915+ /* Make sure the cursor is at the start of a character, but
916+ * skip forward again when going too far back because of a
917+ * composing character. */
[9a875fd]918+ mb_adjust_cursor();
[7352c10]919+ while (curwin->w_cursor.col < (colnr_T)limit_col)
920+ {
921+ int l = utf_ptr2len(ml_get_cursor());
922+
923+ if (l == 0) /* end of line */
924+ break;
925+ curwin->w_cursor.col += l;
926+ }
927+ if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol)
928+ return FALSE;
929+ del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE);
930+ }
931+ else
932+#endif
933+ (void)del_char(FALSE);
934+ return TRUE;
935+}
936+
937 #if defined(FEAT_INS_EXPAND) || defined(PROTO)
938 /*
[9a875fd]939 * CTRL-X pressed in Insert mode.
[7352c10]940@@ -2418,7 +2459,7 @@
941 {
942 had_match = (curwin->w_cursor.col > compl_col);
943 ins_compl_delete();
944- ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
945+ ins_bytes(compl_leader + ins_compl_len());
946 ins_redraw(FALSE);
947
[9a875fd]948 /* When the match isn't there (to avoid matching itself) remove it
[7352c10]949@@ -2470,7 +2511,7 @@
950 *p = NUL;
951 had_match = (curwin->w_cursor.col > compl_col);
952 ins_compl_delete();
953- ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
954+ ins_bytes(compl_leader + ins_compl_len());
955 ins_redraw(FALSE);
956
[9a875fd]957 /* When the match isn't there (to avoid matching itself) remove it
[7352c10]958@@ -3209,7 +3250,7 @@
959 {
960 ins_compl_del_pum();
961 ins_compl_delete();
962- ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
963+ ins_bytes(compl_leader + ins_compl_len());
964 compl_used_match = FALSE;
965
[9a875fd]966 if (compl_started)
[7352c10]967@@ -3264,6 +3305,20 @@
968 }
969
970 /*
971+ * Return the length of the completion, from the completion start column to
972+ * the cursor column. Making sure it never goes below zero.
973+ */
974+ static int
975+ins_compl_len()
976+{
977+ int off = curwin->w_cursor.col - compl_col;
978+
979+ if (off < 0)
980+ return 0;
981+ return off;
982+}
983+
984+/*
985 * Append one character to the match leader. May reduce the number of
986 * matches.
[9a875fd]987 */
[7352c10]988@@ -3621,10 +3676,9 @@
989 {
990 ins_compl_delete();
991 if (compl_leader != NULL)
992- ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
993+ ins_bytes(compl_leader + ins_compl_len());
994 else if (compl_first_match != NULL)
995- ins_bytes(compl_orig_text
996- + curwin->w_cursor.col - compl_col);
997+ ins_bytes(compl_orig_text + ins_compl_len());
998 retval = TRUE;
999 }
[9a875fd]1000
1001@@ -4187,7 +4241,7 @@
1002 }
1003
1004 /* check if compl_curr_match has changed, (e.g. other type of
1005- * expansion added somenthing) */
1006+ * expansion added something) */
1007 if (type != 0 && compl_curr_match != old_match)
1008 found_new_match = OK;
1009
[7352c10]1010@@ -4256,7 +4310,7 @@
1011 static void
1012 ins_compl_insert()
1013 {
1014- ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col);
1015+ ins_bytes(compl_shown_match->cp_str + ins_compl_len());
1016 if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
1017 compl_used_match = FALSE;
[9a875fd]1018 else
[7352c10]1019@@ -4425,7 +4479,7 @@
1020 if (!compl_get_longest || compl_used_match)
1021 ins_compl_insert();
1022 else
1023- ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
1024+ ins_bytes(compl_leader + ins_compl_len());
1025 }
1026 else
[9a875fd]1027 compl_used_match = FALSE;
1028@@ -4688,7 +4742,7 @@
1029 }
1030 compl_length = curwin->w_cursor.col - (int)compl_col;
1031 /* IObuff is used to add a "word from the next line" would we
1032- * have enough space? just being paranoic */
1033+ * have enough space? just being paranoid */
1034 #define MIN_SPACE 75
1035 if (compl_length > (IOSIZE - MIN_SPACE))
1036 {
[7352c10]1037@@ -7123,9 +7177,12 @@
1038 * cc == 0: character was inserted, delete it
1039 * cc > 0: character was replaced, put cc (first byte of original char) back
1040 * and check for more characters to be put back
1041+ * When "limit_col" is >= 0, don't delete before this column. Matters when
1042+ * using composing characters, use del_char_after_col() instead of del_char().
1043 */
1044 static void
1045-replace_do_bs()
1046+replace_do_bs(limit_col)
1047+ int limit_col;
1048 {
1049 int cc;
[9a875fd]1050 #ifdef FEAT_VREPLACE
[7352c10]1051@@ -7153,7 +7210,7 @@
1052 #ifdef FEAT_MBYTE
1053 if (has_mbyte)
1054 {
1055- del_char(FALSE);
1056+ (void)del_char_after_col(limit_col);
1057 # ifdef FEAT_VREPLACE
1058 if (State & VREPLACE_FLAG)
[9a875fd]1059 orig_len = (int)STRLEN(ml_get_cursor());
[7352c10]1060@@ -7203,7 +7260,7 @@
1061 changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
1062 }
1063 else if (cc == 0)
1064- (void)del_char(FALSE);
1065+ (void)del_char_after_col(limit_col);
1066 }
1067
[54f612f]1068 #ifdef FEAT_CINDENT
1069@@ -7646,9 +7703,7 @@
1070 */
1071 ++no_mapping;
1072 regname = plain_vgetc();
1073-#ifdef FEAT_LANGMAP
1074 LANGMAP_ADJUST(regname, TRUE);
1075-#endif
1076 if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P)
1077 {
1078 /* Get a third key for literal register insertion */
1079@@ -7657,9 +7712,7 @@
1080 add_to_showcmd_c(literally);
1081 #endif
1082 regname = plain_vgetc();
1083-#ifdef FEAT_LANGMAP
1084 LANGMAP_ADJUST(regname, TRUE);
1085-#endif
1086 }
1087 --no_mapping;
1088
[9a875fd]1089@@ -8150,7 +8203,7 @@
1090 /*
1091 * If the cursor is on an indent, ^T/^D insert/delete one
1092 * shiftwidth. Otherwise ^T/^D behave like a "<<" or ">>".
1093- * Always round the indent to 'shiftwith', this is compatible
1094+ * Always round the indent to 'shiftwidth', this is compatible
1095 * with vi. But vi only supports ^T and ^D after an
1096 * autoindent, we support it everywhere.
[54f612f]1097 */
[7352c10]1098@@ -8239,7 +8292,7 @@
1099 * Replace mode */
1100 if (curwin->w_cursor.lnum != Insstart.lnum
1101 || curwin->w_cursor.col >= Insstart.col)
1102- replace_do_bs();
1103+ replace_do_bs(-1);
1104 }
1105 else
[54f612f]1106 (void)del_char(FALSE);
[7352c10]1107@@ -8556,7 +8609,7 @@
1108 break;
1109 }
1110 if (State & REPLACE_FLAG)
1111- replace_do_bs();
1112+ replace_do_bs(-1);
1113 else
1114 {
[76dd250]1115 #ifdef FEAT_MBYTE
1116diff -Naur vim72.orig/src/eval.c vim72/src/eval.c
[4635005]1117--- vim72.orig/src/eval.c 2008-08-07 12:37:22.000000000 -0700
[1f22c7c]1118+++ vim72/src/eval.c 2009-03-01 11:11:26.821685989 -0800
1119@@ -32,6 +32,9 @@
1120
1121 #define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
1122
1123+#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not
1124+ be freed. */
1125+
1126 /*
1127 * In a hashtab item "hi_key" points to "di_key" in a dictitem.
1128 * This avoids adding a pointer to the hashtab item.
[76dd250]1129@@ -348,6 +351,7 @@
1130 {VV_NAME("mouse_col", VAR_NUMBER), 0},
1131 {VV_NAME("operator", VAR_STRING), VV_RO},
1132 {VV_NAME("searchforward", VAR_NUMBER), 0},
1133+ {VV_NAME("oldfiles", VAR_LIST), 0},
1134 };
1135
[1f22c7c]1136 /* shorthand */
[76dd250]1137@@ -355,6 +359,7 @@
1138 #define vv_nr vv_di.di_tv.vval.v_number
1139 #define vv_float vv_di.di_tv.vval.v_float
1140 #define vv_str vv_di.di_tv.vval.v_string
1141+#define vv_list vv_di.di_tv.vval.v_list
1142 #define vv_tv vv_di.di_tv
1143
[1f22c7c]1144 /*
[76dd250]1145@@ -426,7 +431,6 @@
1146 static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
1147 static void list_append __ARGS((list_T *l, listitem_T *item));
1148 static int list_append_tv __ARGS((list_T *l, typval_T *tv));
1149-static int list_append_string __ARGS((list_T *l, char_u *str, int len));
1150 static int list_append_number __ARGS((list_T *l, varnumber_T n));
1151 static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
[1f22c7c]1152 static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef));
1153@@ -788,6 +792,8 @@
1154 static void func_unref __ARGS((char_u *name));
1155 static void func_ref __ARGS((char_u *name));
1156 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));
1157+static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ;
1158+static void free_funccal __ARGS((funccall_T *fc, int free_val));
1159 static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr));
1160 static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp));
1161 static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
[76dd250]1162@@ -845,11 +851,17 @@
1163 p = &vimvars[i];
1164 if (p->vv_di.di_tv.v_type == VAR_STRING)
1165 {
1166- vim_free(p->vv_di.di_tv.vval.v_string);
1167- p->vv_di.di_tv.vval.v_string = NULL;
1168+ vim_free(p->vv_str);
1169+ p->vv_str = NULL;
1170+ }
1171+ else if (p->vv_di.di_tv.v_type == VAR_LIST)
1172+ {
1173+ list_unref(p->vv_list);
1174+ p->vv_list = NULL;
1175 }
1176 }
1177 hash_clear(&vimvarht);
1178+ hash_init(&vimvarht); /* garbage_collect() will access it */
1179 hash_clear(&compat_hashtab);
1180
[1f22c7c]1181 /* script-local variables */
1182@@ -916,6 +928,10 @@
1183 /* pointer to funccal for currently active function */
1184 funccall_T *current_funccal = NULL;
1185
1186+/* pointer to list of previously used funccal, still around because some
1187+ * item in it is still being used. */
1188+funccall_T *previous_funccal = NULL;
1189+
1190 /*
1191 * Return TRUE when a function was ended by a ":return" command.
1192 */
[76dd250]1193@@ -1256,23 +1272,26 @@
1194
1195 /*
1196 * Top level evaluation function, returning a string.
1197+ * When "convert" is TRUE convert a List into a sequence of lines and convert
1198+ * a Float to a String.
1199 * Return pointer to allocated memory, or NULL for failure.
1200 */
1201 char_u *
1202-eval_to_string(arg, nextcmd, dolist)
1203+eval_to_string(arg, nextcmd, convert)
1204 char_u *arg;
1205 char_u **nextcmd;
1206- int dolist; /* turn List into sequence of lines */
1207+ int convert;
1208 {
1209 typval_T tv;
1210 char_u *retval;
1211 garray_T ga;
1212+ char_u numbuf[NUMBUFLEN];
1213
1214 if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
1215 retval = NULL;
1216 else
1217 {
1218- if (dolist && tv.v_type == VAR_LIST)
1219+ if (convert && tv.v_type == VAR_LIST)
1220 {
1221 ga_init2(&ga, (int)sizeof(char), 80);
[1f22c7c]1222 if (tv.vval.v_list != NULL)
[76dd250]1223@@ -1280,6 +1299,13 @@
1224 ga_append(&ga, NUL);
1225 retval = (char_u *)ga.ga_data;
1226 }
1227+#ifdef FEAT_FLOAT
1228+ else if (convert && tv.v_type == VAR_FLOAT)
1229+ {
1230+ vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
1231+ retval = vim_strsave(numbuf);
1232+ }
1233+#endif
1234 else
1235 retval = vim_strsave(get_tv_string(&tv));
[1f22c7c]1236 clear_tv(&tv);
[76dd250]1237@@ -3277,7 +3303,7 @@
1238
1239 if (*startarg != '(')
1240 {
1241- EMSG2(_("E107: Missing braces: %s"), eap->arg);
1242+ EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
1243 goto end;
1244 }
[1f22c7c]1245
[76dd250]1246@@ -3657,8 +3683,8 @@
1247 }
1248
1249 /*
1250- * Return TRUE if typeval "tv" is locked: Either tha value is locked itself or
1251- * it refers to a List or Dictionary that is locked.
1252+ * Return TRUE if typeval "tv" is locked: Either that value is locked itself
1253+ * or it refers to a List or Dictionary that is locked.
1254 */
1255 static int
[9a875fd]1256 tv_islocked(tv)
1257@@ -3902,7 +3928,7 @@
1258
1259 /*
1260 * Handle top level expression:
1261- * expr1 ? expr0 : expr0
1262+ * expr2 ? expr1 : expr1
1263 *
1264 * "arg" must point to the first non-white of the expression.
[1f22c7c]1265 * "arg" is advanced to the next non-white after the recognized expression.
[76dd250]1266@@ -6047,6 +6073,25 @@
1267 }
1268
1269 /*
1270+ * Get list item "l[idx - 1]" as a string. Returns NULL for failure.
1271+ */
1272+ char_u *
1273+list_find_str(l, idx)
1274+ list_T *l;
1275+ long idx;
1276+{
1277+ listitem_T *li;
1278+
1279+ li = list_find(l, idx - 1);
1280+ if (li == NULL)
1281+ {
1282+ EMSGN(_(e_listidx), idx);
1283+ return NULL;
1284+ }
1285+ return get_tv_string(&li->li_tv);
1286+}
1287+
1288+/*
1289 * Locate "item" list "l" and return its index.
1290 * Returns -1 when "item" is not in the list.
[1f22c7c]1291 */
[76dd250]1292@@ -6137,7 +6182,7 @@
1293 * When "len" >= 0 use "str[len]".
1294 * Returns FAIL when out of memory.
1295 */
1296- static int
1297+ int
1298 list_append_string(l, str, len)
1299 list_T *l;
[1f22c7c]1300 char_u *str;
1301@@ -6454,7 +6499,7 @@
1302 buf_T *buf;
1303 win_T *wp;
1304 int i;
1305- funccall_T *fc;
1306+ funccall_T *fc, **pfc;
1307 int did_free = FALSE;
1308 #ifdef FEAT_WINDOWS
1309 tabpage_T *tp;
[76dd250]1310@@ -6497,6 +6542,9 @@
1311 set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
1312 }
1313
1314+ /* v: vars */
1315+ set_ref_in_ht(&vimvarht, copyID);
1316+
1317 /*
1318 * 2. Go through the list of dicts and free items without the copyID.
[1f22c7c]1319 */
1320@@ -6535,6 +6583,20 @@
1321 else
1322 ll = ll->lv_used_next;
1323
1324+ /* check if any funccal can be freed now */
1325+ for (pfc = &previous_funccal; *pfc != NULL; )
1326+ {
1327+ if (can_free_funccal(*pfc, copyID))
1328+ {
1329+ fc = *pfc;
1330+ *pfc = fc->caller;
1331+ free_funccal(fc, TRUE);
1332+ did_free = TRUE;
1333+ }
1334+ else
1335+ pfc = &(*pfc)->caller;
1336+ }
1337+
1338 return did_free;
1339 }
1340
[76dd250]1341@@ -6587,7 +6649,7 @@
1342 {
1343 case VAR_DICT:
1344 dd = tv->vval.v_dict;
1345- if (dd->dv_copyID != copyID)
1346+ if (dd != NULL && dd->dv_copyID != copyID)
1347 {
1348 /* Didn't see this dict yet. */
[1f22c7c]1349 dd->dv_copyID = copyID;
[76dd250]1350@@ -6597,7 +6659,7 @@
1351
1352 case VAR_LIST:
1353 ll = tv->vval.v_list;
1354- if (ll->lv_copyID != copyID)
1355+ if (ll != NULL && ll->lv_copyID != copyID)
1356 {
1357 /* Didn't see this list yet. */
[1f22c7c]1358 ll->lv_copyID = copyID;
[76dd250]1359@@ -7525,8 +7587,8 @@
1360 {"getwinposx", 0, 0, f_getwinposx},
1361 {"getwinposy", 0, 0, f_getwinposy},
1362 {"getwinvar", 2, 2, f_getwinvar},
1363- {"glob", 1, 1, f_glob},
1364- {"globpath", 2, 2, f_globpath},
1365+ {"glob", 1, 2, f_glob},
1366+ {"globpath", 2, 3, f_globpath},
1367 {"has", 1, 1, f_has},
1368 {"has_key", 2, 2, f_has_key},
[5f4a45c9]1369 {"haslocaldir", 0, 0, f_haslocaldir},
1370@@ -7856,9 +7918,9 @@
1371 else if (!aborting())
1372 {
1373 if (argcount == MAX_FUNC_ARGS)
1374- emsg_funcname("E740: Too many arguments for function %s", name);
1375+ emsg_funcname(N_("E740: Too many arguments for function %s"), name);
1376 else
1377- emsg_funcname("E116: Invalid arguments for function %s", name);
1378+ emsg_funcname(N_("E116: Invalid arguments for function %s"), name);
1379 }
1380
1381 while (--argcount >= 0)
1382@@ -8091,6 +8153,7 @@
1383
1384 /*
1385 * Give an error message with a function name. Handle <SNR> things.
1386+ * "ermsg" is to be passed without translation, use N_() instead of _().
1387 */
1388 static void
1389 emsg_funcname(ermsg, name)
[76dd250]1390@@ -9518,7 +9581,7 @@
1391 else
1392 {
1393 /* When the optional second argument is non-zero, don't remove matches
1394- * for 'suffixes' and 'wildignore' */
1395+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1396 if (argvars[1].v_type != VAR_UNKNOWN
1397 && get_tv_number_chk(&argvars[1], &error))
[5f4a45c9]1398 flags |= WILD_KEEP_ALL;
[76dd250]1399@@ -10300,7 +10363,8 @@
1400 s = get_tv_string(&argvars[0]);
1401 if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
1402 EMSG2(_(e_invarg2), s);
1403- else if (!function_exists(s))
1404+ /* Don't check an autoload name for existence here. */
1405+ else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
1406 EMSG2(_("E700: Unknown function: %s"), s);
1407 else
[5f4a45c9]1408 {
[76dd250]1409@@ -10602,7 +10666,7 @@
1410 # ifdef FEAT_WINDOWS
1411 win_T *wp;
1412 # endif
1413- int n = 1;
1414+ int winnr = 1;
1415
1416 if (row >= 0 && col >= 0)
[5f4a45c9]1417 {
[76dd250]1418@@ -10612,9 +10676,9 @@
1419 (void)mouse_comp_pos(win, &row, &col, &lnum);
1420 # ifdef FEAT_WINDOWS
1421 for (wp = firstwin; wp != win; wp = wp->w_next)
1422- ++n;
1423+ ++winnr;
1424 # endif
1425- vimvars[VV_MOUSE_WIN].vv_nr = n;
1426+ vimvars[VV_MOUSE_WIN].vv_nr = winnr;
1427 vimvars[VV_MOUSE_LNUM].vv_nr = lnum;
1428 vimvars[VV_MOUSE_COL].vv_nr = col + 1;
[5f4a45c9]1429 }
[76dd250]1430@@ -11284,13 +11348,25 @@
1431 typval_T *argvars;
1432 typval_T *rettv;
1433 {
1434+ int flags = WILD_SILENT|WILD_USE_NL;
1435 expand_T xpc;
1436+ int error = FALSE;
1437
1438- ExpandInit(&xpc);
1439- xpc.xp_context = EXPAND_FILES;
1440+ /* When the optional second argument is non-zero, don't remove matches
1441+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1442+ if (argvars[1].v_type != VAR_UNKNOWN
1443+ && get_tv_number_chk(&argvars[1], &error))
1444+ flags |= WILD_KEEP_ALL;
1445 rettv->v_type = VAR_STRING;
1446- rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1447- NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
1448+ if (!error)
1449+ {
1450+ ExpandInit(&xpc);
1451+ xpc.xp_context = EXPAND_FILES;
1452+ rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1453+ NULL, flags, WILD_ALL);
1454+ }
1455+ else
1456+ rettv->vval.v_string = NULL;
1457 }
1458
[5f4a45c9]1459 /*
[76dd250]1460@@ -11301,14 +11377,22 @@
1461 typval_T *argvars;
1462 typval_T *rettv;
1463 {
1464+ int flags = 0;
1465 char_u buf1[NUMBUFLEN];
1466 char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
1467+ int error = FALSE;
1468
1469+ /* When the optional second argument is non-zero, don't remove matches
1470+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1471+ if (argvars[2].v_type != VAR_UNKNOWN
1472+ && get_tv_number_chk(&argvars[2], &error))
1473+ flags |= WILD_KEEP_ALL;
1474 rettv->v_type = VAR_STRING;
1475- if (file == NULL)
1476+ if (file == NULL || error)
1477 rettv->vval.v_string = NULL;
1478 else
1479- rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
1480+ rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
1481+ flags);
1482 }
1483
[5f4a45c9]1484 /*
[76dd250]1485@@ -11782,6 +11866,10 @@
1486 n = has_patch(atoi((char *)name + 5));
1487 else if (STRICMP(name, "vim_starting") == 0)
1488 n = (starting != 0);
1489+#ifdef FEAT_MBYTE
1490+ else if (STRICMP(name, "multi_byte_encoding") == 0)
1491+ n = has_mbyte;
1492+#endif
1493 #if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32)
1494 else if (STRICMP(name, "balloon_multiline") == 0)
[5f4a45c9]1495 n = multiline_balloon_available();
[76dd250]1496@@ -15838,10 +15926,9 @@
1497 if (res == FAIL)
1498 res = ITEM_COMPARE_FAIL;
1499 else
1500- /* return value has wrong type */
1501 res = get_tv_number_chk(&rettv, &item_compare_func_err);
1502 if (item_compare_func_err)
1503- res = ITEM_COMPARE_FAIL;
1504+ res = ITEM_COMPARE_FAIL; /* return value has wrong type */
1505 clear_tv(&rettv);
1506 return res;
[5f4a45c9]1507 }
[76dd250]1508@@ -16590,8 +16677,11 @@
1509 p = highlight_has_attr(id, HL_INVERSE, modec);
1510 break;
1511
1512- case 's': /* standout */
1513- p = highlight_has_attr(id, HL_STANDOUT, modec);
1514+ case 's':
1515+ if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */
1516+ p = highlight_color(id, what, modec);
1517+ else /* standout */
1518+ p = highlight_has_attr(id, HL_STANDOUT, modec);
1519 break;
1520
[5f4a45c9]1521 case 'u':
[76dd250]1522@@ -16658,7 +16748,7 @@
1523 col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
1524
1525 if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
1526- && col >= 0 && col < (long)STRLEN(ml_get(lnum))
1527+ && col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum)))
1528 && rettv_list_alloc(rettv) != FAIL)
1529 {
[5f4a45c9]1530 (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
[76dd250]1531@@ -18097,14 +18187,28 @@
1532 }
1533
1534 /*
1535- * Set v:count, v:count1 and v:prevcount.
1536+ * Get List v: variable value. Caller must take care of reference count when
1537+ * needed.
1538+ */
1539+ list_T *
1540+get_vim_var_list(idx)
1541+ int idx;
1542+{
1543+ return vimvars[idx].vv_list;
1544+}
1545+
1546+/*
1547+ * Set v:count to "count" and v:count1 to "count1".
1548+ * When "set_prevcount" is TRUE first set v:prevcount from v:count.
1549 */
1550 void
1551-set_vcount(count, count1)
1552+set_vcount(count, count1, set_prevcount)
1553 long count;
1554 long count1;
1555+ int set_prevcount;
1556 {
1557- vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
1558+ if (set_prevcount)
1559+ vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
1560 vimvars[VV_COUNT].vv_nr = count;
1561 vimvars[VV_COUNT1].vv_nr = count1;
[5f4a45c9]1562 }
[76dd250]1563@@ -18132,6 +18236,20 @@
1564 }
1565
1566 /*
1567+ * Set List v: variable to "val".
1568+ */
1569+ void
1570+set_vim_var_list(idx, val)
1571+ int idx;
1572+ list_T *val;
1573+{
1574+ list_unref(vimvars[idx].vv_list);
1575+ vimvars[idx].vv_list = val;
1576+ if (val != NULL)
1577+ ++val->lv_refcount;
1578+}
1579+
1580+/*
1581 * Set v:register if needed.
1582 */
[5f4a45c9]1583 void
[1f22c7c]1584@@ -18868,7 +18986,7 @@
1585 dictitem_T *dict_var;
1586 {
1587 hash_init(&dict->dv_hashtab);
1588- dict->dv_refcount = 99999;
1589+ dict->dv_refcount = DO_NOT_FREE_CNT;
1590 dict_var->di_tv.vval.v_dict = dict;
1591 dict_var->di_tv.v_type = VAR_DICT;
[5f4a45c9]1592 dict_var->di_tv.v_lock = VAR_FIXED;
[1f22c7c]1593@@ -19205,6 +19323,8 @@
1594 * Copy the values from typval_T "from" to typval_T "to".
1595 * When needed allocates string or increases reference count.
1596 * Does not make a copy of a list or dict but copies the reference!
1597+ * It is OK for "from" and "to" to point to the same item. This is used to
1598+ * make a copy later.
1599 */
1600 static void
[5f4a45c9]1601 copy_tv(from, to)
1602@@ -19748,7 +19868,7 @@
1603 }
1604 }
1605 else
1606- emsg_funcname("E123: Undefined function: %s", name);
1607+ emsg_funcname(N_("E123: Undefined function: %s"), name);
1608 }
1609 goto ret_free;
1610 }
1611@@ -19792,7 +19912,7 @@
1612 : eval_isnamec(arg[j])))
1613 ++j;
1614 if (arg[j] != NUL)
[9a875fd]1615- emsg_funcname(_(e_invarg2), arg);
[5f4a45c9]1616+ emsg_funcname((char *)e_invarg2, arg);
1617 }
1618 }
1619
1620@@ -20064,7 +20184,7 @@
1621 v = find_var(name, &ht);
1622 if (v != NULL && v->di_tv.v_type == VAR_FUNC)
1623 {
1624- emsg_funcname("E707: Function name conflicts with variable: %s",
1625+ emsg_funcname(N_("E707: Function name conflicts with variable: %s"),
1626 name);
1627 goto erret;
1628 }
1629@@ -20079,7 +20199,7 @@
1630 }
1631 if (fp->uf_calls > 0)
1632 {
1633- emsg_funcname("E127: Cannot redefine function %s: It is in use",
1634+ emsg_funcname(N_("E127: Cannot redefine function %s: It is in use"),
1635 name);
1636 goto erret;
1637 }
[76dd250]1638@@ -20590,6 +20710,9 @@
1639 int st_len = 0;
1640
1641 todo = (int)func_hashtab.ht_used;
1642+ if (todo == 0)
1643+ return; /* nothing to dump */
1644+
1645 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
1646
[5f4a45c9]1647 for (hi = func_hashtab.ht_array; todo > 0; ++hi)
[76dd250]1648@@ -20638,6 +20761,8 @@
1649 prof_self_cmp);
1650 prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
1651 }
1652+
1653+ vim_free(sorttab);
1654 }
1655
[5f4a45c9]1656 static void
[1f22c7c]1657@@ -21012,7 +21137,7 @@
1658 char_u *save_sourcing_name;
1659 linenr_T save_sourcing_lnum;
1660 scid_T save_current_SID;
1661- funccall_T fc;
1662+ funccall_T *fc;
1663 int save_did_emsg;
1664 static int depth = 0;
[5f4a45c9]1665 dictitem_T *v;
[1f22c7c]1666@@ -21038,36 +21163,37 @@
1667
1668 line_breakcheck(); /* check for CTRL-C hit */
1669
1670- fc.caller = current_funccal;
1671- current_funccal = &fc;
1672- fc.func = fp;
1673- fc.rettv = rettv;
1674+ fc = (funccall_T *)alloc(sizeof(funccall_T));
1675+ fc->caller = current_funccal;
1676+ current_funccal = fc;
1677+ fc->func = fp;
1678+ fc->rettv = rettv;
1679 rettv->vval.v_number = 0;
1680- fc.linenr = 0;
1681- fc.returned = FALSE;
1682- fc.level = ex_nesting_level;
1683+ fc->linenr = 0;
1684+ fc->returned = FALSE;
1685+ fc->level = ex_nesting_level;
1686 /* Check if this function has a breakpoint. */
1687- fc.breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
1688- fc.dbg_tick = debug_tick;
1689+ fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
1690+ fc->dbg_tick = debug_tick;
1691
1692 /*
1693- * Note about using fc.fixvar[]: This is an array of FIXVAR_CNT variables
1694+ * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables
1695 * with names up to VAR_SHORT_LEN long. This avoids having to alloc/free
1696 * each argument variable and saves a lot of time.
1697 */
1698 /*
1699 * Init l: variables.
1700 */
1701- init_var_dict(&fc.l_vars, &fc.l_vars_var);
1702+ init_var_dict(&fc->l_vars, &fc->l_vars_var);
1703 if (selfdict != NULL)
1704 {
1705 /* Set l:self to "selfdict". Use "name" to avoid a warning from
1706 * some compiler that checks the destination size. */
1707- v = &fc.fixvar[fixvar_idx++].var;
1708+ v = &fc->fixvar[fixvar_idx++].var;
1709 name = v->di_key;
1710 STRCPY(name, "self");
1711 v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX;
1712- hash_add(&fc.l_vars.dv_hashtab, DI2HIKEY(v));
1713+ hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
1714 v->di_tv.v_type = VAR_DICT;
1715 v->di_tv.v_lock = 0;
[5f4a45c9]1716 v->di_tv.vval.v_dict = selfdict;
[1f22c7c]1717@@ -21079,28 +21205,31 @@
1718 * Set a:0 to "argcount".
1719 * Set a:000 to a list with room for the "..." arguments.
1720 */
1721- init_var_dict(&fc.l_avars, &fc.l_avars_var);
1722- add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
1723+ init_var_dict(&fc->l_avars, &fc->l_avars_var);
[76dd250]1724+ add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0",
[1f22c7c]1725 (varnumber_T)(argcount - fp->uf_args.ga_len));
1726- v = &fc.fixvar[fixvar_idx++].var;
[76dd250]1727- STRCPY(v->di_key, "000");
1728+ /* Use "name" to avoid a warning from some compiler that checks the
[1f22c7c]1729+ * destination size. */
[76dd250]1730+ v = &fc->fixvar[fixvar_idx++].var;
1731+ name = v->di_key;
1732+ STRCPY(name, "000");
[1f22c7c]1733 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
1734- hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
[76dd250]1735+ hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
[1f22c7c]1736 v->di_tv.v_type = VAR_LIST;
1737 v->di_tv.v_lock = VAR_FIXED;
1738- v->di_tv.vval.v_list = &fc.l_varlist;
1739- vim_memset(&fc.l_varlist, 0, sizeof(list_T));
1740- fc.l_varlist.lv_refcount = 99999;
1741- fc.l_varlist.lv_lock = VAR_FIXED;
1742+ v->di_tv.vval.v_list = &fc->l_varlist;
1743+ vim_memset(&fc->l_varlist, 0, sizeof(list_T));
1744+ fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
1745+ fc->l_varlist.lv_lock = VAR_FIXED;
1746
1747 /*
1748 * Set a:firstline to "firstline" and a:lastline to "lastline".
1749 * Set a:name to named arguments.
1750 * Set a:N to the "..." arguments.
1751 */
1752- add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "firstline",
1753+ add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline",
1754 (varnumber_T)firstline);
1755- add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "lastline",
1756+ add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline",
1757 (varnumber_T)lastline);
1758 for (i = 0; i < argcount; ++i)
[5f4a45c9]1759 {
[1f22c7c]1760@@ -21116,7 +21245,7 @@
1761 }
1762 if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN)
1763 {
1764- v = &fc.fixvar[fixvar_idx++].var;
1765+ v = &fc->fixvar[fixvar_idx++].var;
1766 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
1767 }
[5f4a45c9]1768 else
[1f22c7c]1769@@ -21128,7 +21257,7 @@
1770 v->di_flags = DI_FLAGS_RO;
1771 }
1772 STRCPY(v->di_key, name);
1773- hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
1774+ hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
1775
1776 /* Note: the values are copied directly to avoid alloc/free.
[5f4a45c9]1777 * "argvars" must have VAR_FIXED for v_lock. */
[1f22c7c]1778@@ -21137,9 +21266,9 @@
1779
1780 if (ai >= 0 && ai < MAX_FUNC_ARGS)
1781 {
1782- list_append(&fc.l_varlist, &fc.l_listitems[ai]);
1783- fc.l_listitems[ai].li_tv = argvars[i];
1784- fc.l_listitems[ai].li_tv.v_lock = VAR_FIXED;
1785+ list_append(&fc->l_varlist, &fc->l_listitems[ai]);
1786+ fc->l_listitems[ai].li_tv = argvars[i];
1787+ fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED;
1788 }
1789 }
[5f4a45c9]1790
[76dd250]1791@@ -21204,7 +21333,7 @@
1792 if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
1793 func_do_profile(fp);
1794 if (fp->uf_profiling
[1f22c7c]1795- || (fc.caller != NULL && &fc.caller->func->uf_profiling))
[76dd250]1796+ || (fc->caller != NULL && fc->caller->func->uf_profiling))
1797 {
1798 ++fp->uf_tm_count;
[5f4a45c9]1799 profile_start(&call_start);
[1f22c7c]1800@@ -21220,7 +21349,7 @@
1801 did_emsg = FALSE;
1802
1803 /* call do_cmdline() to execute the lines */
1804- do_cmdline(NULL, get_func_line, (void *)&fc,
1805+ do_cmdline(NULL, get_func_line, (void *)fc,
1806 DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
1807
[5f4a45c9]1808 --RedrawingDisabled;
[76dd250]1809@@ -21235,16 +21364,16 @@
1810
1811 #ifdef FEAT_PROFILE
1812 if (do_profiling == PROF_YES && (fp->uf_profiling
[1f22c7c]1813- || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
[76dd250]1814+ || (fc->caller != NULL && fc->caller->func->uf_profiling)))
1815 {
1816 profile_end(&call_start);
1817 profile_sub_wait(&wait_start, &call_start);
1818 profile_add(&fp->uf_tm_total, &call_start);
1819 profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
[1f22c7c]1820- if (fc.caller != NULL && &fc.caller->func->uf_profiling)
[76dd250]1821+ if (fc->caller != NULL && fc->caller->func->uf_profiling)
[1f22c7c]1822 {
1823- profile_add(&fc.caller->func->uf_tm_children, &call_start);
1824- profile_add(&fc.caller->func->uf_tml_children, &call_start);
1825+ profile_add(&fc->caller->func->uf_tm_children, &call_start);
1826+ profile_add(&fc->caller->func->uf_tml_children, &call_start);
1827 }
1828 }
[5f4a45c9]1829 #endif
[1f22c7c]1830@@ -21257,9 +21386,9 @@
1831
1832 if (aborting())
1833 smsg((char_u *)_("%s aborted"), sourcing_name);
1834- else if (fc.rettv->v_type == VAR_NUMBER)
1835+ else if (fc->rettv->v_type == VAR_NUMBER)
1836 smsg((char_u *)_("%s returning #%ld"), sourcing_name,
1837- (long)fc.rettv->vval.v_number);
1838+ (long)fc->rettv->vval.v_number);
1839 else
1840 {
[5f4a45c9]1841 char_u buf[MSG_BUF_LEN];
[1f22c7c]1842@@ -21270,7 +21399,7 @@
1843 /* The value may be very long. Skip the middle part, so that we
1844 * have some idea how it starts and ends. smsg() would always
1845 * truncate it at the end. */
1846- s = tv2string(fc.rettv, &tofree, numbuf2, 0);
1847+ s = tv2string(fc->rettv, &tofree, numbuf2, 0);
1848 if (s != NULL)
1849 {
[5f4a45c9]1850 trunc_string(s, buf, MSG_BUF_CLEN);
[1f22c7c]1851@@ -21306,14 +21435,84 @@
1852 }
1853
1854 did_emsg |= save_did_emsg;
1855- current_funccal = fc.caller;
1856+ current_funccal = fc->caller;
1857+ --depth;
1858
1859- /* The a: variables typevals were not allocated, only free the allocated
1860- * variables. */
1861- vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE);
1862+ /* if the a:000 list and the a: dict are not referenced we can free the
1863+ * funccall_T and what's in it. */
1864+ if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT
1865+ && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT
1866+ && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT)
1867+ {
1868+ free_funccal(fc, FALSE);
1869+ }
1870+ else
1871+ {
1872+ hashitem_T *hi;
1873+ listitem_T *li;
1874+ int todo;
1875
1876- vars_clear(&fc.l_vars.dv_hashtab); /* free all l: variables */
1877- --depth;
1878+ /* "fc" is still in use. This can happen when returning "a:000" or
1879+ * assigning "l:" to a global variable.
1880+ * Link "fc" in the list for garbage collection later. */
1881+ fc->caller = previous_funccal;
1882+ previous_funccal = fc;
1883+
1884+ /* Make a copy of the a: variables, since we didn't do that above. */
1885+ todo = (int)fc->l_avars.dv_hashtab.ht_used;
1886+ for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
1887+ {
1888+ if (!HASHITEM_EMPTY(hi))
1889+ {
1890+ --todo;
1891+ v = HI2DI(hi);
1892+ copy_tv(&v->di_tv, &v->di_tv);
1893+ }
1894+ }
1895+
1896+ /* Make a copy of the a:000 items, since we didn't do that above. */
1897+ for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
1898+ copy_tv(&li->li_tv, &li->li_tv);
1899+ }
1900+}
1901+
1902+/*
[5f4a45c9]1903+ * Return TRUE if items in "fc" do not have "copyID". That means they are not
[1f22c7c]1904+ * referenced from anywhere.
1905+ */
1906+ static int
1907+can_free_funccal(fc, copyID)
1908+ funccall_T *fc;
1909+ int copyID;
1910+{
1911+ return (fc->l_varlist.lv_copyID != copyID
1912+ && fc->l_vars.dv_copyID != copyID
1913+ && fc->l_avars.dv_copyID != copyID);
1914+}
1915+
1916+/*
1917+ * Free "fc" and what it contains.
1918+ */
1919+ static void
1920+free_funccal(fc, free_val)
1921+ funccall_T *fc;
1922+ int free_val; /* a: vars were allocated */
1923+{
1924+ listitem_T *li;
1925+
1926+ /* The a: variables typevals may not have been allocated, only free the
1927+ * allocated variables. */
1928+ vars_clear_ext(&fc->l_avars.dv_hashtab, free_val);
1929+
1930+ /* free all l: variables */
1931+ vars_clear(&fc->l_vars.dv_hashtab);
1932+
1933+ /* Free the a:000 variables if they were allocated. */
1934+ if (free_val)
1935+ for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
1936+ clear_tv(&li->li_tv);
1937+
1938+ vim_free(fc);
1939 }
1940
[5f4a45c9]1941 /*
[76dd250]1942@@ -21886,6 +22085,62 @@
1943 }
1944 }
1945
1946+/*
1947+ * List v:oldfiles in a nice way.
1948+ */
1949+/*ARGSUSED*/
1950+ void
1951+ex_oldfiles(eap)
1952+ exarg_T *eap;
1953+{
1954+ list_T *l = vimvars[VV_OLDFILES].vv_list;
1955+ listitem_T *li;
1956+ int nr = 0;
1957+
1958+ if (l == NULL)
1959+ msg((char_u *)_("No old files"));
1960+ else
1961+ {
1962+ msg_start();
1963+ msg_scroll = TRUE;
1964+ for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
1965+ {
1966+ msg_outnum((long)++nr);
1967+ MSG_PUTS(": ");
1968+ msg_outtrans(get_tv_string(&li->li_tv));
1969+ msg_putchar('\n');
1970+ out_flush(); /* output one line at a time */
1971+ ui_breakcheck();
1972+ }
1973+ /* Assume "got_int" was set to truncate the listing. */
1974+ got_int = FALSE;
1975+
1976+#ifdef FEAT_BROWSE_CMD
1977+ if (cmdmod.browse)
1978+ {
1979+ quit_more = FALSE;
1980+ nr = prompt_for_number(FALSE);
1981+ msg_starthere();
1982+ if (nr > 0)
1983+ {
1984+ char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
1985+ (long)nr);
1986+
1987+ if (p != NULL)
1988+ {
1989+ p = expand_env_save(p);
1990+ eap->arg = p;
1991+ eap->cmdidx = CMD_edit;
1992+ cmdmod.browse = FALSE;
1993+ do_exedit(eap, NULL);
1994+ vim_free(p);
1995+ }
1996+ }
1997+ }
1998+#endif
1999+ }
2000+}
2001+
2002 #endif /* FEAT_EVAL */
2003
[5f4a45c9]2004
2005diff -Naur vim72.orig/src/ex_cmds2.c vim72/src/ex_cmds2.c
[4635005]2006--- vim72.orig/src/ex_cmds2.c 2008-07-13 09:18:22.000000000 -0700
[9a875fd]2007+++ vim72/src/ex_cmds2.c 2009-03-01 11:11:36.726320435 -0800
2008@@ -2842,6 +2842,7 @@
2009 linenr_T save_sourcing_lnum;
2010 char_u *p;
2011 char_u *fname_exp;
2012+ char_u *firstline = NULL;
2013 int retval = FAIL;
2014 #ifdef FEAT_EVAL
2015 scid_T save_current_SID;
2016@@ -2992,23 +2993,6 @@
2017
2018 cookie.level = ex_nesting_level;
2019 #endif
2020-#ifdef FEAT_MBYTE
2021- cookie.conv.vc_type = CONV_NONE; /* no conversion */
2022-
2023- /* Try reading the first few bytes to check for a UTF-8 BOM. */
2024- {
2025- char_u buf[3];
2026-
2027- if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)
2028- == (size_t)3
2029- && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
2030- /* Found BOM, setup conversion and skip over it. */
2031- convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
2032- else
2033- /* No BOM found, rewind. */
2034- fseek(cookie.fp, 0L, SEEK_SET);
2035- }
2036-#endif
2037
2038 /*
2039 * Keep the sourcing name/lnum, for recursive calls.
2040@@ -3018,6 +3002,27 @@
2041 save_sourcing_lnum = sourcing_lnum;
2042 sourcing_lnum = 0;
2043
2044+#ifdef FEAT_MBYTE
2045+ cookie.conv.vc_type = CONV_NONE; /* no conversion */
2046+
2047+ /* Read the first line so we can check for a UTF-8 BOM. */
2048+ firstline = getsourceline(0, (void *)&cookie, 0);
2049+ if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
2050+ && firstline[1] == 0xbb && firstline[2] == 0xbf)
2051+ {
2052+ /* Found BOM; setup conversion, skip over BOM and recode the line. */
2053+ convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
2054+ p = string_convert(&cookie.conv, firstline + 3, NULL);
2055+ if (p == NULL)
2056+ p = vim_strsave(firstline + 3);
2057+ if (p != NULL)
2058+ {
2059+ vim_free(firstline);
2060+ firstline = p;
2061+ }
2062+ }
2063+#endif
2064+
2065 #ifdef STARTUPTIME
2066 time_push(&tv_rel, &tv_start);
2067 #endif
2068@@ -3111,9 +3116,8 @@
2069 /*
2070 * Call do_cmdline, which will call getsourceline() to get the lines.
2071 */
2072- do_cmdline(NULL, getsourceline, (void *)&cookie,
2073+ do_cmdline(firstline, getsourceline, (void *)&cookie,
2074 DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
2075-
2076 retval = OK;
2077
2078 #ifdef FEAT_PROFILE
[5f4a45c9]2079@@ -3145,8 +3149,8 @@
2080 verbose_leave();
2081 }
2082 #ifdef STARTUPTIME
2083- vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname);
2084- time_msg(IObuff, &tv_start);
2085+ vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
2086+ time_msg((char *)IObuff, &tv_start);
2087 time_pop(&tv_rel);
2088 #endif
[9a875fd]2089
2090@@ -3171,6 +3175,7 @@
2091 #endif
2092 fclose(cookie.fp);
2093 vim_free(cookie.nextline);
2094+ vim_free(firstline);
2095 #ifdef FEAT_MBYTE
2096 convert_setup(&cookie.conv, NULL, NULL);
[76dd250]2097 #endif
2098diff -Naur vim72.orig/src/ex_cmds.c vim72/src/ex_cmds.c
[4635005]2099--- vim72.orig/src/ex_cmds.c 2008-08-04 12:15:00.000000000 -0700
[76dd250]2100+++ vim72/src/ex_cmds.c 2009-03-01 11:12:37.162193043 -0800
2101@@ -24,7 +24,7 @@
2102 static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out));
2103 #ifdef FEAT_VIMINFO
2104 static char_u *viminfo_filename __ARGS((char_u *));
2105-static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read));
2106+static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags));
2107 static int viminfo_encoding __ARGS((vir_T *virp));
2108 static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing));
[7352c10]2109 #endif
2110@@ -49,6 +49,7 @@
2111 exarg_T *eap;
2112 {
2113 int c;
2114+ int cval;
2115 char buf1[20];
2116 char buf2[20];
2117 char_u buf3[7];
2118@@ -75,6 +76,10 @@
2119 {
2120 if (c == NL) /* NUL is stored as NL */
2121 c = NUL;
2122+ if (c == CAR && get_fileformat(curbuf) == EOL_MAC)
2123+ cval = NL; /* NL is stored as CR */
2124+ else
2125+ cval = c;
2126 if (vim_isprintc_strict(c) && (c < ' '
2127 #ifndef EBCDIC
2128 || c > '~'
2129@@ -94,7 +99,7 @@
2130 buf2[0] = NUL;
2131 vim_snprintf((char *)IObuff, IOSIZE,
2132 _("<%s>%s%s %d, Hex %02x, Octal %03o"),
2133- transchar(c), buf1, buf2, c, c, c);
2134+ transchar(c), buf1, buf2, cval, cval, cval);
2135 #ifdef FEAT_MBYTE
2136 if (enc_utf8)
2137 c = cc[ci++];
[76dd250]2138@@ -1676,14 +1681,12 @@
2139
2140 /*
2141 * read_viminfo() -- Read the viminfo file. Registers etc. which are already
2142- * set are not over-written unless force is TRUE. -- webb
2143+ * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb
2144 */
2145 int
2146-read_viminfo(file, want_info, want_marks, forceit)
2147- char_u *file;
2148- int want_info;
2149- int want_marks;
2150- int forceit;
2151+read_viminfo(file, flags)
2152+ char_u *file; /* file name or NULL to use default name */
2153+ int flags; /* VIF_WANT_INFO et al. */
2154 {
2155 FILE *fp;
[7352c10]2156 char_u *fname;
[76dd250]2157@@ -1691,7 +1694,7 @@
2158 if (no_viminfo())
2159 return FAIL;
2160
2161- fname = viminfo_filename(file); /* may set to default if NULL */
2162+ fname = viminfo_filename(file); /* get file name in allocated buffer */
2163 if (fname == NULL)
2164 return FAIL;
[7352c10]2165 fp = mch_fopen((char *)fname, READBIN);
[76dd250]2166@@ -1701,8 +1704,9 @@
2167 verbose_enter();
2168 smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
2169 fname,
2170- want_info ? _(" info") : "",
2171- want_marks ? _(" marks") : "",
2172+ (flags & VIF_WANT_INFO) ? _(" info") : "",
2173+ (flags & VIF_WANT_MARKS) ? _(" marks") : "",
2174+ (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "",
2175 fp == NULL ? _(" FAILED") : "");
2176 verbose_leave();
[7352c10]2177 }
[76dd250]2178@@ -1712,10 +1716,9 @@
2179 return FAIL;
2180
2181 viminfo_errcnt = 0;
2182- do_viminfo(fp, NULL, want_info, want_marks, forceit);
2183+ do_viminfo(fp, NULL, flags);
2184
2185 fclose(fp);
2186-
2187 return OK;
2188 }
[7352c10]2189
[76dd250]2190@@ -1943,7 +1946,7 @@
2191 * root.
2192 */
2193 if (fp_out != NULL)
2194- (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
2195+ ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
2196 #endif
2197 }
[7352c10]2198 }
[76dd250]2199@@ -1968,7 +1971,7 @@
2200 }
2201
2202 viminfo_errcnt = 0;
2203- do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);
2204+ do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS));
2205
2206 fclose(fp_out); /* errors are ignored !? */
[7352c10]2207 if (fp_in != NULL)
[76dd250]2208@@ -2041,12 +2044,10 @@
2209 * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
2210 */
2211 static void
2212-do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
2213+do_viminfo(fp_in, fp_out, flags)
2214 FILE *fp_in;
2215 FILE *fp_out;
2216- int want_info;
2217- int want_marks;
2218- int force_read;
2219+ int flags;
2220 {
2221 int count = 0;
[7352c10]2222 int eof = FALSE;
[76dd250]2223@@ -2061,8 +2062,9 @@
2224
2225 if (fp_in != NULL)
2226 {
2227- if (want_info)
2228- eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL);
2229+ if (flags & VIF_WANT_INFO)
2230+ eof = read_viminfo_up_to_marks(&vir,
2231+ flags & VIF_FORCEIT, fp_out != NULL);
2232 else
2233 /* Skip info, find start of marks */
[7352c10]2234 while (!(eof = viminfo_readline(&vir))
[76dd250]2235@@ -2092,8 +2094,9 @@
2236 write_viminfo_bufferlist(fp_out);
2237 count = write_viminfo_marks(fp_out);
2238 }
2239- if (fp_in != NULL && want_marks)
2240- copy_viminfo_marks(&vir, fp_out, count, eof);
2241+ if (fp_in != NULL
2242+ && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
2243+ copy_viminfo_marks(&vir, fp_out, count, eof, flags);
2244
2245 vim_free(vir.vir_line);
[9a875fd]2246 #ifdef FEAT_MBYTE
2247@@ -2414,8 +2417,8 @@
2248 cursor_on(); /* msg_start() switches it off */
2249 out_flush();
2250 silent_mode = save_silent;
2251- info_message = FALSE;
2252 }
2253+ info_message = FALSE;
2254 }
2255
[61a83e8]2256 /*
2257@@ -2704,7 +2707,12 @@
2258 if (eap->cmdidx == CMD_saveas)
2259 {
2260 if (retval == OK)
2261+ {
2262 curbuf->b_p_ro = FALSE;
2263+#ifdef FEAT_WINDOWS
2264+ redraw_tabline = TRUE;
2265+#endif
2266+ }
2267 /* Change directories when the 'acd' option is set. */
2268 DO_AUTOCHDIR
2269 }
[76dd250]2270@@ -5059,6 +5067,7 @@
2271
2272 if (did_sub)
2273 ++sub_nlines;
2274+ vim_free(new_start); /* for when substitute was cancelled */
2275 vim_free(sub_firstline); /* free the copy of the original line */
2276 sub_firstline = NULL;
[4635005]2277 }
2278@@ -6520,6 +6529,7 @@
2279 static int last_sign_typenr = MAX_TYPENR; /* is decremented */
2280
2281 static void sign_list_defined __ARGS((sign_T *sp));
2282+static void sign_undefine __ARGS((sign_T *sp, sign_T *sp_prev));
2283
2284 /*
2285 * ":sign" command
2286@@ -6728,24 +6738,8 @@
2287 /* ":sign list {name}" */
2288 sign_list_defined(sp);
2289 else
2290- {
2291 /* ":sign undefine {name}" */
2292- vim_free(sp->sn_name);
2293- vim_free(sp->sn_icon);
2294-#ifdef FEAT_SIGN_ICONS
2295- if (sp->sn_image != NULL)
2296- {
2297- out_flush();
2298- gui_mch_destroy_sign(sp->sn_image);
2299- }
2300-#endif
2301- vim_free(sp->sn_text);
2302- if (sp_prev == NULL)
2303- first_sign = sp->sn_next;
2304- else
2305- sp_prev->sn_next = sp->sn_next;
2306- vim_free(sp);
2307- }
2308+ sign_undefine(sp, sp_prev);
2309 }
2310 }
2311 else
2312@@ -6994,6 +6988,31 @@
2313 }
2314
2315 /*
2316+ * Undefine a sign and free its memory.
2317+ */
2318+ static void
2319+sign_undefine(sp, sp_prev)
2320+ sign_T *sp;
2321+ sign_T *sp_prev;
2322+{
2323+ vim_free(sp->sn_name);
2324+ vim_free(sp->sn_icon);
2325+#ifdef FEAT_SIGN_ICONS
2326+ if (sp->sn_image != NULL)
2327+ {
2328+ out_flush();
2329+ gui_mch_destroy_sign(sp->sn_image);
2330+ }
2331+#endif
2332+ vim_free(sp->sn_text);
2333+ if (sp_prev == NULL)
2334+ first_sign = sp->sn_next;
2335+ else
2336+ sp_prev->sn_next = sp->sn_next;
2337+ vim_free(sp);
2338+}
2339+
2340+/*
2341 * Get highlighting attribute for sign "typenr".
2342 * If "line" is TRUE: line highl, if FALSE: text highl.
2343 */
2344@@ -7067,6 +7086,18 @@
2345 return (char_u *)_("[Deleted]");
2346 }
2347
2348+#if defined(EXITFREE) || defined(PROTO)
2349+/*
2350+ * Undefine/free all signs.
2351+ */
2352+ void
2353+free_signs()
2354+{
2355+ while (first_sign != NULL)
2356+ sign_undefine(first_sign, NULL);
2357+}
2358+#endif
2359+
2360 #endif
2361
[76dd250]2362 #if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO)
2363diff -Naur vim72.orig/src/ex_cmds.h vim72/src/ex_cmds.h
[4635005]2364--- vim72.orig/src/ex_cmds.h 2008-06-21 11:47:57.000000000 -0700
[76dd250]2365+++ vim72/src/ex_cmds.h 2009-03-01 11:07:42.759326442 -0800
2366@@ -278,7 +278,7 @@
2367 EX(CMD_crewind, "crewind", ex_cc,
2368 RANGE|NOTADR|COUNT|TRLBAR|BANG),
2369 EX(CMD_cscope, "cscope", do_cscope,
2370- EXTRA|NOTRLCOM|SBOXOK|XFILE),
2371+ EXTRA|NOTRLCOM|XFILE),
2372 EX(CMD_cstag, "cstag", do_cstag,
2373 BANG|TRLBAR|WORD1),
2374 EX(CMD_cunmap, "cunmap", ex_unmap,
2375@@ -506,7 +506,7 @@
2376 EX(CMD_lclose, "lclose", ex_cclose,
2377 RANGE|NOTADR|COUNT|TRLBAR),
2378 EX(CMD_lcscope, "lcscope", do_cscope,
2379- EXTRA|NOTRLCOM|SBOXOK|XFILE),
2380+ EXTRA|NOTRLCOM|XFILE),
2381 EX(CMD_left, "left", ex_align,
2382 TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
2383 EX(CMD_leftabove, "leftabove", ex_wrongmodifier,
2384@@ -635,6 +635,8 @@
2385 RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2386 EX(CMD_noremap, "noremap", ex_map,
2387 BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2388+EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier,
2389+ NEEDARG|EXTRA|NOTRLCOM),
2390 EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch,
2391 TRLBAR|SBOXOK|CMDWIN),
2392 EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate,
2393@@ -651,6 +653,8 @@
2394 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2395 EX(CMD_open, "open", ex_open,
2396 RANGE|EXTRA),
2397+EX(CMD_oldfiles, "oldfiles", ex_oldfiles,
2398+ BANG|TRLBAR|SBOXOK|CMDWIN),
2399 EX(CMD_omap, "omap", ex_map,
2400 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2401 EX(CMD_omapclear, "omapclear", ex_mapclear,
2402@@ -802,7 +806,7 @@
2403 EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
2404 WORD1|TRLBAR|CMDWIN),
2405 EX(CMD_scscope, "scscope", do_scscope,
2406- EXTRA|NOTRLCOM|SBOXOK),
2407+ EXTRA|NOTRLCOM),
2408 EX(CMD_set, "set", ex_set,
2409 TRLBAR|EXTRA|CMDWIN|SBOXOK),
2410 EX(CMD_setfiletype, "setfiletype", ex_setfiletype,
2411diff -Naur vim72.orig/src/ex_docmd.c vim72/src/ex_docmd.c
[4635005]2412--- vim72.orig/src/ex_docmd.c 2008-07-26 04:51:05.000000000 -0700
[76dd250]2413+++ vim72/src/ex_docmd.c 2009-03-01 11:12:42.138510127 -0800
2414@@ -364,6 +364,7 @@
2415 # define ex_function ex_ni
2416 # define ex_delfunction ex_ni
2417 # define ex_return ex_ni
2418+# define ex_oldfiles ex_ni
2419 #endif
2420 static char_u *arg_all __ARGS((void));
2421 #ifdef FEAT_SESSION
2422@@ -1770,7 +1771,7 @@
2423 }
2424 if (checkforcmd(&ea.cmd, "browse", 3))
2425 {
2426-#ifdef FEAT_BROWSE
2427+#ifdef FEAT_BROWSE_CMD
2428 cmdmod.browse = TRUE;
2429 #endif
2430 continue;
2431@@ -2978,6 +2979,7 @@
2432 {"keepmarks", 3, FALSE},
2433 {"leftabove", 5, FALSE},
2434 {"lockmarks", 3, FALSE},
2435+ {"noautocmd", 3, FALSE},
2436 {"rightbelow", 6, FALSE},
2437 {"sandbox", 3, FALSE},
2438 {"silent", 3, FALSE},
2439@@ -3608,6 +3610,7 @@
2440 return set_context_in_autocmd(xp, arg, FALSE);
2441
2442 case CMD_doautocmd:
2443+ case CMD_doautoall:
2444 return set_context_in_autocmd(xp, arg, TRUE);
2445 #endif
[5f4a45c9]2446 case CMD_set:
2447@@ -5479,6 +5482,9 @@
2448 return OK;
2449 }
2450
2451+/*
2452+ * ":command ..."
2453+ */
2454 static void
2455 ex_command(eap)
[54f612f]2456 exarg_T *eap;
2457@@ -5910,7 +5916,8 @@
[5f4a45c9]2458 char_u *q;
2459
[54f612f]2460 char_u *start;
2461- char_u *end;
[5f4a45c9]2462+ char_u *end = NULL;
2463+ char_u *ksp;
2464 size_t len, totlen;
2465
2466 size_t split_len = 0;
2467@@ -5927,16 +5934,51 @@
2468
2469 /*
2470 * Replace <> in the command by the arguments.
2471+ * First round: "buf" is NULL, compute length, allocate "buf".
2472+ * Second round: copy result into "buf".
2473 */
2474 buf = NULL;
2475 for (;;)
2476 {
2477- p = cmd->uc_rep;
2478- q = buf;
2479+ p = cmd->uc_rep; /* source */
2480+ q = buf; /* destinateion */
2481 totlen = 0;
2482- while ((start = vim_strchr(p, '<')) != NULL
2483- && (end = vim_strchr(start + 1, '>')) != NULL)
2484+
2485+ for (;;)
2486 {
2487+ start = vim_strchr(p, '<');
2488+ if (start != NULL)
2489+ end = vim_strchr(start + 1, '>');
2490+ if (buf != NULL)
2491+ {
2492+ ksp = vim_strchr(p, K_SPECIAL);
2493+ if (ksp != NULL && (start == NULL || ksp < start || end == NULL)
2494+ && ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER)
2495+# ifdef FEAT_GUI
2496+ || (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI)
2497+# endif
2498+ ))
2499+ {
2500+ /* K_SPECIAL han been put in the buffer as K_SPECIAL
2501+ * KS_SPECIAL KE_FILLER, like for mappings, but
2502+ * do_cmdline() doesn't handle that, so convert it back.
2503+ * Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */
2504+ len = ksp - p;
2505+ if (len > 0)
2506+ {
2507+ mch_memmove(q, p, len);
2508+ q += len;
2509+ }
2510+ *q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI;
2511+ p = ksp + 3;
2512+ continue;
2513+ }
2514+ }
2515+
2516+ /* break if there no <item> is found */
2517+ if (start == NULL || end == NULL)
2518+ break;
2519+
2520 /* Include the '>' */
2521 ++end;
2522
[76dd250]2523@@ -8749,8 +8791,8 @@
2524 else if (*dirnow != NUL
2525 && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
2526 {
2527- (void)mch_chdir((char *)globaldir);
[4635005]2528- shorten_fnames(TRUE);
[76dd250]2529+ if (mch_chdir((char *)globaldir) == 0)
2530+ shorten_fnames(TRUE);
2531 }
2532
[5f4a45c9]2533 failed |= (makeopens(fd, dirnow) == FAIL);
[76dd250]2534@@ -9506,24 +9548,50 @@
2535 break;
2536 }
2537 s = src + 1;
2538+ if (*s == '<') /* "#<99" uses v:oldfiles */
2539+ ++s;
2540 i = (int)getdigits(&s);
2541 *usedlen = (int)(s - src); /* length of what we expand */
2542
2543- buf = buflist_findnr(i);
2544- if (buf == NULL)
2545+ if (src[1] == '<')
2546 {
2547- *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
2548+ if (*usedlen < 2)
2549+ {
2550+ /* Should we give an error message for #<text? */
2551+ *usedlen = 1;
2552+ return NULL;
2553+ }
2554+#ifdef FEAT_EVAL
2555+ result = list_find_str(get_vim_var_list(VV_OLDFILES),
2556+ (long)i);
2557+ if (result == NULL)
2558+ {
2559+ *errormsg = (char_u *)"";
2560+ return NULL;
2561+ }
2562+#else
2563+ *errormsg = (char_u *)_("E809: #< is not available without the +eval feature");
2564 return NULL;
2565+#endif
2566 }
2567- if (lnump != NULL)
2568- *lnump = ECMD_LAST;
2569- if (buf->b_fname == NULL)
2570+ else
2571 {
2572- result = (char_u *)"";
2573- valid = 0; /* Must have ":p:h" to be valid */
2574+ buf = buflist_findnr(i);
2575+ if (buf == NULL)
2576+ {
2577+ *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
2578+ return NULL;
2579+ }
2580+ if (lnump != NULL)
2581+ *lnump = ECMD_LAST;
2582+ if (buf->b_fname == NULL)
2583+ {
2584+ result = (char_u *)"";
2585+ valid = 0; /* Must have ":p:h" to be valid */
2586+ }
2587+ else
2588+ result = buf->b_fname;
2589 }
2590- else
2591- result = buf->b_fname;
2592 break;
2593
[5f4a45c9]2594 #ifdef FEAT_SEARCHPATH
[76dd250]2595@@ -9541,6 +9609,15 @@
2596 #ifdef FEAT_AUTOCMD
2597 case SPEC_AFILE: /* file name for autocommand */
2598 result = autocmd_fname;
2599+ if (result != NULL && !autocmd_fname_full)
2600+ {
2601+ /* Still need to turn the fname into a full path. It is
2602+ * postponed to avoid a delay when <afile> is not used. */
2603+ autocmd_fname_full = TRUE;
2604+ result = FullName_save(autocmd_fname, FALSE);
2605+ vim_free(autocmd_fname);
2606+ autocmd_fname = result;
2607+ }
2608 if (result == NULL)
2609 {
[5f4a45c9]2610 *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
[76dd250]2611@@ -10067,7 +10144,7 @@
2612 */
2613 if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
2614 || put_line(fd, "if file_readable(s:sx)") == FAIL
2615- || put_line(fd, " exe \"source \" . s:sx") == FAIL
2616+ || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL
2617 || put_line(fd, "endif") == FAIL)
2618 return FAIL;
[5f4a45c9]2619
[76dd250]2620@@ -10689,7 +10766,8 @@
2621 p_viminfo = (char_u *)"'100";
2622 if (eap->cmdidx == CMD_rviminfo)
2623 {
2624- if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL)
2625+ if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS
2626+ | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL)
2627 EMSG(_("E195: Cannot open viminfo file for reading"));
2628 }
2629 else
2630diff -Naur vim72.orig/src/ex_getln.c vim72/src/ex_getln.c
[4635005]2631--- vim72.orig/src/ex_getln.c 2008-08-08 02:31:33.000000000 -0700
[76dd250]2632+++ vim72/src/ex_getln.c 2009-03-01 11:08:34.930671043 -0800
2633@@ -31,6 +31,8 @@
2634 int cmdattr; /* attributes for prompt */
2635 int overstrike; /* Typing mode on the command line. Shared by
2636 getcmdline() and put_on_cmdline(). */
2637+ expand_T *xpc; /* struct being used for expansion, xp_pattern
2638+ may point into cmdbuff */
2639 int xp_context; /* type of expansion */
2640 # ifdef FEAT_EVAL
2641 char_u *xp_arg; /* user-defined expansion arg */
2642@@ -38,7 +40,11 @@
2643 # endif
2644 };
2645
2646-static struct cmdline_info ccline; /* current cmdline_info */
2647+/* The current cmdline_info. It is initialized in getcmdline() and after that
2648+ * used by other functions. When invoking getcmdline() recursively it needs
2649+ * to be saved with save_cmdline() and restored with restore_cmdline().
2650+ * TODO: make it local to getcmdline() and pass it around. */
2651+static struct cmdline_info ccline;
2652
2653 static int cmd_showtail; /* Only show path tail in lists ? */
2654
2655@@ -238,6 +244,7 @@
2656 }
2657
2658 ExpandInit(&xpc);
2659+ ccline.xpc = &xpc;
2660
2661 #ifdef FEAT_RIGHTLEFT
2662 if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
2663@@ -408,9 +415,10 @@
2664 #endif
2665
2666 /*
2667- * <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>).
2668+ * When there are matching completions to select <S-Tab> works like
2669+ * CTRL-P (unless 'wc' is <S-Tab>).
2670 */
2671- if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)
2672+ if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
2673 c = Ctrl_P;
2674
2675 #ifdef FEAT_WILDMENU
2676@@ -1513,6 +1521,7 @@
2677 int old_firstc;
2678
2679 vim_free(ccline.cmdbuff);
2680+ xpc.xp_context = EXPAND_NOTHING;
2681 if (hiscnt == hislen)
2682 p = lookfor; /* back to the old one */
2683 else
2684@@ -1839,6 +1848,7 @@
2685 #endif
2686
2687 ExpandCleanup(&xpc);
2688+ ccline.xpc = NULL;
2689
2690 #ifdef FEAT_SEARCH_EXTRA
2691 if (did_incsearch)
2692@@ -2508,6 +2518,20 @@
2693 }
2694 mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
2695 vim_free(p);
2696+
2697+ if (ccline.xpc != NULL
2698+ && ccline.xpc->xp_pattern != NULL
2699+ && ccline.xpc->xp_context != EXPAND_NOTHING
2700+ && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
2701+ {
2702+ int i = (int)(ccline.xpc->xp_pattern - p);
2703+
2704+ /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
2705+ * to point into the newly allocated memory. */
2706+ if (i >= 0 && i <= ccline.cmdlen)
2707+ ccline.xpc->xp_pattern = ccline.cmdbuff + i;
2708+ }
2709+
2710 return OK;
2711 }
2712
2713@@ -2875,6 +2899,7 @@
2714 prev_ccline = ccline;
2715 ccline.cmdbuff = NULL;
2716 ccline.cmdprompt = NULL;
2717+ ccline.xpc = NULL;
2718 }
2719
2720 /*
2721@@ -3582,6 +3607,7 @@
2722 ExpandInit(xp)
2723 expand_T *xp;
2724 {
2725+ xp->xp_pattern = NULL;
2726 xp->xp_backslash = XP_BS_NONE;
2727 #ifndef BACKSLASH_IN_FILENAME
2728 xp->xp_shell = FALSE;
2729@@ -4871,7 +4897,7 @@
2730 if (s == NULL)
2731 return FAIL;
2732 sprintf((char *)s, "%s/%s*.vim", dirname, pat);
2733- all = globpath(p_rtp, s);
2734+ all = globpath(p_rtp, s, 0);
2735 vim_free(s);
2736 if (all == NULL)
2737 return FAIL;
2738@@ -4912,9 +4938,10 @@
2739 * newlines. Returns NULL for an error or no matches.
2740 */
2741 char_u *
2742-globpath(path, file)
2743+globpath(path, file, expand_options)
2744 char_u *path;
2745 char_u *file;
2746+ int expand_options;
2747 {
2748 expand_T xpc;
2749 char_u *buf;
2750@@ -4943,10 +4970,10 @@
2751 {
2752 add_pathsep(buf);
2753 STRCAT(buf, file);
2754- if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
2755- && num_p > 0)
2756+ if (ExpandFromContext(&xpc, buf, &num_p, &p,
2757+ WILD_SILENT|expand_options) != FAIL && num_p > 0)
2758 {
2759- ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
2760+ ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
2761 for (len = 0, i = 0; i < num_p; ++i)
2762 len += (int)STRLEN(p[i]) + 1;
2763
2764diff -Naur vim72.orig/src/feature.h vim72/src/feature.h
[4635005]2765--- vim72.orig/src/feature.h 2008-08-06 04:00:39.000000000 -0700
[76dd250]2766+++ vim72/src/feature.h 2009-03-01 11:07:42.763326442 -0800
2767@@ -767,9 +767,13 @@
2768
2769 /*
2770 * +browse ":browse" command.
2771+ * or just the ":browse" command modifier
2772 */
2773-#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))
2774-# define FEAT_BROWSE
2775+#if defined(FEAT_NORMAL)
2776+# define FEAT_BROWSE_CMD
2777+# 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)
2778+# define FEAT_BROWSE
2779+# endif
2780 #endif
2781
2782 /*
2783diff -Naur vim72.orig/src/fileio.c vim72/src/fileio.c
[4635005]2784--- vim72.orig/src/fileio.c 2008-08-06 04:01:03.000000000 -0700
[76dd250]2785+++ vim72/src/fileio.c 2009-03-01 11:10:34.002299762 -0800
2786@@ -932,7 +932,10 @@
2787 else
2788 {
2789 if (eap != NULL && eap->force_ff != 0)
2790+ {
2791 fileformat = get_fileformat_force(curbuf, eap);
2792+ try_unix = try_dos = try_mac = FALSE;
2793+ }
2794 else if (curbuf->b_p_bin)
2795 fileformat = EOL_UNIX; /* binary: use Unix format */
2796 else if (*p_ffs == NUL)
2797@@ -2211,7 +2214,7 @@
2798 {
2799 /* Use stderr for stdin, makes shell commands work. */
2800 close(0);
2801- dup(2);
2802+ ignored = dup(2);
2803 }
2804 #endif
2805
2806@@ -2341,11 +2344,6 @@
2807 STRCAT(IObuff, _("[CR missing]"));
2808 c = TRUE;
2809 }
2810- if (ff_error == EOL_MAC)
2811- {
2812- STRCAT(IObuff, _("[NL found]"));
2813- c = TRUE;
2814- }
2815 if (split)
2816 {
2817 STRCAT(IObuff, _("[long lines split]"));
2818@@ -2711,7 +2709,7 @@
2819 {
2820 if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
2821 && curbuf->b_ffname != NULL)
2822- read_viminfo(NULL, FALSE, TRUE, FALSE);
2823+ read_viminfo(NULL, VIF_WANT_MARKS);
2824
2825 /* Always set b_marks_read; needed when 'viminfo' is changed to include
2826 * the ' parameter after opening a buffer. */
2827@@ -3451,7 +3449,7 @@
2828 {
2829 # ifdef UNIX
2830 # ifdef HAVE_FCHOWN
2831- fchown(fd, st_old.st_uid, st_old.st_gid);
2832+ ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
2833 # endif
2834 if (mch_stat((char *)IObuff, &st) < 0
2835 || st.st_uid != st_old.st_uid
2836@@ -4367,7 +4365,7 @@
2837 || st.st_uid != st_old.st_uid
2838 || st.st_gid != st_old.st_gid)
2839 {
2840- fchown(fd, st_old.st_uid, st_old.st_gid);
2841+ ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
2842 if (perm >= 0) /* set permission again, may have changed */
2843 (void)mch_setperm(wfname, perm);
2844 }
2845@@ -5550,9 +5548,10 @@
2846 name = "ucs-4le"; /* FF FE 00 00 */
2847 len = 4;
2848 }
2849- else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L))
2850+ else if (flags == (FIO_UCS2 | FIO_ENDIAN_L))
2851 name = "ucs-2le"; /* FF FE */
2852- else if (flags == (FIO_UTF16 | FIO_ENDIAN_L))
2853+ else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L))
2854+ /* utf-16le is preferred, it also works for ucs-2le text */
2855 name = "utf-16le"; /* FF FE */
2856 }
2857 else if (p[0] == 0xfe && p[1] == 0xff
2858@@ -6031,9 +6030,9 @@
2859 {
2860 tbuf[FGETS_SIZE - 2] = NUL;
2861 #ifdef USE_CR
2862- fgets_cr((char *)tbuf, FGETS_SIZE, fp);
2863+ ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
2864 #else
2865- fgets((char *)tbuf, FGETS_SIZE, fp);
2866+ ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
2867 #endif
2868 } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
[43c52a1]2869 }
2870@@ -6107,12 +6106,24 @@
2871 #ifdef HAVE_ACL
2872 vim_acl_T acl; /* ACL from original file */
2873 #endif
2874+#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
2875+ int use_tmp_file = FALSE;
2876+#endif
2877
2878 /*
2879- * When the names are identical, there is nothing to do.
2880+ * When the names are identical, there is nothing to do. When they refer
2881+ * to the same file (ignoring case and slash/backslash differences) but
2882+ * the file name differs we need to go through a temp file.
2883 */
2884 if (fnamecmp(from, to) == 0)
2885- return 0;
2886+ {
2887+#ifdef CASE_INSENSITIVE_FILENAME
2888+ if (STRCMP(gettail(from), gettail(to)) != 0)
2889+ use_tmp_file = TRUE;
2890+ else
2891+#endif
2892+ return 0;
2893+ }
2894
2895 /*
2896 * Fail if the "from" file doesn't exist. Avoids that "to" is deleted.
[1f22c7c]2897@@ -6120,6 +6131,55 @@
2898 if (mch_stat((char *)from, &st) < 0)
2899 return -1;
2900
2901+#ifdef UNIX
2902+ {
2903+ struct stat st_to;
2904+
2905+ /* It's possible for the source and destination to be the same file.
2906+ * This happens when "from" and "to" differ in case and are on a FAT32
2907+ * filesystem. In that case go through a temp file name. */
2908+ if (mch_stat((char *)to, &st_to) >= 0
2909+ && st.st_dev == st_to.st_dev
[43c52a1]2910+ && st.st_ino == st_to.st_ino)
2911+ use_tmp_file = TRUE;
2912+ }
2913+#endif
2914+
2915+#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
2916+ if (use_tmp_file)
2917+ {
2918+ char tempname[MAXPATHL + 1];
2919+
2920+ /*
2921+ * Find a name that doesn't exist and is in the same directory.
2922+ * Rename "from" to "tempname" and then rename "tempname" to "to".
2923+ */
2924+ if (STRLEN(from) >= MAXPATHL - 5)
2925+ return -1;
2926+ STRCPY(tempname, from);
[1f22c7c]2927+ for (n = 123; n < 99999; ++n)
[43c52a1]2928+ {
2929+ sprintf((char *)gettail((char_u *)tempname), "%d", n);
[1f22c7c]2930+ if (mch_stat(tempname, &st) < 0)
[43c52a1]2931+ {
[1f22c7c]2932+ if (mch_rename((char *)from, tempname) == 0)
[43c52a1]2933+ {
2934+ if (mch_rename(tempname, (char *)to) == 0)
2935+ return 0;
2936+ /* Strange, the second step failed. Try moving the
2937+ * file back and return failure. */
[1f22c7c]2938+ mch_rename(tempname, (char *)from);
2939+ return -1;
[43c52a1]2940+ }
2941+ /* If it fails for one temp name it will most likely fail
2942+ * for any temp name, give up. */
[1f22c7c]2943+ return -1;
2944+ }
[43c52a1]2945+ }
[1f22c7c]2946+ return -1;
2947+ }
2948+#endif
2949+
2950 /*
2951 * Delete the "to" file, this is required on some systems to make the
[43c52a1]2952 * mch_rename() work, on other systems it makes sure that we don't have
[76dd250]2953@@ -8523,6 +8583,7 @@
2954 char_u *save_sourcing_name;
2955 linenr_T save_sourcing_lnum;
2956 char_u *save_autocmd_fname;
2957+ int save_autocmd_fname_full;
2958 int save_autocmd_bufnr;
2959 char_u *save_autocmd_match;
[43c52a1]2960 int save_autocmd_busy;
[76dd250]2961@@ -8601,6 +8662,7 @@
2962 * Save the autocmd_* variables and info about the current buffer.
2963 */
2964 save_autocmd_fname = autocmd_fname;
2965+ save_autocmd_fname_full = autocmd_fname_full;
2966 save_autocmd_bufnr = autocmd_bufnr;
2967 save_autocmd_match = autocmd_match;
[43c52a1]2968 save_autocmd_busy = autocmd_busy;
[76dd250]2969@@ -8618,14 +8680,15 @@
2970 if (fname != NULL && *fname != NUL)
2971 autocmd_fname = fname;
2972 else if (buf != NULL)
2973- autocmd_fname = buf->b_fname;
2974+ autocmd_fname = buf->b_ffname;
2975 else
2976 autocmd_fname = NULL;
2977 }
2978 else
2979 autocmd_fname = fname_io;
2980 if (autocmd_fname != NULL)
2981- autocmd_fname = FullName_save(autocmd_fname, FALSE);
2982+ autocmd_fname = vim_strsave(autocmd_fname);
2983+ autocmd_fname_full = FALSE; /* call FullName_save() later */
2984
2985 /*
[43c52a1]2986 * Set the buffer number to be used for <abuf>.
[76dd250]2987@@ -8810,6 +8873,7 @@
2988 sourcing_lnum = save_sourcing_lnum;
2989 vim_free(autocmd_fname);
2990 autocmd_fname = save_autocmd_fname;
2991+ autocmd_fname_full = save_autocmd_fname_full;
2992 autocmd_bufnr = save_autocmd_bufnr;
2993 autocmd_match = save_autocmd_match;
[43c52a1]2994 #ifdef FEAT_EVAL
[76dd250]2995@@ -8918,7 +8982,7 @@
2996 {
2997 apc->curpat = NULL;
2998
2999- /* only use a pattern when it has not been removed, has commands and
3000+ /* Only use a pattern when it has not been removed, has commands and
3001 * the group matches. For buffer-local autocommands only check the
3002 * buffer number. */
[43c52a1]3003 if (ap->pat != NULL && ap->cmds != NULL
[76dd250]3004@@ -9104,7 +9168,7 @@
3005 set_context_in_autocmd(xp, arg, doautocmd)
3006 expand_T *xp;
3007 char_u *arg;
3008- int doautocmd; /* TRUE for :doautocmd, FALSE for :autocmd */
3009+ int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */
3010 {
3011 char_u *p;
3012 int group;
3013diff -Naur vim72.orig/src/fold.c vim72/src/fold.c
[4635005]3014--- vim72.orig/src/fold.c 2008-08-06 04:01:12.000000000 -0700
[76dd250]3015+++ vim72/src/fold.c 2009-03-01 11:10:36.446457605 -0800
3016@@ -48,7 +48,7 @@
3017 static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp));
3018 static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum));
3019 static void checkupdate __ARGS((win_T *wp));
3020-static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open));
3021+static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open));
3022 static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep));
3023 static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep));
[43c52a1]3024 static void foldOpenNested __ARGS((fold_T *fpr));
3025@@ -740,7 +740,7 @@
3026 garray_T *found_ga;
3027 fold_T *found_fp = NULL;
3028 linenr_T found_off = 0;
3029- int use_level = FALSE;
3030+ int use_level;
3031 int maybe_small = FALSE;
3032 int level = 0;
3033 linenr_T lnum = start;
3034@@ -757,6 +757,7 @@
3035 gap = &curwin->w_folds;
3036 found_ga = NULL;
3037 lnum_off = 0;
3038+ use_level = FALSE;
3039 for (;;)
3040 {
3041 if (!foldFind(gap, lnum - lnum_off, &fp))
3042@@ -783,20 +784,21 @@
3043 else
3044 {
3045 lnum = found_fp->fd_top + found_fp->fd_len + found_off;
3046- did_one = TRUE;
3047
3048 if (foldmethodIsManual(curwin))
3049 deleteFoldEntry(found_ga,
3050 (int)(found_fp - (fold_T *)found_ga->ga_data), recursive);
3051 else
3052 {
3053- if (found_fp->fd_top + found_off < first_lnum)
3054- first_lnum = found_fp->fd_top;
3055- if (lnum > last_lnum)
3056+ if (first_lnum > found_fp->fd_top + found_off)
3057+ first_lnum = found_fp->fd_top + found_off;
3058+ if (last_lnum < lnum)
3059 last_lnum = lnum;
3060- parseMarker(curwin);
3061+ if (!did_one)
3062+ parseMarker(curwin);
3063 deleteFoldMarkers(found_fp, recursive, found_off);
3064 }
3065+ did_one = TRUE;
3066
3067 /* redraw window */
3068 changed_window_setting();
3069@@ -811,6 +813,10 @@
3070 redraw_curbuf_later(INVERTED);
3071 #endif
3072 }
3073+ else
3074+ /* Deleting markers may make cursor column invalid. */
3075+ check_cursor_col();
3076+
3077 if (last_lnum > 0)
3078 changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L);
3079 }
[76dd250]3080@@ -1241,10 +1247,10 @@
3081 * Repeat "count" times.
3082 */
3083 static void
3084-setFoldRepeat(lnum, count, open)
3085+setFoldRepeat(lnum, count, do_open)
3086 linenr_T lnum;
3087 long count;
3088- int open;
3089+ int do_open;
3090 {
3091 int done;
[43c52a1]3092 long n;
[76dd250]3093@@ -1252,7 +1258,7 @@
3094 for (n = 0; n < count; ++n)
3095 {
3096 done = DONE_NOTHING;
3097- (void)setManualFold(lnum, open, FALSE, &done);
3098+ (void)setManualFold(lnum, do_open, FALSE, &done);
3099 if (!(done & DONE_ACTION))
3100 {
3101 /* Only give an error message when no fold could be opened. */
3102diff -Naur vim72.orig/src/getchar.c vim72/src/getchar.c
[4635005]3103--- vim72.orig/src/getchar.c 2008-07-22 09:57:48.000000000 -0700
[54f612f]3104+++ vim72/src/getchar.c 2009-03-01 11:12:29.677711691 -0800
3105@@ -3816,7 +3816,11 @@
3106 int len = 1;
3107
3108 if (msg_didout || msg_silent != 0)
3109+ {
3110 msg_putchar('\n');
3111+ if (got_int) /* 'q' typed at MORE prompt */
3112+ return;
3113+ }
3114 if ((mp->m_mode & (INSERT + CMDLINE)) == INSERT + CMDLINE)
3115 msg_putchar('!'); /* :map! */
3116 else if (mp->m_mode & INSERT)
[76dd250]3117@@ -4702,7 +4706,7 @@
3118 return FAIL;
3119 if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0)
3120 return FAIL;
3121- if (fprintf(fd, cmd) < 0)
3122+ if (fputs(cmd, fd) < 0)
3123 return FAIL;
3124 if (buf != NULL && fputs(" <buffer>", fd) < 0)
[54f612f]3125 return FAIL;
[76dd250]3126@@ -4801,7 +4805,7 @@
3127 }
3128 if (IS_SPECIAL(c) || modifiers) /* special key */
3129 {
3130- if (fprintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)
3131+ if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0)
3132 return FAIL;
3133 continue;
3134 }
3135diff -Naur vim72.orig/src/globals.h vim72/src/globals.h
[4635005]3136--- vim72.orig/src/globals.h 2008-07-26 04:53:29.000000000 -0700
[76dd250]3137+++ vim72/src/globals.h 2009-03-01 11:10:39.066624388 -0800
3138@@ -1022,6 +1022,7 @@
3139 #endif
3140 #ifdef FEAT_AUTOCMD
3141 EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
3142+EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
3143 EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
3144 EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
[43c52a1]3145 EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
3146@@ -1339,7 +1340,6 @@
3147
3148 #ifdef FEAT_NETBEANS_INTG
3149 EXTERN char *netbeansArg INIT(= NULL); /* the -nb[:host:port:passwd] arg */
3150-EXTERN int netbeansCloseFile INIT(= 0); /* send killed if != 0 */
3151 EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */
3152 EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */
3153 EXTERN int netbeansReadFile INIT(= 1); /* OK to read from disk if != 0 */
[76dd250]3154@@ -1548,6 +1548,14 @@
3155 EXTERN time_t starttime;
3156
3157 /*
3158+ * Some compilers warn for not using a return value, but in some situations we
3159+ * can't do anything useful with the value. Assign to this variable to avoid
3160+ * the warning.
3161+ */
3162+EXTERN int ignored;
3163+EXTERN char *ignoredp;
3164+
3165+/*
3166 * Optional Farsi support. Include it here, so EXTERN and INIT are defined.
3167 */
[5f4a45c9]3168 #ifdef FEAT_FKMAP
3169diff -Naur vim72.orig/src/gui_at_sb.c vim72/src/gui_at_sb.c
[4635005]3170--- vim72.orig/src/gui_at_sb.c 2004-06-07 07:32:25.000000000 -0700
[5f4a45c9]3171+++ vim72/src/gui_at_sb.c 2009-03-01 11:08:45.631356893 -0800
3172@@ -1078,6 +1078,12 @@
3173 Cardinal *num_params; /* unused */
3174 {
3175 ScrollbarWidget sbw = (ScrollbarWidget)w;
3176+ /* Use a union to avoid a warning for the weird conversion from float to
3177+ * XtPointer. Comes from Xaw/Scrollbar.c. */
3178+ union {
3179+ XtPointer xtp;
3180+ float xtf;
3181+ } xtpf;
3182
3183 if (LookAhead(w, event))
3184 return;
3185@@ -1085,7 +1091,8 @@
3186 /* thumbProc is not pretty, but is necessary for backwards
3187 compatibility on those architectures for which it work{s,ed};
3188 the intent is to pass a (truncated) float by value. */
3189- XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top);
3190+ xtpf.xtf = sbw->scrollbar.top;
3191+ XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
3192 XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
3193 }
[76dd250]3194
3195diff -Naur vim72.orig/src/gui.c vim72/src/gui.c
[4635005]3196--- vim72.orig/src/gui.c 2008-07-27 12:32:14.000000000 -0700
[76dd250]3197+++ vim72/src/gui.c 2009-03-01 11:10:03.076318759 -0800
3198@@ -139,7 +139,7 @@
3199 /* The read returns when the child closes the pipe (or when
3200 * the child dies for some reason). */
3201 close(pipefd[1]);
3202- (void)read(pipefd[0], &dummy, (size_t)1);
3203+ ignored = (int)read(pipefd[0], &dummy, (size_t)1);
3204 close(pipefd[0]);
3205 }
3206
3207@@ -3241,7 +3241,7 @@
3208 i = Rows;
3209 gui_update_tabline();
3210 Rows = i;
3211- need_set_size = RESIZE_VERT;
3212+ need_set_size |= RESIZE_VERT;
3213 if (using_tabline)
3214 fix_size = TRUE;
3215 if (!gui_use_tabline())
3216@@ -3275,9 +3275,9 @@
3217 if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
3218 {
3219 if (i == SBAR_BOTTOM)
3220- need_set_size = RESIZE_VERT;
3221+ need_set_size |= RESIZE_VERT;
3222 else
3223- need_set_size = RESIZE_HOR;
3224+ need_set_size |= RESIZE_HOR;
3225 if (gui.which_scrollbars[i])
3226 fix_size = TRUE;
3227 }
3228@@ -3297,7 +3297,7 @@
3229 gui_mch_enable_menu(gui.menu_is_active);
3230 Rows = i;
3231 prev_menu_is_active = gui.menu_is_active;
3232- need_set_size = RESIZE_VERT;
3233+ need_set_size |= RESIZE_VERT;
3234 if (gui.menu_is_active)
3235 fix_size = TRUE;
3236 }
3237@@ -3308,7 +3308,7 @@
3238 {
3239 gui_mch_show_toolbar(using_toolbar);
3240 prev_toolbar = using_toolbar;
3241- need_set_size = RESIZE_VERT;
3242+ need_set_size |= RESIZE_VERT;
3243 if (using_toolbar)
3244 fix_size = TRUE;
3245 }
3246@@ -3318,7 +3318,7 @@
3247 {
3248 gui_mch_enable_footer(using_footer);
3249 prev_footer = using_footer;
3250- need_set_size = RESIZE_VERT;
3251+ need_set_size |= RESIZE_VERT;
3252 if (using_footer)
3253 fix_size = TRUE;
3254 }
3255@@ -3330,10 +3330,11 @@
3256 prev_tearoff = using_tearoff;
3257 }
3258 #endif
3259- if (need_set_size)
3260+ if (need_set_size != 0)
3261 {
3262 #ifdef FEAT_GUI_GTK
3263- long c = Columns;
3264+ long prev_Columns = Columns;
3265+ long prev_Rows = Rows;
3266 #endif
3267 /* Adjust the size of the window to make the text area keep the
3268 * same size and to avoid that part of our window is off-screen
3269@@ -3349,11 +3350,14 @@
3270 * If you remove this, please test this command for resizing
3271 * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
3272 * Don't do this while starting up though.
3273- * And don't change Rows, it may have be reduced intentionally
3274- * when adding menu/toolbar/tabline. */
3275- if (!gui.starting)
3276+ * Don't change Rows when adding menu/toolbar/tabline.
3277+ * Don't change Columns when adding vertical toolbar. */
3278+ if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
3279 (void)char_avail();
3280- Columns = c;
3281+ if ((need_set_size & RESIZE_VERT) == 0)
3282+ Rows = prev_Rows;
3283+ if ((need_set_size & RESIZE_HOR) == 0)
3284+ Columns = prev_Columns;
3285 #endif
3286 }
3287 #ifdef FEAT_WINDOWS
3288diff -Naur vim72.orig/src/gui_gtk_x11.c vim72/src/gui_gtk_x11.c
[4635005]3289--- vim72.orig/src/gui_gtk_x11.c 2008-07-04 03:46:24.000000000 -0700
[76dd250]3290+++ vim72/src/gui_gtk_x11.c 2009-03-01 11:08:45.631356893 -0800
3291@@ -4070,14 +4070,14 @@
3292
3293 if (mask & (XValue | YValue))
3294 {
3295- int w, h;
3296- gui_mch_get_screen_dimensions(&w, &h);
3297- h += p_ghr + get_menu_tool_height();
3298- w += get_menu_tool_width();
3299+ int ww, hh;
3300+ gui_mch_get_screen_dimensions(&ww, &hh);
3301+ hh += p_ghr + get_menu_tool_height();
3302+ ww += get_menu_tool_width();
3303 if (mask & XNegative)
3304- x += w - pixel_width;
3305+ x += ww - pixel_width;
3306 if (mask & YNegative)
3307- y += h - pixel_height;
3308+ y += hh - pixel_height;
3309 #ifdef HAVE_GTK2
3310 gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
3311 #else
3312diff -Naur vim72.orig/src/gui_x11.c vim72/src/gui_x11.c
[4635005]3313--- vim72.orig/src/gui_x11.c 2008-06-08 08:13:45.000000000 -0700
3314+++ vim72/src/gui_x11.c 2009-03-01 11:12:34.666031009 -0800
3315@@ -1587,6 +1587,8 @@
3316 XtCloseDisplay(gui.dpy);
3317 gui.dpy = NULL;
3318 vimShell = (Widget)0;
3319+ vim_free(gui_argv);
3320+ gui_argv = NULL;
3321 }
3322
3323 /*
3324@@ -1761,6 +1763,8 @@
3325 * says that this isn't needed when exiting, so just skip it. */
3326 XtCloseDisplay(gui.dpy);
3327 #endif
3328+ vim_free(gui_argv);
3329+ gui_argv = NULL;
3330 }
3331
3332 /*
[76dd250]3333@@ -2450,7 +2454,7 @@
3334 *colorPtr = colortable[closest];
3335 }
3336
3337- free(colortable);
3338+ vim_free(colortable);
3339 return OK;
3340 }
[4635005]3341
3342@@ -3439,47 +3443,37 @@
3343 char_u *signfile;
3344 {
3345 XpmAttributes attrs;
3346- XImage *sign;
3347+ XImage *sign = NULL;
3348 int status;
3349
3350 /*
3351 * Setup the color substitution table.
3352 */
3353- sign = NULL;
3354 if (signfile[0] != NUL && signfile[0] != '-')
3355 {
3356- sign = (XImage *)alloc(sizeof(XImage));
3357- if (sign != NULL)
3358+ XpmColorSymbol color[5] =
3359 {
3360- XpmColorSymbol color[5] =
3361- {
3362- {"none", NULL, 0},
3363- {"iconColor1", NULL, 0},
3364- {"bottomShadowColor", NULL, 0},
3365- {"topShadowColor", NULL, 0},
3366- {"selectColor", NULL, 0}
3367- };
3368- attrs.valuemask = XpmColorSymbols;
3369- attrs.numsymbols = 2;
3370- attrs.colorsymbols = color;
3371- attrs.colorsymbols[0].pixel = gui.back_pixel;
3372- attrs.colorsymbols[1].pixel = gui.norm_pixel;
3373- status = XpmReadFileToImage(gui.dpy, (char *)signfile,
3374+ {"none", NULL, 0},
3375+ {"iconColor1", NULL, 0},
3376+ {"bottomShadowColor", NULL, 0},
3377+ {"topShadowColor", NULL, 0},
3378+ {"selectColor", NULL, 0}
3379+ };
3380+ attrs.valuemask = XpmColorSymbols;
3381+ attrs.numsymbols = 2;
3382+ attrs.colorsymbols = color;
3383+ attrs.colorsymbols[0].pixel = gui.back_pixel;
3384+ attrs.colorsymbols[1].pixel = gui.norm_pixel;
3385+ status = XpmReadFileToImage(gui.dpy, (char *)signfile,
3386 &sign, NULL, &attrs);
3387-
3388- if (status == 0)
3389- {
3390- /* Sign width is fixed at two columns now.
3391- if (sign->width > gui.sign_width)
3392- gui.sign_width = sign->width + 8; */
3393- }
3394- else
3395- {
3396- vim_free(sign);
3397- sign = NULL;
3398- EMSG(_(e_signdata));
3399- }
3400+ if (status == 0)
3401+ {
3402+ /* Sign width is fixed at two columns now.
3403+ if (sign->width > gui.sign_width)
3404+ gui.sign_width = sign->width + 8; */
3405 }
3406+ else
3407+ EMSG(_(e_signdata));
3408 }
3409
3410 return (void *)sign;
3411@@ -3489,8 +3483,7 @@
3412 gui_mch_destroy_sign(sign)
3413 void *sign;
3414 {
3415- XFree(((XImage *)sign)->data);
3416- vim_free(sign);
3417+ XDestroyImage((XImage*)sign);
3418 }
3419 #endif
[76dd250]3420
3421diff -Naur vim72.orig/src/gui_xmdlg.c vim72/src/gui_xmdlg.c
[4635005]3422--- vim72.orig/src/gui_xmdlg.c 2008-06-21 09:05:32.000000000 -0700
[76dd250]3423+++ vim72/src/gui_xmdlg.c 2009-03-01 11:08:45.635357731 -0800
3424@@ -369,10 +369,10 @@
3425 char buf[TEMP_BUF_SIZE];
3426 XmString items[MAX_ENTRIES_IN_LIST];
3427 int i;
3428- int index;
3429+ int idx;
3430
3431- for (index = (int)ENCODING; index < (int)NONE; ++index)
3432- count[index] = 0;
3433+ for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
3434+ count[idx] = 0;
3435
3436 /* First we insert the wild char into every single list. */
3437 if (fix != ENCODING)
3438@@ -503,14 +503,14 @@
3439 /*
3440 * Now loop trough the remaining lists and set them up.
3441 */
3442- for (index = (int)NAME; index < (int)NONE; ++index)
3443+ for (idx = (int)NAME; idx < (int)NONE; ++idx)
3444 {
3445 Widget w;
3446
3447- if (fix == (enum ListSpecifier)index)
3448+ if (fix == (enum ListSpecifier)idx)
3449 continue;
3450
3451- switch ((enum ListSpecifier)index)
3452+ switch ((enum ListSpecifier)idx)
3453 {
3454 case NAME:
3455 w = data->list[NAME];
3456@@ -525,21 +525,21 @@
3457 w = (Widget)0; /* for lint */
3458 }
3459
3460- for (i = 0; i < count[index]; ++i)
3461+ for (i = 0; i < count[idx]; ++i)
3462 {
3463- items[i] = XmStringCreateLocalized(list[index][i]);
3464- XtFree(list[index][i]);
3465+ items[i] = XmStringCreateLocalized(list[idx][i]);
3466+ XtFree(list[idx][i]);
3467 }
3468 XmListDeleteAllItems(w);
3469- XmListAddItems(w, items, count[index], 1);
3470- if (data->sel[index])
3471+ XmListAddItems(w, items, count[idx], 1);
3472+ if (data->sel[idx])
3473 {
3474 XmStringFree(items[0]);
3475- items[0] = XmStringCreateLocalized(data->sel[index]);
3476+ items[0] = XmStringCreateLocalized(data->sel[idx]);
3477 XmListSelectItem(w, items[0], False);
3478 XmListSetBottomItem(w, items[0]);
3479 }
3480- for (i = 0; i < count[index]; ++i)
3481+ for (i = 0; i < count[idx]; ++i)
3482 XmStringFree(items[i]);
3483 }
3484 }
3485@@ -695,14 +695,14 @@
3486 int n;
3487 XmString str;
3488 Arg args[4];
3489- char *msg = _("no specific match");
3490+ char *nomatch_msg = _("no specific match");
3491
3492 n = 0;
3493- str = XmStringCreateLocalized(msg);
3494+ str = XmStringCreateLocalized(nomatch_msg);
3495 XtSetArg(args[n], XmNlabelString, str); ++n;
3496 XtSetValues(data->sample, args, n);
3497 apply_fontlist(data->sample);
3498- XmTextSetString(data->name, msg);
3499+ XmTextSetString(data->name, nomatch_msg);
3500 XmStringFree(str);
3501
3502 return False;
3503@@ -886,21 +886,21 @@
3504 {
3505 int i;
3506 int max;
3507- int index = 0;
3508+ int idx = 0;
3509 int size;
3510- char str[128];
3511+ char buf[128];
3512
3513 for (i = 0, max = 0; i < data->num; i++)
3514 {
3515- get_part(fn(data, i), 7, str);
3516- size = atoi(str);
3517+ get_part(fn(data, i), 7, buf);
3518+ size = atoi(buf);
3519 if ((size > max) && (size < MAX_DISPLAY_SIZE))
3520 {
3521- index = i;
3522+ idx = i;
3523 max = size;
3524 }
3525 }
3526- strcpy(big_font, fn(data, index));
3527+ strcpy(big_font, fn(data, idx));
3528 }
3529 data->old = XLoadQueryFont(XtDisplay(parent), big_font);
3530 data->old_list = gui_motif_create_fontlist(data->old);
3531@@ -1217,28 +1217,28 @@
3532
3533 if (i != 0)
3534 {
3535- char name[TEMP_BUF_SIZE];
3536- char style[TEMP_BUF_SIZE];
3537- char size[TEMP_BUF_SIZE];
3538- char encoding[TEMP_BUF_SIZE];
3539+ char namebuf[TEMP_BUF_SIZE];
3540+ char stylebuf[TEMP_BUF_SIZE];
3541+ char sizebuf[TEMP_BUF_SIZE];
3542+ char encodingbuf[TEMP_BUF_SIZE];
3543 char *found;
3544
3545 found = names[0];
3546
3547- name_part(found, name);
3548- style_part(found, style);
3549- size_part(found, size, data->in_pixels);
3550- encoding_part(found, encoding);
3551-
3552- if (strlen(name) > 0
3553- && strlen(style) > 0
3554- && strlen(size) > 0
3555- && strlen(encoding) > 0)
3556+ name_part(found, namebuf);
3557+ style_part(found, stylebuf);
3558+ size_part(found, sizebuf, data->in_pixels);
3559+ encoding_part(found, encodingbuf);
3560+
3561+ if (strlen(namebuf) > 0
3562+ && strlen(stylebuf) > 0
3563+ && strlen(sizebuf) > 0
3564+ && strlen(encodingbuf) > 0)
3565 {
3566- data->sel[NAME] = XtNewString(name);
3567- data->sel[STYLE] = XtNewString(style);
3568- data->sel[SIZE] = XtNewString(size);
3569- data->sel[ENCODING] = XtNewString(encoding);
3570+ data->sel[NAME] = XtNewString(namebuf);
3571+ data->sel[STYLE] = XtNewString(stylebuf);
3572+ data->sel[SIZE] = XtNewString(sizebuf);
3573+ data->sel[ENCODING] = XtNewString(encodingbuf);
3574 data->font_name = XtNewString(names[0]);
3575 display_sample(data);
3576 XmTextSetString(data->name, data->font_name);
3577diff -Naur vim72.orig/src/gui_xmebw.c vim72/src/gui_xmebw.c
[4635005]3578--- vim72.orig/src/gui_xmebw.c 2007-09-06 03:57:51.000000000 -0700
[76dd250]3579+++ vim72/src/gui_xmebw.c 2009-03-01 11:08:45.635357731 -0800
3580@@ -1256,7 +1256,7 @@
3581 }
3582 else
3583 {
3584- int adjust = 0;
3585+ adjust = 0;
3586
3587 #if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
3588 /*
3589@@ -1268,12 +1268,11 @@
3590 {
3591 case XmEXTERNAL_HIGHLIGHT:
3592 adjust = (eb->primitive.highlight_thickness -
3593- (eb->pushbutton.default_button_shadow_thickness ?
3594- Xm3D_ENHANCE_PIXEL : 0));
3595+ (eb->pushbutton.default_button_shadow_thickness
3596+ ? Xm3D_ENHANCE_PIXEL : 0));
3597 break;
3598
3599 case XmINTERNAL_HIGHLIGHT:
3600- adjust = 0;
3601 break;
3602
3603 default:
3604diff -Naur vim72.orig/src/if_cscope.c vim72/src/if_cscope.c
[4635005]3605--- vim72.orig/src/if_cscope.c 2008-06-24 09:32:34.000000000 -0700
[76dd250]3606+++ vim72/src/if_cscope.c 2009-03-01 11:11:09.312562089 -0800
3607@@ -74,7 +74,7 @@
3608 { "add", cs_add,
3609 N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 },
3610 { "find", cs_find,
3611- N_("Query for a pattern"), FIND_USAGE, 1 },
3612+ N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 },
3613 { "help", cs_help,
3614 N_("Show this message"), "help", 0 },
[5f4a45c9]3615 { "kill", cs_kill,
3616@@ -1177,10 +1177,27 @@
3617 (void)MSG_PUTS(_("cscope commands:\n"));
3618 while (cmdp->name != NULL)
3619 {
3620- (void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
3621- cmdp->name, _(cmdp->help), cmdp->usage);
3622+ char *help = _(cmdp->help);
3623+ int space_cnt = 30 - vim_strsize((char_u *)help);
3624+
3625+ /* Use %*s rather than %30s to ensure proper alignment in utf-8 */
3626+ if (space_cnt < 0)
3627+ space_cnt = 0;
3628+ (void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"),
3629+ cmdp->name,
3630+ help, space_cnt, " ",
[76dd250]3631+ cmdp->usage);
3632 if (strcmp(cmdp->name, "find") == 0)
3633- MSG_PUTS(FIND_HELP);
3634+ MSG_PUTS(_("\n"
3635+ " c: Find functions calling this function\n"
3636+ " d: Find functions called by this function\n"
3637+ " e: Find this egrep pattern\n"
3638+ " f: Find this file\n"
3639+ " g: Find this definition\n"
3640+ " i: Find files #including this file\n"
3641+ " s: Find this C symbol\n"
3642+ " t: Find assignments to\n"));
3643+
3644 cmdp++;
3645 }
3646
3647diff -Naur vim72.orig/src/if_cscope.h vim72/src/if_cscope.h
[4635005]3648--- vim72.orig/src/if_cscope.h 2007-09-02 07:51:08.000000000 -0700
[76dd250]3649+++ vim72/src/if_cscope.h 2009-03-01 11:05:23.086376868 -0800
3650@@ -42,17 +42,6 @@
3651 * f 7name Find this file
3652 * i 8name Find files #including this file
3653 */
3654-#define FIND_USAGE "find c|d|e|f|g|i|s|t name"
3655-#define FIND_HELP "\n\
3656- c: Find functions calling this function\n\
3657- d: Find functions called by this function\n\
3658- e: Find this egrep pattern\n\
3659- f: Find this file\n\
3660- g: Find this definition\n\
3661- i: Find files #including this file\n\
3662- s: Find this C symbol\n\
3663- t: Find assignments to\n"
3664-
3665
3666 typedef struct {
3667 char * name;
3668diff -Naur vim72.orig/src/if_perl.xs vim72/src/if_perl.xs
[4635005]3669--- vim72.orig/src/if_perl.xs 2008-07-17 13:55:09.000000000 -0700
[76dd250]3670+++ vim72/src/if_perl.xs 2009-03-01 11:09:57.879986590 -0800
3671@@ -136,6 +136,9 @@
3672 # define Perl_newXS_flags dll_Perl_newXS_flags
3673 #endif
3674 # define Perl_sv_free dll_Perl_sv_free
3675+# if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
3676+# define Perl_sv_free2 dll_Perl_sv_free2
3677+# endif
3678 # define Perl_sv_isa dll_Perl_sv_isa
3679 # define Perl_sv_magic dll_Perl_sv_magic
3680 # define Perl_sv_setiv dll_Perl_sv_setiv
3681@@ -163,7 +166,7 @@
3682 # define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr
3683 # define boot_DynaLoader dll_boot_DynaLoader
3684
3685-# define Perl_sys_init3 dll_Perl_sys_init3
3686+# define Perl_sys_init dll_Perl_sys_init
3687 # define Perl_sys_term dll_Perl_sys_term
3688 # define Perl_ISv_ptr dll_Perl_ISv_ptr
3689 # define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr
3690@@ -268,7 +271,8 @@
3691 static void (*boot_DynaLoader)_((pTHX_ CV*));
3692
3693 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
3694-static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
3695+static void (*Perl_sv_free2)(pTHX_ SV*);
3696+static void (*Perl_sys_init)(int* argc, char*** argv);
3697 static void (*Perl_sys_term)(void);
3698 static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
3699 static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*);
3700@@ -367,7 +371,8 @@
3701 {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr},
3702 {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
3703 #else
3704- {"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
3705+ {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
3706+ {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init},
3707 {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
3708 {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
3709 {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr},
3710@@ -455,7 +460,7 @@
3711 static char *argv[] = { "", "-e", "" };
3712
3713 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
3714- Perl_sys_init3(&argc, (char***)&argv, NULL);
3715+ Perl_sys_init(&argc, (char***)&argv);
3716 #endif
3717 perl_interp = perl_alloc();
3718 perl_construct(perl_interp);
3719diff -Naur vim72.orig/src/if_python.c vim72/src/if_python.c
[4635005]3720--- vim72.orig/src/if_python.c 2008-07-17 14:09:32.000000000 -0700
[76dd250]3721+++ vim72/src/if_python.c 2009-03-01 11:10:51.831442100 -0800
3722@@ -531,6 +531,12 @@
3723 if (PythonMod_Init())
3724 goto fail;
3725
3726+ /* Remove the element from sys.path that was added because of our
3727+ * argv[0] value in PythonMod_Init(). Previously we used an empty
3728+ * string, but dependinding on the OS we then get an empty entry or
3729+ * the current directory in sys.path. */
3730+ PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
3731+
3732 /* the first python thread is vim's, release the lock */
3733 Python_SaveThread();
[7352c10]3734
3735@@ -1145,14 +1151,23 @@
3736
3737 /* Check if we run into a recursive loop. The item must be in lookupDict
3738 * then and we can use it again. */
3739- sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv);
3740- result = PyDict_GetItemString(lookupDict, ptrBuf);
3741- if (result != NULL)
3742- Py_INCREF(result);
3743- else if (our_tv->v_type == VAR_STRING)
3744+ if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
3745+ || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
3746+ {
3747+ sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U,
3748+ our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list
3749+ : (long_u)our_tv->vval.v_dict);
3750+ result = PyDict_GetItemString(lookupDict, ptrBuf);
3751+ if (result != NULL)
3752+ {
3753+ Py_INCREF(result);
3754+ return result;
3755+ }
3756+ }
3757+
3758+ if (our_tv->v_type == VAR_STRING)
3759 {
3760 result = Py_BuildValue("s", our_tv->vval.v_string);
3761- PyDict_SetItemString(lookupDict, ptrBuf, result);
3762 }
3763 else if (our_tv->v_type == VAR_NUMBER)
3764 {
3765@@ -1161,7 +1176,6 @@
3766 /* For backwards compatibility numbers are stored as strings. */
3767 sprintf(buf, "%ld", (long)our_tv->vval.v_number);
3768 result = Py_BuildValue("s", buf);
3769- PyDict_SetItemString(lookupDict, ptrBuf, result);
3770 }
3771 # ifdef FEAT_FLOAT
3772 else if (our_tv->v_type == VAR_FLOAT)
3773@@ -1170,7 +1184,6 @@
3774
3775 sprintf(buf, "%f", our_tv->vval.v_float);
3776 result = Py_BuildValue("s", buf);
3777- PyDict_SetItemString(lookupDict, ptrBuf, result);
3778 }
3779 # endif
3780 else if (our_tv->v_type == VAR_LIST)
3781@@ -1179,10 +1192,11 @@
3782 listitem_T *curr;
3783
3784 result = PyList_New(0);
3785- PyDict_SetItemString(lookupDict, ptrBuf, result);
3786
3787 if (list != NULL)
3788 {
3789+ PyDict_SetItemString(lookupDict, ptrBuf, result);
3790+
3791 for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
3792 {
3793 newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
3794@@ -1194,7 +1208,6 @@
3795 else if (our_tv->v_type == VAR_DICT)
3796 {
3797 result = PyDict_New();
3798- PyDict_SetItemString(lookupDict, ptrBuf, result);
3799
3800 if (our_tv->vval.v_dict != NULL)
3801 {
3802@@ -1203,6 +1216,8 @@
3803 hashitem_T *hi;
3804 dictitem_T *di;
3805
3806+ PyDict_SetItemString(lookupDict, ptrBuf, result);
3807+
3808 for (hi = ht->ht_array; todo > 0; ++hi)
3809 {
3810 if (!HASHITEM_EMPTY(hi))
[76dd250]3811@@ -2345,7 +2360,8 @@
3812 {
3813 PyObject *mod;
3814 PyObject *dict;
3815- static char *(argv[2]) = {"", NULL};
3816+ /* The special value is removed from sys.path in Python_Init(). */
3817+ static char *(argv[2]) = {"/must>not&exist/foo", NULL};
3818
3819 /* Fixups... */
3820 BufferType.ob_type = &PyType_Type;
3821diff -Naur vim72.orig/src/if_xcmdsrv.c vim72/src/if_xcmdsrv.c
[4635005]3822--- vim72.orig/src/if_xcmdsrv.c 2008-07-18 06:05:03.000000000 -0700
[76dd250]3823+++ vim72/src/if_xcmdsrv.c 2009-03-01 11:08:00.312452856 -0800
3824@@ -736,7 +736,7 @@
3825 + serverReply.ga_len;
3826 e.id = w;
3827 ga_init2(&e.strings, 1, 100);
3828- memcpy(p, &e, sizeof(e));
3829+ mch_memmove(p, &e, sizeof(e));
3830 serverReply.ga_len++;
3831 }
3832 }
3833@@ -1018,7 +1018,7 @@
3834 p++;
3835 count = numItems - (p - regProp);
3836 if (count > 0)
3837- memcpy(entry, p, count);
3838+ mch_memmove(entry, p, count);
3839 XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
3840 8, PropModeReplace, regProp,
3841 (int)(numItems - (p - entry)));
3842@@ -1072,7 +1072,7 @@
3843 p++;
3844 lastHalf = numItems - (p - regProp);
3845 if (lastHalf > 0)
3846- memcpy(entry, p, lastHalf);
3847+ mch_memmove(entry, p, lastHalf);
3848 numItems = (entry - regProp) + lastHalf;
3849 p = entry;
[54f612f]3850 continue;
3851diff -Naur vim72.orig/src/macros.h vim72/src/macros.h
[4635005]3852--- vim72.orig/src/macros.h 2007-08-04 04:44:18.000000000 -0700
[54f612f]3853+++ vim72/src/macros.h 2009-03-01 11:11:54.531461377 -0800
3854@@ -127,15 +127,31 @@
3855 #ifdef FEAT_LANGMAP
3856 /*
3857 * Adjust chars in a language according to 'langmap' option.
3858- * NOTE that there is NO overhead if 'langmap' is not set; but even
3859- * when set we only have to do 2 ifs and an array lookup.
3860+ * NOTE that there is no noticeable overhead if 'langmap' is not set.
3861+ * When set the overhead for characters < 256 is small.
3862 * Don't apply 'langmap' if the character comes from the Stuff buffer.
3863 * The do-while is just to ignore a ';' after the macro.
3864 */
3865-# define LANGMAP_ADJUST(c, condition) do { \
3866- if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
3867- c = langmap_mapchar[c]; \
3868+# ifdef FEAT_MBYTE
3869+# define LANGMAP_ADJUST(c, condition) \
3870+ do { \
3871+ if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \
3872+ { \
3873+ if ((c) < 256) \
3874+ c = langmap_mapchar[c]; \
3875+ else \
3876+ c = langmap_adjust_mb(c); \
3877+ } \
3878 } while (0)
3879+# else
3880+# define LANGMAP_ADJUST(c, condition) \
3881+ do { \
3882+ if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
3883+ c = langmap_mapchar[c]; \
3884+ } while (0)
3885+# endif
3886+#else
3887+# define LANGMAP_ADJUST(c, condition) /* nop */
3888 #endif
3889
[76dd250]3890 /*
3891diff -Naur vim72.orig/src/main.c vim72/src/main.c
[4635005]3892--- vim72.orig/src/main.c 2008-07-24 01:40:56.000000000 -0700
[76dd250]3893+++ vim72/src/main.c 2009-03-01 11:08:45.635357731 -0800
3894@@ -645,11 +645,12 @@
3895
3896 #ifdef FEAT_VIMINFO
3897 /*
3898- * Read in registers, history etc, but not marks, from the viminfo file
3899+ * Read in registers, history etc, but not marks, from the viminfo file.
3900+ * This is where v:oldfiles gets filled.
3901 */
3902 if (*p_viminfo != NUL)
3903 {
3904- read_viminfo(NULL, TRUE, FALSE, FALSE);
3905+ read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
3906 TIME_MSG("reading viminfo");
3907 }
3908 #endif
3909@@ -1457,7 +1458,8 @@
3910 ++initstr;
3911 }
3912
3913- if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k')
3914+ /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */
3915+ if (TOLOWER_ASC(initstr[0]) == 'g')
3916 {
3917 main_start_gui();
3918 #ifdef FEAT_GUI
3919@@ -1508,7 +1510,8 @@
3920 early_arg_scan(parmp)
3921 mparm_T *parmp;
3922 {
3923-#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER)
3924+#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
3925+ || !defined(FEAT_NETBEANS_INTG)
3926 int argc = parmp->argc;
3927 char **argv = parmp->argv;
3928 int i;
3929@@ -1580,6 +1583,14 @@
3930 else if (STRICMP(argv[i], "--echo-wid") == 0)
3931 echo_wid_arg = TRUE;
3932 # endif
3933+# ifndef FEAT_NETBEANS_INTG
3934+ else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
3935+ {
3936+ mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
3937+ mch_exit(2);
3938+ }
3939+# endif
3940+
3941 }
3942 #endif
3943 }
3944@@ -2361,7 +2372,7 @@
3945 * Is there any other system that cannot do this?
3946 */
3947 close(0);
3948- dup(2);
3949+ ignored = dup(2);
3950 #endif
3951 }
3952
3953diff -Naur vim72.orig/src/mark.c vim72/src/mark.c
[4635005]3954--- vim72.orig/src/mark.c 2008-08-08 15:06:49.000000000 -0700
[76dd250]3955+++ vim72/src/mark.c 2009-03-01 11:07:42.767327000 -0800
3956@@ -1627,15 +1627,17 @@
3957
3958 /*
3959 * Handle marks in the viminfo file:
3960- * fp_out == NULL read marks for current buffer only
3961- * fp_out != NULL copy marks for buffers not in buffer list
3962+ * fp_out != NULL: copy marks for buffers not in buffer list
3963+ * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
3964+ * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
3965 */
3966 void
3967-copy_viminfo_marks(virp, fp_out, count, eof)
3968+copy_viminfo_marks(virp, fp_out, count, eof, flags)
3969 vir_T *virp;
3970 FILE *fp_out;
3971 int count;
3972 int eof;
3973+ int flags;
3974 {
3975 char_u *line = virp->vir_line;
3976 buf_T *buf;
3977@@ -1647,10 +1649,23 @@
3978 char_u *p;
3979 char_u *name_buf;
3980 pos_T pos;
3981+#ifdef FEAT_EVAL
3982+ list_T *list = NULL;
3983+#endif
3984
3985 if ((name_buf = alloc(LSIZE)) == NULL)
3986 return;
3987 *name_buf = NUL;
3988+
3989+#ifdef FEAT_EVAL
3990+ if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT)))
3991+ {
3992+ list = list_alloc();
3993+ if (list != NULL)
3994+ set_vim_var_list(VV_OLDFILES, list);
3995+ }
3996+#endif
3997+
3998 num_marked_files = get_viminfo_parameter('\'');
3999 while (!eof && (count < num_marked_files || fp_out == NULL))
4000 {
4001@@ -1681,6 +1696,11 @@
4002 p++;
4003 *p = NUL;
4004
4005+#ifdef FEAT_EVAL
4006+ if (list != NULL)
4007+ list_append_string(list, str, -1);
4008+#endif
4009+
4010 /*
4011 * If fp_out == NULL, load marks for current buffer.
4012 * If fp_out != NULL, copy marks for buffers not in buflist.
4013@@ -1688,7 +1708,7 @@
4014 load_marks = copy_marks_out = FALSE;
4015 if (fp_out == NULL)
4016 {
4017- if (curbuf->b_ffname != NULL)
4018+ if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL)
4019 {
4020 if (*name_buf == NUL) /* only need to do this once */
4021 home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE);
4022diff -Naur vim72.orig/src/mbyte.c vim72/src/mbyte.c
[4635005]4023--- vim72.orig/src/mbyte.c 2008-07-14 05:38:05.000000000 -0700
[76dd250]4024+++ vim72/src/mbyte.c 2009-03-01 11:08:45.635357731 -0800
4025@@ -717,7 +717,7 @@
4026 * where mblen() returns 0 for invalid character.
4027 * Therefore, following condition includes 0.
4028 */
4029- (void)mblen(NULL, 0); /* First reset the state. */
4030+ ignored = mblen(NULL, 0); /* First reset the state. */
4031 if (mblen(buf, (size_t)1) <= 0)
4032 n = 2;
4033 else
4034@@ -2540,7 +2540,6 @@
4035 return (int)(p - q);
4036 }
4037
4038-#if defined(FEAT_EVAL) || defined(PROTO)
4039 /*
4040 * Copy a character from "*fp" to "*tp" and advance the pointers.
4041 */
4042@@ -2555,7 +2554,6 @@
4043 *tp += l;
4044 *fp += l;
4045 }
4046-#endif
4047
4048 /*
4049 * Return the offset from "p" to the first byte of a character. When "p" is
4050@@ -3133,7 +3131,7 @@
4051 else
4052 s = p + 1;
4053 }
4054- for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i)
4055+ for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i)
4056 {
4057 if (s[i] == '_' || s[i] == '-')
4058 buf[i] = '-';
4059@@ -5280,7 +5278,7 @@
4060
4061 /*ARGSUSED*/
4062 static void
4063-preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
4064+preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
4065 {
4066 #ifdef XIM_DEBUG
4067 xim_log("xim_decide_input_style()\n");
4068@@ -5314,7 +5312,7 @@
4069
4070 /*ARGSUSED*/
4071 static void
4072-preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
4073+preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
4074 {
4075 XIMPreeditDrawCallbackStruct *draw_data;
4076 XIMText *text;
4077@@ -5386,7 +5384,7 @@
4078 draw_feedback = (char *)alloc(draw_data->chg_first
4079 + text->length);
4080 else
4081- draw_feedback = realloc(draw_feedback,
4082+ draw_feedback = vim_realloc(draw_feedback,
4083 draw_data->chg_first + text->length);
4084 if (draw_feedback != NULL)
4085 {
4086@@ -5455,7 +5453,7 @@
4087
4088 /*ARGSUSED*/
4089 static void
4090-preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
4091+preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
4092 {
4093 #ifdef XIM_DEBUG
4094 xim_log("preedit_caret_cbproc()\n");
4095@@ -5464,7 +5462,7 @@
4096
4097 /*ARGSUSED*/
4098 static void
4099-preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
4100+preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
4101 {
4102 #ifdef XIM_DEBUG
4103 xim_log("preedit_done_cbproc()\n");
4104diff -Naur vim72.orig/src/menu.c vim72/src/menu.c
[4635005]4105--- vim72.orig/src/menu.c 2008-06-21 12:53:43.000000000 -0700
[76dd250]4106+++ vim72/src/menu.c 2009-03-01 11:05:17.942048889 -0800
4107@@ -1120,6 +1120,7 @@
4108 parent = menu;
4109 menu = menu->children;
4110 }
4111+ vim_free(path_name);
4112
4113 /* Now we have found the matching menu, and we list the mappings */
4114 /* Highlight title */
4115diff -Naur vim72.orig/src/message.c vim72/src/message.c
[4635005]4116--- vim72.orig/src/message.c 2008-07-09 11:24:55.000000000 -0700
[54f612f]4117+++ vim72/src/message.c 2009-03-01 11:12:39.674353959 -0800
4118@@ -976,7 +976,7 @@
4119 }
4120 }
4121 else if (msg_scrolled > Rows - 2
4122- && (c == 'j' || c == K_DOWN || c == 'd'))
4123+ && (c == 'j' || c == K_DOWN || c == 'd' || c == 'f'))
4124 c = K_IGNORE;
4125 }
4126 } while ((had_got_int && c == Ctrl_C)
4127@@ -2504,7 +2504,6 @@
4128 break;
4129
4130 case 'u': /* Up half a page */
4131- case K_PAGEUP:
4132 scroll = -(Rows / 2);
4133 break;
4134
4135@@ -2513,10 +2512,12 @@
4136 break;
4137
4138 case 'b': /* one page back */
4139+ case K_PAGEUP:
4140 scroll = -(Rows - 1);
4141 break;
4142
4143 case ' ': /* one extra page */
4144+ case 'f':
4145 case K_PAGEDOWN:
4146 case K_LEFTMOUSE:
[4635005]4147 scroll = Rows - 1;
4148@@ -2552,7 +2553,6 @@
4149 {
4150 /* Jump to the choices of the dialog. */
4151 retval = TRUE;
4152- lines_left = Rows - 1;
4153 }
4154 else
4155 #endif
4156@@ -2560,6 +2560,9 @@
4157 got_int = TRUE;
4158 quit_more = TRUE;
4159 }
4160+ /* When there is some more output (wrapping line) display that
4161+ * without another prompt. */
4162+ lines_left = Rows - 1;
4163 break;
4164
4165 #ifdef FEAT_CLIPBOARD
[61a83e8]4166@@ -3309,7 +3312,10 @@
4167 {
4168 c = gui_mch_dialog(type, title, message, buttons, dfltbutton,
4169 textfield);
4170- msg_end_prompt();
4171+ /* avoid a hit-enter prompt without clearing the cmdline */
4172+ need_wait_return = FALSE;
4173+ emsg_on_display = FALSE;
4174+ cmdline_row = msg_row;
4175
4176 /* Flush output to avoid that further messages and redrawing is done
[4635005]4177 * in the wrong order. */
[7352c10]4178@@ -4556,7 +4562,13 @@
4179 remove_trailing_zeroes = TRUE;
4180 }
4181
4182- if (fmt_spec == 'f' && abs_f > 1.0e307)
4183+ if (fmt_spec == 'f' &&
4184+#ifdef VAX
4185+ abs_f > 1.0e38
4186+#else
4187+ abs_f > 1.0e307
4188+#endif
4189+ )
4190 {
4191 /* Avoid a buffer overflow */
[4635005]4192 strcpy(tmp, "inf");
[76dd250]4193@@ -4585,61 +4597,62 @@
4194 if (remove_trailing_zeroes)
4195 {
4196 int i;
4197- char *p;
4198+ char *tp;
4199
4200 /* Using %g or %G: remove superfluous zeroes. */
4201 if (fmt_spec == 'f')
4202- p = tmp + str_arg_l - 1;
4203+ tp = tmp + str_arg_l - 1;
4204 else
4205 {
4206- p = (char *)vim_strchr((char_u *)tmp,
4207+ tp = (char *)vim_strchr((char_u *)tmp,
4208 fmt_spec == 'e' ? 'e' : 'E');
4209- if (p != NULL)
4210+ if (tp != NULL)
4211 {
4212 /* Remove superfluous '+' and leading
4213 * zeroes from the exponent. */
4214- if (p[1] == '+')
4215+ if (tp[1] == '+')
4216 {
4217 /* Change "1.0e+07" to "1.0e07" */
4218- STRMOVE(p + 1, p + 2);
4219+ STRMOVE(tp + 1, tp + 2);
4220 --str_arg_l;
4221 }
4222- i = (p[1] == '-') ? 2 : 1;
4223- while (p[i] == '0')
4224+ i = (tp[1] == '-') ? 2 : 1;
4225+ while (tp[i] == '0')
4226 {
4227 /* Change "1.0e07" to "1.0e7" */
4228- STRMOVE(p + i, p + i + 1);
4229+ STRMOVE(tp + i, tp + i + 1);
4230 --str_arg_l;
4231 }
4232- --p;
4233+ --tp;
4234 }
4235 }
4236
4237- if (p != NULL && !precision_specified)
4238+ if (tp != NULL && !precision_specified)
4239 /* Remove trailing zeroes, but keep the one
4240 * just after a dot. */
4241- while (p > tmp + 2 && *p == '0' && p[-1] != '.')
4242+ while (tp > tmp + 2 && *tp == '0'
4243+ && tp[-1] != '.')
4244 {
4245- STRMOVE(p, p + 1);
4246- --p;
4247+ STRMOVE(tp, tp + 1);
4248+ --tp;
4249 --str_arg_l;
4250 }
4251 }
4252 else
4253 {
4254- char *p;
4255+ char *tp;
4256
4257 /* Be consistent: some printf("%e") use 1.0e+12
4258 * and some 1.0e+012. Remove one zero in the last
4259 * case. */
4260- p = (char *)vim_strchr((char_u *)tmp,
4261+ tp = (char *)vim_strchr((char_u *)tmp,
4262 fmt_spec == 'e' ? 'e' : 'E');
4263- if (p != NULL && (p[1] == '+' || p[1] == '-')
4264- && p[2] == '0'
4265- && vim_isdigit(p[3])
4266- && vim_isdigit(p[4]))
4267+ if (tp != NULL && (tp[1] == '+' || tp[1] == '-')
4268+ && tp[2] == '0'
4269+ && vim_isdigit(tp[3])
4270+ && vim_isdigit(tp[4]))
4271 {
4272- STRMOVE(p + 2, p + 3);
4273+ STRMOVE(tp + 2, tp + 3);
4274 --str_arg_l;
4275 }
4276 }
4277diff -Naur vim72.orig/src/misc1.c vim72/src/misc1.c
[4635005]4278--- vim72.orig/src/misc1.c 2008-07-12 12:20:53.000000000 -0700
[76dd250]4279+++ vim72/src/misc1.c 2009-03-01 11:07:42.767327000 -0800
4280@@ -3245,9 +3245,9 @@
4281
4282 /* When using ":silent" assume that <CR> was entered. */
4283 if (mouse_used != NULL)
4284- MSG_PUTS(_("Type number or click with mouse (<Enter> cancels): "));
4285+ MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): "));
4286 else
4287- MSG_PUTS(_("Choice number (<Enter> cancels): "));
4288+ MSG_PUTS(_("Type number and <Enter> (empty cancels): "));
4289
4290 /* Set the state such that text can be selected/copied/pasted and we still
4291 * get mouse events. */
4292diff -Naur vim72.orig/src/misc2.c vim72/src/misc2.c
[4635005]4293--- vim72.orig/src/misc2.c 2008-07-23 12:12:56.000000000 -0700
[76dd250]4294+++ vim72/src/misc2.c 2009-03-01 11:12:37.162193043 -0800
4295@@ -873,7 +873,7 @@
4296 /* 3. check for available memory: call mch_avail_mem() */
4297 if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
4298 {
4299- vim_free((char *)p); /* System is low... no go! */
4300+ free((char *)p); /* System is low... no go! */
4301 p = NULL;
4302 }
[4635005]4303 else
4304@@ -1010,6 +1010,9 @@
4305 # if defined(FEAT_PROFILE)
4306 do_cmdline_cmd((char_u *)"profdel *");
4307 # endif
4308+# if defined(FEAT_KEYMAP)
4309+ do_cmdline_cmd((char_u *)"set keymap=");
4310+#endif
4311
4312 # ifdef FEAT_TITLE
4313 free_titles();
4314@@ -1034,6 +1037,9 @@
4315 free_regexp_stuff();
4316 free_tag_stuff();
4317 free_cd_dir();
4318+# ifdef FEAT_SIGNS
4319+ free_signs();
4320+# endif
4321 # ifdef FEAT_EVAL
4322 set_expr_line(NULL);
4323 # endif
[76dd250]4324@@ -1257,7 +1263,6 @@
4325 return escaped_string;
4326 }
4327
4328-#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
4329 /*
4330 * Return TRUE when 'shell' has "csh" in the tail.
[4635005]4331 */
[76dd250]4332@@ -1266,9 +1271,7 @@
4333 {
4334 return (strstr((char *)gettail(p_sh), "csh") != NULL);
4335 }
4336-#endif
4337
4338-#if defined(FEAT_EVAL) || defined(PROTO)
4339 /*
4340 * Escape "string" for use as a shell argument with system().
[4635005]4341 * This uses single quotes, except when we know we need to use double qoutes
[76dd250]4342@@ -1391,7 +1394,6 @@
4343
4344 return escaped_string;
4345 }
4346-#endif
4347
4348 /*
[4635005]4349 * Like vim_strsave(), but make all characters uppercase.
[1f22c7c]4350@@ -2565,7 +2567,7 @@
4351 int key;
4352 int dlen = 0;
4353
4354- key = find_special_key(srcp, &modifiers, keycode);
4355+ key = find_special_key(srcp, &modifiers, keycode, FALSE);
4356 if (key == 0)
4357 return 0;
[4635005]4358
[1f22c7c]4359@@ -2601,10 +2603,11 @@
4360 * returns 0 if there is no match.
4361 */
4362 int
4363-find_special_key(srcp, modp, keycode)
4364+find_special_key(srcp, modp, keycode, keep_x_key)
4365 char_u **srcp;
4366 int *modp;
4367- int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
4368+ int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
4369+ int keep_x_key; /* don't translate xHome to Home key */
4370 {
4371 char_u *last_dash;
[4635005]4372 char_u *end_of_name;
[1f22c7c]4373@@ -2672,7 +2675,8 @@
4374 else
4375 {
4376 key = get_special_key_code(last_dash + 1);
4377- key = handle_x_keys(key);
4378+ if (!keep_x_key)
4379+ key = handle_x_keys(key);
4380 }
4381
[4635005]4382 /*
[5f4a45c9]4383@@ -4698,7 +4702,8 @@
4384 stackp->ffs_filearray_cur = i + 1;
4385 ff_push(search_ctx, stackp);
4386
4387- simplify_filename(file_path);
4388+ if (!path_with_url(file_path))
4389+ simplify_filename(file_path);
4390 if (mch_dirname(ff_expand_buffer, MAXPATHL)
4391 == OK)
[76dd250]4392 {
4393diff -Naur vim72.orig/src/move.c vim72/src/move.c
[4635005]4394--- vim72.orig/src/move.c 2008-07-12 09:26:47.000000000 -0700
[76dd250]4395+++ vim72/src/move.c 2009-03-01 11:08:10.621111607 -0800
4396@@ -280,18 +280,20 @@
4397
4398 if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
4399 {
4400- if (curwin->w_cursor.lnum < curwin->w_botline
4401- && ((long)curwin->w_cursor.lnum
4402+ if (curwin->w_cursor.lnum < curwin->w_botline)
4403+ {
4404+ if (((long)curwin->w_cursor.lnum
4405 >= (long)curwin->w_botline - p_so
4406 #ifdef FEAT_FOLDING
4407 || hasAnyFolding(curwin)
4408 #endif
4409 ))
4410- {
4411+ {
4412 lineoff_T loff;
4413
4414- /* Cursor is above botline, check if there are 'scrolloff'
4415- * window lines below the cursor. If not, need to scroll. */
4416+ /* Cursor is (a few lines) above botline, check if there are
4417+ * 'scrolloff' window lines below the cursor. If not, need to
4418+ * scroll. */
4419 n = curwin->w_empty_rows;
4420 loff.lnum = curwin->w_cursor.lnum;
4421 #ifdef FEAT_FOLDING
4422@@ -317,6 +319,10 @@
4423 if (n >= p_so)
4424 /* sufficient context, no need to scroll */
4425 check_botline = FALSE;
4426+ }
4427+ else
4428+ /* sufficient context, no need to scroll */
4429+ check_botline = FALSE;
4430 }
4431 if (check_botline)
4432 {
4433@@ -509,6 +515,9 @@
4434 /* Approximate the value of w_botline */
4435 wp->w_botline += lnum - wp->w_topline;
4436 wp->w_topline = lnum;
4437+#ifdef FEAT_AUTOCMD
4438+ wp->w_topline_was_set = TRUE;
4439+#endif
4440 #ifdef FEAT_DIFF
4441 wp->w_topfill = 0;
[54f612f]4442 #endif
4443diff -Naur vim72.orig/src/nbdebug.c vim72/src/nbdebug.c
[4635005]4444--- vim72.orig/src/nbdebug.c 2008-06-22 08:38:58.000000000 -0700
[54f612f]4445+++ vim72/src/nbdebug.c 2009-03-01 11:12:09.456415979 -0800
4446@@ -33,7 +33,6 @@
4447 u_int nb_dlevel = 0; /* nb_debug verbosity level */
4448
4449 void nbdb(char *, ...);
4450-void nbtrace(char *, ...);
4451
4452 static int lookup(char *);
4453 #ifdef USE_NB_ERRORHANDLER
4454@@ -100,25 +99,6 @@
4455 } /* end nbdebug_log_init */
4456
4457
4458-
4459-
4460-void
4461-nbtrace(
4462- char *fmt,
4463- ...)
4464-{
4465- va_list ap;
4466-
4467- if (nb_debug!= NULL && (nb_dlevel & (NB_TRACE | NB_TRACE_VERBOSE))) {
4468- va_start(ap, fmt);
4469- vfprintf(nb_debug, fmt, ap);
4470- va_end(ap);
4471- fflush(nb_debug);
4472- }
4473-
4474-} /* end nbtrace */
4475-
4476-
4477 void
4478 nbdbg(
4479 char *fmt,
4480@@ -136,23 +116,6 @@
4481 } /* end nbdbg */
4482
4483
4484-void
4485-nbprt(
4486- char *fmt,
4487- ...)
4488-{
4489- va_list ap;
4490-
4491- if (nb_debug != NULL && nb_dlevel & NB_PRINT) {
4492- va_start(ap, fmt);
4493- vfprintf(nb_debug, fmt, ap);
4494- va_end(ap);
4495- fflush(nb_debug);
4496- }
4497-
4498-} /* end nbprt */
4499-
4500-
4501 static int
4502 lookup(
4503 char *file)
4504diff -Naur vim72.orig/src/nbdebug.h vim72/src/nbdebug.h
[4635005]4505--- vim72.orig/src/nbdebug.h 2008-06-22 07:31:50.000000000 -0700
[54f612f]4506+++ vim72/src/nbdebug.h 2009-03-01 11:12:09.456415979 -0800
4507@@ -43,8 +43,6 @@
4508
4509
4510 void nbdbg(char *, ...);
4511-void nbprt(char *, ...);
4512-void nbtrace(char *, ...);
4513
4514 void nbdebug_wait __ARGS((u_int wait_flags, char *wait_var, u_int wait_secs));
4515 void nbdebug_log_init __ARGS((char *log_var, char *level_var));
4516@@ -70,19 +68,5 @@
4517 {
4518 }
4519
4520-void
4521-nbprt(
4522- char *fmt,
4523- ...)
4524-{
4525-}
4526-
4527-void
4528-nbtrace(
4529- char *fmt,
4530- ...)
4531-{
4532-}
4533-
4534 #endif /* NBDEBUG */
[76dd250]4535 #endif /* NBDEBUG_H */
4536diff -Naur vim72.orig/src/netbeans.c vim72/src/netbeans.c
[4635005]4537--- vim72.orig/src/netbeans.c 2008-07-13 09:19:54.000000000 -0700
[76dd250]4538+++ vim72/src/netbeans.c 2009-03-01 11:12:06.976258974 -0800
4539@@ -1043,7 +1043,7 @@
4540 nbdebug(("EVT: %s", buf));
4541 /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */
4542 if (sd >= 0)
4543- sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */
4544+ ignored = sock_write(sd, buf, (int)STRLEN(buf));
4545 }
4546 }
[54f612f]4547
4548@@ -1921,7 +1921,7 @@
4549 vim_free(path);
4550 if (bufp == NULL)
4551 {
4552- nbdebug((" File %s not found in setBufferNumber\n", args));
4553+ nbdebug((" File %s not found in setBufferNumber\n", args));
4554 EMSG2("E642: File %s not found in setBufferNumber", args);
4555 return FAIL;
[76dd250]4556 }
4557@@ -2277,9 +2277,6 @@
4558 int serNum;
4559 int localTypeNum;
4560 int typeNum;
4561-# ifdef NBDEBUG
4562- int len;
4563-# endif
4564 pos_T *pos;
4565
4566 if (buf == NULL || buf->bufp == NULL)
4567@@ -2303,13 +2300,10 @@
4568 pos = get_off_or_lnum(buf->bufp, &args);
4569
4570 cp = (char *)args;
4571-# ifdef NBDEBUG
4572- len =
4573-# endif
4574- strtol(cp, &cp, 10);
4575+ ignored = (int)strtol(cp, &cp, 10);
4576 args = (char_u *)cp;
4577 # ifdef NBDEBUG
4578- if (len != -1)
4579+ if (ignored != -1)
4580 {
4581 nbdebug((" partial line annotation -- Not Yet Implemented!\n"));
[54f612f]4582 }
4583@@ -2321,7 +2315,7 @@
4584 }
4585 if (pos)
4586 {
4587- coloncmd(":sign place %d line=%d name=%d buffer=%d",
4588+ coloncmd(":sign place %d line=%ld name=%d buffer=%d",
4589 serNum, pos->lnum, typeNum, buf->bufp->b_fnum);
4590 if (typeNum == curPCtype)
4591 coloncmd(":sign jump %d buffer=%d", serNum,
4592@@ -2425,7 +2419,7 @@
4593 GUARDED) == 0)
4594 {
4595 coloncmd(
4596- ":sign place %d line=%d name=%d buffer=%d",
4597+ ":sign place %d line=%ld name=%d buffer=%d",
4598 guardId++, lnum, GUARDED,
4599 buf->bufp->b_fnum);
[43c52a1]4600 }
4601@@ -2924,44 +2918,26 @@
4602 }
4603
4604 /*
4605- * Tell netbeans a file was closed.
4606+ * Tell netbeans that a file was deleted or wiped out.
4607 */
4608 void
4609-netbeans_file_closed(buf_T *bufp)
4610+netbeans_file_killed(buf_T *bufp)
4611 {
4612 int bufno = nb_getbufno(bufp);
4613 nbbuf_T *nbbuf = nb_get_buf(bufno);
4614 char buffer[2*MAXPATHL];
4615
4616- if (!haveConnection || bufno < 0)
4617- return;
4618-
4619- if (!netbeansCloseFile)
4620- {
4621- nbdebug(("Ignoring file_closed for %s. File was closed from IDE\n",
4622- bufp->b_ffname));
4623+ if (!haveConnection || bufno == -1)
4624 return;
4625- }
4626-
4627- nbdebug(("netbeans_file_closed:\n"));
4628- nbdebug((" Closing bufno: %d", bufno));
4629- if (curbuf != NULL && curbuf != bufp)
4630- {
4631- nbdebug((" Curbuf bufno: %d\n", nb_getbufno(curbuf)));
4632- }
4633- else if (curbuf == bufp)
4634- {
4635- nbdebug((" curbuf == bufp\n"));
4636- }
4637
4638- if (bufno <= 0)
4639- return;
4640+ nbdebug(("netbeans_file_killed:\n"));
4641+ nbdebug((" Killing bufno: %d", bufno));
4642
4643 sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno);
4644
4645 nbdebug(("EVT: %s", buffer));
4646
4647- nb_send(buffer, "netbeans_file_closed");
4648+ nb_send(buffer, "netbeans_file_killed");
4649
4650 if (nbbuf != NULL)
[76dd250]4651 nbbuf->bufp = NULL;
4652diff -Naur vim72.orig/src/normal.c vim72/src/normal.c
[4635005]4653--- vim72.orig/src/normal.c 2008-07-31 13:03:08.000000000 -0700
[76dd250]4654+++ vim72/src/normal.c 2009-03-01 11:11:54.535461935 -0800
4655@@ -183,6 +183,8 @@
4656 static void nv_cursorhold __ARGS((cmdarg_T *cap));
4657 #endif
4658
4659+static char *e_noident = N_("E349: No identifier under cursor");
4660+
4661 /*
4662 * Function to be called for a Normal or Visual mode command.
4663 * The argument is a cmdarg_T.
4664@@ -578,6 +580,9 @@
4665 static int old_mapped_len = 0;
4666 #endif
4667 int idx;
4668+#ifdef FEAT_EVAL
4669+ int set_prevcount = FALSE;
4670+#endif
4671
4672 vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
4673 ca.oap = oap;
4674@@ -613,7 +618,12 @@
4675 /* When not finishing an operator and no register name typed, reset the
4676 * count. */
4677 if (!finish_op && !oap->regname)
4678+ {
4679 ca.opcount = 0;
4680+#ifdef FEAT_EVAL
4681+ set_prevcount = TRUE;
4682+#endif
4683+ }
4684
4685 #ifdef FEAT_AUTOCMD
[54f612f]4686 /* Restore counts from before receiving K_CURSORHOLD. This means after
4687@@ -641,10 +651,7 @@
4688 * Get the command character from the user.
4689 */
4690 c = safe_vgetc();
4691-
4692-#ifdef FEAT_LANGMAP
4693 LANGMAP_ADJUST(c, TRUE);
4694-#endif
4695
4696 #ifdef FEAT_VISUAL
4697 /*
[76dd250]4698@@ -717,7 +724,15 @@
4699 * command, so that v:count can be used in an expression mapping
4700 * right after the count. */
4701 if (toplevel && stuff_empty())
4702- set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0);
4703+ {
4704+ long count = ca.count0;
4705+
4706+ /* multiply with ca.opcount the same way as below */
4707+ if (ca.opcount != 0)
4708+ count = ca.opcount * (count == 0 ? 1 : count);
4709+ set_vcount(count, count == 0 ? 1 : count, set_prevcount);
4710+ set_prevcount = FALSE; /* only set v:prevcount once */
4711+ }
4712 #endif
4713 if (ctrl_w)
[54f612f]4714 {
4715@@ -726,9 +741,7 @@
4716 }
4717 ++no_zero_mapping; /* don't map zero here */
4718 c = plain_vgetc();
4719-#ifdef FEAT_LANGMAP
4720 LANGMAP_ADJUST(c, TRUE);
4721-#endif
4722 --no_zero_mapping;
4723 if (ctrl_w)
4724 {
4725@@ -751,9 +764,7 @@
4726 ++no_mapping;
4727 ++allow_keys; /* no mapping for nchar, but keys */
4728 c = plain_vgetc(); /* get next character */
4729-#ifdef FEAT_LANGMAP
4730 LANGMAP_ADJUST(c, TRUE);
4731-#endif
4732 --no_mapping;
4733 --allow_keys;
4734 #ifdef FEAT_CMDL_INFO
[76dd250]4735@@ -804,7 +815,7 @@
4736 * Only set v:count when called from main() and not a stuffed command.
4737 */
4738 if (toplevel && stuff_empty())
4739- set_vcount(ca.count0, ca.count1);
4740+ set_vcount(ca.count0, ca.count1, set_prevcount);
4741 #endif
4742
[54f612f]4743 /*
4744@@ -941,9 +952,7 @@
4745 * "gr", "g'" and "g`".
4746 */
4747 ca.nchar = plain_vgetc();
4748-#ifdef FEAT_LANGMAP
4749 LANGMAP_ADJUST(ca.nchar, TRUE);
4750-#endif
4751 #ifdef FEAT_CMDL_INFO
4752 need_flushbuf |= add_to_showcmd(ca.nchar);
4753 #endif
4754@@ -1044,10 +1053,8 @@
4755 }
4756 #endif
4757
4758-#ifdef FEAT_LANGMAP
4759 /* adjust chars > 127, except after "tTfFr" commands */
4760 LANGMAP_ADJUST(*cp, !lang);
4761-#endif
4762 #ifdef FEAT_RIGHTLEFT
4763 /* adjust Hebrew mapped char */
4764 if (p_hkmap && lang && KeyTyped)
[76dd250]4765@@ -1132,7 +1139,8 @@
4766 out_flush();
4767 #endif
4768 #ifdef FEAT_AUTOCMD
4769- did_cursorhold = FALSE;
4770+ if (ca.cmdchar != K_IGNORE)
4771+ did_cursorhold = FALSE;
4772 #endif
4773
[54f612f]4774 State = NORMAL;
[76dd250]4775@@ -3509,7 +3517,7 @@
4776 if (find_type & FIND_STRING)
4777 EMSG(_("E348: No string under cursor"));
4778 else
4779- EMSG(_("E349: No identifier under cursor"));
4780+ EMSG(_(e_noident));
4781 return 0;
4782 }
[54f612f]4783 ptr += col;
4784@@ -4611,9 +4619,7 @@
4785 ++no_mapping;
4786 ++allow_keys; /* no mapping for nchar, but allow key codes */
4787 nchar = plain_vgetc();
4788-#ifdef FEAT_LANGMAP
4789 LANGMAP_ADJUST(nchar, TRUE);
4790-#endif
4791 --no_mapping;
4792 --allow_keys;
4793 #ifdef FEAT_CMDL_INFO
4794@@ -4969,9 +4975,7 @@
4795 ++no_mapping;
4796 ++allow_keys; /* no mapping for nchar, but allow key codes */
4797 nchar = plain_vgetc();
4798-#ifdef FEAT_LANGMAP
4799 LANGMAP_ADJUST(nchar, TRUE);
4800-#endif
4801 --no_mapping;
4802 --allow_keys;
4803 #ifdef FEAT_CMDL_INFO
[76dd250]4804@@ -5469,6 +5473,20 @@
4805 STRCPY(buf, "he! ");
4806 else
4807 {
4808+ /* An external command will probably use an argument starting
4809+ * with "-" as an option. To avoid trouble we skip the "-". */
4810+ while (*ptr == '-' && n > 0)
4811+ {
4812+ ++ptr;
4813+ --n;
4814+ }
4815+ if (n == 0)
4816+ {
4817+ EMSG(_(e_noident)); /* found dashes only */
4818+ vim_free(buf);
4819+ return;
4820+ }
4821+
4822 /* When a count is given, turn it into a range. Is this
4823 * really what we want? */
[54f612f]4824 isman = (STRCMP(kp, "man") == 0);
[76dd250]4825@@ -5511,37 +5529,59 @@
4826 /*
4827 * Now grab the chars in the identifier
4828 */
4829- if (cmdchar == '*')
4830- aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
4831- else if (cmdchar == '#')
4832- aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
4833- else if (cmdchar == 'K' && !kp_help)
4834- aux_ptr = (char_u *)" \t\\\"|!";
4835- else
4836- /* Don't escape spaces and Tabs in a tag with a backslash */
4837- aux_ptr = (char_u *)"\\|\"";
4838-
4839- p = buf + STRLEN(buf);
4840- while (n-- > 0)
4841- {
4842- /* put a backslash before \ and some others */
4843- if (vim_strchr(aux_ptr, *ptr) != NULL)
4844- *p++ = '\\';
4845-#ifdef FEAT_MBYTE
4846- /* When current byte is a part of multibyte character, copy all bytes
4847- * of that character. */
4848- if (has_mbyte)
4849+ if (cmdchar == 'K' && !kp_help)
4850+ {
4851+ /* Escape the argument properly for a shell command */
4852+ ptr = vim_strnsave(ptr, n);
4853+ p = vim_strsave_shellescape(ptr, TRUE);
4854+ vim_free(ptr);
4855+ if (p == NULL)
4856 {
4857- int i;
4858- int len = (*mb_ptr2len)(ptr) - 1;
4859-
4860- for (i = 0; i < len && n >= 1; ++i, --n)
4861- *p++ = *ptr++;
4862+ vim_free(buf);
[54f612f]4863+ return;
[76dd250]4864+ }
4865+ buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
4866+ if (buf == NULL)
4867+ {
4868+ vim_free(buf);
4869+ vim_free(p);
[54f612f]4870+ return;
[76dd250]4871 }
4872+ STRCAT(buf, p);
4873+ vim_free(p);
4874+ }
4875+ else
4876+ {
4877+ if (cmdchar == '*')
4878+ aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
4879+ else if (cmdchar == '#')
4880+ aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
4881+ else
4882+ /* Don't escape spaces and Tabs in a tag with a backslash */
4883+ aux_ptr = (char_u *)"\\|\"\n*?[";
4884+
4885+ p = buf + STRLEN(buf);
4886+ while (n-- > 0)
4887+ {
4888+ /* put a backslash before \ and some others */
4889+ if (vim_strchr(aux_ptr, *ptr) != NULL)
4890+ *p++ = '\\';
4891+#ifdef FEAT_MBYTE
4892+ /* When current byte is a part of multibyte character, copy all
4893+ * bytes of that character. */
4894+ if (has_mbyte)
4895+ {
4896+ int i;
4897+ int len = (*mb_ptr2len)(ptr) - 1;
4898+
4899+ for (i = 0; i < len && n >= 1; ++i, --n)
4900+ *p++ = *ptr++;
4901+ }
4902 #endif
4903- *p++ = *ptr++;
4904+ *p++ = *ptr++;
4905+ }
4906+ *p = NUL;
4907 }
4908- *p = NUL;
4909
4910 /*
[54f612f]4911 * Execute the command.
[9a875fd]4912@@ -6728,6 +6768,8 @@
4913 /* Visual mode "r" */
4914 if (VIsual_active)
4915 {
4916+ if (got_int)
4917+ reset_VIsual();
4918 nv_operator(cap);
4919 return;
[54f612f]4920 }
[9a875fd]4921@@ -7784,7 +7826,7 @@
4922 else
4923 i = curwin->w_leftcol;
4924 /* Go to the middle of the screen line. When 'number' is on and lines
4925- * are wrapping the middle can be more to the left.*/
4926+ * are wrapping the middle can be more to the left. */
4927 if (cap->nchar == 'm')
4928 i += (W_WIDTH(curwin) - curwin_col_off()
[76dd250]4929 + ((curwin->w_p_wrap && i > 0)
4930diff -Naur vim72.orig/src/ops.c vim72/src/ops.c
[4635005]4931--- vim72.orig/src/ops.c 2008-06-21 13:08:59.000000000 -0700
[76dd250]4932+++ vim72/src/ops.c 2009-03-01 11:10:00.468150579 -0800
4933@@ -2209,12 +2209,15 @@
4934 {
4935 for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
4936 {
4937+ int one_change;
4938+
4939 block_prep(oap, &bd, pos.lnum, FALSE);
4940 pos.col = bd.textcol;
4941- did_change = swapchars(oap->op_type, &pos, bd.textlen);
4942+ one_change = swapchars(oap->op_type, &pos, bd.textlen);
4943+ did_change |= one_change;
4944
4945 # ifdef FEAT_NETBEANS_INTG
4946- if (usingNetbeans && did_change)
4947+ if (usingNetbeans && one_change)
4948 {
4949 char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
4950
4951diff -Naur vim72.orig/src/option.c vim72/src/option.c
[4635005]4952--- vim72.orig/src/option.c 2008-07-18 06:05:33.000000000 -0700
[76dd250]4953+++ vim72/src/option.c 2009-03-01 11:11:54.539461935 -0800
4954@@ -2593,13 +2593,13 @@
4955 #ifdef FEAT_VIMINFO
4956 (char_u *)&p_viminfo, PV_NONE,
4957 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
4958- {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
4959+ {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
4960 #else
4961 # ifdef AMIGA
4962 {(char_u *)"",
4963- (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
4964+ (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
4965 # else
4966- {(char_u *)"", (char_u *)"'20,<50,s10,h"}
4967+ {(char_u *)"", (char_u *)"'100,<50,s10,h"}
4968 # endif
4969 #endif
[61a83e8]4970 #else
4971@@ -4119,11 +4119,23 @@
4972 && options[opt_idx].var == VAR_WIN)
4973 goto skip;
4974
4975- /* Disallow changing some options from modelines */
4976- if ((opt_flags & OPT_MODELINE) && (flags & P_SECURE))
4977+ /* Disallow changing some options from modelines. */
4978+ if (opt_flags & OPT_MODELINE)
4979 {
4980- errmsg = (char_u *)_("E520: Not allowed in a modeline");
4981- goto skip;
4982+ if (flags & P_SECURE)
4983+ {
4984+ errmsg = (char_u *)_("E520: Not allowed in a modeline");
4985+ goto skip;
4986+ }
4987+#ifdef FEAT_DIFF
4988+ /* In diff mode some options are overruled. This avoids that
4989+ * 'foldmethod' becomes "marker" instead of "diff" and that
4990+ * "wrap" gets set. */
4991+ if (curwin->w_p_diff
4992+ && (options[opt_idx].indir == PV_FDM
4993+ || options[opt_idx].indir == PV_WRAP))
4994+ goto skip;
4995+#endif
4996 }
4997
4998 #ifdef HAVE_SANDBOX
4999@@ -5268,6 +5280,21 @@
5000 }
5001 #endif
5002
5003+#ifdef FEAT_TITLE
5004+static void redraw_titles __ARGS((void));
5005+
5006+/*
5007+ * Redraw the window title and/or tab page text later.
5008+ */
5009+static void redraw_titles()
5010+{
5011+ need_maketitle = TRUE;
5012+# ifdef FEAT_WINDOWS
5013+ redraw_tabline = TRUE;
5014+# endif
5015+}
5016+#endif
5017+
5018 /*
5019 * Set a string option to a new value (without checking the effect).
5020 * The string is copied into allocated memory.
[9a875fd]5021@@ -5407,6 +5434,10 @@
5022 int did_chartab = FALSE;
5023 char_u **gvarp;
5024 long_u free_oldval = (options[opt_idx].flags & P_ALLOCED);
5025+#ifdef FEAT_GUI
5026+ /* set when changing an option that only requires a redraw in the GUI */
5027+ int redraw_gui_only = FALSE;
5028+#endif
5029
5030 /* Get the global option to compare with, otherwise we would have to check
[61a83e8]5031 * two values for all local options. */
5032@@ -5668,7 +5699,7 @@
5033 {
5034 # ifdef FEAT_TITLE
5035 /* May show a "+" in the title now. */
5036- need_maketitle = TRUE;
5037+ redraw_titles();
5038 # endif
5039 /* Add 'fileencoding' to the swap file. */
5040 ml_setflags(curbuf);
5041@@ -5687,7 +5718,7 @@
5042 {
5043 errmsg = mb_init();
5044 # ifdef FEAT_TITLE
5045- need_maketitle = TRUE;
5046+ redraw_titles();
5047 # endif
5048 }
5049 }
5050@@ -5796,7 +5827,7 @@
5051 else
5052 curbuf->b_p_tx = FALSE;
5053 #ifdef FEAT_TITLE
5054- need_maketitle = TRUE;
5055+ redraw_titles();
5056 #endif
5057 /* update flag in swap file */
5058 ml_setflags(curbuf);
[9a875fd]5059@@ -6055,6 +6086,7 @@
5060 errmsg = (char_u *)N_("E596: Invalid font(s)");
5061 }
5062 }
5063+ redraw_gui_only = TRUE;
5064 }
5065 # ifdef FEAT_XFONTSET
[61a83e8]5066 else if (varp == &p_guifontset)
[9a875fd]5067@@ -6063,6 +6095,7 @@
5068 errmsg = (char_u *)N_("E597: can't select fontset");
5069 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
5070 errmsg = (char_u *)N_("E598: Invalid fontset");
5071+ redraw_gui_only = TRUE;
5072 }
5073 # endif
[61a83e8]5074 # ifdef FEAT_MBYTE
[9a875fd]5075@@ -6072,6 +6105,7 @@
5076 errmsg = (char_u *)N_("E533: can't select wide font");
5077 else if (gui_get_wide_font() == FAIL)
5078 errmsg = (char_u *)N_("E534: Invalid wide font");
5079+ redraw_gui_only = TRUE;
5080 }
5081 # endif
[61a83e8]5082 #endif
[9a875fd]5083@@ -6133,13 +6167,24 @@
5084 #ifdef FEAT_GUI
5085 /* 'guioptions' */
5086 else if (varp == &p_go)
5087+ {
5088 gui_init_which_components(oldval);
5089+ redraw_gui_only = TRUE;
5090+ }
5091 #endif
5092
5093 #if defined(FEAT_GUI_TABLINE)
5094 /* 'guitablabel' */
5095 else if (varp == &p_gtl)
5096+ {
5097 redraw_tabline = TRUE;
5098+ redraw_gui_only = TRUE;
5099+ }
5100+ /* 'guitabtooltip' */
5101+ else if (varp == &p_gtt)
5102+ {
5103+ redraw_gui_only = TRUE;
5104+ }
5105 #endif
5106
[61a83e8]5107 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
[9a875fd]5108@@ -6717,7 +6762,11 @@
5109
5110 if (curwin->w_curswant != MAXCOL)
5111 curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */
5112- check_redraw(options[opt_idx].flags);
5113+#ifdef FEAT_GUI
5114+ /* check redraw when it's not a GUI option or the GUI is active. */
5115+ if (!redraw_gui_only || gui.in_use)
5116+#endif
5117+ check_redraw(options[opt_idx].flags);
5118
5119 return errmsg;
[61a83e8]5120 }
5121@@ -7105,22 +7154,28 @@
5122 curbuf->b_did_warn = FALSE;
5123
5124 #ifdef FEAT_TITLE
5125- need_maketitle = TRUE;
5126+ redraw_titles();
5127 #endif
5128 }
5129
5130 #ifdef FEAT_TITLE
5131 /* when 'modifiable' is changed, redraw the window title */
5132 else if ((int *)varp == &curbuf->b_p_ma)
5133- need_maketitle = TRUE;
5134+ {
5135+ redraw_titles();
5136+ }
5137 /* when 'endofline' is changed, redraw the window title */
5138 else if ((int *)varp == &curbuf->b_p_eol)
5139- need_maketitle = TRUE;
5140-#ifdef FEAT_MBYTE
5141- /* when 'bomb' is changed, redraw the window title */
5142+ {
5143+ redraw_titles();
5144+ }
5145+# ifdef FEAT_MBYTE
5146+ /* when 'bomb' is changed, redraw the window title and tab page text */
5147 else if ((int *)varp == &curbuf->b_p_bomb)
5148- need_maketitle = TRUE;
5149-#endif
5150+ {
5151+ redraw_titles();
5152+ }
5153+# endif
5154 #endif
5155
5156 /* when 'bin' is set also set some other options */
5157@@ -7128,7 +7183,7 @@
5158 {
5159 set_options_bin(old_value, curbuf->b_p_bin, opt_flags);
5160 #ifdef FEAT_TITLE
5161- need_maketitle = TRUE;
5162+ redraw_titles();
5163 #endif
5164 }
5165
5166@@ -7279,7 +7334,7 @@
5167 if (!value)
5168 save_file_ff(curbuf); /* Buffer is unchanged */
5169 #ifdef FEAT_TITLE
5170- need_maketitle = TRUE;
5171+ redraw_titles();
5172 #endif
5173 #ifdef FEAT_AUTOCMD
5174 modified_was_set = value;
5175@@ -7714,7 +7769,7 @@
5176 newFoldLevel();
5177 }
5178
5179- /* 'foldminlevel' */
5180+ /* 'foldminlines' */
5181 else if (pp == &curwin->w_p_fml)
5182 {
5183 foldUpdateAll(curwin);
[76dd250]5184@@ -7974,6 +8029,11 @@
5185 else /* curwin->w_p_scr > curwin->w_height */
5186 curwin->w_p_scr = curwin->w_height;
5187 }
5188+ if (p_hi < 0)
5189+ {
5190+ errmsg = e_positive;
5191+ p_hi = 0;
5192+ }
5193 if (p_report < 0)
5194 {
[61a83e8]5195 errmsg = e_positive;
[76dd250]5196@@ -8227,13 +8287,13 @@
5197 {
5198 if (number == 0 && string != NULL)
5199 {
5200- int index;
5201+ int idx;
5202
5203 /* Either we are given a string or we are setting option
5204 * to zero. */
5205- for (index = 0; string[index] == '0'; ++index)
5206+ for (idx = 0; string[idx] == '0'; ++idx)
5207 ;
5208- if (string[index] != NUL || index == 0)
5209+ if (string[idx] != NUL || idx == 0)
5210 {
5211 /* There's another character after zeros or the string
[61a83e8]5212 * is empty. In both cases, we are trying to set a
[1f22c7c]5213@@ -8323,7 +8383,7 @@
5214 {
5215 --arg; /* put arg at the '<' */
5216 modifiers = 0;
5217- key = find_special_key(&arg, &modifiers, TRUE);
5218+ key = find_special_key(&arg, &modifiers, TRUE, TRUE);
5219 if (modifiers) /* can't handle modifiers here */
5220 key = 0;
[54f612f]5221 }
5222@@ -10093,25 +10153,110 @@
5223
5224 #ifdef FEAT_LANGMAP
5225 /*
5226- * Any character has an equivalent character. This is used for keyboards that
5227- * have a special language mode that sends characters above 128 (although
5228- * other characters can be translated too).
5229+ * Any character has an equivalent 'langmap' character. This is used for
5230+ * keyboards that have a special language mode that sends characters above
5231+ * 128 (although other characters can be translated too). The "to" field is a
5232+ * Vim command character. This avoids having to switch the keyboard back to
5233+ * ASCII mode when leaving Insert mode.
5234+ *
5235+ * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
5236+ * commands.
5237+ * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
5238+ * langmap_entry_T. This does the same as langmap_mapchar[] for characters >=
5239+ * 256.
5240+ */
5241+# ifdef FEAT_MBYTE
5242+/*
5243+ * With multi-byte support use growarray for 'langmap' chars >= 256
5244 */
5245+typedef struct
5246+{
5247+ int from;
5248+ int to;
5249+} langmap_entry_T;
5250+
5251+static garray_T langmap_mapga;
5252+static void langmap_set_entry __ARGS((int from, int to));
5253
5254 /*
5255- * char_u langmap_mapchar[256];
5256- * Normally maps each of the 128 upper chars to an <128 ascii char; used to
5257- * "translate" native lang chars in normal mode or some cases of
5258- * insert mode without having to tediously switch lang mode back&forth.
5259+ * Search for an entry in "langmap_mapga" for "from". If found set the "to"
5260+ * field. If not found insert a new entry at the appropriate location.
5261 */
5262+ static void
5263+langmap_set_entry(from, to)
5264+ int from;
5265+ int to;
5266+{
5267+ langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
5268+ int a = 0;
5269+ int b = langmap_mapga.ga_len;
5270+
5271+ /* Do a binary search for an existing entry. */
5272+ while (a != b)
5273+ {
5274+ int i = (a + b) / 2;
5275+ int d = entries[i].from - from;
5276+
5277+ if (d == 0)
5278+ {
5279+ entries[i].to = to;
5280+ return;
5281+ }
5282+ if (d < 0)
5283+ a = i + 1;
5284+ else
5285+ b = i;
5286+ }
5287+
5288+ if (ga_grow(&langmap_mapga, 1) != OK)
5289+ return; /* out of memory */
5290+
5291+ /* insert new entry at position "a" */
5292+ entries = (langmap_entry_T *)(langmap_mapga.ga_data) + a;
5293+ mch_memmove(entries + 1, entries,
5294+ (langmap_mapga.ga_len - a) * sizeof(langmap_entry_T));
5295+ ++langmap_mapga.ga_len;
5296+ entries[0].from = from;
5297+ entries[0].to = to;
5298+}
5299+
5300+/*
5301+ * Apply 'langmap' to multi-byte character "c" and return the result.
5302+ */
5303+ int
5304+langmap_adjust_mb(c)
5305+ int c;
5306+{
5307+ langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
5308+ int a = 0;
5309+ int b = langmap_mapga.ga_len;
5310+
5311+ while (a != b)
5312+ {
5313+ int i = (a + b) / 2;
5314+ int d = entries[i].from - c;
5315+
5316+ if (d == 0)
5317+ return entries[i].to; /* found matching entry */
5318+ if (d < 0)
5319+ a = i + 1;
5320+ else
5321+ b = i;
5322+ }
5323+ return c; /* no entry found, return "c" unmodified */
5324+}
5325+# endif
5326
5327 static void
5328 langmap_init()
5329 {
5330 int i;
5331
5332- for (i = 0; i < 256; i++) /* we init with a-one-to one map */
5333- langmap_mapchar[i] = i;
5334+ for (i = 0; i < 256; i++)
5335+ langmap_mapchar[i] = i; /* we init with a one-to-one map */
5336+# ifdef FEAT_MBYTE
5337+ ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8);
5338+# endif
5339 }
5340
5341 /*
5342@@ -10125,7 +10270,10 @@
5343 char_u *p2;
5344 int from, to;
5345
5346- langmap_init(); /* back to one-to-one map first */
5347+#ifdef FEAT_MBYTE
5348+ ga_clear(&langmap_mapga); /* clear the previous map first */
5349+#endif
5350+ langmap_init(); /* back to one-to-one map */
5351
5352 for (p = p_langmap; p[0] != NUL; )
5353 {
5354@@ -10175,7 +10323,13 @@
5355 transchar(from));
5356 return;
5357 }
5358- langmap_mapchar[from & 255] = to;
5359+
5360+#ifdef FEAT_MBYTE
5361+ if (from >= 256)
5362+ langmap_set_entry(from, to);
5363+ else
5364+#endif
5365+ langmap_mapchar[from & 255] = to;
5366
5367 /* Advance to next pair */
[76dd250]5368 mb_ptr_adv(p);
5369diff -Naur vim72.orig/src/os_unix.c vim72/src/os_unix.c
[4635005]5370--- vim72.orig/src/os_unix.c 2008-08-06 04:01:40.000000000 -0700
[76dd250]5371+++ vim72/src/os_unix.c 2009-03-01 11:12:24.577385947 -0800
5372@@ -315,12 +315,15 @@
5373 {-1, "Unknown!", FALSE}
5374 };
5375
5376+/*
5377+ * Write s[len] to the screen.
5378+ */
5379 void
5380 mch_write(s, len)
5381 char_u *s;
5382 int len;
5383 {
5384- write(1, (char *)s, len);
5385+ ignored = (int)write(1, (char *)s, len);
5386 if (p_wd) /* Unix is too fast, slow down a bit more */
5387 RealWaitForChar(read_cmd_fd, p_wd, NULL);
5388 }
5389@@ -2905,7 +2908,7 @@
5390 * Ignore any errors.
5391 */
5392 #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
5393- signal_stack = malloc(SIGSTKSZ);
5394+ signal_stack = (char *)alloc(SIGSTKSZ);
5395 init_signal_stack();
5396 #endif
5397 }
5398@@ -2936,7 +2939,8 @@
5399 }
5400 # endif
5401 # endif
5402-# ifdef FEAT_X11
5403+ /* Don't close the display for GTK 1, it is done in exit(). */
5404+# if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2))
5405 if (x11_display != NULL
5406 # ifdef FEAT_XCLIPBOARD
5407 && x11_display != xterm_dpy
5408@@ -3926,9 +3930,9 @@
5409 */
5410 if (fd >= 0)
5411 {
5412- dup(fd); /* To replace stdin (file descriptor 0) */
5413- dup(fd); /* To replace stdout (file descriptor 1) */
5414- dup(fd); /* To replace stderr (file descriptor 2) */
5415+ ignored = dup(fd); /* To replace stdin (fd 0) */
5416+ ignored = dup(fd); /* To replace stdout (fd 1) */
5417+ ignored = dup(fd); /* To replace stderr (fd 2) */
5418
5419 /* Don't need this now that we've duplicated it */
[9a875fd]5420 close(fd);
5421@@ -3946,7 +3950,17 @@
5422 * children can be kill()ed. Don't do this when using pipes,
5423 * because stdin is not a tty, we would lose /dev/tty. */
5424 if (p_stmp)
5425+ {
5426 (void)setsid();
5427+# if defined(SIGHUP)
5428+ /* When doing "!xterm&" and 'shell' is bash: the shell
5429+ * will exit and send SIGHUP to all processes in its
5430+ * group, killing the just started process. Ignore SIGHUP
5431+ * to avoid that. (suggested by Simon Schubert)
5432+ */
5433+ signal(SIGHUP, SIG_IGN);
5434+# endif
5435+ }
5436 # endif
5437 # ifdef FEAT_GUI
5438 if (pty_slave_fd >= 0)
[76dd250]5439@@ -3996,13 +4010,13 @@
5440
5441 /* set up stdin/stdout/stderr for the child */
5442 close(0);
5443- dup(pty_slave_fd);
5444+ ignored = dup(pty_slave_fd);
5445 close(1);
5446- dup(pty_slave_fd);
5447+ ignored = dup(pty_slave_fd);
5448 if (gui.in_use)
5449 {
5450 close(2);
5451- dup(pty_slave_fd);
5452+ ignored = dup(pty_slave_fd);
5453 }
5454
[9a875fd]5455 close(pty_slave_fd); /* has been dupped, close it now */
[76dd250]5456@@ -4013,13 +4027,13 @@
5457 /* set up stdin for the child */
5458 close(fd_toshell[1]);
5459 close(0);
5460- dup(fd_toshell[0]);
5461+ ignored = dup(fd_toshell[0]);
5462 close(fd_toshell[0]);
5463
5464 /* set up stdout for the child */
5465 close(fd_fromshell[0]);
5466 close(1);
5467- dup(fd_fromshell[1]);
5468+ ignored = dup(fd_fromshell[1]);
5469 close(fd_fromshell[1]);
5470
[9a875fd]5471 # ifdef FEAT_GUI
[76dd250]5472@@ -4027,7 +4041,7 @@
5473 {
5474 /* set up stderr for the child */
5475 close(2);
5476- dup(1);
5477+ ignored = dup(1);
5478 }
5479 # endif
[54f612f]5480 }
5481@@ -4078,6 +4092,9 @@
5482 int fromshell_fd;
5483 garray_T ga;
5484 int noread_cnt;
5485+# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
5486+ struct timeval start_tv;
5487+# endif
5488
5489 # ifdef FEAT_GUI
5490 if (pty_master_fd >= 0)
[76dd250]5491@@ -4158,7 +4175,8 @@
5492 && (lnum !=
5493 curbuf->b_ml.ml_line_count
5494 || curbuf->b_p_eol)))
5495- write(toshell_fd, "\n", (size_t)1);
5496+ ignored = write(toshell_fd, "\n",
5497+ (size_t)1);
5498 ++lnum;
5499 if (lnum > curbuf->b_op_end.lnum)
[54f612f]5500 {
5501@@ -4186,7 +4204,9 @@
5502 ga_init2(&ga, 1, BUFLEN);
5503
5504 noread_cnt = 0;
5505-
5506+# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
5507+ gettimeofday(&start_tv, NULL);
5508+# endif
5509 for (;;)
5510 {
5511 /*
5512@@ -4199,25 +4219,34 @@
5513 * that a typed password is echoed for ssh or gpg command.
5514 * Don't get characters when the child has already
5515 * finished (wait_pid == 0).
5516- * Don't get extra characters when we already have one.
5517 * Don't read characters unless we didn't get output for a
5518- * while, avoids that ":r !ls" eats typeahead.
5519+ * while (noread_cnt > 4), avoids that ":r !ls" eats
5520+ * typeahead.
5521 */
5522 len = 0;
5523 if (!(options & SHELL_EXPAND)
5524 && ((options &
5525 (SHELL_READ|SHELL_WRITE|SHELL_COOKED))
5526 != (SHELL_READ|SHELL_WRITE|SHELL_COOKED)
5527-#ifdef FEAT_GUI
5528+# ifdef FEAT_GUI
5529 || gui.in_use
5530-#endif
5531+# endif
5532 )
5533 && wait_pid == 0
5534- && (ta_len > 0
5535- || (noread_cnt > 4
5536- && (len = ui_inchar(ta_buf,
5537- BUFLEN, 10L, 0)) > 0)))
5538+ && (ta_len > 0 || noread_cnt > 4))
5539 {
5540+ if (ta_len == 0)
5541+ {
5542+ /* Get extra characters when we don't have any.
5543+ * Reset the counter and timer. */
5544+ noread_cnt = 0;
5545+# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
5546+ gettimeofday(&start_tv, NULL);
5547+# endif
5548+ len = ui_inchar(ta_buf, BUFLEN, 10L, 0);
5549+ }
5550+ if (ta_len > 0 || len > 0)
5551+ {
5552 /*
5553 * For pipes:
5554 * Check for CTRL-C: send interrupt signal to child.
5555@@ -4319,9 +4348,9 @@
5556 {
5557 ta_len -= len;
5558 mch_memmove(ta_buf, ta_buf + len, ta_len);
5559- noread_cnt = 0;
5560 }
5561 }
5562+ }
5563 }
5564
5565 if (got_int)
5566@@ -4429,6 +4458,25 @@
5567 out_flush();
5568 if (got_int)
5569 break;
5570+
5571+# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
5572+ {
5573+ struct timeval now_tv;
5574+ long msec;
5575+
5576+ /* Avoid that we keep looping here without
5577+ * checking for a CTRL-C for a long time. Don't
5578+ * break out too often to avoid losing typeahead. */
5579+ gettimeofday(&now_tv, NULL);
5580+ msec = (now_tv.tv_sec - start_tv.tv_sec) * 1000L
5581+ + (now_tv.tv_usec - start_tv.tv_usec) / 1000L;
5582+ if (msec > 2000)
5583+ {
5584+ noread_cnt = 5;
5585+ break;
5586+ }
5587+ }
5588+# endif
5589 }
5590
5591 /* If we already detected the child has finished break the
[76dd250]5592@@ -6814,7 +6862,8 @@
5593 if (xsmp_icefd != -1)
5594 {
5595 SmcCloseConnection(xsmp.smcconn, 0, NULL);
5596- vim_free(xsmp.clientid);
5597+ if (xsmp.clientid != NULL)
5598+ free(xsmp.clientid);
5599 xsmp.clientid = NULL;
5600 xsmp_icefd = -1;
5601 }
5602diff -Naur vim72.orig/src/proto/eval.pro vim72/src/proto/eval.pro
[4635005]5603--- vim72.orig/src/proto/eval.pro 2008-08-09 07:31:25.000000000 -0700
[76dd250]5604+++ vim72/src/proto/eval.pro 2009-03-01 11:08:25.566070959 -0800
5605@@ -17,7 +17,7 @@
5606 int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip));
5607 char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip));
5608 int skip_expr __ARGS((char_u **pp));
5609-char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));
5610+char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert));
5611 char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox));
5612 int eval_to_number __ARGS((char_u *expr));
5613 list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
5614@@ -46,7 +46,9 @@
5615 void list_unref __ARGS((list_T *l));
5616 void list_free __ARGS((list_T *l, int recurse));
5617 dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
5618+char_u *list_find_str __ARGS((list_T *l, long idx));
5619 int list_append_dict __ARGS((list_T *list, dict_T *dict));
5620+int list_append_string __ARGS((list_T *l, char_u *str, int len));
5621 int garbage_collect __ARGS((void));
5622 dict_T *dict_alloc __ARGS((void));
5623 int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
5624@@ -58,8 +60,10 @@
5625 void set_vim_var_nr __ARGS((int idx, long val));
5626 long get_vim_var_nr __ARGS((int idx));
5627 char_u *get_vim_var_str __ARGS((int idx));
5628-void set_vcount __ARGS((long count, long count1));
5629+list_T *get_vim_var_list __ARGS((int idx));
5630+void set_vcount __ARGS((long count, long count1, int set_prevcount));
5631 void set_vim_var_string __ARGS((int idx, char_u *val, int len));
5632+void set_vim_var_list __ARGS((int idx, list_T *val));
5633 void set_reg_var __ARGS((int c));
5634 char_u *v_exception __ARGS((char_u *oldval));
5635 char_u *v_throwpoint __ARGS((char_u *oldval));
5636@@ -94,6 +98,7 @@
5637 void write_viminfo_varlist __ARGS((FILE *fp));
5638 int store_session_globals __ARGS((FILE *fd));
5639 void last_set_msg __ARGS((scid_T scriptID));
5640+void ex_oldfiles __ARGS((exarg_T *eap));
5641 int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
5642 char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
5643 /* vim: set ft=c : */
5644diff -Naur vim72.orig/src/proto/ex_cmds.pro vim72/src/proto/ex_cmds.pro
[4635005]5645--- vim72.orig/src/proto/ex_cmds.pro 2008-08-09 07:31:25.000000000 -0700
[76dd250]5646+++ vim72/src/proto/ex_cmds.pro 2009-03-01 11:12:37.166193602 -0800
5647@@ -11,7 +11,7 @@
5648 char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
5649 void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
5650 int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
5651-int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
5652+int read_viminfo __ARGS((char_u *file, int flags));
5653 void write_viminfo __ARGS((char_u *file, int forceit));
5654 int viminfo_readline __ARGS((vir_T *virp));
[4635005]5655 char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
5656@@ -40,6 +40,7 @@
5657 int read_viminfo_sub_string __ARGS((vir_T *virp, int force));
5658 void write_viminfo_sub_string __ARGS((FILE *fp));
5659 void free_old_sub __ARGS((void));
5660+void free_signs __ARGS((void));
5661 int prepare_tagpreview __ARGS((int undo_sync));
5662 void ex_help __ARGS((exarg_T *eap));
[76dd250]5663 char_u *check_help_lang __ARGS((char_u *arg));
5664diff -Naur vim72.orig/src/proto/ex_getln.pro vim72/src/proto/ex_getln.pro
[4635005]5665--- vim72.orig/src/proto/ex_getln.pro 2008-08-09 07:31:28.000000000 -0700
[76dd250]5666+++ vim72/src/proto/ex_getln.pro 2009-03-01 11:08:34.934671881 -0800
5667@@ -31,7 +31,7 @@
5668 void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
5669 int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
5670 int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
5671-char_u *globpath __ARGS((char_u *path, char_u *file));
5672+char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
5673 void init_history __ARGS((void));
5674 int get_histtype __ARGS((char_u *name));
5675 void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
5676diff -Naur vim72.orig/src/proto/mark.pro vim72/src/proto/mark.pro
[4635005]5677--- vim72.orig/src/proto/mark.pro 2008-08-09 07:31:36.000000000 -0700
[76dd250]5678+++ vim72/src/proto/mark.pro 2009-03-01 11:07:42.771327000 -0800
5679@@ -26,5 +26,5 @@
5680 void write_viminfo_filemarks __ARGS((FILE *fp));
5681 int removable __ARGS((char_u *name));
5682 int write_viminfo_marks __ARGS((FILE *fp_out));
5683-void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof));
5684+void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags));
[1f22c7c]5685 /* vim: set ft=c : */
5686diff -Naur vim72.orig/src/proto/misc2.pro vim72/src/proto/misc2.pro
[4635005]5687--- vim72.orig/src/proto/misc2.pro 2008-08-09 07:31:40.000000000 -0700
[1f22c7c]5688+++ vim72/src/proto/misc2.pro 2009-03-01 11:10:23.869653024 -0800
5689@@ -59,7 +59,7 @@
5690 int handle_x_keys __ARGS((int key));
5691 char_u *get_special_key_name __ARGS((int c, int modifiers));
5692 int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode));
5693-int find_special_key __ARGS((char_u **srcp, int *modp, int keycode));
5694+int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key));
5695 int extract_modifiers __ARGS((int key, int *modp));
5696 int find_special_key_in_table __ARGS((int c));
[43c52a1]5697 int get_special_key_code __ARGS((char_u *name));
5698diff -Naur vim72.orig/src/proto/netbeans.pro vim72/src/proto/netbeans.pro
[4635005]5699--- vim72.orig/src/proto/netbeans.pro 2008-08-09 07:31:56.000000000 -0700
[43c52a1]5700+++ vim72/src/proto/netbeans.pro 2009-03-01 11:10:39.070626065 -0800
5701@@ -11,7 +11,7 @@
5702 void netbeans_frame_moved __ARGS((int new_x, int new_y));
5703 void netbeans_file_activated __ARGS((buf_T *bufp));
5704 void netbeans_file_opened __ARGS((buf_T *bufp));
5705-void netbeans_file_closed __ARGS((buf_T *bufp));
5706+void netbeans_file_killed __ARGS((buf_T *bufp));
5707 void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen));
5708 void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
[54f612f]5709 void netbeans_unmodified __ARGS((buf_T *bufp));
5710diff -Naur vim72.orig/src/proto/option.pro vim72/src/proto/option.pro
[4635005]5711--- vim72.orig/src/proto/option.pro 2008-08-09 07:31:43.000000000 -0700
[54f612f]5712+++ vim72/src/proto/option.pro 2009-03-01 11:11:54.539461935 -0800
5713@@ -44,6 +44,7 @@
5714 void set_context_in_set_cmd __ARGS((expand_T *xp, char_u *arg, int opt_flags));
5715 int ExpandSettings __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
5716 int ExpandOldSetting __ARGS((int *num_file, char_u ***file));
5717+int langmap_adjust_mb __ARGS((int c));
5718 int has_format_option __ARGS((int x));
5719 int shortmess __ARGS((int x));
[76dd250]5720 void vimrc_found __ARGS((char_u *fname, char_u *envname));
5721diff -Naur vim72.orig/src/pty.c vim72/src/pty.c
[4635005]5722--- vim72.orig/src/pty.c 2008-06-21 11:52:58.000000000 -0700
[76dd250]5723+++ vim72/src/pty.c 2009-03-01 11:05:15.481889369 -0800
5724@@ -270,9 +270,10 @@
5725 }
5726 #endif
5727
5728-#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux)
5729+#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X)
5730
5731-/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */
5732+/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
5733+ * Same for Mac OS X Leopard. */
5734 #define PTY_DONE
5735 int
[54f612f]5736 OpenPTY(ttyn)
5737diff -Naur vim72.orig/src/quickfix.c vim72/src/quickfix.c
[4635005]5738--- vim72.orig/src/quickfix.c 2008-07-18 05:53:02.000000000 -0700
[54f612f]5739+++ vim72/src/quickfix.c 2009-03-01 11:12:22.073226148 -0800
5740@@ -1419,6 +1419,7 @@
5741 int opened_window = FALSE;
5742 win_T *win;
5743 win_T *altwin;
5744+ int flags;
5745 #endif
5746 int print_message = TRUE;
5747 int len;
5748@@ -1530,7 +1531,6 @@
5749 if (qf_ptr->qf_type == 1 && (!curwin->w_buffer->b_help || cmdmod.tab != 0))
5750 {
5751 win_T *wp;
5752- int n;
5753
5754 if (cmdmod.tab != 0)
5755 wp = NULL;
5756@@ -1546,13 +1546,16 @@
5757 * Split off help window; put it at far top if no position
5758 * specified, the current window is vertically split and narrow.
5759 */
5760- n = WSP_HELP;
5761+ flags = WSP_HELP;
5762 # ifdef FEAT_VERTSPLIT
5763 if (cmdmod.split == 0 && curwin->w_width != Columns
5764 && curwin->w_width < 80)
5765- n |= WSP_TOP;
5766+ flags |= WSP_TOP;
5767 # endif
5768- if (win_split(0, n) == FAIL)
5769+ if (qi != &ql_info)
5770+ flags |= WSP_NEWLOC; /* don't copy the location list */
5771+
5772+ if (win_split(0, flags) == FAIL)
5773 goto theend;
5774 opened_window = TRUE; /* close it when fail */
5775
5776@@ -1562,7 +1565,6 @@
5777 if (qi != &ql_info) /* not a quickfix list */
5778 {
5779 /* The new window should use the supplied location list */
5780- qf_free_all(curwin);
5781 curwin->w_llist = qi;
5782 qi->qf_refcount++;
5783 }
5784@@ -1609,10 +1611,11 @@
5785 {
5786 goto_tabpage_win(tp, wp);
5787 usable_win = 1;
5788- break;
5789+ goto win_found;
5790 }
5791 }
5792 }
5793+win_found:
5794
5795 /*
5796 * If there is only one window and it is the quickfix window, create a
5797@@ -1622,7 +1625,10 @@
5798 {
5799 ll_ref = curwin->w_llist_ref;
5800
5801- if (win_split(0, WSP_ABOVE) == FAIL)
5802+ flags = WSP_ABOVE;
5803+ if (ll_ref != NULL)
5804+ flags |= WSP_NEWLOC;
5805+ if (win_split(0, flags) == FAIL)
5806 goto failed; /* not enough room for window */
5807 opened_window = TRUE; /* close it when fail */
5808 p_swb = empty_option; /* don't split again */
5809@@ -1634,7 +1640,6 @@
5810 {
5811 /* The new window should use the location list from the
5812 * location list window */
5813- qf_free_all(curwin);
5814 curwin->w_llist = ll_ref;
5815 ll_ref->qf_refcount++;
5816 }
5817@@ -2307,15 +2312,12 @@
5818 if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
5819 /* Create the new window at the very bottom. */
5820 win_goto(lastwin);
5821- if (win_split(height, WSP_BELOW) == FAIL)
5822+ if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
5823 return; /* not enough room for window */
5824 #ifdef FEAT_SCROLLBIND
5825 curwin->w_p_scb = FALSE;
5826 #endif
5827
5828- /* Remove the location list for the quickfix window */
5829- qf_free_all(curwin);
5830-
5831 if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
5832 {
5833 /*
5834diff -Naur vim72.orig/src/regexp.c vim72/src/regexp.c
[4635005]5835--- vim72.orig/src/regexp.c 2008-08-07 12:58:50.000000000 -0700
[54f612f]5836+++ vim72/src/regexp.c 2009-03-01 11:12:04.508100572 -0800
5837@@ -4532,7 +4532,7 @@
5838 cleanup_subexpr();
5839 if (!REG_MULTI) /* Single-line regexp */
5840 {
5841- if (reg_endp[no] == NULL)
5842+ if (reg_startp[no] == NULL || reg_endp[no] == NULL)
5843 {
5844 /* Backref was not set: Match an empty string. */
5845 len = 0;
5846@@ -4548,7 +4548,7 @@
5847 }
5848 else /* Multi-line regexp */
5849 {
5850- if (reg_endpos[no].lnum < 0)
5851+ if (reg_startpos[no].lnum < 0 || reg_endpos[no].lnum < 0)
5852 {
5853 /* Backref was not set: Match an empty string. */
5854 len = 0;
5855@@ -7279,13 +7279,11 @@
5856 }
5857 else
5858 {
5859- if (submatch_match->endp[no] == NULL)
5860+ s = submatch_match->startp[no];
5861+ if (s == NULL || submatch_match->endp[no] == NULL)
5862 retval = NULL;
5863 else
5864- {
5865- s = submatch_match->startp[no];
5866 retval = vim_strnsave(s, (int)(submatch_match->endp[no] - s));
5867- }
5868 }
5869
[76dd250]5870 return retval;
5871diff -Naur vim72.orig/src/screen.c vim72/src/screen.c
[4635005]5872--- vim72.orig/src/screen.c 2008-07-24 07:45:07.000000000 -0700
[76dd250]5873+++ vim72/src/screen.c 2009-03-01 11:12:27.069546305 -0800
5874@@ -2439,9 +2439,17 @@
5875
5876 #ifdef FEAT_SYN_HL
5877 /* Show 'cursorcolumn' in the fold line. */
5878- if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp))
5879- ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr(
5880- ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC));
5881+ if (wp->w_p_cuc)
5882+ {
5883+ txtcol += wp->w_virtcol;
5884+ if (wp->w_p_wrap)
5885+ txtcol -= wp->w_skipcol;
5886+ else
5887+ txtcol -= wp->w_leftcol;
5888+ if (txtcol >= 0 && txtcol < W_WIDTH(wp))
5889+ ScreenAttrs[off + txtcol] = hl_combine_attr(
5890+ ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
5891+ }
5892 #endif
5893
[54f612f]5894 SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
5895@@ -2588,6 +2596,7 @@
5896 int noinvcur = FALSE; /* don't invert the cursor */
5897 #ifdef FEAT_VISUAL
5898 pos_T *top, *bot;
5899+ int lnum_in_visual_area = FALSE;
5900 #endif
5901 pos_T pos;
5902 long v;
5903@@ -2784,9 +2793,10 @@
5904 top = &VIsual;
5905 bot = &curwin->w_cursor;
5906 }
5907+ lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum);
5908 if (VIsual_mode == Ctrl_V) /* block mode */
5909 {
5910- if (lnum >= top->lnum && lnum <= bot->lnum)
5911+ if (lnum_in_visual_area)
5912 {
5913 fromcol = wp->w_old_cursor_fcol;
5914 tocol = wp->w_old_cursor_lcol;
5915@@ -3412,6 +3422,7 @@
5916 && (*mb_ptr2cells)(ptr) > 1)
5917 #endif
5918 || ((int)vcol_prev == fromcol_prev
5919+ && vcol_prev < vcol /* not at margin */
5920 && vcol < tocol))
5921 area_attr = attr; /* start highlighting */
5922 else if (area_attr != 0
5923@@ -4549,7 +4560,8 @@
5924 * highlight the cursor position itself. */
5925 if (wp->w_p_cuc && vcol == (long)wp->w_virtcol
5926 && lnum != wp->w_cursor.lnum
5927- && draw_state == WL_LINE)
5928+ && draw_state == WL_LINE
5929+ && !lnum_in_visual_area)
5930 {
5931 vcol_save_attr = char_attr;
5932 char_attr = hl_combine_attr(char_attr, hl_attr(HLF_CUC));
5933@@ -6350,7 +6362,7 @@
5934 && c == 0x8e
5935 && ScreenLines2[off] != ptr[1])
5936 || (enc_utf8
5937- && (ScreenLinesUC[off] != (u8char_T)u8c
5938+ && (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0)
5939 || screen_comp_differs(off, u8cc)))
5940 #endif
5941 || ScreenAttrs[off] != attr
5942@@ -7356,7 +7368,11 @@
5943 #endif
5944 static int entered = FALSE; /* avoid recursiveness */
5945 static int done_outofmem_msg = FALSE; /* did outofmem message */
5946+#ifdef FEAT_AUTOCMD
5947+ int retry_count = 0;
5948
5949+retry:
5950+#endif
5951 /*
5952 * Allocation of the screen buffers is done only when the size changes and
5953 * when Rows and Columns have been set and we have started doing full
5954@@ -7440,10 +7456,13 @@
5955 {
5956 outofmem = TRUE;
5957 #ifdef FEAT_WINDOWS
5958- break;
5959+ goto give_up;
5960 #endif
5961 }
5962 }
5963+#ifdef FEAT_WINDOWS
5964+give_up:
5965+#endif
5966
5967 #ifdef FEAT_MBYTE
5968 for (i = 0; i < p_mco; ++i)
5969@@ -7628,8 +7647,17 @@
5970 --RedrawingDisabled;
5971
5972 #ifdef FEAT_AUTOCMD
5973- if (starting == 0)
5974+ /*
5975+ * Do not apply autocommands more than 3 times to avoid an endless loop
5976+ * in case applying autocommands always changes Rows or Columns.
5977+ */
5978+ if (starting == 0 && ++retry_count <= 3)
5979+ {
5980 apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
5981+ /* In rare cases, autocommands may have altered Rows or Columns,
5982+ * jump back to check if we need to allocate the screen again. */
5983+ goto retry;
5984+ }
5985 #endif
5986 }
[76dd250]5987
5988diff -Naur vim72.orig/src/spell.c vim72/src/spell.c
[4635005]5989--- vim72.orig/src/spell.c 2008-07-12 12:20:55.000000000 -0700
[76dd250]5990+++ vim72/src/spell.c 2009-03-01 11:11:46.782964939 -0800
5991@@ -77,7 +77,7 @@
5992
5993 /*
5994 * Do the opposite: based on a maximum end score and a known sound score,
5995- * compute the the maximum word score that can be used.
5996+ * compute the maximum word score that can be used.
5997 */
5998 #define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3)
5999
6000@@ -469,6 +469,7 @@
6001 garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */
6002 regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm
6003 * (NULL when no compounding) */
6004+ char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */
6005 char_u *sl_compstartflags; /* flags for first compound word */
6006 char_u *sl_compallflags; /* all flags for compound words */
6007 char_u sl_nobreak; /* When TRUE: no spaces between words */
6008@@ -625,7 +626,7 @@
6009 /* TRUE if a word appears in the list of banned words. */
6010 #define WAS_BANNED(su, word) (!HASHITEM_EMPTY(hash_find(&su->su_banned, word)))
6011
6012-/* Number of suggestions kept when cleaning up. we need to keep more than
6013+/* Number of suggestions kept when cleaning up. We need to keep more than
6014 * what is displayed, because when rescore_suggestions() is called the score
6015 * may change and wrong suggestions may be removed later. */
6016 #define SUG_CLEAN_COUNT(su) ((su)->su_maxcount < 130 ? 150 : (su)->su_maxcount + 20)
6017@@ -839,7 +840,10 @@
6018 static void slang_clear __ARGS((slang_T *lp));
6019 static void slang_clear_sug __ARGS((slang_T *lp));
6020 static void find_word __ARGS((matchinf_T *mip, int mode));
6021+static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap));
6022 static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags));
6023+static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag));
6024+static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags));
6025 static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req));
6026 static void find_prefix __ARGS((matchinf_T *mip, int mode));
6027 static int fold_more __ARGS((matchinf_T *mip));
6028@@ -1519,6 +1523,11 @@
6029 ((unsigned)flags >> 24)))
6030 continue;
6031
6032+ /* If there is a match with a CHECKCOMPOUNDPATTERN rule
6033+ * discard the compound word. */
6034+ if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
6035+ continue;
6036+
6037 if (mode == FIND_COMPOUND)
6038 {
6039 int capflags;
6040@@ -1577,6 +1586,11 @@
6041 if (!can_compound(slang, fword, mip->mi_compflags))
6042 continue;
6043 }
6044+ else if (slang->sl_comprules != NULL
6045+ && !match_compoundrule(slang, mip->mi_compflags))
6046+ /* The compound flags collected so far do not match any
6047+ * COMPOUNDRULE, discard the compounded word. */
6048+ continue;
6049 }
6050
6051 /* Check NEEDCOMPOUND: can't use word without compounding. */
6052@@ -1727,6 +1741,39 @@
6053 }
6054
6055 /*
6056+ * Return TRUE if there is a match between the word ptr[wlen] and
6057+ * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
6058+ * word.
6059+ * A match means that the first part of CHECKCOMPOUNDPATTERN matches at the
6060+ * end of ptr[wlen] and the second part matches after it.
6061+ */
6062+ static int
6063+match_checkcompoundpattern(ptr, wlen, gap)
6064+ char_u *ptr;
6065+ int wlen;
6066+ garray_T *gap; /* &sl_comppat */
6067+{
6068+ int i;
6069+ char_u *p;
6070+ int len;
6071+
6072+ for (i = 0; i + 1 < gap->ga_len; i += 2)
6073+ {
6074+ p = ((char_u **)gap->ga_data)[i + 1];
6075+ if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
6076+ {
6077+ /* Second part matches at start of following compound word, now
6078+ * check if first part matches at end of previous word. */
6079+ p = ((char_u **)gap->ga_data)[i];
6080+ len = (int)STRLEN(p);
6081+ if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
6082+ return TRUE;
6083+ }
6084+ }
6085+ return FALSE;
6086+}
6087+
6088+/*
6089 * Return TRUE if "flags" is a valid sequence of compound flags and "word"
6090 * does not have too many syllables.
6091 */
6092@@ -1773,6 +1820,98 @@
6093 }
6094
6095 /*
6096+ * Return TRUE when the sequence of flags in "compflags" plus "flag" can
6097+ * possibly form a valid compounded word. This also checks the COMPOUNDRULE
6098+ * lines if they don't contain wildcards.
6099+ */
6100+ static int
6101+can_be_compound(sp, slang, compflags, flag)
6102+ trystate_T *sp;
6103+ slang_T *slang;
6104+ char_u *compflags;
6105+ int flag;
6106+{
6107+ /* If the flag doesn't appear in sl_compstartflags or sl_compallflags
6108+ * then it can't possibly compound. */
6109+ if (!byte_in_str(sp->ts_complen == sp->ts_compsplit
6110+ ? slang->sl_compstartflags : slang->sl_compallflags, flag))
6111+ return FALSE;
6112+
6113+ /* If there are no wildcards, we can check if the flags collected so far
6114+ * possibly can form a match with COMPOUNDRULE patterns. This only
6115+ * makes sense when we have two or more words. */
6116+ if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit)
6117+ {
6118+ int v;
6119+
6120+ compflags[sp->ts_complen] = flag;
6121+ compflags[sp->ts_complen + 1] = NUL;
6122+ v = match_compoundrule(slang, compflags + sp->ts_compsplit);
6123+ compflags[sp->ts_complen] = NUL;
6124+ return v;
6125+ }
6126+
6127+ return TRUE;
6128+}
6129+
6130+
6131+/*
6132+ * Return TRUE if the compound flags in compflags[] match the start of any
6133+ * compound rule. This is used to stop trying a compound if the flags
6134+ * collected so far can't possibly match any compound rule.
6135+ * Caller must check that slang->sl_comprules is not NULL.
6136+ */
6137+ static int
6138+match_compoundrule(slang, compflags)
6139+ slang_T *slang;
6140+ char_u *compflags;
6141+{
6142+ char_u *p;
6143+ int i;
6144+ int c;
6145+
6146+ /* loop over all the COMPOUNDRULE entries */
6147+ for (p = slang->sl_comprules; *p != NUL; ++p)
6148+ {
6149+ /* loop over the flags in the compound word we have made, match
6150+ * them against the current rule entry */
6151+ for (i = 0; ; ++i)
6152+ {
6153+ c = compflags[i];
6154+ if (c == NUL)
6155+ /* found a rule that matches for the flags we have so far */
6156+ return TRUE;
6157+ if (*p == '/' || *p == NUL)
6158+ break; /* end of rule, it's too short */
6159+ if (*p == '[')
6160+ {
6161+ int match = FALSE;
6162+
6163+ /* compare against all the flags in [] */
6164+ ++p;
6165+ while (*p != ']' && *p != NUL)
6166+ if (*p++ == c)
6167+ match = TRUE;
6168+ if (!match)
6169+ break; /* none matches */
6170+ }
6171+ else if (*p != c)
6172+ break; /* flag of word doesn't match flag in pattern */
6173+ ++p;
6174+ }
6175+
6176+ /* Skip to the next "/", where the next pattern starts. */
6177+ p = vim_strchr(p, '/');
6178+ if (p == NULL)
6179+ break;
6180+ }
6181+
6182+ /* Checked all the rules and none of them match the flags, so there
6183+ * can't possibly be a compound starting with these flags. */
6184+ return FALSE;
6185+}
6186+
6187+/*
6188 * Return non-zero if the prefix indicated by "arridx" matches with the prefix
6189 * ID in "flags" for the word "word".
[61a83e8]6190 * The WF_RAREPFX flag is included in the return value for a rare prefix.
6191@@ -2237,7 +2376,7 @@
6192
6193 /* If we are back at the starting line and there is no match then
6194 * give up. */
6195- if (lnum == wp->w_cursor.lnum && !found_one)
6196+ if (lnum == wp->w_cursor.lnum && (!found_one || wrapped))
6197 break;
6198
[76dd250]6199 /* Skip the characters at the start of the next line that were
6200@@ -2513,9 +2652,11 @@
6201 lp->sl_midword = NULL;
6202
6203 vim_free(lp->sl_compprog);
6204+ vim_free(lp->sl_comprules);
6205 vim_free(lp->sl_compstartflags);
6206 vim_free(lp->sl_compallflags);
6207 lp->sl_compprog = NULL;
6208+ lp->sl_comprules = NULL;
6209 lp->sl_compstartflags = NULL;
6210 lp->sl_compallflags = NULL;
6211
6212@@ -3460,6 +3601,7 @@
6213 char_u *pp;
6214 char_u *cp;
6215 char_u *ap;
6216+ char_u *crp;
6217 int cnt;
6218 garray_T *gap;
6219
6220@@ -3545,6 +3687,12 @@
6221 slang->sl_compallflags = ap;
6222 *ap = NUL;
6223
6224+ /* And a list of all patterns in their original form, for checking whether
6225+ * compounding may work in match_compoundrule(). This is freed when we
6226+ * encounter a wildcard, the check doesn't work then. */
6227+ crp = alloc(todo + 1);
6228+ slang->sl_comprules = crp;
6229+
6230 pp = pat;
6231 *pp++ = '^';
6232 *pp++ = '\\';
6233@@ -3587,6 +3735,20 @@
6234 atstart = 0;
6235 }
6236 }
6237+
6238+ /* Copy flag to "sl_comprules", unless we run into a wildcard. */
6239+ if (crp != NULL)
6240+ {
6241+ if (c == '+' || c == '*')
6242+ {
6243+ vim_free(slang->sl_comprules);
6244+ slang->sl_comprules = NULL;
6245+ crp = NULL;
6246+ }
6247+ else
6248+ *crp++ = c;
6249+ }
6250+
6251 if (c == '/') /* slash separates two items */
6252 {
6253 *pp++ = '\\';
6254@@ -3611,6 +3773,9 @@
6255 *pp++ = '$';
6256 *pp = NUL;
6257
6258+ if (crp != NULL)
6259+ *crp = NUL;
6260+
6261 slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
6262 vim_free(pat);
[61a83e8]6263 if (slang->sl_compprog == NULL)
6264@@ -4791,13 +4956,16 @@
6265 * Structure that is used to store the items in the word tree. This avoids
6266 * the need to keep track of each allocated thing, everything is freed all at
6267 * once after ":mkspell" is done.
6268+ * Note: "sb_next" must be just before "sb_data" to make sure the alignment of
6269+ * "sb_data" is correct for systems where pointers must be aligned on
6270+ * pointer-size boundaries and sizeof(pointer) > sizeof(int) (e.g., Sparc).
6271 */
6272 #define SBLOCKSIZE 16000 /* size of sb_data */
6273 typedef struct sblock_S sblock_T;
6274 struct sblock_S
6275 {
6276- sblock_T *sb_next; /* next block in list */
6277 int sb_used; /* nr of bytes already in use */
6278+ sblock_T *sb_next; /* next block in list */
6279 char_u sb_data[1]; /* data, actually longer */
6280 };
6281
[76dd250]6282@@ -4915,6 +5083,7 @@
6283 } spellinfo_T;
6284
6285 static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
6286+static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount));
6287 static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry));
6288 static int spell_info_item __ARGS((char_u *s));
[61a83e8]6289 static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
[76dd250]6290@@ -4950,7 +5119,7 @@
6291 static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd));
6292 static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname));
6293 static void clear_node __ARGS((wordnode_T *node));
6294-static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree));
6295+static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree));
6296 static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname));
6297 static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang));
[61a83e8]6298 static int sug_maketable __ARGS((spellinfo_T *spin));
[76dd250]6299@@ -5223,8 +5392,7 @@
6300 /* Handle non-empty lines. */
6301 if (itemcnt > 0)
6302 {
6303- if (STRCMP(items[0], "SET") == 0 && itemcnt == 2
6304- && aff->af_enc == NULL)
6305+ if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
6306 {
6307 #ifdef FEAT_MBYTE
[61a83e8]6308 /* Setup for conversion from "ENC" to 'encoding'. */
[76dd250]6309@@ -5239,7 +5407,7 @@
6310 smsg((char_u *)_("Conversion in %s not supported"), fname);
6311 #endif
6312 }
6313- else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2
6314+ else if (is_aff_rule(items, itemcnt, "FLAG", 2)
6315 && aff->af_flagtype == AFT_CHAR)
6316 {
[61a83e8]6317 if (STRCMP(items[1], "long") == 0)
[76dd250]6318@@ -5284,69 +5452,71 @@
6319 spin->si_info = p;
6320 }
6321 }
6322- else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
6323+ else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
6324 && midword == NULL)
6325 {
6326 midword = getroom_save(spin, items[1]);
6327 }
6328- else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
6329+ else if (is_aff_rule(items, itemcnt, "TRY", 2))
6330 {
6331 /* ignored, we look in the tree for what chars may appear */
6332 }
6333 /* TODO: remove "RAR" later */
6334- else if ((STRCMP(items[0], "RAR") == 0
6335- || STRCMP(items[0], "RARE") == 0) && itemcnt == 2
6336- && aff->af_rare == 0)
6337+ else if ((is_aff_rule(items, itemcnt, "RAR", 2)
6338+ || is_aff_rule(items, itemcnt, "RARE", 2))
6339+ && aff->af_rare == 0)
6340 {
6341 aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
6342 fname, lnum);
6343 }
6344 /* TODO: remove "KEP" later */
6345- else if ((STRCMP(items[0], "KEP") == 0
6346- || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2
6347+ else if ((is_aff_rule(items, itemcnt, "KEP", 2)
6348+ || is_aff_rule(items, itemcnt, "KEEPCASE", 2))
6349 && aff->af_keepcase == 0)
6350 {
6351 aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
6352 fname, lnum);
6353 }
6354- else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2
6355- && aff->af_bad == 0)
6356+ else if ((is_aff_rule(items, itemcnt, "BAD", 2)
6357+ || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2))
6358+ && aff->af_bad == 0)
6359 {
6360 aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
6361 fname, lnum);
6362 }
6363- else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2
6364+ else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2)
6365 && aff->af_needaffix == 0)
6366 {
6367 aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
6368 fname, lnum);
6369 }
6370- else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2
6371+ else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2)
6372 && aff->af_circumfix == 0)
6373 {
6374 aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
6375 fname, lnum);
6376 }
6377- else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2
6378+ else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2)
6379 && aff->af_nosuggest == 0)
6380 {
6381 aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
6382 fname, lnum);
6383 }
6384- else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2
6385+ else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2)
6386+ || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2))
6387 && aff->af_needcomp == 0)
6388 {
6389 aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
6390 fname, lnum);
6391 }
6392- else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2
6393+ else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2)
6394 && aff->af_comproot == 0)
6395 {
6396 aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
6397 fname, lnum);
6398 }
6399- else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0
6400- && itemcnt == 2 && aff->af_compforbid == 0)
6401+ else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2)
6402+ && aff->af_compforbid == 0)
6403 {
6404 aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
[61a83e8]6405 fname, lnum);
[76dd250]6406@@ -5354,8 +5524,8 @@
6407 smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
6408 fname, lnum);
6409 }
6410- else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0
6411- && itemcnt == 2 && aff->af_comppermit == 0)
6412+ else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
6413+ && aff->af_comppermit == 0)
6414 {
6415 aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
[61a83e8]6416 fname, lnum);
[76dd250]6417@@ -5363,7 +5533,7 @@
6418 smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
6419 fname, lnum);
6420 }
6421- else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
6422+ else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
6423 && compflags == NULL)
6424 {
[61a83e8]6425 /* Turn flag "c" into COMPOUNDRULE compatible string "c+",
[76dd250]6426@@ -5376,7 +5546,15 @@
6427 compflags = p;
6428 }
6429 }
6430- else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
6431+ else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
6432+ {
6433+ /* We don't use the count, but do check that it's a number and
6434+ * not COMPOUNDRULE mistyped. */
6435+ if (atoi((char *)items[1]) == 0)
6436+ smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"),
6437+ fname, lnum, items[1]);
6438+ }
6439+ else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
6440 {
6441 /* Concatenate this string to previously defined ones, using a
[61a83e8]6442 * slash to separate them. */
[76dd250]6443@@ -5395,7 +5573,7 @@
6444 compflags = p;
6445 }
6446 }
6447- else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
6448+ else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
6449 && compmax == 0)
6450 {
[61a83e8]6451 compmax = atoi((char *)items[1]);
[76dd250]6452@@ -5403,7 +5581,7 @@
6453 smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
6454 fname, lnum, items[1]);
6455 }
6456- else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
6457+ else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
6458 && compminlen == 0)
6459 {
[61a83e8]6460 compminlen = atoi((char *)items[1]);
[76dd250]6461@@ -5411,7 +5589,7 @@
6462 smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
6463 fname, lnum, items[1]);
6464 }
6465- else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
6466+ else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
6467 && compsylmax == 0)
6468 {
[61a83e8]6469 compsylmax = atoi((char *)items[1]);
[76dd250]6470@@ -5419,32 +5597,29 @@
6471 smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
6472 fname, lnum, items[1]);
6473 }
6474- else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
6475+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
6476 {
6477 compoptions |= COMP_CHECKDUP;
6478 }
6479- else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
6480+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
6481 {
6482 compoptions |= COMP_CHECKREP;
6483 }
6484- else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
6485+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
6486 {
6487 compoptions |= COMP_CHECKCASE;
6488 }
6489- else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
6490- && itemcnt == 1)
6491+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
6492 {
6493 compoptions |= COMP_CHECKTRIPLE;
6494 }
6495- else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
6496- && itemcnt == 2)
6497+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
6498 {
6499 if (atoi((char *)items[1]) == 0)
6500 smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
6501 fname, lnum, items[1]);
6502 }
6503- else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
6504- && itemcnt == 3)
6505+ else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
6506 {
6507 garray_T *gap = &spin->si_comppat;
[61a83e8]6508 int i;
[76dd250]6509@@ -5463,24 +5638,24 @@
6510 = getroom_save(spin, items[2]);
6511 }
6512 }
6513- else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
6514+ else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
6515 && syllable == NULL)
6516 {
6517 syllable = getroom_save(spin, items[1]);
6518 }
6519- else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
6520+ else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
6521 {
6522 spin->si_nobreak = TRUE;
6523 }
6524- else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
6525+ else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
6526 {
6527 spin->si_nosplitsugs = TRUE;
6528 }
6529- else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
6530+ else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
6531 {
6532 spin->si_nosugfile = TRUE;
6533 }
6534- else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
6535+ else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
6536 {
6537 aff->af_pfxpostpone = TRUE;
[61a83e8]6538 }
[76dd250]6539@@ -5771,24 +5946,20 @@
6540 }
6541 }
6542 }
6543- else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
6544- && fol == NULL)
6545+ else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
6546 {
6547 fol = vim_strsave(items[1]);
6548 }
6549- else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
6550- && low == NULL)
6551+ else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
6552 {
6553 low = vim_strsave(items[1]);
6554 }
6555- else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
6556- && upp == NULL)
6557+ else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
6558 {
6559 upp = vim_strsave(items[1]);
6560 }
6561- else if ((STRCMP(items[0], "REP") == 0
6562- || STRCMP(items[0], "REPSAL") == 0)
6563- && itemcnt == 2)
6564+ else if (is_aff_rule(items, itemcnt, "REP", 2)
6565+ || is_aff_rule(items, itemcnt, "REPSAL", 2))
6566 {
6567 /* Ignore REP/REPSAL count */;
[61a83e8]6568 if (!isdigit(*items[1]))
[76dd250]6569@@ -5819,7 +5990,7 @@
6570 : &spin->si_rep, items[1], items[2]);
6571 }
6572 }
6573- else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
6574+ else if (is_aff_rule(items, itemcnt, "MAP", 2))
6575 {
6576 /* MAP item or count */
[61a83e8]6577 if (!found_map)
[76dd250]6578@@ -5856,9 +6027,8 @@
6579 ga_append(&spin->si_map, '/');
6580 }
6581 }
6582- /* Accept "SAL from to" and "SAL from to # comment". */
6583- else if (STRCMP(items[0], "SAL") == 0
6584- && (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#')))
6585+ /* Accept "SAL from to" and "SAL from to #comment". */
6586+ else if (is_aff_rule(items, itemcnt, "SAL", 3))
6587 {
6588 if (do_sal)
[61a83e8]6589 {
[76dd250]6590@@ -5877,12 +6047,12 @@
6591 : items[2]);
6592 }
6593 }
6594- else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
6595+ else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
6596 && sofofrom == NULL)
6597 {
6598 sofofrom = getroom_save(spin, items[1]);
6599 }
6600- else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
6601+ else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
6602 && sofoto == NULL)
6603 {
[61a83e8]6604 sofoto = getroom_save(spin, items[1]);
[76dd250]6605@@ -5980,7 +6150,7 @@
6606 else if (spin->si_newprefID == 0 || spin->si_newprefID == 127)
6607 MSG(_("Too many compound flags"));
6608 else
6609- MSG(_("Too many posponed prefixes and/or compound flags"));
6610+ MSG(_("Too many postponed prefixes and/or compound flags"));
6611 }
6612
[61a83e8]6613 if (syllable != NULL)
[76dd250]6614@@ -6017,6 +6187,22 @@
6615 }
6616
6617 /*
6618+ * Return TRUE when items[0] equals "rulename", there are "mincount" items or
6619+ * a comment is following after item "mincount".
6620+ */
6621+ static int
6622+is_aff_rule(items, itemcnt, rulename, mincount)
6623+ char_u **items;
6624+ int itemcnt;
6625+ char *rulename;
6626+ int mincount;
6627+{
6628+ return (STRCMP(items[0], rulename) == 0
6629+ && (itemcnt == mincount
6630+ || (itemcnt > mincount && items[mincount][0] == '#')));
6631+}
6632+
6633+/*
6634 * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
6635 * ae_flags to ae_comppermit and ae_compforbid.
[61a83e8]6636 */
[76dd250]6637@@ -7926,6 +8112,8 @@
6638 char_u *p;
6639 int rr;
6640 int retval = OK;
6641+ size_t fwv = 1; /* collect return value of fwrite() to avoid
6642+ warnings from picky compiler */
6643
6644 fd = mch_fopen((char *)fname, "w");
[61a83e8]6645 if (fd == NULL)
[76dd250]6646@@ -7936,11 +8124,11 @@
6647
6648 /* <HEADER>: <fileID> <versionnr> */
6649 /* <fileID> */
6650- if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)
6651- {
6652- EMSG(_(e_write));
6653- retval = FAIL;
6654- }
6655+ fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
6656+ if (fwv != (size_t)1)
6657+ /* Catch first write error, don't try writing more. */
6658+ goto theend;
6659+
6660 putc(VIMSPELLVERSION, fd); /* <versionnr> */
6661
[61a83e8]6662 /*
[76dd250]6663@@ -7955,7 +8143,7 @@
6664
6665 i = (int)STRLEN(spin->si_info);
6666 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
6667- fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
6668+ fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
6669 }
6670
[61a83e8]6671 /* SN_REGION: <regionname> ...
[76dd250]6672@@ -7966,7 +8154,7 @@
6673 putc(SNF_REQUIRED, fd); /* <sectionflags> */
6674 l = spin->si_region_count * 2;
6675 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
6676- fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
6677+ fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
6678 /* <regionname> ... */
6679 regionmask = (1 << spin->si_region_count) - 1;
[61a83e8]6680 }
[76dd250]6681@@ -8016,7 +8204,7 @@
6682 }
6683
6684 put_bytes(fd, (long_u)l, 2); /* <folcharslen> */
6685- fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
6686+ fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
6687 }
6688
[61a83e8]6689 /* SN_MIDWORD: <midword> */
[76dd250]6690@@ -8027,7 +8215,8 @@
6691
6692 i = (int)STRLEN(spin->si_midword);
6693 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
6694- fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */
6695+ fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd);
6696+ /* <midword> */
6697 }
6698
[61a83e8]6699 /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
[76dd250]6700@@ -8113,7 +8302,8 @@
6701 p = rr == 1 ? ftp->ft_from : ftp->ft_to;
6702 l = (int)STRLEN(p);
6703 putc(l, fd);
6704- fwrite(p, l, (size_t)1, fd);
6705+ if (l > 0)
6706+ fwv &= fwrite(p, l, (size_t)1, fd);
6707 }
6708 }
[61a83e8]6709
[76dd250]6710@@ -8131,11 +8321,11 @@
6711 /* <sectionlen> */
6712
6713 put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
6714- fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
6715+ fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
6716
6717 l = (int)STRLEN(spin->si_sofoto);
6718 put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
6719- fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
6720+ fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
6721 }
6722
[61a83e8]6723 /* SN_WORDS: <word> ...
[76dd250]6724@@ -8160,7 +8350,7 @@
6725 l = (int)STRLEN(hi->hi_key) + 1;
6726 len += l;
6727 if (round == 2) /* <word> */
6728- fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
6729+ fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
6730 --todo;
6731 }
[61a83e8]6732 if (round == 1)
[76dd250]6733@@ -8176,7 +8366,7 @@
6734 putc(0, fd); /* <sectionflags> */
6735 l = spin->si_map.ga_len;
6736 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
6737- fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
6738+ fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
6739 /* <mapstr> */
6740 }
[61a83e8]6741
[76dd250]6742@@ -8232,10 +8422,11 @@
6743 {
6744 p = ((char_u **)(spin->si_comppat.ga_data))[i];
6745 putc((int)STRLEN(p), fd); /* <comppatlen> */
6746- fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */
6747+ fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);
6748+ /* <comppattext> */
6749 }
6750 /* <compflags> */
6751- fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
6752+ fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
6753 (size_t)1, fd);
6754 }
[61a83e8]6755
[76dd250]6756@@ -8259,7 +8450,8 @@
6757
6758 l = (int)STRLEN(spin->si_syllable);
6759 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
6760- fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */
6761+ fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd);
6762+ /* <syllable> */
6763 }
6764
[61a83e8]6765 /* end of <SECTIONS> */
[76dd250]6766@@ -8295,13 +8487,18 @@
6767 (void)put_node(fd, tree, 0, regionmask, round == 3);
6768 }
6769
6770- /* Write another byte to check for errors. */
6771+ /* Write another byte to check for errors (file system full). */
6772 if (putc(0, fd) == EOF)
6773 retval = FAIL;
6774-
6775+theend:
6776 if (fclose(fd) == EOF)
6777 retval = FAIL;
6778
6779+ if (fwv != (size_t)1)
6780+ retval = FAIL;
6781+ if (retval == FAIL)
6782+ EMSG(_(e_write));
6783+
6784 return retval;
6785 }
[61a83e8]6786
[76dd250]6787@@ -9890,6 +10087,7 @@
6788 char_u *p;
6789 int len;
6790 int totlen;
6791+ size_t x = 1; /* collect return value of fwrite() */
6792
6793 if (fd != NULL)
[61a83e8]6794 put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
[76dd250]6795@@ -9906,7 +10104,7 @@
6796 if (fd != NULL)
6797 {
6798 fputc(len, fd);
6799- fwrite(p, (size_t)len, (size_t)1, fd);
6800+ x &= fwrite(p, (size_t)len, (size_t)1, fd);
6801 }
6802 totlen += len;
[61a83e8]6803 }
[76dd250]6804@@ -11480,15 +11678,24 @@
6805 vim_strncpy(preword + sp->ts_prewordlen,
6806 tword + sp->ts_splitoff,
6807 sp->ts_twordlen - sp->ts_splitoff);
6808- p = preword;
6809- while (*skiptowhite(p) != NUL)
6810- p = skipwhite(skiptowhite(p));
6811- if (fword_ends && !can_compound(slang, p,
6812- compflags + sp->ts_compsplit))
6813- /* Compound is not allowed. But it may still be
6814- * possible if we add another (short) word. */
6815+
6816+ /* Verify CHECKCOMPOUNDPATTERN rules. */
6817+ if (match_checkcompoundpattern(preword, sp->ts_prewordlen,
6818+ &slang->sl_comppat))
6819 compound_ok = FALSE;
6820
6821+ if (compound_ok)
6822+ {
6823+ p = preword;
6824+ while (*skiptowhite(p) != NUL)
6825+ p = skipwhite(skiptowhite(p));
6826+ if (fword_ends && !can_compound(slang, p,
6827+ compflags + sp->ts_compsplit))
6828+ /* Compound is not allowed. But it may still be
6829+ * possible if we add another (short) word. */
6830+ compound_ok = FALSE;
6831+ }
6832+
6833 /* Get pointer to last char of previous word. */
6834 p = preword + sp->ts_prewordlen;
[61a83e8]6835 mb_ptr_back(preword, p);
[76dd250]6836@@ -11685,10 +11892,9 @@
6837 && (slang->sl_compsylmax < MAXWLEN
6838 || sp->ts_complen + 1 - sp->ts_compsplit
6839 < slang->sl_compmax)
6840- && (byte_in_str(sp->ts_complen == sp->ts_compsplit
6841- ? slang->sl_compstartflags
6842- : slang->sl_compallflags,
6843- ((unsigned)flags >> 24))))
6844+ && (can_be_compound(sp, slang,
6845+ compflags, ((unsigned)flags >> 24))))
6846+
6847 {
6848 try_compound = TRUE;
[61a83e8]6849 compflags[sp->ts_complen] = ((unsigned)flags >> 24);
6850@@ -14808,7 +15014,7 @@
6851
6852 case 0:
6853 /*
6854- * Lenghts are equal, thus changes must result in same length: An
6855+ * Lengths are equal, thus changes must result in same length: An
6856 * insert is only possible in combination with a delete.
6857 * 1: check if for identical strings
[76dd250]6858 */
6859diff -Naur vim72.orig/src/structs.h vim72/src/structs.h
[4635005]6860--- vim72.orig/src/structs.h 2008-07-30 13:02:50.000000000 -0700
[76dd250]6861+++ vim72/src/structs.h 2009-03-01 11:08:10.625114401 -0800
6862@@ -459,7 +459,7 @@
6863 typedef struct
6864 {
6865 int hide; /* TRUE when ":hide" was used */
6866-# ifdef FEAT_BROWSE
6867+# ifdef FEAT_BROWSE_CMD
6868 int browse; /* TRUE to invoke file dialog */
6869 # endif
6870 # ifdef FEAT_WINDOWS
6871@@ -1784,10 +1784,15 @@
6872 #endif
6873
6874 /*
6875- * The next three specify the offsets for displaying the buffer:
6876+ * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
6877+ * displaying the buffer.
6878 */
6879 linenr_T w_topline; /* buffer line number of the line at the
6880 top of the window */
6881+#ifdef FEAT_AUTOCMD
6882+ char w_topline_was_set; /* flag set to TRUE when topline is set,
6883+ e.g. by winrestview() */
6884+#endif
6885 #ifdef FEAT_DIFF
6886 int w_topfill; /* number of filler lines above w_topline */
6887 int w_old_topfill; /* w_topfill at last redraw */
6888diff -Naur vim72.orig/src/tag.c vim72/src/tag.c
[4635005]6889--- vim72.orig/src/tag.c 2008-07-16 14:31:30.000000000 -0700
[7352c10]6890+++ vim72/src/tag.c 2009-03-01 11:12:32.157870372 -0800
6891@@ -515,7 +515,7 @@
6892 * If a count is supplied to the ":tag <name>" command, then
6893 * jump to count'th matching tag.
6894 */
6895- if (type == DT_TAG && count > 0)
6896+ if (type == DT_TAG && *tag != NUL && count > 0)
6897 cur_match = count - 1;
6898
[54f612f]6899 if (type == DT_SELECT || type == DT_JUMP
6900@@ -618,7 +618,7 @@
6901 taglen_advance(taglen);
6902 MSG_PUTS_ATTR(_("file\n"), hl_attr(HLF_T));
6903
6904- for (i = 0; i < num_matches; ++i)
6905+ for (i = 0; i < num_matches && !got_int; ++i)
6906 {
6907 parse_match(matches[i], &tagp);
6908 if (!new_tag && (
6909@@ -655,6 +655,8 @@
6910 }
6911 if (msg_col > 0)
6912 msg_putchar('\n');
6913+ if (got_int)
6914+ break;
6915 msg_advance(15);
6916
6917 /* print any extra fields */
6918@@ -689,6 +691,8 @@
6919 if (msg_col + ptr2cells(p) >= Columns)
6920 {
6921 msg_putchar('\n');
6922+ if (got_int)
6923+ break;
6924 msg_advance(15);
6925 }
6926 p = msg_outtrans_one(p, attr);
6927@@ -704,6 +708,8 @@
6928 if (msg_col > 15)
6929 {
6930 msg_putchar('\n');
6931+ if (got_int)
6932+ break;
6933 msg_advance(15);
6934 }
6935 }
6936@@ -734,6 +740,8 @@
6937 {
6938 if (msg_col + (*p == TAB ? 1 : ptr2cells(p)) > Columns)
6939 msg_putchar('\n');
6940+ if (got_int)
6941+ break;
6942 msg_advance(15);
6943
6944 /* skip backslash used for escaping command char */
6945@@ -760,12 +768,9 @@
6946 if (msg_col)
6947 msg_putchar('\n');
6948 ui_breakcheck();
6949- if (got_int)
6950- {
6951- got_int = FALSE; /* only stop the listing */
6952- break;
6953- }
6954 }
6955+ if (got_int)
6956+ got_int = FALSE; /* only stop the listing */
6957 ask_for_selection = TRUE;
6958 }
6959 #if defined(FEAT_QUICKFIX) && defined(FEAT_EVAL)
6960@@ -2542,6 +2547,15 @@
6961 {
6962 ga_clear_strings(&tag_fnames);
6963 do_tag(NULL, DT_FREE, 0, 0, 0);
6964+ tag_freematch();
6965+
6966+# if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
6967+ if (ptag_entry.tagname)
6968+ {
6969+ vim_free(ptag_entry.tagname);
6970+ ptag_entry.tagname = NULL;
6971+ }
6972+# endif
6973 }
6974 #endif
6975
[76dd250]6976@@ -2725,7 +2739,24 @@
6977 */
6978 p_7f = vim_strchr(lbuf, 0x7f);
6979 if (p_7f == NULL)
6980+ {
6981+etag_fail:
6982+ if (vim_strchr(lbuf, '\n') == NULL)
6983+ {
6984+ /* Truncated line. Ignore it. */
6985+ if (p_verbose >= 5)
6986+ {
6987+ verbose_enter();
6988+ MSG(_("Ignoring long line in tags file"));
6989+ verbose_leave();
6990+ }
6991+ tagp->command = lbuf;
6992+ tagp->tagname = lbuf;
6993+ tagp->tagname_end = lbuf;
6994+ return OK;
6995+ }
6996 return FAIL;
6997+ }
6998
6999 /* Find ^A. If not found the line number is after the 0x7f */
[54f612f]7000 p = vim_strchr(p_7f, Ctrl_A);
[76dd250]7001@@ -2735,7 +2766,7 @@
7002 ++p;
7003
7004 if (!VIM_ISDIGIT(*p)) /* check for start of line number */
7005- return FAIL;
7006+ goto etag_fail;
7007 tagp->command = p;
7008
[54f612f]7009
[76dd250]7010@@ -2749,7 +2780,7 @@
7011 /* find end of tagname */
7012 for (p = p_7f - 1; !vim_iswordc(*p); --p)
7013 if (p == lbuf)
7014- return FAIL;
7015+ goto etag_fail;
7016 tagp->tagname_end = p + 1;
7017 while (p >= lbuf && vim_iswordc(*p))
[5f4a45c9]7018 --p;
7019diff -Naur vim72.orig/src/term.c vim72/src/term.c
[4635005]7020--- vim72.orig/src/term.c 2008-07-27 04:48:06.000000000 -0700
[5f4a45c9]7021+++ vim72/src/term.c 2009-03-01 11:10:54.343604693 -0800
7022@@ -4920,7 +4920,15 @@
7023 key_name[0] = KEY2TERMCAP0(key);
7024 key_name[1] = KEY2TERMCAP1(key);
7025 if (key_name[0] == KS_KEY)
7026- string[new_slen++] = key_name[1]; /* from ":set <M-b>=xx" */
7027+ {
7028+ /* from ":set <M-b>=xx" */
7029+#ifdef FEAT_MBYTE
7030+ if (has_mbyte)
7031+ new_slen += (*mb_char2bytes)(key_name[1], string + new_slen);
7032+ else
7033+#endif
7034+ string[new_slen++] = key_name[1];
7035+ }
7036 else
7037 {
7038 string[new_slen++] = K_SPECIAL;
7039diff -Naur vim72.orig/src/testdir/Makefile vim72/src/testdir/Makefile
[4635005]7040--- vim72.orig/src/testdir/Makefile 2008-06-19 13:29:46.000000000 -0700
[5f4a45c9]7041+++ vim72/src/testdir/Makefile 2009-03-01 11:05:52.680272943 -0800
7042@@ -26,15 +26,17 @@
7043
7044 .SUFFIXES: .in .out
7045
7046-nongui: nolog $(SCRIPTS)
7047- @echo
7048- @cat test.log
7049- @echo ALL DONE
7050+nongui: nolog $(SCRIPTS) report
7051+
7052+gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
7053
7054-gui: nolog $(SCRIPTS) $(SCRIPTS_GUI)
7055+report:
7056 @echo
7057- @cat test.log
7058- @echo ALL DONE
7059+ @echo 'Test results:'
7060+ @/bin/sh -c "if test -f test.log; \
7061+ then cat test.log; echo TEST FAILURE; exit 1; \
7062+ else echo ALL DONE; \
7063+ fi"
7064
7065 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
7066
7067@@ -71,4 +73,4 @@
7068 test60.out: test60.vim
7069
7070 nolog:
7071- -echo Test results: >test.log
[76dd250]7072+ -rm -f test.log
7073diff -Naur vim72.orig/src/testdir/Make_ming.mak vim72/src/testdir/Make_ming.mak
[4635005]7074--- vim72.orig/src/testdir/Make_ming.mak 1969-12-31 16:00:00.000000000 -0800
[76dd250]7075+++ vim72/src/testdir/Make_ming.mak 2009-03-01 11:06:57.588433300 -0800
7076@@ -0,0 +1,91 @@
7077+# Makefile to run tests for Vim, on Dos-like machines
7078+# with sh.exe or zsh.exe in the path or not.
7079+#
7080+# Author: Bill McCarthy
7081+#
7082+# Note that test54 has been removed until it is fixed.
7083+#
7084+# Requires a set of Unix tools: echo, diff, etc.
7085+
7086+ifneq (sh.exe, $(SHELL))
7087+DEL = rm -f
7088+MV = mv
7089+CP = cp
7090+DIRSLASH = /
7091+else
7092+DEL = del
7093+MV = rename
7094+CP = copy
7095+DIRSLASH = \\
7096+endif
7097+
7098+VIMPROG = ..$(DIRSLASH)vim
7099+
7100+# Omitted:
7101+# test2 "\\tmp" doesn't work.
7102+# test10 'errorformat' is different
7103+# test12 can't unlink a swap file
7104+# test25 uses symbolic link
7105+# test27 can't edit file with "*" in file name
7106+# test31 16 bit version runs out of memory...
7107+
7108+SCRIPTS16 = test1.out test19.out test20.out test22.out \
7109+ test23.out test24.out test28.out test29.out \
7110+ test35.out test36.out test43.out \
7111+ test44.out test45.out test46.out test47.out \
7112+ test48.out test51.out test53.out \
7113+ test55.out test56.out test57.out test58.out test59.out \
7114+ test60.out test61.out test62.out test63.out test64.out
7115+
7116+# Had to remove test54 which doesn't work yet.
7117+# test54.out
7118+
7119+SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
7120+ test8.out test9.out test11.out test13.out test14.out \
7121+ test15.out test17.out test18.out test21.out test26.out \
7122+ test30.out test31.out test32.out test33.out test34.out \
7123+ test37.out test38.out test39.out test40.out test41.out \
7124+ test42.out test52.out test65.out
7125+
7126+SCRIPTS32 = test50.out
7127+
7128+SCRIPTS_GUI = test16.out
7129+
7130+.SUFFIXES: .in .out
7131+
7132+vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
7133+ echo ALL DONE
7134+
7135+nongui: fixff $(SCRIPTS16) $(SCRIPTS)
7136+ echo ALL DONE
7137+
7138+small:
7139+ echo ALL DONE
7140+
7141+gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
7142+ echo ALL DONE
7143+
7144+win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
7145+ echo ALL DONE
7146+
7147+fixff:
7148+ -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
7149+
7150+clean:
7151+ -$(DEL) *.out
7152+ -$(DEL) test.ok
7153+ -$(DEL) small.vim
7154+ -$(DEL) tiny.vim
7155+ -$(DEL) mbyte.vim
7156+ -$(DEL) X*
7157+ -$(DEL) viminfo
7158+
7159+.in.out:
7160+ $(CP) $*.ok test.ok
7161+ $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
7162+ diff test.out $*.ok
7163+ -$(DEL) $*.out
7164+ $(MV) test.out $*.out
7165+ -$(DEL) X*
7166+ -$(DEL) test.ok
7167+ -$(DEL) viminfo
7168diff -Naur vim72.orig/src/testdir/test42.ok vim72/src/testdir/test42.ok
[4635005]7169--- vim72.orig/src/testdir/test42.ok 2008-02-20 04:27:37.000000000 -0800
[76dd250]7170+++ vim72/src/testdir/test42.ok 2009-03-01 11:07:47.727646598 -0800
7171@@ -20,7 +20,7 @@
7172 ucs-2
7173
7174
7175- fileencoding=ucs-2le
7176+ fileencoding=utf-16le
7177 bomb
7178 ucs-2le
7179
7180diff -Naur vim72.orig/src/ui.c vim72/src/ui.c
[4635005]7181--- vim72.orig/src/ui.c 2008-07-14 11:14:56.000000000 -0700
[76dd250]7182+++ vim72/src/ui.c 2009-03-01 11:08:45.651358290 -0800
7183@@ -1820,7 +1820,7 @@
7184 #ifdef HAVE_DUP
7185 /* Use stderr for stdin, also works for shell commands. */
7186 close(0);
7187- dup(2);
7188+ ignored = dup(2);
7189 #else
7190 read_cmd_fd = 2; /* read from stderr instead of stdin */
7191 #endif
7192@@ -2020,7 +2020,7 @@
7193
7194 if (value == NULL || *length == 0)
7195 {
7196- clip_free_selection(cbd); /* ??? [what's the query?] */
7197+ clip_free_selection(cbd); /* nothing received, clear register */
7198 *(int *)success = FALSE;
7199 return;
7200 }
7201@@ -2076,7 +2076,7 @@
7202 text_prop.value = (unsigned char *)value;
7203 text_prop.encoding = *type;
7204 text_prop.format = *format;
7205- text_prop.nitems = STRLEN(value);
7206+ text_prop.nitems = len;
7207 status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
7208 &text_list, &n_text);
7209 if (status != Success || n_text < 1)
7210@@ -2110,6 +2110,8 @@
7211 int i;
7212 int nbytes = 0;
7213 char_u *buffer;
7214+ time_t start_time;
7215+ int timed_out = FALSE;
7216
7217 for (i =
7218 #ifdef FEAT_MBYTE
7219@@ -2129,6 +2131,7 @@
7220 case 3: type = text_atom; break;
7221 default: type = XA_STRING;
7222 }
7223+ success = MAYBE;
7224 XtGetSelectionValue(myShell, cbd->sel_atom, type,
7225 clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
7226
7227@@ -2141,27 +2144,48 @@
7228 * characters, then they will appear before the one that requested the
7229 * paste! Don't worry, we will catch up with any other events later.
7230 */
7231- for (;;)
7232+ start_time = time(NULL);
7233+ while (success == MAYBE)
7234 {
7235- if (XCheckTypedEvent(dpy, SelectionNotify, &event))
7236- break;
7237- if (XCheckTypedEvent(dpy, SelectionRequest, &event))
7238- /* We may get a SelectionRequest here and if we don't handle
7239- * it we hang. KDE klipper does this, for example. */
7240+ if (XCheckTypedEvent(dpy, SelectionNotify, &event)
7241+ || XCheckTypedEvent(dpy, SelectionRequest, &event)
7242+ || XCheckTypedEvent(dpy, PropertyNotify, &event))
7243+ {
7244+ /* This is where clip_x11_request_selection_cb() should be
7245+ * called. It may actually happen a bit later, so we loop
7246+ * until "success" changes.
7247+ * We may get a SelectionRequest here and if we don't handle
7248+ * it we hang. KDE klipper does this, for example.
7249+ * We need to handle a PropertyNotify for large selections. */
7250 XtDispatchEvent(&event);
7251+ continue;
7252+ }
7253+
7254+ /* Time out after 2 to 3 seconds to avoid that we hang when the
7255+ * other process doesn't respond. Note that the SelectionNotify
7256+ * event may still come later when the selection owner comes back
7257+ * to life and the text gets inserted unexpectedly. Don't know
7258+ * why that happens or how to avoid that :-(. */
7259+ if (time(NULL) > start_time + 2)
7260+ {
7261+ timed_out = TRUE;
7262+ break;
7263+ }
7264
7265 /* Do we need this? Probably not. */
7266 XSync(dpy, False);
7267
7268- /* Bernhard Walle solved a slow paste response in an X terminal by
7269- * adding: usleep(10000); here. */
7270+ /* Wait for 1 msec to avoid that we eat up all CPU time. */
7271+ ui_delay(1L, TRUE);
7272 }
7273
7274- /* this is where clip_x11_request_selection_cb() is actually called */
7275- XtDispatchEvent(&event);
7276-
7277- if (success)
7278+ if (success == TRUE)
7279 return;
7280+
7281+ /* don't do a retry with another type after timing out, otherwise we
7282+ * hang for 15 seconds. */
7283+ if (timed_out)
7284+ break;
7285 }
7286
7287 /* Final fallback position - use the X CUT_BUFFER0 store */
7288diff -Naur vim72.orig/src/version.c vim72/src/version.c
[4635005]7289--- vim72.orig/src/version.c 2008-08-09 07:24:52.000000000 -0700
7290+++ vim72/src/version.c 2009-03-01 11:12:42.142512361 -0800
[76dd250]7291@@ -677,9 +677,256 @@
7292 static int included_patches[] =
7293 { /* Add new patch number below this line */
[4635005]7294 /**/
7295+ 128,
7296+/**/
7297+ 127,
7298+/**/
7299+ 126,
7300+/**/
7301+ 125,
[54f612f]7302+/**/
7303+ 124,
7304+/**/
7305+ 123,
7306+/**/
7307+ 122,
7308+/**/
7309+ 121,
7310+/**/
7311+ 120,
7312+/**/
7313+ 119,
7314+/**/
7315+ 118,
7316+/**/
7317+ 117,
7318+/**/
7319+ 116,
7320+/**/
7321+ 115,
7322+/**/
7323+ 114,
7324+/**/
7325+ 113,
7326+/**/
7327+ 112,
7328+/**/
7329+ 111,
7330+/**/
7331+ 110,
7332+/**/
7333+ 109,
[61a83e8]7334+/**/
7335+ 108,
7336+/**/
7337+ 107,
7338+/**/
7339+ 106,
7340+/**/
7341+ 105,
7342+/**/
7343+ 104,
7344+/**/
7345+ 103,
[9a875fd]7346+/**/
7347+ 102,
7348+/**/
7349+ 100,
7350+/**/
7351+ 99,
7352+/**/
7353+ 98,
7354+/**/
7355+ 97,
7356+/**/
7357+ 96,
7358+/**/
7359+ 95,
7360+/**/
7361+ 94,
[5f4a45c9]7362+/**/
7363+ 92,
7364+/**/
7365+ 91,
7366+/**/
7367+ 90,
7368+/**/
7369+ 87,
7370+/**/
7371+ 86,
7372+/**/
7373+ 85,
[7352c10]7374+/**/
7375+ 84,
7376+/**/
7377+ 83,
7378+/**/
7379+ 82,
7380+/**/
7381+ 81,
7382+/**/
7383+ 80,
[43c52a1]7384+/**/
7385+ 79,
7386+/**/
7387+ 78,
7388+/**/
7389+ 77,
[1f22c7c]7390+/**/
7391+ 76,
7392+/**/
7393+ 75,
7394+/**/
7395+ 73,
7396+/**/
7397+ 70,
[76dd250]7398+/**/
7399+ 69,
7400+/**/
7401+ 68,
7402+/**/
7403+ 67,
7404+/**/
7405+ 66,
7406+/**/
7407+ 65,
7408+/**/
7409+ 64,
7410+/**/
7411+ 63,
7412+/**/
7413+ 62,
7414+/**/
7415+ 61,
7416+/**/
7417+ 60,
7418+/**/
7419+ 59,
7420+/**/
7421+ 58,
7422+/**/
7423+ 57,
7424+/**/
7425+ 56,
7426+/**/
7427+ 55,
7428+/**/
7429+ 54,
7430+/**/
7431+ 53,
7432+/**/
7433+ 52,
7434+/**/
7435+ 51,
7436+/**/
7437+ 50,
7438+/**/
7439+ 48,
7440+/**/
7441+ 47,
7442+/**/
7443+ 46,
7444+/**/
7445+ 45,
7446+/**/
7447+ 44,
7448+/**/
7449+ 43,
7450+/**/
7451+ 42,
7452+/**/
7453+ 40,
7454+/**/
7455+ 39,
7456+/**/
7457+ 38,
7458+/**/
7459+ 37,
7460+/**/
7461+ 35,
7462+/**/
7463+ 34,
7464+/**/
7465+ 33,
7466+/**/
7467+ 32,
7468+/**/
7469+ 31,
7470+/**/
7471+ 30,
7472+/**/
7473+ 29,
7474+/**/
7475+ 28,
7476+/**/
7477+ 27,
7478+/**/
7479+ 26,
7480+/**/
7481+ 25,
7482+/**/
7483+ 24,
7484+/**/
7485+ 23,
7486+/**/
7487+ 22,
7488+/**/
7489+ 21,
7490+/**/
7491+ 20,
7492+/**/
7493+ 19,
7494+/**/
7495+ 18,
7496+/**/
7497+ 17,
7498+/**/
7499+ 16,
7500+/**/
7501+ 15,
7502+/**/
7503+ 14,
7504+/**/
7505+ 13,
7506+/**/
7507+ 12,
7508+/**/
7509+ 11,
7510+/**/
7511+ 10,
7512+/**/
7513+ 9,
7514+/**/
7515+ 8,
7516+/**/
7517+ 6,
7518+/**/
7519+ 5,
7520+/**/
7521+ 4,
7522+/**/
7523+ 3,
7524+/**/
7525+ 2,
7526+/**/
7527+ 1,
7528+/**/
7529 0
7530 };
7531
7532+/*
7533+ * Place to put a short description when adding a feature with a patch.
7534+ * Keep it short, e.g.,: "relative numbers", "persistent undo".
7535+ * Also add a comment marker to separate the lines.
[1f22c7c]7536+ * See the official Vim patches for the diff format: It must use a context of
[76dd250]7537+ * one line only. Create it by hand or use "diff -C2" and edit the patch.
7538+ */
7539+static char *(extra_patches[]) =
7540+{ /* Add your patch description below this line */
7541+/**/
7542+ NULL
7543+};
7544+
7545 int
7546 highest_patch()
[4635005]7547 {
[76dd250]7548@@ -786,7 +1033,7 @@
7549 MSG_PUTS(_("\nRISC OS version"));
7550 #endif
7551 #ifdef VMS
7552- MSG_PUTS("\nOpenVMS version");
7553+ MSG_PUTS(_("\nOpenVMS version"));
7554 # ifdef HAVE_PATHDEF
7555 if (*compiled_arch != NUL)
[4635005]7556 {
[76dd250]7557@@ -825,6 +1072,19 @@
7558 }
7559 }
7560
7561+ /* Print the list of extra patch descriptions if there is at least one. */
7562+ if (extra_patches[0] != NULL)
7563+ {
7564+ MSG_PUTS(_("\nExtra patches: "));
7565+ s = "";
7566+ for (i = 0; extra_patches[i] != NULL; ++i)
7567+ {
7568+ MSG_PUTS(s);
7569+ s = ", ";
7570+ MSG_PUTS(extra_patches[i]);
7571+ }
7572+ }
7573+
7574 #ifdef MODIFIED_BY
7575 MSG_PUTS("\n");
7576 MSG_PUTS(_("Modified by "));
7577diff -Naur vim72.orig/src/vim.h vim72/src/vim.h
[4635005]7578--- vim72.orig/src/vim.h 2008-08-09 09:03:38.000000000 -0700
[76dd250]7579+++ vim72/src/vim.h 2009-03-01 11:12:22.073226148 -0800
7580@@ -341,8 +341,14 @@
7581 #ifdef BACKSLASH_IN_FILENAME
7582 # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<")
7583 #else
7584-# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
7585-# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
7586+# ifdef VMS
7587+ /* VMS allows a lot of characters in the file name */
7588+# define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!")
7589+# define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&")
7590+# else
7591+# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
7592+# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
7593+# endif
7594 #endif
7595
7596 #define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */
7597@@ -370,7 +376,7 @@
7598 * Define __w64 as an empty token for everything but MSVC 7.x or later.
7599 */
7600 # if !defined(_MSC_VER) || (_MSC_VER < 1300)
7601-# define __w64
7602+# define __w64
7603 # endif
7604 typedef unsigned long __w64 long_u;
[54f612f]7605 typedef long __w64 long_i;
7606@@ -1051,6 +1057,7 @@
7607 #define WSP_HELP 16 /* creating the help window */
7608 #define WSP_BELOW 32 /* put new window below/right */
7609 #define WSP_ABOVE 64 /* put new window above/left */
7610+#define WSP_NEWLOC 128 /* don't copy location list */
7611
7612 /*
7613 * arguments for gui_set_shellsize()
[76dd250]7614@@ -1728,7 +1735,8 @@
7615 #define VV_MOUSE_COL 51
7616 #define VV_OP 52
7617 #define VV_SEARCHFORWARD 53
7618-#define VV_LEN 54 /* number of v: vars */
7619+#define VV_OLDFILES 54
7620+#define VV_LEN 55 /* number of v: vars */
7621
7622 #ifdef FEAT_CLIPBOARD
[54f612f]7623
[76dd250]7624@@ -1979,6 +1987,9 @@
7625 # endif
7626 #endif
7627
7628+#ifndef FEAT_NETBEANS_INTG
7629+# undef NBDEBUG
7630+#endif
7631 #ifdef NBDEBUG /* Netbeans debugging. */
7632 # include "nbdebug.h"
[54f612f]7633 #else
[76dd250]7634@@ -2054,4 +2065,10 @@
7635 #define DOSO_VIMRC 1 /* loading vimrc file */
7636 #define DOSO_GVIMRC 2 /* loading gvimrc file */
7637
7638+/* flags for read_viminfo() and children */
7639+#define VIF_WANT_INFO 1 /* load non-mark info */
7640+#define VIF_WANT_MARKS 2 /* load file marks */
7641+#define VIF_FORCEIT 4 /* overwrite info already read */
7642+#define VIF_GET_OLDFILES 8 /* load v:oldfiles */
7643+
7644 #endif /* VIM__H */
7645diff -Naur vim72.orig/src/window.c vim72/src/window.c
[4635005]7646--- vim72.orig/src/window.c 2008-08-06 04:00:30.000000000 -0700
[54f612f]7647+++ vim72/src/window.c 2009-03-01 11:12:22.073226148 -0800
7648@@ -12,7 +12,7 @@
7649 static int path_is_url __ARGS((char_u *p));
7650 #if defined(FEAT_WINDOWS) || defined(PROTO)
7651 static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
7652-static void win_init __ARGS((win_T *newp, win_T *oldp));
7653+static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
7654 static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
7655 static void frame_setheight __ARGS((frame_T *curfrp, int height));
7656 #ifdef FEAT_VERTSPLIT
7657@@ -593,9 +593,7 @@
7658 ++allow_keys; /* no mapping for xchar, but allow key codes */
7659 if (xchar == NUL)
7660 xchar = plain_vgetc();
7661-#ifdef FEAT_LANGMAP
7662 LANGMAP_ADJUST(xchar, TRUE);
7663-#endif
7664 --no_mapping;
7665 --allow_keys;
7666 #ifdef FEAT_CMDL_INFO
7667@@ -912,7 +910,7 @@
7668 return FAIL;
7669
7670 /* make the contents of the new window the same as the current one */
7671- win_init(wp, curwin);
7672+ win_init(wp, curwin, flags);
7673 }
7674
7675 /*
7676@@ -1161,11 +1159,15 @@
7677 * Initialize window "newp" from window "oldp".
7678 * Used when splitting a window and when creating a new tab page.
7679 * The windows will both edit the same buffer.
7680+ * WSP_NEWLOC may be specified in flags to prevent the location list from
7681+ * being copied.
7682 */
7683+/*ARGSUSED*/
7684 static void
7685-win_init(newp, oldp)
7686+win_init(newp, oldp, flags)
7687 win_T *newp;
7688 win_T *oldp;
7689+ int flags;
7690 {
7691 int i;
7692
7693@@ -1190,7 +1192,14 @@
7694 copy_jumplist(oldp, newp);
7695 #endif
7696 #ifdef FEAT_QUICKFIX
7697- copy_loclist(oldp, newp);
7698+ if (flags & WSP_NEWLOC)
7699+ {
7700+ /* Don't copy the location list. */
7701+ newp->w_llist = NULL;
7702+ newp->w_llist_ref = NULL;
7703+ }
7704+ else
7705+ copy_loclist(oldp, newp);
7706 #endif
7707 if (oldp->w_localdir != NULL)
7708 newp->w_localdir = vim_strsave(oldp->w_localdir);
7709@@ -3220,7 +3229,7 @@
7710 else
7711 {
7712 /* First window in new tab page, initialize it from "oldwin". */
7713- win_init(curwin, oldwin);
7714+ win_init(curwin, oldwin, 0);
7715
7716 # ifdef FEAT_SCROLLBIND
7717 /* We don't want scroll-binding in the first window. */
[76dd250]7718@@ -4028,14 +4037,14 @@
7719 if (mch_dirname(cwd, MAXPATHL) == OK)
7720 globaldir = vim_strsave(cwd);
7721 }
7722- mch_chdir((char *)curwin->w_localdir);
7723- shorten_fnames(TRUE);
7724+ if (mch_chdir((char *)curwin->w_localdir) == 0)
7725+ shorten_fnames(TRUE);
7726 }
7727 else if (globaldir != NULL)
7728 {
7729 /* Window doesn't have a local directory and we are not in the global
7730 * directory: Change to the global directory. */
7731- mch_chdir((char *)globaldir);
7732+ ignored = mch_chdir((char *)globaldir);
7733 vim_free(globaldir);
7734 globaldir = NULL;
7735 shorten_fnames(TRUE);
7736diff -Naur vim72.orig/src/workshop.c vim72/src/workshop.c
[4635005]7737--- vim72.orig/src/workshop.c 2008-06-21 11:53:26.000000000 -0700
[76dd250]7738+++ vim72/src/workshop.c 2009-03-01 11:08:39.914989523 -0800
7739@@ -1121,8 +1121,12 @@
7740 ? (char *)curbuf->b_sfname : "<None>");
7741 #endif
7742
7743- strcpy(ffname, (char *) curbuf->b_ffname);
7744- *filename = ffname; /* copy so nobody can change b_ffname */
7745+ if (curbuf->b_ffname == NULL)
7746+ ffname[0] = NUL;
7747+ else
7748+ /* copy so nobody can change b_ffname */
7749+ strcpy(ffname, (char *) curbuf->b_ffname);
7750+ *filename = ffname;
7751 *curLine = curwin->w_cursor.lnum;
7752 *curCol = curwin->w_cursor.col;
7753
Note: See TracBrowser for help on using the repository browser.