CRUX-ARM : Home

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