1 Submitted By: Matt Burgess <matthew_at_linuxfromscratch_dot_org>
3 Initial Package Version: 7.2
4 Upstream Status: Already in upstream patch repo
6 Description: This patch is upstream patch numbers 1 thru 65.
8 diff -Naur vim72.orig/Filelist vim72/Filelist
9 --- vim72.orig/Filelist 2008-07-06 19:02:23.000000000 +0100
10 +++ vim72/Filelist 2008-12-06 11:37:48.000000000 +0000
12 src/proto/os_win32.pro \
13 src/proto/os_mswin.pro \
14 src/testdir/Make_dos.mak \
15 + src/testdir/Make_ming.mak \
19 diff -Naur vim72.orig/runtime/doc/cmdline.txt vim72/runtime/doc/cmdline.txt
20 --- vim72.orig/runtime/doc/cmdline.txt 2008-08-09 15:22:59.000000000 +0100
21 +++ vim72/runtime/doc/cmdline.txt 2008-12-06 11:37:49.000000000 +0000
23 -*cmdline.txt* For Vim version 7.2. Last change: 2008 Jul 29
24 +*cmdline.txt* For Vim version 7.2. Last change: 2008 Sep 18
27 VIM REFERENCE MANUAL by Bram Moolenaar
29 (doesn't work at the expression prompt; some
30 things such as changing the buffer or current
31 window are not allowed to avoid side effects)
32 + When the result is a |List| the items are used
33 + as lines. They can have line breaks inside
35 + When the result is a Float it's automatically
36 + converted to a String.
37 See |registers| about registers. {not in Vi}
38 Implementation detail: When using the |expression| register
39 and invoking setcmdpos(), this sets the position before
41 In Ex commands, at places where a file name can be used, the following
42 characters have a special meaning. These can also be used in the expression
43 function expand() |expand()|.
44 - % is replaced with the current file name *:_%*
45 - # is replaced with the alternate file name *:_#*
46 + % Is replaced with the current file name. *:_%* *c_%*
47 + # Is replaced with the alternate file name. *:_#* *c_#*
48 #n (where n is a number) is replaced with the file name of
49 - buffer n. "#0" is the same as "#"
50 - ## is replaced with all names in the argument list *:_##*
51 + buffer n. "#0" is the same as "#".
52 + ## Is replaced with all names in the argument list *:_##* *c_##*
53 concatenated, separated by spaces. Each space in a name
54 is preceded with a backslash.
55 -Note that these give the file name as it was typed. If an absolute path is
56 -needed (when using the file name from a different directory), you need to add
57 -":p". See |filename-modifiers|.
58 + #<n (where n is a number > 0) is replaced with old *:_#<* *c_#<*
59 + file name n. See |:oldfiles| or |v:oldfiles| to get the
61 + {only when compiled with the +eval and +viminfo features}
63 +Note that these, except "#<n", give the file name as it was typed. If an
64 +absolute path is needed (when using the file name from a different directory),
65 +you need to add ":p". See |filename-modifiers|.
67 +The "#<n" item returns an absolute path, but it will start with "~/" for files
68 +below your home directory.
70 Note that backslashes are inserted before spaces, so that the command will
71 correctly interpret the file name. But this doesn't happen for shell
72 -commands. For those you probably have to use quotes: >
73 +commands. For those you probably have to use quotes (this fails for files
74 +that contain a quote and wildcards): >
78 diff -Naur vim72.orig/runtime/doc/eval.txt vim72/runtime/doc/eval.txt
79 --- vim72.orig/runtime/doc/eval.txt 2008-08-09 15:22:59.000000000 +0100
80 +++ vim72/runtime/doc/eval.txt 2008-12-06 11:37:50.000000000 +0000
82 -*eval.txt* For Vim version 7.2. Last change: 2008 Aug 09
83 +*eval.txt* For Vim version 7.2. Last change: 2008 Nov 27
86 VIM REFERENCE MANUAL by Bram Moolenaar
87 @@ -1484,6 +1484,17 @@
88 This is the screen column number, like with |virtcol()|. The
89 value is zero when there was no mouse button click.
91 + *v:oldfiles* *oldfiles-variable*
92 +v:oldfiles List of file names that is loaded from the |viminfo| file on
93 + startup. These are the files that Vim remembers marks for.
94 + The length of the List is limited by the ' argument of the
95 + 'viminfo' option (default is 100).
96 + Also see |:oldfiles| and |c_#<|.
97 + The List can be modified, but this has no effect on what is
98 + stored in the |viminfo| file later. If you use values other
99 + than String this will cause trouble.
100 + {only when compiled with the +viminfo feature}
102 *v:operator* *operator-variable*
103 v:operator The last operator given in Normal mode. This is a single
104 character except for commands starting with <g> or <z>,
105 @@ -1695,7 +1706,7 @@
106 exists( {expr}) Number TRUE if {expr} exists
107 extend({expr1}, {expr2} [, {expr3}])
108 List/Dict insert items of {expr2} into {expr1}
109 -expand( {expr}) String expand special keywords in {expr}
110 +expand( {expr} [, {flag}]) String expand special keywords in {expr}
111 feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer
112 filereadable( {file}) Number TRUE if {file} is a readable file
113 filewritable( {file}) Number TRUE if {file} is a writable file
114 @@ -1747,8 +1758,9 @@
115 getwinposx() Number X coord in pixels of GUI Vim window
116 getwinposy() Number Y coord in pixels of GUI Vim window
117 getwinvar( {nr}, {varname}) any variable {varname} in window {nr}
118 -glob( {expr}) String expand file wildcards in {expr}
119 -globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path}
120 +glob( {expr} [, {flag}]) String expand file wildcards in {expr}
121 +globpath( {path}, {expr} [, {flag}])
122 + String do glob({expr}) for all dirs in {path}
123 has( {feature}) Number TRUE if feature {feature} supported
124 has_key( {dict}, {key}) Number TRUE if {dict} has entry {key}
125 haslocaldir() Number TRUE if current window executed |:lcd|
126 @@ -3275,14 +3287,16 @@
127 :let list_is_on = getwinvar(2, '&list')
128 :echo "myvar = " . getwinvar(1, 'myvar')
131 -glob({expr}) Expand the file wildcards in {expr}. See |wildcards| for the
132 +glob({expr} [, {flag}]) *glob()*
133 + Expand the file wildcards in {expr}. See |wildcards| for the
134 use of special characters.
135 The result is a String.
136 When there are several matches, they are separated by <NL>
138 - The 'wildignore' option applies: Names matching one of the
139 - patterns in 'wildignore' will be skipped.
140 + Unless the optional {flag} argument is given and is non-zero,
141 + the 'suffixes' and 'wildignore' options apply: Names matching
142 + one of the patterns in 'wildignore' will be skipped and
143 + 'suffixes' affect the ordering of matches.
144 If the expansion fails, the result is an empty string.
145 A name for a non-existing file is not included.
147 @@ -3296,20 +3310,22 @@
148 See |expand()| for expanding special Vim variables. See
149 |system()| for getting the raw output of an external command.
151 -globpath({path}, {expr}) *globpath()*
152 +globpath({path}, {expr} [, {flag}]) *globpath()*
153 Perform glob() on all directories in {path} and concatenate
154 the results. Example: >
155 :echo globpath(&rtp, "syntax/c.vim")
156 < {path} is a comma-separated list of directory names. Each
157 directory name is prepended to {expr} and expanded like with
158 - glob(). A path separator is inserted when needed.
159 + |glob()|. A path separator is inserted when needed.
160 To add a comma inside a directory name escape it with a
161 backslash. Note that on MS-Windows a directory may have a
162 trailing backslash, remove it if you put a comma after it.
163 If the expansion fails for one of the directories, there is no
165 - The 'wildignore' option applies: Names matching one of the
166 - patterns in 'wildignore' will be skipped.
167 + Unless the optional {flag} argument is given and is non-zero,
168 + the 'suffixes' and 'wildignore' options apply: Names matching
169 + one of the patterns in 'wildignore' will be skipped and
170 + 'suffixes' affect the ordering of matches.
172 The "**" item can be used to search in a directory tree.
173 For example, to find all "README.txt" files in the directories
174 @@ -5332,10 +5348,12 @@
175 "fg" foreground color (GUI: color name used to set
176 the color, cterm: color number as a string,
178 - "bg" background color (like "fg")
179 + "bg" background color (as with "fg")
180 + "sp" special color (as with "fg") |highlight-guisp|
181 "fg#" like "fg", but for the GUI and the GUI is
182 running the name in "#RRGGBB" form
183 "bg#" like "fg#" for "bg"
184 + "sp#" like "fg#" for "sp"
186 "italic" "1" if italic
187 "reverse" "1" if reverse
188 diff -Naur vim72.orig/runtime/doc/options.txt vim72/runtime/doc/options.txt
189 --- vim72.orig/runtime/doc/options.txt 2008-08-09 15:22:59.000000000 +0100
190 +++ vim72/runtime/doc/options.txt 2008-12-06 11:37:50.000000000 +0000
192 -*options.txt* For Vim version 7.2. Last change: 2008 Aug 06
193 +*options.txt* For Vim version 7.2. Last change: 2008 Nov 25
196 VIM REFERENCE MANUAL by Bram Moolenaar
197 @@ -7472,7 +7472,9 @@
198 {not available when compiled without the |+wildignore|
200 A list of file patterns. A file that matches with one of these
201 - patterns is ignored when completing file or directory names.
202 + patterns is ignored when completing file or directory names, and
203 + influences the result of |expand()|, |glob()| and |globpath()| unless
204 + a flag is passed to disable this.
205 The pattern is used like with |:autocmd|, see |autocmd-patterns|.
208 diff -Naur vim72.orig/runtime/doc/os_vms.txt vim72/runtime/doc/os_vms.txt
209 --- vim72.orig/runtime/doc/os_vms.txt 2008-08-09 15:23:00.000000000 +0100
210 +++ vim72/runtime/doc/os_vms.txt 2008-12-06 11:37:48.000000000 +0000
212 -*os_vms.txt* For Vim version 7.2. Last change: 2006 Nov 18
213 +*os_vms.txt* For Vim version 7.2. Last change: 2008 Aug 19
219 8. Useful notes *vms-notes*
221 -8.1 backspace/delete
222 +8.1 Backspace/delete
224 8.3 VMS file version numbers
225 8.4 Directory conversion
228 8.13 Allow '$' in C keywords
229 8.14 VIMTUTOR for beginners
230 +8.15 Slow start in console mode issue
231 +8.16 Common VIM directory - different architectures
233 -8.1 backspace/delete
234 +8.1 Backspace/delete
236 There are backspace/delete key inconsistencies with VMS.
237 :fixdel doesn't do the trick, but the solution is: >
238 @@ -663,12 +665,130 @@
240 (Thomas.R.Wyant III, Vim 6.1)
242 +8.14 Slow start in console mode issue
244 +As GUI/GTK Vim works equally well in console mode, many administartors
245 +deploy those executables system wide.
246 +Unfortunately, on a remote slow connections GUI/GTK executables behave rather
247 +slow when user wants to run Vim just in the console mode - because of X environment detection timeout.
249 +Luckily, there is a simple solution for that. Administrators need to deploy
250 +both GUI/GTK build and just console build executables, like below: >
255 + vimrc (system rc files)
257 + gvim.exe (the remaned GUI or GTK built vim.exe)
258 + vim.exe (the console only executable)
260 +Define system symbols like below in for ex in LOGIN.COM or SYLOGIN.COM: >
262 + $ define/nolog VIM RF10:[UTIL.VIM72] ! where you VIM directory is
263 + $ vi*m :== mcr VIM:VIM.EXE
264 + $ gvi*m :== mcr VIM:GVIM.EXE
265 + $ ! or you can try to spawn with
266 + $ gv*im :== spawn/nowait/input=NLA0 mcr VIM:GVIM.EXE -g -GEOMETRY 80x40
269 +Like this, users that do not have X environment and want to use Vim just in
270 +console mode can avoid performance problems.
272 +(Zoltan Arpadffy, Vim 7.2)
274 +8.15 Common VIM directory - different architectures
276 +In a cluster that contains nodes with different architectures like below:
279 +View of Cluster from system ID 11655 node: TOR 18-AUG-2008 11:58:31
280 ++---------------------------------+
281 +¦ SYSTEMS ¦ MEMBERS ¦
282 ++-----------------------+---------¦
283 +¦ NODE ¦ SOFTWARE ¦ STATUS ¦
284 ++--------+--------------+---------¦
285 +¦ TOR ¦ VMS V7.3-2 ¦ MEMBER ¦
286 +¦ TITAN2 ¦ VMS V8.3 ¦ MEMBER ¦
287 +¦ ODIN ¦ VMS V7.3-2 ¦ MEMBER ¦
288 ++---------------------------------+
290 +It is convinient to have a common VIM directory but execute different
292 +There are more solutions for this problem:
294 +solution 1. all executables in the same directory with different names
295 +This is easily done with the following script that can be added
296 +to the login.com or sylogin.com: >
298 + $ if f$getsyi("NODE_HWTYPE") .eqs. "VAX"
300 + $ say "VAX platform"
301 + $ vi*m:== mcr vim:VIM.EXE_VAX
303 + $ if f$getsyi("NODE_HWTYPE") .eqs. "ALPH"
305 + $ say "ALPHA platform"
306 + $ vi*m :== mcr vim:VIM.EXE_AXP
308 + $ if f$getsyi("ARCH_NAME") .eqs. "IA64"
310 + $ say "IA64 platform"
311 + $ vi*m :== mcr vim:VIM.EXE_IA64
314 +solution 2. different directories: >
316 + $ if f$getsyi("NODE_HWTYPE") .eqs. "VAX"
318 + $ say "VAX platform"
319 + $ define/nolog VIM RF10:[UTIL.VAX_EXE] ! VAX executables
321 + $ if f$getsyi("NODE_HWTYPE") .eqs. "ALPH"
323 + $ say "ALPHA platform"
324 + $ define/nolog VIM RF10:[UTIL.AXP_EXE] ! AXP executables
326 + $ if f$getsyi("ARCH_NAME") .eqs. "IA64"
328 + $ say "IA64 platform"
329 + $ define/nolog VIM RF10:[UTIL.IA64_EXE] ! IA64 executables
331 + $! VIMRUNTIME must be defined in order to find runtime files
332 + $ define/nolog VIMRUNTIME RF10:[UTIL.VIM72]
334 +A good examle for this approach is the [GNU]gnu_tools.com script from GNU_TOOLS.ZIP
335 +package downloadable from http://www.polarhome.com/vim/
337 +(Zoltan Arpadffy, Vim 7.2)
339 ==============================================================================
341 9. VMS related changes *vms-changes*
345 +- The following plugins are included into VMS runtime:
346 + genutils 2.4, multiselect 2.2, multvals 3.1, selectbuf 4.3,
347 + bufexplorer 7.1.7, taglist 4.5
348 +- minor changes in vimrc (just in VMS runtime)
349 +- make_vms.mms - HUGE model is the default
350 +- [TESTDIR]make_vms.mms include as many tests possible
351 +- modify test30 and test54 for VMS
352 +- enable FLOAT feature in VMS port
353 +- os_vms.txt updated
355 +Version 7.2 (2008 Aug 9)
356 +- VCF files write corrected
357 +- CTAGS 5.7 included
358 +- corrected make_vms.mms (on VAX gave syntax error)
360 +Version 7.1 (2007 Jun 15)
361 +- create TAGS file from menu
363 +Version 7 (2006 May 8)
364 - Improved low level char input (affects just console mode)
366 +- CTAGS 5.6 included
368 Version 6.4 (2005 Oct 15)
369 - GTKLIB and Vim build on IA64
372 OpenVMS documentation and executables are maintained by:
373 Zoltan Arpadffy <arpadffy@polarhome.com>
374 +OpenVMS Vim page: http://www.polarhome.com/vim/
376 This document uses parts and remarks from earlier authors and contributors
378 diff -Naur vim72.orig/runtime/doc/spell.txt vim72/runtime/doc/spell.txt
379 --- vim72.orig/runtime/doc/spell.txt 2008-08-09 15:23:00.000000000 +0100
380 +++ vim72/runtime/doc/spell.txt 2008-12-06 11:37:50.000000000 +0000
382 -*spell.txt* For Vim version 7.2. Last change: 2008 Jun 21
383 +*spell.txt* For Vim version 7.2. Last change: 2008 Nov 30
386 VIM REFERENCE MANUAL by Bram Moolenaar
391 -With some items it's also possible to put a comment after it, but this isn't
392 -supported in general.
393 +Items with a fixed number of arguments can be followed by a comment. But only
394 +if none of the arguments can contain white space. The comment must start with
395 +a "#" character. Example:
397 + KEEPCASE = # fix case for words with this flag ~
403 Note: When using utf-8 only characters up to 65000 may be used for flags.
405 +Note: even when using "num" or "long" the number of flags available to
406 +compounding and prefixes is limited to about 250.
410 *spell-PFX* *spell-SFX*
411 @@ -1178,6 +1184,9 @@
412 The flag also applies to the word with affixes, thus this can be used to mark
413 a whole bunch of related words as bad.
415 + *spell-FORBIDDENWORD*
416 +FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell.
419 The NEEDAFFIX flag is used to require that a word is used with an affix. The
420 word itself is not a good word (unless there is an empty affix). Example:
421 @@ -1268,6 +1277,10 @@
425 + *spell-ONLYINCOMPOUND*
426 +The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for
427 +compatiblity with Hunspell.
430 The minimal character length of a word used for compounding is specified with
431 COMPOUNDMIN. Example:
432 @@ -1328,6 +1341,20 @@
433 rules. Can also be used for an affix to count the affix as a compounding
436 + *spell-CHECKCOMPOUNDPATTERN*
437 +CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
438 +position where two words are compounded together forbids the compound.
440 + CHECKCOMPOUNDPATTERN o e ~
442 +This forbids compounding if the first word ends in "o" and the second word
445 +The arguments must be plain text, no patterns are actually supported, despite
446 +the item name. Case is always ignored.
448 +The Hunspell feature to use three arguments and flags is not supported.
451 The SYLLABLE item defines characters or character sequences that are used to
452 count the number of syllables in a word. Example:
453 @@ -1496,6 +1523,10 @@
454 ACCENT (Hunspell) *spell-ACCENT*
455 Use MAP instead. |spell-MAP|
457 +BREAK (Hunspell) *spell-BREAK*
458 + Define break points. Unclear how it works exactly.
461 CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE*
462 Disallow uppercase letters at compound word boundaries.
464 @@ -1512,9 +1543,6 @@
465 Forbid three identical characters when compounding. Not
468 -CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN*
469 - Forbid compounding when patterns match. Not supported.
471 COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES*
472 Enables using two prefixes. Not supported.
474 @@ -1536,13 +1564,18 @@
475 COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
476 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
478 +COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES*
479 + Number of COMPOUNDRULE lines following. Ignored, but the
480 + argument must be a number.
482 COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
483 Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
484 |spell-COMPOUNDSYLMAX|
486 -FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD*
487 - Use BAD instead. |spell-BAD|
489 +KEY (Hunspell) *spell-KEY*
490 + Define characters that are close together on the keyboard.
491 + Used to give better suggestions. Not supported.
493 LANG (Hunspell) *spell-LANG*
494 This specifies language-specific behavior. This actually
495 moves part of the language knowledge into the program,
496 @@ -1553,10 +1586,7 @@
497 Only needed for morphological analysis.
499 MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
502 -ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND*
503 - Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND|
504 + Set number of n-gram suggestions. Not supported.
506 PSEUDOROOT (Hunspell) *spell-PSEUDOROOT*
507 Use NEEDAFFIX instead. |spell-NEEDAFFIX|
508 diff -Naur vim72.orig/runtime/doc/starting.txt vim72/runtime/doc/starting.txt
509 --- vim72.orig/runtime/doc/starting.txt 2008-08-09 15:23:00.000000000 +0100
510 +++ vim72/runtime/doc/starting.txt 2008-12-06 11:37:49.000000000 +0000
512 -*starting.txt* For Vim version 7.2. Last change: 2008 Jun 21
513 +*starting.txt* For Vim version 7.2. Last change: 2008 Nov 09
516 VIM REFERENCE MANUAL by Bram Moolenaar
517 @@ -1337,8 +1337,9 @@
519 When Vim is started and the 'viminfo' option is non-empty, the contents of
520 the viminfo file are read and the info can be used in the appropriate places.
521 -The marks are not read in at startup (but file marks are). See
522 -|initialization| for how to set the 'viminfo' option upon startup.
523 +The |v:oldfiles| variable is filled. The marks are not read in at startup
524 +(but file marks are). See |initialization| for how to set the 'viminfo'
525 +option upon startup.
528 When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo
529 @@ -1372,6 +1373,8 @@
530 that start with any string given with the "r" flag in 'viminfo'. This can be
531 used to avoid saving marks for files on removable media (for MS-DOS you would
532 use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:").
533 +The |v:oldfiles| variable is filled with the file names that the viminfo file
537 Uppercase marks ('A to 'Z) are stored when writing the viminfo file. The
538 @@ -1463,8 +1466,8 @@
539 *:rv* *:rviminfo* *E195*
540 :rv[iminfo][!] [file] Read from viminfo file [file] (default: see above).
541 If [!] is given, then any information that is
542 - already set (registers, marks, etc.) will be
543 - overwritten. {not in Vi}
544 + already set (registers, marks, |v:oldfiles|, etc.)
545 + will be overwritten {not in Vi}
547 *:wv* *:wviminfo* *E137* *E138* *E574*
548 :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
549 @@ -1479,4 +1482,20 @@
554 +:ol[dfiles] List the files that have marks stored in the viminfo
555 + file. This list is read on startup and only changes
556 + afterwards with ":rviminfo!". Also see |v:oldfiles|.
557 + The number can be used with |c_#<|.
558 + {not in Vi, only when compiled with the +eval feature}
560 +:bro[wse] ol[dfiles][!]
561 + List file names as with |:oldfiles|, and then prompt
562 + for a number. When the number is valid that file from
563 + the list is edited.
564 + If you get the |press-enter| prompt you can press "q"
565 + and still get the prompt to enter a file number.
566 + Use ! to abondon a modified buffer. |abandon|
567 + {not when compiled with tiny or small features}
569 vim:tw=78:ts=8:ft=help:norl:
570 diff -Naur vim72.orig/runtime/doc/usr_21.txt vim72/runtime/doc/usr_21.txt
571 --- vim72.orig/runtime/doc/usr_21.txt 2008-08-09 15:23:01.000000000 +0100
572 +++ vim72/runtime/doc/usr_21.txt 2008-12-06 11:37:49.000000000 +0000
574 -*usr_21.txt* For Vim version 7.2. Last change: 2007 May 01
575 +*usr_21.txt* For Vim version 7.2. Last change: 2008 Nov 09
577 VIM USER MANUAL - by Bram Moolenaar
580 to be lost. Each item can be remembered only once.
583 -GETTING BACK TO WHERE YOU WERE
584 +GETTING BACK TO WHERE YOU STOPPED VIM
586 You are halfway editing a file and it's time to leave for holidays. You exit
587 Vim and go enjoy yourselves, forgetting all about your work. After a couple
589 The |:marks| command is useful to find out where '0 to '9 will take you.
592 +GETTING BACK TO SOME FILE
594 +If you want to go back to a file that you edited recently, but not when
595 +exiting Vim, there is a slightly more complicated way. You can see a list of
596 +files by typing the command: >
600 + 2: ~/text/resume.txt ~
603 +Now you would like to edit the second file, which is in the list preceded by
608 +Instead of ":e" you can use any command that has a file name argument, the
609 +"#<2" item works in the same place as "%" (current file name) and "#"
610 +(alternate file name). So you can also split the window to edit the third
615 +That #<123 thing is a bit complicated when you just want to edit a file.
616 +Fortunately there is a simpler way: >
620 + 2: ~/text/resume.txt ~
624 +You get the same list of files as with |:oldfiles|. If you want to edit
625 +"resume.txt" first press "q" to stop the listing. You will get a prompt:
627 + Type number and <Enter> (empty cancels): ~
629 +Type "2" and press <Enter> to edit the second file.
631 +More info at |:oldfiles|, |v:oldfiles| and |c_#<|.
634 MOVE INFO FROM ONE VIM TO ANOTHER
636 You can use the ":wviminfo" and ":rviminfo" commands to save and restore the
637 diff -Naur vim72.orig/runtime/scripts.vim vim72/runtime/scripts.vim
638 --- vim72.orig/runtime/scripts.vim 2008-08-08 23:27:21.000000000 +0100
639 +++ vim72/runtime/scripts.vim 2008-12-06 11:37:48.000000000 +0000
641 elseif s:line1 =~ '\<DTD\s\+XHTML\s'
644 + " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
645 + elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
649 elseif s:line1 =~ '^%PDF-'
651 diff -Naur vim72.orig/src/auto/configure vim72/src/auto/configure
652 --- vim72.orig/src/auto/configure 2008-07-24 13:40:36.000000000 +0100
653 +++ vim72/src/auto/configure 2008-12-06 11:37:50.000000000 +0000
654 @@ -16819,21 +16819,29 @@
655 LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
658 -{ $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
659 -$as_echo_n "checking for GCC 3 or later... " >&6; }
660 DEPEND_CFLAGS_FILTER=
661 if test "$GCC" = yes; then
662 + { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
663 +$as_echo_n "checking for GCC 3 or later... " >&6; }
664 gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
665 if test "$gccmajor" -gt "2"; then
666 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
669 -if test "$DEPEND_CFLAGS_FILTER" = ""; then
670 - { $as_echo "$as_me:$LINENO: result: no" >&5
671 + { $as_echo "$as_me:$LINENO: result: yes" >&5
672 +$as_echo "yes" >&6; }
674 + { $as_echo "$as_me:$LINENO: result: no" >&5
677 - { $as_echo "$as_me:$LINENO: result: yes" >&5
679 + { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5
680 +$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
681 + if test "$gccmajor" -gt "3"; then
682 + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
683 + { $as_echo "$as_me:$LINENO: result: yes" >&5
684 $as_echo "yes" >&6; }
686 + { $as_echo "$as_me:$LINENO: result: no" >&5
687 +$as_echo "no" >&6; }
692 diff -Naur vim72.orig/src/buffer.c vim72/src/buffer.c
693 --- vim72.orig/src/buffer.c 2008-08-06 12:00:48.000000000 +0100
694 +++ vim72/src/buffer.c 2008-12-06 11:37:50.000000000 +0000
696 static char_u *fname_match __ARGS((regprog_T *prog, char_u *name));
698 static void buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options));
699 -static wininfo_T *find_wininfo __ARGS((buf_T *buf));
700 +static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer));
702 static buf_T *buflist_findname_stat __ARGS((char_u *ffname, struct stat *st));
703 static int otherfile_buf __ARGS((buf_T *buf, char_u *ffname, struct stat *stp));
705 vim_free(buf->b_start_fenc);
706 buf->b_start_fenc = NULL;
709 + ga_clear(&buf->b_langp);
714 @@ -1090,7 +1093,7 @@
717 retval = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE,
718 - forceit ? ECMD_FORCEIT : 0);
719 + forceit ? ECMD_FORCEIT : 0, curwin);
722 * do_ecmd() may create a new buffer, then we have to delete
723 @@ -1237,7 +1240,7 @@
724 * "buf" if one exists */
725 if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
727 - /* If 'switchbuf' contians "usetab": jump to first window in any tab
728 + /* If 'switchbuf' contains "usetab": jump to first window in any tab
729 * page containing "buf" if one exists */
730 if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
732 @@ -1313,7 +1316,7 @@
735 curwin->w_alt_fnum = curbuf->b_fnum; /* remember alternate file */
736 - buflist_altfpos(); /* remember curpos */
737 + buflist_altfpos(curwin); /* remember curpos */
740 /* Don't restart Select mode after switching to another buffer. */
741 @@ -1351,11 +1354,12 @@
745 + /* An autocommand may have deleted "buf", already entered it (e.g., when
746 + * it did ":bunload") or aborted the script processing! */
748 - /* An autocommand may have deleted buf or aborted the script processing! */
749 - if (buf_valid(buf) && !aborting())
750 + if (buf_valid(buf) && buf != curbuf && !aborting())
752 - if (buf_valid(buf)) /* an autocommand may have deleted buf! */
753 + if (buf_valid(buf) && buf != curbuf)
757 @@ -1397,6 +1401,9 @@
758 curwin->w_cursor.coladd = 0;
760 curwin->w_set_curswant = TRUE;
762 + curwin->w_topline_was_set = FALSE;
765 /* Make sure the buffer is loaded. */
766 if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
767 @@ -1436,7 +1443,8 @@
771 - if (curwin->w_topline == 1) /* when autocmds didn't change it */
772 + /* when autocmds didn't change it */
773 + if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
775 scroll_cursor_halfway(FALSE); /* redisplay at correct position */
777 @@ -2400,22 +2408,70 @@
782 +static int wininfo_other_tab_diff __ARGS((wininfo_T *wip));
785 + * Return TRUE when "wip" has 'diff' set and the diff is only for another tab
786 + * page. That's because a diff is local to a tab page.
789 +wininfo_other_tab_diff(wip)
794 + if (wip->wi_opt.wo_diff)
796 + for (wp = firstwin; wp != NULL; wp = wp->w_next)
797 + /* return FALSE when it's a window in the current tab page, thus
798 + * the buffer was in diff mode here */
799 + if (wip->wi_win == wp)
808 * Find info for the current window in buffer "buf".
809 * If not found, return the info for the most recently used window.
810 + * When "skip_diff_buffer" is TRUE avoid windows with 'diff' set that is in
811 + * another tab page.
812 * Returns NULL when there isn't any info.
817 +find_wininfo(buf, skip_diff_buffer)
819 + int skip_diff_buffer;
823 for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
824 - if (wip->wi_win == curwin)
825 + if (wip->wi_win == curwin
827 + && (!skip_diff_buffer || !wininfo_other_tab_diff(wip))
831 - if (wip == NULL) /* if no fpos for curwin, use the first in the list */
832 - wip = buf->b_wininfo;
834 + /* If no wininfo for curwin, use the first in the list (that doesn't have
835 + * 'diff' set and is in another tab page). */
839 + if (skip_diff_buffer)
841 + for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
842 + if (!wininfo_other_tab_diff(wip))
847 + wip = buf->b_wininfo;
852 @@ -2436,7 +2492,7 @@
853 clearFolding(curwin);
856 - wip = find_wininfo(buf);
857 + wip = find_wininfo(buf, TRUE);
858 if (wip != NULL && wip->wi_optset)
860 copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt);
861 @@ -2468,7 +2524,7 @@
863 static pos_T no_position = {1, 0};
865 - wip = find_wininfo(buf);
866 + wip = find_wininfo(buf, FALSE);
868 return &(wip->wi_fpos);
870 @@ -2789,14 +2845,14 @@
874 - * Set alternate cursor position for current window.
875 + * Set alternate cursor position for the current buffer and window "win".
876 * Also save the local window option values.
880 +buflist_altfpos(win)
883 - buflist_setfpos(curbuf, curwin, curwin->w_cursor.lnum,
884 - curwin->w_cursor.col, TRUE);
885 + buflist_setfpos(curbuf, win, win->w_cursor.lnum, win->w_cursor.col, TRUE);
889 @@ -3963,7 +4019,7 @@
890 width = vim_strsize(out);
891 if (maxwidth > 0 && width > maxwidth)
893 - /* Result is too long, must trunctate somewhere. */
894 + /* Result is too long, must truncate somewhere. */
898 @@ -4488,7 +4544,7 @@
900 ((P_HID(curwin->w_buffer)
901 || bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0)
903 + + ECMD_OLDBUF, curwin);
907 @@ -5062,7 +5118,7 @@
909 if (buf->b_sfname != NULL)
910 return (char *)buf->b_sfname;
911 - return "[Scratch]";
912 + return _("[Scratch]");
915 if (buf->b_fname == NULL)
916 diff -Naur vim72.orig/src/configure.in vim72/src/configure.in
917 --- vim72.orig/src/configure.in 2008-07-24 13:40:26.000000000 +0100
918 +++ vim72/src/configure.in 2008-12-06 11:37:50.000000000 +0000
919 @@ -3152,18 +3152,25 @@
920 dnl But only when making dependencies, cproto and lint don't take "-isystem".
921 dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
922 dnl the number before the version number.
923 -AC_MSG_CHECKING(for GCC 3 or later)
924 DEPEND_CFLAGS_FILTER=
925 if test "$GCC" = yes; then
926 + AC_MSG_CHECKING(for GCC 3 or later)
927 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
928 if test "$gccmajor" -gt "2"; then
929 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
934 + dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
935 + dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
936 + AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
937 + if test "$gccmajor" -gt "3"; then
938 + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
944 -if test "$DEPEND_CFLAGS_FILTER" = ""; then
949 AC_SUBST(DEPEND_CFLAGS_FILTER)
951 diff -Naur vim72.orig/src/diff.c vim72/src/diff.c
952 --- vim72.orig/src/diff.c 2008-03-05 11:16:56.000000000 +0000
953 +++ vim72/src/diff.c 2008-12-06 11:37:50.000000000 +0000
956 tp->tp_diffbuf[i] = NULL;
957 tp->tp_diff_invalid = TRUE;
965 curtab->tp_diffbuf[i] = NULL;
966 curtab->tp_diff_invalid = TRUE;
973 curtab->tp_diffbuf[i] = buf;
974 curtab->tp_diff_invalid = TRUE;
983 + int io_error = FALSE;
985 /* Delete all diffblocks. */
987 @@ -697,18 +702,26 @@
990 fd = mch_fopen((char *)tmp_orig, "w");
996 - fwrite("line1\n", (size_t)6, (size_t)1, fd);
997 + if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1)
1000 fd = mch_fopen((char *)tmp_new, "w");
1006 - fwrite("line2\n", (size_t)6, (size_t)1, fd);
1007 + if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1)
1010 diff_file(tmp_orig, tmp_new, tmp_diff);
1011 fd = mch_fopen((char *)tmp_diff, "r");
1017 char_u linebuf[LBUFLEN];
1024 + EMSG(_("E810: Cannot read or write temp files"));
1025 EMSG(_("E97: Cannot create diffs"));
1026 diff_a_works = MAYBE;
1027 #if defined(MSWIN) || defined(MSDOS)
1028 @@ -925,10 +940,10 @@
1030 # ifdef TEMPDIRNAMES
1031 if (vim_tempdir != NULL)
1032 - mch_chdir((char *)vim_tempdir);
1033 + ignored = mch_chdir((char *)vim_tempdir);
1036 - mch_chdir("/tmp");
1037 + ignored = mch_chdir("/tmp");
1038 shorten_fnames(TRUE);
1041 diff -Naur vim72.orig/src/eval.c vim72/src/eval.c
1042 --- vim72.orig/src/eval.c 2008-08-07 20:37:22.000000000 +0100
1043 +++ vim72/src/eval.c 2008-12-06 11:37:50.000000000 +0000
1045 {VV_NAME("mouse_col", VAR_NUMBER), 0},
1046 {VV_NAME("operator", VAR_STRING), VV_RO},
1047 {VV_NAME("searchforward", VAR_NUMBER), 0},
1048 + {VV_NAME("oldfiles", VAR_LIST), 0},
1053 #define vv_nr vv_di.di_tv.vval.v_number
1054 #define vv_float vv_di.di_tv.vval.v_float
1055 #define vv_str vv_di.di_tv.vval.v_string
1056 +#define vv_list vv_di.di_tv.vval.v_list
1057 #define vv_tv vv_di.di_tv
1061 static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
1062 static void list_append __ARGS((list_T *l, listitem_T *item));
1063 static int list_append_tv __ARGS((list_T *l, typval_T *tv));
1064 -static int list_append_string __ARGS((list_T *l, char_u *str, int len));
1065 static int list_append_number __ARGS((list_T *l, varnumber_T n));
1066 static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
1067 static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef));
1068 @@ -845,11 +846,17 @@
1070 if (p->vv_di.di_tv.v_type == VAR_STRING)
1072 - vim_free(p->vv_di.di_tv.vval.v_string);
1073 - p->vv_di.di_tv.vval.v_string = NULL;
1074 + vim_free(p->vv_str);
1077 + else if (p->vv_di.di_tv.v_type == VAR_LIST)
1079 + list_unref(p->vv_list);
1080 + p->vv_list = NULL;
1083 hash_clear(&vimvarht);
1084 + hash_init(&vimvarht); /* garbage_collect() will access it */
1085 hash_clear(&compat_hashtab);
1087 /* script-local variables */
1088 @@ -1256,23 +1263,26 @@
1091 * Top level evaluation function, returning a string.
1092 + * When "convert" is TRUE convert a List into a sequence of lines and convert
1093 + * a Float to a String.
1094 * Return pointer to allocated memory, or NULL for failure.
1097 -eval_to_string(arg, nextcmd, dolist)
1098 +eval_to_string(arg, nextcmd, convert)
1101 - int dolist; /* turn List into sequence of lines */
1107 + char_u numbuf[NUMBUFLEN];
1109 if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
1113 - if (dolist && tv.v_type == VAR_LIST)
1114 + if (convert && tv.v_type == VAR_LIST)
1116 ga_init2(&ga, (int)sizeof(char), 80);
1117 if (tv.vval.v_list != NULL)
1118 @@ -1280,6 +1290,13 @@
1119 ga_append(&ga, NUL);
1120 retval = (char_u *)ga.ga_data;
1123 + else if (convert && tv.v_type == VAR_FLOAT)
1125 + vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
1126 + retval = vim_strsave(numbuf);
1130 retval = vim_strsave(get_tv_string(&tv));
1132 @@ -3277,7 +3294,7 @@
1134 if (*startarg != '(')
1136 - EMSG2(_("E107: Missing braces: %s"), eap->arg);
1137 + EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
1141 @@ -3657,8 +3674,8 @@
1145 - * Return TRUE if typeval "tv" is locked: Either tha value is locked itself or
1146 - * it refers to a List or Dictionary that is locked.
1147 + * Return TRUE if typeval "tv" is locked: Either that value is locked itself
1148 + * or it refers to a List or Dictionary that is locked.
1152 @@ -6047,6 +6064,25 @@
1156 + * Get list item "l[idx - 1]" as a string. Returns NULL for failure.
1159 +list_find_str(l, idx)
1165 + li = list_find(l, idx - 1);
1168 + EMSGN(_(e_listidx), idx);
1171 + return get_tv_string(&li->li_tv);
1175 * Locate "item" list "l" and return its index.
1176 * Returns -1 when "item" is not in the list.
1178 @@ -6137,7 +6173,7 @@
1179 * When "len" >= 0 use "str[len]".
1180 * Returns FAIL when out of memory.
1184 list_append_string(l, str, len)
1187 @@ -6497,6 +6533,9 @@
1188 set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
1192 + set_ref_in_ht(&vimvarht, copyID);
1195 * 2. Go through the list of dicts and free items without the copyID.
1197 @@ -6587,7 +6626,7 @@
1200 dd = tv->vval.v_dict;
1201 - if (dd->dv_copyID != copyID)
1202 + if (dd != NULL && dd->dv_copyID != copyID)
1204 /* Didn't see this dict yet. */
1205 dd->dv_copyID = copyID;
1206 @@ -6597,7 +6636,7 @@
1209 ll = tv->vval.v_list;
1210 - if (ll->lv_copyID != copyID)
1211 + if (ll != NULL && ll->lv_copyID != copyID)
1213 /* Didn't see this list yet. */
1214 ll->lv_copyID = copyID;
1215 @@ -7525,8 +7564,8 @@
1216 {"getwinposx", 0, 0, f_getwinposx},
1217 {"getwinposy", 0, 0, f_getwinposy},
1218 {"getwinvar", 2, 2, f_getwinvar},
1219 - {"glob", 1, 1, f_glob},
1220 - {"globpath", 2, 2, f_globpath},
1221 + {"glob", 1, 2, f_glob},
1222 + {"globpath", 2, 3, f_globpath},
1223 {"has", 1, 1, f_has},
1224 {"has_key", 2, 2, f_has_key},
1225 {"haslocaldir", 0, 0, f_haslocaldir},
1226 @@ -9518,7 +9557,7 @@
1229 /* When the optional second argument is non-zero, don't remove matches
1230 - * for 'suffixes' and 'wildignore' */
1231 + * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1232 if (argvars[1].v_type != VAR_UNKNOWN
1233 && get_tv_number_chk(&argvars[1], &error))
1234 flags |= WILD_KEEP_ALL;
1235 @@ -10300,7 +10339,8 @@
1236 s = get_tv_string(&argvars[0]);
1237 if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
1238 EMSG2(_(e_invarg2), s);
1239 - else if (!function_exists(s))
1240 + /* Don't check an autoload name for existence here. */
1241 + else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
1242 EMSG2(_("E700: Unknown function: %s"), s);
1245 @@ -10602,7 +10642,7 @@
1246 # ifdef FEAT_WINDOWS
1252 if (row >= 0 && col >= 0)
1254 @@ -10612,9 +10652,9 @@
1255 (void)mouse_comp_pos(win, &row, &col, &lnum);
1256 # ifdef FEAT_WINDOWS
1257 for (wp = firstwin; wp != win; wp = wp->w_next)
1261 - vimvars[VV_MOUSE_WIN].vv_nr = n;
1262 + vimvars[VV_MOUSE_WIN].vv_nr = winnr;
1263 vimvars[VV_MOUSE_LNUM].vv_nr = lnum;
1264 vimvars[VV_MOUSE_COL].vv_nr = col + 1;
1266 @@ -11284,13 +11324,25 @@
1270 + int flags = WILD_SILENT|WILD_USE_NL;
1272 + int error = FALSE;
1275 - xpc.xp_context = EXPAND_FILES;
1276 + /* When the optional second argument is non-zero, don't remove matches
1277 + * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1278 + if (argvars[1].v_type != VAR_UNKNOWN
1279 + && get_tv_number_chk(&argvars[1], &error))
1280 + flags |= WILD_KEEP_ALL;
1281 rettv->v_type = VAR_STRING;
1282 - rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1283 - NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
1287 + xpc.xp_context = EXPAND_FILES;
1288 + rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1289 + NULL, flags, WILD_ALL);
1292 + rettv->vval.v_string = NULL;
1296 @@ -11301,14 +11353,22 @@
1301 char_u buf1[NUMBUFLEN];
1302 char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
1303 + int error = FALSE;
1305 + /* When the optional second argument is non-zero, don't remove matches
1306 + * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1307 + if (argvars[2].v_type != VAR_UNKNOWN
1308 + && get_tv_number_chk(&argvars[2], &error))
1309 + flags |= WILD_KEEP_ALL;
1310 rettv->v_type = VAR_STRING;
1312 + if (file == NULL || error)
1313 rettv->vval.v_string = NULL;
1315 - rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
1316 + rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
1321 @@ -15838,10 +15898,9 @@
1323 res = ITEM_COMPARE_FAIL;
1325 - /* return value has wrong type */
1326 res = get_tv_number_chk(&rettv, &item_compare_func_err);
1327 if (item_compare_func_err)
1328 - res = ITEM_COMPARE_FAIL;
1329 + res = ITEM_COMPARE_FAIL; /* return value has wrong type */
1333 @@ -16590,8 +16649,11 @@
1334 p = highlight_has_attr(id, HL_INVERSE, modec);
1337 - case 's': /* standout */
1338 - p = highlight_has_attr(id, HL_STANDOUT, modec);
1340 + if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */
1341 + p = highlight_color(id, what, modec);
1342 + else /* standout */
1343 + p = highlight_has_attr(id, HL_STANDOUT, modec);
1347 @@ -16658,7 +16720,7 @@
1348 col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
1350 if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
1351 - && col >= 0 && col < (long)STRLEN(ml_get(lnum))
1352 + && col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum)))
1353 && rettv_list_alloc(rettv) != FAIL)
1355 (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
1356 @@ -18097,14 +18159,28 @@
1360 - * Set v:count, v:count1 and v:prevcount.
1361 + * Get List v: variable value. Caller must take care of reference count when
1365 +get_vim_var_list(idx)
1368 + return vimvars[idx].vv_list;
1372 + * Set v:count to "count" and v:count1 to "count1".
1373 + * When "set_prevcount" is TRUE first set v:prevcount from v:count.
1376 -set_vcount(count, count1)
1377 +set_vcount(count, count1, set_prevcount)
1380 + int set_prevcount;
1382 - vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
1383 + if (set_prevcount)
1384 + vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
1385 vimvars[VV_COUNT].vv_nr = count;
1386 vimvars[VV_COUNT1].vv_nr = count1;
1388 @@ -18132,6 +18208,20 @@
1392 + * Set List v: variable to "val".
1395 +set_vim_var_list(idx, val)
1399 + list_unref(vimvars[idx].vv_list);
1400 + vimvars[idx].vv_list = val;
1402 + ++val->lv_refcount;
1406 * Set v:register if needed.
1409 @@ -20590,6 +20680,9 @@
1412 todo = (int)func_hashtab.ht_used;
1414 + return; /* nothing to dump */
1416 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
1418 for (hi = func_hashtab.ht_array; todo > 0; ++hi)
1419 @@ -20638,6 +20731,8 @@
1421 prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
1424 + vim_free(sorttab);
1428 @@ -21082,8 +21177,11 @@
1429 init_var_dict(&fc.l_avars, &fc.l_avars_var);
1430 add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
1431 (varnumber_T)(argcount - fp->uf_args.ga_len));
1432 + /* Use "name" to avoid a warning from some compiler that checks the
1433 + * destination size. */
1434 v = &fc.fixvar[fixvar_idx++].var;
1435 - STRCPY(v->di_key, "000");
1437 + STRCPY(name, "000");
1438 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
1439 hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
1440 v->di_tv.v_type = VAR_LIST;
1441 @@ -21204,7 +21302,7 @@
1442 if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
1443 func_do_profile(fp);
1444 if (fp->uf_profiling
1445 - || (fc.caller != NULL && &fc.caller->func->uf_profiling))
1446 + || (fc.caller != NULL && fc.caller->func->uf_profiling))
1449 profile_start(&call_start);
1450 @@ -21235,13 +21333,13 @@
1453 if (do_profiling == PROF_YES && (fp->uf_profiling
1454 - || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
1455 + || (fc.caller != NULL && fc.caller->func->uf_profiling)))
1457 profile_end(&call_start);
1458 profile_sub_wait(&wait_start, &call_start);
1459 profile_add(&fp->uf_tm_total, &call_start);
1460 profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
1461 - if (fc.caller != NULL && &fc.caller->func->uf_profiling)
1462 + if (fc.caller != NULL && fc.caller->func->uf_profiling)
1464 profile_add(&fc.caller->func->uf_tm_children, &call_start);
1465 profile_add(&fc.caller->func->uf_tml_children, &call_start);
1466 @@ -21886,6 +21984,62 @@
1471 + * List v:oldfiles in a nice way.
1478 + list_T *l = vimvars[VV_OLDFILES].vv_list;
1483 + msg((char_u *)_("No old files"));
1487 + msg_scroll = TRUE;
1488 + for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
1490 + msg_outnum((long)++nr);
1492 + msg_outtrans(get_tv_string(&li->li_tv));
1493 + msg_putchar('\n');
1494 + out_flush(); /* output one line at a time */
1497 + /* Assume "got_int" was set to truncate the listing. */
1500 +#ifdef FEAT_BROWSE_CMD
1501 + if (cmdmod.browse)
1503 + quit_more = FALSE;
1504 + nr = prompt_for_number(FALSE);
1508 + char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
1513 + p = expand_env_save(p);
1515 + eap->cmdidx = CMD_edit;
1516 + cmdmod.browse = FALSE;
1517 + do_exedit(eap, NULL);
1526 #endif /* FEAT_EVAL */
1529 diff -Naur vim72.orig/src/ex_cmds2.c vim72/src/ex_cmds2.c
1530 --- vim72.orig/src/ex_cmds2.c 2008-07-13 17:18:22.000000000 +0100
1531 +++ vim72/src/ex_cmds2.c 2008-12-06 11:37:49.000000000 +0000
1532 @@ -2132,8 +2132,8 @@
1533 * argument index. */
1534 if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
1536 - (P_HID(curwin->w_buffer) ? ECMD_HIDE : 0) +
1537 - (eap->forceit ? ECMD_FORCEIT : 0)) == FAIL)
1538 + (P_HID(curwin->w_buffer) ? ECMD_HIDE : 0)
1539 + + (eap->forceit ? ECMD_FORCEIT : 0), curwin) == FAIL)
1540 curwin->w_arg_idx = old_arg_idx;
1541 /* like Vi: set the mark where the cursor is in the file. */
1542 else if (eap->cmdidx != CMD_argdo)
1543 @@ -3145,8 +3145,8 @@
1547 - vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname);
1548 - time_msg(IObuff, &tv_start);
1549 + vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
1550 + time_msg((char *)IObuff, &tv_start);
1554 diff -Naur vim72.orig/src/ex_cmds.c vim72/src/ex_cmds.c
1555 --- vim72.orig/src/ex_cmds.c 2008-08-04 20:15:00.000000000 +0100
1556 +++ vim72/src/ex_cmds.c 2008-12-06 11:37:50.000000000 +0000
1558 static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out));
1560 static char_u *viminfo_filename __ARGS((char_u *));
1561 -static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read));
1562 +static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags));
1563 static int viminfo_encoding __ARGS((vir_T *virp));
1564 static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing));
1566 @@ -1676,14 +1676,12 @@
1569 * read_viminfo() -- Read the viminfo file. Registers etc. which are already
1570 - * set are not over-written unless force is TRUE. -- webb
1571 + * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb
1574 -read_viminfo(file, want_info, want_marks, forceit)
1579 +read_viminfo(file, flags)
1580 + char_u *file; /* file name or NULL to use default name */
1581 + int flags; /* VIF_WANT_INFO et al. */
1585 @@ -1691,7 +1689,7 @@
1589 - fname = viminfo_filename(file); /* may set to default if NULL */
1590 + fname = viminfo_filename(file); /* get file name in allocated buffer */
1593 fp = mch_fopen((char *)fname, READBIN);
1594 @@ -1701,8 +1699,9 @@
1596 smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
1598 - want_info ? _(" info") : "",
1599 - want_marks ? _(" marks") : "",
1600 + (flags & VIF_WANT_INFO) ? _(" info") : "",
1601 + (flags & VIF_WANT_MARKS) ? _(" marks") : "",
1602 + (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "",
1603 fp == NULL ? _(" FAILED") : "");
1606 @@ -1712,10 +1711,9 @@
1610 - do_viminfo(fp, NULL, want_info, want_marks, forceit);
1611 + do_viminfo(fp, NULL, flags);
1618 @@ -1943,7 +1941,7 @@
1622 - (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
1623 + ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
1627 @@ -1968,7 +1966,7 @@
1631 - do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);
1632 + do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS));
1634 fclose(fp_out); /* errors are ignored !? */
1636 @@ -2041,12 +2039,10 @@
1637 * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
1640 -do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
1641 +do_viminfo(fp_in, fp_out, flags)
1651 @@ -2061,8 +2057,9 @@
1656 - eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL);
1657 + if (flags & VIF_WANT_INFO)
1658 + eof = read_viminfo_up_to_marks(&vir,
1659 + flags & VIF_FORCEIT, fp_out != NULL);
1661 /* Skip info, find start of marks */
1662 while (!(eof = viminfo_readline(&vir))
1663 @@ -2092,8 +2089,9 @@
1664 write_viminfo_bufferlist(fp_out);
1665 count = write_viminfo_marks(fp_out);
1667 - if (fp_in != NULL && want_marks)
1668 - copy_viminfo_marks(&vir, fp_out, count, eof);
1670 + && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
1671 + copy_viminfo_marks(&vir, fp_out, count, eof, flags);
1673 vim_free(vir.vir_line);
1675 @@ -3054,7 +3052,8 @@
1676 retval = 0; /* it's in the same file */
1678 else if (do_ecmd(fnum, ffname, sfname, NULL, lnum,
1679 - (P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0)) == OK)
1680 + (P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0),
1682 retval = -1; /* opened another file */
1684 retval = 1; /* error encountered */
1685 @@ -3087,17 +3086,21 @@
1686 * ECMD_OLDBUF: use existing buffer if it exists
1687 * ECMD_FORCEIT: ! used for Ex command
1688 * ECMD_ADDBUF: don't edit, just add to buffer list
1689 + * oldwin: Should be "curwin" when editing a new buffer in the current
1690 + * window, NULL when splitting the window first. When not NULL info
1691 + * of the previous buffer for "oldwin" is stored.
1693 * return FAIL for failure, OK otherwise
1696 -do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
1697 +do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
1701 exarg_T *eap; /* can be NULL! */
1706 int other_file; /* TRUE if editing another file */
1707 int oldbuf; /* TRUE if using existing buffer */
1708 @@ -3269,7 +3272,8 @@
1710 if (!cmdmod.keepalt)
1711 curwin->w_alt_fnum = curbuf->b_fnum;
1712 - buflist_altfpos();
1713 + if (oldwin != NULL)
1714 + buflist_altfpos(oldwin);
1718 @@ -3373,7 +3377,7 @@
1720 /* close the link to the current buffer */
1722 - close_buffer(curwin, curbuf,
1723 + close_buffer(oldwin, curbuf,
1724 (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD);
1727 @@ -5059,6 +5063,7 @@
1731 + vim_free(new_start); /* for when substitute was cancelled */
1732 vim_free(sub_firstline); /* free the copy of the original line */
1733 sub_firstline = NULL;
1735 @@ -5610,7 +5615,13 @@
1737 alt_fnum = curbuf->b_fnum;
1738 (void)do_ecmd(0, NULL, NULL, NULL, ECMD_LASTL,
1739 - ECMD_HIDE + ECMD_SET_HELP);
1740 + ECMD_HIDE + ECMD_SET_HELP,
1741 +#ifdef FEAT_WINDOWS
1742 + NULL /* buffer is still open, don't store info */
1747 if (!cmdmod.keepalt)
1748 curwin->w_alt_fnum = alt_fnum;
1749 empty_fnum = curbuf->b_fnum;
1750 diff -Naur vim72.orig/src/ex_cmds.h vim72/src/ex_cmds.h
1751 --- vim72.orig/src/ex_cmds.h 2008-06-21 19:47:57.000000000 +0100
1752 +++ vim72/src/ex_cmds.h 2008-12-06 11:37:49.000000000 +0000
1754 EX(CMD_crewind, "crewind", ex_cc,
1755 RANGE|NOTADR|COUNT|TRLBAR|BANG),
1756 EX(CMD_cscope, "cscope", do_cscope,
1757 - EXTRA|NOTRLCOM|SBOXOK|XFILE),
1758 + EXTRA|NOTRLCOM|XFILE),
1759 EX(CMD_cstag, "cstag", do_cstag,
1761 EX(CMD_cunmap, "cunmap", ex_unmap,
1763 EX(CMD_lclose, "lclose", ex_cclose,
1764 RANGE|NOTADR|COUNT|TRLBAR),
1765 EX(CMD_lcscope, "lcscope", do_cscope,
1766 - EXTRA|NOTRLCOM|SBOXOK|XFILE),
1767 + EXTRA|NOTRLCOM|XFILE),
1768 EX(CMD_left, "left", ex_align,
1769 TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
1770 EX(CMD_leftabove, "leftabove", ex_wrongmodifier,
1772 RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
1773 EX(CMD_noremap, "noremap", ex_map,
1774 BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
1775 +EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier,
1776 + NEEDARG|EXTRA|NOTRLCOM),
1777 EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch,
1778 TRLBAR|SBOXOK|CMDWIN),
1779 EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate,
1781 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
1782 EX(CMD_open, "open", ex_open,
1784 +EX(CMD_oldfiles, "oldfiles", ex_oldfiles,
1785 + BANG|TRLBAR|SBOXOK|CMDWIN),
1786 EX(CMD_omap, "omap", ex_map,
1787 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
1788 EX(CMD_omapclear, "omapclear", ex_mapclear,
1790 EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
1791 WORD1|TRLBAR|CMDWIN),
1792 EX(CMD_scscope, "scscope", do_scscope,
1793 - EXTRA|NOTRLCOM|SBOXOK),
1795 EX(CMD_set, "set", ex_set,
1796 TRLBAR|EXTRA|CMDWIN|SBOXOK),
1797 EX(CMD_setfiletype, "setfiletype", ex_setfiletype,
1798 diff -Naur vim72.orig/src/ex_docmd.c vim72/src/ex_docmd.c
1799 --- vim72.orig/src/ex_docmd.c 2008-07-26 12:51:05.000000000 +0100
1800 +++ vim72/src/ex_docmd.c 2008-12-06 11:37:50.000000000 +0000
1802 # define ex_function ex_ni
1803 # define ex_delfunction ex_ni
1804 # define ex_return ex_ni
1805 +# define ex_oldfiles ex_ni
1807 static char_u *arg_all __ARGS((void));
1809 @@ -1770,7 +1771,7 @@
1811 if (checkforcmd(&ea.cmd, "browse", 3))
1814 +#ifdef FEAT_BROWSE_CMD
1815 cmdmod.browse = TRUE;
1818 @@ -2978,6 +2979,7 @@
1819 {"keepmarks", 3, FALSE},
1820 {"leftabove", 5, FALSE},
1821 {"lockmarks", 3, FALSE},
1822 + {"noautocmd", 3, FALSE},
1823 {"rightbelow", 6, FALSE},
1824 {"sandbox", 3, FALSE},
1825 {"silent", 3, FALSE},
1826 @@ -3608,6 +3610,7 @@
1827 return set_context_in_autocmd(xp, arg, FALSE);
1830 + case CMD_doautoall:
1831 return set_context_in_autocmd(xp, arg, TRUE);
1834 @@ -7485,7 +7488,8 @@
1835 /* ":new" or ":tabnew" without argument: edit an new empty buffer */
1837 (void)do_ecmd(0, NULL, NULL, eap, ECMD_ONE,
1838 - ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0));
1839 + ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0),
1840 + old_curwin == NULL ? curwin : NULL);
1842 else if ((eap->cmdidx != CMD_split
1843 #ifdef FEAT_VERTSPLIT
1844 @@ -7522,7 +7526,7 @@
1845 #ifdef FEAT_LISTCMDS
1846 + (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 )
1849 + , old_curwin == NULL ? curwin : NULL) == FAIL)
1851 /* Editing the file failed. If the window was split, close it. */
1853 @@ -8749,8 +8753,8 @@
1854 else if (*dirnow != NUL
1855 && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
1857 - (void)mch_chdir((char *)globaldir);
1858 - shorten_fnames(TRUE);
1859 + if (mch_chdir((char *)globaldir) == OK)
1860 + shorten_fnames(TRUE);
1863 failed |= (makeopens(fd, dirnow) == FAIL);
1864 @@ -9506,24 +9510,50 @@
1868 + if (*s == '<') /* "#<99" uses v:oldfiles */
1870 i = (int)getdigits(&s);
1871 *usedlen = (int)(s - src); /* length of what we expand */
1873 - buf = buflist_findnr(i);
1875 + if (src[1] == '<')
1877 - *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
1880 + /* Should we give an error message for #<text? */
1885 + result = list_find_str(get_vim_var_list(VV_OLDFILES),
1887 + if (result == NULL)
1889 + *errormsg = (char_u *)"";
1893 + *errormsg = (char_u *)_("E809: #< is not available without the +eval feature");
1897 - if (lnump != NULL)
1898 - *lnump = ECMD_LAST;
1899 - if (buf->b_fname == NULL)
1902 - result = (char_u *)"";
1903 - valid = 0; /* Must have ":p:h" to be valid */
1904 + buf = buflist_findnr(i);
1907 + *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
1910 + if (lnump != NULL)
1911 + *lnump = ECMD_LAST;
1912 + if (buf->b_fname == NULL)
1914 + result = (char_u *)"";
1915 + valid = 0; /* Must have ":p:h" to be valid */
1918 + result = buf->b_fname;
1921 - result = buf->b_fname;
1924 #ifdef FEAT_SEARCHPATH
1925 @@ -9541,6 +9571,15 @@
1927 case SPEC_AFILE: /* file name for autocommand */
1928 result = autocmd_fname;
1929 + if (result != NULL && !autocmd_fname_full)
1931 + /* Still need to turn the fname into a full path. It is
1932 + * postponed to avoid a delay when <afile> is not used. */
1933 + autocmd_fname_full = TRUE;
1934 + result = FullName_save(autocmd_fname, FALSE);
1935 + vim_free(autocmd_fname);
1936 + autocmd_fname = result;
1940 *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
1941 @@ -10689,7 +10728,8 @@
1942 p_viminfo = (char_u *)"'100";
1943 if (eap->cmdidx == CMD_rviminfo)
1945 - if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL)
1946 + if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS
1947 + | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL)
1948 EMSG(_("E195: Cannot open viminfo file for reading"));
1951 diff -Naur vim72.orig/src/ex_getln.c vim72/src/ex_getln.c
1952 --- vim72.orig/src/ex_getln.c 2008-08-08 10:31:33.000000000 +0100
1953 +++ vim72/src/ex_getln.c 2008-12-06 11:37:50.000000000 +0000
1955 int cmdattr; /* attributes for prompt */
1956 int overstrike; /* Typing mode on the command line. Shared by
1957 getcmdline() and put_on_cmdline(). */
1958 + expand_T *xpc; /* struct being used for expansion, xp_pattern
1959 + may point into cmdbuff */
1960 int xp_context; /* type of expansion */
1962 char_u *xp_arg; /* user-defined expansion arg */
1967 -static struct cmdline_info ccline; /* current cmdline_info */
1968 +/* The current cmdline_info. It is initialized in getcmdline() and after that
1969 + * used by other functions. When invoking getcmdline() recursively it needs
1970 + * to be saved with save_cmdline() and restored with restore_cmdline().
1971 + * TODO: make it local to getcmdline() and pass it around. */
1972 +static struct cmdline_info ccline;
1974 static int cmd_showtail; /* Only show path tail in lists ? */
1980 + ccline.xpc = &xpc;
1982 #ifdef FEAT_RIGHTLEFT
1983 if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
1984 @@ -408,9 +415,10 @@
1988 - * <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>).
1989 + * When there are matching completions to select <S-Tab> works like
1990 + * CTRL-P (unless 'wc' is <S-Tab>).
1992 - if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)
1993 + if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
1996 #ifdef FEAT_WILDMENU
1997 @@ -1513,6 +1521,7 @@
2000 vim_free(ccline.cmdbuff);
2001 + xpc.xp_context = EXPAND_NOTHING;
2002 if (hiscnt == hislen)
2003 p = lookfor; /* back to the old one */
2005 @@ -1839,6 +1848,7 @@
2008 ExpandCleanup(&xpc);
2009 + ccline.xpc = NULL;
2011 #ifdef FEAT_SEARCH_EXTRA
2013 @@ -2508,6 +2518,20 @@
2015 mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
2018 + if (ccline.xpc != NULL
2019 + && ccline.xpc->xp_pattern != NULL
2020 + && ccline.xpc->xp_context != EXPAND_NOTHING
2021 + && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
2023 + int i = (int)(ccline.xpc->xp_pattern - p);
2025 + /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
2026 + * to point into the newly allocated memory. */
2027 + if (i >= 0 && i <= ccline.cmdlen)
2028 + ccline.xpc->xp_pattern = ccline.cmdbuff + i;
2034 @@ -2875,6 +2899,7 @@
2035 prev_ccline = ccline;
2036 ccline.cmdbuff = NULL;
2037 ccline.cmdprompt = NULL;
2038 + ccline.xpc = NULL;
2042 @@ -3582,6 +3607,7 @@
2046 + xp->xp_pattern = NULL;
2047 xp->xp_backslash = XP_BS_NONE;
2048 #ifndef BACKSLASH_IN_FILENAME
2049 xp->xp_shell = FALSE;
2050 @@ -4871,7 +4897,7 @@
2053 sprintf((char *)s, "%s/%s*.vim", dirname, pat);
2054 - all = globpath(p_rtp, s);
2055 + all = globpath(p_rtp, s, 0);
2059 @@ -4912,9 +4938,10 @@
2060 * newlines. Returns NULL for an error or no matches.
2063 -globpath(path, file)
2064 +globpath(path, file, expand_options)
2067 + int expand_options;
2071 @@ -4943,10 +4970,10 @@
2075 - if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
2077 + if (ExpandFromContext(&xpc, buf, &num_p, &p,
2078 + WILD_SILENT|expand_options) != FAIL && num_p > 0)
2080 - ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
2081 + ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
2082 for (len = 0, i = 0; i < num_p; ++i)
2083 len += (int)STRLEN(p[i]) + 1;
2085 @@ -6025,7 +6052,7 @@
2088 /* Create the command-line buffer empty. */
2089 - (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE);
2090 + (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
2091 (void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE);
2092 set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
2093 set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
2094 diff -Naur vim72.orig/src/feature.h vim72/src/feature.h
2095 --- vim72.orig/src/feature.h 2008-08-06 12:00:39.000000000 +0100
2096 +++ vim72/src/feature.h 2008-12-06 11:37:49.000000000 +0000
2097 @@ -767,9 +767,13 @@
2100 * +browse ":browse" command.
2101 + * or just the ":browse" command modifier
2103 -#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))
2104 -# define FEAT_BROWSE
2105 +#if defined(FEAT_NORMAL)
2106 +# define FEAT_BROWSE_CMD
2107 +# 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)
2108 +# define FEAT_BROWSE
2113 diff -Naur vim72.orig/src/fileio.c vim72/src/fileio.c
2114 --- vim72.orig/src/fileio.c 2008-08-06 12:01:03.000000000 +0100
2115 +++ vim72/src/fileio.c 2008-12-06 11:37:50.000000000 +0000
2116 @@ -932,7 +932,10 @@
2119 if (eap != NULL && eap->force_ff != 0)
2121 fileformat = get_fileformat_force(curbuf, eap);
2122 + try_unix = try_dos = try_mac = FALSE;
2124 else if (curbuf->b_p_bin)
2125 fileformat = EOL_UNIX; /* binary: use Unix format */
2126 else if (*p_ffs == NUL)
2127 @@ -2211,7 +2214,7 @@
2129 /* Use stderr for stdin, makes shell commands work. */
2136 @@ -2341,11 +2344,6 @@
2137 STRCAT(IObuff, _("[CR missing]"));
2140 - if (ff_error == EOL_MAC)
2142 - STRCAT(IObuff, _("[NL found]"));
2147 STRCAT(IObuff, _("[long lines split]"));
2148 @@ -2711,7 +2709,7 @@
2150 if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
2151 && curbuf->b_ffname != NULL)
2152 - read_viminfo(NULL, FALSE, TRUE, FALSE);
2153 + read_viminfo(NULL, VIF_WANT_MARKS);
2155 /* Always set b_marks_read; needed when 'viminfo' is changed to include
2156 * the ' parameter after opening a buffer. */
2157 @@ -3451,7 +3449,7 @@
2161 - fchown(fd, st_old.st_uid, st_old.st_gid);
2162 + ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
2164 if (mch_stat((char *)IObuff, &st) < 0
2165 || st.st_uid != st_old.st_uid
2166 @@ -4367,7 +4365,7 @@
2167 || st.st_uid != st_old.st_uid
2168 || st.st_gid != st_old.st_gid)
2170 - fchown(fd, st_old.st_uid, st_old.st_gid);
2171 + ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
2172 if (perm >= 0) /* set permission again, may have changed */
2173 (void)mch_setperm(wfname, perm);
2175 @@ -5550,9 +5548,10 @@
2176 name = "ucs-4le"; /* FF FE 00 00 */
2179 - else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L))
2180 + else if (flags == (FIO_UCS2 | FIO_ENDIAN_L))
2181 name = "ucs-2le"; /* FF FE */
2182 - else if (flags == (FIO_UTF16 | FIO_ENDIAN_L))
2183 + else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L))
2184 + /* utf-16le is preferred, it also works for ucs-2le text */
2185 name = "utf-16le"; /* FF FE */
2187 else if (p[0] == 0xfe && p[1] == 0xff
2188 @@ -6031,9 +6030,9 @@
2190 tbuf[FGETS_SIZE - 2] = NUL;
2192 - fgets_cr((char *)tbuf, FGETS_SIZE, fp);
2193 + ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
2195 - fgets((char *)tbuf, FGETS_SIZE, fp);
2196 + ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
2198 } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
2200 @@ -8523,6 +8522,7 @@
2201 char_u *save_sourcing_name;
2202 linenr_T save_sourcing_lnum;
2203 char_u *save_autocmd_fname;
2204 + int save_autocmd_fname_full;
2205 int save_autocmd_bufnr;
2206 char_u *save_autocmd_match;
2207 int save_autocmd_busy;
2208 @@ -8601,6 +8601,7 @@
2209 * Save the autocmd_* variables and info about the current buffer.
2211 save_autocmd_fname = autocmd_fname;
2212 + save_autocmd_fname_full = autocmd_fname_full;
2213 save_autocmd_bufnr = autocmd_bufnr;
2214 save_autocmd_match = autocmd_match;
2215 save_autocmd_busy = autocmd_busy;
2216 @@ -8618,14 +8619,15 @@
2217 if (fname != NULL && *fname != NUL)
2218 autocmd_fname = fname;
2219 else if (buf != NULL)
2220 - autocmd_fname = buf->b_fname;
2221 + autocmd_fname = buf->b_ffname;
2223 autocmd_fname = NULL;
2226 autocmd_fname = fname_io;
2227 if (autocmd_fname != NULL)
2228 - autocmd_fname = FullName_save(autocmd_fname, FALSE);
2229 + autocmd_fname = vim_strsave(autocmd_fname);
2230 + autocmd_fname_full = FALSE; /* call FullName_save() later */
2233 * Set the buffer number to be used for <abuf>.
2234 @@ -8810,6 +8812,7 @@
2235 sourcing_lnum = save_sourcing_lnum;
2236 vim_free(autocmd_fname);
2237 autocmd_fname = save_autocmd_fname;
2238 + autocmd_fname_full = save_autocmd_fname_full;
2239 autocmd_bufnr = save_autocmd_bufnr;
2240 autocmd_match = save_autocmd_match;
2242 @@ -8918,7 +8921,7 @@
2246 - /* only use a pattern when it has not been removed, has commands and
2247 + /* Only use a pattern when it has not been removed, has commands and
2248 * the group matches. For buffer-local autocommands only check the
2250 if (ap->pat != NULL && ap->cmds != NULL
2251 @@ -9104,7 +9107,7 @@
2252 set_context_in_autocmd(xp, arg, doautocmd)
2255 - int doautocmd; /* TRUE for :doautocmd, FALSE for :autocmd */
2256 + int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */
2260 diff -Naur vim72.orig/src/fold.c vim72/src/fold.c
2261 --- vim72.orig/src/fold.c 2008-08-06 12:01:12.000000000 +0100
2262 +++ vim72/src/fold.c 2008-12-06 11:37:50.000000000 +0000
2264 static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp));
2265 static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum));
2266 static void checkupdate __ARGS((win_T *wp));
2267 -static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open));
2268 +static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open));
2269 static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep));
2270 static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep));
2271 static void foldOpenNested __ARGS((fold_T *fpr));
2272 @@ -1241,10 +1241,10 @@
2273 * Repeat "count" times.
2276 -setFoldRepeat(lnum, count, open)
2277 +setFoldRepeat(lnum, count, do_open)
2285 @@ -1252,7 +1252,7 @@
2286 for (n = 0; n < count; ++n)
2288 done = DONE_NOTHING;
2289 - (void)setManualFold(lnum, open, FALSE, &done);
2290 + (void)setManualFold(lnum, do_open, FALSE, &done);
2291 if (!(done & DONE_ACTION))
2293 /* Only give an error message when no fold could be opened. */
2294 diff -Naur vim72.orig/src/getchar.c vim72/src/getchar.c
2295 --- vim72.orig/src/getchar.c 2008-07-22 17:57:48.000000000 +0100
2296 +++ vim72/src/getchar.c 2008-12-06 11:37:50.000000000 +0000
2297 @@ -4702,7 +4702,7 @@
2299 if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0)
2301 - if (fprintf(fd, cmd) < 0)
2302 + if (fputs(cmd, fd) < 0)
2304 if (buf != NULL && fputs(" <buffer>", fd) < 0)
2306 @@ -4801,7 +4801,7 @@
2308 if (IS_SPECIAL(c) || modifiers) /* special key */
2310 - if (fprintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)
2311 + if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0)
2315 diff -Naur vim72.orig/src/globals.h vim72/src/globals.h
2316 --- vim72.orig/src/globals.h 2008-07-26 12:53:29.000000000 +0100
2317 +++ vim72/src/globals.h 2008-12-06 11:37:50.000000000 +0000
2318 @@ -1022,6 +1022,7 @@
2321 EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
2322 +EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
2323 EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
2324 EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
2325 EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
2326 @@ -1548,6 +1549,14 @@
2327 EXTERN time_t starttime;
2330 + * Some compilers warn for not using a return value, but in some situations we
2331 + * can't do anything useful with the value. Assign to this variable to avoid
2334 +EXTERN int ignored;
2335 +EXTERN char *ignoredp;
2338 * Optional Farsi support. Include it here, so EXTERN and INIT are defined.
2341 diff -Naur vim72.orig/src/gui_at_sb.c vim72/src/gui_at_sb.c
2342 --- vim72.orig/src/gui_at_sb.c 2004-06-07 15:32:25.000000000 +0100
2343 +++ vim72/src/gui_at_sb.c 2008-12-06 11:37:50.000000000 +0000
2344 @@ -1078,6 +1078,12 @@
2345 Cardinal *num_params; /* unused */
2347 ScrollbarWidget sbw = (ScrollbarWidget)w;
2348 + /* Use a union to avoid a warning for the weird conversion from float to
2349 + * XtPointer. Comes from Xaw/Scrollbar.c. */
2355 if (LookAhead(w, event))
2357 @@ -1085,7 +1091,8 @@
2358 /* thumbProc is not pretty, but is necessary for backwards
2359 compatibility on those architectures for which it work{s,ed};
2360 the intent is to pass a (truncated) float by value. */
2361 - XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top);
2362 + xtpf.xtf = sbw->scrollbar.top;
2363 + XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
2364 XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
2367 diff -Naur vim72.orig/src/gui.c vim72/src/gui.c
2368 --- vim72.orig/src/gui.c 2008-07-27 20:32:14.000000000 +0100
2369 +++ vim72/src/gui.c 2008-12-06 11:37:50.000000000 +0000
2371 /* The read returns when the child closes the pipe (or when
2372 * the child dies for some reason). */
2374 - (void)read(pipefd[0], &dummy, (size_t)1);
2375 + ignored = (int)read(pipefd[0], &dummy, (size_t)1);
2379 @@ -3241,7 +3241,7 @@
2381 gui_update_tabline();
2383 - need_set_size = RESIZE_VERT;
2384 + need_set_size |= RESIZE_VERT;
2387 if (!gui_use_tabline())
2388 @@ -3275,9 +3275,9 @@
2389 if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
2391 if (i == SBAR_BOTTOM)
2392 - need_set_size = RESIZE_VERT;
2393 + need_set_size |= RESIZE_VERT;
2395 - need_set_size = RESIZE_HOR;
2396 + need_set_size |= RESIZE_HOR;
2397 if (gui.which_scrollbars[i])
2400 @@ -3297,7 +3297,7 @@
2401 gui_mch_enable_menu(gui.menu_is_active);
2403 prev_menu_is_active = gui.menu_is_active;
2404 - need_set_size = RESIZE_VERT;
2405 + need_set_size |= RESIZE_VERT;
2406 if (gui.menu_is_active)
2409 @@ -3308,7 +3308,7 @@
2411 gui_mch_show_toolbar(using_toolbar);
2412 prev_toolbar = using_toolbar;
2413 - need_set_size = RESIZE_VERT;
2414 + need_set_size |= RESIZE_VERT;
2418 @@ -3318,7 +3318,7 @@
2420 gui_mch_enable_footer(using_footer);
2421 prev_footer = using_footer;
2422 - need_set_size = RESIZE_VERT;
2423 + need_set_size |= RESIZE_VERT;
2427 @@ -3330,10 +3330,11 @@
2428 prev_tearoff = using_tearoff;
2431 - if (need_set_size)
2432 + if (need_set_size != 0)
2436 + long prev_Columns = Columns;
2437 + long prev_Rows = Rows;
2439 /* Adjust the size of the window to make the text area keep the
2440 * same size and to avoid that part of our window is off-screen
2441 @@ -3349,11 +3350,14 @@
2442 * If you remove this, please test this command for resizing
2443 * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
2444 * Don't do this while starting up though.
2445 - * And don't change Rows, it may have be reduced intentionally
2446 - * when adding menu/toolbar/tabline. */
2447 - if (!gui.starting)
2448 + * Don't change Rows when adding menu/toolbar/tabline.
2449 + * Don't change Columns when adding vertical toolbar. */
2450 + if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
2453 + if ((need_set_size & RESIZE_VERT) == 0)
2455 + if ((need_set_size & RESIZE_HOR) == 0)
2456 + Columns = prev_Columns;
2460 diff -Naur vim72.orig/src/gui_gtk_x11.c vim72/src/gui_gtk_x11.c
2461 --- vim72.orig/src/gui_gtk_x11.c 2008-07-04 11:46:24.000000000 +0100
2462 +++ vim72/src/gui_gtk_x11.c 2008-12-06 11:37:50.000000000 +0000
2463 @@ -4070,14 +4070,14 @@
2465 if (mask & (XValue | YValue))
2468 - gui_mch_get_screen_dimensions(&w, &h);
2469 - h += p_ghr + get_menu_tool_height();
2470 - w += get_menu_tool_width();
2472 + gui_mch_get_screen_dimensions(&ww, &hh);
2473 + hh += p_ghr + get_menu_tool_height();
2474 + ww += get_menu_tool_width();
2475 if (mask & XNegative)
2476 - x += w - pixel_width;
2477 + x += ww - pixel_width;
2478 if (mask & YNegative)
2479 - y += h - pixel_height;
2480 + y += hh - pixel_height;
2482 gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
2484 diff -Naur vim72.orig/src/gui_x11.c vim72/src/gui_x11.c
2485 --- vim72.orig/src/gui_x11.c 2008-06-08 16:13:45.000000000 +0100
2486 +++ vim72/src/gui_x11.c 2008-12-06 11:37:49.000000000 +0000
2487 @@ -2450,7 +2450,7 @@
2488 *colorPtr = colortable[closest];
2492 + vim_free(colortable);
2496 diff -Naur vim72.orig/src/gui_xmdlg.c vim72/src/gui_xmdlg.c
2497 --- vim72.orig/src/gui_xmdlg.c 2008-06-21 17:05:32.000000000 +0100
2498 +++ vim72/src/gui_xmdlg.c 2008-12-06 11:37:50.000000000 +0000
2499 @@ -369,10 +369,10 @@
2500 char buf[TEMP_BUF_SIZE];
2501 XmString items[MAX_ENTRIES_IN_LIST];
2506 - for (index = (int)ENCODING; index < (int)NONE; ++index)
2508 + for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
2511 /* First we insert the wild char into every single list. */
2512 if (fix != ENCODING)
2513 @@ -503,14 +503,14 @@
2515 * Now loop trough the remaining lists and set them up.
2517 - for (index = (int)NAME; index < (int)NONE; ++index)
2518 + for (idx = (int)NAME; idx < (int)NONE; ++idx)
2522 - if (fix == (enum ListSpecifier)index)
2523 + if (fix == (enum ListSpecifier)idx)
2526 - switch ((enum ListSpecifier)index)
2527 + switch ((enum ListSpecifier)idx)
2530 w = data->list[NAME];
2531 @@ -525,21 +525,21 @@
2532 w = (Widget)0; /* for lint */
2535 - for (i = 0; i < count[index]; ++i)
2536 + for (i = 0; i < count[idx]; ++i)
2538 - items[i] = XmStringCreateLocalized(list[index][i]);
2539 - XtFree(list[index][i]);
2540 + items[i] = XmStringCreateLocalized(list[idx][i]);
2541 + XtFree(list[idx][i]);
2543 XmListDeleteAllItems(w);
2544 - XmListAddItems(w, items, count[index], 1);
2545 - if (data->sel[index])
2546 + XmListAddItems(w, items, count[idx], 1);
2547 + if (data->sel[idx])
2549 XmStringFree(items[0]);
2550 - items[0] = XmStringCreateLocalized(data->sel[index]);
2551 + items[0] = XmStringCreateLocalized(data->sel[idx]);
2552 XmListSelectItem(w, items[0], False);
2553 XmListSetBottomItem(w, items[0]);
2555 - for (i = 0; i < count[index]; ++i)
2556 + for (i = 0; i < count[idx]; ++i)
2557 XmStringFree(items[i]);
2560 @@ -695,14 +695,14 @@
2564 - char *msg = _("no specific match");
2565 + char *nomatch_msg = _("no specific match");
2568 - str = XmStringCreateLocalized(msg);
2569 + str = XmStringCreateLocalized(nomatch_msg);
2570 XtSetArg(args[n], XmNlabelString, str); ++n;
2571 XtSetValues(data->sample, args, n);
2572 apply_fontlist(data->sample);
2573 - XmTextSetString(data->name, msg);
2574 + XmTextSetString(data->name, nomatch_msg);
2578 @@ -886,21 +886,21 @@
2588 for (i = 0, max = 0; i < data->num; i++)
2590 - get_part(fn(data, i), 7, str);
2592 + get_part(fn(data, i), 7, buf);
2594 if ((size > max) && (size < MAX_DISPLAY_SIZE))
2601 - strcpy(big_font, fn(data, index));
2602 + strcpy(big_font, fn(data, idx));
2604 data->old = XLoadQueryFont(XtDisplay(parent), big_font);
2605 data->old_list = gui_motif_create_fontlist(data->old);
2606 @@ -1217,28 +1217,28 @@
2610 - char name[TEMP_BUF_SIZE];
2611 - char style[TEMP_BUF_SIZE];
2612 - char size[TEMP_BUF_SIZE];
2613 - char encoding[TEMP_BUF_SIZE];
2614 + char namebuf[TEMP_BUF_SIZE];
2615 + char stylebuf[TEMP_BUF_SIZE];
2616 + char sizebuf[TEMP_BUF_SIZE];
2617 + char encodingbuf[TEMP_BUF_SIZE];
2622 - name_part(found, name);
2623 - style_part(found, style);
2624 - size_part(found, size, data->in_pixels);
2625 - encoding_part(found, encoding);
2627 - if (strlen(name) > 0
2628 - && strlen(style) > 0
2629 - && strlen(size) > 0
2630 - && strlen(encoding) > 0)
2631 + name_part(found, namebuf);
2632 + style_part(found, stylebuf);
2633 + size_part(found, sizebuf, data->in_pixels);
2634 + encoding_part(found, encodingbuf);
2636 + if (strlen(namebuf) > 0
2637 + && strlen(stylebuf) > 0
2638 + && strlen(sizebuf) > 0
2639 + && strlen(encodingbuf) > 0)
2641 - data->sel[NAME] = XtNewString(name);
2642 - data->sel[STYLE] = XtNewString(style);
2643 - data->sel[SIZE] = XtNewString(size);
2644 - data->sel[ENCODING] = XtNewString(encoding);
2645 + data->sel[NAME] = XtNewString(namebuf);
2646 + data->sel[STYLE] = XtNewString(stylebuf);
2647 + data->sel[SIZE] = XtNewString(sizebuf);
2648 + data->sel[ENCODING] = XtNewString(encodingbuf);
2649 data->font_name = XtNewString(names[0]);
2650 display_sample(data);
2651 XmTextSetString(data->name, data->font_name);
2652 diff -Naur vim72.orig/src/gui_xmebw.c vim72/src/gui_xmebw.c
2653 --- vim72.orig/src/gui_xmebw.c 2007-09-06 11:57:51.000000000 +0100
2654 +++ vim72/src/gui_xmebw.c 2008-12-06 11:37:50.000000000 +0000
2655 @@ -1256,7 +1256,7 @@
2662 #if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
2664 @@ -1268,12 +1268,11 @@
2666 case XmEXTERNAL_HIGHLIGHT:
2667 adjust = (eb->primitive.highlight_thickness -
2668 - (eb->pushbutton.default_button_shadow_thickness ?
2669 - Xm3D_ENHANCE_PIXEL : 0));
2670 + (eb->pushbutton.default_button_shadow_thickness
2671 + ? Xm3D_ENHANCE_PIXEL : 0));
2674 case XmINTERNAL_HIGHLIGHT:
2679 diff -Naur vim72.orig/src/if_cscope.c vim72/src/if_cscope.c
2680 --- vim72.orig/src/if_cscope.c 2008-06-24 17:32:34.000000000 +0100
2681 +++ vim72/src/if_cscope.c 2008-12-06 11:37:48.000000000 +0000
2684 N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 },
2686 - N_("Query for a pattern"), FIND_USAGE, 1 },
2687 + N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 },
2689 N_("Show this message"), "help", 0 },
2691 @@ -1180,7 +1180,16 @@
2692 (void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
2693 cmdp->name, _(cmdp->help), cmdp->usage);
2694 if (strcmp(cmdp->name, "find") == 0)
2695 - MSG_PUTS(FIND_HELP);
2697 + " c: Find functions calling this function\n"
2698 + " d: Find functions called by this function\n"
2699 + " e: Find this egrep pattern\n"
2700 + " f: Find this file\n"
2701 + " g: Find this definition\n"
2702 + " i: Find files #including this file\n"
2703 + " s: Find this C symbol\n"
2704 + " t: Find assignments to\n"));
2709 diff -Naur vim72.orig/src/if_cscope.h vim72/src/if_cscope.h
2710 --- vim72.orig/src/if_cscope.h 2007-09-02 15:51:08.000000000 +0100
2711 +++ vim72/src/if_cscope.h 2008-12-06 11:37:48.000000000 +0000
2713 * f 7name Find this file
2714 * i 8name Find files #including this file
2716 -#define FIND_USAGE "find c|d|e|f|g|i|s|t name"
2717 -#define FIND_HELP "\n\
2718 - c: Find functions calling this function\n\
2719 - d: Find functions called by this function\n\
2720 - e: Find this egrep pattern\n\
2721 - f: Find this file\n\
2722 - g: Find this definition\n\
2723 - i: Find files #including this file\n\
2724 - s: Find this C symbol\n\
2725 - t: Find assignments to\n"
2730 diff -Naur vim72.orig/src/if_perl.xs vim72/src/if_perl.xs
2731 --- vim72.orig/src/if_perl.xs 2008-07-17 21:55:09.000000000 +0100
2732 +++ vim72/src/if_perl.xs 2008-12-06 11:37:50.000000000 +0000
2734 # define Perl_newXS_flags dll_Perl_newXS_flags
2736 # define Perl_sv_free dll_Perl_sv_free
2737 +# if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
2738 +# define Perl_sv_free2 dll_Perl_sv_free2
2740 # define Perl_sv_isa dll_Perl_sv_isa
2741 # define Perl_sv_magic dll_Perl_sv_magic
2742 # define Perl_sv_setiv dll_Perl_sv_setiv
2744 # define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr
2745 # define boot_DynaLoader dll_boot_DynaLoader
2747 -# define Perl_sys_init3 dll_Perl_sys_init3
2748 +# define Perl_sys_init dll_Perl_sys_init
2749 # define Perl_sys_term dll_Perl_sys_term
2750 # define Perl_ISv_ptr dll_Perl_ISv_ptr
2751 # define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr
2753 static void (*boot_DynaLoader)_((pTHX_ CV*));
2755 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
2756 -static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
2757 +static void (*Perl_sv_free2)(pTHX_ SV*);
2758 +static void (*Perl_sys_init)(int* argc, char*** argv);
2759 static void (*Perl_sys_term)(void);
2760 static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
2761 static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*);
2763 {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr},
2764 {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
2766 - {"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
2767 + {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
2768 + {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init},
2769 {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
2770 {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
2771 {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr},
2773 static char *argv[] = { "", "-e", "" };
2775 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
2776 - Perl_sys_init3(&argc, (char***)&argv, NULL);
2777 + Perl_sys_init(&argc, (char***)&argv);
2779 perl_interp = perl_alloc();
2780 perl_construct(perl_interp);
2781 diff -Naur vim72.orig/src/if_python.c vim72/src/if_python.c
2782 --- vim72.orig/src/if_python.c 2008-07-17 22:09:32.000000000 +0100
2783 +++ vim72/src/if_python.c 2008-12-06 11:37:50.000000000 +0000
2784 @@ -531,6 +531,12 @@
2785 if (PythonMod_Init())
2788 + /* Remove the element from sys.path that was added because of our
2789 + * argv[0] value in PythonMod_Init(). Previously we used an empty
2790 + * string, but dependinding on the OS we then get an empty entry or
2791 + * the current directory in sys.path. */
2792 + PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
2794 /* the first python thread is vim's, release the lock */
2795 Python_SaveThread();
2797 @@ -2345,7 +2351,8 @@
2801 - static char *(argv[2]) = {"", NULL};
2802 + /* The special value is removed from sys.path in Python_Init(). */
2803 + static char *(argv[2]) = {"/must>not&exist/foo", NULL};
2806 BufferType.ob_type = &PyType_Type;
2807 diff -Naur vim72.orig/src/if_xcmdsrv.c vim72/src/if_xcmdsrv.c
2808 --- vim72.orig/src/if_xcmdsrv.c 2008-07-18 14:05:03.000000000 +0100
2809 +++ vim72/src/if_xcmdsrv.c 2008-12-06 11:37:49.000000000 +0000
2811 + serverReply.ga_len;
2813 ga_init2(&e.strings, 1, 100);
2814 - memcpy(p, &e, sizeof(e));
2815 + mch_memmove(p, &e, sizeof(e));
2816 serverReply.ga_len++;
2819 @@ -1018,7 +1018,7 @@
2821 count = numItems - (p - regProp);
2823 - memcpy(entry, p, count);
2824 + mch_memmove(entry, p, count);
2825 XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
2826 8, PropModeReplace, regProp,
2827 (int)(numItems - (p - entry)));
2828 @@ -1072,7 +1072,7 @@
2830 lastHalf = numItems - (p - regProp);
2832 - memcpy(entry, p, lastHalf);
2833 + mch_memmove(entry, p, lastHalf);
2834 numItems = (entry - regProp) + lastHalf;
2837 diff -Naur vim72.orig/src/main.c vim72/src/main.c
2838 --- vim72.orig/src/main.c 2008-07-24 09:40:56.000000000 +0100
2839 +++ vim72/src/main.c 2008-12-06 11:37:50.000000000 +0000
2840 @@ -645,11 +645,12 @@
2844 - * Read in registers, history etc, but not marks, from the viminfo file
2845 + * Read in registers, history etc, but not marks, from the viminfo file.
2846 + * This is where v:oldfiles gets filled.
2848 if (*p_viminfo != NUL)
2850 - read_viminfo(NULL, TRUE, FALSE, FALSE);
2851 + read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
2852 TIME_MSG("reading viminfo");
2855 @@ -1457,7 +1458,8 @@
2859 - if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k')
2860 + /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */
2861 + if (TOLOWER_ASC(initstr[0]) == 'g')
2865 @@ -1508,7 +1510,8 @@
2866 early_arg_scan(parmp)
2869 -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER)
2870 +#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
2871 + || !defined(FEAT_NETBEANS_INTG)
2872 int argc = parmp->argc;
2873 char **argv = parmp->argv;
2875 @@ -1580,6 +1583,14 @@
2876 else if (STRICMP(argv[i], "--echo-wid") == 0)
2877 echo_wid_arg = TRUE;
2879 +# ifndef FEAT_NETBEANS_INTG
2880 + else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
2882 + mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
2890 @@ -2361,7 +2372,7 @@
2891 * Is there any other system that cannot do this?
2899 @@ -2586,7 +2597,7 @@
2901 (void)do_ecmd(0, arg_idx < GARGCOUNT
2902 ? alist_name(&GARGLIST[arg_idx]) : NULL,
2903 - NULL, NULL, ECMD_LASTL, ECMD_HIDE);
2904 + NULL, NULL, ECMD_LASTL, ECMD_HIDE, curwin);
2905 # ifdef HAS_SWAP_EXISTS_ACTION
2906 if (swap_exists_did_quit)
2908 diff -Naur vim72.orig/src/mark.c vim72/src/mark.c
2909 --- vim72.orig/src/mark.c 2008-08-08 23:06:49.000000000 +0100
2910 +++ vim72/src/mark.c 2008-12-06 11:37:49.000000000 +0000
2911 @@ -1627,15 +1627,17 @@
2914 * Handle marks in the viminfo file:
2915 - * fp_out == NULL read marks for current buffer only
2916 - * fp_out != NULL copy marks for buffers not in buffer list
2917 + * fp_out != NULL: copy marks for buffers not in buffer list
2918 + * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
2919 + * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
2922 -copy_viminfo_marks(virp, fp_out, count, eof)
2923 +copy_viminfo_marks(virp, fp_out, count, eof, flags)
2930 char_u *line = virp->vir_line;
2932 @@ -1647,10 +1649,23 @@
2937 + list_T *list = NULL;
2940 if ((name_buf = alloc(LSIZE)) == NULL)
2945 + if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT)))
2947 + list = list_alloc();
2949 + set_vim_var_list(VV_OLDFILES, list);
2953 num_marked_files = get_viminfo_parameter('\'');
2954 while (!eof && (count < num_marked_files || fp_out == NULL))
2956 @@ -1681,6 +1696,11 @@
2962 + list_append_string(list, str, -1);
2966 * If fp_out == NULL, load marks for current buffer.
2967 * If fp_out != NULL, copy marks for buffers not in buflist.
2968 @@ -1688,7 +1708,7 @@
2969 load_marks = copy_marks_out = FALSE;
2972 - if (curbuf->b_ffname != NULL)
2973 + if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL)
2975 if (*name_buf == NUL) /* only need to do this once */
2976 home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE);
2977 diff -Naur vim72.orig/src/mbyte.c vim72/src/mbyte.c
2978 --- vim72.orig/src/mbyte.c 2008-07-14 13:38:05.000000000 +0100
2979 +++ vim72/src/mbyte.c 2008-12-06 11:37:50.000000000 +0000
2981 * where mblen() returns 0 for invalid character.
2982 * Therefore, following condition includes 0.
2984 - (void)mblen(NULL, 0); /* First reset the state. */
2985 + ignored = mblen(NULL, 0); /* First reset the state. */
2986 if (mblen(buf, (size_t)1) <= 0)
2989 @@ -2540,7 +2540,6 @@
2990 return (int)(p - q);
2993 -#if defined(FEAT_EVAL) || defined(PROTO)
2995 * Copy a character from "*fp" to "*tp" and advance the pointers.
2997 @@ -2555,7 +2554,6 @@
3004 * Return the offset from "p" to the first byte of a character. When "p" is
3005 @@ -3133,7 +3131,7 @@
3009 - for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i)
3010 + for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i)
3012 if (s[i] == '_' || s[i] == '-')
3014 @@ -5280,7 +5278,7 @@
3018 -preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3019 +preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3022 xim_log("xim_decide_input_style()\n");
3023 @@ -5314,7 +5312,7 @@
3027 -preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3028 +preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3030 XIMPreeditDrawCallbackStruct *draw_data;
3032 @@ -5386,7 +5384,7 @@
3033 draw_feedback = (char *)alloc(draw_data->chg_first
3036 - draw_feedback = realloc(draw_feedback,
3037 + draw_feedback = vim_realloc(draw_feedback,
3038 draw_data->chg_first + text->length);
3039 if (draw_feedback != NULL)
3041 @@ -5455,7 +5453,7 @@
3045 -preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3046 +preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3049 xim_log("preedit_caret_cbproc()\n");
3050 @@ -5464,7 +5462,7 @@
3054 -preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3055 +preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3058 xim_log("preedit_done_cbproc()\n");
3059 @@ -6103,7 +6101,7 @@
3061 /* 1. codepage/UTF-8 -> ucs-2. */
3062 if (vcp->vc_cpfrom == 0)
3063 - tmp_len = utf8_to_ucs2(ptr, len, NULL, NULL);
3064 + tmp_len = utf8_to_utf16(ptr, len, NULL, NULL);
3066 tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, 0,
3068 @@ -6111,13 +6109,13 @@
3071 if (vcp->vc_cpfrom == 0)
3072 - utf8_to_ucs2(ptr, len, tmp, unconvlenp);
3073 + utf8_to_utf16(ptr, len, tmp, unconvlenp);
3075 MultiByteToWideChar(vcp->vc_cpfrom, 0, ptr, len, tmp, tmp_len);
3077 /* 2. ucs-2 -> codepage/UTF-8. */
3078 if (vcp->vc_cpto == 0)
3079 - retlen = ucs2_to_utf8(tmp, tmp_len, NULL);
3080 + retlen = utf16_to_utf8(tmp, tmp_len, NULL);
3082 retlen = WideCharToMultiByte(vcp->vc_cpto, 0,
3083 tmp, tmp_len, 0, 0, 0, 0);
3084 @@ -6125,7 +6123,7 @@
3087 if (vcp->vc_cpto == 0)
3088 - ucs2_to_utf8(tmp, tmp_len, retval);
3089 + utf16_to_utf8(tmp, tmp_len, retval);
3091 WideCharToMultiByte(vcp->vc_cpto, 0,
3092 tmp, tmp_len, retval, retlen, 0, 0);
3093 diff -Naur vim72.orig/src/menu.c vim72/src/menu.c
3094 --- vim72.orig/src/menu.c 2008-06-21 20:53:43.000000000 +0100
3095 +++ vim72/src/menu.c 2008-12-06 11:37:48.000000000 +0000
3096 @@ -1120,6 +1120,7 @@
3098 menu = menu->children;
3100 + vim_free(path_name);
3102 /* Now we have found the matching menu, and we list the mappings */
3103 /* Highlight title */
3104 diff -Naur vim72.orig/src/message.c vim72/src/message.c
3105 --- vim72.orig/src/message.c 2008-07-09 19:24:55.000000000 +0100
3106 +++ vim72/src/message.c 2008-12-06 11:37:50.000000000 +0000
3107 @@ -4585,61 +4585,62 @@
3108 if (remove_trailing_zeroes)
3114 /* Using %g or %G: remove superfluous zeroes. */
3115 if (fmt_spec == 'f')
3116 - p = tmp + str_arg_l - 1;
3117 + tp = tmp + str_arg_l - 1;
3120 - p = (char *)vim_strchr((char_u *)tmp,
3121 + tp = (char *)vim_strchr((char_u *)tmp,
3122 fmt_spec == 'e' ? 'e' : 'E');
3126 /* Remove superfluous '+' and leading
3127 * zeroes from the exponent. */
3131 /* Change "1.0e+07" to "1.0e07" */
3132 - STRMOVE(p + 1, p + 2);
3133 + STRMOVE(tp + 1, tp + 2);
3136 - i = (p[1] == '-') ? 2 : 1;
3137 - while (p[i] == '0')
3138 + i = (tp[1] == '-') ? 2 : 1;
3139 + while (tp[i] == '0')
3141 /* Change "1.0e07" to "1.0e7" */
3142 - STRMOVE(p + i, p + i + 1);
3143 + STRMOVE(tp + i, tp + i + 1);
3151 - if (p != NULL && !precision_specified)
3152 + if (tp != NULL && !precision_specified)
3153 /* Remove trailing zeroes, but keep the one
3154 * just after a dot. */
3155 - while (p > tmp + 2 && *p == '0' && p[-1] != '.')
3156 + while (tp > tmp + 2 && *tp == '0'
3159 - STRMOVE(p, p + 1);
3161 + STRMOVE(tp, tp + 1);
3171 /* Be consistent: some printf("%e") use 1.0e+12
3172 * and some 1.0e+012. Remove one zero in the last
3174 - p = (char *)vim_strchr((char_u *)tmp,
3175 + tp = (char *)vim_strchr((char_u *)tmp,
3176 fmt_spec == 'e' ? 'e' : 'E');
3177 - if (p != NULL && (p[1] == '+' || p[1] == '-')
3179 - && vim_isdigit(p[3])
3180 - && vim_isdigit(p[4]))
3181 + if (tp != NULL && (tp[1] == '+' || tp[1] == '-')
3183 + && vim_isdigit(tp[3])
3184 + && vim_isdigit(tp[4]))
3186 - STRMOVE(p + 2, p + 3);
3187 + STRMOVE(tp + 2, tp + 3);
3191 diff -Naur vim72.orig/src/misc1.c vim72/src/misc1.c
3192 --- vim72.orig/src/misc1.c 2008-07-12 20:20:53.000000000 +0100
3193 +++ vim72/src/misc1.c 2008-12-06 11:37:50.000000000 +0000
3194 @@ -3245,9 +3245,9 @@
3196 /* When using ":silent" assume that <CR> was entered. */
3197 if (mouse_used != NULL)
3198 - MSG_PUTS(_("Type number or click with mouse (<Enter> cancels): "));
3199 + MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): "));
3201 - MSG_PUTS(_("Choice number (<Enter> cancels): "));
3202 + MSG_PUTS(_("Type number and <Enter> (empty cancels): "));
3204 /* Set the state such that text can be selected/copied/pasted and we still
3205 * get mouse events. */
3206 @@ -8728,7 +8728,7 @@
3207 /* The active codepage differs from 'encoding'. Attempt using the
3208 * wide function. If it fails because it is not implemented fall back
3209 * to the non-wide version (for Windows 98) */
3210 - wn = enc_to_ucs2(buf, NULL);
3211 + wn = enc_to_utf16(buf, NULL);
3214 hFind = FindFirstFileW(wn, &wfb);
3215 @@ -8756,7 +8756,7 @@
3219 - p = ucs2_to_enc(wfb.cFileName, NULL); /* p is allocated here */
3220 + p = utf16_to_enc(wfb.cFileName, NULL); /* p is allocated here */
3223 p = (char_u *)fb.cFileName;
3224 @@ -8830,7 +8830,7 @@
3228 - wn = enc_to_ucs2(buf, NULL);
3229 + wn = enc_to_utf16(buf, NULL);
3231 hFind = FindFirstFileW(wn, &wfb);
3233 diff -Naur vim72.orig/src/misc2.c vim72/src/misc2.c
3234 --- vim72.orig/src/misc2.c 2008-07-23 20:12:56.000000000 +0100
3235 +++ vim72/src/misc2.c 2008-12-06 11:37:49.000000000 +0000
3237 /* 3. check for available memory: call mch_avail_mem() */
3238 if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
3240 - vim_free((char *)p); /* System is low... no go! */
3241 + free((char *)p); /* System is low... no go! */
3245 @@ -1257,7 +1257,6 @@
3246 return escaped_string;
3249 -#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
3251 * Return TRUE when 'shell' has "csh" in the tail.
3253 @@ -1266,9 +1265,7 @@
3255 return (strstr((char *)gettail(p_sh), "csh") != NULL);
3259 -#if defined(FEAT_EVAL) || defined(PROTO)
3261 * Escape "string" for use as a shell argument with system().
3262 * This uses single quotes, except when we know we need to use double qoutes
3263 @@ -1391,7 +1388,6 @@
3265 return escaped_string;
3270 * Like vim_strsave(), but make all characters uppercase.
3271 diff -Naur vim72.orig/src/move.c vim72/src/move.c
3272 --- vim72.orig/src/move.c 2008-07-12 17:26:47.000000000 +0100
3273 +++ vim72/src/move.c 2008-12-06 11:37:49.000000000 +0000
3274 @@ -280,18 +280,20 @@
3276 if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
3278 - if (curwin->w_cursor.lnum < curwin->w_botline
3279 - && ((long)curwin->w_cursor.lnum
3280 + if (curwin->w_cursor.lnum < curwin->w_botline)
3282 + if (((long)curwin->w_cursor.lnum
3283 >= (long)curwin->w_botline - p_so
3285 || hasAnyFolding(curwin)
3292 - /* Cursor is above botline, check if there are 'scrolloff'
3293 - * window lines below the cursor. If not, need to scroll. */
3294 + /* Cursor is (a few lines) above botline, check if there are
3295 + * 'scrolloff' window lines below the cursor. If not, need to
3297 n = curwin->w_empty_rows;
3298 loff.lnum = curwin->w_cursor.lnum;
3300 @@ -317,6 +319,10 @@
3302 /* sufficient context, no need to scroll */
3303 check_botline = FALSE;
3306 + /* sufficient context, no need to scroll */
3307 + check_botline = FALSE;
3312 /* Approximate the value of w_botline */
3313 wp->w_botline += lnum - wp->w_topline;
3314 wp->w_topline = lnum;
3315 +#ifdef FEAT_AUTOCMD
3316 + wp->w_topline_was_set = TRUE;
3321 diff -Naur vim72.orig/src/netbeans.c vim72/src/netbeans.c
3322 --- vim72.orig/src/netbeans.c 2008-07-13 17:19:54.000000000 +0100
3323 +++ vim72/src/netbeans.c 2008-12-06 11:37:50.000000000 +0000
3324 @@ -1043,7 +1043,7 @@
3325 nbdebug(("EVT: %s", buf));
3326 /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */
3328 - sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */
3329 + ignored = sock_write(sd, buf, (int)STRLEN(buf));
3333 @@ -1795,7 +1795,7 @@
3334 buf->displayname = NULL;
3336 netbeansReadFile = 0; /* don't try to open disk file */
3337 - do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF);
3338 + do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF, curwin);
3339 netbeansReadFile = 1;
3342 @@ -1960,7 +1960,7 @@
3344 netbeansReadFile = 0; /* don't try to open disk file */
3345 do_ecmd(0, (char_u *)buf->displayname, 0, 0, ECMD_ONE,
3346 - ECMD_HIDE + ECMD_OLDBUF);
3347 + ECMD_HIDE + ECMD_OLDBUF, curwin);
3348 netbeansReadFile = 1;
3351 @@ -1979,7 +1979,7 @@
3352 vim_free(buf->displayname);
3353 buf->displayname = nb_unquote(args, NULL);
3354 do_ecmd(0, (char_u *)buf->displayname, NULL, NULL, ECMD_ONE,
3355 - ECMD_HIDE + ECMD_OLDBUF);
3356 + ECMD_HIDE + ECMD_OLDBUF, curwin);
3358 buf->initDone = TRUE;
3360 @@ -2277,9 +2277,6 @@
3369 if (buf == NULL || buf->bufp == NULL)
3370 @@ -2303,13 +2300,10 @@
3371 pos = get_off_or_lnum(buf->bufp, &args);
3377 - strtol(cp, &cp, 10);
3378 + ignored = (int)strtol(cp, &cp, 10);
3379 args = (char_u *)cp;
3382 + if (ignored != -1)
3384 nbdebug((" partial line annotation -- Not Yet Implemented!\n"));
3386 diff -Naur vim72.orig/src/normal.c vim72/src/normal.c
3387 --- vim72.orig/src/normal.c 2008-07-31 21:03:08.000000000 +0100
3388 +++ vim72/src/normal.c 2008-12-06 11:37:50.000000000 +0000
3390 static void nv_cursorhold __ARGS((cmdarg_T *cap));
3393 +static char *e_noident = N_("E349: No identifier under cursor");
3396 * Function to be called for a Normal or Visual mode command.
3397 * The argument is a cmdarg_T.
3399 static int old_mapped_len = 0;
3403 + int set_prevcount = FALSE;
3406 vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
3408 @@ -613,7 +618,12 @@
3409 /* When not finishing an operator and no register name typed, reset the
3411 if (!finish_op && !oap->regname)
3415 + set_prevcount = TRUE;
3420 /* Restore counts from before receiving K_CURSORHOLD. This means after
3421 @@ -717,7 +727,15 @@
3422 * command, so that v:count can be used in an expression mapping
3423 * right after the count. */
3424 if (toplevel && stuff_empty())
3425 - set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0);
3427 + long count = ca.count0;
3429 + /* multiply with ca.opcount the same way as below */
3430 + if (ca.opcount != 0)
3431 + count = ca.opcount * (count == 0 ? 1 : count);
3432 + set_vcount(count, count == 0 ? 1 : count, set_prevcount);
3433 + set_prevcount = FALSE; /* only set v:prevcount once */
3439 * Only set v:count when called from main() and not a stuffed command.
3441 if (toplevel && stuff_empty())
3442 - set_vcount(ca.count0, ca.count1);
3443 + set_vcount(ca.count0, ca.count1, set_prevcount);
3447 @@ -1132,7 +1150,8 @@
3451 - did_cursorhold = FALSE;
3452 + if (ca.cmdchar != K_IGNORE)
3453 + did_cursorhold = FALSE;
3457 @@ -3509,7 +3528,7 @@
3458 if (find_type & FIND_STRING)
3459 EMSG(_("E348: No string under cursor"));
3461 - EMSG(_("E349: No identifier under cursor"));
3462 + EMSG(_(e_noident));
3466 @@ -5469,6 +5488,20 @@
3467 STRCPY(buf, "he! ");
3470 + /* An external command will probably use an argument starting
3471 + * with "-" as an option. To avoid trouble we skip the "-". */
3472 + while (*ptr == '-' && n > 0)
3479 + EMSG(_(e_noident)); /* found dashes only */
3484 /* When a count is given, turn it into a range. Is this
3485 * really what we want? */
3486 isman = (STRCMP(kp, "man") == 0);
3487 @@ -5511,37 +5544,59 @@
3489 * Now grab the chars in the identifier
3491 - if (cmdchar == '*')
3492 - aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
3493 - else if (cmdchar == '#')
3494 - aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
3495 - else if (cmdchar == 'K' && !kp_help)
3496 - aux_ptr = (char_u *)" \t\\\"|!";
3498 - /* Don't escape spaces and Tabs in a tag with a backslash */
3499 - aux_ptr = (char_u *)"\\|\"";
3501 - p = buf + STRLEN(buf);
3504 - /* put a backslash before \ and some others */
3505 - if (vim_strchr(aux_ptr, *ptr) != NULL)
3508 - /* When current byte is a part of multibyte character, copy all bytes
3509 - * of that character. */
3511 + if (cmdchar == 'K' && !kp_help)
3513 + /* Escape the argument properly for a shell command */
3514 + ptr = vim_strnsave(ptr, n);
3515 + p = vim_strsave_shellescape(ptr, TRUE);
3520 - int len = (*mb_ptr2len)(ptr) - 1;
3522 - for (i = 0; i < len && n >= 1; ++i, --n)
3527 + buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
3539 + if (cmdchar == '*')
3540 + aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
3541 + else if (cmdchar == '#')
3542 + aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
3544 + /* Don't escape spaces and Tabs in a tag with a backslash */
3545 + aux_ptr = (char_u *)"\\|\"\n*?[";
3547 + p = buf + STRLEN(buf);
3550 + /* put a backslash before \ and some others */
3551 + if (vim_strchr(aux_ptr, *ptr) != NULL)
3554 + /* When current byte is a part of multibyte character, copy all
3555 + * bytes of that character. */
3559 + int len = (*mb_ptr2len)(ptr) - 1;
3561 + for (i = 0; i < len && n >= 1; ++i, --n)
3573 * Execute the command.
3574 @@ -6011,7 +6066,7 @@
3575 autowrite(curbuf, FALSE);
3577 (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,
3578 - P_HID(curbuf) ? ECMD_HIDE : 0);
3579 + P_HID(curbuf) ? ECMD_HIDE : 0, curwin);
3580 if (cap->nchar == 'F' && lnum >= 0)
3582 curwin->w_cursor.lnum = lnum;
3583 diff -Naur vim72.orig/src/ops.c vim72/src/ops.c
3584 --- vim72.orig/src/ops.c 2008-06-21 21:08:59.000000000 +0100
3585 +++ vim72/src/ops.c 2008-12-06 11:37:50.000000000 +0000
3586 @@ -2209,12 +2209,15 @@
3588 for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
3592 block_prep(oap, &bd, pos.lnum, FALSE);
3593 pos.col = bd.textcol;
3594 - did_change = swapchars(oap->op_type, &pos, bd.textlen);
3595 + one_change = swapchars(oap->op_type, &pos, bd.textlen);
3596 + did_change |= one_change;
3598 # ifdef FEAT_NETBEANS_INTG
3599 - if (usingNetbeans && did_change)
3600 + if (usingNetbeans && one_change)
3602 char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
3604 diff -Naur vim72.orig/src/option.c vim72/src/option.c
3605 --- vim72.orig/src/option.c 2008-07-18 14:05:33.000000000 +0100
3606 +++ vim72/src/option.c 2008-12-06 11:37:50.000000000 +0000
3607 @@ -2593,13 +2593,13 @@
3609 (char_u *)&p_viminfo, PV_NONE,
3610 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
3611 - {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
3612 + {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
3616 - (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
3617 + (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
3619 - {(char_u *)"", (char_u *)"'20,<50,s10,h"}
3620 + {(char_u *)"", (char_u *)"'100,<50,s10,h"}
3624 @@ -7974,6 +7974,11 @@
3625 else /* curwin->w_p_scr > curwin->w_height */
3626 curwin->w_p_scr = curwin->w_height;
3630 + errmsg = e_positive;
3635 errmsg = e_positive;
3636 @@ -8227,13 +8232,13 @@
3638 if (number == 0 && string != NULL)
3643 /* Either we are given a string or we are setting option
3645 - for (index = 0; string[index] == '0'; ++index)
3646 + for (idx = 0; string[idx] == '0'; ++idx)
3648 - if (string[index] != NUL || index == 0)
3649 + if (string[idx] != NUL || idx == 0)
3651 /* There's another character after zeros or the string
3652 * is empty. In both cases, we are trying to set a
3653 diff -Naur vim72.orig/src/os_unix.c vim72/src/os_unix.c
3654 --- vim72.orig/src/os_unix.c 2008-08-06 12:01:40.000000000 +0100
3655 +++ vim72/src/os_unix.c 2008-12-06 11:37:50.000000000 +0000
3656 @@ -315,12 +315,15 @@
3657 {-1, "Unknown!", FALSE}
3661 + * Write s[len] to the screen.
3668 - write(1, (char *)s, len);
3669 + ignored = (int)write(1, (char *)s, len);
3670 if (p_wd) /* Unix is too fast, slow down a bit more */
3671 RealWaitForChar(read_cmd_fd, p_wd, NULL);
3673 @@ -2905,7 +2908,7 @@
3674 * Ignore any errors.
3676 #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
3677 - signal_stack = malloc(SIGSTKSZ);
3678 + signal_stack = (char *)alloc(SIGSTKSZ);
3679 init_signal_stack();
3682 @@ -2936,7 +2939,8 @@
3687 + /* Don't close the display for GTK 1, it is done in exit(). */
3688 +# if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2))
3689 if (x11_display != NULL
3690 # ifdef FEAT_XCLIPBOARD
3691 && x11_display != xterm_dpy
3692 @@ -3926,9 +3930,9 @@
3696 - dup(fd); /* To replace stdin (file descriptor 0) */
3697 - dup(fd); /* To replace stdout (file descriptor 1) */
3698 - dup(fd); /* To replace stderr (file descriptor 2) */
3699 + ignored = dup(fd); /* To replace stdin (fd 0) */
3700 + ignored = dup(fd); /* To replace stdout (fd 1) */
3701 + ignored = dup(fd); /* To replace stderr (fd 2) */
3703 /* Don't need this now that we've duplicated it */
3705 @@ -3996,13 +4000,13 @@
3707 /* set up stdin/stdout/stderr for the child */
3709 - dup(pty_slave_fd);
3710 + ignored = dup(pty_slave_fd);
3712 - dup(pty_slave_fd);
3713 + ignored = dup(pty_slave_fd);
3717 - dup(pty_slave_fd);
3718 + ignored = dup(pty_slave_fd);
3721 close(pty_slave_fd); /* has been dupped, close it now */
3722 @@ -4013,13 +4017,13 @@
3723 /* set up stdin for the child */
3724 close(fd_toshell[1]);
3726 - dup(fd_toshell[0]);
3727 + ignored = dup(fd_toshell[0]);
3728 close(fd_toshell[0]);
3730 /* set up stdout for the child */
3731 close(fd_fromshell[0]);
3733 - dup(fd_fromshell[1]);
3734 + ignored = dup(fd_fromshell[1]);
3735 close(fd_fromshell[1]);
3738 @@ -4027,7 +4031,7 @@
3740 /* set up stderr for the child */
3747 @@ -4158,7 +4162,8 @@
3749 curbuf->b_ml.ml_line_count
3750 || curbuf->b_p_eol)))
3751 - write(toshell_fd, "\n", (size_t)1);
3752 + ignored = write(toshell_fd, "\n",
3755 if (lnum > curbuf->b_op_end.lnum)
3757 @@ -6814,7 +6819,8 @@
3758 if (xsmp_icefd != -1)
3760 SmcCloseConnection(xsmp.smcconn, 0, NULL);
3761 - vim_free(xsmp.clientid);
3762 + if (xsmp.clientid != NULL)
3763 + free(xsmp.clientid);
3764 xsmp.clientid = NULL;
3767 diff -Naur vim72.orig/src/popupmnu.c vim72/src/popupmnu.c
3768 --- vim72.orig/src/popupmnu.c 2008-07-12 17:28:18.000000000 +0100
3769 +++ vim72/src/popupmnu.c 2008-12-06 11:37:49.000000000 +0000
3772 /* Don't want to sync undo in the current buffer. */
3774 - res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0);
3775 + res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0, NULL);
3779 diff -Naur vim72.orig/src/proto/buffer.pro vim72/src/proto/buffer.pro
3780 --- vim72.orig/src/proto/buffer.pro 2008-08-09 15:31:21.000000000 +0100
3781 +++ vim72/src/proto/buffer.pro 2008-12-06 11:37:49.000000000 +0000
3783 char_u *getaltfname __ARGS((int errmsg));
3784 int buflist_add __ARGS((char_u *fname, int flags));
3785 void buflist_slash_adjust __ARGS((void));
3786 -void buflist_altfpos __ARGS((void));
3787 +void buflist_altfpos __ARGS((win_T *win));
3788 int otherfile __ARGS((char_u *ffname));
3789 void buf_setino __ARGS((buf_T *buf));
3790 void fileinfo __ARGS((int fullname, int shorthelp, int dont_truncate));
3791 diff -Naur vim72.orig/src/proto/eval.pro vim72/src/proto/eval.pro
3792 --- vim72.orig/src/proto/eval.pro 2008-08-09 15:31:25.000000000 +0100
3793 +++ vim72/src/proto/eval.pro 2008-12-06 11:37:50.000000000 +0000
3795 int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip));
3796 char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip));
3797 int skip_expr __ARGS((char_u **pp));
3798 -char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));
3799 +char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert));
3800 char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox));
3801 int eval_to_number __ARGS((char_u *expr));
3802 list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
3804 void list_unref __ARGS((list_T *l));
3805 void list_free __ARGS((list_T *l, int recurse));
3806 dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
3807 +char_u *list_find_str __ARGS((list_T *l, long idx));
3808 int list_append_dict __ARGS((list_T *list, dict_T *dict));
3809 +int list_append_string __ARGS((list_T *l, char_u *str, int len));
3810 int garbage_collect __ARGS((void));
3811 dict_T *dict_alloc __ARGS((void));
3812 int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
3814 void set_vim_var_nr __ARGS((int idx, long val));
3815 long get_vim_var_nr __ARGS((int idx));
3816 char_u *get_vim_var_str __ARGS((int idx));
3817 -void set_vcount __ARGS((long count, long count1));
3818 +list_T *get_vim_var_list __ARGS((int idx));
3819 +void set_vcount __ARGS((long count, long count1, int set_prevcount));
3820 void set_vim_var_string __ARGS((int idx, char_u *val, int len));
3821 +void set_vim_var_list __ARGS((int idx, list_T *val));
3822 void set_reg_var __ARGS((int c));
3823 char_u *v_exception __ARGS((char_u *oldval));
3824 char_u *v_throwpoint __ARGS((char_u *oldval));
3826 void write_viminfo_varlist __ARGS((FILE *fp));
3827 int store_session_globals __ARGS((FILE *fd));
3828 void last_set_msg __ARGS((scid_T scriptID));
3829 +void ex_oldfiles __ARGS((exarg_T *eap));
3830 int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
3831 char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
3832 /* vim: set ft=c : */
3833 diff -Naur vim72.orig/src/proto/ex_cmds.pro vim72/src/proto/ex_cmds.pro
3834 --- vim72.orig/src/proto/ex_cmds.pro 2008-08-09 15:31:25.000000000 +0100
3835 +++ vim72/src/proto/ex_cmds.pro 2008-12-06 11:37:49.000000000 +0000
3837 char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
3838 void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
3839 int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
3840 -int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
3841 +int read_viminfo __ARGS((char_u *file, int flags));
3842 void write_viminfo __ARGS((char_u *file, int forceit));
3843 int viminfo_readline __ARGS((vir_T *virp));
3844 char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
3846 void do_wqall __ARGS((exarg_T *eap));
3847 int not_writing __ARGS((void));
3848 int getfile __ARGS((int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum, int forceit));
3849 -int do_ecmd __ARGS((int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags));
3850 +int do_ecmd __ARGS((int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags, win_T *oldwin));
3851 void ex_append __ARGS((exarg_T *eap));
3852 void ex_change __ARGS((exarg_T *eap));
3853 void ex_z __ARGS((exarg_T *eap));
3854 diff -Naur vim72.orig/src/proto/ex_getln.pro vim72/src/proto/ex_getln.pro
3855 --- vim72.orig/src/proto/ex_getln.pro 2008-08-09 15:31:28.000000000 +0100
3856 +++ vim72/src/proto/ex_getln.pro 2008-12-06 11:37:50.000000000 +0000
3858 void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
3859 int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
3860 int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
3861 -char_u *globpath __ARGS((char_u *path, char_u *file));
3862 +char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
3863 void init_history __ARGS((void));
3864 int get_histtype __ARGS((char_u *name));
3865 void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
3866 diff -Naur vim72.orig/src/proto/mark.pro vim72/src/proto/mark.pro
3867 --- vim72.orig/src/proto/mark.pro 2008-08-09 15:31:36.000000000 +0100
3868 +++ vim72/src/proto/mark.pro 2008-12-06 11:37:49.000000000 +0000
3870 void write_viminfo_filemarks __ARGS((FILE *fp));
3871 int removable __ARGS((char_u *name));
3872 int write_viminfo_marks __ARGS((FILE *fp_out));
3873 -void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof));
3874 +void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags));
3875 /* vim: set ft=c : */
3876 diff -Naur vim72.orig/src/pty.c vim72/src/pty.c
3877 --- vim72.orig/src/pty.c 2008-06-21 19:52:58.000000000 +0100
3878 +++ vim72/src/pty.c 2008-12-06 11:37:48.000000000 +0000
3879 @@ -270,9 +270,10 @@
3883 -#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux)
3884 +#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X)
3886 -/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */
3887 +/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
3888 + * Same for Mac OS X Leopard. */
3892 diff -Naur vim72.orig/src/quickfix.c vim72/src/quickfix.c
3893 --- vim72.orig/src/quickfix.c 2008-07-18 13:53:02.000000000 +0100
3894 +++ vim72/src/quickfix.c 2008-12-06 11:37:49.000000000 +0000
3895 @@ -1420,6 +1420,7 @@
3899 + win_T *oldwin = curwin;
3900 int print_message = TRUE;
3903 @@ -1744,7 +1745,8 @@
3906 ok = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1,
3907 - ECMD_HIDE + ECMD_SET_HELP);
3908 + ECMD_HIDE + ECMD_SET_HELP,
3909 + oldwin == curwin ? curwin : NULL);
3912 ok = buflist_getfile(qf_ptr->qf_fnum,
3913 @@ -2267,6 +2269,7 @@
3915 tabpage_T *prevtab = curtab;
3917 + win_T *oldwin = curwin;
3919 if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
3921 @@ -2326,14 +2329,16 @@
3922 win->w_llist->qf_refcount++;
3925 + if (oldwin != curwin)
3926 + oldwin = NULL; /* don't store info when in another window */
3928 /* Use the existing quickfix buffer */
3929 (void)do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE,
3930 - ECMD_HIDE + ECMD_OLDBUF);
3931 + ECMD_HIDE + ECMD_OLDBUF, oldwin);
3934 /* Create a new quickfix buffer */
3935 - (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE);
3936 + (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin);
3937 /* switch off 'swapfile' */
3938 set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
3939 set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
3940 diff -Naur vim72.orig/src/screen.c vim72/src/screen.c
3941 --- vim72.orig/src/screen.c 2008-07-24 15:45:07.000000000 +0100
3942 +++ vim72/src/screen.c 2008-12-06 11:37:48.000000000 +0000
3943 @@ -2439,9 +2439,17 @@
3946 /* Show 'cursorcolumn' in the fold line. */
3947 - if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp))
3948 - ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr(
3949 - ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC));
3952 + txtcol += wp->w_virtcol;
3954 + txtcol -= wp->w_skipcol;
3956 + txtcol -= wp->w_leftcol;
3957 + if (txtcol >= 0 && txtcol < W_WIDTH(wp))
3958 + ScreenAttrs[off + txtcol] = hl_combine_attr(
3959 + ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
3963 SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
3964 diff -Naur vim72.orig/src/spell.c vim72/src/spell.c
3965 --- vim72.orig/src/spell.c 2008-07-12 20:20:55.000000000 +0100
3966 +++ vim72/src/spell.c 2008-12-06 11:37:50.000000000 +0000
3970 * Do the opposite: based on a maximum end score and a known sound score,
3971 - * compute the the maximum word score that can be used.
3972 + * compute the maximum word score that can be used.
3974 #define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3)
3977 garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */
3978 regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm
3979 * (NULL when no compounding) */
3980 + char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */
3981 char_u *sl_compstartflags; /* flags for first compound word */
3982 char_u *sl_compallflags; /* all flags for compound words */
3983 char_u sl_nobreak; /* When TRUE: no spaces between words */
3985 /* TRUE if a word appears in the list of banned words. */
3986 #define WAS_BANNED(su, word) (!HASHITEM_EMPTY(hash_find(&su->su_banned, word)))
3988 -/* Number of suggestions kept when cleaning up. we need to keep more than
3989 +/* Number of suggestions kept when cleaning up. We need to keep more than
3990 * what is displayed, because when rescore_suggestions() is called the score
3991 * may change and wrong suggestions may be removed later. */
3992 #define SUG_CLEAN_COUNT(su) ((su)->su_maxcount < 130 ? 150 : (su)->su_maxcount + 20)
3993 @@ -839,7 +840,10 @@
3994 static void slang_clear __ARGS((slang_T *lp));
3995 static void slang_clear_sug __ARGS((slang_T *lp));
3996 static void find_word __ARGS((matchinf_T *mip, int mode));
3997 +static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap));
3998 static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags));
3999 +static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag));
4000 +static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags));
4001 static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req));
4002 static void find_prefix __ARGS((matchinf_T *mip, int mode));
4003 static int fold_more __ARGS((matchinf_T *mip));
4004 @@ -1519,6 +1523,11 @@
4005 ((unsigned)flags >> 24)))
4008 + /* If there is a match with a CHECKCOMPOUNDPATTERN rule
4009 + * discard the compound word. */
4010 + if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
4013 if (mode == FIND_COMPOUND)
4016 @@ -1577,6 +1586,11 @@
4017 if (!can_compound(slang, fword, mip->mi_compflags))
4020 + else if (slang->sl_comprules != NULL
4021 + && !match_compoundrule(slang, mip->mi_compflags))
4022 + /* The compound flags collected so far do not match any
4023 + * COMPOUNDRULE, discard the compounded word. */
4027 /* Check NEEDCOMPOUND: can't use word without compounding. */
4028 @@ -1727,6 +1741,39 @@
4032 + * Return TRUE if there is a match between the word ptr[wlen] and
4033 + * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
4035 + * A match means that the first part of CHECKCOMPOUNDPATTERN matches at the
4036 + * end of ptr[wlen] and the second part matches after it.
4039 +match_checkcompoundpattern(ptr, wlen, gap)
4042 + garray_T *gap; /* &sl_comppat */
4048 + for (i = 0; i + 1 < gap->ga_len; i += 2)
4050 + p = ((char_u **)gap->ga_data)[i + 1];
4051 + if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
4053 + /* Second part matches at start of following compound word, now
4054 + * check if first part matches at end of previous word. */
4055 + p = ((char_u **)gap->ga_data)[i];
4057 + if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
4065 * Return TRUE if "flags" is a valid sequence of compound flags and "word"
4066 * does not have too many syllables.
4068 @@ -1773,6 +1820,98 @@
4072 + * Return TRUE when the sequence of flags in "compflags" plus "flag" can
4073 + * possibly form a valid compounded word. This also checks the COMPOUNDRULE
4074 + * lines if they don't contain wildcards.
4077 +can_be_compound(sp, slang, compflags, flag)
4080 + char_u *compflags;
4083 + /* If the flag doesn't appear in sl_compstartflags or sl_compallflags
4084 + * then it can't possibly compound. */
4085 + if (!byte_in_str(sp->ts_complen == sp->ts_compsplit
4086 + ? slang->sl_compstartflags : slang->sl_compallflags, flag))
4089 + /* If there are no wildcards, we can check if the flags collected so far
4090 + * possibly can form a match with COMPOUNDRULE patterns. This only
4091 + * makes sense when we have two or more words. */
4092 + if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit)
4096 + compflags[sp->ts_complen] = flag;
4097 + compflags[sp->ts_complen + 1] = NUL;
4098 + v = match_compoundrule(slang, compflags + sp->ts_compsplit);
4099 + compflags[sp->ts_complen] = NUL;
4108 + * Return TRUE if the compound flags in compflags[] match the start of any
4109 + * compound rule. This is used to stop trying a compound if the flags
4110 + * collected so far can't possibly match any compound rule.
4111 + * Caller must check that slang->sl_comprules is not NULL.
4114 +match_compoundrule(slang, compflags)
4116 + char_u *compflags;
4122 + /* loop over all the COMPOUNDRULE entries */
4123 + for (p = slang->sl_comprules; *p != NUL; ++p)
4125 + /* loop over the flags in the compound word we have made, match
4126 + * them against the current rule entry */
4127 + for (i = 0; ; ++i)
4131 + /* found a rule that matches for the flags we have so far */
4133 + if (*p == '/' || *p == NUL)
4134 + break; /* end of rule, it's too short */
4137 + int match = FALSE;
4139 + /* compare against all the flags in [] */
4141 + while (*p != ']' && *p != NUL)
4145 + break; /* none matches */
4148 + break; /* flag of word doesn't match flag in pattern */
4152 + /* Skip to the next "/", where the next pattern starts. */
4153 + p = vim_strchr(p, '/');
4158 + /* Checked all the rules and none of them match the flags, so there
4159 + * can't possibly be a compound starting with these flags. */
4164 * Return non-zero if the prefix indicated by "arridx" matches with the prefix
4165 * ID in "flags" for the word "word".
4166 * The WF_RAREPFX flag is included in the return value for a rare prefix.
4167 @@ -2513,9 +2652,11 @@
4168 lp->sl_midword = NULL;
4170 vim_free(lp->sl_compprog);
4171 + vim_free(lp->sl_comprules);
4172 vim_free(lp->sl_compstartflags);
4173 vim_free(lp->sl_compallflags);
4174 lp->sl_compprog = NULL;
4175 + lp->sl_comprules = NULL;
4176 lp->sl_compstartflags = NULL;
4177 lp->sl_compallflags = NULL;
4179 @@ -3460,6 +3601,7 @@
4187 @@ -3545,6 +3687,12 @@
4188 slang->sl_compallflags = ap;
4191 + /* And a list of all patterns in their original form, for checking whether
4192 + * compounding may work in match_compoundrule(). This is freed when we
4193 + * encounter a wildcard, the check doesn't work then. */
4194 + crp = alloc(todo + 1);
4195 + slang->sl_comprules = crp;
4200 @@ -3587,6 +3735,20 @@
4205 + /* Copy flag to "sl_comprules", unless we run into a wildcard. */
4208 + if (c == '+' || c == '*')
4210 + vim_free(slang->sl_comprules);
4211 + slang->sl_comprules = NULL;
4218 if (c == '/') /* slash separates two items */
4221 @@ -3611,6 +3773,9 @@
4228 slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
4230 if (slang->sl_compprog == NULL)
4231 @@ -4915,6 +5080,7 @@
4234 static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
4235 +static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount));
4236 static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry));
4237 static int spell_info_item __ARGS((char_u *s));
4238 static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
4239 @@ -4950,7 +5116,7 @@
4240 static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd));
4241 static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname));
4242 static void clear_node __ARGS((wordnode_T *node));
4243 -static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree));
4244 +static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree));
4245 static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname));
4246 static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang));
4247 static int sug_maketable __ARGS((spellinfo_T *spin));
4248 @@ -5223,8 +5389,7 @@
4249 /* Handle non-empty lines. */
4252 - if (STRCMP(items[0], "SET") == 0 && itemcnt == 2
4253 - && aff->af_enc == NULL)
4254 + if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
4257 /* Setup for conversion from "ENC" to 'encoding'. */
4258 @@ -5239,7 +5404,7 @@
4259 smsg((char_u *)_("Conversion in %s not supported"), fname);
4262 - else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2
4263 + else if (is_aff_rule(items, itemcnt, "FLAG", 2)
4264 && aff->af_flagtype == AFT_CHAR)
4266 if (STRCMP(items[1], "long") == 0)
4267 @@ -5284,69 +5449,71 @@
4271 - else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
4272 + else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
4275 midword = getroom_save(spin, items[1]);
4277 - else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
4278 + else if (is_aff_rule(items, itemcnt, "TRY", 2))
4280 /* ignored, we look in the tree for what chars may appear */
4282 /* TODO: remove "RAR" later */
4283 - else if ((STRCMP(items[0], "RAR") == 0
4284 - || STRCMP(items[0], "RARE") == 0) && itemcnt == 2
4285 - && aff->af_rare == 0)
4286 + else if ((is_aff_rule(items, itemcnt, "RAR", 2)
4287 + || is_aff_rule(items, itemcnt, "RARE", 2))
4288 + && aff->af_rare == 0)
4290 aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
4293 /* TODO: remove "KEP" later */
4294 - else if ((STRCMP(items[0], "KEP") == 0
4295 - || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2
4296 + else if ((is_aff_rule(items, itemcnt, "KEP", 2)
4297 + || is_aff_rule(items, itemcnt, "KEEPCASE", 2))
4298 && aff->af_keepcase == 0)
4300 aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
4303 - else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2
4304 - && aff->af_bad == 0)
4305 + else if ((is_aff_rule(items, itemcnt, "BAD", 2)
4306 + || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2))
4307 + && aff->af_bad == 0)
4309 aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
4312 - else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2
4313 + else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2)
4314 && aff->af_needaffix == 0)
4316 aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
4319 - else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2
4320 + else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2)
4321 && aff->af_circumfix == 0)
4323 aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
4326 - else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2
4327 + else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2)
4328 && aff->af_nosuggest == 0)
4330 aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
4333 - else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2
4334 + else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2)
4335 + || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2))
4336 && aff->af_needcomp == 0)
4338 aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
4341 - else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2
4342 + else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2)
4343 && aff->af_comproot == 0)
4345 aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
4348 - else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0
4349 - && itemcnt == 2 && aff->af_compforbid == 0)
4350 + else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2)
4351 + && aff->af_compforbid == 0)
4353 aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
4355 @@ -5354,8 +5521,8 @@
4356 smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
4359 - else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0
4360 - && itemcnt == 2 && aff->af_comppermit == 0)
4361 + else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
4362 + && aff->af_comppermit == 0)
4364 aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
4366 @@ -5363,7 +5530,7 @@
4367 smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
4370 - else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
4371 + else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
4372 && compflags == NULL)
4374 /* Turn flag "c" into COMPOUNDRULE compatible string "c+",
4375 @@ -5376,7 +5543,15 @@
4379 - else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
4380 + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
4382 + /* We don't use the count, but do check that it's a number and
4383 + * not COMPOUNDRULE mistyped. */
4384 + if (atoi((char *)items[1]) == 0)
4385 + smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"),
4386 + fname, lnum, items[1]);
4388 + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
4390 /* Concatenate this string to previously defined ones, using a
4391 * slash to separate them. */
4392 @@ -5395,7 +5570,7 @@
4396 - else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
4397 + else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
4400 compmax = atoi((char *)items[1]);
4401 @@ -5403,7 +5578,7 @@
4402 smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
4403 fname, lnum, items[1]);
4405 - else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
4406 + else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
4409 compminlen = atoi((char *)items[1]);
4410 @@ -5411,7 +5586,7 @@
4411 smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
4412 fname, lnum, items[1]);
4414 - else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
4415 + else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
4418 compsylmax = atoi((char *)items[1]);
4419 @@ -5419,32 +5594,29 @@
4420 smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
4421 fname, lnum, items[1]);
4423 - else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
4424 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
4426 compoptions |= COMP_CHECKDUP;
4428 - else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
4429 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
4431 compoptions |= COMP_CHECKREP;
4433 - else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
4434 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
4436 compoptions |= COMP_CHECKCASE;
4438 - else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
4440 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
4442 compoptions |= COMP_CHECKTRIPLE;
4444 - else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
4446 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
4448 if (atoi((char *)items[1]) == 0)
4449 smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
4450 fname, lnum, items[1]);
4452 - else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
4454 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
4456 garray_T *gap = &spin->si_comppat;
4458 @@ -5463,24 +5635,24 @@
4459 = getroom_save(spin, items[2]);
4462 - else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
4463 + else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
4464 && syllable == NULL)
4466 syllable = getroom_save(spin, items[1]);
4468 - else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
4469 + else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
4471 spin->si_nobreak = TRUE;
4473 - else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
4474 + else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
4476 spin->si_nosplitsugs = TRUE;
4478 - else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
4479 + else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
4481 spin->si_nosugfile = TRUE;
4483 - else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
4484 + else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
4486 aff->af_pfxpostpone = TRUE;
4488 @@ -5771,24 +5943,20 @@
4492 - else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
4494 + else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
4496 fol = vim_strsave(items[1]);
4498 - else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
4500 + else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
4502 low = vim_strsave(items[1]);
4504 - else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
4506 + else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
4508 upp = vim_strsave(items[1]);
4510 - else if ((STRCMP(items[0], "REP") == 0
4511 - || STRCMP(items[0], "REPSAL") == 0)
4513 + else if (is_aff_rule(items, itemcnt, "REP", 2)
4514 + || is_aff_rule(items, itemcnt, "REPSAL", 2))
4516 /* Ignore REP/REPSAL count */;
4517 if (!isdigit(*items[1]))
4518 @@ -5819,7 +5987,7 @@
4519 : &spin->si_rep, items[1], items[2]);
4522 - else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
4523 + else if (is_aff_rule(items, itemcnt, "MAP", 2))
4525 /* MAP item or count */
4527 @@ -5856,9 +6024,8 @@
4528 ga_append(&spin->si_map, '/');
4531 - /* Accept "SAL from to" and "SAL from to # comment". */
4532 - else if (STRCMP(items[0], "SAL") == 0
4533 - && (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#')))
4534 + /* Accept "SAL from to" and "SAL from to #comment". */
4535 + else if (is_aff_rule(items, itemcnt, "SAL", 3))
4539 @@ -5877,12 +6044,12 @@
4543 - else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
4544 + else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
4545 && sofofrom == NULL)
4547 sofofrom = getroom_save(spin, items[1]);
4549 - else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
4550 + else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
4553 sofoto = getroom_save(spin, items[1]);
4554 @@ -5980,7 +6147,7 @@
4555 else if (spin->si_newprefID == 0 || spin->si_newprefID == 127)
4556 MSG(_("Too many compound flags"));
4558 - MSG(_("Too many posponed prefixes and/or compound flags"));
4559 + MSG(_("Too many postponed prefixes and/or compound flags"));
4562 if (syllable != NULL)
4563 @@ -6017,6 +6184,22 @@
4567 + * Return TRUE when items[0] equals "rulename", there are "mincount" items or
4568 + * a comment is following after item "mincount".
4571 +is_aff_rule(items, itemcnt, rulename, mincount)
4577 + return (STRCMP(items[0], rulename) == 0
4578 + && (itemcnt == mincount
4579 + || (itemcnt > mincount && items[mincount][0] == '#')));
4583 * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
4584 * ae_flags to ae_comppermit and ae_compforbid.
4586 @@ -7926,6 +8109,8 @@
4590 + size_t fwv = 1; /* collect return value of fwrite() to avoid
4591 + warnings from picky compiler */
4593 fd = mch_fopen((char *)fname, "w");
4595 @@ -7936,11 +8121,11 @@
4597 /* <HEADER>: <fileID> <versionnr> */
4599 - if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)
4604 + fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
4605 + if (fwv != (size_t)1)
4606 + /* Catch first write error, don't try writing more. */
4609 putc(VIMSPELLVERSION, fd); /* <versionnr> */
4612 @@ -7955,7 +8140,7 @@
4614 i = (int)STRLEN(spin->si_info);
4615 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
4616 - fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
4617 + fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
4620 /* SN_REGION: <regionname> ...
4621 @@ -7966,7 +8151,7 @@
4622 putc(SNF_REQUIRED, fd); /* <sectionflags> */
4623 l = spin->si_region_count * 2;
4624 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
4625 - fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
4626 + fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
4627 /* <regionname> ... */
4628 regionmask = (1 << spin->si_region_count) - 1;
4630 @@ -8016,7 +8201,7 @@
4633 put_bytes(fd, (long_u)l, 2); /* <folcharslen> */
4634 - fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
4635 + fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
4638 /* SN_MIDWORD: <midword> */
4639 @@ -8027,7 +8212,8 @@
4641 i = (int)STRLEN(spin->si_midword);
4642 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
4643 - fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */
4644 + fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd);
4648 /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
4649 @@ -8113,7 +8299,8 @@
4650 p = rr == 1 ? ftp->ft_from : ftp->ft_to;
4653 - fwrite(p, l, (size_t)1, fd);
4655 + fwv &= fwrite(p, l, (size_t)1, fd);
4659 @@ -8131,11 +8318,11 @@
4662 put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
4663 - fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
4664 + fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
4666 l = (int)STRLEN(spin->si_sofoto);
4667 put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
4668 - fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
4669 + fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
4672 /* SN_WORDS: <word> ...
4673 @@ -8160,7 +8347,7 @@
4674 l = (int)STRLEN(hi->hi_key) + 1;
4676 if (round == 2) /* <word> */
4677 - fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
4678 + fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
4682 @@ -8176,7 +8363,7 @@
4683 putc(0, fd); /* <sectionflags> */
4684 l = spin->si_map.ga_len;
4685 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
4686 - fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
4687 + fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
4691 @@ -8232,10 +8419,11 @@
4693 p = ((char_u **)(spin->si_comppat.ga_data))[i];
4694 putc((int)STRLEN(p), fd); /* <comppatlen> */
4695 - fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */
4696 + fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);
4697 + /* <comppattext> */
4700 - fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
4701 + fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
4705 @@ -8259,7 +8447,8 @@
4707 l = (int)STRLEN(spin->si_syllable);
4708 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
4709 - fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */
4710 + fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd);
4714 /* end of <SECTIONS> */
4715 @@ -8295,13 +8484,18 @@
4716 (void)put_node(fd, tree, 0, regionmask, round == 3);
4719 - /* Write another byte to check for errors. */
4720 + /* Write another byte to check for errors (file system full). */
4721 if (putc(0, fd) == EOF)
4725 if (fclose(fd) == EOF)
4728 + if (fwv != (size_t)1)
4730 + if (retval == FAIL)
4736 @@ -9890,6 +10084,7 @@
4740 + size_t x = 1; /* collect return value of fwrite() */
4743 put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
4744 @@ -9906,7 +10101,7 @@
4748 - fwrite(p, (size_t)len, (size_t)1, fd);
4749 + x &= fwrite(p, (size_t)len, (size_t)1, fd);
4753 @@ -11480,15 +11675,24 @@
4754 vim_strncpy(preword + sp->ts_prewordlen,
4755 tword + sp->ts_splitoff,
4756 sp->ts_twordlen - sp->ts_splitoff);
4758 - while (*skiptowhite(p) != NUL)
4759 - p = skipwhite(skiptowhite(p));
4760 - if (fword_ends && !can_compound(slang, p,
4761 - compflags + sp->ts_compsplit))
4762 - /* Compound is not allowed. But it may still be
4763 - * possible if we add another (short) word. */
4765 + /* Verify CHECKCOMPOUNDPATTERN rules. */
4766 + if (match_checkcompoundpattern(preword, sp->ts_prewordlen,
4767 + &slang->sl_comppat))
4768 compound_ok = FALSE;
4773 + while (*skiptowhite(p) != NUL)
4774 + p = skipwhite(skiptowhite(p));
4775 + if (fword_ends && !can_compound(slang, p,
4776 + compflags + sp->ts_compsplit))
4777 + /* Compound is not allowed. But it may still be
4778 + * possible if we add another (short) word. */
4779 + compound_ok = FALSE;
4782 /* Get pointer to last char of previous word. */
4783 p = preword + sp->ts_prewordlen;
4784 mb_ptr_back(preword, p);
4785 @@ -11685,10 +11889,9 @@
4786 && (slang->sl_compsylmax < MAXWLEN
4787 || sp->ts_complen + 1 - sp->ts_compsplit
4788 < slang->sl_compmax)
4789 - && (byte_in_str(sp->ts_complen == sp->ts_compsplit
4790 - ? slang->sl_compstartflags
4791 - : slang->sl_compallflags,
4792 - ((unsigned)flags >> 24))))
4793 + && (can_be_compound(sp, slang,
4794 + compflags, ((unsigned)flags >> 24))))
4797 try_compound = TRUE;
4798 compflags[sp->ts_complen] = ((unsigned)flags >> 24);
4799 diff -Naur vim72.orig/src/structs.h vim72/src/structs.h
4800 --- vim72.orig/src/structs.h 2008-07-30 21:02:50.000000000 +0100
4801 +++ vim72/src/structs.h 2008-12-06 11:37:49.000000000 +0000
4805 int hide; /* TRUE when ":hide" was used */
4806 -# ifdef FEAT_BROWSE
4807 +# ifdef FEAT_BROWSE_CMD
4808 int browse; /* TRUE to invoke file dialog */
4810 # ifdef FEAT_WINDOWS
4811 @@ -1784,10 +1784,15 @@
4815 - * The next three specify the offsets for displaying the buffer:
4816 + * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
4817 + * displaying the buffer.
4819 linenr_T w_topline; /* buffer line number of the line at the
4820 top of the window */
4821 +#ifdef FEAT_AUTOCMD
4822 + char w_topline_was_set; /* flag set to TRUE when topline is set,
4823 + e.g. by winrestview() */
4826 int w_topfill; /* number of filler lines above w_topline */
4827 int w_old_topfill; /* w_topfill at last redraw */
4828 diff -Naur vim72.orig/src/testdir/Makefile vim72/src/testdir/Makefile
4829 --- vim72.orig/src/testdir/Makefile 2008-06-19 21:29:46.000000000 +0100
4830 +++ vim72/src/testdir/Makefile 2008-12-06 11:37:48.000000000 +0000
4835 -nongui: nolog $(SCRIPTS)
4839 +nongui: nolog $(SCRIPTS) report
4841 +gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
4843 -gui: nolog $(SCRIPTS) $(SCRIPTS_GUI)
4848 + @echo 'Test results:'
4849 + @/bin/sh -c "if test -f test.log; \
4850 + then cat test.log; echo TEST FAILURE; exit 1; \
4851 + else echo ALL DONE; \
4854 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
4857 test60.out: test60.vim
4860 - -echo Test results: >test.log
4862 diff -Naur vim72.orig/src/testdir/Make_ming.mak vim72/src/testdir/Make_ming.mak
4863 --- vim72.orig/src/testdir/Make_ming.mak 1970-01-01 01:00:00.000000000 +0100
4864 +++ vim72/src/testdir/Make_ming.mak 2008-12-06 11:37:48.000000000 +0000
4866 +# Makefile to run tests for Vim, on Dos-like machines
4867 +# with sh.exe or zsh.exe in the path or not.
4869 +# Author: Bill McCarthy
4871 +# Note that test54 has been removed until it is fixed.
4873 +# Requires a set of Unix tools: echo, diff, etc.
4875 +ifneq (sh.exe, $(SHELL))
4887 +VIMPROG = ..$(DIRSLASH)vim
4890 +# test2 "\\tmp" doesn't work.
4891 +# test10 'errorformat' is different
4892 +# test12 can't unlink a swap file
4893 +# test25 uses symbolic link
4894 +# test27 can't edit file with "*" in file name
4895 +# test31 16 bit version runs out of memory...
4897 +SCRIPTS16 = test1.out test19.out test20.out test22.out \
4898 + test23.out test24.out test28.out test29.out \
4899 + test35.out test36.out test43.out \
4900 + test44.out test45.out test46.out test47.out \
4901 + test48.out test51.out test53.out \
4902 + test55.out test56.out test57.out test58.out test59.out \
4903 + test60.out test61.out test62.out test63.out test64.out
4905 +# Had to remove test54 which doesn't work yet.
4908 +SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
4909 + test8.out test9.out test11.out test13.out test14.out \
4910 + test15.out test17.out test18.out test21.out test26.out \
4911 + test30.out test31.out test32.out test33.out test34.out \
4912 + test37.out test38.out test39.out test40.out test41.out \
4913 + test42.out test52.out test65.out
4915 +SCRIPTS32 = test50.out
4917 +SCRIPTS_GUI = test16.out
4919 +.SUFFIXES: .in .out
4921 +vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
4924 +nongui: fixff $(SCRIPTS16) $(SCRIPTS)
4930 +gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
4933 +win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
4937 + -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
4949 + $(CP) $*.ok test.ok
4950 + $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
4951 + diff test.out $*.ok
4953 + $(MV) test.out $*.out
4957 diff -Naur vim72.orig/src/testdir/test30.in vim72/src/testdir/test30.in
4958 --- vim72.orig/src/testdir/test30.in 2008-06-25 22:33:01.000000000 +0100
4959 +++ vim72/src/testdir/test30.in 2008-12-06 11:37:48.000000000 +0000
4962 :bwipe XXUnix XXDos XXMac
4963 :" create mixed format files
4964 -:!cat XXUnix XXDos >XXUxDs
4965 -:!cat XXUnix XXMac >XXUxMac
4966 -:!cat XXDos XXMac >XXDosMac
4967 -:!cat XXUnix XXDos XXMac >XXUxDsMc
4969 +: !copy XXUnix,XXDos XXUxDs.
4970 +: !copy XXUnix,XXMac XXUxMac.
4971 +: !copy XXDos,XXMac XXDosMac.
4972 +: !copy XXUnix,XXDos,XXMac XXUxDsMc.
4974 +: !cat XXUnix XXDos >XXUxDs
4975 +: !cat XXUnix XXMac >XXUxMac
4976 +: !cat XXDos XXMac >XXDosMac
4977 +: !cat XXUnix XXDos XXMac >XXUxDsMc
4980 :" try reading and writing with 'fileformats' empty
4981 :set fileformat=unix
4982 diff -Naur vim72.orig/src/testdir/test42.ok vim72/src/testdir/test42.ok
4983 --- vim72.orig/src/testdir/test42.ok 2008-02-20 12:27:37.000000000 +0000
4984 +++ vim72/src/testdir/test42.ok 2008-12-06 11:37:49.000000000 +0000
4989 - fileencoding=ucs-2le
4990 + fileencoding=utf-16le
4994 diff -Naur vim72.orig/src/testdir/test54.in vim72/src/testdir/test54.in
4995 --- vim72.orig/src/testdir/test54.in 2005-01-01 11:21:16.000000000 +0000
4996 +++ vim72/src/testdir/test54.in 2008-12-06 11:37:48.000000000 +0000
5002 -:au BufLeave <buffer> :!echo buffer-local autommand in %>> test.out
5005 +: au BufLeave <buffer> :!write sys$output "buffer-local autommand in %" > test.out
5008 +: au BufLeave <buffer> :!echo buffer-local autommand in %>> test.out
5010 :e somefile " here, autocommand for xx shall write test.out
5011 : " but autocommand shall not apply to buffer named <buffer>
5012 :bwipe xx " here, autocommand shall be auto-deleted
5013 diff -Naur vim72.orig/src/ui.c vim72/src/ui.c
5014 --- vim72.orig/src/ui.c 2008-07-14 19:14:56.000000000 +0100
5015 +++ vim72/src/ui.c 2008-12-06 11:37:50.000000000 +0000
5016 @@ -1820,7 +1820,7 @@
5018 /* Use stderr for stdin, also works for shell commands. */
5023 read_cmd_fd = 2; /* read from stderr instead of stdin */
5025 @@ -2020,7 +2020,7 @@
5027 if (value == NULL || *length == 0)
5029 - clip_free_selection(cbd); /* ??? [what's the query?] */
5030 + clip_free_selection(cbd); /* nothing received, clear register */
5031 *(int *)success = FALSE;
5034 @@ -2076,7 +2076,7 @@
5035 text_prop.value = (unsigned char *)value;
5036 text_prop.encoding = *type;
5037 text_prop.format = *format;
5038 - text_prop.nitems = STRLEN(value);
5039 + text_prop.nitems = len;
5040 status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
5041 &text_list, &n_text);
5042 if (status != Success || n_text < 1)
5043 @@ -2110,6 +2110,8 @@
5047 + time_t start_time;
5048 + int timed_out = FALSE;
5052 @@ -2129,6 +2131,7 @@
5053 case 3: type = text_atom; break;
5054 default: type = XA_STRING;
5057 XtGetSelectionValue(myShell, cbd->sel_atom, type,
5058 clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
5060 @@ -2141,27 +2144,48 @@
5061 * characters, then they will appear before the one that requested the
5062 * paste! Don't worry, we will catch up with any other events later.
5065 + start_time = time(NULL);
5066 + while (success == MAYBE)
5068 - if (XCheckTypedEvent(dpy, SelectionNotify, &event))
5070 - if (XCheckTypedEvent(dpy, SelectionRequest, &event))
5071 - /* We may get a SelectionRequest here and if we don't handle
5072 - * it we hang. KDE klipper does this, for example. */
5073 + if (XCheckTypedEvent(dpy, SelectionNotify, &event)
5074 + || XCheckTypedEvent(dpy, SelectionRequest, &event)
5075 + || XCheckTypedEvent(dpy, PropertyNotify, &event))
5077 + /* This is where clip_x11_request_selection_cb() should be
5078 + * called. It may actually happen a bit later, so we loop
5079 + * until "success" changes.
5080 + * We may get a SelectionRequest here and if we don't handle
5081 + * it we hang. KDE klipper does this, for example.
5082 + * We need to handle a PropertyNotify for large selections. */
5083 XtDispatchEvent(&event);
5087 + /* Time out after 2 to 3 seconds to avoid that we hang when the
5088 + * other process doesn't respond. Note that the SelectionNotify
5089 + * event may still come later when the selection owner comes back
5090 + * to life and the text gets inserted unexpectedly. Don't know
5091 + * why that happens or how to avoid that :-(. */
5092 + if (time(NULL) > start_time + 2)
5098 /* Do we need this? Probably not. */
5101 - /* Bernhard Walle solved a slow paste response in an X terminal by
5102 - * adding: usleep(10000); here. */
5103 + /* Wait for 1 msec to avoid that we eat up all CPU time. */
5104 + ui_delay(1L, TRUE);
5107 - /* this is where clip_x11_request_selection_cb() is actually called */
5108 - XtDispatchEvent(&event);
5111 + if (success == TRUE)
5114 + /* don't do a retry with another type after timing out, otherwise we
5115 + * hang for 15 seconds. */
5120 /* Final fallback position - use the X CUT_BUFFER0 store */
5121 diff -Naur vim72.orig/src/version.c vim72/src/version.c
5122 --- vim72.orig/src/version.c 2008-08-09 15:24:52.000000000 +0100
5123 +++ vim72/src/version.c 2008-12-06 11:37:50.000000000 +0000
5124 @@ -677,9 +677,152 @@
5125 static int included_patches[] =
5126 { /* Add new patch number below this line */
5262 + * Place to put a short description when adding a feature with a patch.
5263 + * Keep it short, e.g.,: "relative numbers", "persistent undo".
5264 + * Also add a comment marker to separate the lines.
5265 + * See the official Vim patches for the diff format: It must use a context of
5266 + * one line only. Use "diff -C2".
5268 +static char *(extra_patches[]) =
5269 +{ /* Add your patch description below this line */
5278 MSG_PUTS(_("\nRISC OS version"));
5281 - MSG_PUTS("\nOpenVMS version");
5282 + MSG_PUTS(_("\nOpenVMS version"));
5283 # ifdef HAVE_PATHDEF
5284 if (*compiled_arch != NUL)
5286 @@ -825,6 +968,19 @@
5290 + /* Print the list of extra patch descriptions if there is at least one. */
5291 + if (extra_patches[0] != NULL)
5293 + MSG_PUTS(_("\nExtra patches: "));
5295 + for (i = 0; extra_patches[i] != NULL; ++i)
5299 + MSG_PUTS(extra_patches[i]);
5305 MSG_PUTS(_("Modified by "));
5306 diff -Naur vim72.orig/src/vim.h vim72/src/vim.h
5307 --- vim72.orig/src/vim.h 2008-08-09 17:03:38.000000000 +0100
5308 +++ vim72/src/vim.h 2008-12-06 11:37:50.000000000 +0000
5309 @@ -341,8 +341,14 @@
5310 #ifdef BACKSLASH_IN_FILENAME
5311 # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<")
5313 -# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
5314 -# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
5316 + /* VMS allows a lot of characters in the file name */
5317 +# define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!")
5318 +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&")
5320 +# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
5321 +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
5325 #define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */
5327 * Define __w64 as an empty token for everything but MSVC 7.x or later.
5329 # if !defined(_MSC_VER) || (_MSC_VER < 1300)
5333 typedef unsigned long __w64 long_u;
5334 typedef long __w64 long_i;
5335 @@ -1728,7 +1734,8 @@
5336 #define VV_MOUSE_COL 51
5338 #define VV_SEARCHFORWARD 53
5339 -#define VV_LEN 54 /* number of v: vars */
5340 +#define VV_OLDFILES 54
5341 +#define VV_LEN 55 /* number of v: vars */
5343 #ifdef FEAT_CLIPBOARD
5345 @@ -1979,6 +1986,9 @@
5349 +#ifndef FEAT_NETBEANS_INTG
5352 #ifdef NBDEBUG /* Netbeans debugging. */
5353 # include "nbdebug.h"
5355 @@ -2054,4 +2064,10 @@
5356 #define DOSO_VIMRC 1 /* loading vimrc file */
5357 #define DOSO_GVIMRC 2 /* loading gvimrc file */
5359 +/* flags for read_viminfo() and children */
5360 +#define VIF_WANT_INFO 1 /* load non-mark info */
5361 +#define VIF_WANT_MARKS 2 /* load file marks */
5362 +#define VIF_FORCEIT 4 /* overwrite info already read */
5363 +#define VIF_GET_OLDFILES 8 /* load v:oldfiles */
5366 diff -Naur vim72.orig/src/window.c vim72/src/window.c
5367 --- vim72.orig/src/window.c 2008-08-06 12:00:30.000000000 +0100
5368 +++ vim72/src/window.c 2008-12-06 11:37:50.000000000 +0000
5370 # ifdef FEAT_SCROLLBIND
5371 curwin->w_p_scb = FALSE;
5373 - (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, ECMD_HIDE);
5374 + (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL,
5376 if (nchar == 'F' && lnum >= 0)
5378 curwin->w_cursor.lnum = lnum;
5379 @@ -4028,14 +4029,14 @@
5380 if (mch_dirname(cwd, MAXPATHL) == OK)
5381 globaldir = vim_strsave(cwd);
5383 - mch_chdir((char *)curwin->w_localdir);
5384 - shorten_fnames(TRUE);
5385 + if (mch_chdir((char *)curwin->w_localdir) == 0)
5386 + shorten_fnames(TRUE);
5388 else if (globaldir != NULL)
5390 /* Window doesn't have a local directory and we are not in the global
5391 * directory: Change to the global directory. */
5392 - mch_chdir((char *)globaldir);
5393 + ignored = mch_chdir((char *)globaldir);
5394 vim_free(globaldir);
5396 shorten_fnames(TRUE);
5397 diff -Naur vim72.orig/src/workshop.c vim72/src/workshop.c
5398 --- vim72.orig/src/workshop.c 2008-06-21 19:53:26.000000000 +0100
5399 +++ vim72/src/workshop.c 2008-12-06 11:37:50.000000000 +0000
5400 @@ -1121,8 +1121,12 @@
5401 ? (char *)curbuf->b_sfname : "<None>");
5404 - strcpy(ffname, (char *) curbuf->b_ffname);
5405 - *filename = ffname; /* copy so nobody can change b_ffname */
5406 + if (curbuf->b_ffname == NULL)
5409 + /* copy so nobody can change b_ffname */
5410 + strcpy(ffname, (char *) curbuf->b_ffname);
5411 + *filename = ffname;
5412 *curLine = curwin->w_cursor.lnum;
5413 *curCol = curwin->w_cursor.col;