1 Submitted By: Jim Gifford (jim at cross-lfs dot org)
3 Initial Package Version: 7.2
5 Upstream Status: Applied
6 Description: Contains all upstream patches up to 7.2.141
7 The following patches were skipped
8 007 036 041 049 071 072 074 088 089 093 101 138
10 diff -Naur vim72.orig/Filelist vim72/Filelist
11 --- vim72.orig/Filelist 2008-07-06 11:02:23.000000000 -0700
12 +++ vim72/Filelist 2009-03-12 11:54:40.397486521 -0700
14 src/proto/os_win32.pro \
15 src/proto/os_mswin.pro \
16 src/testdir/Make_dos.mak \
17 + src/testdir/Make_ming.mak \
21 diff -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
23 +++ vim72/runtime/doc/cmdline.txt 2009-03-12 11:54:40.529493784 -0700
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
29 VIM REFERENCE MANUAL by Bram Moolenaar
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
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
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
63 + {only when compiled with the +eval and +viminfo features}
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|.
69 +The "#<n" item returns an absolute path, but it will start with "~/" for files
70 +below your home directory.
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): >
80 diff -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
82 +++ vim72/runtime/doc/eval.txt 2009-03-12 11:54:50.318122364 -0700
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
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.
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}
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')
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>
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.
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.
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
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.
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,
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"
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|.
200 diff -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
202 +++ vim72/runtime/doc/netbeans.txt 2009-03-12 11:54:59.850731108 -0700
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
208 VIM REFERENCE MANUAL by Gordon Prieur et al.
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.
220 newDotAndMark off off
221 Reports the position of the cursor being at "off" bytes into
222 diff -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
224 +++ vim72/runtime/doc/options.txt 2009-03-12 11:55:13.407601900 -0700
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
230 VIM REFERENCE MANUAL by Bram Moolenaar
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.
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,υy,ζz
241 @@ -7472,7 +7469,9 @@
242 {not available when compiled without the |+wildignore|
244 A list of file patterns. A file that matches with one of these
245 - patterns is ignored when completing file or directory names.
246 + patterns is ignored when completing file or directory names, and
247 + influences the result of |expand()|, |glob()| and |globpath()| unless
248 + a flag is passed to disable this.
249 The pattern is used like with |:autocmd|, see |autocmd-patterns|.
252 diff -Naur vim72.orig/runtime/doc/spell.txt vim72/runtime/doc/spell.txt
253 --- vim72.orig/runtime/doc/spell.txt 2008-08-09 07:23:00.000000000 -0700
254 +++ vim72/runtime/doc/spell.txt 2009-03-12 11:54:50.218113983 -0700
256 -*spell.txt* For Vim version 7.2. Last change: 2008 Jun 21
257 +*spell.txt* For Vim version 7.2. Last change: 2008 Nov 30
260 VIM REFERENCE MANUAL by Bram Moolenaar
265 -With some items it's also possible to put a comment after it, but this isn't
266 -supported in general.
267 +Items with a fixed number of arguments can be followed by a comment. But only
268 +if none of the arguments can contain white space. The comment must start with
269 +a "#" character. Example:
271 + KEEPCASE = # fix case for words with this flag ~
277 Note: When using utf-8 only characters up to 65000 may be used for flags.
279 +Note: even when using "num" or "long" the number of flags available to
280 +compounding and prefixes is limited to about 250.
284 *spell-PFX* *spell-SFX*
285 @@ -1178,6 +1184,9 @@
286 The flag also applies to the word with affixes, thus this can be used to mark
287 a whole bunch of related words as bad.
289 + *spell-FORBIDDENWORD*
290 +FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell.
293 The NEEDAFFIX flag is used to require that a word is used with an affix. The
294 word itself is not a good word (unless there is an empty affix). Example:
295 @@ -1268,6 +1277,10 @@
299 + *spell-ONLYINCOMPOUND*
300 +The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for
301 +compatiblity with Hunspell.
304 The minimal character length of a word used for compounding is specified with
305 COMPOUNDMIN. Example:
306 @@ -1328,6 +1341,20 @@
307 rules. Can also be used for an affix to count the affix as a compounding
310 + *spell-CHECKCOMPOUNDPATTERN*
311 +CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
312 +position where two words are compounded together forbids the compound.
314 + CHECKCOMPOUNDPATTERN o e ~
316 +This forbids compounding if the first word ends in "o" and the second word
319 +The arguments must be plain text, no patterns are actually supported, despite
320 +the item name. Case is always ignored.
322 +The Hunspell feature to use three arguments and flags is not supported.
325 The SYLLABLE item defines characters or character sequences that are used to
326 count the number of syllables in a word. Example:
327 @@ -1496,6 +1523,10 @@
328 ACCENT (Hunspell) *spell-ACCENT*
329 Use MAP instead. |spell-MAP|
331 +BREAK (Hunspell) *spell-BREAK*
332 + Define break points. Unclear how it works exactly.
335 CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE*
336 Disallow uppercase letters at compound word boundaries.
338 @@ -1512,9 +1543,6 @@
339 Forbid three identical characters when compounding. Not
342 -CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN*
343 - Forbid compounding when patterns match. Not supported.
345 COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES*
346 Enables using two prefixes. Not supported.
348 @@ -1536,13 +1564,18 @@
349 COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
350 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
352 +COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES*
353 + Number of COMPOUNDRULE lines following. Ignored, but the
354 + argument must be a number.
356 COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
357 Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
358 |spell-COMPOUNDSYLMAX|
360 -FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD*
361 - Use BAD instead. |spell-BAD|
363 +KEY (Hunspell) *spell-KEY*
364 + Define characters that are close together on the keyboard.
365 + Used to give better suggestions. Not supported.
367 LANG (Hunspell) *spell-LANG*
368 This specifies language-specific behavior. This actually
369 moves part of the language knowledge into the program,
370 @@ -1553,10 +1586,7 @@
371 Only needed for morphological analysis.
373 MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
376 -ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND*
377 - Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND|
378 + Set number of n-gram suggestions. Not supported.
380 PSEUDOROOT (Hunspell) *spell-PSEUDOROOT*
381 Use NEEDAFFIX instead. |spell-NEEDAFFIX|
382 diff -Naur vim72.orig/runtime/doc/starting.txt vim72/runtime/doc/starting.txt
383 --- vim72.orig/runtime/doc/starting.txt 2008-08-09 07:23:00.000000000 -0700
384 +++ vim72/runtime/doc/starting.txt 2009-03-12 11:54:40.533495740 -0700
386 -*starting.txt* For Vim version 7.2. Last change: 2008 Jun 21
387 +*starting.txt* For Vim version 7.2. Last change: 2008 Nov 09
390 VIM REFERENCE MANUAL by Bram Moolenaar
391 @@ -1337,8 +1337,9 @@
393 When Vim is started and the 'viminfo' option is non-empty, the contents of
394 the viminfo file are read and the info can be used in the appropriate places.
395 -The marks are not read in at startup (but file marks are). See
396 -|initialization| for how to set the 'viminfo' option upon startup.
397 +The |v:oldfiles| variable is filled. The marks are not read in at startup
398 +(but file marks are). See |initialization| for how to set the 'viminfo'
399 +option upon startup.
402 When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo
403 @@ -1372,6 +1373,8 @@
404 that start with any string given with the "r" flag in 'viminfo'. This can be
405 used to avoid saving marks for files on removable media (for MS-DOS you would
406 use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:").
407 +The |v:oldfiles| variable is filled with the file names that the viminfo file
411 Uppercase marks ('A to 'Z) are stored when writing the viminfo file. The
412 @@ -1463,8 +1466,8 @@
413 *:rv* *:rviminfo* *E195*
414 :rv[iminfo][!] [file] Read from viminfo file [file] (default: see above).
415 If [!] is given, then any information that is
416 - already set (registers, marks, etc.) will be
417 - overwritten. {not in Vi}
418 + already set (registers, marks, |v:oldfiles|, etc.)
419 + will be overwritten {not in Vi}
421 *:wv* *:wviminfo* *E137* *E138* *E574*
422 :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
423 @@ -1479,4 +1482,20 @@
428 +:ol[dfiles] List the files that have marks stored in the viminfo
429 + file. This list is read on startup and only changes
430 + afterwards with ":rviminfo!". Also see |v:oldfiles|.
431 + The number can be used with |c_#<|.
432 + {not in Vi, only when compiled with the +eval feature}
434 +:bro[wse] ol[dfiles][!]
435 + List file names as with |:oldfiles|, and then prompt
436 + for a number. When the number is valid that file from
437 + the list is edited.
438 + If you get the |press-enter| prompt you can press "q"
439 + and still get the prompt to enter a file number.
440 + Use ! to abondon a modified buffer. |abandon|
441 + {not when compiled with tiny or small features}
443 vim:tw=78:ts=8:ft=help:norl:
444 diff -Naur vim72.orig/runtime/doc/usr_21.txt vim72/runtime/doc/usr_21.txt
445 --- vim72.orig/runtime/doc/usr_21.txt 2008-08-09 07:23:01.000000000 -0700
446 +++ vim72/runtime/doc/usr_21.txt 2009-03-12 11:54:40.533495740 -0700
448 -*usr_21.txt* For Vim version 7.2. Last change: 2007 May 01
449 +*usr_21.txt* For Vim version 7.2. Last change: 2008 Nov 09
451 VIM USER MANUAL - by Bram Moolenaar
454 to be lost. Each item can be remembered only once.
457 -GETTING BACK TO WHERE YOU WERE
458 +GETTING BACK TO WHERE YOU STOPPED VIM
460 You are halfway editing a file and it's time to leave for holidays. You exit
461 Vim and go enjoy yourselves, forgetting all about your work. After a couple
463 The |:marks| command is useful to find out where '0 to '9 will take you.
466 +GETTING BACK TO SOME FILE
468 +If you want to go back to a file that you edited recently, but not when
469 +exiting Vim, there is a slightly more complicated way. You can see a list of
470 +files by typing the command: >
474 + 2: ~/text/resume.txt ~
477 +Now you would like to edit the second file, which is in the list preceded by
482 +Instead of ":e" you can use any command that has a file name argument, the
483 +"#<2" item works in the same place as "%" (current file name) and "#"
484 +(alternate file name). So you can also split the window to edit the third
489 +That #<123 thing is a bit complicated when you just want to edit a file.
490 +Fortunately there is a simpler way: >
494 + 2: ~/text/resume.txt ~
498 +You get the same list of files as with |:oldfiles|. If you want to edit
499 +"resume.txt" first press "q" to stop the listing. You will get a prompt:
501 + Type number and <Enter> (empty cancels): ~
503 +Type "2" and press <Enter> to edit the second file.
505 +More info at |:oldfiles|, |v:oldfiles| and |c_#<|.
508 MOVE INFO FROM ONE VIM TO ANOTHER
510 You can use the ":wviminfo" and ":rviminfo" commands to save and restore the
511 diff -Naur vim72.orig/runtime/scripts.vim vim72/runtime/scripts.vim
512 --- vim72.orig/runtime/scripts.vim 2008-08-08 15:27:21.000000000 -0700
513 +++ vim72/runtime/scripts.vim 2009-03-12 11:54:28.900750105 -0700
515 elseif s:line1 =~ '\<DTD\s\+XHTML\s'
518 + " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
519 + elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
523 elseif s:line1 =~ '^%PDF-'
525 diff -Naur vim72.orig/src/auto/configure vim72/src/auto/configure
526 --- vim72.orig/src/auto/configure 2008-07-24 05:40:36.000000000 -0700
527 +++ vim72/src/auto/configure 2009-03-12 11:55:13.667618383 -0700
528 @@ -11565,6 +11565,67 @@
532 +{ $as_echo "$as_me:$LINENO: checking for working volatile" >&5
533 +$as_echo_n "checking for working volatile... " >&6; }
534 +if test "${ac_cv_c_volatile+set}" = set; then
535 + $as_echo_n "(cached) " >&6
537 + cat >conftest.$ac_ext <<_ACEOF
540 +cat confdefs.h >>conftest.$ac_ext
541 +cat >>conftest.$ac_ext <<_ACEOF
542 +/* end confdefs.h. */
549 +int * volatile y = (int *) 0;
555 +rm -f conftest.$ac_objext
556 +if { (ac_try="$ac_compile"
558 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
559 + *) ac_try_echo=$ac_try;;
561 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
562 +$as_echo "$ac_try_echo") >&5
563 + (eval "$ac_compile") 2>conftest.er1
565 + grep -v '^ *+' conftest.er1 >conftest.err
567 + cat conftest.err >&5
568 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
569 + (exit $ac_status); } && {
570 + test -z "$ac_c_werror_flag" ||
571 + test ! -s conftest.err
572 + } && test -s conftest.$ac_objext; then
573 + ac_cv_c_volatile=yes
575 + $as_echo "$as_me: failed program was:" >&5
576 +sed 's/^/| /' conftest.$ac_ext >&5
578 + ac_cv_c_volatile=no
581 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
583 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5
584 +$as_echo "$ac_cv_c_volatile" >&6; }
585 +if test $ac_cv_c_volatile = no; then
587 +cat >>confdefs.h <<\_ACEOF
588 +#define volatile /**/
593 { $as_echo "$as_me:$LINENO: checking for mode_t" >&5
594 $as_echo_n "checking for mode_t... " >&6; }
595 if test "${ac_cv_type_mode_t+set}" = set; then
596 @@ -16819,21 +16880,29 @@
597 LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
600 -{ $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
601 -$as_echo_n "checking for GCC 3 or later... " >&6; }
602 DEPEND_CFLAGS_FILTER=
603 if test "$GCC" = yes; then
604 + { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
605 +$as_echo_n "checking for GCC 3 or later... " >&6; }
606 gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
607 if test "$gccmajor" -gt "2"; then
608 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
611 -if test "$DEPEND_CFLAGS_FILTER" = ""; then
612 - { $as_echo "$as_me:$LINENO: result: no" >&5
613 + { $as_echo "$as_me:$LINENO: result: yes" >&5
614 +$as_echo "yes" >&6; }
616 + { $as_echo "$as_me:$LINENO: result: no" >&5
619 - { $as_echo "$as_me:$LINENO: result: yes" >&5
621 + { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5
622 +$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
623 + if test "$gccmajor" -gt "3"; then
624 + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
625 + { $as_echo "$as_me:$LINENO: result: yes" >&5
626 $as_echo "yes" >&6; }
628 + { $as_echo "$as_me:$LINENO: result: no" >&5
629 +$as_echo "no" >&6; }
634 diff -Naur vim72.orig/src/buffer.c vim72/src/buffer.c
635 --- vim72.orig/src/buffer.c 2008-08-06 04:00:48.000000000 -0700
636 +++ vim72/src/buffer.c 2009-03-12 11:55:13.507605811 -0700
641 -#ifdef FEAT_NETBEANS_INTG
643 - netbeans_file_closed(buf);
645 /* Change directories when the 'acd' option is set. */
650 buf_delete_signs(buf); /* delete any signs */
652 +#ifdef FEAT_NETBEANS_INTG
654 + netbeans_file_killed(buf);
657 map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
658 map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
660 vim_free(buf->b_start_fenc);
661 buf->b_start_fenc = NULL;
664 + ga_clear(&buf->b_langp);
670 int bnr; /* buffer number */
673 -#ifdef FEAT_NETBEANS_INTG
674 - netbeansCloseFile = 1;
678 (void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit);
683 -#ifdef FEAT_NETBEANS_INTG
684 - netbeansCloseFile = 0;
689 @@ -1237,7 +1234,7 @@
690 * "buf" if one exists */
691 if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
693 - /* If 'switchbuf' contians "usetab": jump to first window in any tab
694 + /* If 'switchbuf' contains "usetab": jump to first window in any tab
695 * page containing "buf" if one exists */
696 if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
698 @@ -1351,11 +1348,12 @@
702 + /* An autocommand may have deleted "buf", already entered it (e.g., when
703 + * it did ":bunload") or aborted the script processing! */
705 - /* An autocommand may have deleted buf or aborted the script processing! */
706 - if (buf_valid(buf) && !aborting())
707 + if (buf_valid(buf) && buf != curbuf && !aborting())
709 - if (buf_valid(buf)) /* an autocommand may have deleted buf! */
710 + if (buf_valid(buf) && buf != curbuf)
714 @@ -1397,6 +1395,9 @@
715 curwin->w_cursor.coladd = 0;
717 curwin->w_set_curswant = TRUE;
719 + curwin->w_topline_was_set = FALSE;
722 /* Make sure the buffer is loaded. */
723 if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
724 @@ -1436,7 +1437,8 @@
728 - if (curwin->w_topline == 1) /* when autocmds didn't change it */
729 + /* when autocmds didn't change it */
730 + if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
732 scroll_cursor_halfway(FALSE); /* redisplay at correct position */
734 @@ -3963,7 +3965,7 @@
735 width = vim_strsize(out);
736 if (maxwidth > 0 && width > maxwidth)
738 - /* Result is too long, must trunctate somewhere. */
739 + /* Result is too long, must truncate somewhere. */
743 @@ -5048,7 +5050,8 @@
745 FOR_ALL_TAB_WINDOWS(tp, win)
746 if (win->w_buffer == buf)
750 if (win != NULL && win->w_llist_ref != NULL)
751 return _("[Location List]");
753 @@ -5062,7 +5065,7 @@
755 if (buf->b_sfname != NULL)
756 return (char *)buf->b_sfname;
757 - return "[Scratch]";
758 + return _("[Scratch]");
761 if (buf->b_fname == NULL)
762 diff -Naur vim72.orig/src/config.h.in vim72/src/config.h.in
763 --- vim72.orig/src/config.h.in 2008-06-21 08:01:41.000000000 -0700
764 +++ vim72/src/config.h.in 2009-03-12 11:55:13.667618383 -0700
766 /* Define to empty if the keyword does not work. */
769 +/* Define to empty if the keyword does not work. */
772 /* Define to `int' if <sys/types.h> doesn't define. */
775 diff -Naur vim72.orig/src/configure.in vim72/src/configure.in
776 --- vim72.orig/src/configure.in 2008-07-24 05:40:26.000000000 -0700
777 +++ vim72/src/configure.in 2009-03-12 11:55:13.667618383 -0700
778 @@ -2148,6 +2148,7 @@
779 dnl Checks for typedefs, structures, and compiler characteristics.
780 AC_PROG_GCC_TRADITIONAL
786 @@ -3152,18 +3153,25 @@
787 dnl But only when making dependencies, cproto and lint don't take "-isystem".
788 dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
789 dnl the number before the version number.
790 -AC_MSG_CHECKING(for GCC 3 or later)
791 DEPEND_CFLAGS_FILTER=
792 if test "$GCC" = yes; then
793 + AC_MSG_CHECKING(for GCC 3 or later)
794 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
795 if test "$gccmajor" -gt "2"; then
796 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
801 + dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
802 + dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
803 + AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
804 + if test "$gccmajor" -gt "3"; then
805 + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
811 -if test "$DEPEND_CFLAGS_FILTER" = ""; then
816 AC_SUBST(DEPEND_CFLAGS_FILTER)
818 diff -Naur vim72.orig/src/diff.c vim72/src/diff.c
819 --- vim72.orig/src/diff.c 2008-03-05 03:16:56.000000000 -0800
820 +++ vim72/src/diff.c 2009-03-12 11:55:16.155775667 -0700
825 - * diff.c: code for diff'ing two or three buffers.
826 + * diff.c: code for diff'ing two, three or four buffers.
832 tp->tp_diffbuf[i] = NULL;
833 tp->tp_diff_invalid = TRUE;
841 curtab->tp_diffbuf[i] = NULL;
842 curtab->tp_diff_invalid = TRUE;
848 * Add a buffer to make diffs for.
849 * Call this when a new buffer is being edited in the current window where
851 - * Marks the current buffer as being part of the diff and requireing updating.
852 + * Marks the current buffer as being part of the diff and requiring updating.
853 * This must be done before any autocmd, because a command may use info
854 * about the screen contents.
858 curtab->tp_diffbuf[i] = buf;
859 curtab->tp_diff_invalid = TRUE;
868 + int io_error = FALSE;
870 /* Delete all diffblocks. */
872 @@ -697,18 +702,26 @@
875 fd = mch_fopen((char *)tmp_orig, "w");
881 - fwrite("line1\n", (size_t)6, (size_t)1, fd);
882 + if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1)
885 fd = mch_fopen((char *)tmp_new, "w");
891 - fwrite("line2\n", (size_t)6, (size_t)1, fd);
892 + if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1)
895 diff_file(tmp_orig, tmp_new, tmp_diff);
896 fd = mch_fopen((char *)tmp_diff, "r");
902 char_u linebuf[LBUFLEN];
909 + EMSG(_("E810: Cannot read or write temp files"));
910 EMSG(_("E97: Cannot create diffs"));
911 diff_a_works = MAYBE;
912 #if defined(MSWIN) || defined(MSDOS)
917 - /* Temporaraly chdir to /tmp, to avoid patching files in the current
918 + /* Temporarily chdir to /tmp, to avoid patching files in the current
919 * directory when the patch file contains more than one patch. When we
920 * have our own temp dir use that instead, it will be cleaned up when we
921 * exit (any .rej files created). Don't change directory if we can't
922 @@ -925,10 +940,10 @@
925 if (vim_tempdir != NULL)
926 - mch_chdir((char *)vim_tempdir);
927 + ignored = mch_chdir((char *)vim_tempdir);
931 + ignored = mch_chdir("/tmp");
932 shorten_fnames(TRUE);
935 @@ -1138,7 +1153,7 @@
937 for (wp = firstwin; wp != NULL; wp = wp->w_next)
939 - if (wp == curwin || eap->forceit)
940 + if (wp == curwin || (eap->forceit && wp->w_p_diff))
942 /* Set 'diff', 'scrollbind' off and 'wrap' on. */
943 wp->w_p_diff = FALSE;
944 @@ -2114,6 +2129,8 @@
945 EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg);
949 + return; /* nothing to do */
950 idx_other = diff_buf_idx(buf);
951 if (idx_other == DB_COUNT)
953 diff -Naur vim72.orig/src/edit.c vim72/src/edit.c
954 --- vim72.orig/src/edit.c 2008-08-06 05:51:17.000000000 -0700
955 +++ vim72/src/edit.c 2009-03-12 11:55:13.411601900 -0700
957 static int ins_compl_bs __ARGS((void));
958 static void ins_compl_new_leader __ARGS((void));
959 static void ins_compl_addleader __ARGS((int c));
960 +static int ins_compl_len __ARGS((void));
961 static void ins_compl_restart __ARGS((void));
962 static void ins_compl_set_original_text __ARGS((char_u *str));
963 static void ins_compl_addfrommatch __ARGS((void));
965 static void mb_replace_pop_ins __ARGS((int cc));
967 static void replace_flush __ARGS((void));
968 -static void replace_do_bs __ARGS((void));
969 +static void replace_do_bs __ARGS((int limit_col));
970 +static int del_char_after_col __ARGS((int limit_col));
972 static int cindent_on __ARGS((void));
974 @@ -1933,6 +1935,8 @@
976 * Backspace the cursor until the given column. Handles REPLACE and VREPLACE
977 * modes correctly. May also be used when not in insert mode at all.
978 + * Will attempt not to go before "col" even when there is a composing
982 backspace_until_column(col)
983 @@ -1942,13 +1946,50 @@
985 curwin->w_cursor.col--;
986 if (State & REPLACE_FLAG)
989 - (void)del_char(FALSE);
990 + replace_do_bs(col);
991 + else if (!del_char_after_col(col))
998 + * Like del_char(), but make sure not to go before column "limit_col".
999 + * Only matters when there are composing characters.
1000 + * Return TRUE when something was deleted.
1004 +del_char_after_col(limit_col)
1008 + if (enc_utf8 && limit_col >= 0)
1010 + int ecol = curwin->w_cursor.col + 1;
1012 + /* Make sure the cursor is at the start of a character, but
1013 + * skip forward again when going too far back because of a
1014 + * composing character. */
1015 + mb_adjust_cursor();
1016 + while (curwin->w_cursor.col < (colnr_T)limit_col)
1018 + int l = utf_ptr2len(ml_get_cursor());
1020 + if (l == 0) /* end of line */
1022 + curwin->w_cursor.col += l;
1024 + if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol)
1026 + del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE);
1030 + (void)del_char(FALSE);
1034 #if defined(FEAT_INS_EXPAND) || defined(PROTO)
1036 * CTRL-X pressed in Insert mode.
1037 @@ -2418,7 +2459,7 @@
1039 had_match = (curwin->w_cursor.col > compl_col);
1041 - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
1042 + ins_bytes(compl_leader + ins_compl_len());
1045 /* When the match isn't there (to avoid matching itself) remove it
1046 @@ -2470,7 +2511,7 @@
1048 had_match = (curwin->w_cursor.col > compl_col);
1050 - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
1051 + ins_bytes(compl_leader + ins_compl_len());
1054 /* When the match isn't there (to avoid matching itself) remove it
1055 @@ -3209,7 +3250,7 @@
1057 ins_compl_del_pum();
1059 - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
1060 + ins_bytes(compl_leader + ins_compl_len());
1061 compl_used_match = FALSE;
1064 @@ -3264,6 +3305,20 @@
1068 + * Return the length of the completion, from the completion start column to
1069 + * the cursor column. Making sure it never goes below zero.
1074 + int off = curwin->w_cursor.col - compl_col;
1082 * Append one character to the match leader. May reduce the number of
1085 @@ -3621,10 +3676,9 @@
1088 if (compl_leader != NULL)
1089 - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
1090 + ins_bytes(compl_leader + ins_compl_len());
1091 else if (compl_first_match != NULL)
1092 - ins_bytes(compl_orig_text
1093 - + curwin->w_cursor.col - compl_col);
1094 + ins_bytes(compl_orig_text + ins_compl_len());
1098 @@ -4187,7 +4241,7 @@
1101 /* check if compl_curr_match has changed, (e.g. other type of
1102 - * expansion added somenthing) */
1103 + * expansion added something) */
1104 if (type != 0 && compl_curr_match != old_match)
1105 found_new_match = OK;
1107 @@ -4256,7 +4310,7 @@
1111 - ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col);
1112 + ins_bytes(compl_shown_match->cp_str + ins_compl_len());
1113 if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
1114 compl_used_match = FALSE;
1116 @@ -4425,7 +4479,7 @@
1117 if (!compl_get_longest || compl_used_match)
1120 - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
1121 + ins_bytes(compl_leader + ins_compl_len());
1124 compl_used_match = FALSE;
1125 @@ -4688,7 +4742,7 @@
1127 compl_length = curwin->w_cursor.col - (int)compl_col;
1128 /* IObuff is used to add a "word from the next line" would we
1129 - * have enough space? just being paranoic */
1130 + * have enough space? just being paranoid */
1131 #define MIN_SPACE 75
1132 if (compl_length > (IOSIZE - MIN_SPACE))
1134 @@ -7123,9 +7177,12 @@
1135 * cc == 0: character was inserted, delete it
1136 * cc > 0: character was replaced, put cc (first byte of original char) back
1137 * and check for more characters to be put back
1138 + * When "limit_col" is >= 0, don't delete before this column. Matters when
1139 + * using composing characters, use del_char_after_col() instead of del_char().
1143 +replace_do_bs(limit_col)
1147 #ifdef FEAT_VREPLACE
1148 @@ -7153,7 +7210,7 @@
1153 + (void)del_char_after_col(limit_col);
1154 # ifdef FEAT_VREPLACE
1155 if (State & VREPLACE_FLAG)
1156 orig_len = (int)STRLEN(ml_get_cursor());
1157 @@ -7203,7 +7260,7 @@
1158 changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
1161 - (void)del_char(FALSE);
1162 + (void)del_char_after_col(limit_col);
1166 @@ -7646,9 +7703,7 @@
1169 regname = plain_vgetc();
1170 -#ifdef FEAT_LANGMAP
1171 LANGMAP_ADJUST(regname, TRUE);
1173 if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P)
1175 /* Get a third key for literal register insertion */
1176 @@ -7657,9 +7712,7 @@
1177 add_to_showcmd_c(literally);
1179 regname = plain_vgetc();
1180 -#ifdef FEAT_LANGMAP
1181 LANGMAP_ADJUST(regname, TRUE);
1186 @@ -8150,7 +8203,7 @@
1188 * If the cursor is on an indent, ^T/^D insert/delete one
1189 * shiftwidth. Otherwise ^T/^D behave like a "<<" or ">>".
1190 - * Always round the indent to 'shiftwith', this is compatible
1191 + * Always round the indent to 'shiftwidth', this is compatible
1192 * with vi. But vi only supports ^T and ^D after an
1193 * autoindent, we support it everywhere.
1195 @@ -8239,7 +8292,7 @@
1197 if (curwin->w_cursor.lnum != Insstart.lnum
1198 || curwin->w_cursor.col >= Insstart.col)
1200 + replace_do_bs(-1);
1203 (void)del_char(FALSE);
1204 @@ -8556,7 +8609,7 @@
1207 if (State & REPLACE_FLAG)
1209 + replace_do_bs(-1);
1213 diff -Naur vim72.orig/src/eval.c vim72/src/eval.c
1214 --- vim72.orig/src/eval.c 2008-08-07 12:37:22.000000000 -0700
1215 +++ vim72/src/eval.c 2009-03-12 11:55:08.231269731 -0700
1218 #define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
1220 +#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not
1224 * In a hashtab item "hi_key" points to "di_key" in a dictitem.
1225 * This avoids adding a pointer to the hashtab item.
1227 {VV_NAME("mouse_col", VAR_NUMBER), 0},
1228 {VV_NAME("operator", VAR_STRING), VV_RO},
1229 {VV_NAME("searchforward", VAR_NUMBER), 0},
1230 + {VV_NAME("oldfiles", VAR_LIST), 0},
1235 #define vv_nr vv_di.di_tv.vval.v_number
1236 #define vv_float vv_di.di_tv.vval.v_float
1237 #define vv_str vv_di.di_tv.vval.v_string
1238 +#define vv_list vv_di.di_tv.vval.v_list
1239 #define vv_tv vv_di.di_tv
1243 static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
1244 static void list_append __ARGS((list_T *l, listitem_T *item));
1245 static int list_append_tv __ARGS((list_T *l, typval_T *tv));
1246 -static int list_append_string __ARGS((list_T *l, char_u *str, int len));
1247 static int list_append_number __ARGS((list_T *l, varnumber_T n));
1248 static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
1249 static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef));
1251 static void func_unref __ARGS((char_u *name));
1252 static void func_ref __ARGS((char_u *name));
1253 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));
1254 +static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ;
1255 +static void free_funccal __ARGS((funccall_T *fc, int free_val));
1256 static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr));
1257 static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp));
1258 static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
1259 @@ -845,11 +851,17 @@
1261 if (p->vv_di.di_tv.v_type == VAR_STRING)
1263 - vim_free(p->vv_di.di_tv.vval.v_string);
1264 - p->vv_di.di_tv.vval.v_string = NULL;
1265 + vim_free(p->vv_str);
1268 + else if (p->vv_di.di_tv.v_type == VAR_LIST)
1270 + list_unref(p->vv_list);
1271 + p->vv_list = NULL;
1274 hash_clear(&vimvarht);
1275 + hash_init(&vimvarht); /* garbage_collect() will access it */
1276 hash_clear(&compat_hashtab);
1278 /* script-local variables */
1279 @@ -916,6 +928,10 @@
1280 /* pointer to funccal for currently active function */
1281 funccall_T *current_funccal = NULL;
1283 +/* pointer to list of previously used funccal, still around because some
1284 + * item in it is still being used. */
1285 +funccall_T *previous_funccal = NULL;
1288 * Return TRUE when a function was ended by a ":return" command.
1290 @@ -1256,23 +1272,26 @@
1293 * Top level evaluation function, returning a string.
1294 + * When "convert" is TRUE convert a List into a sequence of lines and convert
1295 + * a Float to a String.
1296 * Return pointer to allocated memory, or NULL for failure.
1299 -eval_to_string(arg, nextcmd, dolist)
1300 +eval_to_string(arg, nextcmd, convert)
1303 - int dolist; /* turn List into sequence of lines */
1309 + char_u numbuf[NUMBUFLEN];
1311 if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
1315 - if (dolist && tv.v_type == VAR_LIST)
1316 + if (convert && tv.v_type == VAR_LIST)
1318 ga_init2(&ga, (int)sizeof(char), 80);
1319 if (tv.vval.v_list != NULL)
1320 @@ -1280,6 +1299,13 @@
1321 ga_append(&ga, NUL);
1322 retval = (char_u *)ga.ga_data;
1325 + else if (convert && tv.v_type == VAR_FLOAT)
1327 + vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
1328 + retval = vim_strsave(numbuf);
1332 retval = vim_strsave(get_tv_string(&tv));
1334 @@ -3277,7 +3303,7 @@
1336 if (*startarg != '(')
1338 - EMSG2(_("E107: Missing braces: %s"), eap->arg);
1339 + EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
1343 @@ -3657,8 +3683,8 @@
1347 - * Return TRUE if typeval "tv" is locked: Either tha value is locked itself or
1348 - * it refers to a List or Dictionary that is locked.
1349 + * Return TRUE if typeval "tv" is locked: Either that value is locked itself
1350 + * or it refers to a List or Dictionary that is locked.
1354 @@ -3902,7 +3928,7 @@
1357 * Handle top level expression:
1358 - * expr1 ? expr0 : expr0
1359 + * expr2 ? expr1 : expr1
1361 * "arg" must point to the first non-white of the expression.
1362 * "arg" is advanced to the next non-white after the recognized expression.
1363 @@ -6047,6 +6073,25 @@
1367 + * Get list item "l[idx - 1]" as a string. Returns NULL for failure.
1370 +list_find_str(l, idx)
1376 + li = list_find(l, idx - 1);
1379 + EMSGN(_(e_listidx), idx);
1382 + return get_tv_string(&li->li_tv);
1386 * Locate "item" list "l" and return its index.
1387 * Returns -1 when "item" is not in the list.
1389 @@ -6137,7 +6182,7 @@
1390 * When "len" >= 0 use "str[len]".
1391 * Returns FAIL when out of memory.
1395 list_append_string(l, str, len)
1398 @@ -6454,7 +6499,7 @@
1403 + funccall_T *fc, **pfc;
1404 int did_free = FALSE;
1407 @@ -6497,6 +6542,9 @@
1408 set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
1412 + set_ref_in_ht(&vimvarht, copyID);
1415 * 2. Go through the list of dicts and free items without the copyID.
1417 @@ -6535,6 +6583,20 @@
1419 ll = ll->lv_used_next;
1421 + /* check if any funccal can be freed now */
1422 + for (pfc = &previous_funccal; *pfc != NULL; )
1424 + if (can_free_funccal(*pfc, copyID))
1427 + *pfc = fc->caller;
1428 + free_funccal(fc, TRUE);
1432 + pfc = &(*pfc)->caller;
1438 @@ -6587,7 +6649,7 @@
1441 dd = tv->vval.v_dict;
1442 - if (dd->dv_copyID != copyID)
1443 + if (dd != NULL && dd->dv_copyID != copyID)
1445 /* Didn't see this dict yet. */
1446 dd->dv_copyID = copyID;
1447 @@ -6597,7 +6659,7 @@
1450 ll = tv->vval.v_list;
1451 - if (ll->lv_copyID != copyID)
1452 + if (ll != NULL && ll->lv_copyID != copyID)
1454 /* Didn't see this list yet. */
1455 ll->lv_copyID = copyID;
1456 @@ -7525,8 +7587,8 @@
1457 {"getwinposx", 0, 0, f_getwinposx},
1458 {"getwinposy", 0, 0, f_getwinposy},
1459 {"getwinvar", 2, 2, f_getwinvar},
1460 - {"glob", 1, 1, f_glob},
1461 - {"globpath", 2, 2, f_globpath},
1462 + {"glob", 1, 2, f_glob},
1463 + {"globpath", 2, 3, f_globpath},
1464 {"has", 1, 1, f_has},
1465 {"has_key", 2, 2, f_has_key},
1466 {"haslocaldir", 0, 0, f_haslocaldir},
1467 @@ -7856,9 +7918,9 @@
1468 else if (!aborting())
1470 if (argcount == MAX_FUNC_ARGS)
1471 - emsg_funcname("E740: Too many arguments for function %s", name);
1472 + emsg_funcname(N_("E740: Too many arguments for function %s"), name);
1474 - emsg_funcname("E116: Invalid arguments for function %s", name);
1475 + emsg_funcname(N_("E116: Invalid arguments for function %s"), name);
1478 while (--argcount >= 0)
1479 @@ -8091,6 +8153,7 @@
1482 * Give an error message with a function name. Handle <SNR> things.
1483 + * "ermsg" is to be passed without translation, use N_() instead of _().
1486 emsg_funcname(ermsg, name)
1487 @@ -9518,7 +9581,7 @@
1490 /* When the optional second argument is non-zero, don't remove matches
1491 - * for 'suffixes' and 'wildignore' */
1492 + * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1493 if (argvars[1].v_type != VAR_UNKNOWN
1494 && get_tv_number_chk(&argvars[1], &error))
1495 flags |= WILD_KEEP_ALL;
1496 @@ -10300,7 +10363,8 @@
1497 s = get_tv_string(&argvars[0]);
1498 if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
1499 EMSG2(_(e_invarg2), s);
1500 - else if (!function_exists(s))
1501 + /* Don't check an autoload name for existence here. */
1502 + else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
1503 EMSG2(_("E700: Unknown function: %s"), s);
1506 @@ -10602,7 +10666,7 @@
1507 # ifdef FEAT_WINDOWS
1513 if (row >= 0 && col >= 0)
1515 @@ -10612,9 +10676,9 @@
1516 (void)mouse_comp_pos(win, &row, &col, &lnum);
1517 # ifdef FEAT_WINDOWS
1518 for (wp = firstwin; wp != win; wp = wp->w_next)
1522 - vimvars[VV_MOUSE_WIN].vv_nr = n;
1523 + vimvars[VV_MOUSE_WIN].vv_nr = winnr;
1524 vimvars[VV_MOUSE_LNUM].vv_nr = lnum;
1525 vimvars[VV_MOUSE_COL].vv_nr = col + 1;
1527 @@ -11284,13 +11348,25 @@
1531 + int flags = WILD_SILENT|WILD_USE_NL;
1533 + int error = FALSE;
1536 - xpc.xp_context = EXPAND_FILES;
1537 + /* When the optional second argument is non-zero, don't remove matches
1538 + * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1539 + if (argvars[1].v_type != VAR_UNKNOWN
1540 + && get_tv_number_chk(&argvars[1], &error))
1541 + flags |= WILD_KEEP_ALL;
1542 rettv->v_type = VAR_STRING;
1543 - rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1544 - NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
1548 + xpc.xp_context = EXPAND_FILES;
1549 + rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1550 + NULL, flags, WILD_ALL);
1553 + rettv->vval.v_string = NULL;
1557 @@ -11301,14 +11377,22 @@
1562 char_u buf1[NUMBUFLEN];
1563 char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
1564 + int error = FALSE;
1566 + /* When the optional second argument is non-zero, don't remove matches
1567 + * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1568 + if (argvars[2].v_type != VAR_UNKNOWN
1569 + && get_tv_number_chk(&argvars[2], &error))
1570 + flags |= WILD_KEEP_ALL;
1571 rettv->v_type = VAR_STRING;
1573 + if (file == NULL || error)
1574 rettv->vval.v_string = NULL;
1576 - rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
1577 + rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
1582 @@ -11782,6 +11866,10 @@
1583 n = has_patch(atoi((char *)name + 5));
1584 else if (STRICMP(name, "vim_starting") == 0)
1585 n = (starting != 0);
1587 + else if (STRICMP(name, "multi_byte_encoding") == 0)
1590 #if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32)
1591 else if (STRICMP(name, "balloon_multiline") == 0)
1592 n = multiline_balloon_available();
1593 @@ -15838,10 +15926,9 @@
1595 res = ITEM_COMPARE_FAIL;
1597 - /* return value has wrong type */
1598 res = get_tv_number_chk(&rettv, &item_compare_func_err);
1599 if (item_compare_func_err)
1600 - res = ITEM_COMPARE_FAIL;
1601 + res = ITEM_COMPARE_FAIL; /* return value has wrong type */
1605 @@ -16590,8 +16677,11 @@
1606 p = highlight_has_attr(id, HL_INVERSE, modec);
1609 - case 's': /* standout */
1610 - p = highlight_has_attr(id, HL_STANDOUT, modec);
1612 + if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */
1613 + p = highlight_color(id, what, modec);
1614 + else /* standout */
1615 + p = highlight_has_attr(id, HL_STANDOUT, modec);
1619 @@ -16658,7 +16748,7 @@
1620 col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
1622 if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
1623 - && col >= 0 && col < (long)STRLEN(ml_get(lnum))
1624 + && col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum)))
1625 && rettv_list_alloc(rettv) != FAIL)
1627 (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
1628 @@ -18097,14 +18187,28 @@
1632 - * Set v:count, v:count1 and v:prevcount.
1633 + * Get List v: variable value. Caller must take care of reference count when
1637 +get_vim_var_list(idx)
1640 + return vimvars[idx].vv_list;
1644 + * Set v:count to "count" and v:count1 to "count1".
1645 + * When "set_prevcount" is TRUE first set v:prevcount from v:count.
1648 -set_vcount(count, count1)
1649 +set_vcount(count, count1, set_prevcount)
1652 + int set_prevcount;
1654 - vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
1655 + if (set_prevcount)
1656 + vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
1657 vimvars[VV_COUNT].vv_nr = count;
1658 vimvars[VV_COUNT1].vv_nr = count1;
1660 @@ -18132,6 +18236,20 @@
1664 + * Set List v: variable to "val".
1667 +set_vim_var_list(idx, val)
1671 + list_unref(vimvars[idx].vv_list);
1672 + vimvars[idx].vv_list = val;
1674 + ++val->lv_refcount;
1678 * Set v:register if needed.
1681 @@ -18868,7 +18986,7 @@
1682 dictitem_T *dict_var;
1684 hash_init(&dict->dv_hashtab);
1685 - dict->dv_refcount = 99999;
1686 + dict->dv_refcount = DO_NOT_FREE_CNT;
1687 dict_var->di_tv.vval.v_dict = dict;
1688 dict_var->di_tv.v_type = VAR_DICT;
1689 dict_var->di_tv.v_lock = VAR_FIXED;
1690 @@ -19205,6 +19323,8 @@
1691 * Copy the values from typval_T "from" to typval_T "to".
1692 * When needed allocates string or increases reference count.
1693 * Does not make a copy of a list or dict but copies the reference!
1694 + * It is OK for "from" and "to" to point to the same item. This is used to
1695 + * make a copy later.
1699 @@ -19748,7 +19868,7 @@
1703 - emsg_funcname("E123: Undefined function: %s", name);
1704 + emsg_funcname(N_("E123: Undefined function: %s"), name);
1708 @@ -19792,7 +19912,7 @@
1709 : eval_isnamec(arg[j])))
1712 - emsg_funcname(_(e_invarg2), arg);
1713 + emsg_funcname((char *)e_invarg2, arg);
1717 @@ -20064,7 +20184,7 @@
1718 v = find_var(name, &ht);
1719 if (v != NULL && v->di_tv.v_type == VAR_FUNC)
1721 - emsg_funcname("E707: Function name conflicts with variable: %s",
1722 + emsg_funcname(N_("E707: Function name conflicts with variable: %s"),
1726 @@ -20079,7 +20199,7 @@
1728 if (fp->uf_calls > 0)
1730 - emsg_funcname("E127: Cannot redefine function %s: It is in use",
1731 + emsg_funcname(N_("E127: Cannot redefine function %s: It is in use"),
1735 @@ -20590,6 +20710,9 @@
1738 todo = (int)func_hashtab.ht_used;
1740 + return; /* nothing to dump */
1742 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
1744 for (hi = func_hashtab.ht_array; todo > 0; ++hi)
1745 @@ -20638,6 +20761,8 @@
1747 prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
1750 + vim_free(sorttab);
1754 @@ -21012,7 +21137,7 @@
1755 char_u *save_sourcing_name;
1756 linenr_T save_sourcing_lnum;
1757 scid_T save_current_SID;
1761 static int depth = 0;
1763 @@ -21038,36 +21163,37 @@
1765 line_breakcheck(); /* check for CTRL-C hit */
1767 - fc.caller = current_funccal;
1768 - current_funccal = &fc;
1771 + fc = (funccall_T *)alloc(sizeof(funccall_T));
1772 + fc->caller = current_funccal;
1773 + current_funccal = fc;
1775 + fc->rettv = rettv;
1776 rettv->vval.v_number = 0;
1778 - fc.returned = FALSE;
1779 - fc.level = ex_nesting_level;
1781 + fc->returned = FALSE;
1782 + fc->level = ex_nesting_level;
1783 /* Check if this function has a breakpoint. */
1784 - fc.breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
1785 - fc.dbg_tick = debug_tick;
1786 + fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
1787 + fc->dbg_tick = debug_tick;
1790 - * Note about using fc.fixvar[]: This is an array of FIXVAR_CNT variables
1791 + * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables
1792 * with names up to VAR_SHORT_LEN long. This avoids having to alloc/free
1793 * each argument variable and saves a lot of time.
1796 * Init l: variables.
1798 - init_var_dict(&fc.l_vars, &fc.l_vars_var);
1799 + init_var_dict(&fc->l_vars, &fc->l_vars_var);
1800 if (selfdict != NULL)
1802 /* Set l:self to "selfdict". Use "name" to avoid a warning from
1803 * some compiler that checks the destination size. */
1804 - v = &fc.fixvar[fixvar_idx++].var;
1805 + v = &fc->fixvar[fixvar_idx++].var;
1807 STRCPY(name, "self");
1808 v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX;
1809 - hash_add(&fc.l_vars.dv_hashtab, DI2HIKEY(v));
1810 + hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
1811 v->di_tv.v_type = VAR_DICT;
1812 v->di_tv.v_lock = 0;
1813 v->di_tv.vval.v_dict = selfdict;
1814 @@ -21079,28 +21205,31 @@
1815 * Set a:0 to "argcount".
1816 * Set a:000 to a list with room for the "..." arguments.
1818 - init_var_dict(&fc.l_avars, &fc.l_avars_var);
1819 - add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
1820 + init_var_dict(&fc->l_avars, &fc->l_avars_var);
1821 + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0",
1822 (varnumber_T)(argcount - fp->uf_args.ga_len));
1823 - v = &fc.fixvar[fixvar_idx++].var;
1824 - STRCPY(v->di_key, "000");
1825 + /* Use "name" to avoid a warning from some compiler that checks the
1826 + * destination size. */
1827 + v = &fc->fixvar[fixvar_idx++].var;
1829 + STRCPY(name, "000");
1830 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
1831 - hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
1832 + hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
1833 v->di_tv.v_type = VAR_LIST;
1834 v->di_tv.v_lock = VAR_FIXED;
1835 - v->di_tv.vval.v_list = &fc.l_varlist;
1836 - vim_memset(&fc.l_varlist, 0, sizeof(list_T));
1837 - fc.l_varlist.lv_refcount = 99999;
1838 - fc.l_varlist.lv_lock = VAR_FIXED;
1839 + v->di_tv.vval.v_list = &fc->l_varlist;
1840 + vim_memset(&fc->l_varlist, 0, sizeof(list_T));
1841 + fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
1842 + fc->l_varlist.lv_lock = VAR_FIXED;
1845 * Set a:firstline to "firstline" and a:lastline to "lastline".
1846 * Set a:name to named arguments.
1847 * Set a:N to the "..." arguments.
1849 - add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "firstline",
1850 + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline",
1851 (varnumber_T)firstline);
1852 - add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "lastline",
1853 + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline",
1854 (varnumber_T)lastline);
1855 for (i = 0; i < argcount; ++i)
1857 @@ -21116,7 +21245,7 @@
1859 if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN)
1861 - v = &fc.fixvar[fixvar_idx++].var;
1862 + v = &fc->fixvar[fixvar_idx++].var;
1863 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
1866 @@ -21128,7 +21257,7 @@
1867 v->di_flags = DI_FLAGS_RO;
1869 STRCPY(v->di_key, name);
1870 - hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
1871 + hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
1873 /* Note: the values are copied directly to avoid alloc/free.
1874 * "argvars" must have VAR_FIXED for v_lock. */
1875 @@ -21137,9 +21266,9 @@
1877 if (ai >= 0 && ai < MAX_FUNC_ARGS)
1879 - list_append(&fc.l_varlist, &fc.l_listitems[ai]);
1880 - fc.l_listitems[ai].li_tv = argvars[i];
1881 - fc.l_listitems[ai].li_tv.v_lock = VAR_FIXED;
1882 + list_append(&fc->l_varlist, &fc->l_listitems[ai]);
1883 + fc->l_listitems[ai].li_tv = argvars[i];
1884 + fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED;
1888 @@ -21204,7 +21333,7 @@
1889 if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
1890 func_do_profile(fp);
1891 if (fp->uf_profiling
1892 - || (fc.caller != NULL && &fc.caller->func->uf_profiling))
1893 + || (fc->caller != NULL && fc->caller->func->uf_profiling))
1896 profile_start(&call_start);
1897 @@ -21220,7 +21349,7 @@
1900 /* call do_cmdline() to execute the lines */
1901 - do_cmdline(NULL, get_func_line, (void *)&fc,
1902 + do_cmdline(NULL, get_func_line, (void *)fc,
1903 DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
1905 --RedrawingDisabled;
1906 @@ -21235,16 +21364,16 @@
1909 if (do_profiling == PROF_YES && (fp->uf_profiling
1910 - || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
1911 + || (fc->caller != NULL && fc->caller->func->uf_profiling)))
1913 profile_end(&call_start);
1914 profile_sub_wait(&wait_start, &call_start);
1915 profile_add(&fp->uf_tm_total, &call_start);
1916 profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
1917 - if (fc.caller != NULL && &fc.caller->func->uf_profiling)
1918 + if (fc->caller != NULL && fc->caller->func->uf_profiling)
1920 - profile_add(&fc.caller->func->uf_tm_children, &call_start);
1921 - profile_add(&fc.caller->func->uf_tml_children, &call_start);
1922 + profile_add(&fc->caller->func->uf_tm_children, &call_start);
1923 + profile_add(&fc->caller->func->uf_tml_children, &call_start);
1927 @@ -21257,9 +21386,9 @@
1930 smsg((char_u *)_("%s aborted"), sourcing_name);
1931 - else if (fc.rettv->v_type == VAR_NUMBER)
1932 + else if (fc->rettv->v_type == VAR_NUMBER)
1933 smsg((char_u *)_("%s returning #%ld"), sourcing_name,
1934 - (long)fc.rettv->vval.v_number);
1935 + (long)fc->rettv->vval.v_number);
1938 char_u buf[MSG_BUF_LEN];
1939 @@ -21270,7 +21399,7 @@
1940 /* The value may be very long. Skip the middle part, so that we
1941 * have some idea how it starts and ends. smsg() would always
1942 * truncate it at the end. */
1943 - s = tv2string(fc.rettv, &tofree, numbuf2, 0);
1944 + s = tv2string(fc->rettv, &tofree, numbuf2, 0);
1947 trunc_string(s, buf, MSG_BUF_CLEN);
1948 @@ -21306,14 +21435,84 @@
1951 did_emsg |= save_did_emsg;
1952 - current_funccal = fc.caller;
1953 + current_funccal = fc->caller;
1956 - /* The a: variables typevals were not allocated, only free the allocated
1958 - vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE);
1959 + /* if the a:000 list and the a: dict are not referenced we can free the
1960 + * funccall_T and what's in it. */
1961 + if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT
1962 + && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT
1963 + && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT)
1965 + free_funccal(fc, FALSE);
1973 - vars_clear(&fc.l_vars.dv_hashtab); /* free all l: variables */
1975 + /* "fc" is still in use. This can happen when returning "a:000" or
1976 + * assigning "l:" to a global variable.
1977 + * Link "fc" in the list for garbage collection later. */
1978 + fc->caller = previous_funccal;
1979 + previous_funccal = fc;
1981 + /* Make a copy of the a: variables, since we didn't do that above. */
1982 + todo = (int)fc->l_avars.dv_hashtab.ht_used;
1983 + for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
1985 + if (!HASHITEM_EMPTY(hi))
1989 + copy_tv(&v->di_tv, &v->di_tv);
1993 + /* Make a copy of the a:000 items, since we didn't do that above. */
1994 + for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
1995 + copy_tv(&li->li_tv, &li->li_tv);
2000 + * Return TRUE if items in "fc" do not have "copyID". That means they are not
2001 + * referenced from anywhere.
2004 +can_free_funccal(fc, copyID)
2008 + return (fc->l_varlist.lv_copyID != copyID
2009 + && fc->l_vars.dv_copyID != copyID
2010 + && fc->l_avars.dv_copyID != copyID);
2014 + * Free "fc" and what it contains.
2017 +free_funccal(fc, free_val)
2019 + int free_val; /* a: vars were allocated */
2023 + /* The a: variables typevals may not have been allocated, only free the
2024 + * allocated variables. */
2025 + vars_clear_ext(&fc->l_avars.dv_hashtab, free_val);
2027 + /* free all l: variables */
2028 + vars_clear(&fc->l_vars.dv_hashtab);
2030 + /* Free the a:000 variables if they were allocated. */
2032 + for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
2033 + clear_tv(&li->li_tv);
2039 @@ -21886,6 +22085,62 @@
2044 + * List v:oldfiles in a nice way.
2051 + list_T *l = vimvars[VV_OLDFILES].vv_list;
2056 + msg((char_u *)_("No old files"));
2060 + msg_scroll = TRUE;
2061 + for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
2063 + msg_outnum((long)++nr);
2065 + msg_outtrans(get_tv_string(&li->li_tv));
2066 + msg_putchar('\n');
2067 + out_flush(); /* output one line at a time */
2070 + /* Assume "got_int" was set to truncate the listing. */
2073 +#ifdef FEAT_BROWSE_CMD
2074 + if (cmdmod.browse)
2076 + quit_more = FALSE;
2077 + nr = prompt_for_number(FALSE);
2081 + char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
2086 + p = expand_env_save(p);
2088 + eap->cmdidx = CMD_edit;
2089 + cmdmod.browse = FALSE;
2090 + do_exedit(eap, NULL);
2099 #endif /* FEAT_EVAL */
2102 diff -Naur vim72.orig/src/ex_cmds2.c vim72/src/ex_cmds2.c
2103 --- vim72.orig/src/ex_cmds2.c 2008-07-13 09:18:22.000000000 -0700
2104 +++ vim72/src/ex_cmds2.c 2009-03-12 11:55:13.311593519 -0700
2105 @@ -2842,6 +2842,7 @@
2106 linenr_T save_sourcing_lnum;
2109 + char_u *firstline = NULL;
2112 scid_T save_current_SID;
2113 @@ -2992,23 +2993,6 @@
2115 cookie.level = ex_nesting_level;
2118 - cookie.conv.vc_type = CONV_NONE; /* no conversion */
2120 - /* Try reading the first few bytes to check for a UTF-8 BOM. */
2124 - if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)
2126 - && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
2127 - /* Found BOM, setup conversion and skip over it. */
2128 - convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
2130 - /* No BOM found, rewind. */
2131 - fseek(cookie.fp, 0L, SEEK_SET);
2136 * Keep the sourcing name/lnum, for recursive calls.
2137 @@ -3018,6 +3002,27 @@
2138 save_sourcing_lnum = sourcing_lnum;
2142 + cookie.conv.vc_type = CONV_NONE; /* no conversion */
2144 + /* Read the first line so we can check for a UTF-8 BOM. */
2145 + firstline = getsourceline(0, (void *)&cookie, 0);
2146 + if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
2147 + && firstline[1] == 0xbb && firstline[2] == 0xbf)
2149 + /* Found BOM; setup conversion, skip over BOM and recode the line. */
2150 + convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
2151 + p = string_convert(&cookie.conv, firstline + 3, NULL);
2153 + p = vim_strsave(firstline + 3);
2156 + vim_free(firstline);
2163 time_push(&tv_rel, &tv_start);
2165 @@ -3111,9 +3116,8 @@
2167 * Call do_cmdline, which will call getsourceline() to get the lines.
2169 - do_cmdline(NULL, getsourceline, (void *)&cookie,
2170 + do_cmdline(firstline, getsourceline, (void *)&cookie,
2171 DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
2176 @@ -3145,8 +3149,8 @@
2180 - vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname);
2181 - time_msg(IObuff, &tv_start);
2182 + vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
2183 + time_msg((char *)IObuff, &tv_start);
2187 @@ -3171,6 +3175,7 @@
2190 vim_free(cookie.nextline);
2191 + vim_free(firstline);
2193 convert_setup(&cookie.conv, NULL, NULL);
2195 diff -Naur vim72.orig/src/ex_cmds.c vim72/src/ex_cmds.c
2196 --- vim72.orig/src/ex_cmds.c 2008-08-04 12:15:00.000000000 -0700
2197 +++ vim72/src/ex_cmds.c 2009-03-12 11:55:13.611614471 -0700
2199 static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out));
2201 static char_u *viminfo_filename __ARGS((char_u *));
2202 -static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read));
2203 +static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags));
2204 static int viminfo_encoding __ARGS((vir_T *virp));
2205 static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing));
2217 if (c == NL) /* NUL is stored as NL */
2219 + if (c == CAR && get_fileformat(curbuf) == EOL_MAC)
2220 + cval = NL; /* NL is stored as CR */
2223 if (vim_isprintc_strict(c) && (c < ' '
2228 vim_snprintf((char *)IObuff, IOSIZE,
2229 _("<%s>%s%s %d, Hex %02x, Octal %03o"),
2230 - transchar(c), buf1, buf2, c, c, c);
2231 + transchar(c), buf1, buf2, cval, cval, cval);
2235 @@ -1676,14 +1681,12 @@
2238 * read_viminfo() -- Read the viminfo file. Registers etc. which are already
2239 - * set are not over-written unless force is TRUE. -- webb
2240 + * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb
2243 -read_viminfo(file, want_info, want_marks, forceit)
2248 +read_viminfo(file, flags)
2249 + char_u *file; /* file name or NULL to use default name */
2250 + int flags; /* VIF_WANT_INFO et al. */
2254 @@ -1691,7 +1694,7 @@
2258 - fname = viminfo_filename(file); /* may set to default if NULL */
2259 + fname = viminfo_filename(file); /* get file name in allocated buffer */
2262 fp = mch_fopen((char *)fname, READBIN);
2263 @@ -1701,8 +1704,9 @@
2265 smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
2267 - want_info ? _(" info") : "",
2268 - want_marks ? _(" marks") : "",
2269 + (flags & VIF_WANT_INFO) ? _(" info") : "",
2270 + (flags & VIF_WANT_MARKS) ? _(" marks") : "",
2271 + (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "",
2272 fp == NULL ? _(" FAILED") : "");
2275 @@ -1712,10 +1716,9 @@
2279 - do_viminfo(fp, NULL, want_info, want_marks, forceit);
2280 + do_viminfo(fp, NULL, flags);
2287 @@ -1943,7 +1946,7 @@
2291 - (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
2292 + ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
2296 @@ -1968,7 +1971,7 @@
2300 - do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);
2301 + do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS));
2303 fclose(fp_out); /* errors are ignored !? */
2305 @@ -2041,12 +2044,10 @@
2306 * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
2309 -do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
2310 +do_viminfo(fp_in, fp_out, flags)
2320 @@ -2061,8 +2062,9 @@
2325 - eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL);
2326 + if (flags & VIF_WANT_INFO)
2327 + eof = read_viminfo_up_to_marks(&vir,
2328 + flags & VIF_FORCEIT, fp_out != NULL);
2330 /* Skip info, find start of marks */
2331 while (!(eof = viminfo_readline(&vir))
2332 @@ -2092,8 +2094,9 @@
2333 write_viminfo_bufferlist(fp_out);
2334 count = write_viminfo_marks(fp_out);
2336 - if (fp_in != NULL && want_marks)
2337 - copy_viminfo_marks(&vir, fp_out, count, eof);
2339 + && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
2340 + copy_viminfo_marks(&vir, fp_out, count, eof, flags);
2342 vim_free(vir.vir_line);
2344 @@ -2414,8 +2417,8 @@
2345 cursor_on(); /* msg_start() switches it off */
2347 silent_mode = save_silent;
2348 - info_message = FALSE;
2350 + info_message = FALSE;
2354 @@ -2704,7 +2707,12 @@
2355 if (eap->cmdidx == CMD_saveas)
2359 curbuf->b_p_ro = FALSE;
2360 +#ifdef FEAT_WINDOWS
2361 + redraw_tabline = TRUE;
2364 /* Change directories when the 'acd' option is set. */
2367 @@ -5059,6 +5067,7 @@
2371 + vim_free(new_start); /* for when substitute was cancelled */
2372 vim_free(sub_firstline); /* free the copy of the original line */
2373 sub_firstline = NULL;
2375 @@ -6520,6 +6529,7 @@
2376 static int last_sign_typenr = MAX_TYPENR; /* is decremented */
2378 static void sign_list_defined __ARGS((sign_T *sp));
2379 +static void sign_undefine __ARGS((sign_T *sp, sign_T *sp_prev));
2383 @@ -6728,24 +6738,8 @@
2384 /* ":sign list {name}" */
2385 sign_list_defined(sp);
2388 /* ":sign undefine {name}" */
2389 - vim_free(sp->sn_name);
2390 - vim_free(sp->sn_icon);
2391 -#ifdef FEAT_SIGN_ICONS
2392 - if (sp->sn_image != NULL)
2395 - gui_mch_destroy_sign(sp->sn_image);
2398 - vim_free(sp->sn_text);
2399 - if (sp_prev == NULL)
2400 - first_sign = sp->sn_next;
2402 - sp_prev->sn_next = sp->sn_next;
2405 + sign_undefine(sp, sp_prev);
2409 @@ -6994,6 +6988,31 @@
2413 + * Undefine a sign and free its memory.
2416 +sign_undefine(sp, sp_prev)
2420 + vim_free(sp->sn_name);
2421 + vim_free(sp->sn_icon);
2422 +#ifdef FEAT_SIGN_ICONS
2423 + if (sp->sn_image != NULL)
2426 + gui_mch_destroy_sign(sp->sn_image);
2429 + vim_free(sp->sn_text);
2430 + if (sp_prev == NULL)
2431 + first_sign = sp->sn_next;
2433 + sp_prev->sn_next = sp->sn_next;
2438 * Get highlighting attribute for sign "typenr".
2439 * If "line" is TRUE: line highl, if FALSE: text highl.
2441 @@ -7067,6 +7086,18 @@
2442 return (char_u *)_("[Deleted]");
2445 +#if defined(EXITFREE) || defined(PROTO)
2447 + * Undefine/free all signs.
2452 + while (first_sign != NULL)
2453 + sign_undefine(first_sign, NULL);
2459 #if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO)
2460 diff -Naur vim72.orig/src/ex_cmds.h vim72/src/ex_cmds.h
2461 --- vim72.orig/src/ex_cmds.h 2008-06-21 11:47:57.000000000 -0700
2462 +++ vim72/src/ex_cmds.h 2009-03-12 11:54:40.541495740 -0700
2464 EX(CMD_crewind, "crewind", ex_cc,
2465 RANGE|NOTADR|COUNT|TRLBAR|BANG),
2466 EX(CMD_cscope, "cscope", do_cscope,
2467 - EXTRA|NOTRLCOM|SBOXOK|XFILE),
2468 + EXTRA|NOTRLCOM|XFILE),
2469 EX(CMD_cstag, "cstag", do_cstag,
2471 EX(CMD_cunmap, "cunmap", ex_unmap,
2473 EX(CMD_lclose, "lclose", ex_cclose,
2474 RANGE|NOTADR|COUNT|TRLBAR),
2475 EX(CMD_lcscope, "lcscope", do_cscope,
2476 - EXTRA|NOTRLCOM|SBOXOK|XFILE),
2477 + EXTRA|NOTRLCOM|XFILE),
2478 EX(CMD_left, "left", ex_align,
2479 TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
2480 EX(CMD_leftabove, "leftabove", ex_wrongmodifier,
2482 RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2483 EX(CMD_noremap, "noremap", ex_map,
2484 BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2485 +EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier,
2486 + NEEDARG|EXTRA|NOTRLCOM),
2487 EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch,
2488 TRLBAR|SBOXOK|CMDWIN),
2489 EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate,
2491 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2492 EX(CMD_open, "open", ex_open,
2494 +EX(CMD_oldfiles, "oldfiles", ex_oldfiles,
2495 + BANG|TRLBAR|SBOXOK|CMDWIN),
2496 EX(CMD_omap, "omap", ex_map,
2497 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
2498 EX(CMD_omapclear, "omapclear", ex_mapclear,
2500 EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
2501 WORD1|TRLBAR|CMDWIN),
2502 EX(CMD_scscope, "scscope", do_scscope,
2503 - EXTRA|NOTRLCOM|SBOXOK),
2505 EX(CMD_set, "set", ex_set,
2506 TRLBAR|EXTRA|CMDWIN|SBOXOK),
2507 EX(CMD_setfiletype, "setfiletype", ex_setfiletype,
2508 diff -Naur vim72.orig/src/ex_docmd.c vim72/src/ex_docmd.c
2509 --- vim72.orig/src/ex_docmd.c 2008-07-26 04:51:05.000000000 -0700
2510 +++ vim72/src/ex_docmd.c 2009-03-12 11:55:24.900337757 -0700
2512 # define ex_function ex_ni
2513 # define ex_delfunction ex_ni
2514 # define ex_return ex_ni
2515 +# define ex_oldfiles ex_ni
2517 static char_u *arg_all __ARGS((void));
2519 @@ -1770,7 +1771,7 @@
2521 if (checkforcmd(&ea.cmd, "browse", 3))
2524 +#ifdef FEAT_BROWSE_CMD
2525 cmdmod.browse = TRUE;
2528 @@ -2978,6 +2979,7 @@
2529 {"keepmarks", 3, FALSE},
2530 {"leftabove", 5, FALSE},
2531 {"lockmarks", 3, FALSE},
2532 + {"noautocmd", 3, FALSE},
2533 {"rightbelow", 6, FALSE},
2534 {"sandbox", 3, FALSE},
2535 {"silent", 3, FALSE},
2536 @@ -3608,6 +3610,7 @@
2537 return set_context_in_autocmd(xp, arg, FALSE);
2540 + case CMD_doautoall:
2541 return set_context_in_autocmd(xp, arg, TRUE);
2544 @@ -5121,7 +5124,11 @@
2547 vim_free(cmd->uc_rep);
2549 + cmd->uc_rep = NULL;
2550 +#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
2551 + vim_free(cmd->uc_compl_arg);
2552 + cmd->uc_compl_arg = NULL;
2557 @@ -5479,6 +5486,9 @@
2567 @@ -5910,7 +5920,8 @@
2572 + char_u *end = NULL;
2576 size_t split_len = 0;
2577 @@ -5927,16 +5938,51 @@
2580 * Replace <> in the command by the arguments.
2581 + * First round: "buf" is NULL, compute length, allocate "buf".
2582 + * Second round: copy result into "buf".
2589 + p = cmd->uc_rep; /* source */
2590 + q = buf; /* destination */
2592 - while ((start = vim_strchr(p, '<')) != NULL
2593 - && (end = vim_strchr(start + 1, '>')) != NULL)
2597 + start = vim_strchr(p, '<');
2598 + if (start != NULL)
2599 + end = vim_strchr(start + 1, '>');
2602 + ksp = vim_strchr(p, K_SPECIAL);
2603 + if (ksp != NULL && (start == NULL || ksp < start || end == NULL)
2604 + && ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER)
2606 + || (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI)
2610 + /* K_SPECIAL han been put in the buffer as K_SPECIAL
2611 + * KS_SPECIAL KE_FILLER, like for mappings, but
2612 + * do_cmdline() doesn't handle that, so convert it back.
2613 + * Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */
2617 + mch_memmove(q, p, len);
2620 + *q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI;
2626 + /* break if there no <item> is found */
2627 + if (start == NULL || end == NULL)
2630 /* Include the '>' */
2633 @@ -7803,6 +7849,9 @@
2638 + vim_free(globaldir);
2643 @@ -7825,6 +7874,10 @@
2647 +#ifdef FEAT_AUTOCMD
2648 + if (allbuf_locked())
2651 if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged()
2654 @@ -8749,8 +8802,8 @@
2655 else if (*dirnow != NUL
2656 && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
2658 - (void)mch_chdir((char *)globaldir);
2659 - shorten_fnames(TRUE);
2660 + if (mch_chdir((char *)globaldir) == 0)
2661 + shorten_fnames(TRUE);
2664 failed |= (makeopens(fd, dirnow) == FAIL);
2665 @@ -9506,24 +9559,50 @@
2669 + if (*s == '<') /* "#<99" uses v:oldfiles */
2671 i = (int)getdigits(&s);
2672 *usedlen = (int)(s - src); /* length of what we expand */
2674 - buf = buflist_findnr(i);
2676 + if (src[1] == '<')
2678 - *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
2681 + /* Should we give an error message for #<text? */
2686 + result = list_find_str(get_vim_var_list(VV_OLDFILES),
2688 + if (result == NULL)
2690 + *errormsg = (char_u *)"";
2694 + *errormsg = (char_u *)_("E809: #< is not available without the +eval feature");
2698 - if (lnump != NULL)
2699 - *lnump = ECMD_LAST;
2700 - if (buf->b_fname == NULL)
2703 - result = (char_u *)"";
2704 - valid = 0; /* Must have ":p:h" to be valid */
2705 + buf = buflist_findnr(i);
2708 + *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
2711 + if (lnump != NULL)
2712 + *lnump = ECMD_LAST;
2713 + if (buf->b_fname == NULL)
2715 + result = (char_u *)"";
2716 + valid = 0; /* Must have ":p:h" to be valid */
2719 + result = buf->b_fname;
2722 - result = buf->b_fname;
2725 #ifdef FEAT_SEARCHPATH
2726 @@ -9541,6 +9620,15 @@
2728 case SPEC_AFILE: /* file name for autocommand */
2729 result = autocmd_fname;
2730 + if (result != NULL && !autocmd_fname_full)
2732 + /* Still need to turn the fname into a full path. It is
2733 + * postponed to avoid a delay when <afile> is not used. */
2734 + autocmd_fname_full = TRUE;
2735 + result = FullName_save(autocmd_fname, FALSE);
2736 + vim_free(autocmd_fname);
2737 + autocmd_fname = result;
2741 *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
2742 @@ -10067,7 +10155,7 @@
2744 if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
2745 || put_line(fd, "if file_readable(s:sx)") == FAIL
2746 - || put_line(fd, " exe \"source \" . s:sx") == FAIL
2747 + || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL
2748 || put_line(fd, "endif") == FAIL)
2751 @@ -10689,7 +10777,8 @@
2752 p_viminfo = (char_u *)"'100";
2753 if (eap->cmdidx == CMD_rviminfo)
2755 - if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL)
2756 + if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS
2757 + | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL)
2758 EMSG(_("E195: Cannot open viminfo file for reading"));
2761 diff -Naur vim72.orig/src/ex_getln.c vim72/src/ex_getln.c
2762 --- vim72.orig/src/ex_getln.c 2008-08-08 02:31:33.000000000 -0700
2763 +++ vim72/src/ex_getln.c 2009-03-12 11:55:13.699620338 -0700
2765 int cmdattr; /* attributes for prompt */
2766 int overstrike; /* Typing mode on the command line. Shared by
2767 getcmdline() and put_on_cmdline(). */
2768 + expand_T *xpc; /* struct being used for expansion, xp_pattern
2769 + may point into cmdbuff */
2770 int xp_context; /* type of expansion */
2772 char_u *xp_arg; /* user-defined expansion arg */
2777 -static struct cmdline_info ccline; /* current cmdline_info */
2778 +/* The current cmdline_info. It is initialized in getcmdline() and after that
2779 + * used by other functions. When invoking getcmdline() recursively it needs
2780 + * to be saved with save_cmdline() and restored with restore_cmdline().
2781 + * TODO: make it local to getcmdline() and pass it around. */
2782 +static struct cmdline_info ccline;
2784 static int cmd_showtail; /* Only show path tail in lists ? */
2790 + ccline.xpc = &xpc;
2792 #ifdef FEAT_RIGHTLEFT
2793 if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
2794 @@ -408,9 +415,10 @@
2798 - * <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>).
2799 + * When there are matching completions to select <S-Tab> works like
2800 + * CTRL-P (unless 'wc' is <S-Tab>).
2802 - if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)
2803 + if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
2806 #ifdef FEAT_WILDMENU
2807 @@ -1513,6 +1521,7 @@
2810 vim_free(ccline.cmdbuff);
2811 + xpc.xp_context = EXPAND_NOTHING;
2812 if (hiscnt == hislen)
2813 p = lookfor; /* back to the old one */
2815 @@ -1839,6 +1848,7 @@
2818 ExpandCleanup(&xpc);
2819 + ccline.xpc = NULL;
2821 #ifdef FEAT_SEARCH_EXTRA
2823 @@ -1990,8 +2000,8 @@
2825 #if defined(FEAT_AUTOCMD) || defined(PROTO)
2827 - * Check if "curbuf_lock" is set and return TRUE when it is and give an error
2829 + * Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is
2830 + * and give an error message.
2834 @@ -2001,6 +2011,21 @@
2835 EMSG(_("E788: Not allowed to edit another buffer now"));
2838 + return allbuf_locked();
2842 + * Check if "allbuf_lock" is set and return TRUE when it is and give an error
2848 + if (allbuf_lock > 0)
2850 + EMSG(_("E811: Not allowed to change buffer information now"));
2856 @@ -2508,6 +2533,20 @@
2858 mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
2861 + if (ccline.xpc != NULL
2862 + && ccline.xpc->xp_pattern != NULL
2863 + && ccline.xpc->xp_context != EXPAND_NOTHING
2864 + && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
2866 + int i = (int)(ccline.xpc->xp_pattern - p);
2868 + /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
2869 + * to point into the newly allocated memory. */
2870 + if (i >= 0 && i <= ccline.cmdlen)
2871 + ccline.xpc->xp_pattern = ccline.cmdbuff + i;
2877 @@ -2875,6 +2914,7 @@
2878 prev_ccline = ccline;
2879 ccline.cmdbuff = NULL;
2880 ccline.cmdprompt = NULL;
2881 + ccline.xpc = NULL;
2885 @@ -3582,6 +3622,7 @@
2889 + xp->xp_pattern = NULL;
2890 xp->xp_backslash = XP_BS_NONE;
2891 #ifndef BACKSLASH_IN_FILENAME
2892 xp->xp_shell = FALSE;
2893 @@ -4871,7 +4912,7 @@
2896 sprintf((char *)s, "%s/%s*.vim", dirname, pat);
2897 - all = globpath(p_rtp, s);
2898 + all = globpath(p_rtp, s, 0);
2902 @@ -4912,9 +4953,10 @@
2903 * newlines. Returns NULL for an error or no matches.
2906 -globpath(path, file)
2907 +globpath(path, file, expand_options)
2910 + int expand_options;
2914 @@ -4943,10 +4985,10 @@
2918 - if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
2920 + if (ExpandFromContext(&xpc, buf, &num_p, &p,
2921 + WILD_SILENT|expand_options) != FAIL && num_p > 0)
2923 - ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
2924 + ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
2925 for (len = 0, i = 0; i < num_p; ++i)
2926 len += (int)STRLEN(p[i]) + 1;
2928 @@ -6020,9 +6062,7 @@
2932 - cmdwin_type = ccline.cmdfirstc;
2933 - if (cmdwin_type == NUL)
2934 - cmdwin_type = '-';
2935 + cmdwin_type = get_cmdline_type();
2937 /* Create the command-line buffer empty. */
2938 (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE);
2939 @@ -6046,7 +6086,7 @@
2940 /* Showing the prompt may have set need_wait_return, reset it. */
2941 need_wait_return = FALSE;
2943 - histtype = hist_char2type(ccline.cmdfirstc);
2944 + histtype = hist_char2type(cmdwin_type);
2945 if (histtype == HIST_CMD || histtype == HIST_DEBUG)
2948 diff -Naur vim72.orig/src/feature.h vim72/src/feature.h
2949 --- vim72.orig/src/feature.h 2008-08-06 04:00:39.000000000 -0700
2950 +++ vim72/src/feature.h 2009-03-12 11:54:40.545495740 -0700
2951 @@ -767,9 +767,13 @@
2954 * +browse ":browse" command.
2955 + * or just the ":browse" command modifier
2957 -#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))
2958 -# define FEAT_BROWSE
2959 +#if defined(FEAT_NORMAL)
2960 +# define FEAT_BROWSE_CMD
2961 +# 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)
2962 +# define FEAT_BROWSE
2967 diff -Naur vim72.orig/src/fileio.c vim72/src/fileio.c
2968 --- vim72.orig/src/fileio.c 2008-08-06 04:01:03.000000000 -0700
2969 +++ vim72/src/fileio.c 2009-03-12 11:55:18.711941333 -0700
2971 static int au_find_group __ARGS((char_u *name));
2973 # define AUGROUP_DEFAULT -1 /* default autocmd group */
2974 -# define AUGROUP_ERROR -2 /* errornouse autocmd group */
2975 +# define AUGROUP_ERROR -2 /* erroneous autocmd group */
2976 # define AUGROUP_ALL -3 /* all autocmd groups */
2982 static int move_lines __ARGS((buf_T *frombuf, buf_T *tobuf));
2984 +#ifdef FEAT_AUTOCMD
2985 +static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
2989 filemess(buf, name, s, attr)
2990 @@ -295,6 +297,19 @@
2991 int conv_restlen = 0; /* nr of bytes in conv_rest[] */
2994 +#ifdef FEAT_AUTOCMD
2995 + /* Remember the initial values of curbuf, curbuf->b_ffname and
2996 + * curbuf->b_fname to detect whether they are altered as a result of
2997 + * executing nasty autocommands. Also check if "fname" and "sfname"
2998 + * point to one of these values. */
2999 + buf_T *old_curbuf = curbuf;
3000 + char_u *old_b_ffname = curbuf->b_ffname;
3001 + char_u *old_b_fname = curbuf->b_fname;
3002 + int using_b_ffname = (fname == curbuf->b_ffname)
3003 + || (sfname == curbuf->b_ffname);
3004 + int using_b_fname = (fname == curbuf->b_fname)
3005 + || (sfname == curbuf->b_fname);
3007 write_no_eol_lnum = 0; /* in case it was set by the previous read */
3010 @@ -589,7 +604,21 @@
3011 #ifdef FEAT_QUICKFIX
3012 if (!bt_dontwrite(curbuf))
3015 check_need_swap(newfile);
3016 +#ifdef FEAT_AUTOCMD
3017 + /* SwapExists autocommand may mess things up */
3018 + if (curbuf != old_curbuf
3019 + || (using_b_ffname
3020 + && (old_b_ffname != curbuf->b_ffname))
3022 + && (old_b_fname != curbuf->b_fname)))
3024 + EMSG(_(e_auchangedbuf));
3029 if (dir_of_file_exists(fname))
3030 filemess(curbuf, sfname, (char_u *)_("[New File]"), 0);
3032 @@ -668,6 +697,17 @@
3035 check_need_swap(newfile);
3036 +#ifdef FEAT_AUTOCMD
3037 + if (!read_stdin && (curbuf != old_curbuf
3038 + || (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
3039 + || (using_b_fname && (old_b_fname != curbuf->b_fname))))
3041 + EMSG(_(e_auchangedbuf));
3048 /* Set swap file protection bits after creating it. */
3049 if (swap_mode > 0 && curbuf->b_ml.ml_mfp->mf_fname != NULL)
3053 int n = msg_scrolled;
3054 - buf_T *old_curbuf = curbuf;
3057 * The file must be closed again, the autocommands may want to change
3058 @@ -740,8 +779,13 @@
3060 * Don't allow the autocommands to change the current buffer.
3061 * Try to re-open the file.
3063 + * Don't allow the autocommands to change the buffer name either
3064 + * (cd for example) if it invalidates fname or sfname.
3066 if (!read_stdin && (curbuf != old_curbuf
3067 + || (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
3068 + || (using_b_fname && (old_b_fname != curbuf->b_fname))
3069 || (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) < 0))
3072 @@ -932,7 +976,10 @@
3075 if (eap != NULL && eap->force_ff != 0)
3077 fileformat = get_fileformat_force(curbuf, eap);
3078 + try_unix = try_dos = try_mac = FALSE;
3080 else if (curbuf->b_p_bin)
3081 fileformat = EOL_UNIX; /* binary: use Unix format */
3082 else if (*p_ffs == NUL)
3083 @@ -2211,7 +2258,7 @@
3085 /* Use stderr for stdin, makes shell commands work. */
3092 @@ -2341,11 +2388,6 @@
3093 STRCAT(IObuff, _("[CR missing]"));
3096 - if (ff_error == EOL_MAC)
3098 - STRCAT(IObuff, _("[NL found]"));
3103 STRCAT(IObuff, _("[long lines split]"));
3104 @@ -2711,7 +2753,7 @@
3106 if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
3107 && curbuf->b_ffname != NULL)
3108 - read_viminfo(NULL, FALSE, TRUE, FALSE);
3109 + read_viminfo(NULL, VIF_WANT_MARKS);
3111 /* Always set b_marks_read; needed when 'viminfo' is changed to include
3112 * the ' parameter after opening a buffer. */
3113 @@ -3451,7 +3493,7 @@
3117 - fchown(fd, st_old.st_uid, st_old.st_gid);
3118 + ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
3120 if (mch_stat((char *)IObuff, &st) < 0
3121 || st.st_uid != st_old.st_uid
3122 @@ -4367,7 +4409,7 @@
3123 || st.st_uid != st_old.st_uid
3124 || st.st_gid != st_old.st_gid)
3126 - fchown(fd, st_old.st_uid, st_old.st_gid);
3127 + ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
3128 if (perm >= 0) /* set permission again, may have changed */
3129 (void)mch_setperm(wfname, perm);
3131 @@ -5246,13 +5288,16 @@
3132 /* Convert with iconv(). */
3133 if (ip->bw_restlen > 0)
3137 /* Need to concatenate the remainder of the previous call and
3138 * the bytes of the current call. Use the end of the
3139 * conversion buffer for this. */
3140 fromlen = len + ip->bw_restlen;
3141 - from = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen;
3142 - mch_memmove((void *)from, ip->bw_rest, (size_t)ip->bw_restlen);
3143 - mch_memmove((void *)(from + ip->bw_restlen), buf, (size_t)len);
3144 + fp = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen;
3145 + mch_memmove(fp, ip->bw_rest, (size_t)ip->bw_restlen);
3146 + mch_memmove(fp + ip->bw_restlen, buf, (size_t)len);
3148 tolen = ip->bw_conv_buflen - fromlen;
3151 @@ -5550,9 +5595,10 @@
3152 name = "ucs-4le"; /* FF FE 00 00 */
3155 - else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L))
3156 + else if (flags == (FIO_UCS2 | FIO_ENDIAN_L))
3157 name = "ucs-2le"; /* FF FE */
3158 - else if (flags == (FIO_UTF16 | FIO_ENDIAN_L))
3159 + else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L))
3160 + /* utf-16le is preferred, it also works for ucs-2le text */
3161 name = "utf-16le"; /* FF FE */
3163 else if (p[0] == 0xfe && p[1] == 0xff
3164 @@ -6031,9 +6077,9 @@
3166 tbuf[FGETS_SIZE - 2] = NUL;
3168 - fgets_cr((char *)tbuf, FGETS_SIZE, fp);
3169 + ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
3171 - fgets((char *)tbuf, FGETS_SIZE, fp);
3172 + ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
3174 } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
3176 @@ -6107,12 +6153,24 @@
3178 vim_acl_T acl; /* ACL from original file */
3180 +#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
3181 + int use_tmp_file = FALSE;
3185 - * When the names are identical, there is nothing to do.
3186 + * When the names are identical, there is nothing to do. When they refer
3187 + * to the same file (ignoring case and slash/backslash differences) but
3188 + * the file name differs we need to go through a temp file.
3190 if (fnamecmp(from, to) == 0)
3193 +#ifdef CASE_INSENSITIVE_FILENAME
3194 + if (STRCMP(gettail(from), gettail(to)) != 0)
3195 + use_tmp_file = TRUE;
3202 * Fail if the "from" file doesn't exist. Avoids that "to" is deleted.
3203 @@ -6120,6 +6178,55 @@
3204 if (mch_stat((char *)from, &st) < 0)
3209 + struct stat st_to;
3211 + /* It's possible for the source and destination to be the same file.
3212 + * This happens when "from" and "to" differ in case and are on a FAT32
3213 + * filesystem. In that case go through a temp file name. */
3214 + if (mch_stat((char *)to, &st_to) >= 0
3215 + && st.st_dev == st_to.st_dev
3216 + && st.st_ino == st_to.st_ino)
3217 + use_tmp_file = TRUE;
3221 +#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
3224 + char tempname[MAXPATHL + 1];
3227 + * Find a name that doesn't exist and is in the same directory.
3228 + * Rename "from" to "tempname" and then rename "tempname" to "to".
3230 + if (STRLEN(from) >= MAXPATHL - 5)
3232 + STRCPY(tempname, from);
3233 + for (n = 123; n < 99999; ++n)
3235 + sprintf((char *)gettail((char_u *)tempname), "%d", n);
3236 + if (mch_stat(tempname, &st) < 0)
3238 + if (mch_rename((char *)from, tempname) == 0)
3240 + if (mch_rename(tempname, (char *)to) == 0)
3242 + /* Strange, the second step failed. Try moving the
3243 + * file back and return failure. */
3244 + mch_rename(tempname, (char *)from);
3247 + /* If it fails for one temp name it will most likely fail
3248 + * for any temp name, give up. */
3257 * Delete the "to" file, this is required on some systems to make the
3258 * mch_rename() work, on other systems it makes sure that we don't have
3259 @@ -6260,7 +6367,7 @@
3261 if (!stuff_empty() || global_busy || !typebuf_typed()
3263 - || autocmd_busy || curbuf_lock > 0
3264 + || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0
3267 need_check_timestamps = TRUE; /* check later */
3268 @@ -6462,8 +6569,10 @@
3269 set_vim_var_string(VV_FCS_REASON, (char_u *)reason, -1);
3270 set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", -1);
3273 n = apply_autocmds(EVENT_FILECHANGEDSHELL,
3274 buf->b_fname, buf->b_fname, FALSE, buf);
3279 @@ -8523,6 +8632,7 @@
3280 char_u *save_sourcing_name;
3281 linenr_T save_sourcing_lnum;
3282 char_u *save_autocmd_fname;
3283 + int save_autocmd_fname_full;
3284 int save_autocmd_bufnr;
3285 char_u *save_autocmd_match;
3286 int save_autocmd_busy;
3287 @@ -8601,6 +8711,7 @@
3288 * Save the autocmd_* variables and info about the current buffer.
3290 save_autocmd_fname = autocmd_fname;
3291 + save_autocmd_fname_full = autocmd_fname_full;
3292 save_autocmd_bufnr = autocmd_bufnr;
3293 save_autocmd_match = autocmd_match;
3294 save_autocmd_busy = autocmd_busy;
3295 @@ -8618,14 +8729,15 @@
3296 if (fname != NULL && *fname != NUL)
3297 autocmd_fname = fname;
3298 else if (buf != NULL)
3299 - autocmd_fname = buf->b_fname;
3300 + autocmd_fname = buf->b_ffname;
3302 autocmd_fname = NULL;
3305 autocmd_fname = fname_io;
3306 if (autocmd_fname != NULL)
3307 - autocmd_fname = FullName_save(autocmd_fname, FALSE);
3308 + autocmd_fname = vim_strsave(autocmd_fname);
3309 + autocmd_fname_full = FALSE; /* call FullName_save() later */
3312 * Set the buffer number to be used for <abuf>.
3313 @@ -8810,6 +8922,7 @@
3314 sourcing_lnum = save_sourcing_lnum;
3315 vim_free(autocmd_fname);
3316 autocmd_fname = save_autocmd_fname;
3317 + autocmd_fname_full = save_autocmd_fname_full;
3318 autocmd_bufnr = save_autocmd_bufnr;
3319 autocmd_match = save_autocmd_match;
3321 @@ -8918,7 +9031,7 @@
3325 - /* only use a pattern when it has not been removed, has commands and
3326 + /* Only use a pattern when it has not been removed, has commands and
3327 * the group matches. For buffer-local autocommands only check the
3329 if (ap->pat != NULL && ap->cmds != NULL
3330 @@ -9104,7 +9217,7 @@
3331 set_context_in_autocmd(xp, arg, doautocmd)
3334 - int doautocmd; /* TRUE for :doautocmd, FALSE for :autocmd */
3335 + int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */
3339 diff -Naur vim72.orig/src/fold.c vim72/src/fold.c
3340 --- vim72.orig/src/fold.c 2008-08-06 04:01:12.000000000 -0700
3341 +++ vim72/src/fold.c 2009-03-12 11:54:59.842732505 -0700
3343 static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp));
3344 static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum));
3345 static void checkupdate __ARGS((win_T *wp));
3346 -static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open));
3347 +static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open));
3348 static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep));
3349 static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep));
3350 static void foldOpenNested __ARGS((fold_T *fpr));
3353 fold_T *found_fp = NULL;
3354 linenr_T found_off = 0;
3355 - int use_level = FALSE;
3357 int maybe_small = FALSE;
3359 linenr_T lnum = start;
3361 gap = &curwin->w_folds;
3364 + use_level = FALSE;
3367 if (!foldFind(gap, lnum - lnum_off, &fp))
3368 @@ -783,20 +784,21 @@
3371 lnum = found_fp->fd_top + found_fp->fd_len + found_off;
3374 if (foldmethodIsManual(curwin))
3375 deleteFoldEntry(found_ga,
3376 (int)(found_fp - (fold_T *)found_ga->ga_data), recursive);
3379 - if (found_fp->fd_top + found_off < first_lnum)
3380 - first_lnum = found_fp->fd_top;
3381 - if (lnum > last_lnum)
3382 + if (first_lnum > found_fp->fd_top + found_off)
3383 + first_lnum = found_fp->fd_top + found_off;
3384 + if (last_lnum < lnum)
3386 - parseMarker(curwin);
3388 + parseMarker(curwin);
3389 deleteFoldMarkers(found_fp, recursive, found_off);
3394 changed_window_setting();
3395 @@ -811,6 +813,10 @@
3396 redraw_curbuf_later(INVERTED);
3400 + /* Deleting markers may make cursor column invalid. */
3401 + check_cursor_col();
3404 changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L);
3406 @@ -1241,10 +1247,10 @@
3407 * Repeat "count" times.
3410 -setFoldRepeat(lnum, count, open)
3411 +setFoldRepeat(lnum, count, do_open)
3419 @@ -1252,7 +1258,7 @@
3420 for (n = 0; n < count; ++n)
3422 done = DONE_NOTHING;
3423 - (void)setManualFold(lnum, open, FALSE, &done);
3424 + (void)setManualFold(lnum, do_open, FALSE, &done);
3425 if (!(done & DONE_ACTION))
3427 /* Only give an error message when no fold could be opened. */
3428 diff -Naur vim72.orig/src/getchar.c vim72/src/getchar.c
3429 --- vim72.orig/src/getchar.c 2008-07-22 09:57:48.000000000 -0700
3430 +++ vim72/src/getchar.c 2009-03-12 11:55:13.579612236 -0700
3431 @@ -3816,7 +3816,11 @@
3434 if (msg_didout || msg_silent != 0)
3437 + if (got_int) /* 'q' typed at MORE prompt */
3440 if ((mp->m_mode & (INSERT + CMDLINE)) == INSERT + CMDLINE)
3441 msg_putchar('!'); /* :map! */
3442 else if (mp->m_mode & INSERT)
3443 @@ -4702,7 +4706,7 @@
3445 if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0)
3447 - if (fprintf(fd, cmd) < 0)
3448 + if (fputs(cmd, fd) < 0)
3450 if (buf != NULL && fputs(" <buffer>", fd) < 0)
3452 @@ -4801,7 +4805,7 @@
3454 if (IS_SPECIAL(c) || modifiers) /* special key */
3456 - if (fprintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)
3457 + if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0)
3461 diff -Naur vim72.orig/src/globals.h vim72/src/globals.h
3462 --- vim72.orig/src/globals.h 2008-07-26 04:53:29.000000000 -0700
3463 +++ vim72/src/globals.h 2009-03-12 11:55:13.699620338 -0700
3464 @@ -482,8 +482,10 @@
3466 * While executing external commands or in Ex mode, should not insert GUI
3467 * events in the input buffer: Set hold_gui_events to non-zero.
3469 + * volatile because it is used in signal handler sig_sysmouse().
3471 -EXTERN int hold_gui_events INIT(= 0);
3472 +EXTERN volatile int hold_gui_events INIT(= 0);
3475 * When resizing the shell is postponed, remember the new size, and call
3477 EXTERN int really_exiting INIT(= FALSE);
3478 /* TRUE when we are sure to exit, e.g., after
3479 * a deadly signal */
3480 -EXTERN int full_screen INIT(= FALSE);
3481 +/* volatile because it is used in signal handler deathtrap(). */
3482 +EXTERN volatile int full_screen INIT(= FALSE);
3483 /* TRUE when doing full-screen output
3484 * otherwise only writing some messages */
3486 @@ -616,6 +619,11 @@
3487 EXTERN int curbuf_lock INIT(= 0);
3488 /* non-zero when the current buffer can't be
3489 * changed. Used for FileChangedRO. */
3490 +EXTERN int allbuf_lock INIT(= 0);
3491 + /* non-zero when no buffer name can be
3492 + * changed, no buffer can be deleted and
3493 + * current directory can't be changed.
3494 + * Used for SwapExists et al. */
3497 # define HAVE_SANDBOX
3498 @@ -739,10 +747,12 @@
3500 EXTERN JMP_BUF lc_jump_env; /* argument to SETJMP() */
3502 -EXTERN int lc_signal; /* catched signal number, 0 when no was signal
3503 - catched; used for mch_libcall() */
3504 +/* volatile because it is used in signal handlers. */
3505 +EXTERN volatile int lc_signal; /* caught signal number, 0 when no was signal
3506 + caught; used for mch_libcall() */
3508 -EXTERN int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */
3509 +/* volatile because it is used in signal handler deathtrap(). */
3510 +EXTERN volatile int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */
3513 #if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT)
3515 EXTERN FILE *scriptout INIT(= NULL); /* stream to write script to */
3516 EXTERN int read_cmd_fd INIT(= 0); /* fd to read commands from */
3518 -EXTERN int got_int INIT(= FALSE); /* set to TRUE when interrupt
3519 +/* volatile because it is used in signal handler catch_sigint(). */
3520 +EXTERN volatile int got_int INIT(= FALSE); /* set to TRUE when interrupt
3522 #ifdef USE_TERM_CONSOLE
3523 EXTERN int term_console INIT(= FALSE); /* set to TRUE when console used */
3524 @@ -1022,6 +1033,7 @@
3527 EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
3528 +EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
3529 EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
3530 EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
3531 EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
3532 @@ -1339,7 +1351,6 @@
3534 #ifdef FEAT_NETBEANS_INTG
3535 EXTERN char *netbeansArg INIT(= NULL); /* the -nb[:host:port:passwd] arg */
3536 -EXTERN int netbeansCloseFile INIT(= 0); /* send killed if != 0 */
3537 EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */
3538 EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */
3539 EXTERN int netbeansReadFile INIT(= 1); /* OK to read from disk if != 0 */
3540 @@ -1548,6 +1559,14 @@
3541 EXTERN time_t starttime;
3544 + * Some compilers warn for not using a return value, but in some situations we
3545 + * can't do anything useful with the value. Assign to this variable to avoid
3548 +EXTERN int ignored;
3549 +EXTERN char *ignoredp;
3552 * Optional Farsi support. Include it here, so EXTERN and INIT are defined.
3555 diff -Naur vim72.orig/src/gui_at_sb.c vim72/src/gui_at_sb.c
3556 --- vim72.orig/src/gui_at_sb.c 2004-06-07 07:32:25.000000000 -0700
3557 +++ vim72/src/gui_at_sb.c 2009-03-12 11:54:50.138110630 -0700
3558 @@ -1078,6 +1078,12 @@
3559 Cardinal *num_params; /* unused */
3561 ScrollbarWidget sbw = (ScrollbarWidget)w;
3562 + /* Use a union to avoid a warning for the weird conversion from float to
3563 + * XtPointer. Comes from Xaw/Scrollbar.c. */
3569 if (LookAhead(w, event))
3571 @@ -1085,7 +1091,8 @@
3572 /* thumbProc is not pretty, but is necessary for backwards
3573 compatibility on those architectures for which it work{s,ed};
3574 the intent is to pass a (truncated) float by value. */
3575 - XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top);
3576 + xtpf.xtf = sbw->scrollbar.top;
3577 + XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
3578 XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
3581 diff -Naur vim72.orig/src/gui.c vim72/src/gui.c
3582 --- vim72.orig/src/gui.c 2008-07-27 12:32:14.000000000 -0700
3583 +++ vim72/src/gui.c 2009-03-12 11:54:50.298121805 -0700
3585 /* The read returns when the child closes the pipe (or when
3586 * the child dies for some reason). */
3588 - (void)read(pipefd[0], &dummy, (size_t)1);
3589 + ignored = (int)read(pipefd[0], &dummy, (size_t)1);
3593 @@ -3241,7 +3241,7 @@
3595 gui_update_tabline();
3597 - need_set_size = RESIZE_VERT;
3598 + need_set_size |= RESIZE_VERT;
3601 if (!gui_use_tabline())
3602 @@ -3275,9 +3275,9 @@
3603 if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
3605 if (i == SBAR_BOTTOM)
3606 - need_set_size = RESIZE_VERT;
3607 + need_set_size |= RESIZE_VERT;
3609 - need_set_size = RESIZE_HOR;
3610 + need_set_size |= RESIZE_HOR;
3611 if (gui.which_scrollbars[i])
3614 @@ -3297,7 +3297,7 @@
3615 gui_mch_enable_menu(gui.menu_is_active);
3617 prev_menu_is_active = gui.menu_is_active;
3618 - need_set_size = RESIZE_VERT;
3619 + need_set_size |= RESIZE_VERT;
3620 if (gui.menu_is_active)
3623 @@ -3308,7 +3308,7 @@
3625 gui_mch_show_toolbar(using_toolbar);
3626 prev_toolbar = using_toolbar;
3627 - need_set_size = RESIZE_VERT;
3628 + need_set_size |= RESIZE_VERT;
3632 @@ -3318,7 +3318,7 @@
3634 gui_mch_enable_footer(using_footer);
3635 prev_footer = using_footer;
3636 - need_set_size = RESIZE_VERT;
3637 + need_set_size |= RESIZE_VERT;
3641 @@ -3330,10 +3330,11 @@
3642 prev_tearoff = using_tearoff;
3645 - if (need_set_size)
3646 + if (need_set_size != 0)
3650 + long prev_Columns = Columns;
3651 + long prev_Rows = Rows;
3653 /* Adjust the size of the window to make the text area keep the
3654 * same size and to avoid that part of our window is off-screen
3655 @@ -3349,11 +3350,14 @@
3656 * If you remove this, please test this command for resizing
3657 * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
3658 * Don't do this while starting up though.
3659 - * And don't change Rows, it may have be reduced intentionally
3660 - * when adding menu/toolbar/tabline. */
3661 - if (!gui.starting)
3662 + * Don't change Rows when adding menu/toolbar/tabline.
3663 + * Don't change Columns when adding vertical toolbar. */
3664 + if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
3667 + if ((need_set_size & RESIZE_VERT) == 0)
3669 + if ((need_set_size & RESIZE_HOR) == 0)
3670 + Columns = prev_Columns;
3674 diff -Naur vim72.orig/src/gui_gtk_x11.c vim72/src/gui_gtk_x11.c
3675 --- vim72.orig/src/gui_gtk_x11.c 2008-07-04 03:46:24.000000000 -0700
3676 +++ vim72/src/gui_gtk_x11.c 2009-03-12 11:54:50.138110630 -0700
3677 @@ -4070,14 +4070,14 @@
3679 if (mask & (XValue | YValue))
3682 - gui_mch_get_screen_dimensions(&w, &h);
3683 - h += p_ghr + get_menu_tool_height();
3684 - w += get_menu_tool_width();
3686 + gui_mch_get_screen_dimensions(&ww, &hh);
3687 + hh += p_ghr + get_menu_tool_height();
3688 + ww += get_menu_tool_width();
3689 if (mask & XNegative)
3690 - x += w - pixel_width;
3691 + x += ww - pixel_width;
3692 if (mask & YNegative)
3693 - y += h - pixel_height;
3694 + y += hh - pixel_height;
3696 gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
3698 diff -Naur vim72.orig/src/gui_x11.c vim72/src/gui_x11.c
3699 --- vim72.orig/src/gui_x11.c 2008-06-08 08:13:45.000000000 -0700
3700 +++ vim72/src/gui_x11.c 2009-03-12 11:55:13.599613075 -0700
3701 @@ -1587,6 +1587,8 @@
3702 XtCloseDisplay(gui.dpy);
3704 vimShell = (Widget)0;
3705 + vim_free(gui_argv);
3710 @@ -1761,6 +1763,8 @@
3711 * says that this isn't needed when exiting, so just skip it. */
3712 XtCloseDisplay(gui.dpy);
3714 + vim_free(gui_argv);
3719 @@ -2450,7 +2454,7 @@
3720 *colorPtr = colortable[closest];
3724 + vim_free(colortable);
3728 @@ -3439,47 +3443,37 @@
3731 XpmAttributes attrs;
3733 + XImage *sign = NULL;
3737 * Setup the color substitution table.
3740 if (signfile[0] != NUL && signfile[0] != '-')
3742 - sign = (XImage *)alloc(sizeof(XImage));
3744 + XpmColorSymbol color[5] =
3746 - XpmColorSymbol color[5] =
3748 - {"none", NULL, 0},
3749 - {"iconColor1", NULL, 0},
3750 - {"bottomShadowColor", NULL, 0},
3751 - {"topShadowColor", NULL, 0},
3752 - {"selectColor", NULL, 0}
3754 - attrs.valuemask = XpmColorSymbols;
3755 - attrs.numsymbols = 2;
3756 - attrs.colorsymbols = color;
3757 - attrs.colorsymbols[0].pixel = gui.back_pixel;
3758 - attrs.colorsymbols[1].pixel = gui.norm_pixel;
3759 - status = XpmReadFileToImage(gui.dpy, (char *)signfile,
3760 + {"none", NULL, 0},
3761 + {"iconColor1", NULL, 0},
3762 + {"bottomShadowColor", NULL, 0},
3763 + {"topShadowColor", NULL, 0},
3764 + {"selectColor", NULL, 0}
3766 + attrs.valuemask = XpmColorSymbols;
3767 + attrs.numsymbols = 2;
3768 + attrs.colorsymbols = color;
3769 + attrs.colorsymbols[0].pixel = gui.back_pixel;
3770 + attrs.colorsymbols[1].pixel = gui.norm_pixel;
3771 + status = XpmReadFileToImage(gui.dpy, (char *)signfile,
3772 &sign, NULL, &attrs);
3776 - /* Sign width is fixed at two columns now.
3777 - if (sign->width > gui.sign_width)
3778 - gui.sign_width = sign->width + 8; */
3784 - EMSG(_(e_signdata));
3788 + /* Sign width is fixed at two columns now.
3789 + if (sign->width > gui.sign_width)
3790 + gui.sign_width = sign->width + 8; */
3793 + EMSG(_(e_signdata));
3796 return (void *)sign;
3797 @@ -3489,8 +3483,7 @@
3798 gui_mch_destroy_sign(sign)
3801 - XFree(((XImage *)sign)->data);
3803 + XDestroyImage((XImage*)sign);
3807 diff -Naur vim72.orig/src/gui_xmdlg.c vim72/src/gui_xmdlg.c
3808 --- vim72.orig/src/gui_xmdlg.c 2008-06-21 09:05:32.000000000 -0700
3809 +++ vim72/src/gui_xmdlg.c 2009-03-12 11:54:50.142110910 -0700
3810 @@ -369,10 +369,10 @@
3811 char buf[TEMP_BUF_SIZE];
3812 XmString items[MAX_ENTRIES_IN_LIST];
3817 - for (index = (int)ENCODING; index < (int)NONE; ++index)
3819 + for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
3822 /* First we insert the wild char into every single list. */
3823 if (fix != ENCODING)
3824 @@ -503,14 +503,14 @@
3826 * Now loop trough the remaining lists and set them up.
3828 - for (index = (int)NAME; index < (int)NONE; ++index)
3829 + for (idx = (int)NAME; idx < (int)NONE; ++idx)
3833 - if (fix == (enum ListSpecifier)index)
3834 + if (fix == (enum ListSpecifier)idx)
3837 - switch ((enum ListSpecifier)index)
3838 + switch ((enum ListSpecifier)idx)
3841 w = data->list[NAME];
3842 @@ -525,21 +525,21 @@
3843 w = (Widget)0; /* for lint */
3846 - for (i = 0; i < count[index]; ++i)
3847 + for (i = 0; i < count[idx]; ++i)
3849 - items[i] = XmStringCreateLocalized(list[index][i]);
3850 - XtFree(list[index][i]);
3851 + items[i] = XmStringCreateLocalized(list[idx][i]);
3852 + XtFree(list[idx][i]);
3854 XmListDeleteAllItems(w);
3855 - XmListAddItems(w, items, count[index], 1);
3856 - if (data->sel[index])
3857 + XmListAddItems(w, items, count[idx], 1);
3858 + if (data->sel[idx])
3860 XmStringFree(items[0]);
3861 - items[0] = XmStringCreateLocalized(data->sel[index]);
3862 + items[0] = XmStringCreateLocalized(data->sel[idx]);
3863 XmListSelectItem(w, items[0], False);
3864 XmListSetBottomItem(w, items[0]);
3866 - for (i = 0; i < count[index]; ++i)
3867 + for (i = 0; i < count[idx]; ++i)
3868 XmStringFree(items[i]);
3871 @@ -695,14 +695,14 @@
3875 - char *msg = _("no specific match");
3876 + char *nomatch_msg = _("no specific match");
3879 - str = XmStringCreateLocalized(msg);
3880 + str = XmStringCreateLocalized(nomatch_msg);
3881 XtSetArg(args[n], XmNlabelString, str); ++n;
3882 XtSetValues(data->sample, args, n);
3883 apply_fontlist(data->sample);
3884 - XmTextSetString(data->name, msg);
3885 + XmTextSetString(data->name, nomatch_msg);
3889 @@ -886,21 +886,21 @@
3899 for (i = 0, max = 0; i < data->num; i++)
3901 - get_part(fn(data, i), 7, str);
3903 + get_part(fn(data, i), 7, buf);
3905 if ((size > max) && (size < MAX_DISPLAY_SIZE))
3912 - strcpy(big_font, fn(data, index));
3913 + strcpy(big_font, fn(data, idx));
3915 data->old = XLoadQueryFont(XtDisplay(parent), big_font);
3916 data->old_list = gui_motif_create_fontlist(data->old);
3917 @@ -1217,28 +1217,28 @@
3921 - char name[TEMP_BUF_SIZE];
3922 - char style[TEMP_BUF_SIZE];
3923 - char size[TEMP_BUF_SIZE];
3924 - char encoding[TEMP_BUF_SIZE];
3925 + char namebuf[TEMP_BUF_SIZE];
3926 + char stylebuf[TEMP_BUF_SIZE];
3927 + char sizebuf[TEMP_BUF_SIZE];
3928 + char encodingbuf[TEMP_BUF_SIZE];
3933 - name_part(found, name);
3934 - style_part(found, style);
3935 - size_part(found, size, data->in_pixels);
3936 - encoding_part(found, encoding);
3938 - if (strlen(name) > 0
3939 - && strlen(style) > 0
3940 - && strlen(size) > 0
3941 - && strlen(encoding) > 0)
3942 + name_part(found, namebuf);
3943 + style_part(found, stylebuf);
3944 + size_part(found, sizebuf, data->in_pixels);
3945 + encoding_part(found, encodingbuf);
3947 + if (strlen(namebuf) > 0
3948 + && strlen(stylebuf) > 0
3949 + && strlen(sizebuf) > 0
3950 + && strlen(encodingbuf) > 0)
3952 - data->sel[NAME] = XtNewString(name);
3953 - data->sel[STYLE] = XtNewString(style);
3954 - data->sel[SIZE] = XtNewString(size);
3955 - data->sel[ENCODING] = XtNewString(encoding);
3956 + data->sel[NAME] = XtNewString(namebuf);
3957 + data->sel[STYLE] = XtNewString(stylebuf);
3958 + data->sel[SIZE] = XtNewString(sizebuf);
3959 + data->sel[ENCODING] = XtNewString(encodingbuf);
3960 data->font_name = XtNewString(names[0]);
3961 display_sample(data);
3962 XmTextSetString(data->name, data->font_name);
3963 diff -Naur vim72.orig/src/gui_xmebw.c vim72/src/gui_xmebw.c
3964 --- vim72.orig/src/gui_xmebw.c 2007-09-06 03:57:51.000000000 -0700
3965 +++ vim72/src/gui_xmebw.c 2009-03-12 11:54:50.142110910 -0700
3966 @@ -1256,7 +1256,7 @@
3973 #if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
3975 @@ -1268,12 +1268,11 @@
3977 case XmEXTERNAL_HIGHLIGHT:
3978 adjust = (eb->primitive.highlight_thickness -
3979 - (eb->pushbutton.default_button_shadow_thickness ?
3980 - Xm3D_ENHANCE_PIXEL : 0));
3981 + (eb->pushbutton.default_button_shadow_thickness
3982 + ? Xm3D_ENHANCE_PIXEL : 0));
3985 case XmINTERNAL_HIGHLIGHT:
3990 diff -Naur vim72.orig/src/if_cscope.c vim72/src/if_cscope.c
3991 --- vim72.orig/src/if_cscope.c 2008-06-24 09:32:34.000000000 -0700
3992 +++ vim72/src/if_cscope.c 2009-03-12 11:55:05.383086185 -0700
3995 N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 },
3997 - N_("Query for a pattern"), FIND_USAGE, 1 },
3998 + N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 },
4000 N_("Show this message"), "help", 0 },
4002 @@ -1177,10 +1177,27 @@
4003 (void)MSG_PUTS(_("cscope commands:\n"));
4004 while (cmdp->name != NULL)
4006 - (void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
4007 - cmdp->name, _(cmdp->help), cmdp->usage);
4008 + char *help = _(cmdp->help);
4009 + int space_cnt = 30 - vim_strsize((char_u *)help);
4011 + /* Use %*s rather than %30s to ensure proper alignment in utf-8 */
4012 + if (space_cnt < 0)
4014 + (void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"),
4016 + help, space_cnt, " ",
4018 if (strcmp(cmdp->name, "find") == 0)
4019 - MSG_PUTS(FIND_HELP);
4021 + " c: Find functions calling this function\n"
4022 + " d: Find functions called by this function\n"
4023 + " e: Find this egrep pattern\n"
4024 + " f: Find this file\n"
4025 + " g: Find this definition\n"
4026 + " i: Find files #including this file\n"
4027 + " s: Find this C symbol\n"
4028 + " t: Find assignments to\n"));
4033 diff -Naur vim72.orig/src/if_cscope.h vim72/src/if_cscope.h
4034 --- vim72.orig/src/if_cscope.h 2007-09-02 07:51:08.000000000 -0700
4035 +++ vim72/src/if_cscope.h 2009-03-12 11:54:28.876748429 -0700
4037 * f 7name Find this file
4038 * i 8name Find files #including this file
4040 -#define FIND_USAGE "find c|d|e|f|g|i|s|t name"
4041 -#define FIND_HELP "\n\
4042 - c: Find functions calling this function\n\
4043 - d: Find functions called by this function\n\
4044 - e: Find this egrep pattern\n\
4045 - f: Find this file\n\
4046 - g: Find this definition\n\
4047 - i: Find files #including this file\n\
4048 - s: Find this C symbol\n\
4049 - t: Find assignments to\n"
4054 diff -Naur vim72.orig/src/if_perl.xs vim72/src/if_perl.xs
4055 --- vim72.orig/src/if_perl.xs 2008-07-17 13:55:09.000000000 -0700
4056 +++ vim72/src/if_perl.xs 2009-03-12 11:54:50.278119291 -0700
4058 # define Perl_newXS_flags dll_Perl_newXS_flags
4060 # define Perl_sv_free dll_Perl_sv_free
4061 +# if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
4062 +# define Perl_sv_free2 dll_Perl_sv_free2
4064 # define Perl_sv_isa dll_Perl_sv_isa
4065 # define Perl_sv_magic dll_Perl_sv_magic
4066 # define Perl_sv_setiv dll_Perl_sv_setiv
4068 # define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr
4069 # define boot_DynaLoader dll_boot_DynaLoader
4071 -# define Perl_sys_init3 dll_Perl_sys_init3
4072 +# define Perl_sys_init dll_Perl_sys_init
4073 # define Perl_sys_term dll_Perl_sys_term
4074 # define Perl_ISv_ptr dll_Perl_ISv_ptr
4075 # define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr
4077 static void (*boot_DynaLoader)_((pTHX_ CV*));
4079 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
4080 -static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
4081 +static void (*Perl_sv_free2)(pTHX_ SV*);
4082 +static void (*Perl_sys_init)(int* argc, char*** argv);
4083 static void (*Perl_sys_term)(void);
4084 static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
4085 static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*);
4087 {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr},
4088 {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
4090 - {"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
4091 + {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
4092 + {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init},
4093 {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
4094 {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
4095 {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr},
4097 static char *argv[] = { "", "-e", "" };
4099 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
4100 - Perl_sys_init3(&argc, (char***)&argv, NULL);
4101 + Perl_sys_init(&argc, (char***)&argv);
4103 perl_interp = perl_alloc();
4104 perl_construct(perl_interp);
4105 diff -Naur vim72.orig/src/if_python.c vim72/src/if_python.c
4106 --- vim72.orig/src/if_python.c 2008-07-17 14:09:32.000000000 -0700
4107 +++ vim72/src/if_python.c 2009-03-12 11:54:59.902735857 -0700
4108 @@ -531,6 +531,12 @@
4109 if (PythonMod_Init())
4112 + /* Remove the element from sys.path that was added because of our
4113 + * argv[0] value in PythonMod_Init(). Previously we used an empty
4114 + * string, but dependinding on the OS we then get an empty entry or
4115 + * the current directory in sys.path. */
4116 + PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
4118 /* the first python thread is vim's, release the lock */
4119 Python_SaveThread();
4121 @@ -1145,14 +1151,23 @@
4123 /* Check if we run into a recursive loop. The item must be in lookupDict
4124 * then and we can use it again. */
4125 - sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv);
4126 - result = PyDict_GetItemString(lookupDict, ptrBuf);
4127 - if (result != NULL)
4128 - Py_INCREF(result);
4129 - else if (our_tv->v_type == VAR_STRING)
4130 + if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
4131 + || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
4133 + sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U,
4134 + our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list
4135 + : (long_u)our_tv->vval.v_dict);
4136 + result = PyDict_GetItemString(lookupDict, ptrBuf);
4137 + if (result != NULL)
4139 + Py_INCREF(result);
4144 + if (our_tv->v_type == VAR_STRING)
4146 result = Py_BuildValue("s", our_tv->vval.v_string);
4147 - PyDict_SetItemString(lookupDict, ptrBuf, result);
4149 else if (our_tv->v_type == VAR_NUMBER)
4151 @@ -1161,7 +1176,6 @@
4152 /* For backwards compatibility numbers are stored as strings. */
4153 sprintf(buf, "%ld", (long)our_tv->vval.v_number);
4154 result = Py_BuildValue("s", buf);
4155 - PyDict_SetItemString(lookupDict, ptrBuf, result);
4158 else if (our_tv->v_type == VAR_FLOAT)
4159 @@ -1170,7 +1184,6 @@
4161 sprintf(buf, "%f", our_tv->vval.v_float);
4162 result = Py_BuildValue("s", buf);
4163 - PyDict_SetItemString(lookupDict, ptrBuf, result);
4166 else if (our_tv->v_type == VAR_LIST)
4167 @@ -1179,10 +1192,11 @@
4170 result = PyList_New(0);
4171 - PyDict_SetItemString(lookupDict, ptrBuf, result);
4175 + PyDict_SetItemString(lookupDict, ptrBuf, result);
4177 for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
4179 newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
4180 @@ -1194,7 +1208,6 @@
4181 else if (our_tv->v_type == VAR_DICT)
4183 result = PyDict_New();
4184 - PyDict_SetItemString(lookupDict, ptrBuf, result);
4186 if (our_tv->vval.v_dict != NULL)
4188 @@ -1203,6 +1216,8 @@
4192 + PyDict_SetItemString(lookupDict, ptrBuf, result);
4194 for (hi = ht->ht_array; todo > 0; ++hi)
4196 if (!HASHITEM_EMPTY(hi))
4197 @@ -2345,7 +2360,8 @@
4201 - static char *(argv[2]) = {"", NULL};
4202 + /* The special value is removed from sys.path in Python_Init(). */
4203 + static char *(argv[2]) = {"/must>not&exist/foo", NULL};
4206 BufferType.ob_type = &PyType_Type;
4207 diff -Naur vim72.orig/src/if_xcmdsrv.c vim72/src/if_xcmdsrv.c
4208 --- vim72.orig/src/if_xcmdsrv.c 2008-07-18 06:05:03.000000000 -0700
4209 +++ vim72/src/if_xcmdsrv.c 2009-03-12 11:54:43.269670345 -0700
4211 + serverReply.ga_len;
4213 ga_init2(&e.strings, 1, 100);
4214 - memcpy(p, &e, sizeof(e));
4215 + mch_memmove(p, &e, sizeof(e));
4216 serverReply.ga_len++;
4219 @@ -1018,7 +1018,7 @@
4221 count = numItems - (p - regProp);
4223 - memcpy(entry, p, count);
4224 + mch_memmove(entry, p, count);
4225 XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
4226 8, PropModeReplace, regProp,
4227 (int)(numItems - (p - entry)));
4228 @@ -1072,7 +1072,7 @@
4230 lastHalf = numItems - (p - regProp);
4232 - memcpy(entry, p, lastHalf);
4233 + mch_memmove(entry, p, lastHalf);
4234 numItems = (entry - regProp) + lastHalf;
4237 diff -Naur vim72.orig/src/macros.h vim72/src/macros.h
4238 --- vim72.orig/src/macros.h 2007-08-04 04:44:18.000000000 -0700
4239 +++ vim72/src/macros.h 2009-03-12 11:55:13.411601900 -0700
4240 @@ -127,15 +127,31 @@
4243 * Adjust chars in a language according to 'langmap' option.
4244 - * NOTE that there is NO overhead if 'langmap' is not set; but even
4245 - * when set we only have to do 2 ifs and an array lookup.
4246 + * NOTE that there is no noticeable overhead if 'langmap' is not set.
4247 + * When set the overhead for characters < 256 is small.
4248 * Don't apply 'langmap' if the character comes from the Stuff buffer.
4249 * The do-while is just to ignore a ';' after the macro.
4251 -# define LANGMAP_ADJUST(c, condition) do { \
4252 - if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
4253 - c = langmap_mapchar[c]; \
4255 +# define LANGMAP_ADJUST(c, condition) \
4257 + if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \
4260 + c = langmap_mapchar[c]; \
4262 + c = langmap_adjust_mb(c); \
4266 +# define LANGMAP_ADJUST(c, condition) \
4268 + if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
4269 + c = langmap_mapchar[c]; \
4273 +# define LANGMAP_ADJUST(c, condition) /* nop */
4277 diff -Naur vim72.orig/src/main.c vim72/src/main.c
4278 --- vim72.orig/src/main.c 2008-07-24 01:40:56.000000000 -0700
4279 +++ vim72/src/main.c 2009-03-12 11:54:50.142110910 -0700
4280 @@ -645,11 +645,12 @@
4284 - * Read in registers, history etc, but not marks, from the viminfo file
4285 + * Read in registers, history etc, but not marks, from the viminfo file.
4286 + * This is where v:oldfiles gets filled.
4288 if (*p_viminfo != NUL)
4290 - read_viminfo(NULL, TRUE, FALSE, FALSE);
4291 + read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
4292 TIME_MSG("reading viminfo");
4295 @@ -1457,7 +1458,8 @@
4299 - if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k')
4300 + /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */
4301 + if (TOLOWER_ASC(initstr[0]) == 'g')
4305 @@ -1508,7 +1510,8 @@
4306 early_arg_scan(parmp)
4309 -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER)
4310 +#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
4311 + || !defined(FEAT_NETBEANS_INTG)
4312 int argc = parmp->argc;
4313 char **argv = parmp->argv;
4315 @@ -1580,6 +1583,14 @@
4316 else if (STRICMP(argv[i], "--echo-wid") == 0)
4317 echo_wid_arg = TRUE;
4319 +# ifndef FEAT_NETBEANS_INTG
4320 + else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
4322 + mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
4330 @@ -2361,7 +2372,7 @@
4331 * Is there any other system that cannot do this?
4339 diff -Naur vim72.orig/src/mark.c vim72/src/mark.c
4340 --- vim72.orig/src/mark.c 2008-08-08 15:06:49.000000000 -0700
4341 +++ vim72/src/mark.c 2009-03-12 11:54:40.549496299 -0700
4342 @@ -1627,15 +1627,17 @@
4345 * Handle marks in the viminfo file:
4346 - * fp_out == NULL read marks for current buffer only
4347 - * fp_out != NULL copy marks for buffers not in buffer list
4348 + * fp_out != NULL: copy marks for buffers not in buffer list
4349 + * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
4350 + * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
4353 -copy_viminfo_marks(virp, fp_out, count, eof)
4354 +copy_viminfo_marks(virp, fp_out, count, eof, flags)
4361 char_u *line = virp->vir_line;
4363 @@ -1647,10 +1649,23 @@
4368 + list_T *list = NULL;
4371 if ((name_buf = alloc(LSIZE)) == NULL)
4376 + if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT)))
4378 + list = list_alloc();
4380 + set_vim_var_list(VV_OLDFILES, list);
4384 num_marked_files = get_viminfo_parameter('\'');
4385 while (!eof && (count < num_marked_files || fp_out == NULL))
4387 @@ -1681,6 +1696,11 @@
4393 + list_append_string(list, str, -1);
4397 * If fp_out == NULL, load marks for current buffer.
4398 * If fp_out != NULL, copy marks for buffers not in buflist.
4399 @@ -1688,7 +1708,7 @@
4400 load_marks = copy_marks_out = FALSE;
4403 - if (curbuf->b_ffname != NULL)
4404 + if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL)
4406 if (*name_buf == NUL) /* only need to do this once */
4407 home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE);
4408 diff -Naur vim72.orig/src/mbyte.c vim72/src/mbyte.c
4409 --- vim72.orig/src/mbyte.c 2008-07-14 05:38:05.000000000 -0700
4410 +++ vim72/src/mbyte.c 2009-03-12 11:54:50.142110910 -0700
4412 * where mblen() returns 0 for invalid character.
4413 * Therefore, following condition includes 0.
4415 - (void)mblen(NULL, 0); /* First reset the state. */
4416 + ignored = mblen(NULL, 0); /* First reset the state. */
4417 if (mblen(buf, (size_t)1) <= 0)
4420 @@ -2540,7 +2540,6 @@
4421 return (int)(p - q);
4424 -#if defined(FEAT_EVAL) || defined(PROTO)
4426 * Copy a character from "*fp" to "*tp" and advance the pointers.
4428 @@ -2555,7 +2554,6 @@
4435 * Return the offset from "p" to the first byte of a character. When "p" is
4436 @@ -3133,7 +3131,7 @@
4440 - for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i)
4441 + for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i)
4443 if (s[i] == '_' || s[i] == '-')
4445 @@ -5280,7 +5278,7 @@
4449 -preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
4450 +preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
4453 xim_log("xim_decide_input_style()\n");
4454 @@ -5314,7 +5312,7 @@
4458 -preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
4459 +preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
4461 XIMPreeditDrawCallbackStruct *draw_data;
4463 @@ -5386,7 +5384,7 @@
4464 draw_feedback = (char *)alloc(draw_data->chg_first
4467 - draw_feedback = realloc(draw_feedback,
4468 + draw_feedback = vim_realloc(draw_feedback,
4469 draw_data->chg_first + text->length);
4470 if (draw_feedback != NULL)
4472 @@ -5455,7 +5453,7 @@
4476 -preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
4477 +preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
4480 xim_log("preedit_caret_cbproc()\n");
4481 @@ -5464,7 +5462,7 @@
4485 -preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
4486 +preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
4489 xim_log("preedit_done_cbproc()\n");
4490 diff -Naur vim72.orig/src/menu.c vim72/src/menu.c
4491 --- vim72.orig/src/menu.c 2008-06-21 12:53:43.000000000 -0700
4492 +++ vim72/src/menu.c 2009-03-12 11:54:28.852745635 -0700
4493 @@ -1120,6 +1120,7 @@
4495 menu = menu->children;
4497 + vim_free(path_name);
4499 /* Now we have found the matching menu, and we list the mappings */
4500 /* Highlight title */
4501 diff -Naur vim72.orig/src/message.c vim72/src/message.c
4502 --- vim72.orig/src/message.c 2008-07-09 11:24:55.000000000 -0700
4503 +++ vim72/src/message.c 2009-03-12 11:55:13.623615309 -0700
4507 else if (msg_scrolled > Rows - 2
4508 - && (c == 'j' || c == K_DOWN || c == 'd'))
4509 + && (c == 'j' || c == K_DOWN || c == 'd' || c == 'f'))
4512 } while ((had_got_int && c == Ctrl_C)
4513 @@ -2504,7 +2504,6 @@
4516 case 'u': /* Up half a page */
4518 scroll = -(Rows / 2);
4521 @@ -2513,10 +2512,12 @@
4524 case 'b': /* one page back */
4526 scroll = -(Rows - 1);
4529 case ' ': /* one extra page */
4534 @@ -2552,7 +2553,6 @@
4536 /* Jump to the choices of the dialog. */
4538 - lines_left = Rows - 1;
4542 @@ -2560,6 +2560,9 @@
4546 + /* When there is some more output (wrapping line) display that
4547 + * without another prompt. */
4548 + lines_left = Rows - 1;
4551 #ifdef FEAT_CLIPBOARD
4552 @@ -3309,7 +3312,10 @@
4554 c = gui_mch_dialog(type, title, message, buttons, dfltbutton,
4557 + /* avoid a hit-enter prompt without clearing the cmdline */
4558 + need_wait_return = FALSE;
4559 + emsg_on_display = FALSE;
4560 + cmdline_row = msg_row;
4562 /* Flush output to avoid that further messages and redrawing is done
4563 * in the wrong order. */
4564 @@ -4556,7 +4562,13 @@
4565 remove_trailing_zeroes = TRUE;
4568 - if (fmt_spec == 'f' && abs_f > 1.0e307)
4569 + if (fmt_spec == 'f' &&
4577 /* Avoid a buffer overflow */
4579 @@ -4585,61 +4597,62 @@
4580 if (remove_trailing_zeroes)
4586 /* Using %g or %G: remove superfluous zeroes. */
4587 if (fmt_spec == 'f')
4588 - p = tmp + str_arg_l - 1;
4589 + tp = tmp + str_arg_l - 1;
4592 - p = (char *)vim_strchr((char_u *)tmp,
4593 + tp = (char *)vim_strchr((char_u *)tmp,
4594 fmt_spec == 'e' ? 'e' : 'E');
4598 /* Remove superfluous '+' and leading
4599 * zeroes from the exponent. */
4603 /* Change "1.0e+07" to "1.0e07" */
4604 - STRMOVE(p + 1, p + 2);
4605 + STRMOVE(tp + 1, tp + 2);
4608 - i = (p[1] == '-') ? 2 : 1;
4609 - while (p[i] == '0')
4610 + i = (tp[1] == '-') ? 2 : 1;
4611 + while (tp[i] == '0')
4613 /* Change "1.0e07" to "1.0e7" */
4614 - STRMOVE(p + i, p + i + 1);
4615 + STRMOVE(tp + i, tp + i + 1);
4623 - if (p != NULL && !precision_specified)
4624 + if (tp != NULL && !precision_specified)
4625 /* Remove trailing zeroes, but keep the one
4626 * just after a dot. */
4627 - while (p > tmp + 2 && *p == '0' && p[-1] != '.')
4628 + while (tp > tmp + 2 && *tp == '0'
4631 - STRMOVE(p, p + 1);
4633 + STRMOVE(tp, tp + 1);
4643 /* Be consistent: some printf("%e") use 1.0e+12
4644 * and some 1.0e+012. Remove one zero in the last
4646 - p = (char *)vim_strchr((char_u *)tmp,
4647 + tp = (char *)vim_strchr((char_u *)tmp,
4648 fmt_spec == 'e' ? 'e' : 'E');
4649 - if (p != NULL && (p[1] == '+' || p[1] == '-')
4651 - && vim_isdigit(p[3])
4652 - && vim_isdigit(p[4]))
4653 + if (tp != NULL && (tp[1] == '+' || tp[1] == '-')
4655 + && vim_isdigit(tp[3])
4656 + && vim_isdigit(tp[4]))
4658 - STRMOVE(p + 2, p + 3);
4659 + STRMOVE(tp + 2, tp + 3);
4663 diff -Naur vim72.orig/src/misc1.c vim72/src/misc1.c
4664 --- vim72.orig/src/misc1.c 2008-07-12 12:20:53.000000000 -0700
4665 +++ vim72/src/misc1.c 2009-03-12 11:54:40.553496578 -0700
4666 @@ -3245,9 +3245,9 @@
4668 /* When using ":silent" assume that <CR> was entered. */
4669 if (mouse_used != NULL)
4670 - MSG_PUTS(_("Type number or click with mouse (<Enter> cancels): "));
4671 + MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): "));
4673 - MSG_PUTS(_("Choice number (<Enter> cancels): "));
4674 + MSG_PUTS(_("Type number and <Enter> (empty cancels): "));
4676 /* Set the state such that text can be selected/copied/pasted and we still
4677 * get mouse events. */
4678 diff -Naur vim72.orig/src/misc2.c vim72/src/misc2.c
4679 --- vim72.orig/src/misc2.c 2008-07-23 12:12:56.000000000 -0700
4680 +++ vim72/src/misc2.c 2009-03-12 11:55:33.688900964 -0700
4684 #ifdef FEAT_VIRTUALEDIT
4685 - colnr_T oldcol = curwin->w_cursor.col + curwin->w_cursor.coladd;
4686 + colnr_T oldcol = curwin->w_cursor.col;
4687 + colnr_T oldcoladd = curwin->w_cursor.col + curwin->w_cursor.coladd;
4690 len = (colnr_T)STRLEN(ml_get_curline());
4691 @@ -535,7 +536,13 @@
4692 if (oldcol == MAXCOL)
4693 curwin->w_cursor.coladd = 0;
4694 else if (ve_flags == VE_ALL)
4695 - curwin->w_cursor.coladd = oldcol - curwin->w_cursor.col;
4697 + if (oldcoladd > curwin->w_cursor.col)
4698 + curwin->w_cursor.coladd = oldcoladd - curwin->w_cursor.col;
4700 + /* avoid weird number when there is a miscalculation or overflow */
4701 + curwin->w_cursor.coladd = 0;
4707 /* 3. check for available memory: call mch_avail_mem() */
4708 if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
4710 - vim_free((char *)p); /* System is low... no go! */
4711 + free((char *)p); /* System is low... no go! */
4715 @@ -1010,6 +1017,9 @@
4716 # if defined(FEAT_PROFILE)
4717 do_cmdline_cmd((char_u *)"profdel *");
4719 +# if defined(FEAT_KEYMAP)
4720 + do_cmdline_cmd((char_u *)"set keymap=");
4725 @@ -1034,6 +1044,9 @@
4726 free_regexp_stuff();
4733 set_expr_line(NULL);
4735 @@ -1257,7 +1270,6 @@
4736 return escaped_string;
4739 -#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
4741 * Return TRUE when 'shell' has "csh" in the tail.
4743 @@ -1266,9 +1278,7 @@
4745 return (strstr((char *)gettail(p_sh), "csh") != NULL);
4749 -#if defined(FEAT_EVAL) || defined(PROTO)
4751 * Escape "string" for use as a shell argument with system().
4752 * This uses single quotes, except when we know we need to use double qoutes
4753 @@ -1391,7 +1401,6 @@
4755 return escaped_string;
4760 * Like vim_strsave(), but make all characters uppercase.
4761 @@ -2565,7 +2574,7 @@
4765 - key = find_special_key(srcp, &modifiers, keycode);
4766 + key = find_special_key(srcp, &modifiers, keycode, FALSE);
4770 @@ -2601,10 +2610,11 @@
4771 * returns 0 if there is no match.
4774 -find_special_key(srcp, modp, keycode)
4775 +find_special_key(srcp, modp, keycode, keep_x_key)
4778 - int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
4779 + int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
4780 + int keep_x_key; /* don't translate xHome to Home key */
4783 char_u *end_of_name;
4784 @@ -2672,7 +2682,8 @@
4787 key = get_special_key_code(last_dash + 1);
4788 - key = handle_x_keys(key);
4790 + key = handle_x_keys(key);
4794 @@ -4698,7 +4709,8 @@
4795 stackp->ffs_filearray_cur = i + 1;
4796 ff_push(search_ctx, stackp);
4798 - simplify_filename(file_path);
4799 + if (!path_with_url(file_path))
4800 + simplify_filename(file_path);
4801 if (mch_dirname(ff_expand_buffer, MAXPATHL)
4804 diff -Naur vim72.orig/src/move.c vim72/src/move.c
4805 --- vim72.orig/src/move.c 2008-07-12 09:26:47.000000000 -0700
4806 +++ vim72/src/move.c 2009-03-12 11:54:46.913903059 -0700
4807 @@ -280,18 +280,20 @@
4809 if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
4811 - if (curwin->w_cursor.lnum < curwin->w_botline
4812 - && ((long)curwin->w_cursor.lnum
4813 + if (curwin->w_cursor.lnum < curwin->w_botline)
4815 + if (((long)curwin->w_cursor.lnum
4816 >= (long)curwin->w_botline - p_so
4818 || hasAnyFolding(curwin)
4825 - /* Cursor is above botline, check if there are 'scrolloff'
4826 - * window lines below the cursor. If not, need to scroll. */
4827 + /* Cursor is (a few lines) above botline, check if there are
4828 + * 'scrolloff' window lines below the cursor. If not, need to
4830 n = curwin->w_empty_rows;
4831 loff.lnum = curwin->w_cursor.lnum;
4833 @@ -317,6 +319,10 @@
4835 /* sufficient context, no need to scroll */
4836 check_botline = FALSE;
4839 + /* sufficient context, no need to scroll */
4840 + check_botline = FALSE;
4845 /* Approximate the value of w_botline */
4846 wp->w_botline += lnum - wp->w_topline;
4847 wp->w_topline = lnum;
4848 +#ifdef FEAT_AUTOCMD
4849 + wp->w_topline_was_set = TRUE;
4854 diff -Naur vim72.orig/src/nbdebug.c vim72/src/nbdebug.c
4855 --- vim72.orig/src/nbdebug.c 2008-06-22 08:38:58.000000000 -0700
4856 +++ vim72/src/nbdebug.c 2009-03-12 11:55:13.487606370 -0700
4858 u_int nb_dlevel = 0; /* nb_debug verbosity level */
4860 void nbdb(char *, ...);
4861 -void nbtrace(char *, ...);
4863 static int lookup(char *);
4864 #ifdef USE_NB_ERRORHANDLER
4866 } /* end nbdebug_log_init */
4878 - if (nb_debug!= NULL && (nb_dlevel & (NB_TRACE | NB_TRACE_VERBOSE))) {
4879 - va_start(ap, fmt);
4880 - vfprintf(nb_debug, fmt, ap);
4885 -} /* end nbtrace */
4891 @@ -136,23 +116,6 @@
4902 - if (nb_debug != NULL && nb_dlevel & NB_PRINT) {
4903 - va_start(ap, fmt);
4904 - vfprintf(nb_debug, fmt, ap);
4915 diff -Naur vim72.orig/src/nbdebug.h vim72/src/nbdebug.h
4916 --- vim72.orig/src/nbdebug.h 2008-06-22 07:31:50.000000000 -0700
4917 +++ vim72/src/nbdebug.h 2009-03-12 11:55:13.487606370 -0700
4921 void nbdbg(char *, ...);
4922 -void nbprt(char *, ...);
4923 -void nbtrace(char *, ...);
4925 void nbdebug_wait __ARGS((u_int wait_flags, char *wait_var, u_int wait_secs));
4926 void nbdebug_log_init __ARGS((char *log_var, char *level_var));
4945 #endif /* NBDEBUG */
4946 #endif /* NBDEBUG_H */
4947 diff -Naur vim72.orig/src/netbeans.c vim72/src/netbeans.c
4948 --- vim72.orig/src/netbeans.c 2008-07-13 09:19:54.000000000 -0700
4949 +++ vim72/src/netbeans.c 2009-03-12 11:55:13.479606090 -0700
4950 @@ -1043,7 +1043,7 @@
4951 nbdebug(("EVT: %s", buf));
4952 /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */
4954 - sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */
4955 + ignored = sock_write(sd, buf, (int)STRLEN(buf));
4959 @@ -1921,7 +1921,7 @@
4963 - nbdebug((" File %s not found in setBufferNumber\n", args));
4964 + nbdebug((" File %s not found in setBufferNumber\n", args));
4965 EMSG2("E642: File %s not found in setBufferNumber", args);
4968 @@ -2277,9 +2277,6 @@
4977 if (buf == NULL || buf->bufp == NULL)
4978 @@ -2303,13 +2300,10 @@
4979 pos = get_off_or_lnum(buf->bufp, &args);
4985 - strtol(cp, &cp, 10);
4986 + ignored = (int)strtol(cp, &cp, 10);
4987 args = (char_u *)cp;
4990 + if (ignored != -1)
4992 nbdebug((" partial line annotation -- Not Yet Implemented!\n"));
4994 @@ -2321,7 +2315,7 @@
4998 - coloncmd(":sign place %d line=%d name=%d buffer=%d",
4999 + coloncmd(":sign place %d line=%ld name=%d buffer=%d",
5000 serNum, pos->lnum, typeNum, buf->bufp->b_fnum);
5001 if (typeNum == curPCtype)
5002 coloncmd(":sign jump %d buffer=%d", serNum,
5003 @@ -2425,7 +2419,7 @@
5007 - ":sign place %d line=%d name=%d buffer=%d",
5008 + ":sign place %d line=%ld name=%d buffer=%d",
5009 guardId++, lnum, GUARDED,
5012 @@ -2924,44 +2918,26 @@
5016 - * Tell netbeans a file was closed.
5017 + * Tell netbeans that a file was deleted or wiped out.
5020 -netbeans_file_closed(buf_T *bufp)
5021 +netbeans_file_killed(buf_T *bufp)
5023 int bufno = nb_getbufno(bufp);
5024 nbbuf_T *nbbuf = nb_get_buf(bufno);
5025 char buffer[2*MAXPATHL];
5027 - if (!haveConnection || bufno < 0)
5030 - if (!netbeansCloseFile)
5032 - nbdebug(("Ignoring file_closed for %s. File was closed from IDE\n",
5034 + if (!haveConnection || bufno == -1)
5038 - nbdebug(("netbeans_file_closed:\n"));
5039 - nbdebug((" Closing bufno: %d", bufno));
5040 - if (curbuf != NULL && curbuf != bufp)
5042 - nbdebug((" Curbuf bufno: %d\n", nb_getbufno(curbuf)));
5044 - else if (curbuf == bufp)
5046 - nbdebug((" curbuf == bufp\n"));
5051 + nbdebug(("netbeans_file_killed:\n"));
5052 + nbdebug((" Killing bufno: %d", bufno));
5054 sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno);
5056 nbdebug(("EVT: %s", buffer));
5058 - nb_send(buffer, "netbeans_file_closed");
5059 + nb_send(buffer, "netbeans_file_killed");
5063 diff -Naur vim72.orig/src/normal.c vim72/src/normal.c
5064 --- vim72.orig/src/normal.c 2008-07-31 13:03:08.000000000 -0700
5065 +++ vim72/src/normal.c 2009-03-12 11:55:13.415602459 -0700
5067 static void nv_cursorhold __ARGS((cmdarg_T *cap));
5070 +static char *e_noident = N_("E349: No identifier under cursor");
5073 * Function to be called for a Normal or Visual mode command.
5074 * The argument is a cmdarg_T.
5076 static int old_mapped_len = 0;
5080 + int set_prevcount = FALSE;
5083 vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
5085 @@ -613,7 +618,12 @@
5086 /* When not finishing an operator and no register name typed, reset the
5088 if (!finish_op && !oap->regname)
5092 + set_prevcount = TRUE;
5097 /* Restore counts from before receiving K_CURSORHOLD. This means after
5098 @@ -641,10 +651,7 @@
5099 * Get the command character from the user.
5103 -#ifdef FEAT_LANGMAP
5104 LANGMAP_ADJUST(c, TRUE);
5109 @@ -717,7 +724,15 @@
5110 * command, so that v:count can be used in an expression mapping
5111 * right after the count. */
5112 if (toplevel && stuff_empty())
5113 - set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0);
5115 + long count = ca.count0;
5117 + /* multiply with ca.opcount the same way as below */
5118 + if (ca.opcount != 0)
5119 + count = ca.opcount * (count == 0 ? 1 : count);
5120 + set_vcount(count, count == 0 ? 1 : count, set_prevcount);
5121 + set_prevcount = FALSE; /* only set v:prevcount once */
5128 ++no_zero_mapping; /* don't map zero here */
5130 -#ifdef FEAT_LANGMAP
5131 LANGMAP_ADJUST(c, TRUE);
5138 ++allow_keys; /* no mapping for nchar, but keys */
5139 c = plain_vgetc(); /* get next character */
5140 -#ifdef FEAT_LANGMAP
5141 LANGMAP_ADJUST(c, TRUE);
5145 #ifdef FEAT_CMDL_INFO
5147 * Only set v:count when called from main() and not a stuffed command.
5149 if (toplevel && stuff_empty())
5150 - set_vcount(ca.count0, ca.count1);
5151 + set_vcount(ca.count0, ca.count1, set_prevcount);
5156 * "gr", "g'" and "g`".
5158 ca.nchar = plain_vgetc();
5159 -#ifdef FEAT_LANGMAP
5160 LANGMAP_ADJUST(ca.nchar, TRUE);
5162 #ifdef FEAT_CMDL_INFO
5163 need_flushbuf |= add_to_showcmd(ca.nchar);
5165 @@ -1044,10 +1053,8 @@
5169 -#ifdef FEAT_LANGMAP
5170 /* adjust chars > 127, except after "tTfFr" commands */
5171 LANGMAP_ADJUST(*cp, !lang);
5173 #ifdef FEAT_RIGHTLEFT
5174 /* adjust Hebrew mapped char */
5175 if (p_hkmap && lang && KeyTyped)
5176 @@ -1132,7 +1139,8 @@
5180 - did_cursorhold = FALSE;
5181 + if (ca.cmdchar != K_IGNORE)
5182 + did_cursorhold = FALSE;
5186 @@ -3509,7 +3517,7 @@
5187 if (find_type & FIND_STRING)
5188 EMSG(_("E348: No string under cursor"));
5190 - EMSG(_("E349: No identifier under cursor"));
5191 + EMSG(_(e_noident));
5195 @@ -4611,9 +4619,7 @@
5197 ++allow_keys; /* no mapping for nchar, but allow key codes */
5198 nchar = plain_vgetc();
5199 -#ifdef FEAT_LANGMAP
5200 LANGMAP_ADJUST(nchar, TRUE);
5204 #ifdef FEAT_CMDL_INFO
5205 @@ -4969,9 +4975,7 @@
5207 ++allow_keys; /* no mapping for nchar, but allow key codes */
5208 nchar = plain_vgetc();
5209 -#ifdef FEAT_LANGMAP
5210 LANGMAP_ADJUST(nchar, TRUE);
5214 #ifdef FEAT_CMDL_INFO
5215 @@ -5469,6 +5473,20 @@
5216 STRCPY(buf, "he! ");
5219 + /* An external command will probably use an argument starting
5220 + * with "-" as an option. To avoid trouble we skip the "-". */
5221 + while (*ptr == '-' && n > 0)
5228 + EMSG(_(e_noident)); /* found dashes only */
5233 /* When a count is given, turn it into a range. Is this
5234 * really what we want? */
5235 isman = (STRCMP(kp, "man") == 0);
5236 @@ -5511,37 +5529,59 @@
5238 * Now grab the chars in the identifier
5240 - if (cmdchar == '*')
5241 - aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
5242 - else if (cmdchar == '#')
5243 - aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
5244 - else if (cmdchar == 'K' && !kp_help)
5245 - aux_ptr = (char_u *)" \t\\\"|!";
5247 - /* Don't escape spaces and Tabs in a tag with a backslash */
5248 - aux_ptr = (char_u *)"\\|\"";
5250 - p = buf + STRLEN(buf);
5253 - /* put a backslash before \ and some others */
5254 - if (vim_strchr(aux_ptr, *ptr) != NULL)
5257 - /* When current byte is a part of multibyte character, copy all bytes
5258 - * of that character. */
5260 + if (cmdchar == 'K' && !kp_help)
5262 + /* Escape the argument properly for a shell command */
5263 + ptr = vim_strnsave(ptr, n);
5264 + p = vim_strsave_shellescape(ptr, TRUE);
5269 - int len = (*mb_ptr2len)(ptr) - 1;
5271 - for (i = 0; i < len && n >= 1; ++i, --n)
5276 + buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
5288 + if (cmdchar == '*')
5289 + aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
5290 + else if (cmdchar == '#')
5291 + aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
5293 + /* Don't escape spaces and Tabs in a tag with a backslash */
5294 + aux_ptr = (char_u *)"\\|\"\n*?[";
5296 + p = buf + STRLEN(buf);
5299 + /* put a backslash before \ and some others */
5300 + if (vim_strchr(aux_ptr, *ptr) != NULL)
5303 + /* When current byte is a part of multibyte character, copy all
5304 + * bytes of that character. */
5308 + int len = (*mb_ptr2len)(ptr) - 1;
5310 + for (i = 0; i < len && n >= 1; ++i, --n)
5322 * Execute the command.
5323 @@ -6728,6 +6768,8 @@
5324 /* Visual mode "r" */
5332 @@ -7784,7 +7826,7 @@
5334 i = curwin->w_leftcol;
5335 /* Go to the middle of the screen line. When 'number' is on and lines
5336 - * are wrapping the middle can be more to the left.*/
5337 + * are wrapping the middle can be more to the left. */
5338 if (cap->nchar == 'm')
5339 i += (W_WIDTH(curwin) - curwin_col_off()
5340 + ((curwin->w_p_wrap && i > 0)
5341 diff -Naur vim72.orig/src/ops.c vim72/src/ops.c
5342 --- vim72.orig/src/ops.c 2008-06-21 13:08:59.000000000 -0700
5343 +++ vim72/src/ops.c 2009-03-12 11:55:27.544506216 -0700
5348 - int startspaces; /* 'extra' cols of first char */
5349 - int endspaces; /* 'extra' cols of first char */
5350 + int startspaces; /* 'extra' cols before first char */
5351 + int endspaces; /* 'extra' cols after last char */
5352 int textlen; /* chars in block */
5353 - char_u *textstart; /* pointer to 1st char in block */
5354 - colnr_T textcol; /* cols of chars (at least part.) in block */
5355 + char_u *textstart; /* pointer to 1st char (partially) in block */
5356 + colnr_T textcol; /* index of chars (partially) in block */
5357 colnr_T start_vcol; /* start col of 1st char wholly inside block */
5358 colnr_T end_vcol; /* start col of 1st char wholly after block */
5359 #ifdef FEAT_VISUALEXTRA
5360 @@ -382,15 +382,14 @@
5362 int left = (oap->op_type == OP_LSHIFT);
5363 int oldstate = State;
5365 - char_u *newp, *oldp, *midp, *ptr;
5367 + char_u *newp, *oldp;
5368 int oldcol = curwin->w_cursor.col;
5369 int p_sw = (int)curbuf->b_p_sw;
5370 int p_ts = (int)curbuf->b_p_ts;
5371 struct block_def bd;
5374 - colnr_T vcol, col = 0, ws_vcol;
5379 @@ -456,67 +455,89 @@
5383 - vcol = oap->start_vcol;
5384 - /* walk vcol past ws to be removed */
5385 - for (midp = oldp + bd.textcol;
5386 - vcol < (oap->start_vcol + total) && vim_iswhite(*midp); )
5388 - incr = lbr_chartabsize_adv(&midp, (colnr_T)vcol);
5391 - /* internal is the block-internal ws replacing a split TAB */
5392 - if (vcol > (oap->start_vcol + total))
5394 - /* we have to split the TAB *(midp-1) */
5395 - internal = vcol - (oap->start_vcol + total);
5397 - /* if 'expandtab' is not set, use TABs */
5398 + colnr_T destination_col; /* column to which text in block will
5400 + char_u *verbatim_copy_end; /* end of the part of the line which is
5401 + copied verbatim */
5402 + colnr_T verbatim_copy_width;/* the (displayed) width of this part
5404 + unsigned fill; /* nr of spaces that replace a TAB */
5405 + unsigned new_line_len; /* the length of the line after the
5407 + size_t block_space_width;
5408 + size_t shift_amount;
5409 + char_u *non_white = bd.textstart;
5410 + colnr_T non_white_col;
5412 - split = bd.startspaces + internal;
5415 - if (!curbuf->b_p_et)
5417 - for (ptr = oldp, col = 0; ptr < oldp+bd.textcol; )
5418 - col += lbr_chartabsize_adv(&ptr, (colnr_T)col);
5420 + * Firstly, let's find the first non-whitespace character that is
5421 + * displayed after the block's start column and the character's column
5422 + * number. Also, let's calculate the width of all the whitespace
5423 + * characters that are displayed in the block and precede the searched
5424 + * non-whitespace character.
5427 - /* col+1 now equals the start col of the first char of the
5428 - * block (may be < oap.start_vcol if we're splitting a TAB) */
5429 - i = ((col % p_ts) + split) / p_ts; /* number of tabs */
5432 - j = ((col % p_ts) + split) % p_ts; /* number of spp */
5436 + /* If "bd.startspaces" is set, "bd.textstart" points to the character,
5437 + * the part of which is displayed at the block's beginning. Let's start
5438 + * searching from the next character. */
5439 + if (bd.startspaces)
5440 + mb_ptr_adv(non_white);
5442 - newp = alloc_check(bd.textcol + i + j + (unsigned)STRLEN(midp) + 1);
5445 - vim_memset(newp, NUL, (size_t)(bd.textcol + i + j + STRLEN(midp) + 1));
5446 + /* The character's column is in "bd.start_vcol". */
5447 + non_white_col = bd.start_vcol;
5449 - /* copy first part we want to keep */
5450 - mch_memmove(newp, oldp, (size_t)bd.textcol);
5451 - /* Now copy any TABS and spp to ensure correct alignment! */
5452 - while (vim_iswhite(*midp))
5453 + while (vim_iswhite(*non_white))
5460 + incr = lbr_chartabsize_adv(&non_white, non_white_col);
5461 + non_white_col += incr;
5463 - /* We might have an extra TAB worth of spp now! */
5464 - if (j / p_ts && !curbuf->b_p_et)
5466 + block_space_width = non_white_col - oap->start_vcol;
5467 + /* We will shift by "total" or "block_space_width", whichever is less.
5469 + shift_amount = (block_space_width < total? block_space_width: total);
5471 + /* The column to which we will shift the text. */
5472 + destination_col = non_white_col - shift_amount;
5474 + /* Now let's find out how much of the beginning of the line we can
5475 + * reuse without modification. */
5476 + verbatim_copy_end = bd.textstart;
5477 + verbatim_copy_width = bd.start_vcol;
5479 + /* If "bd.startspaces" is set, "bd.textstart" points to the character
5480 + * preceding the block. We have to subtract its width to obtain its
5481 + * column number. */
5482 + if (bd.startspaces)
5483 + verbatim_copy_width -= bd.start_char_vcols;
5484 + while (verbatim_copy_width < destination_col)
5488 + incr = lbr_chartabsize(verbatim_copy_end, verbatim_copy_width);
5489 + if (verbatim_copy_width + incr > destination_col)
5491 + verbatim_copy_width += incr;
5492 + mb_ptr_adv(verbatim_copy_end);
5494 - copy_chars(newp + bd.textcol, (size_t)i, TAB);
5495 - copy_spaces(newp + bd.textcol + i, (size_t)j);
5498 - STRMOVE(newp + STRLEN(newp), midp);
5499 + /* If "destination_col" is different from the width of the initial
5500 + * part of the line that will be copied, it means we encountered a tab
5501 + * character, which we will have to partly replace with spaces. */
5502 + fill = destination_col - verbatim_copy_width;
5504 + /* The replacement line will consist of:
5505 + * - the beginning of the original line up to "verbatim_copy_end",
5506 + * - "fill" number of spaces,
5507 + * - the rest of the line, pointed to by non_white. */
5508 + new_line_len = (unsigned)(verbatim_copy_end - oldp)
5510 + + (unsigned)STRLEN(non_white) + 1;
5512 + newp = alloc_check(new_line_len);
5515 + mch_memmove(newp, oldp, (size_t)(verbatim_copy_end - oldp));
5516 + copy_spaces(newp + (verbatim_copy_end - oldp), (size_t)fill);
5517 + STRMOVE(newp + (verbatim_copy_end - oldp) + fill, non_white);
5519 /* replace the line */
5520 ml_replace(curwin->w_cursor.lnum, newp, FALSE);
5521 @@ -2209,12 +2230,15 @@
5523 for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
5527 block_prep(oap, &bd, pos.lnum, FALSE);
5528 pos.col = bd.textcol;
5529 - did_change = swapchars(oap->op_type, &pos, bd.textlen);
5530 + one_change = swapchars(oap->op_type, &pos, bd.textlen);
5531 + did_change |= one_change;
5533 # ifdef FEAT_NETBEANS_INTG
5534 - if (usingNetbeans && did_change)
5535 + if (usingNetbeans && one_change)
5537 char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
5539 @@ -4848,7 +4872,8 @@
5540 * - textlen includes the first/last char to be (partly) deleted
5541 * - start/endspaces is the number of columns that are taken by the
5542 * first/last deleted char minus the number of columns that have to be
5543 - * deleted. for yank and tilde:
5545 + * for yank and tilde:
5546 * - textlen includes the first/last char to be wholly yanked
5547 * - start/endspaces is the number of columns of the first/last yanked char
5548 * that are to be yanked.
5549 diff -Naur vim72.orig/src/option.c vim72/src/option.c
5550 --- vim72.orig/src/option.c 2008-07-18 06:05:33.000000000 -0700
5551 +++ vim72/src/option.c 2009-03-12 11:55:13.683619779 -0700
5552 @@ -2593,13 +2593,13 @@
5554 (char_u *)&p_viminfo, PV_NONE,
5555 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
5556 - {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
5557 + {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
5561 - (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
5562 + (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
5564 - {(char_u *)"", (char_u *)"'20,<50,s10,h"}
5565 + {(char_u *)"", (char_u *)"'100,<50,s10,h"}
5569 @@ -4119,11 +4119,23 @@
5570 && options[opt_idx].var == VAR_WIN)
5573 - /* Disallow changing some options from modelines */
5574 - if ((opt_flags & OPT_MODELINE) && (flags & P_SECURE))
5575 + /* Disallow changing some options from modelines. */
5576 + if (opt_flags & OPT_MODELINE)
5578 - errmsg = (char_u *)_("E520: Not allowed in a modeline");
5580 + if (flags & P_SECURE)
5582 + errmsg = (char_u *)_("E520: Not allowed in a modeline");
5586 + /* In diff mode some options are overruled. This avoids that
5587 + * 'foldmethod' becomes "marker" instead of "diff" and that
5588 + * "wrap" gets set. */
5589 + if (curwin->w_p_diff
5590 + && (options[opt_idx].indir == PV_FDM
5591 + || options[opt_idx].indir == PV_WRAP))
5597 @@ -5268,6 +5280,21 @@
5602 +static void redraw_titles __ARGS((void));
5605 + * Redraw the window title and/or tab page text later.
5607 +static void redraw_titles()
5609 + need_maketitle = TRUE;
5610 +# ifdef FEAT_WINDOWS
5611 + redraw_tabline = TRUE;
5617 * Set a string option to a new value (without checking the effect).
5618 * The string is copied into allocated memory.
5619 @@ -5407,6 +5434,10 @@
5620 int did_chartab = FALSE;
5622 long_u free_oldval = (options[opt_idx].flags & P_ALLOCED);
5624 + /* set when changing an option that only requires a redraw in the GUI */
5625 + int redraw_gui_only = FALSE;
5628 /* Get the global option to compare with, otherwise we would have to check
5629 * two values for all local options. */
5630 @@ -5668,7 +5699,7 @@
5633 /* May show a "+" in the title now. */
5634 - need_maketitle = TRUE;
5637 /* Add 'fileencoding' to the swap file. */
5638 ml_setflags(curbuf);
5639 @@ -5687,7 +5718,7 @@
5643 - need_maketitle = TRUE;
5648 @@ -5766,14 +5797,28 @@
5649 /* load or unload key mapping tables */
5650 errmsg = keymap_init();
5652 - /* When successfully installed a new keymap switch on using it. */
5653 - if (*curbuf->b_p_keymap != NUL && errmsg == NULL)
5654 + if (errmsg == NULL)
5656 - curbuf->b_p_iminsert = B_IMODE_LMAP;
5657 - if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
5658 - curbuf->b_p_imsearch = B_IMODE_LMAP;
5659 - set_iminsert_global();
5660 - set_imsearch_global();
5661 + if (*curbuf->b_p_keymap != NUL)
5663 + /* Installed a new keymap, switch on using it. */
5664 + curbuf->b_p_iminsert = B_IMODE_LMAP;
5665 + if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
5666 + curbuf->b_p_imsearch = B_IMODE_LMAP;
5670 + /* Cleared the keymap, may reset 'iminsert' and 'imsearch'. */
5671 + if (curbuf->b_p_iminsert == B_IMODE_LMAP)
5672 + curbuf->b_p_iminsert = B_IMODE_NONE;
5673 + if (curbuf->b_p_imsearch == B_IMODE_LMAP)
5674 + curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
5676 + if ((opt_flags & OPT_LOCAL) == 0)
5678 + set_iminsert_global();
5679 + set_imsearch_global();
5681 # ifdef FEAT_WINDOWS
5682 status_redraw_curbuf();
5684 @@ -5796,7 +5841,7 @@
5686 curbuf->b_p_tx = FALSE;
5688 - need_maketitle = TRUE;
5691 /* update flag in swap file */
5692 ml_setflags(curbuf);
5693 @@ -6055,6 +6100,7 @@
5694 errmsg = (char_u *)N_("E596: Invalid font(s)");
5697 + redraw_gui_only = TRUE;
5699 # ifdef FEAT_XFONTSET
5700 else if (varp == &p_guifontset)
5701 @@ -6063,6 +6109,7 @@
5702 errmsg = (char_u *)N_("E597: can't select fontset");
5703 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
5704 errmsg = (char_u *)N_("E598: Invalid fontset");
5705 + redraw_gui_only = TRUE;
5709 @@ -6072,6 +6119,7 @@
5710 errmsg = (char_u *)N_("E533: can't select wide font");
5711 else if (gui_get_wide_font() == FAIL)
5712 errmsg = (char_u *)N_("E534: Invalid wide font");
5713 + redraw_gui_only = TRUE;
5717 @@ -6133,13 +6181,24 @@
5720 else if (varp == &p_go)
5722 gui_init_which_components(oldval);
5723 + redraw_gui_only = TRUE;
5727 #if defined(FEAT_GUI_TABLINE)
5729 else if (varp == &p_gtl)
5731 redraw_tabline = TRUE;
5732 + redraw_gui_only = TRUE;
5734 + /* 'guitabtooltip' */
5735 + else if (varp == &p_gtt)
5737 + redraw_gui_only = TRUE;
5741 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
5742 @@ -6717,7 +6776,11 @@
5744 if (curwin->w_curswant != MAXCOL)
5745 curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */
5746 - check_redraw(options[opt_idx].flags);
5748 + /* check redraw when it's not a GUI option or the GUI is active. */
5749 + if (!redraw_gui_only || gui.in_use)
5751 + check_redraw(options[opt_idx].flags);
5755 @@ -7105,22 +7168,28 @@
5756 curbuf->b_did_warn = FALSE;
5759 - need_maketitle = TRUE;
5765 /* when 'modifiable' is changed, redraw the window title */
5766 else if ((int *)varp == &curbuf->b_p_ma)
5767 - need_maketitle = TRUE;
5771 /* when 'endofline' is changed, redraw the window title */
5772 else if ((int *)varp == &curbuf->b_p_eol)
5773 - need_maketitle = TRUE;
5775 - /* when 'bomb' is changed, redraw the window title */
5780 + /* when 'bomb' is changed, redraw the window title and tab page text */
5781 else if ((int *)varp == &curbuf->b_p_bomb)
5782 - need_maketitle = TRUE;
5790 /* when 'bin' is set also set some other options */
5791 @@ -7128,7 +7197,7 @@
5793 set_options_bin(old_value, curbuf->b_p_bin, opt_flags);
5795 - need_maketitle = TRUE;
5800 @@ -7279,7 +7348,7 @@
5802 save_file_ff(curbuf); /* Buffer is unchanged */
5804 - need_maketitle = TRUE;
5808 modified_was_set = value;
5809 @@ -7714,7 +7783,7 @@
5813 - /* 'foldminlevel' */
5814 + /* 'foldminlines' */
5815 else if (pp == &curwin->w_p_fml)
5817 foldUpdateAll(curwin);
5818 @@ -7974,6 +8043,11 @@
5819 else /* curwin->w_p_scr > curwin->w_height */
5820 curwin->w_p_scr = curwin->w_height;
5824 + errmsg = e_positive;
5829 errmsg = e_positive;
5830 @@ -8227,13 +8301,13 @@
5832 if (number == 0 && string != NULL)
5837 /* Either we are given a string or we are setting option
5839 - for (index = 0; string[index] == '0'; ++index)
5840 + for (idx = 0; string[idx] == '0'; ++idx)
5842 - if (string[index] != NUL || index == 0)
5843 + if (string[idx] != NUL || idx == 0)
5845 /* There's another character after zeros or the string
5846 * is empty. In both cases, we are trying to set a
5847 @@ -8323,7 +8397,7 @@
5849 --arg; /* put arg at the '<' */
5851 - key = find_special_key(&arg, &modifiers, TRUE);
5852 + key = find_special_key(&arg, &modifiers, TRUE, TRUE);
5853 if (modifiers) /* can't handle modifiers here */
5856 @@ -10093,25 +10167,110 @@
5860 - * Any character has an equivalent character. This is used for keyboards that
5861 - * have a special language mode that sends characters above 128 (although
5862 - * other characters can be translated too).
5863 + * Any character has an equivalent 'langmap' character. This is used for
5864 + * keyboards that have a special language mode that sends characters above
5865 + * 128 (although other characters can be translated too). The "to" field is a
5866 + * Vim command character. This avoids having to switch the keyboard back to
5867 + * ASCII mode when leaving Insert mode.
5869 + * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
5871 + * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
5872 + * langmap_entry_T. This does the same as langmap_mapchar[] for characters >=
5877 + * With multi-byte support use growarray for 'langmap' chars >= 256
5885 +static garray_T langmap_mapga;
5886 +static void langmap_set_entry __ARGS((int from, int to));
5889 - * char_u langmap_mapchar[256];
5890 - * Normally maps each of the 128 upper chars to an <128 ascii char; used to
5891 - * "translate" native lang chars in normal mode or some cases of
5892 - * insert mode without having to tediously switch lang mode back&forth.
5893 + * Search for an entry in "langmap_mapga" for "from". If found set the "to"
5894 + * field. If not found insert a new entry at the appropriate location.
5897 +langmap_set_entry(from, to)
5901 + langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
5903 + int b = langmap_mapga.ga_len;
5905 + /* Do a binary search for an existing entry. */
5908 + int i = (a + b) / 2;
5909 + int d = entries[i].from - from;
5913 + entries[i].to = to;
5922 + if (ga_grow(&langmap_mapga, 1) != OK)
5923 + return; /* out of memory */
5925 + /* insert new entry at position "a" */
5926 + entries = (langmap_entry_T *)(langmap_mapga.ga_data) + a;
5927 + mch_memmove(entries + 1, entries,
5928 + (langmap_mapga.ga_len - a) * sizeof(langmap_entry_T));
5929 + ++langmap_mapga.ga_len;
5930 + entries[0].from = from;
5931 + entries[0].to = to;
5935 + * Apply 'langmap' to multi-byte character "c" and return the result.
5938 +langmap_adjust_mb(c)
5941 + langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
5943 + int b = langmap_mapga.ga_len;
5947 + int i = (a + b) / 2;
5948 + int d = entries[i].from - c;
5951 + return entries[i].to; /* found matching entry */
5957 + return c; /* no entry found, return "c" unmodified */
5966 - for (i = 0; i < 256; i++) /* we init with a-one-to one map */
5967 - langmap_mapchar[i] = i;
5968 + for (i = 0; i < 256; i++)
5969 + langmap_mapchar[i] = i; /* we init with a one-to-one map */
5971 + ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8);
5976 @@ -10125,7 +10284,10 @@
5980 - langmap_init(); /* back to one-to-one map first */
5982 + ga_clear(&langmap_mapga); /* clear the previous map first */
5984 + langmap_init(); /* back to one-to-one map */
5986 for (p = p_langmap; p[0] != NUL; )
5988 @@ -10175,7 +10337,13 @@
5992 - langmap_mapchar[from & 255] = to;
5996 + langmap_set_entry(from, to);
5999 + langmap_mapchar[from & 255] = to;
6001 /* Advance to next pair */
6003 diff -Naur vim72.orig/src/os_unix.c vim72/src/os_unix.c
6004 --- vim72.orig/src/os_unix.c 2008-08-06 04:01:40.000000000 -0700
6005 +++ vim72/src/os_unix.c 2009-03-12 11:55:13.671618662 -0700
6007 && defined(FEAT_TITLE) && !defined(FEAT_GUI_GTK)
6008 # define SET_SIG_ALARM
6009 static RETSIGTYPE sig_alarm __ARGS(SIGPROTOARG);
6010 -static int sig_alarm_called;
6011 +/* volatile because it is used in signal handler sig_alarm(). */
6012 +static volatile int sig_alarm_called;
6014 static RETSIGTYPE deathtrap __ARGS(SIGPROTOARG);
6016 @@ -201,13 +202,16 @@
6017 # define SIG_ERR ((RETSIGTYPE (*)())-1)
6020 -static int do_resize = FALSE;
6021 +/* volatile because it is used in signal handler sig_winch(). */
6022 +static volatile int do_resize = FALSE;
6024 static char_u *extra_shell_arg = NULL;
6025 static int show_shell_mess = TRUE;
6027 -static int deadly_signal = 0; /* The signal we caught */
6028 -static int in_mch_delay = FALSE; /* sleeping in mch_delay() */
6029 +/* volatile because it is used in signal handler deathtrap(). */
6030 +static volatile int deadly_signal = 0; /* The signal we caught */
6031 +/* volatile because it is used in signal handler deathtrap(). */
6032 +static volatile int in_mch_delay = FALSE; /* sleeping in mch_delay() */
6034 static int curr_tmode = TMODE_COOK; /* contains current terminal mode */
6036 @@ -315,12 +319,15 @@
6037 {-1, "Unknown!", FALSE}
6041 + * Write s[len] to the screen.
6048 - write(1, (char *)s, len);
6049 + ignored = (int)write(1, (char *)s, len);
6050 if (p_wd) /* Unix is too fast, slow down a bit more */
6051 RealWaitForChar(read_cmd_fd, p_wd, NULL);
6057 - * We need correct potatotypes for a signal function, otherwise mean compilers
6058 + * We need correct prototypes for a signal function, otherwise mean compilers
6059 * will barf when the second argument to signal() is ``wrong''.
6060 * Let me try it with a few tricky defines from my own osdef.h (jw).
6062 @@ -1065,13 +1072,18 @@
6067 +#if defined(_REENTRANT) && defined(SIGCONT)
6069 * On Solaris with multi-threading, suspending might not work immediately.
6070 * Catch the SIGCONT signal, which will be used as an indication whether the
6071 * suspending has been done or not.
6073 + * On Linux, signal is not always handled immediately either.
6074 + * See https://bugs.launchpad.net/bugs/291373
6076 + * volatile because it is used in in signal handler sigcont_handler().
6078 -static int sigcont_received;
6079 +static volatile int sigcont_received;
6080 static RETSIGTYPE sigcont_handler __ARGS(SIGPROTOARG);
6083 @@ -1115,15 +1127,28 @@
6088 +# if defined(_REENTRANT) && defined(SIGCONT)
6089 sigcont_received = FALSE;
6091 kill(0, SIGTSTP); /* send ourselves a STOP signal */
6093 - /* When we didn't suspend immediately in the kill(), do it now. Happens
6094 - * on multi-threaded Solaris. */
6095 - if (!sigcont_received)
6097 +# if defined(_REENTRANT) && defined(SIGCONT)
6099 + * Wait for the SIGCONT signal to be handled. It generally happens
6100 + * immediately, but somehow not all the time. Do not call pause()
6101 + * because there would be race condition which would hang Vim if
6102 + * signal happened in between the test of sigcont_received and the
6103 + * call to pause(). If signal is not yet received, call sleep(0)
6104 + * to just yield CPU. Signal should then be received. If somehow
6105 + * it's still not received, sleep 1, 2, 3 ms. Don't bother waiting
6106 + * further if signal is not received after 1+2+3+4 ms (not expected
6111 + for (wait = 0; !sigcont_received && wait <= 3L; wait++)
6112 + /* Loop is not entered most of the time */
6113 + mch_delay(wait, FALSE);
6118 @@ -1172,7 +1197,7 @@
6120 signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL);
6123 +#if defined(_REENTRANT) && defined(SIGCONT)
6124 signal(SIGCONT, sigcont_handler);
6127 @@ -1231,7 +1256,7 @@
6130 catch_signals(SIG_DFL, SIG_DFL);
6132 +#if defined(_REENTRANT) && defined(SIGCONT)
6133 /* SIGCONT isn't in the list, because its default action is ignore */
6134 signal(SIGCONT, SIG_DFL);
6136 @@ -2905,7 +2930,7 @@
6137 * Ignore any errors.
6139 #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
6140 - signal_stack = malloc(SIGSTKSZ);
6141 + signal_stack = (char *)alloc(SIGSTKSZ);
6142 init_signal_stack();
6145 @@ -2936,7 +2961,8 @@
6150 + /* Don't close the display for GTK 1, it is done in exit(). */
6151 +# if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2))
6152 if (x11_display != NULL
6153 # ifdef FEAT_XCLIPBOARD
6154 && x11_display != xterm_dpy
6155 @@ -3926,9 +3952,9 @@
6159 - dup(fd); /* To replace stdin (file descriptor 0) */
6160 - dup(fd); /* To replace stdout (file descriptor 1) */
6161 - dup(fd); /* To replace stderr (file descriptor 2) */
6162 + ignored = dup(fd); /* To replace stdin (fd 0) */
6163 + ignored = dup(fd); /* To replace stdout (fd 1) */
6164 + ignored = dup(fd); /* To replace stderr (fd 2) */
6166 /* Don't need this now that we've duplicated it */
6168 @@ -3946,7 +3972,17 @@
6169 * children can be kill()ed. Don't do this when using pipes,
6170 * because stdin is not a tty, we would lose /dev/tty. */
6174 +# if defined(SIGHUP)
6175 + /* When doing "!xterm&" and 'shell' is bash: the shell
6176 + * will exit and send SIGHUP to all processes in its
6177 + * group, killing the just started process. Ignore SIGHUP
6178 + * to avoid that. (suggested by Simon Schubert)
6180 + signal(SIGHUP, SIG_IGN);
6185 if (pty_slave_fd >= 0)
6186 @@ -3996,13 +4032,13 @@
6188 /* set up stdin/stdout/stderr for the child */
6190 - dup(pty_slave_fd);
6191 + ignored = dup(pty_slave_fd);
6193 - dup(pty_slave_fd);
6194 + ignored = dup(pty_slave_fd);
6198 - dup(pty_slave_fd);
6199 + ignored = dup(pty_slave_fd);
6202 close(pty_slave_fd); /* has been dupped, close it now */
6203 @@ -4013,13 +4049,13 @@
6204 /* set up stdin for the child */
6205 close(fd_toshell[1]);
6207 - dup(fd_toshell[0]);
6208 + ignored = dup(fd_toshell[0]);
6209 close(fd_toshell[0]);
6211 /* set up stdout for the child */
6212 close(fd_fromshell[0]);
6214 - dup(fd_fromshell[1]);
6215 + ignored = dup(fd_fromshell[1]);
6216 close(fd_fromshell[1]);
6219 @@ -4027,7 +4063,7 @@
6221 /* set up stderr for the child */
6228 @@ -4078,6 +4114,9 @@
6232 +# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
6233 + struct timeval start_tv;
6237 if (pty_master_fd >= 0)
6238 @@ -4158,7 +4197,8 @@
6240 curbuf->b_ml.ml_line_count
6241 || curbuf->b_p_eol)))
6242 - write(toshell_fd, "\n", (size_t)1);
6243 + ignored = write(toshell_fd, "\n",
6246 if (lnum > curbuf->b_op_end.lnum)
6248 @@ -4186,7 +4226,9 @@
6249 ga_init2(&ga, 1, BUFLEN);
6253 +# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
6254 + gettimeofday(&start_tv, NULL);
6259 @@ -4199,25 +4241,34 @@
6260 * that a typed password is echoed for ssh or gpg command.
6261 * Don't get characters when the child has already
6262 * finished (wait_pid == 0).
6263 - * Don't get extra characters when we already have one.
6264 * Don't read characters unless we didn't get output for a
6265 - * while, avoids that ":r !ls" eats typeahead.
6266 + * while (noread_cnt > 4), avoids that ":r !ls" eats
6270 if (!(options & SHELL_EXPAND)
6272 (SHELL_READ|SHELL_WRITE|SHELL_COOKED))
6273 != (SHELL_READ|SHELL_WRITE|SHELL_COOKED)
6282 - || (noread_cnt > 4
6283 - && (len = ui_inchar(ta_buf,
6284 - BUFLEN, 10L, 0)) > 0)))
6285 + && (ta_len > 0 || noread_cnt > 4))
6289 + /* Get extra characters when we don't have any.
6290 + * Reset the counter and timer. */
6292 +# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
6293 + gettimeofday(&start_tv, NULL);
6295 + len = ui_inchar(ta_buf, BUFLEN, 10L, 0);
6297 + if (ta_len > 0 || len > 0)
6301 * Check for CTRL-C: send interrupt signal to child.
6302 @@ -4319,9 +4370,9 @@
6305 mch_memmove(ta_buf, ta_buf + len, ta_len);
6313 @@ -4429,6 +4480,25 @@
6318 +# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
6320 + struct timeval now_tv;
6323 + /* Avoid that we keep looping here without
6324 + * checking for a CTRL-C for a long time. Don't
6325 + * break out too often to avoid losing typeahead. */
6326 + gettimeofday(&now_tv, NULL);
6327 + msec = (now_tv.tv_sec - start_tv.tv_sec) * 1000L
6328 + + (now_tv.tv_usec - start_tv.tv_usec) / 1000L;
6338 /* If we already detected the child has finished break the
6339 @@ -5851,7 +5921,9 @@
6340 * we are going to suspend or starting an external process
6341 * so we shouldn't have problem with this
6344 signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL);
6346 return 1; /* succeed */
6349 @@ -6814,7 +6886,8 @@
6350 if (xsmp_icefd != -1)
6352 SmcCloseConnection(xsmp.smcconn, 0, NULL);
6353 - vim_free(xsmp.clientid);
6354 + if (xsmp.clientid != NULL)
6355 + free(xsmp.clientid);
6356 xsmp.clientid = NULL;
6359 diff -Naur vim72.orig/src/proto/eval.pro vim72/src/proto/eval.pro
6360 --- vim72.orig/src/proto/eval.pro 2008-08-09 07:31:25.000000000 -0700
6361 +++ vim72/src/proto/eval.pro 2009-03-12 11:54:47.005909205 -0700
6363 int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip));
6364 char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip));
6365 int skip_expr __ARGS((char_u **pp));
6366 -char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));
6367 +char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert));
6368 char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox));
6369 int eval_to_number __ARGS((char_u *expr));
6370 list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
6372 void list_unref __ARGS((list_T *l));
6373 void list_free __ARGS((list_T *l, int recurse));
6374 dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
6375 +char_u *list_find_str __ARGS((list_T *l, long idx));
6376 int list_append_dict __ARGS((list_T *list, dict_T *dict));
6377 +int list_append_string __ARGS((list_T *l, char_u *str, int len));
6378 int garbage_collect __ARGS((void));
6379 dict_T *dict_alloc __ARGS((void));
6380 int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
6382 void set_vim_var_nr __ARGS((int idx, long val));
6383 long get_vim_var_nr __ARGS((int idx));
6384 char_u *get_vim_var_str __ARGS((int idx));
6385 -void set_vcount __ARGS((long count, long count1));
6386 +list_T *get_vim_var_list __ARGS((int idx));
6387 +void set_vcount __ARGS((long count, long count1, int set_prevcount));
6388 void set_vim_var_string __ARGS((int idx, char_u *val, int len));
6389 +void set_vim_var_list __ARGS((int idx, list_T *val));
6390 void set_reg_var __ARGS((int c));
6391 char_u *v_exception __ARGS((char_u *oldval));
6392 char_u *v_throwpoint __ARGS((char_u *oldval));
6394 void write_viminfo_varlist __ARGS((FILE *fp));
6395 int store_session_globals __ARGS((FILE *fd));
6396 void last_set_msg __ARGS((scid_T scriptID));
6397 +void ex_oldfiles __ARGS((exarg_T *eap));
6398 int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
6399 char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
6400 /* vim: set ft=c : */
6401 diff -Naur vim72.orig/src/proto/ex_cmds.pro vim72/src/proto/ex_cmds.pro
6402 --- vim72.orig/src/proto/ex_cmds.pro 2008-08-09 07:31:25.000000000 -0700
6403 +++ vim72/src/proto/ex_cmds.pro 2009-03-12 11:55:13.611614471 -0700
6405 char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
6406 void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
6407 int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
6408 -int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
6409 +int read_viminfo __ARGS((char_u *file, int flags));
6410 void write_viminfo __ARGS((char_u *file, int forceit));
6411 int viminfo_readline __ARGS((vir_T *virp));
6412 char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
6414 int read_viminfo_sub_string __ARGS((vir_T *virp, int force));
6415 void write_viminfo_sub_string __ARGS((FILE *fp));
6416 void free_old_sub __ARGS((void));
6417 +void free_signs __ARGS((void));
6418 int prepare_tagpreview __ARGS((int undo_sync));
6419 void ex_help __ARGS((exarg_T *eap));
6420 char_u *check_help_lang __ARGS((char_u *arg));
6421 diff -Naur vim72.orig/src/proto/ex_getln.pro vim72/src/proto/ex_getln.pro
6422 --- vim72.orig/src/proto/ex_getln.pro 2008-08-09 07:31:28.000000000 -0700
6423 +++ vim72/src/proto/ex_getln.pro 2009-03-12 11:55:13.703620617 -0700
6425 int text_locked __ARGS((void));
6426 void text_locked_msg __ARGS((void));
6427 int curbuf_locked __ARGS((void));
6428 +int allbuf_locked __ARGS((void));
6429 char_u *getexline __ARGS((int c, void *dummy, int indent));
6430 char_u *getexmodeline __ARGS((int promptc, void *dummy, int indent));
6431 int cmdline_overstrike __ARGS((void));
6433 void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
6434 int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
6435 int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
6436 -char_u *globpath __ARGS((char_u *path, char_u *file));
6437 +char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
6438 void init_history __ARGS((void));
6439 int get_histtype __ARGS((char_u *name));
6440 void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
6441 diff -Naur vim72.orig/src/proto/mark.pro vim72/src/proto/mark.pro
6442 --- vim72.orig/src/proto/mark.pro 2008-08-09 07:31:36.000000000 -0700
6443 +++ vim72/src/proto/mark.pro 2009-03-12 11:54:40.553496578 -0700
6445 void write_viminfo_filemarks __ARGS((FILE *fp));
6446 int removable __ARGS((char_u *name));
6447 int write_viminfo_marks __ARGS((FILE *fp_out));
6448 -void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof));
6449 +void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags));
6450 /* vim: set ft=c : */
6451 diff -Naur vim72.orig/src/proto/misc2.pro vim72/src/proto/misc2.pro
6452 --- vim72.orig/src/proto/misc2.pro 2008-08-09 07:31:40.000000000 -0700
6453 +++ vim72/src/proto/misc2.pro 2009-03-12 11:54:56.454515435 -0700
6455 int handle_x_keys __ARGS((int key));
6456 char_u *get_special_key_name __ARGS((int c, int modifiers));
6457 int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode));
6458 -int find_special_key __ARGS((char_u **srcp, int *modp, int keycode));
6459 +int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key));
6460 int extract_modifiers __ARGS((int key, int *modp));
6461 int find_special_key_in_table __ARGS((int c));
6462 int get_special_key_code __ARGS((char_u *name));
6463 diff -Naur vim72.orig/src/proto/netbeans.pro vim72/src/proto/netbeans.pro
6464 --- vim72.orig/src/proto/netbeans.pro 2008-08-09 07:31:56.000000000 -0700
6465 +++ vim72/src/proto/netbeans.pro 2009-03-12 11:54:59.854733063 -0700
6467 void netbeans_frame_moved __ARGS((int new_x, int new_y));
6468 void netbeans_file_activated __ARGS((buf_T *bufp));
6469 void netbeans_file_opened __ARGS((buf_T *bufp));
6470 -void netbeans_file_closed __ARGS((buf_T *bufp));
6471 +void netbeans_file_killed __ARGS((buf_T *bufp));
6472 void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen));
6473 void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
6474 void netbeans_unmodified __ARGS((buf_T *bufp));
6475 diff -Naur vim72.orig/src/proto/option.pro vim72/src/proto/option.pro
6476 --- vim72.orig/src/proto/option.pro 2008-08-09 07:31:43.000000000 -0700
6477 +++ vim72/src/proto/option.pro 2009-03-12 11:55:13.419602459 -0700
6479 void set_context_in_set_cmd __ARGS((expand_T *xp, char_u *arg, int opt_flags));
6480 int ExpandSettings __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
6481 int ExpandOldSetting __ARGS((int *num_file, char_u ***file));
6482 +int langmap_adjust_mb __ARGS((int c));
6483 int has_format_option __ARGS((int x));
6484 int shortmess __ARGS((int x));
6485 void vimrc_found __ARGS((char_u *fname, char_u *envname));
6486 diff -Naur vim72.orig/src/pty.c vim72/src/pty.c
6487 --- vim72.orig/src/pty.c 2008-06-21 11:52:58.000000000 -0700
6488 +++ vim72/src/pty.c 2009-03-12 11:54:28.844744238 -0700
6489 @@ -270,9 +270,10 @@
6493 -#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux)
6494 +#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X)
6496 -/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */
6497 +/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
6498 + * Same for Mac OS X Leopard. */
6502 diff -Naur vim72.orig/src/quickfix.c vim72/src/quickfix.c
6503 --- vim72.orig/src/quickfix.c 2008-07-18 05:53:02.000000000 -0700
6504 +++ vim72/src/quickfix.c 2009-03-12 11:55:13.547610560 -0700
6505 @@ -1419,6 +1419,7 @@
6506 int opened_window = FALSE;
6511 int print_message = TRUE;
6513 @@ -1530,7 +1531,6 @@
6514 if (qf_ptr->qf_type == 1 && (!curwin->w_buffer->b_help || cmdmod.tab != 0))
6519 if (cmdmod.tab != 0)
6521 @@ -1546,13 +1546,16 @@
6522 * Split off help window; put it at far top if no position
6523 * specified, the current window is vertically split and narrow.
6527 # ifdef FEAT_VERTSPLIT
6528 if (cmdmod.split == 0 && curwin->w_width != Columns
6529 && curwin->w_width < 80)
6533 - if (win_split(0, n) == FAIL)
6534 + if (qi != &ql_info)
6535 + flags |= WSP_NEWLOC; /* don't copy the location list */
6537 + if (win_split(0, flags) == FAIL)
6539 opened_window = TRUE; /* close it when fail */
6541 @@ -1562,7 +1565,6 @@
6542 if (qi != &ql_info) /* not a quickfix list */
6544 /* The new window should use the supplied location list */
6545 - qf_free_all(curwin);
6546 curwin->w_llist = qi;
6549 @@ -1609,10 +1611,11 @@
6551 goto_tabpage_win(tp, wp);
6561 * If there is only one window and it is the quickfix window, create a
6562 @@ -1622,7 +1625,10 @@
6564 ll_ref = curwin->w_llist_ref;
6566 - if (win_split(0, WSP_ABOVE) == FAIL)
6567 + flags = WSP_ABOVE;
6568 + if (ll_ref != NULL)
6569 + flags |= WSP_NEWLOC;
6570 + if (win_split(0, flags) == FAIL)
6571 goto failed; /* not enough room for window */
6572 opened_window = TRUE; /* close it when fail */
6573 p_swb = empty_option; /* don't split again */
6574 @@ -1634,7 +1640,6 @@
6576 /* The new window should use the location list from the
6577 * location list window */
6578 - qf_free_all(curwin);
6579 curwin->w_llist = ll_ref;
6580 ll_ref->qf_refcount++;
6582 @@ -2307,15 +2312,12 @@
6583 if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
6584 /* Create the new window at the very bottom. */
6586 - if (win_split(height, WSP_BELOW) == FAIL)
6587 + if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
6588 return; /* not enough room for window */
6589 #ifdef FEAT_SCROLLBIND
6590 curwin->w_p_scb = FALSE;
6593 - /* Remove the location list for the quickfix window */
6594 - qf_free_all(curwin);
6596 if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
6599 diff -Naur vim72.orig/src/regexp.c vim72/src/regexp.c
6600 --- vim72.orig/src/regexp.c 2008-08-07 12:58:50.000000000 -0700
6601 +++ vim72/src/regexp.c 2009-03-12 11:55:13.471605532 -0700
6602 @@ -4532,7 +4532,7 @@
6604 if (!REG_MULTI) /* Single-line regexp */
6606 - if (reg_endp[no] == NULL)
6607 + if (reg_startp[no] == NULL || reg_endp[no] == NULL)
6609 /* Backref was not set: Match an empty string. */
6611 @@ -4548,7 +4548,7 @@
6613 else /* Multi-line regexp */
6615 - if (reg_endpos[no].lnum < 0)
6616 + if (reg_startpos[no].lnum < 0 || reg_endpos[no].lnum < 0)
6618 /* Backref was not set: Match an empty string. */
6620 @@ -7279,13 +7279,11 @@
6624 - if (submatch_match->endp[no] == NULL)
6625 + s = submatch_match->startp[no];
6626 + if (s == NULL || submatch_match->endp[no] == NULL)
6630 - s = submatch_match->startp[no];
6631 retval = vim_strnsave(s, (int)(submatch_match->endp[no] - s));
6636 diff -Naur vim72.orig/src/screen.c vim72/src/screen.c
6637 --- vim72.orig/src/screen.c 2008-07-24 07:45:07.000000000 -0700
6638 +++ vim72/src/screen.c 2009-03-12 11:55:39.893297947 -0700
6639 @@ -2439,9 +2439,17 @@
6642 /* Show 'cursorcolumn' in the fold line. */
6643 - if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp))
6644 - ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr(
6645 - ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC));
6648 + txtcol += wp->w_virtcol;
6650 + txtcol -= wp->w_skipcol;
6652 + txtcol -= wp->w_leftcol;
6653 + if (txtcol >= 0 && txtcol < W_WIDTH(wp))
6654 + ScreenAttrs[off + txtcol] = hl_combine_attr(
6655 + ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
6659 SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
6660 @@ -2588,6 +2596,7 @@
6661 int noinvcur = FALSE; /* don't invert the cursor */
6664 + int lnum_in_visual_area = FALSE;
6668 @@ -2784,9 +2793,10 @@
6670 bot = &curwin->w_cursor;
6672 + lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum);
6673 if (VIsual_mode == Ctrl_V) /* block mode */
6675 - if (lnum >= top->lnum && lnum <= bot->lnum)
6676 + if (lnum_in_visual_area)
6678 fromcol = wp->w_old_cursor_fcol;
6679 tocol = wp->w_old_cursor_lcol;
6680 @@ -3412,6 +3422,7 @@
6681 && (*mb_ptr2cells)(ptr) > 1)
6683 || ((int)vcol_prev == fromcol_prev
6684 + && vcol_prev < vcol /* not at margin */
6686 area_attr = attr; /* start highlighting */
6687 else if (area_attr != 0
6688 @@ -3544,7 +3555,8 @@
6689 /* Use line_attr when not in the Visual or 'incsearch' area
6690 * (area_attr may be 0 when "noinvcur" is set). */
6691 else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
6692 - || (vcol < fromcol || vcol >= tocol)))
6693 + || vcol < fromcol || vcol_prev < fromcol_prev
6694 + || vcol >= tocol))
6695 char_attr = line_attr;
6698 @@ -4549,7 +4561,8 @@
6699 * highlight the cursor position itself. */
6700 if (wp->w_p_cuc && vcol == (long)wp->w_virtcol
6701 && lnum != wp->w_cursor.lnum
6702 - && draw_state == WL_LINE)
6703 + && draw_state == WL_LINE
6704 + && !lnum_in_visual_area)
6706 vcol_save_attr = char_attr;
6707 char_attr = hl_combine_attr(char_attr, hl_attr(HLF_CUC));
6708 @@ -5119,8 +5132,8 @@
6711 #if defined(FEAT_GUI) || defined(UNIX)
6712 - /* The bold trick makes a single row of pixels appear in the next
6713 - * character. When a bold character is removed, the next
6714 + /* The bold trick makes a single column of pixels appear in the
6715 + * next character. When a bold character is removed, the next
6716 * character should be redrawn too. This happens for our own GUI
6717 * and for some xterms. */
6719 @@ -6263,9 +6276,15 @@
6723 +#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
6724 + int force_redraw_this;
6725 + int force_redraw_next = FALSE;
6729 if (ScreenLines == NULL || row >= screen_Rows) /* safety check */
6731 + off = LineOffset[row] + col;
6734 /* When drawing over the right halve of a double-wide char clear out the
6735 @@ -6275,10 +6294,21 @@
6738 && mb_fix_col(col, row) != col)
6739 - screen_puts_len((char_u *)" ", 1, row, col - 1, 0);
6741 + ScreenLines[off - 1] = ' ';
6742 + ScreenAttrs[off - 1] = 0;
6745 + ScreenLinesUC[off - 1] = 0;
6746 + ScreenLinesC[0][off - 1] = 0;
6748 + /* redraw the previous cell, make it empty */
6749 + screen_char(off - 1, row, col - 1);
6750 + /* force the cell at "col" to be redrawn */
6751 + force_redraw_next = TRUE;
6755 - off = LineOffset[row] + col;
6757 max_off = LineOffset[row] + screen_Columns;
6759 @@ -6342,7 +6372,12 @@
6763 - if (ScreenLines[off] != c
6764 +#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
6765 + force_redraw_this = force_redraw_next;
6766 + force_redraw_next = FALSE;
6769 + need_redraw = ScreenLines[off] != c
6771 || (mbyte_cells == 2
6772 && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0))
6773 @@ -6350,24 +6385,24 @@
6775 && ScreenLines2[off] != ptr[1])
6777 - && (ScreenLinesUC[off] != (u8char_T)u8c
6778 + && (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0)
6779 || screen_comp_differs(off, u8cc)))
6781 || ScreenAttrs[off] != attr
6786 +#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
6787 + || force_redraw_this
6791 #if defined(FEAT_GUI) || defined(UNIX)
6792 /* The bold trick makes a single row of pixels appear in the next
6793 * character. When a bold character is removed, the next
6794 * character should be redrawn too. This happens for our own GUI
6795 - * and for some xterms.
6796 - * Force the redraw by setting the attribute to a different value
6797 - * than "attr", the contents of ScreenLines[] may be needed by
6798 - * mb_off2cells() further on.
6799 - * Don't do this for the last drawn character, because the next
6800 - * character may not be redrawn. */
6802 + * and for some xterms. */
6803 + if (need_redraw && ScreenLines[off] != ' ' && (
6807 @@ -6377,23 +6412,14 @@
6815 + int n = ScreenAttrs[off];
6817 - n = ScreenAttrs[off];
6819 - if (col + mbyte_cells < screen_Columns
6820 - && (n > HL_ALL || (n & HL_BOLD))
6821 - && (len < 0 ? ptr[mbyte_blen] != NUL
6822 - : ptr + mbyte_blen < text + len))
6823 - ScreenAttrs[off + mbyte_cells] = attr + 1;
6825 - if (col + 1 < screen_Columns
6826 - && (n > HL_ALL || (n & HL_BOLD))
6827 - && (len < 0 ? ptr[1] != NUL : ptr + 1 < text + len))
6828 - ScreenLines[off + 1] = 0;
6831 + n = syn_attr2attr(n);
6833 + force_redraw_next = TRUE;
6837 @@ -6480,6 +6506,20 @@
6842 +#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
6843 + /* If we detected the next character needs to be redrawn, but the text
6844 + * doesn't extend up to there, update the character here. */
6845 + if (force_redraw_next && col < screen_Columns)
6848 + if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1)
6849 + screen_char_2(off, row, col);
6852 + screen_char(off, row, col);
6857 #ifdef FEAT_SEARCH_EXTRA
6858 @@ -7356,7 +7396,11 @@
6860 static int entered = FALSE; /* avoid recursiveness */
6861 static int done_outofmem_msg = FALSE; /* did outofmem message */
6862 +#ifdef FEAT_AUTOCMD
6863 + int retry_count = 0;
6868 * Allocation of the screen buffers is done only when the size changes and
6869 * when Rows and Columns have been set and we have started doing full
6870 @@ -7440,10 +7484,13 @@
6879 +#ifdef FEAT_WINDOWS
6884 for (i = 0; i < p_mco; ++i)
6885 @@ -7628,8 +7675,17 @@
6886 --RedrawingDisabled;
6889 - if (starting == 0)
6891 + * Do not apply autocommands more than 3 times to avoid an endless loop
6892 + * in case applying autocommands always changes Rows or Columns.
6894 + if (starting == 0 && ++retry_count <= 3)
6896 apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
6897 + /* In rare cases, autocommands may have altered Rows or Columns,
6898 + * jump back to check if we need to allocate the screen again. */
6904 diff -Naur vim72.orig/src/spell.c vim72/src/spell.c
6905 --- vim72.orig/src/spell.c 2008-07-12 12:20:55.000000000 -0700
6906 +++ vim72/src/spell.c 2009-03-12 11:55:13.363596871 -0700
6910 * Do the opposite: based on a maximum end score and a known sound score,
6911 - * compute the the maximum word score that can be used.
6912 + * compute the maximum word score that can be used.
6914 #define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3)
6917 garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */
6918 regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm
6919 * (NULL when no compounding) */
6920 + char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */
6921 char_u *sl_compstartflags; /* flags for first compound word */
6922 char_u *sl_compallflags; /* all flags for compound words */
6923 char_u sl_nobreak; /* When TRUE: no spaces between words */
6925 /* TRUE if a word appears in the list of banned words. */
6926 #define WAS_BANNED(su, word) (!HASHITEM_EMPTY(hash_find(&su->su_banned, word)))
6928 -/* Number of suggestions kept when cleaning up. we need to keep more than
6929 +/* Number of suggestions kept when cleaning up. We need to keep more than
6930 * what is displayed, because when rescore_suggestions() is called the score
6931 * may change and wrong suggestions may be removed later. */
6932 #define SUG_CLEAN_COUNT(su) ((su)->su_maxcount < 130 ? 150 : (su)->su_maxcount + 20)
6933 @@ -839,7 +840,10 @@
6934 static void slang_clear __ARGS((slang_T *lp));
6935 static void slang_clear_sug __ARGS((slang_T *lp));
6936 static void find_word __ARGS((matchinf_T *mip, int mode));
6937 +static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap));
6938 static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags));
6939 +static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag));
6940 +static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags));
6941 static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req));
6942 static void find_prefix __ARGS((matchinf_T *mip, int mode));
6943 static int fold_more __ARGS((matchinf_T *mip));
6944 @@ -1519,6 +1523,11 @@
6945 ((unsigned)flags >> 24)))
6948 + /* If there is a match with a CHECKCOMPOUNDPATTERN rule
6949 + * discard the compound word. */
6950 + if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
6953 if (mode == FIND_COMPOUND)
6956 @@ -1577,6 +1586,11 @@
6957 if (!can_compound(slang, fword, mip->mi_compflags))
6960 + else if (slang->sl_comprules != NULL
6961 + && !match_compoundrule(slang, mip->mi_compflags))
6962 + /* The compound flags collected so far do not match any
6963 + * COMPOUNDRULE, discard the compounded word. */
6967 /* Check NEEDCOMPOUND: can't use word without compounding. */
6968 @@ -1727,6 +1741,39 @@
6972 + * Return TRUE if there is a match between the word ptr[wlen] and
6973 + * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
6975 + * A match means that the first part of CHECKCOMPOUNDPATTERN matches at the
6976 + * end of ptr[wlen] and the second part matches after it.
6979 +match_checkcompoundpattern(ptr, wlen, gap)
6982 + garray_T *gap; /* &sl_comppat */
6988 + for (i = 0; i + 1 < gap->ga_len; i += 2)
6990 + p = ((char_u **)gap->ga_data)[i + 1];
6991 + if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
6993 + /* Second part matches at start of following compound word, now
6994 + * check if first part matches at end of previous word. */
6995 + p = ((char_u **)gap->ga_data)[i];
6996 + len = (int)STRLEN(p);
6997 + if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
7005 * Return TRUE if "flags" is a valid sequence of compound flags and "word"
7006 * does not have too many syllables.
7008 @@ -1773,6 +1820,98 @@
7012 + * Return TRUE when the sequence of flags in "compflags" plus "flag" can
7013 + * possibly form a valid compounded word. This also checks the COMPOUNDRULE
7014 + * lines if they don't contain wildcards.
7017 +can_be_compound(sp, slang, compflags, flag)
7020 + char_u *compflags;
7023 + /* If the flag doesn't appear in sl_compstartflags or sl_compallflags
7024 + * then it can't possibly compound. */
7025 + if (!byte_in_str(sp->ts_complen == sp->ts_compsplit
7026 + ? slang->sl_compstartflags : slang->sl_compallflags, flag))
7029 + /* If there are no wildcards, we can check if the flags collected so far
7030 + * possibly can form a match with COMPOUNDRULE patterns. This only
7031 + * makes sense when we have two or more words. */
7032 + if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit)
7036 + compflags[sp->ts_complen] = flag;
7037 + compflags[sp->ts_complen + 1] = NUL;
7038 + v = match_compoundrule(slang, compflags + sp->ts_compsplit);
7039 + compflags[sp->ts_complen] = NUL;
7048 + * Return TRUE if the compound flags in compflags[] match the start of any
7049 + * compound rule. This is used to stop trying a compound if the flags
7050 + * collected so far can't possibly match any compound rule.
7051 + * Caller must check that slang->sl_comprules is not NULL.
7054 +match_compoundrule(slang, compflags)
7056 + char_u *compflags;
7062 + /* loop over all the COMPOUNDRULE entries */
7063 + for (p = slang->sl_comprules; *p != NUL; ++p)
7065 + /* loop over the flags in the compound word we have made, match
7066 + * them against the current rule entry */
7067 + for (i = 0; ; ++i)
7071 + /* found a rule that matches for the flags we have so far */
7073 + if (*p == '/' || *p == NUL)
7074 + break; /* end of rule, it's too short */
7077 + int match = FALSE;
7079 + /* compare against all the flags in [] */
7081 + while (*p != ']' && *p != NUL)
7085 + break; /* none matches */
7088 + break; /* flag of word doesn't match flag in pattern */
7092 + /* Skip to the next "/", where the next pattern starts. */
7093 + p = vim_strchr(p, '/');
7098 + /* Checked all the rules and none of them match the flags, so there
7099 + * can't possibly be a compound starting with these flags. */
7104 * Return non-zero if the prefix indicated by "arridx" matches with the prefix
7105 * ID in "flags" for the word "word".
7106 * The WF_RAREPFX flag is included in the return value for a rare prefix.
7107 @@ -2237,7 +2376,7 @@
7109 /* If we are back at the starting line and there is no match then
7111 - if (lnum == wp->w_cursor.lnum && !found_one)
7112 + if (lnum == wp->w_cursor.lnum && (!found_one || wrapped))
7115 /* Skip the characters at the start of the next line that were
7116 @@ -2513,9 +2652,11 @@
7117 lp->sl_midword = NULL;
7119 vim_free(lp->sl_compprog);
7120 + vim_free(lp->sl_comprules);
7121 vim_free(lp->sl_compstartflags);
7122 vim_free(lp->sl_compallflags);
7123 lp->sl_compprog = NULL;
7124 + lp->sl_comprules = NULL;
7125 lp->sl_compstartflags = NULL;
7126 lp->sl_compallflags = NULL;
7128 @@ -3460,6 +3601,7 @@
7136 @@ -3545,6 +3687,12 @@
7137 slang->sl_compallflags = ap;
7140 + /* And a list of all patterns in their original form, for checking whether
7141 + * compounding may work in match_compoundrule(). This is freed when we
7142 + * encounter a wildcard, the check doesn't work then. */
7143 + crp = alloc(todo + 1);
7144 + slang->sl_comprules = crp;
7149 @@ -3587,6 +3735,20 @@
7154 + /* Copy flag to "sl_comprules", unless we run into a wildcard. */
7157 + if (c == '+' || c == '*')
7159 + vim_free(slang->sl_comprules);
7160 + slang->sl_comprules = NULL;
7167 if (c == '/') /* slash separates two items */
7170 @@ -3611,6 +3773,9 @@
7177 slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
7179 if (slang->sl_compprog == NULL)
7180 @@ -4791,13 +4956,16 @@
7181 * Structure that is used to store the items in the word tree. This avoids
7182 * the need to keep track of each allocated thing, everything is freed all at
7183 * once after ":mkspell" is done.
7184 + * Note: "sb_next" must be just before "sb_data" to make sure the alignment of
7185 + * "sb_data" is correct for systems where pointers must be aligned on
7186 + * pointer-size boundaries and sizeof(pointer) > sizeof(int) (e.g., Sparc).
7188 #define SBLOCKSIZE 16000 /* size of sb_data */
7189 typedef struct sblock_S sblock_T;
7192 - sblock_T *sb_next; /* next block in list */
7193 int sb_used; /* nr of bytes already in use */
7194 + sblock_T *sb_next; /* next block in list */
7195 char_u sb_data[1]; /* data, actually longer */
7198 @@ -4915,6 +5083,7 @@
7201 static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
7202 +static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount));
7203 static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry));
7204 static int spell_info_item __ARGS((char_u *s));
7205 static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
7206 @@ -4950,7 +5119,7 @@
7207 static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd));
7208 static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname));
7209 static void clear_node __ARGS((wordnode_T *node));
7210 -static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree));
7211 +static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree));
7212 static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname));
7213 static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang));
7214 static int sug_maketable __ARGS((spellinfo_T *spin));
7215 @@ -5223,8 +5392,7 @@
7216 /* Handle non-empty lines. */
7219 - if (STRCMP(items[0], "SET") == 0 && itemcnt == 2
7220 - && aff->af_enc == NULL)
7221 + if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
7224 /* Setup for conversion from "ENC" to 'encoding'. */
7225 @@ -5239,7 +5407,7 @@
7226 smsg((char_u *)_("Conversion in %s not supported"), fname);
7229 - else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2
7230 + else if (is_aff_rule(items, itemcnt, "FLAG", 2)
7231 && aff->af_flagtype == AFT_CHAR)
7233 if (STRCMP(items[1], "long") == 0)
7234 @@ -5284,69 +5452,71 @@
7238 - else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
7239 + else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
7242 midword = getroom_save(spin, items[1]);
7244 - else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
7245 + else if (is_aff_rule(items, itemcnt, "TRY", 2))
7247 /* ignored, we look in the tree for what chars may appear */
7249 /* TODO: remove "RAR" later */
7250 - else if ((STRCMP(items[0], "RAR") == 0
7251 - || STRCMP(items[0], "RARE") == 0) && itemcnt == 2
7252 - && aff->af_rare == 0)
7253 + else if ((is_aff_rule(items, itemcnt, "RAR", 2)
7254 + || is_aff_rule(items, itemcnt, "RARE", 2))
7255 + && aff->af_rare == 0)
7257 aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
7260 /* TODO: remove "KEP" later */
7261 - else if ((STRCMP(items[0], "KEP") == 0
7262 - || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2
7263 + else if ((is_aff_rule(items, itemcnt, "KEP", 2)
7264 + || is_aff_rule(items, itemcnt, "KEEPCASE", 2))
7265 && aff->af_keepcase == 0)
7267 aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
7270 - else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2
7271 - && aff->af_bad == 0)
7272 + else if ((is_aff_rule(items, itemcnt, "BAD", 2)
7273 + || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2))
7274 + && aff->af_bad == 0)
7276 aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
7279 - else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2
7280 + else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2)
7281 && aff->af_needaffix == 0)
7283 aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
7286 - else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2
7287 + else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2)
7288 && aff->af_circumfix == 0)
7290 aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
7293 - else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2
7294 + else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2)
7295 && aff->af_nosuggest == 0)
7297 aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
7300 - else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2
7301 + else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2)
7302 + || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2))
7303 && aff->af_needcomp == 0)
7305 aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
7308 - else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2
7309 + else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2)
7310 && aff->af_comproot == 0)
7312 aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
7315 - else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0
7316 - && itemcnt == 2 && aff->af_compforbid == 0)
7317 + else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2)
7318 + && aff->af_compforbid == 0)
7320 aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
7322 @@ -5354,8 +5524,8 @@
7323 smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
7326 - else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0
7327 - && itemcnt == 2 && aff->af_comppermit == 0)
7328 + else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
7329 + && aff->af_comppermit == 0)
7331 aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
7333 @@ -5363,7 +5533,7 @@
7334 smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
7337 - else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
7338 + else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
7339 && compflags == NULL)
7341 /* Turn flag "c" into COMPOUNDRULE compatible string "c+",
7342 @@ -5376,7 +5546,15 @@
7346 - else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
7347 + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
7349 + /* We don't use the count, but do check that it's a number and
7350 + * not COMPOUNDRULE mistyped. */
7351 + if (atoi((char *)items[1]) == 0)
7352 + smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"),
7353 + fname, lnum, items[1]);
7355 + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
7357 /* Concatenate this string to previously defined ones, using a
7358 * slash to separate them. */
7359 @@ -5395,7 +5573,7 @@
7363 - else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
7364 + else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
7367 compmax = atoi((char *)items[1]);
7368 @@ -5403,7 +5581,7 @@
7369 smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
7370 fname, lnum, items[1]);
7372 - else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
7373 + else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
7376 compminlen = atoi((char *)items[1]);
7377 @@ -5411,7 +5589,7 @@
7378 smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
7379 fname, lnum, items[1]);
7381 - else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
7382 + else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
7385 compsylmax = atoi((char *)items[1]);
7386 @@ -5419,32 +5597,29 @@
7387 smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
7388 fname, lnum, items[1]);
7390 - else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
7391 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
7393 compoptions |= COMP_CHECKDUP;
7395 - else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
7396 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
7398 compoptions |= COMP_CHECKREP;
7400 - else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
7401 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
7403 compoptions |= COMP_CHECKCASE;
7405 - else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
7407 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
7409 compoptions |= COMP_CHECKTRIPLE;
7411 - else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
7413 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
7415 if (atoi((char *)items[1]) == 0)
7416 smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
7417 fname, lnum, items[1]);
7419 - else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
7421 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
7423 garray_T *gap = &spin->si_comppat;
7425 @@ -5463,24 +5638,24 @@
7426 = getroom_save(spin, items[2]);
7429 - else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
7430 + else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
7431 && syllable == NULL)
7433 syllable = getroom_save(spin, items[1]);
7435 - else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
7436 + else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
7438 spin->si_nobreak = TRUE;
7440 - else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
7441 + else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
7443 spin->si_nosplitsugs = TRUE;
7445 - else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
7446 + else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
7448 spin->si_nosugfile = TRUE;
7450 - else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
7451 + else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
7453 aff->af_pfxpostpone = TRUE;
7455 @@ -5771,24 +5946,20 @@
7459 - else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
7461 + else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
7463 fol = vim_strsave(items[1]);
7465 - else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
7467 + else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
7469 low = vim_strsave(items[1]);
7471 - else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
7473 + else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
7475 upp = vim_strsave(items[1]);
7477 - else if ((STRCMP(items[0], "REP") == 0
7478 - || STRCMP(items[0], "REPSAL") == 0)
7480 + else if (is_aff_rule(items, itemcnt, "REP", 2)
7481 + || is_aff_rule(items, itemcnt, "REPSAL", 2))
7483 /* Ignore REP/REPSAL count */;
7484 if (!isdigit(*items[1]))
7485 @@ -5819,7 +5990,7 @@
7486 : &spin->si_rep, items[1], items[2]);
7489 - else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
7490 + else if (is_aff_rule(items, itemcnt, "MAP", 2))
7492 /* MAP item or count */
7494 @@ -5856,9 +6027,8 @@
7495 ga_append(&spin->si_map, '/');
7498 - /* Accept "SAL from to" and "SAL from to # comment". */
7499 - else if (STRCMP(items[0], "SAL") == 0
7500 - && (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#')))
7501 + /* Accept "SAL from to" and "SAL from to #comment". */
7502 + else if (is_aff_rule(items, itemcnt, "SAL", 3))
7506 @@ -5877,12 +6047,12 @@
7510 - else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
7511 + else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
7512 && sofofrom == NULL)
7514 sofofrom = getroom_save(spin, items[1]);
7516 - else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
7517 + else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
7520 sofoto = getroom_save(spin, items[1]);
7521 @@ -5980,7 +6150,7 @@
7522 else if (spin->si_newprefID == 0 || spin->si_newprefID == 127)
7523 MSG(_("Too many compound flags"));
7525 - MSG(_("Too many posponed prefixes and/or compound flags"));
7526 + MSG(_("Too many postponed prefixes and/or compound flags"));
7529 if (syllable != NULL)
7530 @@ -6017,6 +6187,22 @@
7534 + * Return TRUE when items[0] equals "rulename", there are "mincount" items or
7535 + * a comment is following after item "mincount".
7538 +is_aff_rule(items, itemcnt, rulename, mincount)
7544 + return (STRCMP(items[0], rulename) == 0
7545 + && (itemcnt == mincount
7546 + || (itemcnt > mincount && items[mincount][0] == '#')));
7550 * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
7551 * ae_flags to ae_comppermit and ae_compforbid.
7553 @@ -7926,6 +8112,8 @@
7557 + size_t fwv = 1; /* collect return value of fwrite() to avoid
7558 + warnings from picky compiler */
7560 fd = mch_fopen((char *)fname, "w");
7562 @@ -7936,11 +8124,11 @@
7564 /* <HEADER>: <fileID> <versionnr> */
7566 - if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)
7571 + fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
7572 + if (fwv != (size_t)1)
7573 + /* Catch first write error, don't try writing more. */
7576 putc(VIMSPELLVERSION, fd); /* <versionnr> */
7579 @@ -7955,7 +8143,7 @@
7581 i = (int)STRLEN(spin->si_info);
7582 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
7583 - fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
7584 + fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
7587 /* SN_REGION: <regionname> ...
7588 @@ -7966,7 +8154,7 @@
7589 putc(SNF_REQUIRED, fd); /* <sectionflags> */
7590 l = spin->si_region_count * 2;
7591 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
7592 - fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
7593 + fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
7594 /* <regionname> ... */
7595 regionmask = (1 << spin->si_region_count) - 1;
7597 @@ -8016,7 +8204,7 @@
7600 put_bytes(fd, (long_u)l, 2); /* <folcharslen> */
7601 - fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
7602 + fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
7605 /* SN_MIDWORD: <midword> */
7606 @@ -8027,7 +8215,8 @@
7608 i = (int)STRLEN(spin->si_midword);
7609 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
7610 - fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */
7611 + fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd);
7615 /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
7616 @@ -8113,7 +8302,8 @@
7617 p = rr == 1 ? ftp->ft_from : ftp->ft_to;
7620 - fwrite(p, l, (size_t)1, fd);
7622 + fwv &= fwrite(p, l, (size_t)1, fd);
7626 @@ -8131,11 +8321,11 @@
7629 put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
7630 - fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
7631 + fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
7633 l = (int)STRLEN(spin->si_sofoto);
7634 put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
7635 - fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
7636 + fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
7639 /* SN_WORDS: <word> ...
7640 @@ -8160,7 +8350,7 @@
7641 l = (int)STRLEN(hi->hi_key) + 1;
7643 if (round == 2) /* <word> */
7644 - fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
7645 + fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
7649 @@ -8176,7 +8366,7 @@
7650 putc(0, fd); /* <sectionflags> */
7651 l = spin->si_map.ga_len;
7652 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
7653 - fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
7654 + fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
7658 @@ -8232,10 +8422,11 @@
7660 p = ((char_u **)(spin->si_comppat.ga_data))[i];
7661 putc((int)STRLEN(p), fd); /* <comppatlen> */
7662 - fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */
7663 + fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);
7664 + /* <comppattext> */
7667 - fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
7668 + fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
7672 @@ -8259,7 +8450,8 @@
7674 l = (int)STRLEN(spin->si_syllable);
7675 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
7676 - fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */
7677 + fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd);
7681 /* end of <SECTIONS> */
7682 @@ -8295,13 +8487,18 @@
7683 (void)put_node(fd, tree, 0, regionmask, round == 3);
7686 - /* Write another byte to check for errors. */
7687 + /* Write another byte to check for errors (file system full). */
7688 if (putc(0, fd) == EOF)
7692 if (fclose(fd) == EOF)
7695 + if (fwv != (size_t)1)
7697 + if (retval == FAIL)
7703 @@ -9890,6 +10087,7 @@
7707 + size_t x = 1; /* collect return value of fwrite() */
7710 put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
7711 @@ -9906,7 +10104,7 @@
7715 - fwrite(p, (size_t)len, (size_t)1, fd);
7716 + x &= fwrite(p, (size_t)len, (size_t)1, fd);
7720 @@ -11480,15 +11678,24 @@
7721 vim_strncpy(preword + sp->ts_prewordlen,
7722 tword + sp->ts_splitoff,
7723 sp->ts_twordlen - sp->ts_splitoff);
7725 - while (*skiptowhite(p) != NUL)
7726 - p = skipwhite(skiptowhite(p));
7727 - if (fword_ends && !can_compound(slang, p,
7728 - compflags + sp->ts_compsplit))
7729 - /* Compound is not allowed. But it may still be
7730 - * possible if we add another (short) word. */
7732 + /* Verify CHECKCOMPOUNDPATTERN rules. */
7733 + if (match_checkcompoundpattern(preword, sp->ts_prewordlen,
7734 + &slang->sl_comppat))
7735 compound_ok = FALSE;
7740 + while (*skiptowhite(p) != NUL)
7741 + p = skipwhite(skiptowhite(p));
7742 + if (fword_ends && !can_compound(slang, p,
7743 + compflags + sp->ts_compsplit))
7744 + /* Compound is not allowed. But it may still be
7745 + * possible if we add another (short) word. */
7746 + compound_ok = FALSE;
7749 /* Get pointer to last char of previous word. */
7750 p = preword + sp->ts_prewordlen;
7751 mb_ptr_back(preword, p);
7752 @@ -11685,10 +11892,9 @@
7753 && (slang->sl_compsylmax < MAXWLEN
7754 || sp->ts_complen + 1 - sp->ts_compsplit
7755 < slang->sl_compmax)
7756 - && (byte_in_str(sp->ts_complen == sp->ts_compsplit
7757 - ? slang->sl_compstartflags
7758 - : slang->sl_compallflags,
7759 - ((unsigned)flags >> 24))))
7760 + && (can_be_compound(sp, slang,
7761 + compflags, ((unsigned)flags >> 24))))
7764 try_compound = TRUE;
7765 compflags[sp->ts_complen] = ((unsigned)flags >> 24);
7766 @@ -14808,7 +15014,7 @@
7770 - * Lenghts are equal, thus changes must result in same length: An
7771 + * Lengths are equal, thus changes must result in same length: An
7772 * insert is only possible in combination with a delete.
7773 * 1: check if for identical strings
7775 diff -Naur vim72.orig/src/structs.h vim72/src/structs.h
7776 --- vim72.orig/src/structs.h 2008-07-30 13:02:50.000000000 -0700
7777 +++ vim72/src/structs.h 2009-03-12 11:54:46.913903059 -0700
7781 int hide; /* TRUE when ":hide" was used */
7782 -# ifdef FEAT_BROWSE
7783 +# ifdef FEAT_BROWSE_CMD
7784 int browse; /* TRUE to invoke file dialog */
7786 # ifdef FEAT_WINDOWS
7787 @@ -1784,10 +1784,15 @@
7791 - * The next three specify the offsets for displaying the buffer:
7792 + * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
7793 + * displaying the buffer.
7795 linenr_T w_topline; /* buffer line number of the line at the
7796 top of the window */
7797 +#ifdef FEAT_AUTOCMD
7798 + char w_topline_was_set; /* flag set to TRUE when topline is set,
7799 + e.g. by winrestview() */
7802 int w_topfill; /* number of filler lines above w_topline */
7803 int w_old_topfill; /* w_topfill at last redraw */
7804 diff -Naur vim72.orig/src/tag.c vim72/src/tag.c
7805 --- vim72.orig/src/tag.c 2008-07-16 14:31:30.000000000 -0700
7806 +++ vim72/src/tag.c 2009-03-12 11:55:13.591613075 -0700
7808 * If a count is supplied to the ":tag <name>" command, then
7809 * jump to count'th matching tag.
7811 - if (type == DT_TAG && count > 0)
7812 + if (type == DT_TAG && *tag != NUL && count > 0)
7813 cur_match = count - 1;
7815 if (type == DT_SELECT || type == DT_JUMP
7817 taglen_advance(taglen);
7818 MSG_PUTS_ATTR(_("file\n"), hl_attr(HLF_T));
7820 - for (i = 0; i < num_matches; ++i)
7821 + for (i = 0; i < num_matches && !got_int; ++i)
7823 parse_match(matches[i], &tagp);
7833 /* print any extra fields */
7835 if (msg_col + ptr2cells(p) >= Columns)
7842 p = msg_outtrans_one(p, attr);
7854 if (msg_col + (*p == TAB ? 1 : ptr2cells(p)) > Columns)
7860 /* skip backslash used for escaping command char */
7861 @@ -760,12 +768,9 @@
7867 - got_int = FALSE; /* only stop the listing */
7872 + got_int = FALSE; /* only stop the listing */
7873 ask_for_selection = TRUE;
7875 #if defined(FEAT_QUICKFIX) && defined(FEAT_EVAL)
7876 @@ -2542,6 +2547,15 @@
7878 ga_clear_strings(&tag_fnames);
7879 do_tag(NULL, DT_FREE, 0, 0, 0);
7882 +# if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
7883 + if (ptag_entry.tagname)
7885 + vim_free(ptag_entry.tagname);
7886 + ptag_entry.tagname = NULL;
7892 @@ -2725,7 +2739,24 @@
7894 p_7f = vim_strchr(lbuf, 0x7f);
7898 + if (vim_strchr(lbuf, '\n') == NULL)
7900 + /* Truncated line. Ignore it. */
7901 + if (p_verbose >= 5)
7904 + MSG(_("Ignoring long line in tags file"));
7907 + tagp->command = lbuf;
7908 + tagp->tagname = lbuf;
7909 + tagp->tagname_end = lbuf;
7915 /* Find ^A. If not found the line number is after the 0x7f */
7916 p = vim_strchr(p_7f, Ctrl_A);
7917 @@ -2735,7 +2766,7 @@
7920 if (!VIM_ISDIGIT(*p)) /* check for start of line number */
7926 @@ -2749,7 +2780,7 @@
7927 /* find end of tagname */
7928 for (p = p_7f - 1; !vim_iswordc(*p); --p)
7932 tagp->tagname_end = p + 1;
7933 while (p >= lbuf && vim_iswordc(*p))
7935 diff -Naur vim72.orig/src/term.c vim72/src/term.c
7936 --- vim72.orig/src/term.c 2008-07-27 04:48:06.000000000 -0700
7937 +++ vim72/src/term.c 2009-03-12 11:54:59.914737254 -0700
7938 @@ -4920,7 +4920,15 @@
7939 key_name[0] = KEY2TERMCAP0(key);
7940 key_name[1] = KEY2TERMCAP1(key);
7941 if (key_name[0] == KS_KEY)
7942 - string[new_slen++] = key_name[1]; /* from ":set <M-b>=xx" */
7944 + /* from ":set <M-b>=xx" */
7947 + new_slen += (*mb_char2bytes)(key_name[1], string + new_slen);
7950 + string[new_slen++] = key_name[1];
7954 string[new_slen++] = K_SPECIAL;
7955 diff -Naur vim72.orig/src/testdir/Makefile vim72/src/testdir/Makefile
7956 --- vim72.orig/src/testdir/Makefile 2008-06-19 13:29:46.000000000 -0700
7957 +++ vim72/src/testdir/Makefile 2009-03-12 11:55:27.544506216 -0700
7959 test48.out test49.out test51.out test52.out test53.out \
7960 test54.out test55.out test56.out test57.out test58.out \
7961 test59.out test60.out test61.out test62.out test63.out \
7962 - test64.out test65.out
7963 + test64.out test65.out test66.out
7965 SCRIPTS_GUI = test16.out
7969 -nongui: nolog $(SCRIPTS)
7973 +nongui: nolog $(SCRIPTS) report
7975 +gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
7977 -gui: nolog $(SCRIPTS) $(SCRIPTS_GUI)
7982 + @echo 'Test results:'
7983 + @/bin/sh -c "if test -f test.log; \
7984 + then cat test.log; echo TEST FAILURE; exit 1; \
7985 + else echo ALL DONE; \
7988 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
7991 test60.out: test60.vim
7994 - -echo Test results: >test.log
7996 diff -Naur vim72.orig/src/testdir/Make_ming.mak vim72/src/testdir/Make_ming.mak
7997 --- vim72.orig/src/testdir/Make_ming.mak 1969-12-31 16:00:00.000000000 -0800
7998 +++ vim72/src/testdir/Make_ming.mak 2009-03-12 11:54:40.397486521 -0700
8000 +# Makefile to run tests for Vim, on Dos-like machines
8001 +# with sh.exe or zsh.exe in the path or not.
8003 +# Author: Bill McCarthy
8005 +# Note that test54 has been removed until it is fixed.
8007 +# Requires a set of Unix tools: echo, diff, etc.
8009 +ifneq (sh.exe, $(SHELL))
8021 +VIMPROG = ..$(DIRSLASH)vim
8024 +# test2 "\\tmp" doesn't work.
8025 +# test10 'errorformat' is different
8026 +# test12 can't unlink a swap file
8027 +# test25 uses symbolic link
8028 +# test27 can't edit file with "*" in file name
8029 +# test31 16 bit version runs out of memory...
8031 +SCRIPTS16 = test1.out test19.out test20.out test22.out \
8032 + test23.out test24.out test28.out test29.out \
8033 + test35.out test36.out test43.out \
8034 + test44.out test45.out test46.out test47.out \
8035 + test48.out test51.out test53.out \
8036 + test55.out test56.out test57.out test58.out test59.out \
8037 + test60.out test61.out test62.out test63.out test64.out
8039 +# Had to remove test54 which doesn't work yet.
8042 +SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
8043 + test8.out test9.out test11.out test13.out test14.out \
8044 + test15.out test17.out test18.out test21.out test26.out \
8045 + test30.out test31.out test32.out test33.out test34.out \
8046 + test37.out test38.out test39.out test40.out test41.out \
8047 + test42.out test52.out test65.out
8049 +SCRIPTS32 = test50.out
8051 +SCRIPTS_GUI = test16.out
8053 +.SUFFIXES: .in .out
8055 +vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
8058 +nongui: fixff $(SCRIPTS16) $(SCRIPTS)
8064 +gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
8067 +win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
8071 + -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
8083 + $(CP) $*.ok test.ok
8084 + $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
8085 + diff test.out $*.ok
8087 + $(MV) test.out $*.out
8091 diff -Naur vim72.orig/src/testdir/test42.ok vim72/src/testdir/test42.ok
8092 --- vim72.orig/src/testdir/test42.ok 2008-02-20 04:27:37.000000000 -0800
8093 +++ vim72/src/testdir/test42.ok 2009-03-12 11:54:40.601499372 -0700
8098 - fileencoding=ucs-2le
8099 + fileencoding=utf-16le
8103 diff -Naur vim72.orig/src/testdir/test66.in vim72/src/testdir/test66.in
8104 --- vim72.orig/src/testdir/test66.in 1969-12-31 16:00:00.000000000 -0800
8105 +++ vim72/src/testdir/test66.in 2009-03-12 11:55:27.544506216 -0700
8108 +Test for visual block shift and tab characters.
8123 +:$-4,$w >> test.out
8127 +abcdefghijklmnopqrstuvwxyz
8128 +abcdefghijklmnopqrstuvwxyz
8129 +abcdefghijklmnopqrstuvwxyz
8130 +abcdefghijklmnopqrstuvwxyz
8131 +abcdefghijklmnopqrstuvwxyz
8132 diff -Naur vim72.orig/src/testdir/test66.ok vim72/src/testdir/test66.ok
8133 --- vim72.orig/src/testdir/test66.ok 1969-12-31 16:00:00.000000000 -0800
8134 +++ vim72/src/testdir/test66.ok 2009-03-12 11:55:27.544506216 -0700
8136 + abcdefghijklmnopqrstuvwxyz
8138 + abc defghijklmnopqrstuvwxyz
8139 + abc defghijklmnopqrstuvwxyz
8140 + abc defghijklmnopqrstuvwxyz
8141 + abcdefghijklmnopqrstuvwxyz
8143 + abc defghijklmnopqrstuvwxyz
8144 + abc defghijklmnopqrstuvwxyz
8145 + abc defghijklmnopqrstuvwxyz
8146 diff -Naur vim72.orig/src/ui.c vim72/src/ui.c
8147 --- vim72.orig/src/ui.c 2008-07-14 11:14:56.000000000 -0700
8148 +++ vim72/src/ui.c 2009-03-12 11:54:50.158111748 -0700
8149 @@ -1820,7 +1820,7 @@
8151 /* Use stderr for stdin, also works for shell commands. */
8156 read_cmd_fd = 2; /* read from stderr instead of stdin */
8158 @@ -2020,7 +2020,7 @@
8160 if (value == NULL || *length == 0)
8162 - clip_free_selection(cbd); /* ??? [what's the query?] */
8163 + clip_free_selection(cbd); /* nothing received, clear register */
8164 *(int *)success = FALSE;
8167 @@ -2076,7 +2076,7 @@
8168 text_prop.value = (unsigned char *)value;
8169 text_prop.encoding = *type;
8170 text_prop.format = *format;
8171 - text_prop.nitems = STRLEN(value);
8172 + text_prop.nitems = len;
8173 status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
8174 &text_list, &n_text);
8175 if (status != Success || n_text < 1)
8176 @@ -2110,6 +2110,8 @@
8180 + time_t start_time;
8181 + int timed_out = FALSE;
8185 @@ -2129,6 +2131,7 @@
8186 case 3: type = text_atom; break;
8187 default: type = XA_STRING;
8190 XtGetSelectionValue(myShell, cbd->sel_atom, type,
8191 clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
8193 @@ -2141,27 +2144,48 @@
8194 * characters, then they will appear before the one that requested the
8195 * paste! Don't worry, we will catch up with any other events later.
8198 + start_time = time(NULL);
8199 + while (success == MAYBE)
8201 - if (XCheckTypedEvent(dpy, SelectionNotify, &event))
8203 - if (XCheckTypedEvent(dpy, SelectionRequest, &event))
8204 - /* We may get a SelectionRequest here and if we don't handle
8205 - * it we hang. KDE klipper does this, for example. */
8206 + if (XCheckTypedEvent(dpy, SelectionNotify, &event)
8207 + || XCheckTypedEvent(dpy, SelectionRequest, &event)
8208 + || XCheckTypedEvent(dpy, PropertyNotify, &event))
8210 + /* This is where clip_x11_request_selection_cb() should be
8211 + * called. It may actually happen a bit later, so we loop
8212 + * until "success" changes.
8213 + * We may get a SelectionRequest here and if we don't handle
8214 + * it we hang. KDE klipper does this, for example.
8215 + * We need to handle a PropertyNotify for large selections. */
8216 XtDispatchEvent(&event);
8220 + /* Time out after 2 to 3 seconds to avoid that we hang when the
8221 + * other process doesn't respond. Note that the SelectionNotify
8222 + * event may still come later when the selection owner comes back
8223 + * to life and the text gets inserted unexpectedly. Don't know
8224 + * why that happens or how to avoid that :-(. */
8225 + if (time(NULL) > start_time + 2)
8231 /* Do we need this? Probably not. */
8234 - /* Bernhard Walle solved a slow paste response in an X terminal by
8235 - * adding: usleep(10000); here. */
8236 + /* Wait for 1 msec to avoid that we eat up all CPU time. */
8237 + ui_delay(1L, TRUE);
8240 - /* this is where clip_x11_request_selection_cb() is actually called */
8241 - XtDispatchEvent(&event);
8244 + if (success == TRUE)
8247 + /* don't do a retry with another type after timing out, otherwise we
8248 + * hang for 15 seconds. */
8253 /* Final fallback position - use the X CUT_BUFFER0 store */
8254 diff -Naur vim72.orig/src/version.c vim72/src/version.c
8255 --- vim72.orig/src/version.c 2008-08-09 07:24:52.000000000 -0700
8256 +++ vim72/src/version.c 2009-03-12 11:55:39.893297947 -0700
8257 @@ -677,9 +677,280 @@
8258 static int included_patches[] =
8259 { /* Add new patch number below this line */
8523 + * Place to put a short description when adding a feature with a patch.
8524 + * Keep it short, e.g.,: "relative numbers", "persistent undo".
8525 + * Also add a comment marker to separate the lines.
8526 + * See the official Vim patches for the diff format: It must use a context of
8527 + * one line only. Create it by hand or use "diff -C2" and edit the patch.
8529 +static char *(extra_patches[]) =
8530 +{ /* Add your patch description below this line */
8538 @@ -786,7 +1057,7 @@
8539 MSG_PUTS(_("\nRISC OS version"));
8542 - MSG_PUTS("\nOpenVMS version");
8543 + MSG_PUTS(_("\nOpenVMS version"));
8544 # ifdef HAVE_PATHDEF
8545 if (*compiled_arch != NUL)
8547 @@ -825,6 +1096,19 @@
8551 + /* Print the list of extra patch descriptions if there is at least one. */
8552 + if (extra_patches[0] != NULL)
8554 + MSG_PUTS(_("\nExtra patches: "));
8556 + for (i = 0; extra_patches[i] != NULL; ++i)
8560 + MSG_PUTS(extra_patches[i]);
8566 MSG_PUTS(_("Modified by "));
8567 diff -Naur vim72.orig/src/vim.h vim72/src/vim.h
8568 --- vim72.orig/src/vim.h 2008-08-09 09:03:38.000000000 -0700
8569 +++ vim72/src/vim.h 2009-03-12 11:55:13.547610560 -0700
8570 @@ -341,8 +341,14 @@
8571 #ifdef BACKSLASH_IN_FILENAME
8572 # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<")
8574 -# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
8575 -# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
8577 + /* VMS allows a lot of characters in the file name */
8578 +# define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!")
8579 +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&")
8581 +# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
8582 +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
8586 #define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */
8588 * Define __w64 as an empty token for everything but MSVC 7.x or later.
8590 # if !defined(_MSC_VER) || (_MSC_VER < 1300)
8594 typedef unsigned long __w64 long_u;
8595 typedef long __w64 long_i;
8596 @@ -1051,6 +1057,7 @@
8597 #define WSP_HELP 16 /* creating the help window */
8598 #define WSP_BELOW 32 /* put new window below/right */
8599 #define WSP_ABOVE 64 /* put new window above/left */
8600 +#define WSP_NEWLOC 128 /* don't copy location list */
8603 * arguments for gui_set_shellsize()
8604 @@ -1728,7 +1735,8 @@
8605 #define VV_MOUSE_COL 51
8607 #define VV_SEARCHFORWARD 53
8608 -#define VV_LEN 54 /* number of v: vars */
8609 +#define VV_OLDFILES 54
8610 +#define VV_LEN 55 /* number of v: vars */
8612 #ifdef FEAT_CLIPBOARD
8614 @@ -1979,6 +1987,9 @@
8618 +#ifndef FEAT_NETBEANS_INTG
8621 #ifdef NBDEBUG /* Netbeans debugging. */
8622 # include "nbdebug.h"
8624 @@ -2054,4 +2065,10 @@
8625 #define DOSO_VIMRC 1 /* loading vimrc file */
8626 #define DOSO_GVIMRC 2 /* loading gvimrc file */
8628 +/* flags for read_viminfo() and children */
8629 +#define VIF_WANT_INFO 1 /* load non-mark info */
8630 +#define VIF_WANT_MARKS 2 /* load file marks */
8631 +#define VIF_FORCEIT 4 /* overwrite info already read */
8632 +#define VIF_GET_OLDFILES 8 /* load v:oldfiles */
8635 diff -Naur vim72.orig/src/window.c vim72/src/window.c
8636 --- vim72.orig/src/window.c 2008-08-06 04:00:30.000000000 -0700
8637 +++ vim72/src/window.c 2009-03-12 11:55:13.547610560 -0700
8639 static int path_is_url __ARGS((char_u *p));
8640 #if defined(FEAT_WINDOWS) || defined(PROTO)
8641 static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
8642 -static void win_init __ARGS((win_T *newp, win_T *oldp));
8643 +static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
8644 static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
8645 static void frame_setheight __ARGS((frame_T *curfrp, int height));
8646 #ifdef FEAT_VERTSPLIT
8648 ++allow_keys; /* no mapping for xchar, but allow key codes */
8650 xchar = plain_vgetc();
8651 -#ifdef FEAT_LANGMAP
8652 LANGMAP_ADJUST(xchar, TRUE);
8656 #ifdef FEAT_CMDL_INFO
8660 /* make the contents of the new window the same as the current one */
8661 - win_init(wp, curwin);
8662 + win_init(wp, curwin, flags);
8666 @@ -1161,11 +1159,15 @@
8667 * Initialize window "newp" from window "oldp".
8668 * Used when splitting a window and when creating a new tab page.
8669 * The windows will both edit the same buffer.
8670 + * WSP_NEWLOC may be specified in flags to prevent the location list from
8675 -win_init(newp, oldp)
8676 +win_init(newp, oldp, flags)
8683 @@ -1190,7 +1192,14 @@
8684 copy_jumplist(oldp, newp);
8686 #ifdef FEAT_QUICKFIX
8687 - copy_loclist(oldp, newp);
8688 + if (flags & WSP_NEWLOC)
8690 + /* Don't copy the location list. */
8691 + newp->w_llist = NULL;
8692 + newp->w_llist_ref = NULL;
8695 + copy_loclist(oldp, newp);
8697 if (oldp->w_localdir != NULL)
8698 newp->w_localdir = vim_strsave(oldp->w_localdir);
8699 @@ -3220,7 +3229,7 @@
8702 /* First window in new tab page, initialize it from "oldwin". */
8703 - win_init(curwin, oldwin);
8704 + win_init(curwin, oldwin, 0);
8706 # ifdef FEAT_SCROLLBIND
8707 /* We don't want scroll-binding in the first window. */
8708 @@ -4028,14 +4037,14 @@
8709 if (mch_dirname(cwd, MAXPATHL) == OK)
8710 globaldir = vim_strsave(cwd);
8712 - mch_chdir((char *)curwin->w_localdir);
8713 - shorten_fnames(TRUE);
8714 + if (mch_chdir((char *)curwin->w_localdir) == 0)
8715 + shorten_fnames(TRUE);
8717 else if (globaldir != NULL)
8719 /* Window doesn't have a local directory and we are not in the global
8720 * directory: Change to the global directory. */
8721 - mch_chdir((char *)globaldir);
8722 + ignored = mch_chdir((char *)globaldir);
8723 vim_free(globaldir);
8725 shorten_fnames(TRUE);
8726 diff -Naur vim72.orig/src/workshop.c vim72/src/workshop.c
8727 --- vim72.orig/src/workshop.c 2008-06-21 11:53:26.000000000 -0700
8728 +++ vim72/src/workshop.c 2009-03-12 11:54:50.062104763 -0700
8729 @@ -1121,8 +1121,12 @@
8730 ? (char *)curbuf->b_sfname : "<None>");
8733 - strcpy(ffname, (char *) curbuf->b_ffname);
8734 - *filename = ffname; /* copy so nobody can change b_ffname */
8735 + if (curbuf->b_ffname == NULL)
8738 + /* copy so nobody can change b_ffname */
8739 + strcpy(ffname, (char *) curbuf->b_ffname);
8740 + *filename = ffname;
8741 *curLine = curwin->w_cursor.lnum;
8742 *curCol = curwin->w_cursor.col;