source: patches/vim-7.2-branch_update-11.patch@ d378786

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

Updated VIM Branch Update Patch to -11

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