]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/vim-7.2-fixes-4.patch
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-2.x
[ipfire-2.x.git] / src / patches / vim-7.2-fixes-4.patch
1 Submitted By: Matt Burgess <matthew_at_linuxfromscratch_dot_org>
2 Date: 2008-12-06
3 Initial Package Version: 7.2
4 Upstream Status: Already in upstream patch repo
5 Origin: Upstream
6 Description: This patch is upstream patch numbers 1 thru 65.
7
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
11 @@ -285,6 +285,7 @@
12 src/proto/os_win32.pro \
13 src/proto/os_mswin.pro \
14 src/testdir/Make_dos.mak \
15 + src/testdir/Make_ming.mak \
16 src/testdir/dos.vim \
17 src/uninstal.c \
18 src/vim.def \
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
22 @@ -1,4 +1,4 @@
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
25
26
27 VIM REFERENCE MANUAL by Bram Moolenaar
28 @@ -157,6 +157,11 @@
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
34 + too.
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
40 @@ -730,19 +735,29 @@
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
60 + number. *E809*
61 + {only when compiled with the +eval and +viminfo features}
62 +
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|.
66 +
67 +The "#<n" item returns an absolute path, but it will start with "~/" for files
68 +below your home directory.
69 +
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): >
75 :!ls "%"
76 :r !spell "%"
77
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
81 @@ -1,4 +1,4 @@
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
84
85
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.
90
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}
101 +
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')
129 <
130 - *glob()*
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>
137 characters.
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.
146
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.
150
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
164 error message.
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.
171
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,
177 term: empty 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"
185 "bold" "1" if bold
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
191 @@ -1,4 +1,4 @@
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
194
195
196 VIM REFERENCE MANUAL by Bram Moolenaar
197 @@ -7472,7 +7472,9 @@
198 {not available when compiled without the |+wildignore|
199 feature}
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|.
206 Also see 'suffixes'.
207 Example: >
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
211 @@ -1,4 +1,4 @@
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
214
215
216 VIM REFERENCE MANUAL
217 @@ -312,7 +312,7 @@
218
219 8. Useful notes *vms-notes*
220
221 -8.1 backspace/delete
222 +8.1 Backspace/delete
223 8.2 Filters
224 8.3 VMS file version numbers
225 8.4 Directory conversion
226 @@ -326,8 +326,10 @@
227 8.12 diff-mode
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
232
233 -8.1 backspace/delete
234 +8.1 Backspace/delete
235
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 @@
239
240 (Thomas.R.Wyant III, Vim 6.1)
241
242 +8.14 Slow start in console mode issue
243 +
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.
248 +
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: >
251 +
252 + |- vim72
253 + |----- doc
254 + |----- syntax
255 + vimrc (system rc files)
256 + gvimrc
257 + gvim.exe (the remaned GUI or GTK built vim.exe)
258 + vim.exe (the console only executable)
259 +
260 +Define system symbols like below in for ex in LOGIN.COM or SYLOGIN.COM: >
261 +
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
267 +
268 +
269 +Like this, users that do not have X environment and want to use Vim just in
270 +console mode can avoid performance problems.
271 +
272 +(Zoltan Arpadffy, Vim 7.2)
273 +
274 +8.15 Common VIM directory - different architectures
275 +
276 +In a cluster that contains nodes with different architectures like below:
277 +
278 +$show cluster
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 ++---------------------------------+
289 +
290 +It is convinient to have a common VIM directory but execute different
291 +executables.
292 +There are more solutions for this problem:
293 +
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: >
297 +
298 + $ if f$getsyi("NODE_HWTYPE") .eqs. "VAX"
299 + $ then
300 + $ say "VAX platform"
301 + $ vi*m:== mcr vim:VIM.EXE_VAX
302 + $ endif
303 + $ if f$getsyi("NODE_HWTYPE") .eqs. "ALPH"
304 + $ then
305 + $ say "ALPHA platform"
306 + $ vi*m :== mcr vim:VIM.EXE_AXP
307 + $ endif
308 + $ if f$getsyi("ARCH_NAME") .eqs. "IA64"
309 + $ then
310 + $ say "IA64 platform"
311 + $ vi*m :== mcr vim:VIM.EXE_IA64
312 + $ endif
313 +
314 +solution 2. different directories: >
315 +
316 + $ if f$getsyi("NODE_HWTYPE") .eqs. "VAX"
317 + $ then
318 + $ say "VAX platform"
319 + $ define/nolog VIM RF10:[UTIL.VAX_EXE] ! VAX executables
320 + $ endif
321 + $ if f$getsyi("NODE_HWTYPE") .eqs. "ALPH"
322 + $ then
323 + $ say "ALPHA platform"
324 + $ define/nolog VIM RF10:[UTIL.AXP_EXE] ! AXP executables
325 + $ endif
326 + $ if f$getsyi("ARCH_NAME") .eqs. "IA64"
327 + $ then
328 + $ say "IA64 platform"
329 + $ define/nolog VIM RF10:[UTIL.IA64_EXE] ! IA64 executables
330 + $ endif
331 + $! VIMRUNTIME must be defined in order to find runtime files
332 + $ define/nolog VIMRUNTIME RF10:[UTIL.VIM72]
333 +
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/
336 +
337 +(Zoltan Arpadffy, Vim 7.2)
338 +
339 ==============================================================================
340
341 9. VMS related changes *vms-changes*
342
343 -Version 7
344 +Recent 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
354 +
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)
359 +
360 +Version 7.1 (2007 Jun 15)
361 +- create TAGS file from menu
362 +
363 +Version 7 (2006 May 8)
364 - Improved low level char input (affects just console mode)
365 +- Fixed plugin bug
366 +- CTAGS 5.6 included
367
368 Version 6.4 (2005 Oct 15)
369 - GTKLIB and Vim build on IA64
370 @@ -806,6 +926,7 @@
371
372 OpenVMS documentation and executables are maintained by:
373 Zoltan Arpadffy <arpadffy@polarhome.com>
374 +OpenVMS Vim page: http://www.polarhome.com/vim/
375
376 This document uses parts and remarks from earlier authors and contributors
377 of OS_VMS.TXT:
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
381 @@ -1,4 +1,4 @@
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
384
385
386 VIM REFERENCE MANUAL by Bram Moolenaar
387 @@ -831,8 +831,11 @@
388
389 # comment line ~
390
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:
396 +
397 + KEEPCASE = # fix case for words with this flag ~
398
399
400 ENCODING *spell-SET*
401 @@ -965,6 +968,9 @@
402
403 Note: When using utf-8 only characters up to 65000 may be used for flags.
404
405 +Note: even when using "num" or "long" the number of flags available to
406 +compounding and prefixes is limited to about 250.
407 +
408
409 AFFIXES
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.
414
415 + *spell-FORBIDDENWORD*
416 +FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell.
417 +
418 *spell-NEEDAFFIX*
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 @@
422
423 NEEDCOMPOUND & ~
424
425 + *spell-ONLYINCOMPOUND*
426 +The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for
427 +compatiblity with Hunspell.
428 +
429 *spell-COMPOUNDMIN*
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
434 word.
435
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.
439 +For example:
440 + CHECKCOMPOUNDPATTERN o e ~
441 +
442 +This forbids compounding if the first word ends in "o" and the second word
443 +starts with "e".
444 +
445 +The arguments must be plain text, no patterns are actually supported, despite
446 +the item name. Case is always ignored.
447 +
448 +The Hunspell feature to use three arguments and flags is not supported.
449 +
450 *spell-SYLLABLE*
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|
456
457 +BREAK (Hunspell) *spell-BREAK*
458 + Define break points. Unclear how it works exactly.
459 + Not supported.
460 +
461 CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE*
462 Disallow uppercase letters at compound word boundaries.
463 Not supported.
464 @@ -1512,9 +1543,6 @@
465 Forbid three identical characters when compounding. Not
466 supported.
467
468 -CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN*
469 - Forbid compounding when patterns match. Not supported.
470 -
471 COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES*
472 Enables using two prefixes. Not supported.
473
474 @@ -1536,13 +1564,18 @@
475 COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
476 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
477
478 +COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES*
479 + Number of COMPOUNDRULE lines following. Ignored, but the
480 + argument must be a number.
481 +
482 COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
483 Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
484 |spell-COMPOUNDSYLMAX|
485
486 -FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD*
487 - Use BAD instead. |spell-BAD|
488 -
489 +KEY (Hunspell) *spell-KEY*
490 + Define characters that are close together on the keyboard.
491 + Used to give better suggestions. Not supported.
492 +
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.
498
499 MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
500 - Not supported.
501 -
502 -ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND*
503 - Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND|
504 + Set number of n-gram suggestions. Not supported.
505
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
511 @@ -1,4 +1,4 @@
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
514
515
516 VIM REFERENCE MANUAL by Bram Moolenaar
517 @@ -1337,8 +1337,9 @@
518 *viminfo-read*
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.
526
527 *viminfo-write*
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
534 +has marks for.
535
536 *viminfo-file-marks*
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}
546
547 *:wv* *:wviminfo* *E137* *E138* *E574*
548 :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
549 @@ -1479,4 +1482,20 @@
550 the .viminfo file.
551 {not in Vi}
552
553 + *:ol* *:oldfiles*
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}
559 +
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}
568 +
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
573 @@ -1,4 +1,4 @@
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
576
577 VIM USER MANUAL - by Bram Moolenaar
578
579 @@ -153,7 +153,7 @@
580 to be lost. Each item can be remembered only once.
581
582
583 -GETTING BACK TO WHERE YOU WERE
584 +GETTING BACK TO WHERE YOU STOPPED VIM
585
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
588 @@ -168,6 +168,48 @@
589 The |:marks| command is useful to find out where '0 to '9 will take you.
590
591
592 +GETTING BACK TO SOME FILE
593 +
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: >
597 +
598 + :oldfiles
599 +< 1: ~/.viminfo ~
600 + 2: ~/text/resume.txt ~
601 + 3: /tmp/draft ~
602 +
603 +Now you would like to edit the second file, which is in the list preceded by
604 +"2:". You type: >
605 +
606 + :e #<2
607 +
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
611 +file: >
612 +
613 + :split #<3
614 +
615 +That #<123 thing is a bit complicated when you just want to edit a file.
616 +Fortunately there is a simpler way: >
617 +
618 + :browse oldfiles
619 +< 1: ~/.viminfo ~
620 + 2: ~/text/resume.txt ~
621 + 3: /tmp/draft ~
622 + -- More --
623 +
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:
626 +
627 + Type number and <Enter> (empty cancels): ~
628 +
629 +Type "2" and press <Enter> to edit the second file.
630 +
631 +More info at |:oldfiles|, |v:oldfiles| and |c_#<|.
632 +
633 +
634 MOVE INFO FROM ONE VIM TO ANOTHER
635
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
640 @@ -234,6 +234,10 @@
641 elseif s:line1 =~ '\<DTD\s\+XHTML\s'
642 set ft=xhtml
643
644 + " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
645 + elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
646 + set ft=html
647 +
648 " PDF
649 elseif s:line1 =~ '^%PDF-'
650 set ft=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"
656 fi
657
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'"
667 - fi
668 -fi
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; }
673 + else
674 + { $as_echo "$as_me:$LINENO: result: no" >&5
675 $as_echo "no" >&6; }
676 -else
677 - { $as_echo "$as_me:$LINENO: result: yes" >&5
678 + fi
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; }
685 + else
686 + { $as_echo "$as_me:$LINENO: result: no" >&5
687 +$as_echo "no" >&6; }
688 + fi
689 fi
690
691
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
695 @@ -33,7 +33,7 @@
696 static char_u *fname_match __ARGS((regprog_T *prog, char_u *name));
697 #endif
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));
701 #ifdef UNIX
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));
704 @@ -647,6 +647,9 @@
705 vim_free(buf->b_start_fenc);
706 buf->b_start_fenc = NULL;
707 #endif
708 +#ifdef FEAT_SPELL
709 + ga_clear(&buf->b_langp);
710 +#endif
711 }
712
713 /*
714 @@ -1090,7 +1093,7 @@
715 #endif
716 setpcmark();
717 retval = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE,
718 - forceit ? ECMD_FORCEIT : 0);
719 + forceit ? ECMD_FORCEIT : 0, curwin);
720
721 /*
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))
726 return OK;
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))
731 return OK;
732 @@ -1313,7 +1316,7 @@
733 setpcmark();
734 if (!cmdmod.keepalt)
735 curwin->w_alt_fnum = curbuf->b_fnum; /* remember alternate file */
736 - buflist_altfpos(); /* remember curpos */
737 + buflist_altfpos(curwin); /* remember curpos */
738
739 #ifdef FEAT_VISUAL
740 /* Don't restart Select mode after switching to another buffer. */
741 @@ -1351,11 +1354,12 @@
742 }
743 }
744 #ifdef FEAT_AUTOCMD
745 + /* An autocommand may have deleted "buf", already entered it (e.g., when
746 + * it did ":bunload") or aborted the script processing! */
747 # ifdef FEAT_EVAL
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())
751 # else
752 - if (buf_valid(buf)) /* an autocommand may have deleted buf! */
753 + if (buf_valid(buf) && buf != curbuf)
754 # endif
755 #endif
756 enter_buffer(buf);
757 @@ -1397,6 +1401,9 @@
758 curwin->w_cursor.coladd = 0;
759 #endif
760 curwin->w_set_curswant = TRUE;
761 +#ifdef FEAT_AUTOCMD
762 + curwin->w_topline_was_set = FALSE;
763 +#endif
764
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 @@
768 maketitle();
769 #endif
770 #ifdef FEAT_AUTOCMD
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)
774 #endif
775 scroll_cursor_halfway(FALSE); /* redisplay at correct position */
776
777 @@ -2400,22 +2408,70 @@
778 return;
779 }
780
781 +#ifdef FEAT_DIFF
782 +static int wininfo_other_tab_diff __ARGS((wininfo_T *wip));
783 +
784 +/*
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.
787 + */
788 + static int
789 +wininfo_other_tab_diff(wip)
790 + wininfo_T *wip;
791 +{
792 + win_T *wp;
793 +
794 + if (wip->wi_opt.wo_diff)
795 + {
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)
800 + return FALSE;
801 + return TRUE;
802 + }
803 + return FALSE;
804 +}
805 +#endif
806 +
807 /*
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.
813 */
814 +/*ARGSUSED*/
815 static wininfo_T *
816 -find_wininfo(buf)
817 +find_wininfo(buf, skip_diff_buffer)
818 buf_T *buf;
819 + int skip_diff_buffer;
820 {
821 wininfo_T *wip;
822
823 for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
824 - if (wip->wi_win == curwin)
825 + if (wip->wi_win == curwin
826 +#ifdef FEAT_DIFF
827 + && (!skip_diff_buffer || !wininfo_other_tab_diff(wip))
828 +#endif
829 + )
830 break;
831 - if (wip == NULL) /* if no fpos for curwin, use the first in the list */
832 - wip = buf->b_wininfo;
833 +
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). */
836 + if (wip == NULL)
837 + {
838 +#ifdef FEAT_DIFF
839 + if (skip_diff_buffer)
840 + {
841 + for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
842 + if (!wininfo_other_tab_diff(wip))
843 + break;
844 + }
845 + else
846 +#endif
847 + wip = buf->b_wininfo;
848 + }
849 return wip;
850 }
851
852 @@ -2436,7 +2492,7 @@
853 clearFolding(curwin);
854 #endif
855
856 - wip = find_wininfo(buf);
857 + wip = find_wininfo(buf, TRUE);
858 if (wip != NULL && wip->wi_optset)
859 {
860 copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt);
861 @@ -2468,7 +2524,7 @@
862 wininfo_T *wip;
863 static pos_T no_position = {1, 0};
864
865 - wip = find_wininfo(buf);
866 + wip = find_wininfo(buf, FALSE);
867 if (wip != NULL)
868 return &(wip->wi_fpos);
869 else
870 @@ -2789,14 +2845,14 @@
871 #endif
872
873 /*
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.
877 */
878 void
879 -buflist_altfpos()
880 +buflist_altfpos(win)
881 + win_T *win;
882 {
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);
886 }
887
888 /*
889 @@ -3963,7 +4019,7 @@
890 width = vim_strsize(out);
891 if (maxwidth > 0 && width > maxwidth)
892 {
893 - /* Result is too long, must trunctate somewhere. */
894 + /* Result is too long, must truncate somewhere. */
895 l = 0;
896 if (itemcnt == 0)
897 s = out;
898 @@ -4488,7 +4544,7 @@
899 ECMD_ONE,
900 ((P_HID(curwin->w_buffer)
901 || bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0)
902 - + ECMD_OLDBUF);
903 + + ECMD_OLDBUF, curwin);
904 #ifdef FEAT_AUTOCMD
905 if (use_firstwin)
906 ++autocmd_no_leave;
907 @@ -5062,7 +5118,7 @@
908 {
909 if (buf->b_sfname != NULL)
910 return (char *)buf->b_sfname;
911 - return "[Scratch]";
912 + return _("[Scratch]");
913 }
914 #endif
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'"
930 + AC_MSG_RESULT(yes)
931 + else
932 + AC_MSG_RESULT(no)
933 + fi
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"
939 + AC_MSG_RESULT(yes)
940 + else
941 + AC_MSG_RESULT(no)
942 fi
943 -fi
944 -if test "$DEPEND_CFLAGS_FILTER" = ""; then
945 - AC_MSG_RESULT(no)
946 -else
947 - AC_MSG_RESULT(yes)
948 fi
949 AC_SUBST(DEPEND_CFLAGS_FILTER)
950
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
954 @@ -73,6 +73,8 @@
955 {
956 tp->tp_diffbuf[i] = NULL;
957 tp->tp_diff_invalid = TRUE;
958 + if (tp == curtab)
959 + diff_redraw(TRUE);
960 }
961 }
962 }
963 @@ -102,6 +104,7 @@
964 {
965 curtab->tp_diffbuf[i] = NULL;
966 curtab->tp_diff_invalid = TRUE;
967 + diff_redraw(TRUE);
968 }
969 }
970 }
971 @@ -131,6 +134,7 @@
972 {
973 curtab->tp_diffbuf[i] = buf;
974 curtab->tp_diff_invalid = TRUE;
975 + diff_redraw(TRUE);
976 return;
977 }
978
979 @@ -661,6 +665,7 @@
980 char_u *tmp_diff;
981 FILE *fd;
982 int ok;
983 + int io_error = FALSE;
984
985 /* Delete all diffblocks. */
986 diff_clear(curtab);
987 @@ -697,18 +702,26 @@
988 {
989 ok = FALSE;
990 fd = mch_fopen((char *)tmp_orig, "w");
991 - if (fd != NULL)
992 + if (fd == NULL)
993 + io_error = TRUE;
994 + else
995 {
996 - fwrite("line1\n", (size_t)6, (size_t)1, fd);
997 + if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1)
998 + io_error = TRUE;
999 fclose(fd);
1000 fd = mch_fopen((char *)tmp_new, "w");
1001 - if (fd != NULL)
1002 + if (fd == NULL)
1003 + io_error = TRUE;
1004 + else
1005 {
1006 - fwrite("line2\n", (size_t)6, (size_t)1, fd);
1007 + if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1)
1008 + io_error = TRUE;
1009 fclose(fd);
1010 diff_file(tmp_orig, tmp_new, tmp_diff);
1011 fd = mch_fopen((char *)tmp_diff, "r");
1012 - if (fd != NULL)
1013 + if (fd == NULL)
1014 + io_error = TRUE;
1015 + else
1016 {
1017 char_u linebuf[LBUFLEN];
1018
1019 @@ -761,6 +774,8 @@
1020 }
1021 if (!ok)
1022 {
1023 + if (io_error)
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 @@
1029 {
1030 # ifdef TEMPDIRNAMES
1031 if (vim_tempdir != NULL)
1032 - mch_chdir((char *)vim_tempdir);
1033 + ignored = mch_chdir((char *)vim_tempdir);
1034 else
1035 # endif
1036 - mch_chdir("/tmp");
1037 + ignored = mch_chdir("/tmp");
1038 shorten_fnames(TRUE);
1039 }
1040 #endif
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
1044 @@ -348,6 +348,7 @@
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},
1049 };
1050
1051 /* shorthand */
1052 @@ -355,6 +356,7 @@
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
1058
1059 /*
1060 @@ -426,7 +428,6 @@
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 @@
1069 p = &vimvars[i];
1070 if (p->vv_di.di_tv.v_type == VAR_STRING)
1071 {
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);
1075 + p->vv_str = NULL;
1076 + }
1077 + else if (p->vv_di.di_tv.v_type == VAR_LIST)
1078 + {
1079 + list_unref(p->vv_list);
1080 + p->vv_list = NULL;
1081 }
1082 }
1083 hash_clear(&vimvarht);
1084 + hash_init(&vimvarht); /* garbage_collect() will access it */
1085 hash_clear(&compat_hashtab);
1086
1087 /* script-local variables */
1088 @@ -1256,23 +1263,26 @@
1089
1090 /*
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.
1095 */
1096 char_u *
1097 -eval_to_string(arg, nextcmd, dolist)
1098 +eval_to_string(arg, nextcmd, convert)
1099 char_u *arg;
1100 char_u **nextcmd;
1101 - int dolist; /* turn List into sequence of lines */
1102 + int convert;
1103 {
1104 typval_T tv;
1105 char_u *retval;
1106 garray_T ga;
1107 + char_u numbuf[NUMBUFLEN];
1108
1109 if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
1110 retval = NULL;
1111 else
1112 {
1113 - if (dolist && tv.v_type == VAR_LIST)
1114 + if (convert && tv.v_type == VAR_LIST)
1115 {
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;
1121 }
1122 +#ifdef FEAT_FLOAT
1123 + else if (convert && tv.v_type == VAR_FLOAT)
1124 + {
1125 + vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
1126 + retval = vim_strsave(numbuf);
1127 + }
1128 +#endif
1129 else
1130 retval = vim_strsave(get_tv_string(&tv));
1131 clear_tv(&tv);
1132 @@ -3277,7 +3294,7 @@
1133
1134 if (*startarg != '(')
1135 {
1136 - EMSG2(_("E107: Missing braces: %s"), eap->arg);
1137 + EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
1138 goto end;
1139 }
1140
1141 @@ -3657,8 +3674,8 @@
1142 }
1143
1144 /*
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.
1149 */
1150 static int
1151 tv_islocked(tv)
1152 @@ -6047,6 +6064,25 @@
1153 }
1154
1155 /*
1156 + * Get list item "l[idx - 1]" as a string. Returns NULL for failure.
1157 + */
1158 + char_u *
1159 +list_find_str(l, idx)
1160 + list_T *l;
1161 + long idx;
1162 +{
1163 + listitem_T *li;
1164 +
1165 + li = list_find(l, idx - 1);
1166 + if (li == NULL)
1167 + {
1168 + EMSGN(_(e_listidx), idx);
1169 + return NULL;
1170 + }
1171 + return get_tv_string(&li->li_tv);
1172 +}
1173 +
1174 +/*
1175 * Locate "item" list "l" and return its index.
1176 * Returns -1 when "item" is not in the list.
1177 */
1178 @@ -6137,7 +6173,7 @@
1179 * When "len" >= 0 use "str[len]".
1180 * Returns FAIL when out of memory.
1181 */
1182 - static int
1183 + int
1184 list_append_string(l, str, len)
1185 list_T *l;
1186 char_u *str;
1187 @@ -6497,6 +6533,9 @@
1188 set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
1189 }
1190
1191 + /* v: vars */
1192 + set_ref_in_ht(&vimvarht, copyID);
1193 +
1194 /*
1195 * 2. Go through the list of dicts and free items without the copyID.
1196 */
1197 @@ -6587,7 +6626,7 @@
1198 {
1199 case VAR_DICT:
1200 dd = tv->vval.v_dict;
1201 - if (dd->dv_copyID != copyID)
1202 + if (dd != NULL && dd->dv_copyID != copyID)
1203 {
1204 /* Didn't see this dict yet. */
1205 dd->dv_copyID = copyID;
1206 @@ -6597,7 +6636,7 @@
1207
1208 case VAR_LIST:
1209 ll = tv->vval.v_list;
1210 - if (ll->lv_copyID != copyID)
1211 + if (ll != NULL && ll->lv_copyID != copyID)
1212 {
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 @@
1227 else
1228 {
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);
1243 else
1244 {
1245 @@ -10602,7 +10642,7 @@
1246 # ifdef FEAT_WINDOWS
1247 win_T *wp;
1248 # endif
1249 - int n = 1;
1250 + int winnr = 1;
1251
1252 if (row >= 0 && col >= 0)
1253 {
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)
1258 - ++n;
1259 + ++winnr;
1260 # endif
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;
1265 }
1266 @@ -11284,13 +11324,25 @@
1267 typval_T *argvars;
1268 typval_T *rettv;
1269 {
1270 + int flags = WILD_SILENT|WILD_USE_NL;
1271 expand_T xpc;
1272 + int error = FALSE;
1273
1274 - ExpandInit(&xpc);
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);
1284 + if (!error)
1285 + {
1286 + ExpandInit(&xpc);
1287 + xpc.xp_context = EXPAND_FILES;
1288 + rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1289 + NULL, flags, WILD_ALL);
1290 + }
1291 + else
1292 + rettv->vval.v_string = NULL;
1293 }
1294
1295 /*
1296 @@ -11301,14 +11353,22 @@
1297 typval_T *argvars;
1298 typval_T *rettv;
1299 {
1300 + int flags = 0;
1301 char_u buf1[NUMBUFLEN];
1302 char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
1303 + int error = FALSE;
1304
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;
1311 - if (file == NULL)
1312 + if (file == NULL || error)
1313 rettv->vval.v_string = NULL;
1314 else
1315 - rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
1316 + rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
1317 + flags);
1318 }
1319
1320 /*
1321 @@ -15838,10 +15898,9 @@
1322 if (res == FAIL)
1323 res = ITEM_COMPARE_FAIL;
1324 else
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 */
1330 clear_tv(&rettv);
1331 return res;
1332 }
1333 @@ -16590,8 +16649,11 @@
1334 p = highlight_has_attr(id, HL_INVERSE, modec);
1335 break;
1336
1337 - case 's': /* standout */
1338 - p = highlight_has_attr(id, HL_STANDOUT, modec);
1339 + case 's':
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);
1344 break;
1345
1346 case 'u':
1347 @@ -16658,7 +16720,7 @@
1348 col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
1349
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)
1354 {
1355 (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
1356 @@ -18097,14 +18159,28 @@
1357 }
1358
1359 /*
1360 - * Set v:count, v:count1 and v:prevcount.
1361 + * Get List v: variable value. Caller must take care of reference count when
1362 + * needed.
1363 + */
1364 + list_T *
1365 +get_vim_var_list(idx)
1366 + int idx;
1367 +{
1368 + return vimvars[idx].vv_list;
1369 +}
1370 +
1371 +/*
1372 + * Set v:count to "count" and v:count1 to "count1".
1373 + * When "set_prevcount" is TRUE first set v:prevcount from v:count.
1374 */
1375 void
1376 -set_vcount(count, count1)
1377 +set_vcount(count, count1, set_prevcount)
1378 long count;
1379 long count1;
1380 + int set_prevcount;
1381 {
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;
1387 }
1388 @@ -18132,6 +18208,20 @@
1389 }
1390
1391 /*
1392 + * Set List v: variable to "val".
1393 + */
1394 + void
1395 +set_vim_var_list(idx, val)
1396 + int idx;
1397 + list_T *val;
1398 +{
1399 + list_unref(vimvars[idx].vv_list);
1400 + vimvars[idx].vv_list = val;
1401 + if (val != NULL)
1402 + ++val->lv_refcount;
1403 +}
1404 +
1405 +/*
1406 * Set v:register if needed.
1407 */
1408 void
1409 @@ -20590,6 +20680,9 @@
1410 int st_len = 0;
1411
1412 todo = (int)func_hashtab.ht_used;
1413 + if (todo == 0)
1414 + return; /* nothing to dump */
1415 +
1416 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
1417
1418 for (hi = func_hashtab.ht_array; todo > 0; ++hi)
1419 @@ -20638,6 +20731,8 @@
1420 prof_self_cmp);
1421 prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
1422 }
1423 +
1424 + vim_free(sorttab);
1425 }
1426
1427 static void
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");
1436 + name = v->di_key;
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))
1447 {
1448 ++fp->uf_tm_count;
1449 profile_start(&call_start);
1450 @@ -21235,13 +21333,13 @@
1451
1452 #ifdef FEAT_PROFILE
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)))
1456 {
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)
1463 {
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 @@
1467 }
1468 }
1469
1470 +/*
1471 + * List v:oldfiles in a nice way.
1472 + */
1473 +/*ARGSUSED*/
1474 + void
1475 +ex_oldfiles(eap)
1476 + exarg_T *eap;
1477 +{
1478 + list_T *l = vimvars[VV_OLDFILES].vv_list;
1479 + listitem_T *li;
1480 + int nr = 0;
1481 +
1482 + if (l == NULL)
1483 + msg((char_u *)_("No old files"));
1484 + else
1485 + {
1486 + msg_start();
1487 + msg_scroll = TRUE;
1488 + for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
1489 + {
1490 + msg_outnum((long)++nr);
1491 + MSG_PUTS(": ");
1492 + msg_outtrans(get_tv_string(&li->li_tv));
1493 + msg_putchar('\n');
1494 + out_flush(); /* output one line at a time */
1495 + ui_breakcheck();
1496 + }
1497 + /* Assume "got_int" was set to truncate the listing. */
1498 + got_int = FALSE;
1499 +
1500 +#ifdef FEAT_BROWSE_CMD
1501 + if (cmdmod.browse)
1502 + {
1503 + quit_more = FALSE;
1504 + nr = prompt_for_number(FALSE);
1505 + msg_starthere();
1506 + if (nr > 0)
1507 + {
1508 + char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
1509 + (long)nr);
1510 +
1511 + if (p != NULL)
1512 + {
1513 + p = expand_env_save(p);
1514 + eap->arg = p;
1515 + eap->cmdidx = CMD_edit;
1516 + cmdmod.browse = FALSE;
1517 + do_exedit(eap, NULL);
1518 + vim_free(p);
1519 + }
1520 + }
1521 + }
1522 +#endif
1523 + }
1524 +}
1525 +
1526 #endif /* FEAT_EVAL */
1527
1528
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,
1535 eap, ECMD_LAST,
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 @@
1544 verbose_leave();
1545 }
1546 #ifdef STARTUPTIME
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);
1551 time_pop(&tv_rel);
1552 #endif
1553
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
1557 @@ -24,7 +24,7 @@
1558 static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out));
1559 #ifdef FEAT_VIMINFO
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));
1565 #endif
1566 @@ -1676,14 +1676,12 @@
1567
1568 /*
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
1572 */
1573 int
1574 -read_viminfo(file, want_info, want_marks, forceit)
1575 - char_u *file;
1576 - int want_info;
1577 - int want_marks;
1578 - int 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. */
1582 {
1583 FILE *fp;
1584 char_u *fname;
1585 @@ -1691,7 +1689,7 @@
1586 if (no_viminfo())
1587 return FAIL;
1588
1589 - fname = viminfo_filename(file); /* may set to default if NULL */
1590 + fname = viminfo_filename(file); /* get file name in allocated buffer */
1591 if (fname == NULL)
1592 return FAIL;
1593 fp = mch_fopen((char *)fname, READBIN);
1594 @@ -1701,8 +1699,9 @@
1595 verbose_enter();
1596 smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
1597 fname,
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") : "");
1604 verbose_leave();
1605 }
1606 @@ -1712,10 +1711,9 @@
1607 return FAIL;
1608
1609 viminfo_errcnt = 0;
1610 - do_viminfo(fp, NULL, want_info, want_marks, forceit);
1611 + do_viminfo(fp, NULL, flags);
1612
1613 fclose(fp);
1614 -
1615 return OK;
1616 }
1617
1618 @@ -1943,7 +1941,7 @@
1619 * root.
1620 */
1621 if (fp_out != NULL)
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);
1624 #endif
1625 }
1626 }
1627 @@ -1968,7 +1966,7 @@
1628 }
1629
1630 viminfo_errcnt = 0;
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));
1633
1634 fclose(fp_out); /* errors are ignored !? */
1635 if (fp_in != NULL)
1636 @@ -2041,12 +2039,10 @@
1637 * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
1638 */
1639 static void
1640 -do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
1641 +do_viminfo(fp_in, fp_out, flags)
1642 FILE *fp_in;
1643 FILE *fp_out;
1644 - int want_info;
1645 - int want_marks;
1646 - int force_read;
1647 + int flags;
1648 {
1649 int count = 0;
1650 int eof = FALSE;
1651 @@ -2061,8 +2057,9 @@
1652
1653 if (fp_in != NULL)
1654 {
1655 - if (want_info)
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);
1660 else
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);
1666 }
1667 - if (fp_in != NULL && want_marks)
1668 - copy_viminfo_marks(&vir, fp_out, count, eof);
1669 + if (fp_in != NULL
1670 + && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
1671 + copy_viminfo_marks(&vir, fp_out, count, eof, flags);
1672
1673 vim_free(vir.vir_line);
1674 #ifdef FEAT_MBYTE
1675 @@ -3054,7 +3052,8 @@
1676 retval = 0; /* it's in the same file */
1677 }
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),
1681 + curwin) == OK)
1682 retval = -1; /* opened another file */
1683 else
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.
1692 *
1693 * return FAIL for failure, OK otherwise
1694 */
1695 int
1696 -do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
1697 +do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
1698 int fnum;
1699 char_u *ffname;
1700 char_u *sfname;
1701 exarg_T *eap; /* can be NULL! */
1702 linenr_T newlnum;
1703 int flags;
1704 + win_T *oldwin;
1705 {
1706 int other_file; /* TRUE if editing another file */
1707 int oldbuf; /* TRUE if using existing buffer */
1708 @@ -3269,7 +3272,8 @@
1709 {
1710 if (!cmdmod.keepalt)
1711 curwin->w_alt_fnum = curbuf->b_fnum;
1712 - buflist_altfpos();
1713 + if (oldwin != NULL)
1714 + buflist_altfpos(oldwin);
1715 }
1716
1717 if (fnum)
1718 @@ -3373,7 +3377,7 @@
1719
1720 /* close the link to the current buffer */
1721 u_sync(FALSE);
1722 - close_buffer(curwin, curbuf,
1723 + close_buffer(oldwin, curbuf,
1724 (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD);
1725
1726 #ifdef FEAT_AUTOCMD
1727 @@ -5059,6 +5063,7 @@
1728
1729 if (did_sub)
1730 ++sub_nlines;
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;
1734 }
1735 @@ -5610,7 +5615,13 @@
1736 */
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 */
1743 +#else
1744 + curwin
1745 +#endif
1746 + );
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
1753 @@ -278,7 +278,7 @@
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,
1760 BANG|TRLBAR|WORD1),
1761 EX(CMD_cunmap, "cunmap", ex_unmap,
1762 @@ -506,7 +506,7 @@
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,
1771 @@ -635,6 +635,8 @@
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,
1780 @@ -651,6 +653,8 @@
1781 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
1782 EX(CMD_open, "open", ex_open,
1783 RANGE|EXTRA),
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,
1789 @@ -802,7 +806,7 @@
1790 EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
1791 WORD1|TRLBAR|CMDWIN),
1792 EX(CMD_scscope, "scscope", do_scscope,
1793 - EXTRA|NOTRLCOM|SBOXOK),
1794 + EXTRA|NOTRLCOM),
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
1801 @@ -364,6 +364,7 @@
1802 # define ex_function ex_ni
1803 # define ex_delfunction ex_ni
1804 # define ex_return ex_ni
1805 +# define ex_oldfiles ex_ni
1806 #endif
1807 static char_u *arg_all __ARGS((void));
1808 #ifdef FEAT_SESSION
1809 @@ -1770,7 +1771,7 @@
1810 }
1811 if (checkforcmd(&ea.cmd, "browse", 3))
1812 {
1813 -#ifdef FEAT_BROWSE
1814 +#ifdef FEAT_BROWSE_CMD
1815 cmdmod.browse = TRUE;
1816 #endif
1817 continue;
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);
1828
1829 case CMD_doautocmd:
1830 + case CMD_doautoall:
1831 return set_context_in_autocmd(xp, arg, TRUE);
1832 #endif
1833 case CMD_set:
1834 @@ -7485,7 +7488,8 @@
1835 /* ":new" or ":tabnew" without argument: edit an new empty buffer */
1836 setpcmark();
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);
1841 }
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 )
1847 #endif
1848 - ) == FAIL)
1849 + , old_curwin == NULL ? curwin : NULL) == FAIL)
1850 {
1851 /* Editing the file failed. If the window was split, close it. */
1852 #ifdef FEAT_WINDOWS
1853 @@ -8749,8 +8753,8 @@
1854 else if (*dirnow != NUL
1855 && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
1856 {
1857 - (void)mch_chdir((char *)globaldir);
1858 - shorten_fnames(TRUE);
1859 + if (mch_chdir((char *)globaldir) == OK)
1860 + shorten_fnames(TRUE);
1861 }
1862
1863 failed |= (makeopens(fd, dirnow) == FAIL);
1864 @@ -9506,24 +9510,50 @@
1865 break;
1866 }
1867 s = src + 1;
1868 + if (*s == '<') /* "#<99" uses v:oldfiles */
1869 + ++s;
1870 i = (int)getdigits(&s);
1871 *usedlen = (int)(s - src); /* length of what we expand */
1872
1873 - buf = buflist_findnr(i);
1874 - if (buf == NULL)
1875 + if (src[1] == '<')
1876 {
1877 - *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
1878 + if (*usedlen < 2)
1879 + {
1880 + /* Should we give an error message for #<text? */
1881 + *usedlen = 1;
1882 + return NULL;
1883 + }
1884 +#ifdef FEAT_EVAL
1885 + result = list_find_str(get_vim_var_list(VV_OLDFILES),
1886 + (long)i);
1887 + if (result == NULL)
1888 + {
1889 + *errormsg = (char_u *)"";
1890 + return NULL;
1891 + }
1892 +#else
1893 + *errormsg = (char_u *)_("E809: #< is not available without the +eval feature");
1894 return NULL;
1895 +#endif
1896 }
1897 - if (lnump != NULL)
1898 - *lnump = ECMD_LAST;
1899 - if (buf->b_fname == NULL)
1900 + else
1901 {
1902 - result = (char_u *)"";
1903 - valid = 0; /* Must have ":p:h" to be valid */
1904 + buf = buflist_findnr(i);
1905 + if (buf == NULL)
1906 + {
1907 + *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
1908 + return NULL;
1909 + }
1910 + if (lnump != NULL)
1911 + *lnump = ECMD_LAST;
1912 + if (buf->b_fname == NULL)
1913 + {
1914 + result = (char_u *)"";
1915 + valid = 0; /* Must have ":p:h" to be valid */
1916 + }
1917 + else
1918 + result = buf->b_fname;
1919 }
1920 - else
1921 - result = buf->b_fname;
1922 break;
1923
1924 #ifdef FEAT_SEARCHPATH
1925 @@ -9541,6 +9571,15 @@
1926 #ifdef FEAT_AUTOCMD
1927 case SPEC_AFILE: /* file name for autocommand */
1928 result = autocmd_fname;
1929 + if (result != NULL && !autocmd_fname_full)
1930 + {
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;
1937 + }
1938 if (result == NULL)
1939 {
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)
1944 {
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"));
1949 }
1950 else
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
1954 @@ -31,6 +31,8 @@
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 */
1961 # ifdef FEAT_EVAL
1962 char_u *xp_arg; /* user-defined expansion arg */
1963 @@ -38,7 +40,11 @@
1964 # endif
1965 };
1966
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;
1973
1974 static int cmd_showtail; /* Only show path tail in lists ? */
1975
1976 @@ -238,6 +244,7 @@
1977 }
1978
1979 ExpandInit(&xpc);
1980 + ccline.xpc = &xpc;
1981
1982 #ifdef FEAT_RIGHTLEFT
1983 if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
1984 @@ -408,9 +415,10 @@
1985 #endif
1986
1987 /*
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>).
1991 */
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)
1994 c = Ctrl_P;
1995
1996 #ifdef FEAT_WILDMENU
1997 @@ -1513,6 +1521,7 @@
1998 int old_firstc;
1999
2000 vim_free(ccline.cmdbuff);
2001 + xpc.xp_context = EXPAND_NOTHING;
2002 if (hiscnt == hislen)
2003 p = lookfor; /* back to the old one */
2004 else
2005 @@ -1839,6 +1848,7 @@
2006 #endif
2007
2008 ExpandCleanup(&xpc);
2009 + ccline.xpc = NULL;
2010
2011 #ifdef FEAT_SEARCH_EXTRA
2012 if (did_incsearch)
2013 @@ -2508,6 +2518,20 @@
2014 }
2015 mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
2016 vim_free(p);
2017 +
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)
2022 + {
2023 + int i = (int)(ccline.xpc->xp_pattern - p);
2024 +
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;
2029 + }
2030 +
2031 return OK;
2032 }
2033
2034 @@ -2875,6 +2899,7 @@
2035 prev_ccline = ccline;
2036 ccline.cmdbuff = NULL;
2037 ccline.cmdprompt = NULL;
2038 + ccline.xpc = NULL;
2039 }
2040
2041 /*
2042 @@ -3582,6 +3607,7 @@
2043 ExpandInit(xp)
2044 expand_T *xp;
2045 {
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 @@
2051 if (s == NULL)
2052 return FAIL;
2053 sprintf((char *)s, "%s/%s*.vim", dirname, pat);
2054 - all = globpath(p_rtp, s);
2055 + all = globpath(p_rtp, s, 0);
2056 vim_free(s);
2057 if (all == NULL)
2058 return FAIL;
2059 @@ -4912,9 +4938,10 @@
2060 * newlines. Returns NULL for an error or no matches.
2061 */
2062 char_u *
2063 -globpath(path, file)
2064 +globpath(path, file, expand_options)
2065 char_u *path;
2066 char_u *file;
2067 + int expand_options;
2068 {
2069 expand_T xpc;
2070 char_u *buf;
2071 @@ -4943,10 +4970,10 @@
2072 {
2073 add_pathsep(buf);
2074 STRCAT(buf, file);
2075 - if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
2076 - && num_p > 0)
2077 + if (ExpandFromContext(&xpc, buf, &num_p, &p,
2078 + WILD_SILENT|expand_options) != FAIL && num_p > 0)
2079 {
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;
2084
2085 @@ -6025,7 +6052,7 @@
2086 cmdwin_type = '-';
2087
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 @@
2098
2099 /*
2100 * +browse ":browse" command.
2101 + * or just the ":browse" command modifier
2102 */
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
2109 +# endif
2110 #endif
2111
2112 /*
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 @@
2117 else
2118 {
2119 if (eap != NULL && eap->force_ff != 0)
2120 + {
2121 fileformat = get_fileformat_force(curbuf, eap);
2122 + try_unix = try_dos = try_mac = FALSE;
2123 + }
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 @@
2128 {
2129 /* Use stderr for stdin, makes shell commands work. */
2130 close(0);
2131 - dup(2);
2132 + ignored = dup(2);
2133 }
2134 #endif
2135
2136 @@ -2341,11 +2344,6 @@
2137 STRCAT(IObuff, _("[CR missing]"));
2138 c = TRUE;
2139 }
2140 - if (ff_error == EOL_MAC)
2141 - {
2142 - STRCAT(IObuff, _("[NL found]"));
2143 - c = TRUE;
2144 - }
2145 if (split)
2146 {
2147 STRCAT(IObuff, _("[long lines split]"));
2148 @@ -2711,7 +2709,7 @@
2149 {
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);
2154
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 @@
2158 {
2159 # ifdef UNIX
2160 # ifdef HAVE_FCHOWN
2161 - fchown(fd, st_old.st_uid, st_old.st_gid);
2162 + ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
2163 # endif
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)
2169 {
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);
2174 }
2175 @@ -5550,9 +5548,10 @@
2176 name = "ucs-4le"; /* FF FE 00 00 */
2177 len = 4;
2178 }
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 */
2186 }
2187 else if (p[0] == 0xfe && p[1] == 0xff
2188 @@ -6031,9 +6030,9 @@
2189 {
2190 tbuf[FGETS_SIZE - 2] = NUL;
2191 #ifdef USE_CR
2192 - fgets_cr((char *)tbuf, FGETS_SIZE, fp);
2193 + ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
2194 #else
2195 - fgets((char *)tbuf, FGETS_SIZE, fp);
2196 + ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
2197 #endif
2198 } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
2199 }
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.
2210 */
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;
2222 else
2223 autocmd_fname = NULL;
2224 }
2225 else
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 */
2231
2232 /*
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;
2241 #ifdef FEAT_EVAL
2242 @@ -8918,7 +8921,7 @@
2243 {
2244 apc->curpat = NULL;
2245
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
2249 * buffer number. */
2250 if (ap->pat != NULL && ap->cmds != NULL
2251 @@ -9104,7 +9107,7 @@
2252 set_context_in_autocmd(xp, arg, doautocmd)
2253 expand_T *xp;
2254 char_u *arg;
2255 - int doautocmd; /* TRUE for :doautocmd, FALSE for :autocmd */
2256 + int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */
2257 {
2258 char_u *p;
2259 int group;
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
2263 @@ -48,7 +48,7 @@
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.
2274 */
2275 static void
2276 -setFoldRepeat(lnum, count, open)
2277 +setFoldRepeat(lnum, count, do_open)
2278 linenr_T lnum;
2279 long count;
2280 - int open;
2281 + int do_open;
2282 {
2283 int done;
2284 long n;
2285 @@ -1252,7 +1252,7 @@
2286 for (n = 0; n < count; ++n)
2287 {
2288 done = DONE_NOTHING;
2289 - (void)setManualFold(lnum, open, FALSE, &done);
2290 + (void)setManualFold(lnum, do_open, FALSE, &done);
2291 if (!(done & DONE_ACTION))
2292 {
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 @@
2298 return FAIL;
2299 if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0)
2300 return FAIL;
2301 - if (fprintf(fd, cmd) < 0)
2302 + if (fputs(cmd, fd) < 0)
2303 return FAIL;
2304 if (buf != NULL && fputs(" <buffer>", fd) < 0)
2305 return FAIL;
2306 @@ -4801,7 +4801,7 @@
2307 }
2308 if (IS_SPECIAL(c) || modifiers) /* special key */
2309 {
2310 - if (fprintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)
2311 + if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0)
2312 return FAIL;
2313 continue;
2314 }
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 @@
2319 #endif
2320 #ifdef FEAT_AUTOCMD
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;
2328
2329 /*
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
2332 + * the warning.
2333 + */
2334 +EXTERN int ignored;
2335 +EXTERN char *ignoredp;
2336 +
2337 +/*
2338 * Optional Farsi support. Include it here, so EXTERN and INIT are defined.
2339 */
2340 #ifdef FEAT_FKMAP
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 */
2346 {
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. */
2350 + union {
2351 + XtPointer xtp;
2352 + float xtf;
2353 + } xtpf;
2354
2355 if (LookAhead(w, event))
2356 return;
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);
2365 }
2366
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
2370 @@ -139,7 +139,7 @@
2371 /* The read returns when the child closes the pipe (or when
2372 * the child dies for some reason). */
2373 close(pipefd[1]);
2374 - (void)read(pipefd[0], &dummy, (size_t)1);
2375 + ignored = (int)read(pipefd[0], &dummy, (size_t)1);
2376 close(pipefd[0]);
2377 }
2378
2379 @@ -3241,7 +3241,7 @@
2380 i = Rows;
2381 gui_update_tabline();
2382 Rows = i;
2383 - need_set_size = RESIZE_VERT;
2384 + need_set_size |= RESIZE_VERT;
2385 if (using_tabline)
2386 fix_size = TRUE;
2387 if (!gui_use_tabline())
2388 @@ -3275,9 +3275,9 @@
2389 if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
2390 {
2391 if (i == SBAR_BOTTOM)
2392 - need_set_size = RESIZE_VERT;
2393 + need_set_size |= RESIZE_VERT;
2394 else
2395 - need_set_size = RESIZE_HOR;
2396 + need_set_size |= RESIZE_HOR;
2397 if (gui.which_scrollbars[i])
2398 fix_size = TRUE;
2399 }
2400 @@ -3297,7 +3297,7 @@
2401 gui_mch_enable_menu(gui.menu_is_active);
2402 Rows = i;
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)
2407 fix_size = TRUE;
2408 }
2409 @@ -3308,7 +3308,7 @@
2410 {
2411 gui_mch_show_toolbar(using_toolbar);
2412 prev_toolbar = using_toolbar;
2413 - need_set_size = RESIZE_VERT;
2414 + need_set_size |= RESIZE_VERT;
2415 if (using_toolbar)
2416 fix_size = TRUE;
2417 }
2418 @@ -3318,7 +3318,7 @@
2419 {
2420 gui_mch_enable_footer(using_footer);
2421 prev_footer = using_footer;
2422 - need_set_size = RESIZE_VERT;
2423 + need_set_size |= RESIZE_VERT;
2424 if (using_footer)
2425 fix_size = TRUE;
2426 }
2427 @@ -3330,10 +3330,11 @@
2428 prev_tearoff = using_tearoff;
2429 }
2430 #endif
2431 - if (need_set_size)
2432 + if (need_set_size != 0)
2433 {
2434 #ifdef FEAT_GUI_GTK
2435 - long c = Columns;
2436 + long prev_Columns = Columns;
2437 + long prev_Rows = Rows;
2438 #endif
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))
2451 (void)char_avail();
2452 - Columns = c;
2453 + if ((need_set_size & RESIZE_VERT) == 0)
2454 + Rows = prev_Rows;
2455 + if ((need_set_size & RESIZE_HOR) == 0)
2456 + Columns = prev_Columns;
2457 #endif
2458 }
2459 #ifdef FEAT_WINDOWS
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 @@
2464
2465 if (mask & (XValue | YValue))
2466 {
2467 - int w, h;
2468 - gui_mch_get_screen_dimensions(&w, &h);
2469 - h += p_ghr + get_menu_tool_height();
2470 - w += get_menu_tool_width();
2471 + int ww, hh;
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;
2481 #ifdef HAVE_GTK2
2482 gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
2483 #else
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];
2489 }
2490
2491 - free(colortable);
2492 + vim_free(colortable);
2493 return OK;
2494 }
2495
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];
2502 int i;
2503 - int index;
2504 + int idx;
2505
2506 - for (index = (int)ENCODING; index < (int)NONE; ++index)
2507 - count[index] = 0;
2508 + for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
2509 + count[idx] = 0;
2510
2511 /* First we insert the wild char into every single list. */
2512 if (fix != ENCODING)
2513 @@ -503,14 +503,14 @@
2514 /*
2515 * Now loop trough the remaining lists and set them up.
2516 */
2517 - for (index = (int)NAME; index < (int)NONE; ++index)
2518 + for (idx = (int)NAME; idx < (int)NONE; ++idx)
2519 {
2520 Widget w;
2521
2522 - if (fix == (enum ListSpecifier)index)
2523 + if (fix == (enum ListSpecifier)idx)
2524 continue;
2525
2526 - switch ((enum ListSpecifier)index)
2527 + switch ((enum ListSpecifier)idx)
2528 {
2529 case NAME:
2530 w = data->list[NAME];
2531 @@ -525,21 +525,21 @@
2532 w = (Widget)0; /* for lint */
2533 }
2534
2535 - for (i = 0; i < count[index]; ++i)
2536 + for (i = 0; i < count[idx]; ++i)
2537 {
2538 - items[i] = XmStringCreateLocalized(list[index][i]);
2539 - XtFree(list[index][i]);
2540 + items[i] = XmStringCreateLocalized(list[idx][i]);
2541 + XtFree(list[idx][i]);
2542 }
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])
2548 {
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]);
2554 }
2555 - for (i = 0; i < count[index]; ++i)
2556 + for (i = 0; i < count[idx]; ++i)
2557 XmStringFree(items[i]);
2558 }
2559 }
2560 @@ -695,14 +695,14 @@
2561 int n;
2562 XmString str;
2563 Arg args[4];
2564 - char *msg = _("no specific match");
2565 + char *nomatch_msg = _("no specific match");
2566
2567 n = 0;
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);
2575 XmStringFree(str);
2576
2577 return False;
2578 @@ -886,21 +886,21 @@
2579 {
2580 int i;
2581 int max;
2582 - int index = 0;
2583 + int idx = 0;
2584 int size;
2585 - char str[128];
2586 + char buf[128];
2587
2588 for (i = 0, max = 0; i < data->num; i++)
2589 {
2590 - get_part(fn(data, i), 7, str);
2591 - size = atoi(str);
2592 + get_part(fn(data, i), 7, buf);
2593 + size = atoi(buf);
2594 if ((size > max) && (size < MAX_DISPLAY_SIZE))
2595 {
2596 - index = i;
2597 + idx = i;
2598 max = size;
2599 }
2600 }
2601 - strcpy(big_font, fn(data, index));
2602 + strcpy(big_font, fn(data, idx));
2603 }
2604 data->old = XLoadQueryFont(XtDisplay(parent), big_font);
2605 data->old_list = gui_motif_create_fontlist(data->old);
2606 @@ -1217,28 +1217,28 @@
2607
2608 if (i != 0)
2609 {
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];
2618 char *found;
2619
2620 found = names[0];
2621
2622 - name_part(found, name);
2623 - style_part(found, style);
2624 - size_part(found, size, data->in_pixels);
2625 - encoding_part(found, encoding);
2626 -
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);
2635 +
2636 + if (strlen(namebuf) > 0
2637 + && strlen(stylebuf) > 0
2638 + && strlen(sizebuf) > 0
2639 + && strlen(encodingbuf) > 0)
2640 {
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 @@
2656 }
2657 else
2658 {
2659 - int adjust = 0;
2660 + adjust = 0;
2661
2662 #if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
2663 /*
2664 @@ -1268,12 +1268,11 @@
2665 {
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));
2672 break;
2673
2674 case XmINTERNAL_HIGHLIGHT:
2675 - adjust = 0;
2676 break;
2677
2678 default:
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
2682 @@ -74,7 +74,7 @@
2683 { "add", cs_add,
2684 N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 },
2685 { "find", cs_find,
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 },
2688 { "help", cs_help,
2689 N_("Show this message"), "help", 0 },
2690 { "kill", cs_kill,
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);
2696 + MSG_PUTS(_("\n"
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"));
2705 +
2706 cmdp++;
2707 }
2708
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
2712 @@ -42,17 +42,6 @@
2713 * f 7name Find this file
2714 * i 8name Find files #including this file
2715 */
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"
2726 -
2727
2728 typedef struct {
2729 char * name;
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
2733 @@ -136,6 +136,9 @@
2734 # define Perl_newXS_flags dll_Perl_newXS_flags
2735 #endif
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
2739 +# endif
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
2743 @@ -163,7 +166,7 @@
2744 # define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr
2745 # define boot_DynaLoader dll_boot_DynaLoader
2746
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
2752 @@ -268,7 +271,8 @@
2753 static void (*boot_DynaLoader)_((pTHX_ CV*));
2754
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*);
2762 @@ -367,7 +371,8 @@
2763 {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr},
2764 {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
2765 #else
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},
2772 @@ -455,7 +460,7 @@
2773 static char *argv[] = { "", "-e", "" };
2774
2775 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
2776 - Perl_sys_init3(&argc, (char***)&argv, NULL);
2777 + Perl_sys_init(&argc, (char***)&argv);
2778 #endif
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())
2786 goto fail;
2787
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)");
2793 +
2794 /* the first python thread is vim's, release the lock */
2795 Python_SaveThread();
2796
2797 @@ -2345,7 +2351,8 @@
2798 {
2799 PyObject *mod;
2800 PyObject *dict;
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};
2804
2805 /* Fixups... */
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
2810 @@ -736,7 +736,7 @@
2811 + serverReply.ga_len;
2812 e.id = w;
2813 ga_init2(&e.strings, 1, 100);
2814 - memcpy(p, &e, sizeof(e));
2815 + mch_memmove(p, &e, sizeof(e));
2816 serverReply.ga_len++;
2817 }
2818 }
2819 @@ -1018,7 +1018,7 @@
2820 p++;
2821 count = numItems - (p - regProp);
2822 if (count > 0)
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 @@
2829 p++;
2830 lastHalf = numItems - (p - regProp);
2831 if (lastHalf > 0)
2832 - memcpy(entry, p, lastHalf);
2833 + mch_memmove(entry, p, lastHalf);
2834 numItems = (entry - regProp) + lastHalf;
2835 p = entry;
2836 continue;
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 @@
2841
2842 #ifdef FEAT_VIMINFO
2843 /*
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.
2847 */
2848 if (*p_viminfo != NUL)
2849 {
2850 - read_viminfo(NULL, TRUE, FALSE, FALSE);
2851 + read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
2852 TIME_MSG("reading viminfo");
2853 }
2854 #endif
2855 @@ -1457,7 +1458,8 @@
2856 ++initstr;
2857 }
2858
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')
2862 {
2863 main_start_gui();
2864 #ifdef FEAT_GUI
2865 @@ -1508,7 +1510,8 @@
2866 early_arg_scan(parmp)
2867 mparm_T *parmp;
2868 {
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;
2874 int i;
2875 @@ -1580,6 +1583,14 @@
2876 else if (STRICMP(argv[i], "--echo-wid") == 0)
2877 echo_wid_arg = TRUE;
2878 # endif
2879 +# ifndef FEAT_NETBEANS_INTG
2880 + else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
2881 + {
2882 + mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
2883 + mch_exit(2);
2884 + }
2885 +# endif
2886 +
2887 }
2888 #endif
2889 }
2890 @@ -2361,7 +2372,7 @@
2891 * Is there any other system that cannot do this?
2892 */
2893 close(0);
2894 - dup(2);
2895 + ignored = dup(2);
2896 #endif
2897 }
2898
2899 @@ -2586,7 +2597,7 @@
2900 # endif
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)
2907 {
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 @@
2912
2913 /*
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
2920 */
2921 void
2922 -copy_viminfo_marks(virp, fp_out, count, eof)
2923 +copy_viminfo_marks(virp, fp_out, count, eof, flags)
2924 vir_T *virp;
2925 FILE *fp_out;
2926 int count;
2927 int eof;
2928 + int flags;
2929 {
2930 char_u *line = virp->vir_line;
2931 buf_T *buf;
2932 @@ -1647,10 +1649,23 @@
2933 char_u *p;
2934 char_u *name_buf;
2935 pos_T pos;
2936 +#ifdef FEAT_EVAL
2937 + list_T *list = NULL;
2938 +#endif
2939
2940 if ((name_buf = alloc(LSIZE)) == NULL)
2941 return;
2942 *name_buf = NUL;
2943 +
2944 +#ifdef FEAT_EVAL
2945 + if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT)))
2946 + {
2947 + list = list_alloc();
2948 + if (list != NULL)
2949 + set_vim_var_list(VV_OLDFILES, list);
2950 + }
2951 +#endif
2952 +
2953 num_marked_files = get_viminfo_parameter('\'');
2954 while (!eof && (count < num_marked_files || fp_out == NULL))
2955 {
2956 @@ -1681,6 +1696,11 @@
2957 p++;
2958 *p = NUL;
2959
2960 +#ifdef FEAT_EVAL
2961 + if (list != NULL)
2962 + list_append_string(list, str, -1);
2963 +#endif
2964 +
2965 /*
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;
2970 if (fp_out == NULL)
2971 {
2972 - if (curbuf->b_ffname != NULL)
2973 + if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL)
2974 {
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
2980 @@ -717,7 +717,7 @@
2981 * where mblen() returns 0 for invalid character.
2982 * Therefore, following condition includes 0.
2983 */
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)
2987 n = 2;
2988 else
2989 @@ -2540,7 +2540,6 @@
2990 return (int)(p - q);
2991 }
2992
2993 -#if defined(FEAT_EVAL) || defined(PROTO)
2994 /*
2995 * Copy a character from "*fp" to "*tp" and advance the pointers.
2996 */
2997 @@ -2555,7 +2554,6 @@
2998 *tp += l;
2999 *fp += l;
3000 }
3001 -#endif
3002
3003 /*
3004 * Return the offset from "p" to the first byte of a character. When "p" is
3005 @@ -3133,7 +3131,7 @@
3006 else
3007 s = p + 1;
3008 }
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)
3011 {
3012 if (s[i] == '_' || s[i] == '-')
3013 buf[i] = '-';
3014 @@ -5280,7 +5278,7 @@
3015
3016 /*ARGSUSED*/
3017 static void
3018 -preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3019 +preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3020 {
3021 #ifdef XIM_DEBUG
3022 xim_log("xim_decide_input_style()\n");
3023 @@ -5314,7 +5312,7 @@
3024
3025 /*ARGSUSED*/
3026 static void
3027 -preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3028 +preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3029 {
3030 XIMPreeditDrawCallbackStruct *draw_data;
3031 XIMText *text;
3032 @@ -5386,7 +5384,7 @@
3033 draw_feedback = (char *)alloc(draw_data->chg_first
3034 + text->length);
3035 else
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)
3040 {
3041 @@ -5455,7 +5453,7 @@
3042
3043 /*ARGSUSED*/
3044 static void
3045 -preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3046 +preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3047 {
3048 #ifdef XIM_DEBUG
3049 xim_log("preedit_caret_cbproc()\n");
3050 @@ -5464,7 +5462,7 @@
3051
3052 /*ARGSUSED*/
3053 static void
3054 -preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
3055 +preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
3056 {
3057 #ifdef XIM_DEBUG
3058 xim_log("preedit_done_cbproc()\n");
3059 @@ -6103,7 +6101,7 @@
3060
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);
3065 else
3066 tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, 0,
3067 ptr, len, 0, 0);
3068 @@ -6111,13 +6109,13 @@
3069 if (tmp == NULL)
3070 break;
3071 if (vcp->vc_cpfrom == 0)
3072 - utf8_to_ucs2(ptr, len, tmp, unconvlenp);
3073 + utf8_to_utf16(ptr, len, tmp, unconvlenp);
3074 else
3075 MultiByteToWideChar(vcp->vc_cpfrom, 0, ptr, len, tmp, tmp_len);
3076
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);
3081 else
3082 retlen = WideCharToMultiByte(vcp->vc_cpto, 0,
3083 tmp, tmp_len, 0, 0, 0, 0);
3084 @@ -6125,7 +6123,7 @@
3085 if (retval != NULL)
3086 {
3087 if (vcp->vc_cpto == 0)
3088 - ucs2_to_utf8(tmp, tmp_len, retval);
3089 + utf16_to_utf8(tmp, tmp_len, retval);
3090 else
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 @@
3097 parent = menu;
3098 menu = menu->children;
3099 }
3100 + vim_free(path_name);
3101
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)
3109 {
3110 int i;
3111 - char *p;
3112 + char *tp;
3113
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;
3118 else
3119 {
3120 - p = (char *)vim_strchr((char_u *)tmp,
3121 + tp = (char *)vim_strchr((char_u *)tmp,
3122 fmt_spec == 'e' ? 'e' : 'E');
3123 - if (p != NULL)
3124 + if (tp != NULL)
3125 {
3126 /* Remove superfluous '+' and leading
3127 * zeroes from the exponent. */
3128 - if (p[1] == '+')
3129 + if (tp[1] == '+')
3130 {
3131 /* Change "1.0e+07" to "1.0e07" */
3132 - STRMOVE(p + 1, p + 2);
3133 + STRMOVE(tp + 1, tp + 2);
3134 --str_arg_l;
3135 }
3136 - i = (p[1] == '-') ? 2 : 1;
3137 - while (p[i] == '0')
3138 + i = (tp[1] == '-') ? 2 : 1;
3139 + while (tp[i] == '0')
3140 {
3141 /* Change "1.0e07" to "1.0e7" */
3142 - STRMOVE(p + i, p + i + 1);
3143 + STRMOVE(tp + i, tp + i + 1);
3144 --str_arg_l;
3145 }
3146 - --p;
3147 + --tp;
3148 }
3149 }
3150
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'
3157 + && tp[-1] != '.')
3158 {
3159 - STRMOVE(p, p + 1);
3160 - --p;
3161 + STRMOVE(tp, tp + 1);
3162 + --tp;
3163 --str_arg_l;
3164 }
3165 }
3166 else
3167 {
3168 - char *p;
3169 + char *tp;
3170
3171 /* Be consistent: some printf("%e") use 1.0e+12
3172 * and some 1.0e+012. Remove one zero in the last
3173 * case. */
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] == '-')
3178 - && p[2] == '0'
3179 - && vim_isdigit(p[3])
3180 - && vim_isdigit(p[4]))
3181 + if (tp != NULL && (tp[1] == '+' || tp[1] == '-')
3182 + && tp[2] == '0'
3183 + && vim_isdigit(tp[3])
3184 + && vim_isdigit(tp[4]))
3185 {
3186 - STRMOVE(p + 2, p + 3);
3187 + STRMOVE(tp + 2, tp + 3);
3188 --str_arg_l;
3189 }
3190 }
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 @@
3195
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): "));
3200 else
3201 - MSG_PUTS(_("Choice number (<Enter> cancels): "));
3202 + MSG_PUTS(_("Type number and <Enter> (empty cancels): "));
3203
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);
3212 if (wn != NULL)
3213 {
3214 hFind = FindFirstFileW(wn, &wfb);
3215 @@ -8756,7 +8756,7 @@
3216 #ifdef WIN3264
3217 # ifdef FEAT_MBYTE
3218 if (wn != NULL)
3219 - p = ucs2_to_enc(wfb.cFileName, NULL); /* p is allocated here */
3220 + p = utf16_to_enc(wfb.cFileName, NULL); /* p is allocated here */
3221 else
3222 # endif
3223 p = (char_u *)fb.cFileName;
3224 @@ -8830,7 +8830,7 @@
3225 if (wn != NULL)
3226 {
3227 vim_free(wn);
3228 - wn = enc_to_ucs2(buf, NULL);
3229 + wn = enc_to_utf16(buf, NULL);
3230 if (wn != NULL)
3231 hFind = FindFirstFileW(wn, &wfb);
3232 }
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
3236 @@ -873,7 +873,7 @@
3237 /* 3. check for available memory: call mch_avail_mem() */
3238 if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
3239 {
3240 - vim_free((char *)p); /* System is low... no go! */
3241 + free((char *)p); /* System is low... no go! */
3242 p = NULL;
3243 }
3244 else
3245 @@ -1257,7 +1257,6 @@
3246 return escaped_string;
3247 }
3248
3249 -#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
3250 /*
3251 * Return TRUE when 'shell' has "csh" in the tail.
3252 */
3253 @@ -1266,9 +1265,7 @@
3254 {
3255 return (strstr((char *)gettail(p_sh), "csh") != NULL);
3256 }
3257 -#endif
3258
3259 -#if defined(FEAT_EVAL) || defined(PROTO)
3260 /*
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 @@
3264
3265 return escaped_string;
3266 }
3267 -#endif
3268
3269 /*
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 @@
3275
3276 if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
3277 {
3278 - if (curwin->w_cursor.lnum < curwin->w_botline
3279 - && ((long)curwin->w_cursor.lnum
3280 + if (curwin->w_cursor.lnum < curwin->w_botline)
3281 + {
3282 + if (((long)curwin->w_cursor.lnum
3283 >= (long)curwin->w_botline - p_so
3284 #ifdef FEAT_FOLDING
3285 || hasAnyFolding(curwin)
3286 #endif
3287 ))
3288 - {
3289 + {
3290 lineoff_T loff;
3291
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
3296 + * scroll. */
3297 n = curwin->w_empty_rows;
3298 loff.lnum = curwin->w_cursor.lnum;
3299 #ifdef FEAT_FOLDING
3300 @@ -317,6 +319,10 @@
3301 if (n >= p_so)
3302 /* sufficient context, no need to scroll */
3303 check_botline = FALSE;
3304 + }
3305 + else
3306 + /* sufficient context, no need to scroll */
3307 + check_botline = FALSE;
3308 }
3309 if (check_botline)
3310 {
3311 @@ -509,6 +515,9 @@
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;
3317 +#endif
3318 #ifdef FEAT_DIFF
3319 wp->w_topfill = 0;
3320 #endif
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 */
3327 if (sd >= 0)
3328 - sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */
3329 + ignored = sock_write(sd, buf, (int)STRLEN(buf));
3330 }
3331 }
3332
3333 @@ -1795,7 +1795,7 @@
3334 buf->displayname = NULL;
3335
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;
3340 buf->bufp = curbuf;
3341 maketitle();
3342 @@ -1960,7 +1960,7 @@
3343
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;
3349 buf->bufp = curbuf;
3350 maketitle();
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);
3357 buf->bufp = curbuf;
3358 buf->initDone = TRUE;
3359 doupdate = 1;
3360 @@ -2277,9 +2277,6 @@
3361 int serNum;
3362 int localTypeNum;
3363 int typeNum;
3364 -# ifdef NBDEBUG
3365 - int len;
3366 -# endif
3367 pos_T *pos;
3368
3369 if (buf == NULL || buf->bufp == NULL)
3370 @@ -2303,13 +2300,10 @@
3371 pos = get_off_or_lnum(buf->bufp, &args);
3372
3373 cp = (char *)args;
3374 -# ifdef NBDEBUG
3375 - len =
3376 -# endif
3377 - strtol(cp, &cp, 10);
3378 + ignored = (int)strtol(cp, &cp, 10);
3379 args = (char_u *)cp;
3380 # ifdef NBDEBUG
3381 - if (len != -1)
3382 + if (ignored != -1)
3383 {
3384 nbdebug((" partial line annotation -- Not Yet Implemented!\n"));
3385 }
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
3389 @@ -183,6 +183,8 @@
3390 static void nv_cursorhold __ARGS((cmdarg_T *cap));
3391 #endif
3392
3393 +static char *e_noident = N_("E349: No identifier under cursor");
3394 +
3395 /*
3396 * Function to be called for a Normal or Visual mode command.
3397 * The argument is a cmdarg_T.
3398 @@ -578,6 +580,9 @@
3399 static int old_mapped_len = 0;
3400 #endif
3401 int idx;
3402 +#ifdef FEAT_EVAL
3403 + int set_prevcount = FALSE;
3404 +#endif
3405
3406 vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
3407 ca.oap = oap;
3408 @@ -613,7 +618,12 @@
3409 /* When not finishing an operator and no register name typed, reset the
3410 * count. */
3411 if (!finish_op && !oap->regname)
3412 + {
3413 ca.opcount = 0;
3414 +#ifdef FEAT_EVAL
3415 + set_prevcount = TRUE;
3416 +#endif
3417 + }
3418
3419 #ifdef FEAT_AUTOCMD
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);
3426 + {
3427 + long count = ca.count0;
3428 +
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 */
3434 + }
3435 #endif
3436 if (ctrl_w)
3437 {
3438 @@ -804,7 +822,7 @@
3439 * Only set v:count when called from main() and not a stuffed command.
3440 */
3441 if (toplevel && stuff_empty())
3442 - set_vcount(ca.count0, ca.count1);
3443 + set_vcount(ca.count0, ca.count1, set_prevcount);
3444 #endif
3445
3446 /*
3447 @@ -1132,7 +1150,8 @@
3448 out_flush();
3449 #endif
3450 #ifdef FEAT_AUTOCMD
3451 - did_cursorhold = FALSE;
3452 + if (ca.cmdchar != K_IGNORE)
3453 + did_cursorhold = FALSE;
3454 #endif
3455
3456 State = NORMAL;
3457 @@ -3509,7 +3528,7 @@
3458 if (find_type & FIND_STRING)
3459 EMSG(_("E348: No string under cursor"));
3460 else
3461 - EMSG(_("E349: No identifier under cursor"));
3462 + EMSG(_(e_noident));
3463 return 0;
3464 }
3465 ptr += col;
3466 @@ -5469,6 +5488,20 @@
3467 STRCPY(buf, "he! ");
3468 else
3469 {
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)
3473 + {
3474 + ++ptr;
3475 + --n;
3476 + }
3477 + if (n == 0)
3478 + {
3479 + EMSG(_(e_noident)); /* found dashes only */
3480 + vim_free(buf);
3481 + return;
3482 + }
3483 +
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 @@
3488 /*
3489 * Now grab the chars in the identifier
3490 */
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\\\"|!";
3497 - else
3498 - /* Don't escape spaces and Tabs in a tag with a backslash */
3499 - aux_ptr = (char_u *)"\\|\"";
3500 -
3501 - p = buf + STRLEN(buf);
3502 - while (n-- > 0)
3503 - {
3504 - /* put a backslash before \ and some others */
3505 - if (vim_strchr(aux_ptr, *ptr) != NULL)
3506 - *p++ = '\\';
3507 -#ifdef FEAT_MBYTE
3508 - /* When current byte is a part of multibyte character, copy all bytes
3509 - * of that character. */
3510 - if (has_mbyte)
3511 + if (cmdchar == 'K' && !kp_help)
3512 + {
3513 + /* Escape the argument properly for a shell command */
3514 + ptr = vim_strnsave(ptr, n);
3515 + p = vim_strsave_shellescape(ptr, TRUE);
3516 + vim_free(ptr);
3517 + if (p == NULL)
3518 {
3519 - int i;
3520 - int len = (*mb_ptr2len)(ptr) - 1;
3521 -
3522 - for (i = 0; i < len && n >= 1; ++i, --n)
3523 - *p++ = *ptr++;
3524 + vim_free(buf);
3525 + return;
3526 }
3527 + buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
3528 + if (buf == NULL)
3529 + {
3530 + vim_free(buf);
3531 + vim_free(p);
3532 + return;
3533 + }
3534 + STRCAT(buf, p);
3535 + vim_free(p);
3536 + }
3537 + else
3538 + {
3539 + if (cmdchar == '*')
3540 + aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
3541 + else if (cmdchar == '#')
3542 + aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
3543 + else
3544 + /* Don't escape spaces and Tabs in a tag with a backslash */
3545 + aux_ptr = (char_u *)"\\|\"\n*?[";
3546 +
3547 + p = buf + STRLEN(buf);
3548 + while (n-- > 0)
3549 + {
3550 + /* put a backslash before \ and some others */
3551 + if (vim_strchr(aux_ptr, *ptr) != NULL)
3552 + *p++ = '\\';
3553 +#ifdef FEAT_MBYTE
3554 + /* When current byte is a part of multibyte character, copy all
3555 + * bytes of that character. */
3556 + if (has_mbyte)
3557 + {
3558 + int i;
3559 + int len = (*mb_ptr2len)(ptr) - 1;
3560 +
3561 + for (i = 0; i < len && n >= 1; ++i, --n)
3562 + *p++ = *ptr++;
3563 + }
3564 #endif
3565 - *p++ = *ptr++;
3566 + *p++ = *ptr++;
3567 + }
3568 + *p = NUL;
3569 }
3570 - *p = NUL;
3571
3572 /*
3573 * Execute the command.
3574 @@ -6011,7 +6066,7 @@
3575 autowrite(curbuf, FALSE);
3576 setpcmark();
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)
3581 {
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 @@
3587 {
3588 for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
3589 {
3590 + int one_change;
3591 +
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;
3597
3598 # ifdef FEAT_NETBEANS_INTG
3599 - if (usingNetbeans && did_change)
3600 + if (usingNetbeans && one_change)
3601 {
3602 char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
3603
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 @@
3608 #ifdef FEAT_VIMINFO
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:"}
3613 #else
3614 # ifdef AMIGA
3615 {(char_u *)"",
3616 - (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
3617 + (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
3618 # else
3619 - {(char_u *)"", (char_u *)"'20,<50,s10,h"}
3620 + {(char_u *)"", (char_u *)"'100,<50,s10,h"}
3621 # endif
3622 #endif
3623 #else
3624 @@ -7974,6 +7974,11 @@
3625 else /* curwin->w_p_scr > curwin->w_height */
3626 curwin->w_p_scr = curwin->w_height;
3627 }
3628 + if (p_hi < 0)
3629 + {
3630 + errmsg = e_positive;
3631 + p_hi = 0;
3632 + }
3633 if (p_report < 0)
3634 {
3635 errmsg = e_positive;
3636 @@ -8227,13 +8232,13 @@
3637 {
3638 if (number == 0 && string != NULL)
3639 {
3640 - int index;
3641 + int idx;
3642
3643 /* Either we are given a string or we are setting option
3644 * to zero. */
3645 - for (index = 0; string[index] == '0'; ++index)
3646 + for (idx = 0; string[idx] == '0'; ++idx)
3647 ;
3648 - if (string[index] != NUL || index == 0)
3649 + if (string[idx] != NUL || idx == 0)
3650 {
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}
3658 };
3659
3660 +/*
3661 + * Write s[len] to the screen.
3662 + */
3663 void
3664 mch_write(s, len)
3665 char_u *s;
3666 int len;
3667 {
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);
3672 }
3673 @@ -2905,7 +2908,7 @@
3674 * Ignore any errors.
3675 */
3676 #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
3677 - signal_stack = malloc(SIGSTKSZ);
3678 + signal_stack = (char *)alloc(SIGSTKSZ);
3679 init_signal_stack();
3680 #endif
3681 }
3682 @@ -2936,7 +2939,8 @@
3683 }
3684 # endif
3685 # endif
3686 -# ifdef FEAT_X11
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 @@
3693 */
3694 if (fd >= 0)
3695 {
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) */
3702
3703 /* Don't need this now that we've duplicated it */
3704 close(fd);
3705 @@ -3996,13 +4000,13 @@
3706
3707 /* set up stdin/stdout/stderr for the child */
3708 close(0);
3709 - dup(pty_slave_fd);
3710 + ignored = dup(pty_slave_fd);
3711 close(1);
3712 - dup(pty_slave_fd);
3713 + ignored = dup(pty_slave_fd);
3714 if (gui.in_use)
3715 {
3716 close(2);
3717 - dup(pty_slave_fd);
3718 + ignored = dup(pty_slave_fd);
3719 }
3720
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]);
3725 close(0);
3726 - dup(fd_toshell[0]);
3727 + ignored = dup(fd_toshell[0]);
3728 close(fd_toshell[0]);
3729
3730 /* set up stdout for the child */
3731 close(fd_fromshell[0]);
3732 close(1);
3733 - dup(fd_fromshell[1]);
3734 + ignored = dup(fd_fromshell[1]);
3735 close(fd_fromshell[1]);
3736
3737 # ifdef FEAT_GUI
3738 @@ -4027,7 +4031,7 @@
3739 {
3740 /* set up stderr for the child */
3741 close(2);
3742 - dup(1);
3743 + ignored = dup(1);
3744 }
3745 # endif
3746 }
3747 @@ -4158,7 +4162,8 @@
3748 && (lnum !=
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",
3753 + (size_t)1);
3754 ++lnum;
3755 if (lnum > curbuf->b_op_end.lnum)
3756 {
3757 @@ -6814,7 +6819,8 @@
3758 if (xsmp_icefd != -1)
3759 {
3760 SmcCloseConnection(xsmp.smcconn, 0, NULL);
3761 - vim_free(xsmp.clientid);
3762 + if (xsmp.clientid != NULL)
3763 + free(xsmp.clientid);
3764 xsmp.clientid = NULL;
3765 xsmp_icefd = -1;
3766 }
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
3770 @@ -573,7 +573,7 @@
3771 {
3772 /* Don't want to sync undo in the current buffer. */
3773 ++no_u_sync;
3774 - res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0);
3775 + res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0, NULL);
3776 --no_u_sync;
3777 if (res == OK)
3778 {
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
3782 @@ -33,7 +33,7 @@
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
3794 @@ -17,7 +17,7 @@
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));
3803 @@ -46,7 +46,9 @@
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));
3813 @@ -58,8 +60,10 @@
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));
3825 @@ -94,6 +98,7 @@
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
3836 @@ -11,7 +11,7 @@
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));
3845 @@ -27,7 +27,7 @@
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
3857 @@ -31,7 +31,7 @@
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
3869 @@ -26,5 +26,5 @@
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 @@
3880 }
3881 #endif
3882
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)
3885
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. */
3889 #define PTY_DONE
3890 int
3891 OpenPTY(ttyn)
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 @@
3896 win_T *win;
3897 win_T *altwin;
3898 #endif
3899 + win_T *oldwin = curwin;
3900 int print_message = TRUE;
3901 int len;
3902 #ifdef FEAT_FOLDING
3903 @@ -1744,7 +1745,8 @@
3904 }
3905 else
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);
3910 }
3911 else
3912 ok = buflist_getfile(qf_ptr->qf_fnum,
3913 @@ -2267,6 +2269,7 @@
3914 win_T *win;
3915 tabpage_T *prevtab = curtab;
3916 buf_T *qf_buf;
3917 + win_T *oldwin = curwin;
3918
3919 if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
3920 {
3921 @@ -2326,14 +2329,16 @@
3922 win->w_llist->qf_refcount++;
3923 }
3924
3925 + if (oldwin != curwin)
3926 + oldwin = NULL; /* don't store info when in another window */
3927 if (qf_buf != NULL)
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);
3932 else
3933 {
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 @@
3944
3945 #ifdef FEAT_SYN_HL
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));
3950 + if (wp->w_p_cuc)
3951 + {
3952 + txtcol += wp->w_virtcol;
3953 + if (wp->w_p_wrap)
3954 + txtcol -= wp->w_skipcol;
3955 + else
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));
3960 + }
3961 #endif
3962
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
3967 @@ -77,7 +77,7 @@
3968
3969 /*
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.
3973 */
3974 #define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3)
3975
3976 @@ -469,6 +469,7 @@
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 */
3984 @@ -625,7 +626,7 @@
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)))
3987
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)))
4006 continue;
4007
4008 + /* If there is a match with a CHECKCOMPOUNDPATTERN rule
4009 + * discard the compound word. */
4010 + if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
4011 + continue;
4012 +
4013 if (mode == FIND_COMPOUND)
4014 {
4015 int capflags;
4016 @@ -1577,6 +1586,11 @@
4017 if (!can_compound(slang, fword, mip->mi_compflags))
4018 continue;
4019 }
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. */
4024 + continue;
4025 }
4026
4027 /* Check NEEDCOMPOUND: can't use word without compounding. */
4028 @@ -1727,6 +1741,39 @@
4029 }
4030
4031 /*
4032 + * Return TRUE if there is a match between the word ptr[wlen] and
4033 + * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
4034 + * word.
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.
4037 + */
4038 + static int
4039 +match_checkcompoundpattern(ptr, wlen, gap)
4040 + char_u *ptr;
4041 + int wlen;
4042 + garray_T *gap; /* &sl_comppat */
4043 +{
4044 + int i;
4045 + char_u *p;
4046 + int len;
4047 +
4048 + for (i = 0; i + 1 < gap->ga_len; i += 2)
4049 + {
4050 + p = ((char_u **)gap->ga_data)[i + 1];
4051 + if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
4052 + {
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];
4056 + len = STRLEN(p);
4057 + if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
4058 + return TRUE;
4059 + }
4060 + }
4061 + return FALSE;
4062 +}
4063 +
4064 +/*
4065 * Return TRUE if "flags" is a valid sequence of compound flags and "word"
4066 * does not have too many syllables.
4067 */
4068 @@ -1773,6 +1820,98 @@
4069 }
4070
4071 /*
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.
4075 + */
4076 + static int
4077 +can_be_compound(sp, slang, compflags, flag)
4078 + trystate_T *sp;
4079 + slang_T *slang;
4080 + char_u *compflags;
4081 + int flag;
4082 +{
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))
4087 + return FALSE;
4088 +
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)
4093 + {
4094 + int v;
4095 +
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;
4100 + return v;
4101 + }
4102 +
4103 + return TRUE;
4104 +}
4105 +
4106 +
4107 +/*
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.
4112 + */
4113 + static int
4114 +match_compoundrule(slang, compflags)
4115 + slang_T *slang;
4116 + char_u *compflags;
4117 +{
4118 + char_u *p;
4119 + int i;
4120 + int c;
4121 +
4122 + /* loop over all the COMPOUNDRULE entries */
4123 + for (p = slang->sl_comprules; *p != NUL; ++p)
4124 + {
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)
4128 + {
4129 + c = compflags[i];
4130 + if (c == NUL)
4131 + /* found a rule that matches for the flags we have so far */
4132 + return TRUE;
4133 + if (*p == '/' || *p == NUL)
4134 + break; /* end of rule, it's too short */
4135 + if (*p == '[')
4136 + {
4137 + int match = FALSE;
4138 +
4139 + /* compare against all the flags in [] */
4140 + ++p;
4141 + while (*p != ']' && *p != NUL)
4142 + if (*p++ == c)
4143 + match = TRUE;
4144 + if (!match)
4145 + break; /* none matches */
4146 + }
4147 + else if (*p != c)
4148 + break; /* flag of word doesn't match flag in pattern */
4149 + ++p;
4150 + }
4151 +
4152 + /* Skip to the next "/", where the next pattern starts. */
4153 + p = vim_strchr(p, '/');
4154 + if (p == NULL)
4155 + break;
4156 + }
4157 +
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. */
4160 + return FALSE;
4161 +}
4162 +
4163 +/*
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;
4169
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;
4178
4179 @@ -3460,6 +3601,7 @@
4180 char_u *pp;
4181 char_u *cp;
4182 char_u *ap;
4183 + char_u *crp;
4184 int cnt;
4185 garray_T *gap;
4186
4187 @@ -3545,6 +3687,12 @@
4188 slang->sl_compallflags = ap;
4189 *ap = NUL;
4190
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;
4196 +
4197 pp = pat;
4198 *pp++ = '^';
4199 *pp++ = '\\';
4200 @@ -3587,6 +3735,20 @@
4201 atstart = 0;
4202 }
4203 }
4204 +
4205 + /* Copy flag to "sl_comprules", unless we run into a wildcard. */
4206 + if (crp != NULL)
4207 + {
4208 + if (c == '+' || c == '*')
4209 + {
4210 + vim_free(slang->sl_comprules);
4211 + slang->sl_comprules = NULL;
4212 + crp = NULL;
4213 + }
4214 + else
4215 + *crp++ = c;
4216 + }
4217 +
4218 if (c == '/') /* slash separates two items */
4219 {
4220 *pp++ = '\\';
4221 @@ -3611,6 +3773,9 @@
4222 *pp++ = '$';
4223 *pp = NUL;
4224
4225 + if (crp != NULL)
4226 + *crp = NUL;
4227 +
4228 slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
4229 vim_free(pat);
4230 if (slang->sl_compprog == NULL)
4231 @@ -4915,6 +5080,7 @@
4232 } spellinfo_T;
4233
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. */
4250 if (itemcnt > 0)
4251 {
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)
4255 {
4256 #ifdef FEAT_MBYTE
4257 /* Setup for conversion from "ENC" to 'encoding'. */
4258 @@ -5239,7 +5404,7 @@
4259 smsg((char_u *)_("Conversion in %s not supported"), fname);
4260 #endif
4261 }
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)
4265 {
4266 if (STRCMP(items[1], "long") == 0)
4267 @@ -5284,69 +5449,71 @@
4268 spin->si_info = p;
4269 }
4270 }
4271 - else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
4272 + else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
4273 && midword == NULL)
4274 {
4275 midword = getroom_save(spin, items[1]);
4276 }
4277 - else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
4278 + else if (is_aff_rule(items, itemcnt, "TRY", 2))
4279 {
4280 /* ignored, we look in the tree for what chars may appear */
4281 }
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)
4289 {
4290 aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
4291 fname, lnum);
4292 }
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)
4299 {
4300 aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
4301 fname, lnum);
4302 }
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)
4308 {
4309 aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
4310 fname, lnum);
4311 }
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)
4315 {
4316 aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
4317 fname, lnum);
4318 }
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)
4322 {
4323 aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
4324 fname, lnum);
4325 }
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)
4329 {
4330 aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
4331 fname, lnum);
4332 }
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)
4337 {
4338 aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
4339 fname, lnum);
4340 }
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)
4344 {
4345 aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
4346 fname, lnum);
4347 }
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)
4352 {
4353 aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
4354 fname, lnum);
4355 @@ -5354,8 +5521,8 @@
4356 smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
4357 fname, lnum);
4358 }
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)
4363 {
4364 aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
4365 fname, lnum);
4366 @@ -5363,7 +5530,7 @@
4367 smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
4368 fname, lnum);
4369 }
4370 - else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
4371 + else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
4372 && compflags == NULL)
4373 {
4374 /* Turn flag "c" into COMPOUNDRULE compatible string "c+",
4375 @@ -5376,7 +5543,15 @@
4376 compflags = p;
4377 }
4378 }
4379 - else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
4380 + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
4381 + {
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]);
4387 + }
4388 + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
4389 {
4390 /* Concatenate this string to previously defined ones, using a
4391 * slash to separate them. */
4392 @@ -5395,7 +5570,7 @@
4393 compflags = p;
4394 }
4395 }
4396 - else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
4397 + else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
4398 && compmax == 0)
4399 {
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]);
4404 }
4405 - else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
4406 + else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
4407 && compminlen == 0)
4408 {
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]);
4413 }
4414 - else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
4415 + else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
4416 && compsylmax == 0)
4417 {
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]);
4422 }
4423 - else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
4424 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
4425 {
4426 compoptions |= COMP_CHECKDUP;
4427 }
4428 - else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
4429 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
4430 {
4431 compoptions |= COMP_CHECKREP;
4432 }
4433 - else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
4434 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
4435 {
4436 compoptions |= COMP_CHECKCASE;
4437 }
4438 - else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
4439 - && itemcnt == 1)
4440 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
4441 {
4442 compoptions |= COMP_CHECKTRIPLE;
4443 }
4444 - else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
4445 - && itemcnt == 2)
4446 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
4447 {
4448 if (atoi((char *)items[1]) == 0)
4449 smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
4450 fname, lnum, items[1]);
4451 }
4452 - else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
4453 - && itemcnt == 3)
4454 + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
4455 {
4456 garray_T *gap = &spin->si_comppat;
4457 int i;
4458 @@ -5463,24 +5635,24 @@
4459 = getroom_save(spin, items[2]);
4460 }
4461 }
4462 - else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
4463 + else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
4464 && syllable == NULL)
4465 {
4466 syllable = getroom_save(spin, items[1]);
4467 }
4468 - else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
4469 + else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
4470 {
4471 spin->si_nobreak = TRUE;
4472 }
4473 - else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
4474 + else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
4475 {
4476 spin->si_nosplitsugs = TRUE;
4477 }
4478 - else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
4479 + else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
4480 {
4481 spin->si_nosugfile = TRUE;
4482 }
4483 - else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
4484 + else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
4485 {
4486 aff->af_pfxpostpone = TRUE;
4487 }
4488 @@ -5771,24 +5943,20 @@
4489 }
4490 }
4491 }
4492 - else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
4493 - && fol == NULL)
4494 + else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
4495 {
4496 fol = vim_strsave(items[1]);
4497 }
4498 - else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
4499 - && low == NULL)
4500 + else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
4501 {
4502 low = vim_strsave(items[1]);
4503 }
4504 - else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
4505 - && upp == NULL)
4506 + else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
4507 {
4508 upp = vim_strsave(items[1]);
4509 }
4510 - else if ((STRCMP(items[0], "REP") == 0
4511 - || STRCMP(items[0], "REPSAL") == 0)
4512 - && itemcnt == 2)
4513 + else if (is_aff_rule(items, itemcnt, "REP", 2)
4514 + || is_aff_rule(items, itemcnt, "REPSAL", 2))
4515 {
4516 /* Ignore REP/REPSAL count */;
4517 if (!isdigit(*items[1]))
4518 @@ -5819,7 +5987,7 @@
4519 : &spin->si_rep, items[1], items[2]);
4520 }
4521 }
4522 - else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
4523 + else if (is_aff_rule(items, itemcnt, "MAP", 2))
4524 {
4525 /* MAP item or count */
4526 if (!found_map)
4527 @@ -5856,9 +6024,8 @@
4528 ga_append(&spin->si_map, '/');
4529 }
4530 }
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))
4536 {
4537 if (do_sal)
4538 {
4539 @@ -5877,12 +6044,12 @@
4540 : items[2]);
4541 }
4542 }
4543 - else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
4544 + else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
4545 && sofofrom == NULL)
4546 {
4547 sofofrom = getroom_save(spin, items[1]);
4548 }
4549 - else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
4550 + else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
4551 && sofoto == NULL)
4552 {
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"));
4557 else
4558 - MSG(_("Too many posponed prefixes and/or compound flags"));
4559 + MSG(_("Too many postponed prefixes and/or compound flags"));
4560 }
4561
4562 if (syllable != NULL)
4563 @@ -6017,6 +6184,22 @@
4564 }
4565
4566 /*
4567 + * Return TRUE when items[0] equals "rulename", there are "mincount" items or
4568 + * a comment is following after item "mincount".
4569 + */
4570 + static int
4571 +is_aff_rule(items, itemcnt, rulename, mincount)
4572 + char_u **items;
4573 + int itemcnt;
4574 + char *rulename;
4575 + int mincount;
4576 +{
4577 + return (STRCMP(items[0], rulename) == 0
4578 + && (itemcnt == mincount
4579 + || (itemcnt > mincount && items[mincount][0] == '#')));
4580 +}
4581 +
4582 +/*
4583 * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
4584 * ae_flags to ae_comppermit and ae_compforbid.
4585 */
4586 @@ -7926,6 +8109,8 @@
4587 char_u *p;
4588 int rr;
4589 int retval = OK;
4590 + size_t fwv = 1; /* collect return value of fwrite() to avoid
4591 + warnings from picky compiler */
4592
4593 fd = mch_fopen((char *)fname, "w");
4594 if (fd == NULL)
4595 @@ -7936,11 +8121,11 @@
4596
4597 /* <HEADER>: <fileID> <versionnr> */
4598 /* <fileID> */
4599 - if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)
4600 - {
4601 - EMSG(_(e_write));
4602 - retval = FAIL;
4603 - }
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. */
4607 + goto theend;
4608 +
4609 putc(VIMSPELLVERSION, fd); /* <versionnr> */
4610
4611 /*
4612 @@ -7955,7 +8140,7 @@
4613
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> */
4618 }
4619
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;
4629 }
4630 @@ -8016,7 +8201,7 @@
4631 }
4632
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> */
4636 }
4637
4638 /* SN_MIDWORD: <midword> */
4639 @@ -8027,7 +8212,8 @@
4640
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);
4645 + /* <midword> */
4646 }
4647
4648 /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
4649 @@ -8113,7 +8299,8 @@
4650 p = rr == 1 ? ftp->ft_from : ftp->ft_to;
4651 l = (int)STRLEN(p);
4652 putc(l, fd);
4653 - fwrite(p, l, (size_t)1, fd);
4654 + if (l > 0)
4655 + fwv &= fwrite(p, l, (size_t)1, fd);
4656 }
4657 }
4658
4659 @@ -8131,11 +8318,11 @@
4660 /* <sectionlen> */
4661
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> */
4665
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> */
4670 }
4671
4672 /* SN_WORDS: <word> ...
4673 @@ -8160,7 +8347,7 @@
4674 l = (int)STRLEN(hi->hi_key) + 1;
4675 len += l;
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);
4679 --todo;
4680 }
4681 if (round == 1)
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);
4688 /* <mapstr> */
4689 }
4690
4691 @@ -8232,10 +8419,11 @@
4692 {
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> */
4698 }
4699 /* <compflags> */
4700 - fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
4701 + fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
4702 (size_t)1, fd);
4703 }
4704
4705 @@ -8259,7 +8447,8 @@
4706
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);
4711 + /* <syllable> */
4712 }
4713
4714 /* end of <SECTIONS> */
4715 @@ -8295,13 +8484,18 @@
4716 (void)put_node(fd, tree, 0, regionmask, round == 3);
4717 }
4718
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)
4722 retval = FAIL;
4723 -
4724 +theend:
4725 if (fclose(fd) == EOF)
4726 retval = FAIL;
4727
4728 + if (fwv != (size_t)1)
4729 + retval = FAIL;
4730 + if (retval == FAIL)
4731 + EMSG(_(e_write));
4732 +
4733 return retval;
4734 }
4735
4736 @@ -9890,6 +10084,7 @@
4737 char_u *p;
4738 int len;
4739 int totlen;
4740 + size_t x = 1; /* collect return value of fwrite() */
4741
4742 if (fd != NULL)
4743 put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
4744 @@ -9906,7 +10101,7 @@
4745 if (fd != NULL)
4746 {
4747 fputc(len, fd);
4748 - fwrite(p, (size_t)len, (size_t)1, fd);
4749 + x &= fwrite(p, (size_t)len, (size_t)1, fd);
4750 }
4751 totlen += len;
4752 }
4753 @@ -11480,15 +11675,24 @@
4754 vim_strncpy(preword + sp->ts_prewordlen,
4755 tword + sp->ts_splitoff,
4756 sp->ts_twordlen - sp->ts_splitoff);
4757 - p = preword;
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. */
4764 +
4765 + /* Verify CHECKCOMPOUNDPATTERN rules. */
4766 + if (match_checkcompoundpattern(preword, sp->ts_prewordlen,
4767 + &slang->sl_comppat))
4768 compound_ok = FALSE;
4769
4770 + if (compound_ok)
4771 + {
4772 + p = preword;
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;
4780 + }
4781 +
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))))
4795 +
4796 {
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
4802 @@ -459,7 +459,7 @@
4803 typedef struct
4804 {
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 */
4809 # endif
4810 # ifdef FEAT_WINDOWS
4811 @@ -1784,10 +1784,15 @@
4812 #endif
4813
4814 /*
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.
4818 */
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() */
4824 +#endif
4825 #ifdef FEAT_DIFF
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
4831 @@ -26,15 +26,17 @@
4832
4833 .SUFFIXES: .in .out
4834
4835 -nongui: nolog $(SCRIPTS)
4836 - @echo
4837 - @cat test.log
4838 - @echo ALL DONE
4839 +nongui: nolog $(SCRIPTS) report
4840 +
4841 +gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
4842
4843 -gui: nolog $(SCRIPTS) $(SCRIPTS_GUI)
4844 +report:
4845 @echo
4846 - @cat test.log
4847 - @echo ALL DONE
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; \
4852 + fi"
4853
4854 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
4855
4856 @@ -71,4 +73,4 @@
4857 test60.out: test60.vim
4858
4859 nolog:
4860 - -echo Test results: >test.log
4861 + -rm -f 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
4865 @@ -0,0 +1,91 @@
4866 +# Makefile to run tests for Vim, on Dos-like machines
4867 +# with sh.exe or zsh.exe in the path or not.
4868 +#
4869 +# Author: Bill McCarthy
4870 +#
4871 +# Note that test54 has been removed until it is fixed.
4872 +#
4873 +# Requires a set of Unix tools: echo, diff, etc.
4874 +
4875 +ifneq (sh.exe, $(SHELL))
4876 +DEL = rm -f
4877 +MV = mv
4878 +CP = cp
4879 +DIRSLASH = /
4880 +else
4881 +DEL = del
4882 +MV = rename
4883 +CP = copy
4884 +DIRSLASH = \\
4885 +endif
4886 +
4887 +VIMPROG = ..$(DIRSLASH)vim
4888 +
4889 +# Omitted:
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...
4896 +
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
4904 +
4905 +# Had to remove test54 which doesn't work yet.
4906 +# test54.out
4907 +
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
4914 +
4915 +SCRIPTS32 = test50.out
4916 +
4917 +SCRIPTS_GUI = test16.out
4918 +
4919 +.SUFFIXES: .in .out
4920 +
4921 +vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
4922 + echo ALL DONE
4923 +
4924 +nongui: fixff $(SCRIPTS16) $(SCRIPTS)
4925 + echo ALL DONE
4926 +
4927 +small:
4928 + echo ALL DONE
4929 +
4930 +gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
4931 + echo ALL DONE
4932 +
4933 +win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
4934 + echo ALL DONE
4935 +
4936 +fixff:
4937 + -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
4938 +
4939 +clean:
4940 + -$(DEL) *.out
4941 + -$(DEL) test.ok
4942 + -$(DEL) small.vim
4943 + -$(DEL) tiny.vim
4944 + -$(DEL) mbyte.vim
4945 + -$(DEL) X*
4946 + -$(DEL) viminfo
4947 +
4948 +.in.out:
4949 + $(CP) $*.ok test.ok
4950 + $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
4951 + diff test.out $*.ok
4952 + -$(DEL) $*.out
4953 + $(MV) test.out $*.out
4954 + -$(DEL) X*
4955 + -$(DEL) test.ok
4956 + -$(DEL) viminfo
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
4960 @@ -24,10 +24,17 @@
4961 :set nobin eol
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
4968 +:if has("vms")
4969 +: !copy XXUnix,XXDos XXUxDs.
4970 +: !copy XXUnix,XXMac XXUxMac.
4971 +: !copy XXDos,XXMac XXDosMac.
4972 +: !copy XXUnix,XXDos,XXMac XXUxDsMc.
4973 +:else
4974 +: !cat XXUnix XXDos >XXUxDs
4975 +: !cat XXUnix XXMac >XXUxMac
4976 +: !cat XXDos XXMac >XXDosMac
4977 +: !cat XXUnix XXDos XXMac >XXUxDsMc
4978 +:endif
4979 :"
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
4985 @@ -20,7 +20,7 @@
4986 ucs-2
4987
4988
4989 - fileencoding=ucs-2le
4990 + fileencoding=utf-16le
4991 bomb
4992 ucs-2le
4993
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
4997 @@ -3,8 +3,13 @@
4998 STARTTEST
4999 :so small.vim
5000 :e xx
5001 -:!rm -f test.out
5002 -:au BufLeave <buffer> :!echo buffer-local autommand in %>> test.out
5003 +:if has("vms")
5004 +: !del test.out.*
5005 +: au BufLeave <buffer> :!write sys$output "buffer-local autommand in %" > test.out
5006 +:else
5007 +: !rm -f test.out
5008 +: au BufLeave <buffer> :!echo buffer-local autommand in %>> test.out
5009 +:endif
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 @@
5017 #ifdef HAVE_DUP
5018 /* Use stderr for stdin, also works for shell commands. */
5019 close(0);
5020 - dup(2);
5021 + ignored = dup(2);
5022 #else
5023 read_cmd_fd = 2; /* read from stderr instead of stdin */
5024 #endif
5025 @@ -2020,7 +2020,7 @@
5026
5027 if (value == NULL || *length == 0)
5028 {
5029 - clip_free_selection(cbd); /* ??? [what's the query?] */
5030 + clip_free_selection(cbd); /* nothing received, clear register */
5031 *(int *)success = FALSE;
5032 return;
5033 }
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 @@
5044 int i;
5045 int nbytes = 0;
5046 char_u *buffer;
5047 + time_t start_time;
5048 + int timed_out = FALSE;
5049
5050 for (i =
5051 #ifdef FEAT_MBYTE
5052 @@ -2129,6 +2131,7 @@
5053 case 3: type = text_atom; break;
5054 default: type = XA_STRING;
5055 }
5056 + success = MAYBE;
5057 XtGetSelectionValue(myShell, cbd->sel_atom, type,
5058 clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
5059
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.
5063 */
5064 - for (;;)
5065 + start_time = time(NULL);
5066 + while (success == MAYBE)
5067 {
5068 - if (XCheckTypedEvent(dpy, SelectionNotify, &event))
5069 - break;
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))
5076 + {
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);
5084 + continue;
5085 + }
5086 +
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)
5093 + {
5094 + timed_out = TRUE;
5095 + break;
5096 + }
5097
5098 /* Do we need this? Probably not. */
5099 XSync(dpy, False);
5100
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);
5105 }
5106
5107 - /* this is where clip_x11_request_selection_cb() is actually called */
5108 - XtDispatchEvent(&event);
5109 -
5110 - if (success)
5111 + if (success == TRUE)
5112 return;
5113 +
5114 + /* don't do a retry with another type after timing out, otherwise we
5115 + * hang for 15 seconds. */
5116 + if (timed_out)
5117 + break;
5118 }
5119
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 */
5127 /**/
5128 + 65,
5129 +/**/
5130 + 64,
5131 +/**/
5132 + 63,
5133 +/**/
5134 + 62,
5135 +/**/
5136 + 61,
5137 +/**/
5138 + 60,
5139 +/**/
5140 + 59,
5141 +/**/
5142 + 58,
5143 +/**/
5144 + 57,
5145 +/**/
5146 + 56,
5147 +/**/
5148 + 55,
5149 +/**/
5150 + 54,
5151 +/**/
5152 + 53,
5153 +/**/
5154 + 52,
5155 +/**/
5156 + 51,
5157 +/**/
5158 + 50,
5159 +/**/
5160 + 49,
5161 +/**/
5162 + 48,
5163 +/**/
5164 + 47,
5165 +/**/
5166 + 46,
5167 +/**/
5168 + 45,
5169 +/**/
5170 + 44,
5171 +/**/
5172 + 43,
5173 +/**/
5174 + 42,
5175 +/**/
5176 + 41,
5177 +/**/
5178 + 40,
5179 +/**/
5180 + 39,
5181 +/**/
5182 + 38,
5183 +/**/
5184 + 37,
5185 +/**/
5186 + 36,
5187 +/**/
5188 + 35,
5189 +/**/
5190 + 34,
5191 +/**/
5192 + 33,
5193 +/**/
5194 + 32,
5195 +/**/
5196 + 31,
5197 +/**/
5198 + 30,
5199 +/**/
5200 + 29,
5201 +/**/
5202 + 28,
5203 +/**/
5204 + 27,
5205 +/**/
5206 + 26,
5207 +/**/
5208 + 25,
5209 +/**/
5210 + 24,
5211 +/**/
5212 + 23,
5213 +/**/
5214 + 22,
5215 +/**/
5216 + 21,
5217 +/**/
5218 + 20,
5219 +/**/
5220 + 19,
5221 +/**/
5222 + 18,
5223 +/**/
5224 + 17,
5225 +/**/
5226 + 16,
5227 +/**/
5228 + 15,
5229 +/**/
5230 + 14,
5231 +/**/
5232 + 13,
5233 +/**/
5234 + 12,
5235 +/**/
5236 + 11,
5237 +/**/
5238 + 10,
5239 +/**/
5240 + 9,
5241 +/**/
5242 + 8,
5243 +/**/
5244 + 7,
5245 +/**/
5246 + 6,
5247 +/**/
5248 + 5,
5249 +/**/
5250 + 4,
5251 +/**/
5252 + 3,
5253 +/**/
5254 + 2,
5255 +/**/
5256 + 1,
5257 +/**/
5258 0
5259 };
5260
5261 +/*
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".
5267 + */
5268 +static char *(extra_patches[]) =
5269 +{ /* Add your patch description below this line */
5270 +/**/
5271 + NULL
5272 +};
5273 +
5274 int
5275 highest_patch()
5276 {
5277 @@ -786,7 +929,7 @@
5278 MSG_PUTS(_("\nRISC OS version"));
5279 #endif
5280 #ifdef VMS
5281 - MSG_PUTS("\nOpenVMS version");
5282 + MSG_PUTS(_("\nOpenVMS version"));
5283 # ifdef HAVE_PATHDEF
5284 if (*compiled_arch != NUL)
5285 {
5286 @@ -825,6 +968,19 @@
5287 }
5288 }
5289
5290 + /* Print the list of extra patch descriptions if there is at least one. */
5291 + if (extra_patches[0] != NULL)
5292 + {
5293 + MSG_PUTS(_("\nExtra patches: "));
5294 + s = "";
5295 + for (i = 0; extra_patches[i] != NULL; ++i)
5296 + {
5297 + MSG_PUTS(s);
5298 + s = ", ";
5299 + MSG_PUTS(extra_patches[i]);
5300 + }
5301 + }
5302 +
5303 #ifdef MODIFIED_BY
5304 MSG_PUTS("\n");
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*?[{`%#'\"|!<")
5312 #else
5313 -# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
5314 -# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
5315 +# ifdef VMS
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*?{`\\%#'|!()&")
5319 +# else
5320 +# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
5321 +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
5322 +# endif
5323 #endif
5324
5325 #define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */
5326 @@ -370,7 +376,7 @@
5327 * Define __w64 as an empty token for everything but MSVC 7.x or later.
5328 */
5329 # if !defined(_MSC_VER) || (_MSC_VER < 1300)
5330 -# define __w64
5331 +# define __w64
5332 # endif
5333 typedef unsigned long __w64 long_u;
5334 typedef long __w64 long_i;
5335 @@ -1728,7 +1734,8 @@
5336 #define VV_MOUSE_COL 51
5337 #define VV_OP 52
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 */
5342
5343 #ifdef FEAT_CLIPBOARD
5344
5345 @@ -1979,6 +1986,9 @@
5346 # endif
5347 #endif
5348
5349 +#ifndef FEAT_NETBEANS_INTG
5350 +# undef NBDEBUG
5351 +#endif
5352 #ifdef NBDEBUG /* Netbeans debugging. */
5353 # include "nbdebug.h"
5354 #else
5355 @@ -2054,4 +2064,10 @@
5356 #define DOSO_VIMRC 1 /* loading vimrc file */
5357 #define DOSO_GVIMRC 2 /* loading gvimrc file */
5358
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 */
5364 +
5365 #endif /* VIM__H */
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
5369 @@ -531,7 +531,8 @@
5370 # ifdef FEAT_SCROLLBIND
5371 curwin->w_p_scb = FALSE;
5372 # endif
5373 - (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, ECMD_HIDE);
5374 + (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL,
5375 + ECMD_HIDE, NULL);
5376 if (nchar == 'F' && lnum >= 0)
5377 {
5378 curwin->w_cursor.lnum = lnum;
5379 @@ -4028,14 +4029,14 @@
5380 if (mch_dirname(cwd, MAXPATHL) == OK)
5381 globaldir = vim_strsave(cwd);
5382 }
5383 - mch_chdir((char *)curwin->w_localdir);
5384 - shorten_fnames(TRUE);
5385 + if (mch_chdir((char *)curwin->w_localdir) == 0)
5386 + shorten_fnames(TRUE);
5387 }
5388 else if (globaldir != NULL)
5389 {
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);
5395 globaldir = NULL;
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>");
5402 #endif
5403
5404 - strcpy(ffname, (char *) curbuf->b_ffname);
5405 - *filename = ffname; /* copy so nobody can change b_ffname */
5406 + if (curbuf->b_ffname == NULL)
5407 + ffname[0] = NUL;
5408 + else
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;
5414