[bef6db9] | 1 | Submitted By: Jim Gifford (jim at cross-lfs dot org) |
---|
| 2 | Date: 01-19-2009 |
---|
[d25b7db] | 3 | Initial Package Version: 7.2 |
---|
| 4 | Origin: Upstream |
---|
| 5 | Upstream Status: Applied |
---|
[bef6db9] | 6 | Description: Contains all upstream patches up to 7.2.084 |
---|
[d25b7db] | 7 | The following patches were skipped |
---|
| 8 | 007 036 041 049 071 072 074 |
---|
| 9 | |
---|
| 10 | diff -Naur vim72.orig/Filelist vim72/Filelist |
---|
| 11 | --- vim72.orig/Filelist 2008-07-06 11:02:23.000000000 -0700 |
---|
[bef6db9] | 12 | +++ vim72/Filelist 2009-01-19 00:08:05.000000000 -0800 |
---|
[d25b7db] | 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 |
---|
[bef6db9] | 23 | +++ vim72/runtime/doc/cmdline.txt 2009-01-19 00:08:30.000000000 -0800 |
---|
[d25b7db] | 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 |
---|
[bef6db9] | 82 | +++ vim72/runtime/doc/eval.txt 2009-01-19 00:10:10.000000000 -0800 |
---|
[d25b7db] | 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|. |
---|
[bef6db9] | 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-01-19 00:10:45.000000000 -0800 |
---|
| 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 |
---|
[d25b7db] | 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 |
---|
[bef6db9] | 224 | +++ vim72/runtime/doc/options.txt 2009-01-19 00:09:28.000000000 -0800 |
---|
[d25b7db] | 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 | @@ -7472,7 +7472,9 @@ |
---|
| 232 | {not available when compiled without the |+wildignore| |
---|
| 233 | feature} |
---|
| 234 | A list of file patterns. A file that matches with one of these |
---|
| 235 | - patterns is ignored when completing file or directory names. |
---|
| 236 | + patterns is ignored when completing file or directory names, and |
---|
| 237 | + influences the result of |expand()|, |glob()| and |globpath()| unless |
---|
| 238 | + a flag is passed to disable this. |
---|
| 239 | The pattern is used like with |:autocmd|, see |autocmd-patterns|. |
---|
| 240 | Also see 'suffixes'. |
---|
| 241 | Example: > |
---|
| 242 | diff -Naur vim72.orig/runtime/doc/spell.txt vim72/runtime/doc/spell.txt |
---|
| 243 | --- vim72.orig/runtime/doc/spell.txt 2008-08-09 07:23:00.000000000 -0700 |
---|
[bef6db9] | 244 | +++ vim72/runtime/doc/spell.txt 2009-01-19 00:09:54.000000000 -0800 |
---|
[d25b7db] | 245 | @@ -1,4 +1,4 @@ |
---|
| 246 | -*spell.txt* For Vim version 7.2. Last change: 2008 Jun 21 |
---|
| 247 | +*spell.txt* For Vim version 7.2. Last change: 2008 Nov 30 |
---|
| 248 | |
---|
| 249 | |
---|
| 250 | VIM REFERENCE MANUAL by Bram Moolenaar |
---|
| 251 | @@ -831,8 +831,11 @@ |
---|
| 252 | |
---|
| 253 | # comment line ~ |
---|
| 254 | |
---|
| 255 | -With some items it's also possible to put a comment after it, but this isn't |
---|
| 256 | -supported in general. |
---|
| 257 | +Items with a fixed number of arguments can be followed by a comment. But only |
---|
| 258 | +if none of the arguments can contain white space. The comment must start with |
---|
| 259 | +a "#" character. Example: |
---|
| 260 | + |
---|
| 261 | + KEEPCASE = # fix case for words with this flag ~ |
---|
| 262 | |
---|
| 263 | |
---|
| 264 | ENCODING *spell-SET* |
---|
| 265 | @@ -965,6 +968,9 @@ |
---|
| 266 | |
---|
| 267 | Note: When using utf-8 only characters up to 65000 may be used for flags. |
---|
| 268 | |
---|
| 269 | +Note: even when using "num" or "long" the number of flags available to |
---|
| 270 | +compounding and prefixes is limited to about 250. |
---|
| 271 | + |
---|
| 272 | |
---|
| 273 | AFFIXES |
---|
| 274 | *spell-PFX* *spell-SFX* |
---|
| 275 | @@ -1178,6 +1184,9 @@ |
---|
| 276 | The flag also applies to the word with affixes, thus this can be used to mark |
---|
| 277 | a whole bunch of related words as bad. |
---|
| 278 | |
---|
| 279 | + *spell-FORBIDDENWORD* |
---|
| 280 | +FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell. |
---|
| 281 | + |
---|
| 282 | *spell-NEEDAFFIX* |
---|
| 283 | The NEEDAFFIX flag is used to require that a word is used with an affix. The |
---|
| 284 | word itself is not a good word (unless there is an empty affix). Example: |
---|
| 285 | @@ -1268,6 +1277,10 @@ |
---|
| 286 | |
---|
| 287 | NEEDCOMPOUND & ~ |
---|
| 288 | |
---|
| 289 | + *spell-ONLYINCOMPOUND* |
---|
| 290 | +The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for |
---|
| 291 | +compatiblity with Hunspell. |
---|
| 292 | + |
---|
| 293 | *spell-COMPOUNDMIN* |
---|
| 294 | The minimal character length of a word used for compounding is specified with |
---|
| 295 | COMPOUNDMIN. Example: |
---|
| 296 | @@ -1328,6 +1341,20 @@ |
---|
| 297 | rules. Can also be used for an affix to count the affix as a compounding |
---|
| 298 | word. |
---|
| 299 | |
---|
| 300 | + *spell-CHECKCOMPOUNDPATTERN* |
---|
| 301 | +CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the |
---|
| 302 | +position where two words are compounded together forbids the compound. |
---|
| 303 | +For example: |
---|
| 304 | + CHECKCOMPOUNDPATTERN o e ~ |
---|
| 305 | + |
---|
| 306 | +This forbids compounding if the first word ends in "o" and the second word |
---|
| 307 | +starts with "e". |
---|
| 308 | + |
---|
| 309 | +The arguments must be plain text, no patterns are actually supported, despite |
---|
| 310 | +the item name. Case is always ignored. |
---|
| 311 | + |
---|
| 312 | +The Hunspell feature to use three arguments and flags is not supported. |
---|
| 313 | + |
---|
| 314 | *spell-SYLLABLE* |
---|
| 315 | The SYLLABLE item defines characters or character sequences that are used to |
---|
| 316 | count the number of syllables in a word. Example: |
---|
| 317 | @@ -1496,6 +1523,10 @@ |
---|
| 318 | ACCENT (Hunspell) *spell-ACCENT* |
---|
| 319 | Use MAP instead. |spell-MAP| |
---|
| 320 | |
---|
| 321 | +BREAK (Hunspell) *spell-BREAK* |
---|
| 322 | + Define break points. Unclear how it works exactly. |
---|
| 323 | + Not supported. |
---|
| 324 | + |
---|
| 325 | CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE* |
---|
| 326 | Disallow uppercase letters at compound word boundaries. |
---|
| 327 | Not supported. |
---|
| 328 | @@ -1512,9 +1543,6 @@ |
---|
| 329 | Forbid three identical characters when compounding. Not |
---|
| 330 | supported. |
---|
| 331 | |
---|
| 332 | -CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN* |
---|
| 333 | - Forbid compounding when patterns match. Not supported. |
---|
| 334 | - |
---|
| 335 | COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES* |
---|
| 336 | Enables using two prefixes. Not supported. |
---|
| 337 | |
---|
| 338 | @@ -1536,13 +1564,18 @@ |
---|
| 339 | COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE* |
---|
| 340 | Use COMPOUNDRULE instead. |spell-COMPOUNDRULE| |
---|
| 341 | |
---|
| 342 | +COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES* |
---|
| 343 | + Number of COMPOUNDRULE lines following. Ignored, but the |
---|
| 344 | + argument must be a number. |
---|
| 345 | + |
---|
| 346 | COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE* |
---|
| 347 | Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE| |
---|
| 348 | |spell-COMPOUNDSYLMAX| |
---|
| 349 | |
---|
| 350 | -FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD* |
---|
| 351 | - Use BAD instead. |spell-BAD| |
---|
| 352 | - |
---|
| 353 | +KEY (Hunspell) *spell-KEY* |
---|
| 354 | + Define characters that are close together on the keyboard. |
---|
| 355 | + Used to give better suggestions. Not supported. |
---|
| 356 | + |
---|
| 357 | LANG (Hunspell) *spell-LANG* |
---|
| 358 | This specifies language-specific behavior. This actually |
---|
| 359 | moves part of the language knowledge into the program, |
---|
| 360 | @@ -1553,10 +1586,7 @@ |
---|
| 361 | Only needed for morphological analysis. |
---|
| 362 | |
---|
| 363 | MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS* |
---|
| 364 | - Not supported. |
---|
| 365 | - |
---|
| 366 | -ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND* |
---|
| 367 | - Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND| |
---|
| 368 | + Set number of n-gram suggestions. Not supported. |
---|
| 369 | |
---|
| 370 | PSEUDOROOT (Hunspell) *spell-PSEUDOROOT* |
---|
| 371 | Use NEEDAFFIX instead. |spell-NEEDAFFIX| |
---|
| 372 | diff -Naur vim72.orig/runtime/doc/starting.txt vim72/runtime/doc/starting.txt |
---|
| 373 | --- vim72.orig/runtime/doc/starting.txt 2008-08-09 07:23:00.000000000 -0700 |
---|
[bef6db9] | 374 | +++ vim72/runtime/doc/starting.txt 2009-01-19 00:08:31.000000000 -0800 |
---|
[d25b7db] | 375 | @@ -1,4 +1,4 @@ |
---|
| 376 | -*starting.txt* For Vim version 7.2. Last change: 2008 Jun 21 |
---|
| 377 | +*starting.txt* For Vim version 7.2. Last change: 2008 Nov 09 |
---|
| 378 | |
---|
| 379 | |
---|
| 380 | VIM REFERENCE MANUAL by Bram Moolenaar |
---|
| 381 | @@ -1337,8 +1337,9 @@ |
---|
| 382 | *viminfo-read* |
---|
| 383 | When Vim is started and the 'viminfo' option is non-empty, the contents of |
---|
| 384 | the viminfo file are read and the info can be used in the appropriate places. |
---|
| 385 | -The marks are not read in at startup (but file marks are). See |
---|
| 386 | -|initialization| for how to set the 'viminfo' option upon startup. |
---|
| 387 | +The |v:oldfiles| variable is filled. The marks are not read in at startup |
---|
| 388 | +(but file marks are). See |initialization| for how to set the 'viminfo' |
---|
| 389 | +option upon startup. |
---|
| 390 | |
---|
| 391 | *viminfo-write* |
---|
| 392 | When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo |
---|
| 393 | @@ -1372,6 +1373,8 @@ |
---|
| 394 | that start with any string given with the "r" flag in 'viminfo'. This can be |
---|
| 395 | used to avoid saving marks for files on removable media (for MS-DOS you would |
---|
| 396 | use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:"). |
---|
| 397 | +The |v:oldfiles| variable is filled with the file names that the viminfo file |
---|
| 398 | +has marks for. |
---|
| 399 | |
---|
| 400 | *viminfo-file-marks* |
---|
| 401 | Uppercase marks ('A to 'Z) are stored when writing the viminfo file. The |
---|
| 402 | @@ -1463,8 +1466,8 @@ |
---|
| 403 | *:rv* *:rviminfo* *E195* |
---|
| 404 | :rv[iminfo][!] [file] Read from viminfo file [file] (default: see above). |
---|
| 405 | If [!] is given, then any information that is |
---|
| 406 | - already set (registers, marks, etc.) will be |
---|
| 407 | - overwritten. {not in Vi} |
---|
| 408 | + already set (registers, marks, |v:oldfiles|, etc.) |
---|
| 409 | + will be overwritten {not in Vi} |
---|
| 410 | |
---|
| 411 | *:wv* *:wviminfo* *E137* *E138* *E574* |
---|
| 412 | :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above). |
---|
| 413 | @@ -1479,4 +1482,20 @@ |
---|
| 414 | the .viminfo file. |
---|
| 415 | {not in Vi} |
---|
| 416 | |
---|
| 417 | + *:ol* *:oldfiles* |
---|
| 418 | +:ol[dfiles] List the files that have marks stored in the viminfo |
---|
| 419 | + file. This list is read on startup and only changes |
---|
| 420 | + afterwards with ":rviminfo!". Also see |v:oldfiles|. |
---|
| 421 | + The number can be used with |c_#<|. |
---|
| 422 | + {not in Vi, only when compiled with the +eval feature} |
---|
| 423 | + |
---|
| 424 | +:bro[wse] ol[dfiles][!] |
---|
| 425 | + List file names as with |:oldfiles|, and then prompt |
---|
| 426 | + for a number. When the number is valid that file from |
---|
| 427 | + the list is edited. |
---|
| 428 | + If you get the |press-enter| prompt you can press "q" |
---|
| 429 | + and still get the prompt to enter a file number. |
---|
| 430 | + Use ! to abondon a modified buffer. |abandon| |
---|
| 431 | + {not when compiled with tiny or small features} |
---|
| 432 | + |
---|
| 433 | vim:tw=78:ts=8:ft=help:norl: |
---|
| 434 | diff -Naur vim72.orig/runtime/doc/usr_21.txt vim72/runtime/doc/usr_21.txt |
---|
| 435 | --- vim72.orig/runtime/doc/usr_21.txt 2008-08-09 07:23:01.000000000 -0700 |
---|
[bef6db9] | 436 | +++ vim72/runtime/doc/usr_21.txt 2009-01-19 00:08:31.000000000 -0800 |
---|
[d25b7db] | 437 | @@ -1,4 +1,4 @@ |
---|
| 438 | -*usr_21.txt* For Vim version 7.2. Last change: 2007 May 01 |
---|
| 439 | +*usr_21.txt* For Vim version 7.2. Last change: 2008 Nov 09 |
---|
| 440 | |
---|
| 441 | VIM USER MANUAL - by Bram Moolenaar |
---|
| 442 | |
---|
| 443 | @@ -153,7 +153,7 @@ |
---|
| 444 | to be lost. Each item can be remembered only once. |
---|
| 445 | |
---|
| 446 | |
---|
| 447 | -GETTING BACK TO WHERE YOU WERE |
---|
| 448 | +GETTING BACK TO WHERE YOU STOPPED VIM |
---|
| 449 | |
---|
| 450 | You are halfway editing a file and it's time to leave for holidays. You exit |
---|
| 451 | Vim and go enjoy yourselves, forgetting all about your work. After a couple |
---|
| 452 | @@ -168,6 +168,48 @@ |
---|
| 453 | The |:marks| command is useful to find out where '0 to '9 will take you. |
---|
| 454 | |
---|
| 455 | |
---|
| 456 | +GETTING BACK TO SOME FILE |
---|
| 457 | + |
---|
| 458 | +If you want to go back to a file that you edited recently, but not when |
---|
| 459 | +exiting Vim, there is a slightly more complicated way. You can see a list of |
---|
| 460 | +files by typing the command: > |
---|
| 461 | + |
---|
| 462 | + :oldfiles |
---|
| 463 | +< 1: ~/.viminfo ~ |
---|
| 464 | + 2: ~/text/resume.txt ~ |
---|
| 465 | + 3: /tmp/draft ~ |
---|
| 466 | + |
---|
| 467 | +Now you would like to edit the second file, which is in the list preceded by |
---|
| 468 | +"2:". You type: > |
---|
| 469 | + |
---|
| 470 | + :e #<2 |
---|
| 471 | + |
---|
| 472 | +Instead of ":e" you can use any command that has a file name argument, the |
---|
| 473 | +"#<2" item works in the same place as "%" (current file name) and "#" |
---|
| 474 | +(alternate file name). So you can also split the window to edit the third |
---|
| 475 | +file: > |
---|
| 476 | + |
---|
| 477 | + :split #<3 |
---|
| 478 | + |
---|
| 479 | +That #<123 thing is a bit complicated when you just want to edit a file. |
---|
| 480 | +Fortunately there is a simpler way: > |
---|
| 481 | + |
---|
| 482 | + :browse oldfiles |
---|
| 483 | +< 1: ~/.viminfo ~ |
---|
| 484 | + 2: ~/text/resume.txt ~ |
---|
| 485 | + 3: /tmp/draft ~ |
---|
| 486 | + -- More -- |
---|
| 487 | + |
---|
| 488 | +You get the same list of files as with |:oldfiles|. If you want to edit |
---|
| 489 | +"resume.txt" first press "q" to stop the listing. You will get a prompt: |
---|
| 490 | + |
---|
| 491 | + Type number and <Enter> (empty cancels): ~ |
---|
| 492 | + |
---|
| 493 | +Type "2" and press <Enter> to edit the second file. |
---|
| 494 | + |
---|
| 495 | +More info at |:oldfiles|, |v:oldfiles| and |c_#<|. |
---|
| 496 | + |
---|
| 497 | + |
---|
| 498 | MOVE INFO FROM ONE VIM TO ANOTHER |
---|
| 499 | |
---|
| 500 | You can use the ":wviminfo" and ":rviminfo" commands to save and restore the |
---|
| 501 | diff -Naur vim72.orig/runtime/scripts.vim vim72/runtime/scripts.vim |
---|
| 502 | --- vim72.orig/runtime/scripts.vim 2008-08-08 15:27:21.000000000 -0700 |
---|
[bef6db9] | 503 | +++ vim72/runtime/scripts.vim 2009-01-19 00:07:18.000000000 -0800 |
---|
[d25b7db] | 504 | @@ -234,6 +234,10 @@ |
---|
| 505 | elseif s:line1 =~ '\<DTD\s\+XHTML\s' |
---|
| 506 | set ft=xhtml |
---|
| 507 | |
---|
| 508 | + " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN") |
---|
| 509 | + elseif s:line1 =~? '\<DOCTYPE\s\+html\>' |
---|
| 510 | + set ft=html |
---|
| 511 | + |
---|
| 512 | " PDF |
---|
| 513 | elseif s:line1 =~ '^%PDF-' |
---|
| 514 | set ft=pdf |
---|
| 515 | diff -Naur vim72.orig/src/auto/configure vim72/src/auto/configure |
---|
| 516 | --- vim72.orig/src/auto/configure 2008-07-24 05:40:36.000000000 -0700 |
---|
[bef6db9] | 517 | +++ vim72/src/auto/configure 2009-01-19 00:09:07.000000000 -0800 |
---|
[d25b7db] | 518 | @@ -16819,21 +16819,29 @@ |
---|
| 519 | LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" |
---|
| 520 | fi |
---|
| 521 | |
---|
| 522 | -{ $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5 |
---|
| 523 | -$as_echo_n "checking for GCC 3 or later... " >&6; } |
---|
| 524 | DEPEND_CFLAGS_FILTER= |
---|
| 525 | if test "$GCC" = yes; then |
---|
| 526 | + { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5 |
---|
| 527 | +$as_echo_n "checking for GCC 3 or later... " >&6; } |
---|
| 528 | gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'` |
---|
| 529 | if test "$gccmajor" -gt "2"; then |
---|
| 530 | DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'" |
---|
| 531 | - fi |
---|
| 532 | -fi |
---|
| 533 | -if test "$DEPEND_CFLAGS_FILTER" = ""; then |
---|
| 534 | - { $as_echo "$as_me:$LINENO: result: no" >&5 |
---|
| 535 | + { $as_echo "$as_me:$LINENO: result: yes" >&5 |
---|
| 536 | +$as_echo "yes" >&6; } |
---|
| 537 | + else |
---|
| 538 | + { $as_echo "$as_me:$LINENO: result: no" >&5 |
---|
| 539 | $as_echo "no" >&6; } |
---|
| 540 | -else |
---|
| 541 | - { $as_echo "$as_me:$LINENO: result: yes" >&5 |
---|
| 542 | + fi |
---|
| 543 | + { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5 |
---|
| 544 | +$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; } |
---|
| 545 | + if test "$gccmajor" -gt "3"; then |
---|
| 546 | + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1" |
---|
| 547 | + { $as_echo "$as_me:$LINENO: result: yes" >&5 |
---|
| 548 | $as_echo "yes" >&6; } |
---|
| 549 | + else |
---|
| 550 | + { $as_echo "$as_me:$LINENO: result: no" >&5 |
---|
| 551 | +$as_echo "no" >&6; } |
---|
| 552 | + fi |
---|
| 553 | fi |
---|
| 554 | |
---|
| 555 | |
---|
| 556 | diff -Naur vim72.orig/src/buffer.c vim72/src/buffer.c |
---|
| 557 | --- vim72.orig/src/buffer.c 2008-08-06 04:00:48.000000000 -0700 |
---|
[bef6db9] | 558 | +++ vim72/src/buffer.c 2009-01-19 00:10:45.000000000 -0800 |
---|
| 559 | @@ -437,10 +437,6 @@ |
---|
| 560 | return; |
---|
| 561 | #endif |
---|
| 562 | |
---|
| 563 | -#ifdef FEAT_NETBEANS_INTG |
---|
| 564 | - if (usingNetbeans) |
---|
| 565 | - netbeans_file_closed(buf); |
---|
| 566 | -#endif |
---|
| 567 | /* Change directories when the 'acd' option is set. */ |
---|
| 568 | DO_AUTOCHDIR |
---|
| 569 | |
---|
| 570 | @@ -639,6 +635,10 @@ |
---|
| 571 | #ifdef FEAT_SIGNS |
---|
| 572 | buf_delete_signs(buf); /* delete any signs */ |
---|
| 573 | #endif |
---|
| 574 | +#ifdef FEAT_NETBEANS_INTG |
---|
| 575 | + if (usingNetbeans) |
---|
| 576 | + netbeans_file_killed(buf); |
---|
| 577 | +#endif |
---|
| 578 | #ifdef FEAT_LOCALMAP |
---|
| 579 | map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */ |
---|
| 580 | map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */ |
---|
[d25b7db] | 581 | @@ -647,6 +647,9 @@ |
---|
| 582 | vim_free(buf->b_start_fenc); |
---|
| 583 | buf->b_start_fenc = NULL; |
---|
| 584 | #endif |
---|
| 585 | +#ifdef FEAT_SPELL |
---|
| 586 | + ga_clear(&buf->b_langp); |
---|
| 587 | +#endif |
---|
| 588 | } |
---|
| 589 | |
---|
| 590 | /* |
---|
[bef6db9] | 591 | @@ -812,9 +815,6 @@ |
---|
| 592 | int bnr; /* buffer number */ |
---|
| 593 | char_u *p; |
---|
| 594 | |
---|
| 595 | -#ifdef FEAT_NETBEANS_INTG |
---|
| 596 | - netbeansCloseFile = 1; |
---|
| 597 | -#endif |
---|
| 598 | if (addr_count == 0) |
---|
| 599 | { |
---|
| 600 | (void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit); |
---|
| 601 | @@ -909,9 +909,6 @@ |
---|
| 602 | } |
---|
| 603 | } |
---|
| 604 | |
---|
| 605 | -#ifdef FEAT_NETBEANS_INTG |
---|
| 606 | - netbeansCloseFile = 0; |
---|
| 607 | -#endif |
---|
| 608 | |
---|
| 609 | return errormsg; |
---|
| 610 | } |
---|
| 611 | @@ -1237,7 +1234,7 @@ |
---|
[d25b7db] | 612 | * "buf" if one exists */ |
---|
| 613 | if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf)) |
---|
| 614 | return OK; |
---|
| 615 | - /* If 'switchbuf' contians "usetab": jump to first window in any tab |
---|
| 616 | + /* If 'switchbuf' contains "usetab": jump to first window in any tab |
---|
| 617 | * page containing "buf" if one exists */ |
---|
| 618 | if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf)) |
---|
| 619 | return OK; |
---|
[bef6db9] | 620 | @@ -1351,11 +1348,12 @@ |
---|
[d25b7db] | 621 | } |
---|
| 622 | } |
---|
| 623 | #ifdef FEAT_AUTOCMD |
---|
| 624 | + /* An autocommand may have deleted "buf", already entered it (e.g., when |
---|
| 625 | + * it did ":bunload") or aborted the script processing! */ |
---|
| 626 | # ifdef FEAT_EVAL |
---|
| 627 | - /* An autocommand may have deleted buf or aborted the script processing! */ |
---|
| 628 | - if (buf_valid(buf) && !aborting()) |
---|
| 629 | + if (buf_valid(buf) && buf != curbuf && !aborting()) |
---|
| 630 | # else |
---|
| 631 | - if (buf_valid(buf)) /* an autocommand may have deleted buf! */ |
---|
| 632 | + if (buf_valid(buf) && buf != curbuf) |
---|
| 633 | # endif |
---|
| 634 | #endif |
---|
| 635 | enter_buffer(buf); |
---|
[bef6db9] | 636 | @@ -1397,6 +1395,9 @@ |
---|
[d25b7db] | 637 | curwin->w_cursor.coladd = 0; |
---|
| 638 | #endif |
---|
| 639 | curwin->w_set_curswant = TRUE; |
---|
| 640 | +#ifdef FEAT_AUTOCMD |
---|
| 641 | + curwin->w_topline_was_set = FALSE; |
---|
| 642 | +#endif |
---|
| 643 | |
---|
| 644 | /* Make sure the buffer is loaded. */ |
---|
| 645 | if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */ |
---|
[bef6db9] | 646 | @@ -1436,7 +1437,8 @@ |
---|
[d25b7db] | 647 | maketitle(); |
---|
| 648 | #endif |
---|
| 649 | #ifdef FEAT_AUTOCMD |
---|
| 650 | - if (curwin->w_topline == 1) /* when autocmds didn't change it */ |
---|
| 651 | + /* when autocmds didn't change it */ |
---|
| 652 | + if (curwin->w_topline == 1 && !curwin->w_topline_was_set) |
---|
| 653 | #endif |
---|
| 654 | scroll_cursor_halfway(FALSE); /* redisplay at correct position */ |
---|
| 655 | |
---|
[bef6db9] | 656 | @@ -3963,7 +3965,7 @@ |
---|
[d25b7db] | 657 | width = vim_strsize(out); |
---|
| 658 | if (maxwidth > 0 && width > maxwidth) |
---|
| 659 | { |
---|
| 660 | - /* Result is too long, must trunctate somewhere. */ |
---|
| 661 | + /* Result is too long, must truncate somewhere. */ |
---|
| 662 | l = 0; |
---|
| 663 | if (itemcnt == 0) |
---|
| 664 | s = out; |
---|
[bef6db9] | 665 | @@ -5062,7 +5064,7 @@ |
---|
[d25b7db] | 666 | { |
---|
| 667 | if (buf->b_sfname != NULL) |
---|
| 668 | return (char *)buf->b_sfname; |
---|
| 669 | - return "[Scratch]"; |
---|
| 670 | + return _("[Scratch]"); |
---|
| 671 | } |
---|
| 672 | #endif |
---|
| 673 | if (buf->b_fname == NULL) |
---|
| 674 | diff -Naur vim72.orig/src/configure.in vim72/src/configure.in |
---|
| 675 | --- vim72.orig/src/configure.in 2008-07-24 05:40:26.000000000 -0700 |
---|
[bef6db9] | 676 | +++ vim72/src/configure.in 2009-01-19 00:09:07.000000000 -0800 |
---|
[d25b7db] | 677 | @@ -3152,18 +3152,25 @@ |
---|
| 678 | dnl But only when making dependencies, cproto and lint don't take "-isystem". |
---|
| 679 | dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow |
---|
| 680 | dnl the number before the version number. |
---|
| 681 | -AC_MSG_CHECKING(for GCC 3 or later) |
---|
| 682 | DEPEND_CFLAGS_FILTER= |
---|
| 683 | if test "$GCC" = yes; then |
---|
| 684 | + AC_MSG_CHECKING(for GCC 3 or later) |
---|
| 685 | gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'` |
---|
| 686 | if test "$gccmajor" -gt "2"; then |
---|
| 687 | DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'" |
---|
| 688 | + AC_MSG_RESULT(yes) |
---|
| 689 | + else |
---|
| 690 | + AC_MSG_RESULT(no) |
---|
| 691 | + fi |
---|
| 692 | + dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is |
---|
| 693 | + dnl declared as char x[1] but actually longer. Introduced in gcc 4.0. |
---|
| 694 | + AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1) |
---|
| 695 | + if test "$gccmajor" -gt "3"; then |
---|
| 696 | + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1" |
---|
| 697 | + AC_MSG_RESULT(yes) |
---|
| 698 | + else |
---|
| 699 | + AC_MSG_RESULT(no) |
---|
| 700 | fi |
---|
| 701 | -fi |
---|
| 702 | -if test "$DEPEND_CFLAGS_FILTER" = ""; then |
---|
| 703 | - AC_MSG_RESULT(no) |
---|
| 704 | -else |
---|
| 705 | - AC_MSG_RESULT(yes) |
---|
| 706 | fi |
---|
| 707 | AC_SUBST(DEPEND_CFLAGS_FILTER) |
---|
| 708 | |
---|
| 709 | diff -Naur vim72.orig/src/diff.c vim72/src/diff.c |
---|
| 710 | --- vim72.orig/src/diff.c 2008-03-05 03:16:56.000000000 -0800 |
---|
[bef6db9] | 711 | +++ vim72/src/diff.c 2009-01-19 00:09:50.000000000 -0800 |
---|
[d25b7db] | 712 | @@ -73,6 +73,8 @@ |
---|
| 713 | { |
---|
| 714 | tp->tp_diffbuf[i] = NULL; |
---|
| 715 | tp->tp_diff_invalid = TRUE; |
---|
| 716 | + if (tp == curtab) |
---|
| 717 | + diff_redraw(TRUE); |
---|
| 718 | } |
---|
| 719 | } |
---|
| 720 | } |
---|
| 721 | @@ -102,6 +104,7 @@ |
---|
| 722 | { |
---|
| 723 | curtab->tp_diffbuf[i] = NULL; |
---|
| 724 | curtab->tp_diff_invalid = TRUE; |
---|
| 725 | + diff_redraw(TRUE); |
---|
| 726 | } |
---|
| 727 | } |
---|
| 728 | } |
---|
| 729 | @@ -131,6 +134,7 @@ |
---|
| 730 | { |
---|
| 731 | curtab->tp_diffbuf[i] = buf; |
---|
| 732 | curtab->tp_diff_invalid = TRUE; |
---|
| 733 | + diff_redraw(TRUE); |
---|
| 734 | return; |
---|
| 735 | } |
---|
| 736 | |
---|
| 737 | @@ -661,6 +665,7 @@ |
---|
| 738 | char_u *tmp_diff; |
---|
| 739 | FILE *fd; |
---|
| 740 | int ok; |
---|
| 741 | + int io_error = FALSE; |
---|
| 742 | |
---|
| 743 | /* Delete all diffblocks. */ |
---|
| 744 | diff_clear(curtab); |
---|
| 745 | @@ -697,18 +702,26 @@ |
---|
| 746 | { |
---|
| 747 | ok = FALSE; |
---|
| 748 | fd = mch_fopen((char *)tmp_orig, "w"); |
---|
| 749 | - if (fd != NULL) |
---|
| 750 | + if (fd == NULL) |
---|
| 751 | + io_error = TRUE; |
---|
| 752 | + else |
---|
| 753 | { |
---|
| 754 | - fwrite("line1\n", (size_t)6, (size_t)1, fd); |
---|
| 755 | + if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1) |
---|
| 756 | + io_error = TRUE; |
---|
| 757 | fclose(fd); |
---|
| 758 | fd = mch_fopen((char *)tmp_new, "w"); |
---|
| 759 | - if (fd != NULL) |
---|
| 760 | + if (fd == NULL) |
---|
| 761 | + io_error = TRUE; |
---|
| 762 | + else |
---|
| 763 | { |
---|
| 764 | - fwrite("line2\n", (size_t)6, (size_t)1, fd); |
---|
| 765 | + if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1) |
---|
| 766 | + io_error = TRUE; |
---|
| 767 | fclose(fd); |
---|
| 768 | diff_file(tmp_orig, tmp_new, tmp_diff); |
---|
| 769 | fd = mch_fopen((char *)tmp_diff, "r"); |
---|
| 770 | - if (fd != NULL) |
---|
| 771 | + if (fd == NULL) |
---|
| 772 | + io_error = TRUE; |
---|
| 773 | + else |
---|
| 774 | { |
---|
| 775 | char_u linebuf[LBUFLEN]; |
---|
| 776 | |
---|
| 777 | @@ -761,6 +774,8 @@ |
---|
| 778 | } |
---|
| 779 | if (!ok) |
---|
| 780 | { |
---|
| 781 | + if (io_error) |
---|
| 782 | + EMSG(_("E810: Cannot read or write temp files")); |
---|
| 783 | EMSG(_("E97: Cannot create diffs")); |
---|
| 784 | diff_a_works = MAYBE; |
---|
| 785 | #if defined(MSWIN) || defined(MSDOS) |
---|
| 786 | @@ -925,10 +940,10 @@ |
---|
| 787 | { |
---|
| 788 | # ifdef TEMPDIRNAMES |
---|
| 789 | if (vim_tempdir != NULL) |
---|
| 790 | - mch_chdir((char *)vim_tempdir); |
---|
| 791 | + ignored = mch_chdir((char *)vim_tempdir); |
---|
| 792 | else |
---|
| 793 | # endif |
---|
| 794 | - mch_chdir("/tmp"); |
---|
| 795 | + ignored = mch_chdir("/tmp"); |
---|
| 796 | shorten_fnames(TRUE); |
---|
| 797 | } |
---|
| 798 | #endif |
---|
[bef6db9] | 799 | diff -Naur vim72.orig/src/edit.c vim72/src/edit.c |
---|
| 800 | --- vim72.orig/src/edit.c 2008-08-06 05:51:17.000000000 -0700 |
---|
| 801 | +++ vim72/src/edit.c 2009-01-19 00:10:48.000000000 -0800 |
---|
| 802 | @@ -147,6 +147,7 @@ |
---|
| 803 | static int ins_compl_bs __ARGS((void)); |
---|
| 804 | static void ins_compl_new_leader __ARGS((void)); |
---|
| 805 | static void ins_compl_addleader __ARGS((int c)); |
---|
| 806 | +static int ins_compl_len __ARGS((void)); |
---|
| 807 | static void ins_compl_restart __ARGS((void)); |
---|
| 808 | static void ins_compl_set_original_text __ARGS((char_u *str)); |
---|
| 809 | static void ins_compl_addfrommatch __ARGS((void)); |
---|
| 810 | @@ -197,7 +198,8 @@ |
---|
| 811 | static void mb_replace_pop_ins __ARGS((int cc)); |
---|
| 812 | #endif |
---|
| 813 | static void replace_flush __ARGS((void)); |
---|
| 814 | -static void replace_do_bs __ARGS((void)); |
---|
| 815 | +static void replace_do_bs __ARGS((int limit_col)); |
---|
| 816 | +static int del_char_after_col __ARGS((int limit_col)); |
---|
| 817 | #ifdef FEAT_CINDENT |
---|
| 818 | static int cindent_on __ARGS((void)); |
---|
| 819 | #endif |
---|
| 820 | @@ -1933,6 +1935,8 @@ |
---|
| 821 | /* |
---|
| 822 | * Backspace the cursor until the given column. Handles REPLACE and VREPLACE |
---|
| 823 | * modes correctly. May also be used when not in insert mode at all. |
---|
| 824 | + * Will attempt not to go before "col" even when there is a composing |
---|
| 825 | + * character. |
---|
| 826 | */ |
---|
| 827 | void |
---|
| 828 | backspace_until_column(col) |
---|
| 829 | @@ -1942,13 +1946,49 @@ |
---|
| 830 | { |
---|
| 831 | curwin->w_cursor.col--; |
---|
| 832 | if (State & REPLACE_FLAG) |
---|
| 833 | - replace_do_bs(); |
---|
| 834 | - else |
---|
| 835 | - (void)del_char(FALSE); |
---|
| 836 | + replace_do_bs(col); |
---|
| 837 | + else if (!del_char_after_col(col)) |
---|
| 838 | + break; |
---|
| 839 | } |
---|
| 840 | } |
---|
| 841 | #endif |
---|
| 842 | |
---|
| 843 | +/* |
---|
| 844 | + * Like del_char(), but make sure not to go before column "limit_col". |
---|
| 845 | + * Only matters when there are composing characters. |
---|
| 846 | + * Return TRUE when something was deleted. |
---|
| 847 | + */ |
---|
| 848 | + static int |
---|
| 849 | +del_char_after_col(limit_col) |
---|
| 850 | + int limit_col; |
---|
| 851 | +{ |
---|
| 852 | +#ifdef FEAT_MBYTE |
---|
| 853 | + if (enc_utf8 && limit_col >= 0) |
---|
| 854 | + { |
---|
| 855 | + int ecol = curwin->w_cursor.col + 1; |
---|
| 856 | + |
---|
| 857 | + /* Make sure the cursor is at the start of a character, but |
---|
| 858 | + * skip forward again when going too far back because of a |
---|
| 859 | + * composing character. */ |
---|
| 860 | + mb_adjust_cursor(); |
---|
| 861 | + while (curwin->w_cursor.col < limit_col) |
---|
| 862 | + { |
---|
| 863 | + int l = utf_ptr2len(ml_get_cursor()); |
---|
| 864 | + |
---|
| 865 | + if (l == 0) /* end of line */ |
---|
| 866 | + break; |
---|
| 867 | + curwin->w_cursor.col += l; |
---|
| 868 | + } |
---|
| 869 | + if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol) |
---|
| 870 | + return FALSE; |
---|
| 871 | + del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE); |
---|
| 872 | + } |
---|
| 873 | + else |
---|
| 874 | +#endif |
---|
| 875 | + (void)del_char(FALSE); |
---|
| 876 | + return TRUE; |
---|
| 877 | +} |
---|
| 878 | + |
---|
| 879 | #if defined(FEAT_INS_EXPAND) || defined(PROTO) |
---|
| 880 | /* |
---|
| 881 | * CTRL-X pressed in Insert mode. |
---|
| 882 | @@ -2418,7 +2458,7 @@ |
---|
| 883 | { |
---|
| 884 | had_match = (curwin->w_cursor.col > compl_col); |
---|
| 885 | ins_compl_delete(); |
---|
| 886 | - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col); |
---|
| 887 | + ins_bytes(compl_leader + ins_compl_len()); |
---|
| 888 | ins_redraw(FALSE); |
---|
| 889 | |
---|
| 890 | /* When the match isn't there (to avoid matching itself) remove it |
---|
| 891 | @@ -2470,7 +2510,7 @@ |
---|
| 892 | *p = NUL; |
---|
| 893 | had_match = (curwin->w_cursor.col > compl_col); |
---|
| 894 | ins_compl_delete(); |
---|
| 895 | - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col); |
---|
| 896 | + ins_bytes(compl_leader + ins_compl_len()); |
---|
| 897 | ins_redraw(FALSE); |
---|
| 898 | |
---|
| 899 | /* When the match isn't there (to avoid matching itself) remove it |
---|
| 900 | @@ -3209,7 +3249,7 @@ |
---|
| 901 | { |
---|
| 902 | ins_compl_del_pum(); |
---|
| 903 | ins_compl_delete(); |
---|
| 904 | - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col); |
---|
| 905 | + ins_bytes(compl_leader + ins_compl_len()); |
---|
| 906 | compl_used_match = FALSE; |
---|
| 907 | |
---|
| 908 | if (compl_started) |
---|
| 909 | @@ -3264,6 +3304,20 @@ |
---|
| 910 | } |
---|
| 911 | |
---|
| 912 | /* |
---|
| 913 | + * Return the length of the completion, from the completion start column to |
---|
| 914 | + * the cursor column. Making sure it never goes below zero. |
---|
| 915 | + */ |
---|
| 916 | + static int |
---|
| 917 | +ins_compl_len() |
---|
| 918 | +{ |
---|
| 919 | + int off = curwin->w_cursor.col - compl_col; |
---|
| 920 | + |
---|
| 921 | + if (off < 0) |
---|
| 922 | + return 0; |
---|
| 923 | + return off; |
---|
| 924 | +} |
---|
| 925 | + |
---|
| 926 | +/* |
---|
| 927 | * Append one character to the match leader. May reduce the number of |
---|
| 928 | * matches. |
---|
| 929 | */ |
---|
| 930 | @@ -3621,10 +3675,9 @@ |
---|
| 931 | { |
---|
| 932 | ins_compl_delete(); |
---|
| 933 | if (compl_leader != NULL) |
---|
| 934 | - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col); |
---|
| 935 | + ins_bytes(compl_leader + ins_compl_len()); |
---|
| 936 | else if (compl_first_match != NULL) |
---|
| 937 | - ins_bytes(compl_orig_text |
---|
| 938 | - + curwin->w_cursor.col - compl_col); |
---|
| 939 | + ins_bytes(compl_orig_text + ins_compl_len()); |
---|
| 940 | retval = TRUE; |
---|
| 941 | } |
---|
| 942 | |
---|
| 943 | @@ -4256,7 +4309,7 @@ |
---|
| 944 | static void |
---|
| 945 | ins_compl_insert() |
---|
| 946 | { |
---|
| 947 | - ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col); |
---|
| 948 | + ins_bytes(compl_shown_match->cp_str + ins_compl_len()); |
---|
| 949 | if (compl_shown_match->cp_flags & ORIGINAL_TEXT) |
---|
| 950 | compl_used_match = FALSE; |
---|
| 951 | else |
---|
| 952 | @@ -4425,7 +4478,7 @@ |
---|
| 953 | if (!compl_get_longest || compl_used_match) |
---|
| 954 | ins_compl_insert(); |
---|
| 955 | else |
---|
| 956 | - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col); |
---|
| 957 | + ins_bytes(compl_leader + ins_compl_len()); |
---|
| 958 | } |
---|
| 959 | else |
---|
| 960 | compl_used_match = FALSE; |
---|
| 961 | @@ -7123,9 +7176,12 @@ |
---|
| 962 | * cc == 0: character was inserted, delete it |
---|
| 963 | * cc > 0: character was replaced, put cc (first byte of original char) back |
---|
| 964 | * and check for more characters to be put back |
---|
| 965 | + * When "limit_col" is >= 0, don't delete before this column. Matters when |
---|
| 966 | + * using composing characters, use del_char_after_col() instead of del_char(). |
---|
| 967 | */ |
---|
| 968 | static void |
---|
| 969 | -replace_do_bs() |
---|
| 970 | +replace_do_bs(limit_col) |
---|
| 971 | + int limit_col; |
---|
| 972 | { |
---|
| 973 | int cc; |
---|
| 974 | #ifdef FEAT_VREPLACE |
---|
| 975 | @@ -7153,7 +7209,7 @@ |
---|
| 976 | #ifdef FEAT_MBYTE |
---|
| 977 | if (has_mbyte) |
---|
| 978 | { |
---|
| 979 | - del_char(FALSE); |
---|
| 980 | + (void)del_char_after_col(limit_col); |
---|
| 981 | # ifdef FEAT_VREPLACE |
---|
| 982 | if (State & VREPLACE_FLAG) |
---|
| 983 | orig_len = (int)STRLEN(ml_get_cursor()); |
---|
| 984 | @@ -7203,7 +7259,7 @@ |
---|
| 985 | changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col); |
---|
| 986 | } |
---|
| 987 | else if (cc == 0) |
---|
| 988 | - (void)del_char(FALSE); |
---|
| 989 | + (void)del_char_after_col(limit_col); |
---|
| 990 | } |
---|
| 991 | |
---|
| 992 | #ifdef FEAT_CINDENT |
---|
| 993 | @@ -8239,7 +8295,7 @@ |
---|
| 994 | * Replace mode */ |
---|
| 995 | if (curwin->w_cursor.lnum != Insstart.lnum |
---|
| 996 | || curwin->w_cursor.col >= Insstart.col) |
---|
| 997 | - replace_do_bs(); |
---|
| 998 | + replace_do_bs(-1); |
---|
| 999 | } |
---|
| 1000 | else |
---|
| 1001 | (void)del_char(FALSE); |
---|
| 1002 | @@ -8556,7 +8612,7 @@ |
---|
| 1003 | break; |
---|
| 1004 | } |
---|
| 1005 | if (State & REPLACE_FLAG) |
---|
| 1006 | - replace_do_bs(); |
---|
| 1007 | + replace_do_bs(-1); |
---|
| 1008 | else |
---|
| 1009 | { |
---|
| 1010 | #ifdef FEAT_MBYTE |
---|
[d25b7db] | 1011 | diff -Naur vim72.orig/src/eval.c vim72/src/eval.c |
---|
| 1012 | --- vim72.orig/src/eval.c 2008-08-07 12:37:22.000000000 -0700 |
---|
[bef6db9] | 1013 | +++ vim72/src/eval.c 2009-01-19 00:10:21.000000000 -0800 |
---|
[d25b7db] | 1014 | @@ -32,6 +32,9 @@ |
---|
| 1015 | |
---|
| 1016 | #define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */ |
---|
| 1017 | |
---|
| 1018 | +#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not |
---|
| 1019 | + be freed. */ |
---|
| 1020 | + |
---|
| 1021 | /* |
---|
| 1022 | * In a hashtab item "hi_key" points to "di_key" in a dictitem. |
---|
| 1023 | * This avoids adding a pointer to the hashtab item. |
---|
| 1024 | @@ -348,6 +351,7 @@ |
---|
| 1025 | {VV_NAME("mouse_col", VAR_NUMBER), 0}, |
---|
| 1026 | {VV_NAME("operator", VAR_STRING), VV_RO}, |
---|
| 1027 | {VV_NAME("searchforward", VAR_NUMBER), 0}, |
---|
| 1028 | + {VV_NAME("oldfiles", VAR_LIST), 0}, |
---|
| 1029 | }; |
---|
| 1030 | |
---|
| 1031 | /* shorthand */ |
---|
| 1032 | @@ -355,6 +359,7 @@ |
---|
| 1033 | #define vv_nr vv_di.di_tv.vval.v_number |
---|
| 1034 | #define vv_float vv_di.di_tv.vval.v_float |
---|
| 1035 | #define vv_str vv_di.di_tv.vval.v_string |
---|
| 1036 | +#define vv_list vv_di.di_tv.vval.v_list |
---|
| 1037 | #define vv_tv vv_di.di_tv |
---|
| 1038 | |
---|
| 1039 | /* |
---|
| 1040 | @@ -426,7 +431,6 @@ |
---|
| 1041 | static long list_idx_of_item __ARGS((list_T *l, listitem_T *item)); |
---|
| 1042 | static void list_append __ARGS((list_T *l, listitem_T *item)); |
---|
| 1043 | static int list_append_tv __ARGS((list_T *l, typval_T *tv)); |
---|
| 1044 | -static int list_append_string __ARGS((list_T *l, char_u *str, int len)); |
---|
| 1045 | static int list_append_number __ARGS((list_T *l, varnumber_T n)); |
---|
| 1046 | static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item)); |
---|
| 1047 | static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef)); |
---|
| 1048 | @@ -788,6 +792,8 @@ |
---|
| 1049 | static void func_unref __ARGS((char_u *name)); |
---|
| 1050 | static void func_ref __ARGS((char_u *name)); |
---|
| 1051 | 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)); |
---|
| 1052 | +static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ; |
---|
| 1053 | +static void free_funccal __ARGS((funccall_T *fc, int free_val)); |
---|
| 1054 | static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr)); |
---|
| 1055 | static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp)); |
---|
| 1056 | static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off)); |
---|
| 1057 | @@ -845,11 +851,17 @@ |
---|
| 1058 | p = &vimvars[i]; |
---|
| 1059 | if (p->vv_di.di_tv.v_type == VAR_STRING) |
---|
| 1060 | { |
---|
| 1061 | - vim_free(p->vv_di.di_tv.vval.v_string); |
---|
| 1062 | - p->vv_di.di_tv.vval.v_string = NULL; |
---|
| 1063 | + vim_free(p->vv_str); |
---|
| 1064 | + p->vv_str = NULL; |
---|
| 1065 | + } |
---|
| 1066 | + else if (p->vv_di.di_tv.v_type == VAR_LIST) |
---|
| 1067 | + { |
---|
| 1068 | + list_unref(p->vv_list); |
---|
| 1069 | + p->vv_list = NULL; |
---|
| 1070 | } |
---|
| 1071 | } |
---|
| 1072 | hash_clear(&vimvarht); |
---|
| 1073 | + hash_init(&vimvarht); /* garbage_collect() will access it */ |
---|
| 1074 | hash_clear(&compat_hashtab); |
---|
| 1075 | |
---|
| 1076 | /* script-local variables */ |
---|
| 1077 | @@ -916,6 +928,10 @@ |
---|
| 1078 | /* pointer to funccal for currently active function */ |
---|
| 1079 | funccall_T *current_funccal = NULL; |
---|
| 1080 | |
---|
| 1081 | +/* pointer to list of previously used funccal, still around because some |
---|
| 1082 | + * item in it is still being used. */ |
---|
| 1083 | +funccall_T *previous_funccal = NULL; |
---|
| 1084 | + |
---|
| 1085 | /* |
---|
| 1086 | * Return TRUE when a function was ended by a ":return" command. |
---|
| 1087 | */ |
---|
| 1088 | @@ -1256,23 +1272,26 @@ |
---|
| 1089 | |
---|
| 1090 | /* |
---|
| 1091 | * Top level evaluation function, returning a string. |
---|
| 1092 | + * When "convert" is TRUE convert a List into a sequence of lines and convert |
---|
| 1093 | + * a Float to a String. |
---|
| 1094 | * Return pointer to allocated memory, or NULL for failure. |
---|
| 1095 | */ |
---|
| 1096 | char_u * |
---|
| 1097 | -eval_to_string(arg, nextcmd, dolist) |
---|
| 1098 | +eval_to_string(arg, nextcmd, convert) |
---|
| 1099 | char_u *arg; |
---|
| 1100 | char_u **nextcmd; |
---|
| 1101 | - int dolist; /* turn List into sequence of lines */ |
---|
| 1102 | + int convert; |
---|
| 1103 | { |
---|
| 1104 | typval_T tv; |
---|
| 1105 | char_u *retval; |
---|
| 1106 | garray_T ga; |
---|
| 1107 | + char_u numbuf[NUMBUFLEN]; |
---|
| 1108 | |
---|
| 1109 | if (eval0(arg, &tv, nextcmd, TRUE) == FAIL) |
---|
| 1110 | retval = NULL; |
---|
| 1111 | else |
---|
| 1112 | { |
---|
| 1113 | - if (dolist && tv.v_type == VAR_LIST) |
---|
| 1114 | + if (convert && tv.v_type == VAR_LIST) |
---|
| 1115 | { |
---|
| 1116 | ga_init2(&ga, (int)sizeof(char), 80); |
---|
| 1117 | if (tv.vval.v_list != NULL) |
---|
| 1118 | @@ -1280,6 +1299,13 @@ |
---|
| 1119 | ga_append(&ga, NUL); |
---|
| 1120 | retval = (char_u *)ga.ga_data; |
---|
| 1121 | } |
---|
| 1122 | +#ifdef FEAT_FLOAT |
---|
| 1123 | + else if (convert && tv.v_type == VAR_FLOAT) |
---|
| 1124 | + { |
---|
| 1125 | + vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float); |
---|
| 1126 | + retval = vim_strsave(numbuf); |
---|
| 1127 | + } |
---|
| 1128 | +#endif |
---|
| 1129 | else |
---|
| 1130 | retval = vim_strsave(get_tv_string(&tv)); |
---|
| 1131 | clear_tv(&tv); |
---|
| 1132 | @@ -3277,7 +3303,7 @@ |
---|
| 1133 | |
---|
| 1134 | if (*startarg != '(') |
---|
| 1135 | { |
---|
| 1136 | - EMSG2(_("E107: Missing braces: %s"), eap->arg); |
---|
| 1137 | + EMSG2(_("E107: Missing parentheses: %s"), eap->arg); |
---|
| 1138 | goto end; |
---|
| 1139 | } |
---|
| 1140 | |
---|
| 1141 | @@ -3657,8 +3683,8 @@ |
---|
| 1142 | } |
---|
| 1143 | |
---|
| 1144 | /* |
---|
| 1145 | - * Return TRUE if typeval "tv" is locked: Either tha value is locked itself or |
---|
| 1146 | - * it refers to a List or Dictionary that is locked. |
---|
| 1147 | + * Return TRUE if typeval "tv" is locked: Either that value is locked itself |
---|
| 1148 | + * or it refers to a List or Dictionary that is locked. |
---|
| 1149 | */ |
---|
| 1150 | static int |
---|
| 1151 | tv_islocked(tv) |
---|
| 1152 | @@ -6047,6 +6073,25 @@ |
---|
| 1153 | } |
---|
| 1154 | |
---|
| 1155 | /* |
---|
| 1156 | + * Get list item "l[idx - 1]" as a string. Returns NULL for failure. |
---|
| 1157 | + */ |
---|
| 1158 | + char_u * |
---|
| 1159 | +list_find_str(l, idx) |
---|
| 1160 | + list_T *l; |
---|
| 1161 | + long idx; |
---|
| 1162 | +{ |
---|
| 1163 | + listitem_T *li; |
---|
| 1164 | + |
---|
| 1165 | + li = list_find(l, idx - 1); |
---|
| 1166 | + if (li == NULL) |
---|
| 1167 | + { |
---|
| 1168 | + EMSGN(_(e_listidx), idx); |
---|
| 1169 | + return NULL; |
---|
| 1170 | + } |
---|
| 1171 | + return get_tv_string(&li->li_tv); |
---|
| 1172 | +} |
---|
| 1173 | + |
---|
| 1174 | +/* |
---|
| 1175 | * Locate "item" list "l" and return its index. |
---|
| 1176 | * Returns -1 when "item" is not in the list. |
---|
| 1177 | */ |
---|
| 1178 | @@ -6137,7 +6182,7 @@ |
---|
| 1179 | * When "len" >= 0 use "str[len]". |
---|
| 1180 | * Returns FAIL when out of memory. |
---|
| 1181 | */ |
---|
| 1182 | - static int |
---|
| 1183 | + int |
---|
| 1184 | list_append_string(l, str, len) |
---|
| 1185 | list_T *l; |
---|
| 1186 | char_u *str; |
---|
| 1187 | @@ -6454,7 +6499,7 @@ |
---|
| 1188 | buf_T *buf; |
---|
| 1189 | win_T *wp; |
---|
| 1190 | int i; |
---|
| 1191 | - funccall_T *fc; |
---|
| 1192 | + funccall_T *fc, **pfc; |
---|
| 1193 | int did_free = FALSE; |
---|
| 1194 | #ifdef FEAT_WINDOWS |
---|
| 1195 | tabpage_T *tp; |
---|
| 1196 | @@ -6497,6 +6542,9 @@ |
---|
| 1197 | set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID); |
---|
| 1198 | } |
---|
| 1199 | |
---|
| 1200 | + /* v: vars */ |
---|
| 1201 | + set_ref_in_ht(&vimvarht, copyID); |
---|
| 1202 | + |
---|
| 1203 | /* |
---|
| 1204 | * 2. Go through the list of dicts and free items without the copyID. |
---|
| 1205 | */ |
---|
| 1206 | @@ -6535,6 +6583,20 @@ |
---|
| 1207 | else |
---|
| 1208 | ll = ll->lv_used_next; |
---|
| 1209 | |
---|
| 1210 | + /* check if any funccal can be freed now */ |
---|
| 1211 | + for (pfc = &previous_funccal; *pfc != NULL; ) |
---|
| 1212 | + { |
---|
| 1213 | + if (can_free_funccal(*pfc, copyID)) |
---|
| 1214 | + { |
---|
| 1215 | + fc = *pfc; |
---|
| 1216 | + *pfc = fc->caller; |
---|
| 1217 | + free_funccal(fc, TRUE); |
---|
| 1218 | + did_free = TRUE; |
---|
| 1219 | + } |
---|
| 1220 | + else |
---|
| 1221 | + pfc = &(*pfc)->caller; |
---|
| 1222 | + } |
---|
| 1223 | + |
---|
| 1224 | return did_free; |
---|
| 1225 | } |
---|
| 1226 | |
---|
| 1227 | @@ -6587,7 +6649,7 @@ |
---|
| 1228 | { |
---|
| 1229 | case VAR_DICT: |
---|
| 1230 | dd = tv->vval.v_dict; |
---|
| 1231 | - if (dd->dv_copyID != copyID) |
---|
| 1232 | + if (dd != NULL && dd->dv_copyID != copyID) |
---|
| 1233 | { |
---|
| 1234 | /* Didn't see this dict yet. */ |
---|
| 1235 | dd->dv_copyID = copyID; |
---|
| 1236 | @@ -6597,7 +6659,7 @@ |
---|
| 1237 | |
---|
| 1238 | case VAR_LIST: |
---|
| 1239 | ll = tv->vval.v_list; |
---|
| 1240 | - if (ll->lv_copyID != copyID) |
---|
| 1241 | + if (ll != NULL && ll->lv_copyID != copyID) |
---|
| 1242 | { |
---|
| 1243 | /* Didn't see this list yet. */ |
---|
| 1244 | ll->lv_copyID = copyID; |
---|
| 1245 | @@ -7525,8 +7587,8 @@ |
---|
| 1246 | {"getwinposx", 0, 0, f_getwinposx}, |
---|
| 1247 | {"getwinposy", 0, 0, f_getwinposy}, |
---|
| 1248 | {"getwinvar", 2, 2, f_getwinvar}, |
---|
| 1249 | - {"glob", 1, 1, f_glob}, |
---|
| 1250 | - {"globpath", 2, 2, f_globpath}, |
---|
| 1251 | + {"glob", 1, 2, f_glob}, |
---|
| 1252 | + {"globpath", 2, 3, f_globpath}, |
---|
| 1253 | {"has", 1, 1, f_has}, |
---|
| 1254 | {"has_key", 2, 2, f_has_key}, |
---|
| 1255 | {"haslocaldir", 0, 0, f_haslocaldir}, |
---|
| 1256 | @@ -9518,7 +9580,7 @@ |
---|
| 1257 | else |
---|
| 1258 | { |
---|
| 1259 | /* When the optional second argument is non-zero, don't remove matches |
---|
| 1260 | - * for 'suffixes' and 'wildignore' */ |
---|
| 1261 | + * for 'wildignore' and don't put matches for 'suffixes' at the end. */ |
---|
| 1262 | if (argvars[1].v_type != VAR_UNKNOWN |
---|
| 1263 | && get_tv_number_chk(&argvars[1], &error)) |
---|
| 1264 | flags |= WILD_KEEP_ALL; |
---|
| 1265 | @@ -10300,7 +10362,8 @@ |
---|
| 1266 | s = get_tv_string(&argvars[0]); |
---|
| 1267 | if (s == NULL || *s == NUL || VIM_ISDIGIT(*s)) |
---|
| 1268 | EMSG2(_(e_invarg2), s); |
---|
| 1269 | - else if (!function_exists(s)) |
---|
| 1270 | + /* Don't check an autoload name for existence here. */ |
---|
| 1271 | + else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s)) |
---|
| 1272 | EMSG2(_("E700: Unknown function: %s"), s); |
---|
| 1273 | else |
---|
| 1274 | { |
---|
| 1275 | @@ -10602,7 +10665,7 @@ |
---|
| 1276 | # ifdef FEAT_WINDOWS |
---|
| 1277 | win_T *wp; |
---|
| 1278 | # endif |
---|
| 1279 | - int n = 1; |
---|
| 1280 | + int winnr = 1; |
---|
| 1281 | |
---|
| 1282 | if (row >= 0 && col >= 0) |
---|
| 1283 | { |
---|
| 1284 | @@ -10612,9 +10675,9 @@ |
---|
| 1285 | (void)mouse_comp_pos(win, &row, &col, &lnum); |
---|
| 1286 | # ifdef FEAT_WINDOWS |
---|
| 1287 | for (wp = firstwin; wp != win; wp = wp->w_next) |
---|
| 1288 | - ++n; |
---|
| 1289 | + ++winnr; |
---|
| 1290 | # endif |
---|
| 1291 | - vimvars[VV_MOUSE_WIN].vv_nr = n; |
---|
| 1292 | + vimvars[VV_MOUSE_WIN].vv_nr = winnr; |
---|
| 1293 | vimvars[VV_MOUSE_LNUM].vv_nr = lnum; |
---|
| 1294 | vimvars[VV_MOUSE_COL].vv_nr = col + 1; |
---|
| 1295 | } |
---|
| 1296 | @@ -11284,13 +11347,25 @@ |
---|
| 1297 | typval_T *argvars; |
---|
| 1298 | typval_T *rettv; |
---|
| 1299 | { |
---|
| 1300 | + int flags = WILD_SILENT|WILD_USE_NL; |
---|
| 1301 | expand_T xpc; |
---|
| 1302 | + int error = FALSE; |
---|
| 1303 | |
---|
| 1304 | - ExpandInit(&xpc); |
---|
| 1305 | - xpc.xp_context = EXPAND_FILES; |
---|
| 1306 | + /* When the optional second argument is non-zero, don't remove matches |
---|
| 1307 | + * for 'wildignore' and don't put matches for 'suffixes' at the end. */ |
---|
| 1308 | + if (argvars[1].v_type != VAR_UNKNOWN |
---|
| 1309 | + && get_tv_number_chk(&argvars[1], &error)) |
---|
| 1310 | + flags |= WILD_KEEP_ALL; |
---|
| 1311 | rettv->v_type = VAR_STRING; |
---|
| 1312 | - rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]), |
---|
| 1313 | - NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL); |
---|
| 1314 | + if (!error) |
---|
| 1315 | + { |
---|
| 1316 | + ExpandInit(&xpc); |
---|
| 1317 | + xpc.xp_context = EXPAND_FILES; |
---|
| 1318 | + rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]), |
---|
| 1319 | + NULL, flags, WILD_ALL); |
---|
| 1320 | + } |
---|
| 1321 | + else |
---|
| 1322 | + rettv->vval.v_string = NULL; |
---|
| 1323 | } |
---|
| 1324 | |
---|
| 1325 | /* |
---|
| 1326 | @@ -11301,14 +11376,22 @@ |
---|
| 1327 | typval_T *argvars; |
---|
| 1328 | typval_T *rettv; |
---|
| 1329 | { |
---|
| 1330 | + int flags = 0; |
---|
| 1331 | char_u buf1[NUMBUFLEN]; |
---|
| 1332 | char_u *file = get_tv_string_buf_chk(&argvars[1], buf1); |
---|
| 1333 | + int error = FALSE; |
---|
| 1334 | |
---|
| 1335 | + /* When the optional second argument is non-zero, don't remove matches |
---|
| 1336 | + * for 'wildignore' and don't put matches for 'suffixes' at the end. */ |
---|
| 1337 | + if (argvars[2].v_type != VAR_UNKNOWN |
---|
| 1338 | + && get_tv_number_chk(&argvars[2], &error)) |
---|
| 1339 | + flags |= WILD_KEEP_ALL; |
---|
| 1340 | rettv->v_type = VAR_STRING; |
---|
| 1341 | - if (file == NULL) |
---|
| 1342 | + if (file == NULL || error) |
---|
| 1343 | rettv->vval.v_string = NULL; |
---|
| 1344 | else |
---|
| 1345 | - rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file); |
---|
| 1346 | + rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file, |
---|
| 1347 | + flags); |
---|
| 1348 | } |
---|
| 1349 | |
---|
| 1350 | /* |
---|
| 1351 | @@ -11782,6 +11865,10 @@ |
---|
| 1352 | n = has_patch(atoi((char *)name + 5)); |
---|
| 1353 | else if (STRICMP(name, "vim_starting") == 0) |
---|
| 1354 | n = (starting != 0); |
---|
| 1355 | +#ifdef FEAT_MBYTE |
---|
| 1356 | + else if (STRICMP(name, "multi_byte_encoding") == 0) |
---|
| 1357 | + n = has_mbyte; |
---|
| 1358 | +#endif |
---|
| 1359 | #if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32) |
---|
| 1360 | else if (STRICMP(name, "balloon_multiline") == 0) |
---|
| 1361 | n = multiline_balloon_available(); |
---|
| 1362 | @@ -15838,10 +15925,9 @@ |
---|
| 1363 | if (res == FAIL) |
---|
| 1364 | res = ITEM_COMPARE_FAIL; |
---|
| 1365 | else |
---|
| 1366 | - /* return value has wrong type */ |
---|
| 1367 | res = get_tv_number_chk(&rettv, &item_compare_func_err); |
---|
| 1368 | if (item_compare_func_err) |
---|
| 1369 | - res = ITEM_COMPARE_FAIL; |
---|
| 1370 | + res = ITEM_COMPARE_FAIL; /* return value has wrong type */ |
---|
| 1371 | clear_tv(&rettv); |
---|
| 1372 | return res; |
---|
| 1373 | } |
---|
| 1374 | @@ -16590,8 +16676,11 @@ |
---|
| 1375 | p = highlight_has_attr(id, HL_INVERSE, modec); |
---|
| 1376 | break; |
---|
| 1377 | |
---|
| 1378 | - case 's': /* standout */ |
---|
| 1379 | - p = highlight_has_attr(id, HL_STANDOUT, modec); |
---|
| 1380 | + case 's': |
---|
| 1381 | + if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */ |
---|
| 1382 | + p = highlight_color(id, what, modec); |
---|
| 1383 | + else /* standout */ |
---|
| 1384 | + p = highlight_has_attr(id, HL_STANDOUT, modec); |
---|
| 1385 | break; |
---|
| 1386 | |
---|
| 1387 | case 'u': |
---|
| 1388 | @@ -16658,7 +16747,7 @@ |
---|
| 1389 | col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */ |
---|
| 1390 | |
---|
| 1391 | if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count |
---|
| 1392 | - && col >= 0 && col < (long)STRLEN(ml_get(lnum)) |
---|
| 1393 | + && col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum))) |
---|
| 1394 | && rettv_list_alloc(rettv) != FAIL) |
---|
| 1395 | { |
---|
| 1396 | (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE); |
---|
| 1397 | @@ -18097,14 +18186,28 @@ |
---|
| 1398 | } |
---|
| 1399 | |
---|
| 1400 | /* |
---|
| 1401 | - * Set v:count, v:count1 and v:prevcount. |
---|
| 1402 | + * Get List v: variable value. Caller must take care of reference count when |
---|
| 1403 | + * needed. |
---|
| 1404 | + */ |
---|
| 1405 | + list_T * |
---|
| 1406 | +get_vim_var_list(idx) |
---|
| 1407 | + int idx; |
---|
| 1408 | +{ |
---|
| 1409 | + return vimvars[idx].vv_list; |
---|
| 1410 | +} |
---|
| 1411 | + |
---|
| 1412 | +/* |
---|
| 1413 | + * Set v:count to "count" and v:count1 to "count1". |
---|
| 1414 | + * When "set_prevcount" is TRUE first set v:prevcount from v:count. |
---|
| 1415 | */ |
---|
| 1416 | void |
---|
| 1417 | -set_vcount(count, count1) |
---|
| 1418 | +set_vcount(count, count1, set_prevcount) |
---|
| 1419 | long count; |
---|
| 1420 | long count1; |
---|
| 1421 | + int set_prevcount; |
---|
| 1422 | { |
---|
| 1423 | - vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr; |
---|
| 1424 | + if (set_prevcount) |
---|
| 1425 | + vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr; |
---|
| 1426 | vimvars[VV_COUNT].vv_nr = count; |
---|
| 1427 | vimvars[VV_COUNT1].vv_nr = count1; |
---|
| 1428 | } |
---|
| 1429 | @@ -18132,6 +18235,20 @@ |
---|
| 1430 | } |
---|
| 1431 | |
---|
| 1432 | /* |
---|
| 1433 | + * Set List v: variable to "val". |
---|
| 1434 | + */ |
---|
| 1435 | + void |
---|
| 1436 | +set_vim_var_list(idx, val) |
---|
| 1437 | + int idx; |
---|
| 1438 | + list_T *val; |
---|
| 1439 | +{ |
---|
| 1440 | + list_unref(vimvars[idx].vv_list); |
---|
| 1441 | + vimvars[idx].vv_list = val; |
---|
| 1442 | + if (val != NULL) |
---|
| 1443 | + ++val->lv_refcount; |
---|
| 1444 | +} |
---|
| 1445 | + |
---|
| 1446 | +/* |
---|
| 1447 | * Set v:register if needed. |
---|
| 1448 | */ |
---|
| 1449 | void |
---|
| 1450 | @@ -18868,7 +18985,7 @@ |
---|
| 1451 | dictitem_T *dict_var; |
---|
| 1452 | { |
---|
| 1453 | hash_init(&dict->dv_hashtab); |
---|
| 1454 | - dict->dv_refcount = 99999; |
---|
| 1455 | + dict->dv_refcount = DO_NOT_FREE_CNT; |
---|
| 1456 | dict_var->di_tv.vval.v_dict = dict; |
---|
| 1457 | dict_var->di_tv.v_type = VAR_DICT; |
---|
| 1458 | dict_var->di_tv.v_lock = VAR_FIXED; |
---|
| 1459 | @@ -19205,6 +19322,8 @@ |
---|
| 1460 | * Copy the values from typval_T "from" to typval_T "to". |
---|
| 1461 | * When needed allocates string or increases reference count. |
---|
| 1462 | * Does not make a copy of a list or dict but copies the reference! |
---|
| 1463 | + * It is OK for "from" and "to" to point to the same item. This is used to |
---|
| 1464 | + * make a copy later. |
---|
| 1465 | */ |
---|
| 1466 | static void |
---|
| 1467 | copy_tv(from, to) |
---|
| 1468 | @@ -20590,6 +20709,9 @@ |
---|
| 1469 | int st_len = 0; |
---|
| 1470 | |
---|
| 1471 | todo = (int)func_hashtab.ht_used; |
---|
| 1472 | + if (todo == 0) |
---|
| 1473 | + return; /* nothing to dump */ |
---|
| 1474 | + |
---|
| 1475 | sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo)); |
---|
| 1476 | |
---|
| 1477 | for (hi = func_hashtab.ht_array; todo > 0; ++hi) |
---|
| 1478 | @@ -20638,6 +20760,8 @@ |
---|
| 1479 | prof_self_cmp); |
---|
| 1480 | prof_sort_list(fd, sorttab, st_len, "SELF", TRUE); |
---|
| 1481 | } |
---|
| 1482 | + |
---|
| 1483 | + vim_free(sorttab); |
---|
| 1484 | } |
---|
| 1485 | |
---|
| 1486 | static void |
---|
| 1487 | @@ -21012,7 +21136,7 @@ |
---|
| 1488 | char_u *save_sourcing_name; |
---|
| 1489 | linenr_T save_sourcing_lnum; |
---|
| 1490 | scid_T save_current_SID; |
---|
| 1491 | - funccall_T fc; |
---|
| 1492 | + funccall_T *fc; |
---|
| 1493 | int save_did_emsg; |
---|
| 1494 | static int depth = 0; |
---|
| 1495 | dictitem_T *v; |
---|
| 1496 | @@ -21038,36 +21162,37 @@ |
---|
| 1497 | |
---|
| 1498 | line_breakcheck(); /* check for CTRL-C hit */ |
---|
| 1499 | |
---|
| 1500 | - fc.caller = current_funccal; |
---|
| 1501 | - current_funccal = &fc; |
---|
| 1502 | - fc.func = fp; |
---|
| 1503 | - fc.rettv = rettv; |
---|
| 1504 | + fc = (funccall_T *)alloc(sizeof(funccall_T)); |
---|
| 1505 | + fc->caller = current_funccal; |
---|
| 1506 | + current_funccal = fc; |
---|
| 1507 | + fc->func = fp; |
---|
| 1508 | + fc->rettv = rettv; |
---|
| 1509 | rettv->vval.v_number = 0; |
---|
| 1510 | - fc.linenr = 0; |
---|
| 1511 | - fc.returned = FALSE; |
---|
| 1512 | - fc.level = ex_nesting_level; |
---|
| 1513 | + fc->linenr = 0; |
---|
| 1514 | + fc->returned = FALSE; |
---|
| 1515 | + fc->level = ex_nesting_level; |
---|
| 1516 | /* Check if this function has a breakpoint. */ |
---|
| 1517 | - fc.breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0); |
---|
| 1518 | - fc.dbg_tick = debug_tick; |
---|
| 1519 | + fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0); |
---|
| 1520 | + fc->dbg_tick = debug_tick; |
---|
| 1521 | |
---|
| 1522 | /* |
---|
| 1523 | - * Note about using fc.fixvar[]: This is an array of FIXVAR_CNT variables |
---|
| 1524 | + * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables |
---|
| 1525 | * with names up to VAR_SHORT_LEN long. This avoids having to alloc/free |
---|
| 1526 | * each argument variable and saves a lot of time. |
---|
| 1527 | */ |
---|
| 1528 | /* |
---|
| 1529 | * Init l: variables. |
---|
| 1530 | */ |
---|
| 1531 | - init_var_dict(&fc.l_vars, &fc.l_vars_var); |
---|
| 1532 | + init_var_dict(&fc->l_vars, &fc->l_vars_var); |
---|
| 1533 | if (selfdict != NULL) |
---|
| 1534 | { |
---|
| 1535 | /* Set l:self to "selfdict". Use "name" to avoid a warning from |
---|
| 1536 | * some compiler that checks the destination size. */ |
---|
| 1537 | - v = &fc.fixvar[fixvar_idx++].var; |
---|
| 1538 | + v = &fc->fixvar[fixvar_idx++].var; |
---|
| 1539 | name = v->di_key; |
---|
| 1540 | STRCPY(name, "self"); |
---|
| 1541 | v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX; |
---|
| 1542 | - hash_add(&fc.l_vars.dv_hashtab, DI2HIKEY(v)); |
---|
| 1543 | + hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v)); |
---|
| 1544 | v->di_tv.v_type = VAR_DICT; |
---|
| 1545 | v->di_tv.v_lock = 0; |
---|
| 1546 | v->di_tv.vval.v_dict = selfdict; |
---|
| 1547 | @@ -21079,28 +21204,31 @@ |
---|
| 1548 | * Set a:0 to "argcount". |
---|
| 1549 | * Set a:000 to a list with room for the "..." arguments. |
---|
| 1550 | */ |
---|
| 1551 | - init_var_dict(&fc.l_avars, &fc.l_avars_var); |
---|
| 1552 | - add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0", |
---|
| 1553 | + init_var_dict(&fc->l_avars, &fc->l_avars_var); |
---|
| 1554 | + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0", |
---|
| 1555 | (varnumber_T)(argcount - fp->uf_args.ga_len)); |
---|
| 1556 | - v = &fc.fixvar[fixvar_idx++].var; |
---|
| 1557 | - STRCPY(v->di_key, "000"); |
---|
| 1558 | + /* Use "name" to avoid a warning from some compiler that checks the |
---|
| 1559 | + * destination size. */ |
---|
| 1560 | + v = &fc->fixvar[fixvar_idx++].var; |
---|
| 1561 | + name = v->di_key; |
---|
| 1562 | + STRCPY(name, "000"); |
---|
| 1563 | v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; |
---|
| 1564 | - hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v)); |
---|
| 1565 | + hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); |
---|
| 1566 | v->di_tv.v_type = VAR_LIST; |
---|
| 1567 | v->di_tv.v_lock = VAR_FIXED; |
---|
| 1568 | - v->di_tv.vval.v_list = &fc.l_varlist; |
---|
| 1569 | - vim_memset(&fc.l_varlist, 0, sizeof(list_T)); |
---|
| 1570 | - fc.l_varlist.lv_refcount = 99999; |
---|
| 1571 | - fc.l_varlist.lv_lock = VAR_FIXED; |
---|
| 1572 | + v->di_tv.vval.v_list = &fc->l_varlist; |
---|
| 1573 | + vim_memset(&fc->l_varlist, 0, sizeof(list_T)); |
---|
| 1574 | + fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT; |
---|
| 1575 | + fc->l_varlist.lv_lock = VAR_FIXED; |
---|
| 1576 | |
---|
| 1577 | /* |
---|
| 1578 | * Set a:firstline to "firstline" and a:lastline to "lastline". |
---|
| 1579 | * Set a:name to named arguments. |
---|
| 1580 | * Set a:N to the "..." arguments. |
---|
| 1581 | */ |
---|
| 1582 | - add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "firstline", |
---|
| 1583 | + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline", |
---|
| 1584 | (varnumber_T)firstline); |
---|
| 1585 | - add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "lastline", |
---|
| 1586 | + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline", |
---|
| 1587 | (varnumber_T)lastline); |
---|
| 1588 | for (i = 0; i < argcount; ++i) |
---|
| 1589 | { |
---|
| 1590 | @@ -21116,7 +21244,7 @@ |
---|
| 1591 | } |
---|
| 1592 | if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN) |
---|
| 1593 | { |
---|
| 1594 | - v = &fc.fixvar[fixvar_idx++].var; |
---|
| 1595 | + v = &fc->fixvar[fixvar_idx++].var; |
---|
| 1596 | v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; |
---|
| 1597 | } |
---|
| 1598 | else |
---|
| 1599 | @@ -21128,7 +21256,7 @@ |
---|
| 1600 | v->di_flags = DI_FLAGS_RO; |
---|
| 1601 | } |
---|
| 1602 | STRCPY(v->di_key, name); |
---|
| 1603 | - hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v)); |
---|
| 1604 | + hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); |
---|
| 1605 | |
---|
| 1606 | /* Note: the values are copied directly to avoid alloc/free. |
---|
| 1607 | * "argvars" must have VAR_FIXED for v_lock. */ |
---|
| 1608 | @@ -21137,9 +21265,9 @@ |
---|
| 1609 | |
---|
| 1610 | if (ai >= 0 && ai < MAX_FUNC_ARGS) |
---|
| 1611 | { |
---|
| 1612 | - list_append(&fc.l_varlist, &fc.l_listitems[ai]); |
---|
| 1613 | - fc.l_listitems[ai].li_tv = argvars[i]; |
---|
| 1614 | - fc.l_listitems[ai].li_tv.v_lock = VAR_FIXED; |
---|
| 1615 | + list_append(&fc->l_varlist, &fc->l_listitems[ai]); |
---|
| 1616 | + fc->l_listitems[ai].li_tv = argvars[i]; |
---|
| 1617 | + fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED; |
---|
| 1618 | } |
---|
| 1619 | } |
---|
| 1620 | |
---|
| 1621 | @@ -21204,7 +21332,7 @@ |
---|
| 1622 | if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL)) |
---|
| 1623 | func_do_profile(fp); |
---|
| 1624 | if (fp->uf_profiling |
---|
| 1625 | - || (fc.caller != NULL && &fc.caller->func->uf_profiling)) |
---|
| 1626 | + || (fc->caller != NULL && fc->caller->func->uf_profiling)) |
---|
| 1627 | { |
---|
| 1628 | ++fp->uf_tm_count; |
---|
| 1629 | profile_start(&call_start); |
---|
| 1630 | @@ -21220,7 +21348,7 @@ |
---|
| 1631 | did_emsg = FALSE; |
---|
| 1632 | |
---|
| 1633 | /* call do_cmdline() to execute the lines */ |
---|
| 1634 | - do_cmdline(NULL, get_func_line, (void *)&fc, |
---|
| 1635 | + do_cmdline(NULL, get_func_line, (void *)fc, |
---|
| 1636 | DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); |
---|
| 1637 | |
---|
| 1638 | --RedrawingDisabled; |
---|
| 1639 | @@ -21235,16 +21363,16 @@ |
---|
| 1640 | |
---|
| 1641 | #ifdef FEAT_PROFILE |
---|
| 1642 | if (do_profiling == PROF_YES && (fp->uf_profiling |
---|
| 1643 | - || (fc.caller != NULL && &fc.caller->func->uf_profiling))) |
---|
| 1644 | + || (fc->caller != NULL && fc->caller->func->uf_profiling))) |
---|
| 1645 | { |
---|
| 1646 | profile_end(&call_start); |
---|
| 1647 | profile_sub_wait(&wait_start, &call_start); |
---|
| 1648 | profile_add(&fp->uf_tm_total, &call_start); |
---|
| 1649 | profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children); |
---|
| 1650 | - if (fc.caller != NULL && &fc.caller->func->uf_profiling) |
---|
| 1651 | + if (fc->caller != NULL && fc->caller->func->uf_profiling) |
---|
| 1652 | { |
---|
| 1653 | - profile_add(&fc.caller->func->uf_tm_children, &call_start); |
---|
| 1654 | - profile_add(&fc.caller->func->uf_tml_children, &call_start); |
---|
| 1655 | + profile_add(&fc->caller->func->uf_tm_children, &call_start); |
---|
| 1656 | + profile_add(&fc->caller->func->uf_tml_children, &call_start); |
---|
| 1657 | } |
---|
| 1658 | } |
---|
| 1659 | #endif |
---|
| 1660 | @@ -21257,9 +21385,9 @@ |
---|
| 1661 | |
---|
| 1662 | if (aborting()) |
---|
| 1663 | smsg((char_u *)_("%s aborted"), sourcing_name); |
---|
| 1664 | - else if (fc.rettv->v_type == VAR_NUMBER) |
---|
| 1665 | + else if (fc->rettv->v_type == VAR_NUMBER) |
---|
| 1666 | smsg((char_u *)_("%s returning #%ld"), sourcing_name, |
---|
| 1667 | - (long)fc.rettv->vval.v_number); |
---|
| 1668 | + (long)fc->rettv->vval.v_number); |
---|
| 1669 | else |
---|
| 1670 | { |
---|
| 1671 | char_u buf[MSG_BUF_LEN]; |
---|
| 1672 | @@ -21270,7 +21398,7 @@ |
---|
| 1673 | /* The value may be very long. Skip the middle part, so that we |
---|
| 1674 | * have some idea how it starts and ends. smsg() would always |
---|
| 1675 | * truncate it at the end. */ |
---|
| 1676 | - s = tv2string(fc.rettv, &tofree, numbuf2, 0); |
---|
| 1677 | + s = tv2string(fc->rettv, &tofree, numbuf2, 0); |
---|
| 1678 | if (s != NULL) |
---|
| 1679 | { |
---|
| 1680 | trunc_string(s, buf, MSG_BUF_CLEN); |
---|
| 1681 | @@ -21306,14 +21434,84 @@ |
---|
| 1682 | } |
---|
| 1683 | |
---|
| 1684 | did_emsg |= save_did_emsg; |
---|
| 1685 | - current_funccal = fc.caller; |
---|
| 1686 | + current_funccal = fc->caller; |
---|
| 1687 | + --depth; |
---|
| 1688 | |
---|
| 1689 | - /* The a: variables typevals were not allocated, only free the allocated |
---|
| 1690 | - * variables. */ |
---|
| 1691 | - vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE); |
---|
| 1692 | + /* if the a:000 list and the a: dict are not referenced we can free the |
---|
| 1693 | + * funccall_T and what's in it. */ |
---|
| 1694 | + if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT |
---|
| 1695 | + && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT |
---|
| 1696 | + && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT) |
---|
| 1697 | + { |
---|
| 1698 | + free_funccal(fc, FALSE); |
---|
| 1699 | + } |
---|
| 1700 | + else |
---|
| 1701 | + { |
---|
| 1702 | + hashitem_T *hi; |
---|
| 1703 | + listitem_T *li; |
---|
| 1704 | + int todo; |
---|
| 1705 | |
---|
| 1706 | - vars_clear(&fc.l_vars.dv_hashtab); /* free all l: variables */ |
---|
| 1707 | - --depth; |
---|
| 1708 | + /* "fc" is still in use. This can happen when returning "a:000" or |
---|
| 1709 | + * assigning "l:" to a global variable. |
---|
| 1710 | + * Link "fc" in the list for garbage collection later. */ |
---|
| 1711 | + fc->caller = previous_funccal; |
---|
| 1712 | + previous_funccal = fc; |
---|
| 1713 | + |
---|
| 1714 | + /* Make a copy of the a: variables, since we didn't do that above. */ |
---|
| 1715 | + todo = (int)fc->l_avars.dv_hashtab.ht_used; |
---|
| 1716 | + for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi) |
---|
| 1717 | + { |
---|
| 1718 | + if (!HASHITEM_EMPTY(hi)) |
---|
| 1719 | + { |
---|
| 1720 | + --todo; |
---|
| 1721 | + v = HI2DI(hi); |
---|
| 1722 | + copy_tv(&v->di_tv, &v->di_tv); |
---|
| 1723 | + } |
---|
| 1724 | + } |
---|
| 1725 | + |
---|
| 1726 | + /* Make a copy of the a:000 items, since we didn't do that above. */ |
---|
| 1727 | + for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next) |
---|
| 1728 | + copy_tv(&li->li_tv, &li->li_tv); |
---|
| 1729 | + } |
---|
| 1730 | +} |
---|
| 1731 | + |
---|
| 1732 | +/* |
---|
| 1733 | + * Return TRUE if items in "fc" do not have "copyID". That means they are not |
---|
| 1734 | + * referenced from anywyere. |
---|
| 1735 | + */ |
---|
| 1736 | + static int |
---|
| 1737 | +can_free_funccal(fc, copyID) |
---|
| 1738 | + funccall_T *fc; |
---|
| 1739 | + int copyID; |
---|
| 1740 | +{ |
---|
| 1741 | + return (fc->l_varlist.lv_copyID != copyID |
---|
| 1742 | + && fc->l_vars.dv_copyID != copyID |
---|
| 1743 | + && fc->l_avars.dv_copyID != copyID); |
---|
| 1744 | +} |
---|
| 1745 | + |
---|
| 1746 | +/* |
---|
| 1747 | + * Free "fc" and what it contains. |
---|
| 1748 | + */ |
---|
| 1749 | + static void |
---|
| 1750 | +free_funccal(fc, free_val) |
---|
| 1751 | + funccall_T *fc; |
---|
| 1752 | + int free_val; /* a: vars were allocated */ |
---|
| 1753 | +{ |
---|
| 1754 | + listitem_T *li; |
---|
| 1755 | + |
---|
| 1756 | + /* The a: variables typevals may not have been allocated, only free the |
---|
| 1757 | + * allocated variables. */ |
---|
| 1758 | + vars_clear_ext(&fc->l_avars.dv_hashtab, free_val); |
---|
| 1759 | + |
---|
| 1760 | + /* free all l: variables */ |
---|
| 1761 | + vars_clear(&fc->l_vars.dv_hashtab); |
---|
| 1762 | + |
---|
| 1763 | + /* Free the a:000 variables if they were allocated. */ |
---|
| 1764 | + if (free_val) |
---|
| 1765 | + for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next) |
---|
| 1766 | + clear_tv(&li->li_tv); |
---|
| 1767 | + |
---|
| 1768 | + vim_free(fc); |
---|
| 1769 | } |
---|
| 1770 | |
---|
| 1771 | /* |
---|
| 1772 | @@ -21886,6 +22084,62 @@ |
---|
| 1773 | } |
---|
| 1774 | } |
---|
| 1775 | |
---|
| 1776 | +/* |
---|
| 1777 | + * List v:oldfiles in a nice way. |
---|
| 1778 | + */ |
---|
| 1779 | +/*ARGSUSED*/ |
---|
| 1780 | + void |
---|
| 1781 | +ex_oldfiles(eap) |
---|
| 1782 | + exarg_T *eap; |
---|
| 1783 | +{ |
---|
| 1784 | + list_T *l = vimvars[VV_OLDFILES].vv_list; |
---|
| 1785 | + listitem_T *li; |
---|
| 1786 | + int nr = 0; |
---|
| 1787 | + |
---|
| 1788 | + if (l == NULL) |
---|
| 1789 | + msg((char_u *)_("No old files")); |
---|
| 1790 | + else |
---|
| 1791 | + { |
---|
| 1792 | + msg_start(); |
---|
| 1793 | + msg_scroll = TRUE; |
---|
| 1794 | + for (li = l->lv_first; li != NULL && !got_int; li = li->li_next) |
---|
| 1795 | + { |
---|
| 1796 | + msg_outnum((long)++nr); |
---|
| 1797 | + MSG_PUTS(": "); |
---|
| 1798 | + msg_outtrans(get_tv_string(&li->li_tv)); |
---|
| 1799 | + msg_putchar('\n'); |
---|
| 1800 | + out_flush(); /* output one line at a time */ |
---|
| 1801 | + ui_breakcheck(); |
---|
| 1802 | + } |
---|
| 1803 | + /* Assume "got_int" was set to truncate the listing. */ |
---|
| 1804 | + got_int = FALSE; |
---|
| 1805 | + |
---|
| 1806 | +#ifdef FEAT_BROWSE_CMD |
---|
| 1807 | + if (cmdmod.browse) |
---|
| 1808 | + { |
---|
| 1809 | + quit_more = FALSE; |
---|
| 1810 | + nr = prompt_for_number(FALSE); |
---|
| 1811 | + msg_starthere(); |
---|
| 1812 | + if (nr > 0) |
---|
| 1813 | + { |
---|
| 1814 | + char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES), |
---|
| 1815 | + (long)nr); |
---|
| 1816 | + |
---|
| 1817 | + if (p != NULL) |
---|
| 1818 | + { |
---|
| 1819 | + p = expand_env_save(p); |
---|
| 1820 | + eap->arg = p; |
---|
| 1821 | + eap->cmdidx = CMD_edit; |
---|
| 1822 | + cmdmod.browse = FALSE; |
---|
| 1823 | + do_exedit(eap, NULL); |
---|
| 1824 | + vim_free(p); |
---|
| 1825 | + } |
---|
| 1826 | + } |
---|
| 1827 | + } |
---|
| 1828 | +#endif |
---|
| 1829 | + } |
---|
| 1830 | +} |
---|
| 1831 | + |
---|
| 1832 | #endif /* FEAT_EVAL */ |
---|
| 1833 | |
---|
| 1834 | |
---|
| 1835 | diff -Naur vim72.orig/src/ex_cmds.c vim72/src/ex_cmds.c |
---|
| 1836 | --- vim72.orig/src/ex_cmds.c 2008-08-04 12:15:00.000000000 -0700 |
---|
[bef6db9] | 1837 | +++ vim72/src/ex_cmds.c 2009-01-19 00:10:54.000000000 -0800 |
---|
[d25b7db] | 1838 | @@ -24,7 +24,7 @@ |
---|
| 1839 | static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out)); |
---|
| 1840 | #ifdef FEAT_VIMINFO |
---|
| 1841 | static char_u *viminfo_filename __ARGS((char_u *)); |
---|
| 1842 | -static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read)); |
---|
| 1843 | +static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags)); |
---|
| 1844 | static int viminfo_encoding __ARGS((vir_T *virp)); |
---|
| 1845 | static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing)); |
---|
| 1846 | #endif |
---|
[bef6db9] | 1847 | @@ -49,6 +49,7 @@ |
---|
| 1848 | exarg_T *eap; |
---|
| 1849 | { |
---|
| 1850 | int c; |
---|
| 1851 | + int cval; |
---|
| 1852 | char buf1[20]; |
---|
| 1853 | char buf2[20]; |
---|
| 1854 | char_u buf3[7]; |
---|
| 1855 | @@ -75,6 +76,10 @@ |
---|
| 1856 | { |
---|
| 1857 | if (c == NL) /* NUL is stored as NL */ |
---|
| 1858 | c = NUL; |
---|
| 1859 | + if (c == CAR && get_fileformat(curbuf) == EOL_MAC) |
---|
| 1860 | + cval = NL; /* NL is stored as CR */ |
---|
| 1861 | + else |
---|
| 1862 | + cval = c; |
---|
| 1863 | if (vim_isprintc_strict(c) && (c < ' ' |
---|
| 1864 | #ifndef EBCDIC |
---|
| 1865 | || c > '~' |
---|
| 1866 | @@ -94,7 +99,7 @@ |
---|
| 1867 | buf2[0] = NUL; |
---|
| 1868 | vim_snprintf((char *)IObuff, IOSIZE, |
---|
| 1869 | _("<%s>%s%s %d, Hex %02x, Octal %03o"), |
---|
| 1870 | - transchar(c), buf1, buf2, c, c, c); |
---|
| 1871 | + transchar(c), buf1, buf2, cval, cval, cval); |
---|
| 1872 | #ifdef FEAT_MBYTE |
---|
| 1873 | if (enc_utf8) |
---|
| 1874 | c = cc[ci++]; |
---|
| 1875 | @@ -1676,14 +1681,12 @@ |
---|
[d25b7db] | 1876 | |
---|
| 1877 | /* |
---|
| 1878 | * read_viminfo() -- Read the viminfo file. Registers etc. which are already |
---|
| 1879 | - * set are not over-written unless force is TRUE. -- webb |
---|
| 1880 | + * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb |
---|
| 1881 | */ |
---|
| 1882 | int |
---|
| 1883 | -read_viminfo(file, want_info, want_marks, forceit) |
---|
| 1884 | - char_u *file; |
---|
| 1885 | - int want_info; |
---|
| 1886 | - int want_marks; |
---|
| 1887 | - int forceit; |
---|
| 1888 | +read_viminfo(file, flags) |
---|
| 1889 | + char_u *file; /* file name or NULL to use default name */ |
---|
| 1890 | + int flags; /* VIF_WANT_INFO et al. */ |
---|
| 1891 | { |
---|
| 1892 | FILE *fp; |
---|
| 1893 | char_u *fname; |
---|
[bef6db9] | 1894 | @@ -1691,7 +1694,7 @@ |
---|
[d25b7db] | 1895 | if (no_viminfo()) |
---|
| 1896 | return FAIL; |
---|
| 1897 | |
---|
| 1898 | - fname = viminfo_filename(file); /* may set to default if NULL */ |
---|
| 1899 | + fname = viminfo_filename(file); /* get file name in allocated buffer */ |
---|
| 1900 | if (fname == NULL) |
---|
| 1901 | return FAIL; |
---|
| 1902 | fp = mch_fopen((char *)fname, READBIN); |
---|
[bef6db9] | 1903 | @@ -1701,8 +1704,9 @@ |
---|
[d25b7db] | 1904 | verbose_enter(); |
---|
| 1905 | smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"), |
---|
| 1906 | fname, |
---|
| 1907 | - want_info ? _(" info") : "", |
---|
| 1908 | - want_marks ? _(" marks") : "", |
---|
| 1909 | + (flags & VIF_WANT_INFO) ? _(" info") : "", |
---|
| 1910 | + (flags & VIF_WANT_MARKS) ? _(" marks") : "", |
---|
| 1911 | + (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "", |
---|
| 1912 | fp == NULL ? _(" FAILED") : ""); |
---|
| 1913 | verbose_leave(); |
---|
| 1914 | } |
---|
[bef6db9] | 1915 | @@ -1712,10 +1716,9 @@ |
---|
[d25b7db] | 1916 | return FAIL; |
---|
| 1917 | |
---|
| 1918 | viminfo_errcnt = 0; |
---|
| 1919 | - do_viminfo(fp, NULL, want_info, want_marks, forceit); |
---|
| 1920 | + do_viminfo(fp, NULL, flags); |
---|
| 1921 | |
---|
| 1922 | fclose(fp); |
---|
| 1923 | - |
---|
| 1924 | return OK; |
---|
| 1925 | } |
---|
| 1926 | |
---|
[bef6db9] | 1927 | @@ -1943,7 +1946,7 @@ |
---|
[d25b7db] | 1928 | * root. |
---|
| 1929 | */ |
---|
| 1930 | if (fp_out != NULL) |
---|
| 1931 | - (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid); |
---|
| 1932 | + ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid); |
---|
| 1933 | #endif |
---|
| 1934 | } |
---|
| 1935 | } |
---|
[bef6db9] | 1936 | @@ -1968,7 +1971,7 @@ |
---|
[d25b7db] | 1937 | } |
---|
| 1938 | |
---|
| 1939 | viminfo_errcnt = 0; |
---|
| 1940 | - do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE); |
---|
| 1941 | + do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS)); |
---|
| 1942 | |
---|
| 1943 | fclose(fp_out); /* errors are ignored !? */ |
---|
| 1944 | if (fp_in != NULL) |
---|
[bef6db9] | 1945 | @@ -2041,12 +2044,10 @@ |
---|
[d25b7db] | 1946 | * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo(). |
---|
| 1947 | */ |
---|
| 1948 | static void |
---|
| 1949 | -do_viminfo(fp_in, fp_out, want_info, want_marks, force_read) |
---|
| 1950 | +do_viminfo(fp_in, fp_out, flags) |
---|
| 1951 | FILE *fp_in; |
---|
| 1952 | FILE *fp_out; |
---|
| 1953 | - int want_info; |
---|
| 1954 | - int want_marks; |
---|
| 1955 | - int force_read; |
---|
| 1956 | + int flags; |
---|
| 1957 | { |
---|
| 1958 | int count = 0; |
---|
| 1959 | int eof = FALSE; |
---|
[bef6db9] | 1960 | @@ -2061,8 +2062,9 @@ |
---|
[d25b7db] | 1961 | |
---|
| 1962 | if (fp_in != NULL) |
---|
| 1963 | { |
---|
| 1964 | - if (want_info) |
---|
| 1965 | - eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL); |
---|
| 1966 | + if (flags & VIF_WANT_INFO) |
---|
| 1967 | + eof = read_viminfo_up_to_marks(&vir, |
---|
| 1968 | + flags & VIF_FORCEIT, fp_out != NULL); |
---|
| 1969 | else |
---|
| 1970 | /* Skip info, find start of marks */ |
---|
| 1971 | while (!(eof = viminfo_readline(&vir)) |
---|
[bef6db9] | 1972 | @@ -2092,8 +2094,9 @@ |
---|
[d25b7db] | 1973 | write_viminfo_bufferlist(fp_out); |
---|
| 1974 | count = write_viminfo_marks(fp_out); |
---|
| 1975 | } |
---|
| 1976 | - if (fp_in != NULL && want_marks) |
---|
| 1977 | - copy_viminfo_marks(&vir, fp_out, count, eof); |
---|
| 1978 | + if (fp_in != NULL |
---|
| 1979 | + && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT))) |
---|
| 1980 | + copy_viminfo_marks(&vir, fp_out, count, eof, flags); |
---|
| 1981 | |
---|
| 1982 | vim_free(vir.vir_line); |
---|
| 1983 | #ifdef FEAT_MBYTE |
---|
[bef6db9] | 1984 | @@ -5059,6 +5062,7 @@ |
---|
[d25b7db] | 1985 | |
---|
| 1986 | if (did_sub) |
---|
| 1987 | ++sub_nlines; |
---|
| 1988 | + vim_free(new_start); /* for when substitute was cancelled */ |
---|
| 1989 | vim_free(sub_firstline); /* free the copy of the original line */ |
---|
| 1990 | sub_firstline = NULL; |
---|
| 1991 | } |
---|
| 1992 | diff -Naur vim72.orig/src/ex_cmds.h vim72/src/ex_cmds.h |
---|
| 1993 | --- vim72.orig/src/ex_cmds.h 2008-06-21 11:47:57.000000000 -0700 |
---|
[bef6db9] | 1994 | +++ vim72/src/ex_cmds.h 2009-01-19 00:08:31.000000000 -0800 |
---|
[d25b7db] | 1995 | @@ -278,7 +278,7 @@ |
---|
| 1996 | EX(CMD_crewind, "crewind", ex_cc, |
---|
| 1997 | RANGE|NOTADR|COUNT|TRLBAR|BANG), |
---|
| 1998 | EX(CMD_cscope, "cscope", do_cscope, |
---|
| 1999 | - EXTRA|NOTRLCOM|SBOXOK|XFILE), |
---|
| 2000 | + EXTRA|NOTRLCOM|XFILE), |
---|
| 2001 | EX(CMD_cstag, "cstag", do_cstag, |
---|
| 2002 | BANG|TRLBAR|WORD1), |
---|
| 2003 | EX(CMD_cunmap, "cunmap", ex_unmap, |
---|
| 2004 | @@ -506,7 +506,7 @@ |
---|
| 2005 | EX(CMD_lclose, "lclose", ex_cclose, |
---|
| 2006 | RANGE|NOTADR|COUNT|TRLBAR), |
---|
| 2007 | EX(CMD_lcscope, "lcscope", do_cscope, |
---|
| 2008 | - EXTRA|NOTRLCOM|SBOXOK|XFILE), |
---|
| 2009 | + EXTRA|NOTRLCOM|XFILE), |
---|
| 2010 | EX(CMD_left, "left", ex_align, |
---|
| 2011 | TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), |
---|
| 2012 | EX(CMD_leftabove, "leftabove", ex_wrongmodifier, |
---|
| 2013 | @@ -635,6 +635,8 @@ |
---|
| 2014 | RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), |
---|
| 2015 | EX(CMD_noremap, "noremap", ex_map, |
---|
| 2016 | BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), |
---|
| 2017 | +EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier, |
---|
| 2018 | + NEEDARG|EXTRA|NOTRLCOM), |
---|
| 2019 | EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch, |
---|
| 2020 | TRLBAR|SBOXOK|CMDWIN), |
---|
| 2021 | EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate, |
---|
| 2022 | @@ -651,6 +653,8 @@ |
---|
| 2023 | EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), |
---|
| 2024 | EX(CMD_open, "open", ex_open, |
---|
| 2025 | RANGE|EXTRA), |
---|
| 2026 | +EX(CMD_oldfiles, "oldfiles", ex_oldfiles, |
---|
| 2027 | + BANG|TRLBAR|SBOXOK|CMDWIN), |
---|
| 2028 | EX(CMD_omap, "omap", ex_map, |
---|
| 2029 | EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), |
---|
| 2030 | EX(CMD_omapclear, "omapclear", ex_mapclear, |
---|
| 2031 | @@ -802,7 +806,7 @@ |
---|
| 2032 | EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding, |
---|
| 2033 | WORD1|TRLBAR|CMDWIN), |
---|
| 2034 | EX(CMD_scscope, "scscope", do_scscope, |
---|
| 2035 | - EXTRA|NOTRLCOM|SBOXOK), |
---|
| 2036 | + EXTRA|NOTRLCOM), |
---|
| 2037 | EX(CMD_set, "set", ex_set, |
---|
| 2038 | TRLBAR|EXTRA|CMDWIN|SBOXOK), |
---|
| 2039 | EX(CMD_setfiletype, "setfiletype", ex_setfiletype, |
---|
| 2040 | diff -Naur vim72.orig/src/ex_cmds2.c vim72/src/ex_cmds2.c |
---|
| 2041 | --- vim72.orig/src/ex_cmds2.c 2008-07-13 09:18:22.000000000 -0700 |
---|
[bef6db9] | 2042 | +++ vim72/src/ex_cmds2.c 2009-01-19 00:07:35.000000000 -0800 |
---|
[d25b7db] | 2043 | @@ -3145,8 +3145,8 @@ |
---|
| 2044 | verbose_leave(); |
---|
| 2045 | } |
---|
| 2046 | #ifdef STARTUPTIME |
---|
| 2047 | - vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname); |
---|
| 2048 | - time_msg(IObuff, &tv_start); |
---|
| 2049 | + vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname); |
---|
| 2050 | + time_msg((char *)IObuff, &tv_start); |
---|
| 2051 | time_pop(&tv_rel); |
---|
| 2052 | #endif |
---|
| 2053 | |
---|
| 2054 | diff -Naur vim72.orig/src/ex_docmd.c vim72/src/ex_docmd.c |
---|
| 2055 | --- vim72.orig/src/ex_docmd.c 2008-07-26 04:51:05.000000000 -0700 |
---|
[bef6db9] | 2056 | +++ vim72/src/ex_docmd.c 2009-01-19 00:10:13.000000000 -0800 |
---|
[d25b7db] | 2057 | @@ -364,6 +364,7 @@ |
---|
| 2058 | # define ex_function ex_ni |
---|
| 2059 | # define ex_delfunction ex_ni |
---|
| 2060 | # define ex_return ex_ni |
---|
| 2061 | +# define ex_oldfiles ex_ni |
---|
| 2062 | #endif |
---|
| 2063 | static char_u *arg_all __ARGS((void)); |
---|
| 2064 | #ifdef FEAT_SESSION |
---|
| 2065 | @@ -1770,7 +1771,7 @@ |
---|
| 2066 | } |
---|
| 2067 | if (checkforcmd(&ea.cmd, "browse", 3)) |
---|
| 2068 | { |
---|
| 2069 | -#ifdef FEAT_BROWSE |
---|
| 2070 | +#ifdef FEAT_BROWSE_CMD |
---|
| 2071 | cmdmod.browse = TRUE; |
---|
| 2072 | #endif |
---|
| 2073 | continue; |
---|
| 2074 | @@ -2978,6 +2979,7 @@ |
---|
| 2075 | {"keepmarks", 3, FALSE}, |
---|
| 2076 | {"leftabove", 5, FALSE}, |
---|
| 2077 | {"lockmarks", 3, FALSE}, |
---|
| 2078 | + {"noautocmd", 3, FALSE}, |
---|
| 2079 | {"rightbelow", 6, FALSE}, |
---|
| 2080 | {"sandbox", 3, FALSE}, |
---|
| 2081 | {"silent", 3, FALSE}, |
---|
| 2082 | @@ -3608,6 +3610,7 @@ |
---|
| 2083 | return set_context_in_autocmd(xp, arg, FALSE); |
---|
| 2084 | |
---|
| 2085 | case CMD_doautocmd: |
---|
| 2086 | + case CMD_doautoall: |
---|
| 2087 | return set_context_in_autocmd(xp, arg, TRUE); |
---|
| 2088 | #endif |
---|
| 2089 | case CMD_set: |
---|
| 2090 | @@ -8749,8 +8752,8 @@ |
---|
| 2091 | else if (*dirnow != NUL |
---|
| 2092 | && (ssop_flags & SSOP_CURDIR) && globaldir != NULL) |
---|
| 2093 | { |
---|
| 2094 | - (void)mch_chdir((char *)globaldir); |
---|
| 2095 | - shorten_fnames(TRUE); |
---|
| 2096 | + if (mch_chdir((char *)globaldir) == OK) |
---|
| 2097 | + shorten_fnames(TRUE); |
---|
| 2098 | } |
---|
| 2099 | |
---|
| 2100 | failed |= (makeopens(fd, dirnow) == FAIL); |
---|
| 2101 | @@ -9506,24 +9509,50 @@ |
---|
| 2102 | break; |
---|
| 2103 | } |
---|
| 2104 | s = src + 1; |
---|
| 2105 | + if (*s == '<') /* "#<99" uses v:oldfiles */ |
---|
| 2106 | + ++s; |
---|
| 2107 | i = (int)getdigits(&s); |
---|
| 2108 | *usedlen = (int)(s - src); /* length of what we expand */ |
---|
| 2109 | |
---|
| 2110 | - buf = buflist_findnr(i); |
---|
| 2111 | - if (buf == NULL) |
---|
| 2112 | + if (src[1] == '<') |
---|
| 2113 | { |
---|
| 2114 | - *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'"); |
---|
| 2115 | + if (*usedlen < 2) |
---|
| 2116 | + { |
---|
| 2117 | + /* Should we give an error message for #<text? */ |
---|
| 2118 | + *usedlen = 1; |
---|
| 2119 | + return NULL; |
---|
| 2120 | + } |
---|
| 2121 | +#ifdef FEAT_EVAL |
---|
| 2122 | + result = list_find_str(get_vim_var_list(VV_OLDFILES), |
---|
| 2123 | + (long)i); |
---|
| 2124 | + if (result == NULL) |
---|
| 2125 | + { |
---|
| 2126 | + *errormsg = (char_u *)""; |
---|
| 2127 | + return NULL; |
---|
| 2128 | + } |
---|
| 2129 | +#else |
---|
| 2130 | + *errormsg = (char_u *)_("E809: #< is not available without the +eval feature"); |
---|
| 2131 | return NULL; |
---|
| 2132 | +#endif |
---|
| 2133 | } |
---|
| 2134 | - if (lnump != NULL) |
---|
| 2135 | - *lnump = ECMD_LAST; |
---|
| 2136 | - if (buf->b_fname == NULL) |
---|
| 2137 | + else |
---|
| 2138 | { |
---|
| 2139 | - result = (char_u *)""; |
---|
| 2140 | - valid = 0; /* Must have ":p:h" to be valid */ |
---|
| 2141 | + buf = buflist_findnr(i); |
---|
| 2142 | + if (buf == NULL) |
---|
| 2143 | + { |
---|
| 2144 | + *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'"); |
---|
| 2145 | + return NULL; |
---|
| 2146 | + } |
---|
| 2147 | + if (lnump != NULL) |
---|
| 2148 | + *lnump = ECMD_LAST; |
---|
| 2149 | + if (buf->b_fname == NULL) |
---|
| 2150 | + { |
---|
| 2151 | + result = (char_u *)""; |
---|
| 2152 | + valid = 0; /* Must have ":p:h" to be valid */ |
---|
| 2153 | + } |
---|
| 2154 | + else |
---|
| 2155 | + result = buf->b_fname; |
---|
| 2156 | } |
---|
| 2157 | - else |
---|
| 2158 | - result = buf->b_fname; |
---|
| 2159 | break; |
---|
| 2160 | |
---|
| 2161 | #ifdef FEAT_SEARCHPATH |
---|
| 2162 | @@ -9541,6 +9570,15 @@ |
---|
| 2163 | #ifdef FEAT_AUTOCMD |
---|
| 2164 | case SPEC_AFILE: /* file name for autocommand */ |
---|
| 2165 | result = autocmd_fname; |
---|
| 2166 | + if (result != NULL && !autocmd_fname_full) |
---|
| 2167 | + { |
---|
| 2168 | + /* Still need to turn the fname into a full path. It is |
---|
| 2169 | + * postponed to avoid a delay when <afile> is not used. */ |
---|
| 2170 | + autocmd_fname_full = TRUE; |
---|
| 2171 | + result = FullName_save(autocmd_fname, FALSE); |
---|
| 2172 | + vim_free(autocmd_fname); |
---|
| 2173 | + autocmd_fname = result; |
---|
| 2174 | + } |
---|
| 2175 | if (result == NULL) |
---|
| 2176 | { |
---|
| 2177 | *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\""); |
---|
| 2178 | @@ -10067,7 +10105,7 @@ |
---|
| 2179 | */ |
---|
| 2180 | if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL |
---|
| 2181 | || put_line(fd, "if file_readable(s:sx)") == FAIL |
---|
| 2182 | - || put_line(fd, " exe \"source \" . s:sx") == FAIL |
---|
| 2183 | + || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL |
---|
| 2184 | || put_line(fd, "endif") == FAIL) |
---|
| 2185 | return FAIL; |
---|
| 2186 | |
---|
| 2187 | @@ -10689,7 +10727,8 @@ |
---|
| 2188 | p_viminfo = (char_u *)"'100"; |
---|
| 2189 | if (eap->cmdidx == CMD_rviminfo) |
---|
| 2190 | { |
---|
| 2191 | - if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL) |
---|
| 2192 | + if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS |
---|
| 2193 | + | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL) |
---|
| 2194 | EMSG(_("E195: Cannot open viminfo file for reading")); |
---|
| 2195 | } |
---|
| 2196 | else |
---|
| 2197 | diff -Naur vim72.orig/src/ex_getln.c vim72/src/ex_getln.c |
---|
| 2198 | --- vim72.orig/src/ex_getln.c 2008-08-08 02:31:33.000000000 -0700 |
---|
[bef6db9] | 2199 | +++ vim72/src/ex_getln.c 2009-01-19 00:09:28.000000000 -0800 |
---|
[d25b7db] | 2200 | @@ -31,6 +31,8 @@ |
---|
| 2201 | int cmdattr; /* attributes for prompt */ |
---|
| 2202 | int overstrike; /* Typing mode on the command line. Shared by |
---|
| 2203 | getcmdline() and put_on_cmdline(). */ |
---|
| 2204 | + expand_T *xpc; /* struct being used for expansion, xp_pattern |
---|
| 2205 | + may point into cmdbuff */ |
---|
| 2206 | int xp_context; /* type of expansion */ |
---|
| 2207 | # ifdef FEAT_EVAL |
---|
| 2208 | char_u *xp_arg; /* user-defined expansion arg */ |
---|
| 2209 | @@ -38,7 +40,11 @@ |
---|
| 2210 | # endif |
---|
| 2211 | }; |
---|
| 2212 | |
---|
| 2213 | -static struct cmdline_info ccline; /* current cmdline_info */ |
---|
| 2214 | +/* The current cmdline_info. It is initialized in getcmdline() and after that |
---|
| 2215 | + * used by other functions. When invoking getcmdline() recursively it needs |
---|
| 2216 | + * to be saved with save_cmdline() and restored with restore_cmdline(). |
---|
| 2217 | + * TODO: make it local to getcmdline() and pass it around. */ |
---|
| 2218 | +static struct cmdline_info ccline; |
---|
| 2219 | |
---|
| 2220 | static int cmd_showtail; /* Only show path tail in lists ? */ |
---|
| 2221 | |
---|
| 2222 | @@ -238,6 +244,7 @@ |
---|
| 2223 | } |
---|
| 2224 | |
---|
| 2225 | ExpandInit(&xpc); |
---|
| 2226 | + ccline.xpc = &xpc; |
---|
| 2227 | |
---|
| 2228 | #ifdef FEAT_RIGHTLEFT |
---|
| 2229 | if (curwin->w_p_rl && *curwin->w_p_rlc == 's' |
---|
| 2230 | @@ -408,9 +415,10 @@ |
---|
| 2231 | #endif |
---|
| 2232 | |
---|
| 2233 | /* |
---|
| 2234 | - * <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>). |
---|
| 2235 | + * When there are matching completions to select <S-Tab> works like |
---|
| 2236 | + * CTRL-P (unless 'wc' is <S-Tab>). |
---|
| 2237 | */ |
---|
| 2238 | - if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1) |
---|
| 2239 | + if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0) |
---|
| 2240 | c = Ctrl_P; |
---|
| 2241 | |
---|
| 2242 | #ifdef FEAT_WILDMENU |
---|
| 2243 | @@ -1513,6 +1521,7 @@ |
---|
| 2244 | int old_firstc; |
---|
| 2245 | |
---|
| 2246 | vim_free(ccline.cmdbuff); |
---|
| 2247 | + xpc.xp_context = EXPAND_NOTHING; |
---|
| 2248 | if (hiscnt == hislen) |
---|
| 2249 | p = lookfor; /* back to the old one */ |
---|
| 2250 | else |
---|
| 2251 | @@ -1839,6 +1848,7 @@ |
---|
| 2252 | #endif |
---|
| 2253 | |
---|
| 2254 | ExpandCleanup(&xpc); |
---|
| 2255 | + ccline.xpc = NULL; |
---|
| 2256 | |
---|
| 2257 | #ifdef FEAT_SEARCH_EXTRA |
---|
| 2258 | if (did_incsearch) |
---|
| 2259 | @@ -2508,6 +2518,20 @@ |
---|
| 2260 | } |
---|
| 2261 | mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1); |
---|
| 2262 | vim_free(p); |
---|
| 2263 | + |
---|
| 2264 | + if (ccline.xpc != NULL |
---|
| 2265 | + && ccline.xpc->xp_pattern != NULL |
---|
| 2266 | + && ccline.xpc->xp_context != EXPAND_NOTHING |
---|
| 2267 | + && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) |
---|
| 2268 | + { |
---|
| 2269 | + int i = (int)(ccline.xpc->xp_pattern - p); |
---|
| 2270 | + |
---|
| 2271 | + /* If xp_pattern points inside the old cmdbuff it needs to be adjusted |
---|
| 2272 | + * to point into the newly allocated memory. */ |
---|
| 2273 | + if (i >= 0 && i <= ccline.cmdlen) |
---|
| 2274 | + ccline.xpc->xp_pattern = ccline.cmdbuff + i; |
---|
| 2275 | + } |
---|
| 2276 | + |
---|
| 2277 | return OK; |
---|
| 2278 | } |
---|
| 2279 | |
---|
| 2280 | @@ -2875,6 +2899,7 @@ |
---|
| 2281 | prev_ccline = ccline; |
---|
| 2282 | ccline.cmdbuff = NULL; |
---|
| 2283 | ccline.cmdprompt = NULL; |
---|
| 2284 | + ccline.xpc = NULL; |
---|
| 2285 | } |
---|
| 2286 | |
---|
| 2287 | /* |
---|
| 2288 | @@ -3582,6 +3607,7 @@ |
---|
| 2289 | ExpandInit(xp) |
---|
| 2290 | expand_T *xp; |
---|
| 2291 | { |
---|
| 2292 | + xp->xp_pattern = NULL; |
---|
| 2293 | xp->xp_backslash = XP_BS_NONE; |
---|
| 2294 | #ifndef BACKSLASH_IN_FILENAME |
---|
| 2295 | xp->xp_shell = FALSE; |
---|
| 2296 | @@ -4871,7 +4897,7 @@ |
---|
| 2297 | if (s == NULL) |
---|
| 2298 | return FAIL; |
---|
| 2299 | sprintf((char *)s, "%s/%s*.vim", dirname, pat); |
---|
| 2300 | - all = globpath(p_rtp, s); |
---|
| 2301 | + all = globpath(p_rtp, s, 0); |
---|
| 2302 | vim_free(s); |
---|
| 2303 | if (all == NULL) |
---|
| 2304 | return FAIL; |
---|
| 2305 | @@ -4912,9 +4938,10 @@ |
---|
| 2306 | * newlines. Returns NULL for an error or no matches. |
---|
| 2307 | */ |
---|
| 2308 | char_u * |
---|
| 2309 | -globpath(path, file) |
---|
| 2310 | +globpath(path, file, expand_options) |
---|
| 2311 | char_u *path; |
---|
| 2312 | char_u *file; |
---|
| 2313 | + int expand_options; |
---|
| 2314 | { |
---|
| 2315 | expand_T xpc; |
---|
| 2316 | char_u *buf; |
---|
| 2317 | @@ -4943,10 +4970,10 @@ |
---|
| 2318 | { |
---|
| 2319 | add_pathsep(buf); |
---|
| 2320 | STRCAT(buf, file); |
---|
| 2321 | - if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL |
---|
| 2322 | - && num_p > 0) |
---|
| 2323 | + if (ExpandFromContext(&xpc, buf, &num_p, &p, |
---|
| 2324 | + WILD_SILENT|expand_options) != FAIL && num_p > 0) |
---|
| 2325 | { |
---|
| 2326 | - ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT); |
---|
| 2327 | + ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options); |
---|
| 2328 | for (len = 0, i = 0; i < num_p; ++i) |
---|
| 2329 | len += (int)STRLEN(p[i]) + 1; |
---|
| 2330 | |
---|
| 2331 | diff -Naur vim72.orig/src/feature.h vim72/src/feature.h |
---|
| 2332 | --- vim72.orig/src/feature.h 2008-08-06 04:00:39.000000000 -0700 |
---|
[bef6db9] | 2333 | +++ vim72/src/feature.h 2009-01-19 00:08:31.000000000 -0800 |
---|
[d25b7db] | 2334 | @@ -767,9 +767,13 @@ |
---|
| 2335 | |
---|
| 2336 | /* |
---|
| 2337 | * +browse ":browse" command. |
---|
| 2338 | + * or just the ":browse" command modifier |
---|
| 2339 | */ |
---|
| 2340 | -#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)) |
---|
| 2341 | -# define FEAT_BROWSE |
---|
| 2342 | +#if defined(FEAT_NORMAL) |
---|
| 2343 | +# define FEAT_BROWSE_CMD |
---|
| 2344 | +# 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) |
---|
| 2345 | +# define FEAT_BROWSE |
---|
| 2346 | +# endif |
---|
| 2347 | #endif |
---|
| 2348 | |
---|
| 2349 | /* |
---|
| 2350 | diff -Naur vim72.orig/src/fileio.c vim72/src/fileio.c |
---|
| 2351 | --- vim72.orig/src/fileio.c 2008-08-06 04:01:03.000000000 -0700 |
---|
[bef6db9] | 2352 | +++ vim72/src/fileio.c 2009-01-19 00:10:40.000000000 -0800 |
---|
[d25b7db] | 2353 | @@ -932,7 +932,10 @@ |
---|
| 2354 | else |
---|
| 2355 | { |
---|
| 2356 | if (eap != NULL && eap->force_ff != 0) |
---|
| 2357 | + { |
---|
| 2358 | fileformat = get_fileformat_force(curbuf, eap); |
---|
| 2359 | + try_unix = try_dos = try_mac = FALSE; |
---|
| 2360 | + } |
---|
| 2361 | else if (curbuf->b_p_bin) |
---|
| 2362 | fileformat = EOL_UNIX; /* binary: use Unix format */ |
---|
| 2363 | else if (*p_ffs == NUL) |
---|
| 2364 | @@ -2211,7 +2214,7 @@ |
---|
| 2365 | { |
---|
| 2366 | /* Use stderr for stdin, makes shell commands work. */ |
---|
| 2367 | close(0); |
---|
| 2368 | - dup(2); |
---|
| 2369 | + ignored = dup(2); |
---|
| 2370 | } |
---|
| 2371 | #endif |
---|
| 2372 | |
---|
| 2373 | @@ -2341,11 +2344,6 @@ |
---|
| 2374 | STRCAT(IObuff, _("[CR missing]")); |
---|
| 2375 | c = TRUE; |
---|
| 2376 | } |
---|
| 2377 | - if (ff_error == EOL_MAC) |
---|
| 2378 | - { |
---|
| 2379 | - STRCAT(IObuff, _("[NL found]")); |
---|
| 2380 | - c = TRUE; |
---|
| 2381 | - } |
---|
| 2382 | if (split) |
---|
| 2383 | { |
---|
| 2384 | STRCAT(IObuff, _("[long lines split]")); |
---|
| 2385 | @@ -2711,7 +2709,7 @@ |
---|
| 2386 | { |
---|
| 2387 | if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0 |
---|
| 2388 | && curbuf->b_ffname != NULL) |
---|
| 2389 | - read_viminfo(NULL, FALSE, TRUE, FALSE); |
---|
| 2390 | + read_viminfo(NULL, VIF_WANT_MARKS); |
---|
| 2391 | |
---|
| 2392 | /* Always set b_marks_read; needed when 'viminfo' is changed to include |
---|
| 2393 | * the ' parameter after opening a buffer. */ |
---|
| 2394 | @@ -3451,7 +3449,7 @@ |
---|
| 2395 | { |
---|
| 2396 | # ifdef UNIX |
---|
| 2397 | # ifdef HAVE_FCHOWN |
---|
| 2398 | - fchown(fd, st_old.st_uid, st_old.st_gid); |
---|
| 2399 | + ignored = fchown(fd, st_old.st_uid, st_old.st_gid); |
---|
| 2400 | # endif |
---|
| 2401 | if (mch_stat((char *)IObuff, &st) < 0 |
---|
| 2402 | || st.st_uid != st_old.st_uid |
---|
| 2403 | @@ -4367,7 +4365,7 @@ |
---|
| 2404 | || st.st_uid != st_old.st_uid |
---|
| 2405 | || st.st_gid != st_old.st_gid) |
---|
| 2406 | { |
---|
| 2407 | - fchown(fd, st_old.st_uid, st_old.st_gid); |
---|
| 2408 | + ignored = fchown(fd, st_old.st_uid, st_old.st_gid); |
---|
| 2409 | if (perm >= 0) /* set permission again, may have changed */ |
---|
| 2410 | (void)mch_setperm(wfname, perm); |
---|
| 2411 | } |
---|
| 2412 | @@ -5550,9 +5548,10 @@ |
---|
| 2413 | name = "ucs-4le"; /* FF FE 00 00 */ |
---|
| 2414 | len = 4; |
---|
| 2415 | } |
---|
| 2416 | - else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L)) |
---|
| 2417 | + else if (flags == (FIO_UCS2 | FIO_ENDIAN_L)) |
---|
| 2418 | name = "ucs-2le"; /* FF FE */ |
---|
| 2419 | - else if (flags == (FIO_UTF16 | FIO_ENDIAN_L)) |
---|
| 2420 | + else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L)) |
---|
| 2421 | + /* utf-16le is preferred, it also works for ucs-2le text */ |
---|
| 2422 | name = "utf-16le"; /* FF FE */ |
---|
| 2423 | } |
---|
| 2424 | else if (p[0] == 0xfe && p[1] == 0xff |
---|
| 2425 | @@ -6031,9 +6030,9 @@ |
---|
| 2426 | { |
---|
| 2427 | tbuf[FGETS_SIZE - 2] = NUL; |
---|
| 2428 | #ifdef USE_CR |
---|
| 2429 | - fgets_cr((char *)tbuf, FGETS_SIZE, fp); |
---|
| 2430 | + ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp); |
---|
| 2431 | #else |
---|
| 2432 | - fgets((char *)tbuf, FGETS_SIZE, fp); |
---|
| 2433 | + ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp); |
---|
| 2434 | #endif |
---|
| 2435 | } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n'); |
---|
| 2436 | } |
---|
[bef6db9] | 2437 | @@ -6107,12 +6106,24 @@ |
---|
| 2438 | #ifdef HAVE_ACL |
---|
| 2439 | vim_acl_T acl; /* ACL from original file */ |
---|
| 2440 | #endif |
---|
| 2441 | +#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME) |
---|
| 2442 | + int use_tmp_file = FALSE; |
---|
| 2443 | +#endif |
---|
| 2444 | |
---|
| 2445 | /* |
---|
| 2446 | - * When the names are identical, there is nothing to do. |
---|
| 2447 | + * When the names are identical, there is nothing to do. When they refer |
---|
| 2448 | + * to the same file (ignoring case and slash/backslash differences) but |
---|
| 2449 | + * the file name differs we need to go through a temp file. |
---|
| 2450 | */ |
---|
| 2451 | if (fnamecmp(from, to) == 0) |
---|
| 2452 | - return 0; |
---|
| 2453 | + { |
---|
| 2454 | +#ifdef CASE_INSENSITIVE_FILENAME |
---|
| 2455 | + if (STRCMP(gettail(from), gettail(to)) != 0) |
---|
| 2456 | + use_tmp_file = TRUE; |
---|
| 2457 | + else |
---|
| 2458 | +#endif |
---|
| 2459 | + return 0; |
---|
| 2460 | + } |
---|
| 2461 | |
---|
| 2462 | /* |
---|
| 2463 | * Fail if the "from" file doesn't exist. Avoids that "to" is deleted. |
---|
| 2464 | @@ -6120,6 +6131,55 @@ |
---|
[d25b7db] | 2465 | if (mch_stat((char *)from, &st) < 0) |
---|
| 2466 | return -1; |
---|
| 2467 | |
---|
| 2468 | +#ifdef UNIX |
---|
| 2469 | + { |
---|
| 2470 | + struct stat st_to; |
---|
| 2471 | + |
---|
| 2472 | + /* It's possible for the source and destination to be the same file. |
---|
| 2473 | + * This happens when "from" and "to" differ in case and are on a FAT32 |
---|
| 2474 | + * filesystem. In that case go through a temp file name. */ |
---|
| 2475 | + if (mch_stat((char *)to, &st_to) >= 0 |
---|
| 2476 | + && st.st_dev == st_to.st_dev |
---|
| 2477 | + && st.st_ino == st_to.st_ino) |
---|
[bef6db9] | 2478 | + use_tmp_file = TRUE; |
---|
| 2479 | + } |
---|
| 2480 | +#endif |
---|
| 2481 | + |
---|
| 2482 | +#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME) |
---|
| 2483 | + if (use_tmp_file) |
---|
| 2484 | + { |
---|
| 2485 | + char tempname[MAXPATHL + 1]; |
---|
| 2486 | + |
---|
| 2487 | + /* |
---|
| 2488 | + * Find a name that doesn't exist and is in the same directory. |
---|
| 2489 | + * Rename "from" to "tempname" and then rename "tempname" to "to". |
---|
| 2490 | + */ |
---|
| 2491 | + if (STRLEN(from) >= MAXPATHL - 5) |
---|
| 2492 | + return -1; |
---|
| 2493 | + STRCPY(tempname, from); |
---|
| 2494 | + for (n = 123; n < 99999; ++n) |
---|
[d25b7db] | 2495 | + { |
---|
[bef6db9] | 2496 | + sprintf((char *)gettail((char_u *)tempname), "%d", n); |
---|
| 2497 | + if (mch_stat(tempname, &st) < 0) |
---|
[d25b7db] | 2498 | + { |
---|
[bef6db9] | 2499 | + if (mch_rename((char *)from, tempname) == 0) |
---|
[d25b7db] | 2500 | + { |
---|
[bef6db9] | 2501 | + if (mch_rename(tempname, (char *)to) == 0) |
---|
| 2502 | + return 0; |
---|
| 2503 | + /* Strange, the second step failed. Try moving the |
---|
| 2504 | + * file back and return failure. */ |
---|
| 2505 | + mch_rename(tempname, (char *)from); |
---|
[d25b7db] | 2506 | + return -1; |
---|
| 2507 | + } |
---|
[bef6db9] | 2508 | + /* If it fails for one temp name it will most likely fail |
---|
| 2509 | + * for any temp name, give up. */ |
---|
| 2510 | + return -1; |
---|
[d25b7db] | 2511 | + } |
---|
| 2512 | + } |
---|
[bef6db9] | 2513 | + return -1; |
---|
[d25b7db] | 2514 | + } |
---|
| 2515 | +#endif |
---|
| 2516 | + |
---|
| 2517 | /* |
---|
| 2518 | * Delete the "to" file, this is required on some systems to make the |
---|
| 2519 | * mch_rename() work, on other systems it makes sure that we don't have |
---|
[bef6db9] | 2520 | @@ -8523,6 +8583,7 @@ |
---|
[d25b7db] | 2521 | char_u *save_sourcing_name; |
---|
| 2522 | linenr_T save_sourcing_lnum; |
---|
| 2523 | char_u *save_autocmd_fname; |
---|
| 2524 | + int save_autocmd_fname_full; |
---|
| 2525 | int save_autocmd_bufnr; |
---|
| 2526 | char_u *save_autocmd_match; |
---|
| 2527 | int save_autocmd_busy; |
---|
[bef6db9] | 2528 | @@ -8601,6 +8662,7 @@ |
---|
[d25b7db] | 2529 | * Save the autocmd_* variables and info about the current buffer. |
---|
| 2530 | */ |
---|
| 2531 | save_autocmd_fname = autocmd_fname; |
---|
| 2532 | + save_autocmd_fname_full = autocmd_fname_full; |
---|
| 2533 | save_autocmd_bufnr = autocmd_bufnr; |
---|
| 2534 | save_autocmd_match = autocmd_match; |
---|
| 2535 | save_autocmd_busy = autocmd_busy; |
---|
[bef6db9] | 2536 | @@ -8618,14 +8680,15 @@ |
---|
[d25b7db] | 2537 | if (fname != NULL && *fname != NUL) |
---|
| 2538 | autocmd_fname = fname; |
---|
| 2539 | else if (buf != NULL) |
---|
| 2540 | - autocmd_fname = buf->b_fname; |
---|
| 2541 | + autocmd_fname = buf->b_ffname; |
---|
| 2542 | else |
---|
| 2543 | autocmd_fname = NULL; |
---|
| 2544 | } |
---|
| 2545 | else |
---|
| 2546 | autocmd_fname = fname_io; |
---|
| 2547 | if (autocmd_fname != NULL) |
---|
| 2548 | - autocmd_fname = FullName_save(autocmd_fname, FALSE); |
---|
| 2549 | + autocmd_fname = vim_strsave(autocmd_fname); |
---|
| 2550 | + autocmd_fname_full = FALSE; /* call FullName_save() later */ |
---|
| 2551 | |
---|
| 2552 | /* |
---|
| 2553 | * Set the buffer number to be used for <abuf>. |
---|
[bef6db9] | 2554 | @@ -8810,6 +8873,7 @@ |
---|
[d25b7db] | 2555 | sourcing_lnum = save_sourcing_lnum; |
---|
| 2556 | vim_free(autocmd_fname); |
---|
| 2557 | autocmd_fname = save_autocmd_fname; |
---|
| 2558 | + autocmd_fname_full = save_autocmd_fname_full; |
---|
| 2559 | autocmd_bufnr = save_autocmd_bufnr; |
---|
| 2560 | autocmd_match = save_autocmd_match; |
---|
| 2561 | #ifdef FEAT_EVAL |
---|
[bef6db9] | 2562 | @@ -8918,7 +8982,7 @@ |
---|
[d25b7db] | 2563 | { |
---|
| 2564 | apc->curpat = NULL; |
---|
| 2565 | |
---|
| 2566 | - /* only use a pattern when it has not been removed, has commands and |
---|
| 2567 | + /* Only use a pattern when it has not been removed, has commands and |
---|
| 2568 | * the group matches. For buffer-local autocommands only check the |
---|
| 2569 | * buffer number. */ |
---|
| 2570 | if (ap->pat != NULL && ap->cmds != NULL |
---|
[bef6db9] | 2571 | @@ -9104,7 +9168,7 @@ |
---|
[d25b7db] | 2572 | set_context_in_autocmd(xp, arg, doautocmd) |
---|
| 2573 | expand_T *xp; |
---|
| 2574 | char_u *arg; |
---|
| 2575 | - int doautocmd; /* TRUE for :doautocmd, FALSE for :autocmd */ |
---|
| 2576 | + int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */ |
---|
| 2577 | { |
---|
| 2578 | char_u *p; |
---|
| 2579 | int group; |
---|
| 2580 | diff -Naur vim72.orig/src/fold.c vim72/src/fold.c |
---|
| 2581 | --- vim72.orig/src/fold.c 2008-08-06 04:01:12.000000000 -0700 |
---|
[bef6db9] | 2582 | +++ vim72/src/fold.c 2009-01-19 00:10:42.000000000 -0800 |
---|
[d25b7db] | 2583 | @@ -48,7 +48,7 @@ |
---|
| 2584 | static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp)); |
---|
| 2585 | static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum)); |
---|
| 2586 | static void checkupdate __ARGS((win_T *wp)); |
---|
| 2587 | -static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open)); |
---|
| 2588 | +static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open)); |
---|
| 2589 | static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep)); |
---|
| 2590 | static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep)); |
---|
| 2591 | static void foldOpenNested __ARGS((fold_T *fpr)); |
---|
[bef6db9] | 2592 | @@ -740,7 +740,7 @@ |
---|
| 2593 | garray_T *found_ga; |
---|
| 2594 | fold_T *found_fp = NULL; |
---|
| 2595 | linenr_T found_off = 0; |
---|
| 2596 | - int use_level = FALSE; |
---|
| 2597 | + int use_level; |
---|
| 2598 | int maybe_small = FALSE; |
---|
| 2599 | int level = 0; |
---|
| 2600 | linenr_T lnum = start; |
---|
| 2601 | @@ -757,6 +757,7 @@ |
---|
| 2602 | gap = &curwin->w_folds; |
---|
| 2603 | found_ga = NULL; |
---|
| 2604 | lnum_off = 0; |
---|
| 2605 | + use_level = FALSE; |
---|
| 2606 | for (;;) |
---|
| 2607 | { |
---|
| 2608 | if (!foldFind(gap, lnum - lnum_off, &fp)) |
---|
| 2609 | @@ -783,20 +784,21 @@ |
---|
| 2610 | else |
---|
| 2611 | { |
---|
| 2612 | lnum = found_fp->fd_top + found_fp->fd_len + found_off; |
---|
| 2613 | - did_one = TRUE; |
---|
| 2614 | |
---|
| 2615 | if (foldmethodIsManual(curwin)) |
---|
| 2616 | deleteFoldEntry(found_ga, |
---|
| 2617 | (int)(found_fp - (fold_T *)found_ga->ga_data), recursive); |
---|
| 2618 | else |
---|
| 2619 | { |
---|
| 2620 | - if (found_fp->fd_top + found_off < first_lnum) |
---|
| 2621 | - first_lnum = found_fp->fd_top; |
---|
| 2622 | - if (lnum > last_lnum) |
---|
| 2623 | + if (first_lnum > found_fp->fd_top + found_off) |
---|
| 2624 | + first_lnum = found_fp->fd_top + found_off; |
---|
| 2625 | + if (last_lnum < lnum) |
---|
| 2626 | last_lnum = lnum; |
---|
| 2627 | - parseMarker(curwin); |
---|
| 2628 | + if (!did_one) |
---|
| 2629 | + parseMarker(curwin); |
---|
| 2630 | deleteFoldMarkers(found_fp, recursive, found_off); |
---|
| 2631 | } |
---|
| 2632 | + did_one = TRUE; |
---|
| 2633 | |
---|
| 2634 | /* redraw window */ |
---|
| 2635 | changed_window_setting(); |
---|
| 2636 | @@ -811,6 +813,10 @@ |
---|
| 2637 | redraw_curbuf_later(INVERTED); |
---|
| 2638 | #endif |
---|
| 2639 | } |
---|
| 2640 | + else |
---|
| 2641 | + /* Deleting markers may make cursor column invalid. */ |
---|
| 2642 | + check_cursor_col(); |
---|
| 2643 | + |
---|
| 2644 | if (last_lnum > 0) |
---|
| 2645 | changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L); |
---|
| 2646 | } |
---|
| 2647 | @@ -1241,10 +1247,10 @@ |
---|
[d25b7db] | 2648 | * Repeat "count" times. |
---|
| 2649 | */ |
---|
| 2650 | static void |
---|
| 2651 | -setFoldRepeat(lnum, count, open) |
---|
| 2652 | +setFoldRepeat(lnum, count, do_open) |
---|
| 2653 | linenr_T lnum; |
---|
| 2654 | long count; |
---|
| 2655 | - int open; |
---|
| 2656 | + int do_open; |
---|
| 2657 | { |
---|
| 2658 | int done; |
---|
| 2659 | long n; |
---|
[bef6db9] | 2660 | @@ -1252,7 +1258,7 @@ |
---|
[d25b7db] | 2661 | for (n = 0; n < count; ++n) |
---|
| 2662 | { |
---|
| 2663 | done = DONE_NOTHING; |
---|
| 2664 | - (void)setManualFold(lnum, open, FALSE, &done); |
---|
| 2665 | + (void)setManualFold(lnum, do_open, FALSE, &done); |
---|
| 2666 | if (!(done & DONE_ACTION)) |
---|
| 2667 | { |
---|
| 2668 | /* Only give an error message when no fold could be opened. */ |
---|
| 2669 | diff -Naur vim72.orig/src/getchar.c vim72/src/getchar.c |
---|
| 2670 | --- vim72.orig/src/getchar.c 2008-07-22 09:57:48.000000000 -0700 |
---|
[bef6db9] | 2671 | +++ vim72/src/getchar.c 2009-01-19 00:09:36.000000000 -0800 |
---|
[d25b7db] | 2672 | @@ -4702,7 +4702,7 @@ |
---|
| 2673 | return FAIL; |
---|
| 2674 | if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0) |
---|
| 2675 | return FAIL; |
---|
| 2676 | - if (fprintf(fd, cmd) < 0) |
---|
| 2677 | + if (fputs(cmd, fd) < 0) |
---|
| 2678 | return FAIL; |
---|
| 2679 | if (buf != NULL && fputs(" <buffer>", fd) < 0) |
---|
| 2680 | return FAIL; |
---|
| 2681 | @@ -4801,7 +4801,7 @@ |
---|
| 2682 | } |
---|
| 2683 | if (IS_SPECIAL(c) || modifiers) /* special key */ |
---|
| 2684 | { |
---|
| 2685 | - if (fprintf(fd, (char *)get_special_key_name(c, modifiers)) < 0) |
---|
| 2686 | + if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0) |
---|
| 2687 | return FAIL; |
---|
| 2688 | continue; |
---|
| 2689 | } |
---|
| 2690 | diff -Naur vim72.orig/src/globals.h vim72/src/globals.h |
---|
| 2691 | --- vim72.orig/src/globals.h 2008-07-26 04:53:29.000000000 -0700 |
---|
[bef6db9] | 2692 | +++ vim72/src/globals.h 2009-01-19 00:10:45.000000000 -0800 |
---|
[d25b7db] | 2693 | @@ -1022,6 +1022,7 @@ |
---|
| 2694 | #endif |
---|
| 2695 | #ifdef FEAT_AUTOCMD |
---|
| 2696 | EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */ |
---|
| 2697 | +EXTERN int autocmd_fname_full; /* autocmd_fname is full path */ |
---|
| 2698 | EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */ |
---|
| 2699 | EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */ |
---|
| 2700 | EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */ |
---|
[bef6db9] | 2701 | @@ -1339,7 +1340,6 @@ |
---|
| 2702 | |
---|
| 2703 | #ifdef FEAT_NETBEANS_INTG |
---|
| 2704 | EXTERN char *netbeansArg INIT(= NULL); /* the -nb[:host:port:passwd] arg */ |
---|
| 2705 | -EXTERN int netbeansCloseFile INIT(= 0); /* send killed if != 0 */ |
---|
| 2706 | EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */ |
---|
| 2707 | EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */ |
---|
| 2708 | EXTERN int netbeansReadFile INIT(= 1); /* OK to read from disk if != 0 */ |
---|
| 2709 | @@ -1548,6 +1548,14 @@ |
---|
[d25b7db] | 2710 | EXTERN time_t starttime; |
---|
| 2711 | |
---|
| 2712 | /* |
---|
| 2713 | + * Some compilers warn for not using a return value, but in some situations we |
---|
| 2714 | + * can't do anything useful with the value. Assign to this variable to avoid |
---|
| 2715 | + * the warning. |
---|
| 2716 | + */ |
---|
| 2717 | +EXTERN int ignored; |
---|
| 2718 | +EXTERN char *ignoredp; |
---|
| 2719 | + |
---|
| 2720 | +/* |
---|
| 2721 | * Optional Farsi support. Include it here, so EXTERN and INIT are defined. |
---|
| 2722 | */ |
---|
| 2723 | #ifdef FEAT_FKMAP |
---|
| 2724 | diff -Naur vim72.orig/src/gui.c vim72/src/gui.c |
---|
| 2725 | --- vim72.orig/src/gui.c 2008-07-27 12:32:14.000000000 -0700 |
---|
[bef6db9] | 2726 | +++ vim72/src/gui.c 2009-01-19 00:10:07.000000000 -0800 |
---|
[d25b7db] | 2727 | @@ -139,7 +139,7 @@ |
---|
| 2728 | /* The read returns when the child closes the pipe (or when |
---|
| 2729 | * the child dies for some reason). */ |
---|
| 2730 | close(pipefd[1]); |
---|
| 2731 | - (void)read(pipefd[0], &dummy, (size_t)1); |
---|
| 2732 | + ignored = (int)read(pipefd[0], &dummy, (size_t)1); |
---|
| 2733 | close(pipefd[0]); |
---|
| 2734 | } |
---|
| 2735 | |
---|
| 2736 | @@ -3241,7 +3241,7 @@ |
---|
| 2737 | i = Rows; |
---|
| 2738 | gui_update_tabline(); |
---|
| 2739 | Rows = i; |
---|
| 2740 | - need_set_size = RESIZE_VERT; |
---|
| 2741 | + need_set_size |= RESIZE_VERT; |
---|
| 2742 | if (using_tabline) |
---|
| 2743 | fix_size = TRUE; |
---|
| 2744 | if (!gui_use_tabline()) |
---|
| 2745 | @@ -3275,9 +3275,9 @@ |
---|
| 2746 | if (gui.which_scrollbars[i] != prev_which_scrollbars[i]) |
---|
| 2747 | { |
---|
| 2748 | if (i == SBAR_BOTTOM) |
---|
| 2749 | - need_set_size = RESIZE_VERT; |
---|
| 2750 | + need_set_size |= RESIZE_VERT; |
---|
| 2751 | else |
---|
| 2752 | - need_set_size = RESIZE_HOR; |
---|
| 2753 | + need_set_size |= RESIZE_HOR; |
---|
| 2754 | if (gui.which_scrollbars[i]) |
---|
| 2755 | fix_size = TRUE; |
---|
| 2756 | } |
---|
| 2757 | @@ -3297,7 +3297,7 @@ |
---|
| 2758 | gui_mch_enable_menu(gui.menu_is_active); |
---|
| 2759 | Rows = i; |
---|
| 2760 | prev_menu_is_active = gui.menu_is_active; |
---|
| 2761 | - need_set_size = RESIZE_VERT; |
---|
| 2762 | + need_set_size |= RESIZE_VERT; |
---|
| 2763 | if (gui.menu_is_active) |
---|
| 2764 | fix_size = TRUE; |
---|
| 2765 | } |
---|
| 2766 | @@ -3308,7 +3308,7 @@ |
---|
| 2767 | { |
---|
| 2768 | gui_mch_show_toolbar(using_toolbar); |
---|
| 2769 | prev_toolbar = using_toolbar; |
---|
| 2770 | - need_set_size = RESIZE_VERT; |
---|
| 2771 | + need_set_size |= RESIZE_VERT; |
---|
| 2772 | if (using_toolbar) |
---|
| 2773 | fix_size = TRUE; |
---|
| 2774 | } |
---|
| 2775 | @@ -3318,7 +3318,7 @@ |
---|
| 2776 | { |
---|
| 2777 | gui_mch_enable_footer(using_footer); |
---|
| 2778 | prev_footer = using_footer; |
---|
| 2779 | - need_set_size = RESIZE_VERT; |
---|
| 2780 | + need_set_size |= RESIZE_VERT; |
---|
| 2781 | if (using_footer) |
---|
| 2782 | fix_size = TRUE; |
---|
| 2783 | } |
---|
| 2784 | @@ -3330,10 +3330,11 @@ |
---|
| 2785 | prev_tearoff = using_tearoff; |
---|
| 2786 | } |
---|
| 2787 | #endif |
---|
| 2788 | - if (need_set_size) |
---|
| 2789 | + if (need_set_size != 0) |
---|
| 2790 | { |
---|
| 2791 | #ifdef FEAT_GUI_GTK |
---|
| 2792 | - long c = Columns; |
---|
| 2793 | + long prev_Columns = Columns; |
---|
| 2794 | + long prev_Rows = Rows; |
---|
| 2795 | #endif |
---|
| 2796 | /* Adjust the size of the window to make the text area keep the |
---|
| 2797 | * same size and to avoid that part of our window is off-screen |
---|
| 2798 | @@ -3349,11 +3350,14 @@ |
---|
| 2799 | * If you remove this, please test this command for resizing |
---|
| 2800 | * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q". |
---|
| 2801 | * Don't do this while starting up though. |
---|
| 2802 | - * And don't change Rows, it may have be reduced intentionally |
---|
| 2803 | - * when adding menu/toolbar/tabline. */ |
---|
| 2804 | - if (!gui.starting) |
---|
| 2805 | + * Don't change Rows when adding menu/toolbar/tabline. |
---|
| 2806 | + * Don't change Columns when adding vertical toolbar. */ |
---|
| 2807 | + if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR)) |
---|
| 2808 | (void)char_avail(); |
---|
| 2809 | - Columns = c; |
---|
| 2810 | + if ((need_set_size & RESIZE_VERT) == 0) |
---|
| 2811 | + Rows = prev_Rows; |
---|
| 2812 | + if ((need_set_size & RESIZE_HOR) == 0) |
---|
| 2813 | + Columns = prev_Columns; |
---|
| 2814 | #endif |
---|
| 2815 | } |
---|
| 2816 | #ifdef FEAT_WINDOWS |
---|
| 2817 | diff -Naur vim72.orig/src/gui_at_sb.c vim72/src/gui_at_sb.c |
---|
| 2818 | --- vim72.orig/src/gui_at_sb.c 2004-06-07 07:32:25.000000000 -0700 |
---|
[bef6db9] | 2819 | +++ vim72/src/gui_at_sb.c 2009-01-19 00:09:39.000000000 -0800 |
---|
[d25b7db] | 2820 | @@ -1078,6 +1078,12 @@ |
---|
| 2821 | Cardinal *num_params; /* unused */ |
---|
| 2822 | { |
---|
| 2823 | ScrollbarWidget sbw = (ScrollbarWidget)w; |
---|
| 2824 | + /* Use a union to avoid a warning for the weird conversion from float to |
---|
| 2825 | + * XtPointer. Comes from Xaw/Scrollbar.c. */ |
---|
| 2826 | + union { |
---|
| 2827 | + XtPointer xtp; |
---|
| 2828 | + float xtf; |
---|
| 2829 | + } xtpf; |
---|
| 2830 | |
---|
| 2831 | if (LookAhead(w, event)) |
---|
| 2832 | return; |
---|
| 2833 | @@ -1085,7 +1091,8 @@ |
---|
| 2834 | /* thumbProc is not pretty, but is necessary for backwards |
---|
| 2835 | compatibility on those architectures for which it work{s,ed}; |
---|
| 2836 | the intent is to pass a (truncated) float by value. */ |
---|
| 2837 | - XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top); |
---|
| 2838 | + xtpf.xtf = sbw->scrollbar.top; |
---|
| 2839 | + XtCallCallbacks(w, XtNthumbProc, xtpf.xtp); |
---|
| 2840 | XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top); |
---|
| 2841 | } |
---|
| 2842 | |
---|
| 2843 | diff -Naur vim72.orig/src/gui_gtk_x11.c vim72/src/gui_gtk_x11.c |
---|
| 2844 | --- vim72.orig/src/gui_gtk_x11.c 2008-07-04 03:46:24.000000000 -0700 |
---|
[bef6db9] | 2845 | +++ vim72/src/gui_gtk_x11.c 2009-01-19 00:09:39.000000000 -0800 |
---|
[d25b7db] | 2846 | @@ -4070,14 +4070,14 @@ |
---|
| 2847 | |
---|
| 2848 | if (mask & (XValue | YValue)) |
---|
| 2849 | { |
---|
| 2850 | - int w, h; |
---|
| 2851 | - gui_mch_get_screen_dimensions(&w, &h); |
---|
| 2852 | - h += p_ghr + get_menu_tool_height(); |
---|
| 2853 | - w += get_menu_tool_width(); |
---|
| 2854 | + int ww, hh; |
---|
| 2855 | + gui_mch_get_screen_dimensions(&ww, &hh); |
---|
| 2856 | + hh += p_ghr + get_menu_tool_height(); |
---|
| 2857 | + ww += get_menu_tool_width(); |
---|
| 2858 | if (mask & XNegative) |
---|
| 2859 | - x += w - pixel_width; |
---|
| 2860 | + x += ww - pixel_width; |
---|
| 2861 | if (mask & YNegative) |
---|
| 2862 | - y += h - pixel_height; |
---|
| 2863 | + y += hh - pixel_height; |
---|
| 2864 | #ifdef HAVE_GTK2 |
---|
| 2865 | gtk_window_move(GTK_WINDOW(gui.mainwin), x, y); |
---|
| 2866 | #else |
---|
| 2867 | diff -Naur vim72.orig/src/gui_x11.c vim72/src/gui_x11.c |
---|
| 2868 | --- vim72.orig/src/gui_x11.c 2008-06-08 08:13:45.000000000 -0700 |
---|
[bef6db9] | 2869 | +++ vim72/src/gui_x11.c 2009-01-19 00:08:42.000000000 -0800 |
---|
[d25b7db] | 2870 | @@ -2450,7 +2450,7 @@ |
---|
| 2871 | *colorPtr = colortable[closest]; |
---|
| 2872 | } |
---|
| 2873 | |
---|
| 2874 | - free(colortable); |
---|
| 2875 | + vim_free(colortable); |
---|
| 2876 | return OK; |
---|
| 2877 | } |
---|
| 2878 | |
---|
| 2879 | diff -Naur vim72.orig/src/gui_xmdlg.c vim72/src/gui_xmdlg.c |
---|
| 2880 | --- vim72.orig/src/gui_xmdlg.c 2008-06-21 09:05:32.000000000 -0700 |
---|
[bef6db9] | 2881 | +++ vim72/src/gui_xmdlg.c 2009-01-19 00:09:39.000000000 -0800 |
---|
[d25b7db] | 2882 | @@ -369,10 +369,10 @@ |
---|
| 2883 | char buf[TEMP_BUF_SIZE]; |
---|
| 2884 | XmString items[MAX_ENTRIES_IN_LIST]; |
---|
| 2885 | int i; |
---|
| 2886 | - int index; |
---|
| 2887 | + int idx; |
---|
| 2888 | |
---|
| 2889 | - for (index = (int)ENCODING; index < (int)NONE; ++index) |
---|
| 2890 | - count[index] = 0; |
---|
| 2891 | + for (idx = (int)ENCODING; idx < (int)NONE; ++idx) |
---|
| 2892 | + count[idx] = 0; |
---|
| 2893 | |
---|
| 2894 | /* First we insert the wild char into every single list. */ |
---|
| 2895 | if (fix != ENCODING) |
---|
| 2896 | @@ -503,14 +503,14 @@ |
---|
| 2897 | /* |
---|
| 2898 | * Now loop trough the remaining lists and set them up. |
---|
| 2899 | */ |
---|
| 2900 | - for (index = (int)NAME; index < (int)NONE; ++index) |
---|
| 2901 | + for (idx = (int)NAME; idx < (int)NONE; ++idx) |
---|
| 2902 | { |
---|
| 2903 | Widget w; |
---|
| 2904 | |
---|
| 2905 | - if (fix == (enum ListSpecifier)index) |
---|
| 2906 | + if (fix == (enum ListSpecifier)idx) |
---|
| 2907 | continue; |
---|
| 2908 | |
---|
| 2909 | - switch ((enum ListSpecifier)index) |
---|
| 2910 | + switch ((enum ListSpecifier)idx) |
---|
| 2911 | { |
---|
| 2912 | case NAME: |
---|
| 2913 | w = data->list[NAME]; |
---|
| 2914 | @@ -525,21 +525,21 @@ |
---|
| 2915 | w = (Widget)0; /* for lint */ |
---|
| 2916 | } |
---|
| 2917 | |
---|
| 2918 | - for (i = 0; i < count[index]; ++i) |
---|
| 2919 | + for (i = 0; i < count[idx]; ++i) |
---|
| 2920 | { |
---|
| 2921 | - items[i] = XmStringCreateLocalized(list[index][i]); |
---|
| 2922 | - XtFree(list[index][i]); |
---|
| 2923 | + items[i] = XmStringCreateLocalized(list[idx][i]); |
---|
| 2924 | + XtFree(list[idx][i]); |
---|
| 2925 | } |
---|
| 2926 | XmListDeleteAllItems(w); |
---|
| 2927 | - XmListAddItems(w, items, count[index], 1); |
---|
| 2928 | - if (data->sel[index]) |
---|
| 2929 | + XmListAddItems(w, items, count[idx], 1); |
---|
| 2930 | + if (data->sel[idx]) |
---|
| 2931 | { |
---|
| 2932 | XmStringFree(items[0]); |
---|
| 2933 | - items[0] = XmStringCreateLocalized(data->sel[index]); |
---|
| 2934 | + items[0] = XmStringCreateLocalized(data->sel[idx]); |
---|
| 2935 | XmListSelectItem(w, items[0], False); |
---|
| 2936 | XmListSetBottomItem(w, items[0]); |
---|
| 2937 | } |
---|
| 2938 | - for (i = 0; i < count[index]; ++i) |
---|
| 2939 | + for (i = 0; i < count[idx]; ++i) |
---|
| 2940 | XmStringFree(items[i]); |
---|
| 2941 | } |
---|
| 2942 | } |
---|
| 2943 | @@ -695,14 +695,14 @@ |
---|
| 2944 | int n; |
---|
| 2945 | XmString str; |
---|
| 2946 | Arg args[4]; |
---|
| 2947 | - char *msg = _("no specific match"); |
---|
| 2948 | + char *nomatch_msg = _("no specific match"); |
---|
| 2949 | |
---|
| 2950 | n = 0; |
---|
| 2951 | - str = XmStringCreateLocalized(msg); |
---|
| 2952 | + str = XmStringCreateLocalized(nomatch_msg); |
---|
| 2953 | XtSetArg(args[n], XmNlabelString, str); ++n; |
---|
| 2954 | XtSetValues(data->sample, args, n); |
---|
| 2955 | apply_fontlist(data->sample); |
---|
| 2956 | - XmTextSetString(data->name, msg); |
---|
| 2957 | + XmTextSetString(data->name, nomatch_msg); |
---|
| 2958 | XmStringFree(str); |
---|
| 2959 | |
---|
| 2960 | return False; |
---|
| 2961 | @@ -886,21 +886,21 @@ |
---|
| 2962 | { |
---|
| 2963 | int i; |
---|
| 2964 | int max; |
---|
| 2965 | - int index = 0; |
---|
| 2966 | + int idx = 0; |
---|
| 2967 | int size; |
---|
| 2968 | - char str[128]; |
---|
| 2969 | + char buf[128]; |
---|
| 2970 | |
---|
| 2971 | for (i = 0, max = 0; i < data->num; i++) |
---|
| 2972 | { |
---|
| 2973 | - get_part(fn(data, i), 7, str); |
---|
| 2974 | - size = atoi(str); |
---|
| 2975 | + get_part(fn(data, i), 7, buf); |
---|
| 2976 | + size = atoi(buf); |
---|
| 2977 | if ((size > max) && (size < MAX_DISPLAY_SIZE)) |
---|
| 2978 | { |
---|
| 2979 | - index = i; |
---|
| 2980 | + idx = i; |
---|
| 2981 | max = size; |
---|
| 2982 | } |
---|
| 2983 | } |
---|
| 2984 | - strcpy(big_font, fn(data, index)); |
---|
| 2985 | + strcpy(big_font, fn(data, idx)); |
---|
| 2986 | } |
---|
| 2987 | data->old = XLoadQueryFont(XtDisplay(parent), big_font); |
---|
| 2988 | data->old_list = gui_motif_create_fontlist(data->old); |
---|
| 2989 | @@ -1217,28 +1217,28 @@ |
---|
| 2990 | |
---|
| 2991 | if (i != 0) |
---|
| 2992 | { |
---|
| 2993 | - char name[TEMP_BUF_SIZE]; |
---|
| 2994 | - char style[TEMP_BUF_SIZE]; |
---|
| 2995 | - char size[TEMP_BUF_SIZE]; |
---|
| 2996 | - char encoding[TEMP_BUF_SIZE]; |
---|
| 2997 | + char namebuf[TEMP_BUF_SIZE]; |
---|
| 2998 | + char stylebuf[TEMP_BUF_SIZE]; |
---|
| 2999 | + char sizebuf[TEMP_BUF_SIZE]; |
---|
| 3000 | + char encodingbuf[TEMP_BUF_SIZE]; |
---|
| 3001 | char *found; |
---|
| 3002 | |
---|
| 3003 | found = names[0]; |
---|
| 3004 | |
---|
| 3005 | - name_part(found, name); |
---|
| 3006 | - style_part(found, style); |
---|
| 3007 | - size_part(found, size, data->in_pixels); |
---|
| 3008 | - encoding_part(found, encoding); |
---|
| 3009 | - |
---|
| 3010 | - if (strlen(name) > 0 |
---|
| 3011 | - && strlen(style) > 0 |
---|
| 3012 | - && strlen(size) > 0 |
---|
| 3013 | - && strlen(encoding) > 0) |
---|
| 3014 | + name_part(found, namebuf); |
---|
| 3015 | + style_part(found, stylebuf); |
---|
| 3016 | + size_part(found, sizebuf, data->in_pixels); |
---|
| 3017 | + encoding_part(found, encodingbuf); |
---|
| 3018 | + |
---|
| 3019 | + if (strlen(namebuf) > 0 |
---|
| 3020 | + && strlen(stylebuf) > 0 |
---|
| 3021 | + && strlen(sizebuf) > 0 |
---|
| 3022 | + && strlen(encodingbuf) > 0) |
---|
| 3023 | { |
---|
| 3024 | - data->sel[NAME] = XtNewString(name); |
---|
| 3025 | - data->sel[STYLE] = XtNewString(style); |
---|
| 3026 | - data->sel[SIZE] = XtNewString(size); |
---|
| 3027 | - data->sel[ENCODING] = XtNewString(encoding); |
---|
| 3028 | + data->sel[NAME] = XtNewString(namebuf); |
---|
| 3029 | + data->sel[STYLE] = XtNewString(stylebuf); |
---|
| 3030 | + data->sel[SIZE] = XtNewString(sizebuf); |
---|
| 3031 | + data->sel[ENCODING] = XtNewString(encodingbuf); |
---|
| 3032 | data->font_name = XtNewString(names[0]); |
---|
| 3033 | display_sample(data); |
---|
| 3034 | XmTextSetString(data->name, data->font_name); |
---|
| 3035 | diff -Naur vim72.orig/src/gui_xmebw.c vim72/src/gui_xmebw.c |
---|
| 3036 | --- vim72.orig/src/gui_xmebw.c 2007-09-06 03:57:51.000000000 -0700 |
---|
[bef6db9] | 3037 | +++ vim72/src/gui_xmebw.c 2009-01-19 00:09:39.000000000 -0800 |
---|
[d25b7db] | 3038 | @@ -1256,7 +1256,7 @@ |
---|
| 3039 | } |
---|
| 3040 | else |
---|
| 3041 | { |
---|
| 3042 | - int adjust = 0; |
---|
| 3043 | + adjust = 0; |
---|
| 3044 | |
---|
| 3045 | #if !defined(LESSTIF_VERSION) && (XmVersion > 1002) |
---|
| 3046 | /* |
---|
| 3047 | @@ -1268,12 +1268,11 @@ |
---|
| 3048 | { |
---|
| 3049 | case XmEXTERNAL_HIGHLIGHT: |
---|
| 3050 | adjust = (eb->primitive.highlight_thickness - |
---|
| 3051 | - (eb->pushbutton.default_button_shadow_thickness ? |
---|
| 3052 | - Xm3D_ENHANCE_PIXEL : 0)); |
---|
| 3053 | + (eb->pushbutton.default_button_shadow_thickness |
---|
| 3054 | + ? Xm3D_ENHANCE_PIXEL : 0)); |
---|
| 3055 | break; |
---|
| 3056 | |
---|
| 3057 | case XmINTERNAL_HIGHLIGHT: |
---|
| 3058 | - adjust = 0; |
---|
| 3059 | break; |
---|
| 3060 | |
---|
| 3061 | default: |
---|
| 3062 | diff -Naur vim72.orig/src/if_cscope.c vim72/src/if_cscope.c |
---|
| 3063 | --- vim72.orig/src/if_cscope.c 2008-06-24 09:32:34.000000000 -0700 |
---|
[bef6db9] | 3064 | +++ vim72/src/if_cscope.c 2009-01-19 00:07:11.000000000 -0800 |
---|
[d25b7db] | 3065 | @@ -74,7 +74,7 @@ |
---|
| 3066 | { "add", cs_add, |
---|
| 3067 | N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 }, |
---|
| 3068 | { "find", cs_find, |
---|
| 3069 | - N_("Query for a pattern"), FIND_USAGE, 1 }, |
---|
| 3070 | + N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 }, |
---|
| 3071 | { "help", cs_help, |
---|
| 3072 | N_("Show this message"), "help", 0 }, |
---|
| 3073 | { "kill", cs_kill, |
---|
| 3074 | @@ -1180,7 +1180,16 @@ |
---|
| 3075 | (void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"), |
---|
| 3076 | cmdp->name, _(cmdp->help), cmdp->usage); |
---|
| 3077 | if (strcmp(cmdp->name, "find") == 0) |
---|
| 3078 | - MSG_PUTS(FIND_HELP); |
---|
| 3079 | + MSG_PUTS(_("\n" |
---|
| 3080 | + " c: Find functions calling this function\n" |
---|
| 3081 | + " d: Find functions called by this function\n" |
---|
| 3082 | + " e: Find this egrep pattern\n" |
---|
| 3083 | + " f: Find this file\n" |
---|
| 3084 | + " g: Find this definition\n" |
---|
| 3085 | + " i: Find files #including this file\n" |
---|
| 3086 | + " s: Find this C symbol\n" |
---|
| 3087 | + " t: Find assignments to\n")); |
---|
| 3088 | + |
---|
| 3089 | cmdp++; |
---|
| 3090 | } |
---|
| 3091 | |
---|
| 3092 | diff -Naur vim72.orig/src/if_cscope.h vim72/src/if_cscope.h |
---|
| 3093 | --- vim72.orig/src/if_cscope.h 2007-09-02 07:51:08.000000000 -0700 |
---|
[bef6db9] | 3094 | +++ vim72/src/if_cscope.h 2009-01-19 00:07:11.000000000 -0800 |
---|
[d25b7db] | 3095 | @@ -42,17 +42,6 @@ |
---|
| 3096 | * f 7name Find this file |
---|
| 3097 | * i 8name Find files #including this file |
---|
| 3098 | */ |
---|
| 3099 | -#define FIND_USAGE "find c|d|e|f|g|i|s|t name" |
---|
| 3100 | -#define FIND_HELP "\n\ |
---|
| 3101 | - c: Find functions calling this function\n\ |
---|
| 3102 | - d: Find functions called by this function\n\ |
---|
| 3103 | - e: Find this egrep pattern\n\ |
---|
| 3104 | - f: Find this file\n\ |
---|
| 3105 | - g: Find this definition\n\ |
---|
| 3106 | - i: Find files #including this file\n\ |
---|
| 3107 | - s: Find this C symbol\n\ |
---|
| 3108 | - t: Find assignments to\n" |
---|
| 3109 | - |
---|
| 3110 | |
---|
| 3111 | typedef struct { |
---|
| 3112 | char * name; |
---|
| 3113 | diff -Naur vim72.orig/src/if_perl.xs vim72/src/if_perl.xs |
---|
| 3114 | --- vim72.orig/src/if_perl.xs 2008-07-17 13:55:09.000000000 -0700 |
---|
[bef6db9] | 3115 | +++ vim72/src/if_perl.xs 2009-01-19 00:10:02.000000000 -0800 |
---|
[d25b7db] | 3116 | @@ -136,6 +136,9 @@ |
---|
| 3117 | # define Perl_newXS_flags dll_Perl_newXS_flags |
---|
| 3118 | #endif |
---|
| 3119 | # define Perl_sv_free dll_Perl_sv_free |
---|
| 3120 | +# if (PERL_REVISION == 5) && (PERL_VERSION >= 10) |
---|
| 3121 | +# define Perl_sv_free2 dll_Perl_sv_free2 |
---|
| 3122 | +# endif |
---|
| 3123 | # define Perl_sv_isa dll_Perl_sv_isa |
---|
| 3124 | # define Perl_sv_magic dll_Perl_sv_magic |
---|
| 3125 | # define Perl_sv_setiv dll_Perl_sv_setiv |
---|
| 3126 | @@ -163,7 +166,7 @@ |
---|
| 3127 | # define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr |
---|
| 3128 | # define boot_DynaLoader dll_boot_DynaLoader |
---|
| 3129 | |
---|
| 3130 | -# define Perl_sys_init3 dll_Perl_sys_init3 |
---|
| 3131 | +# define Perl_sys_init dll_Perl_sys_init |
---|
| 3132 | # define Perl_sys_term dll_Perl_sys_term |
---|
| 3133 | # define Perl_ISv_ptr dll_Perl_ISv_ptr |
---|
| 3134 | # define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr |
---|
| 3135 | @@ -268,7 +271,8 @@ |
---|
| 3136 | static void (*boot_DynaLoader)_((pTHX_ CV*)); |
---|
| 3137 | |
---|
| 3138 | #if (PERL_REVISION == 5) && (PERL_VERSION >= 10) |
---|
| 3139 | -static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env); |
---|
| 3140 | +static void (*Perl_sv_free2)(pTHX_ SV*); |
---|
| 3141 | +static void (*Perl_sys_init)(int* argc, char*** argv); |
---|
| 3142 | static void (*Perl_sys_term)(void); |
---|
| 3143 | static SV** (*Perl_ISv_ptr)(register PerlInterpreter*); |
---|
| 3144 | static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*); |
---|
| 3145 | @@ -367,7 +371,8 @@ |
---|
| 3146 | {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr}, |
---|
| 3147 | {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr}, |
---|
| 3148 | #else |
---|
| 3149 | - {"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3}, |
---|
| 3150 | + {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2}, |
---|
| 3151 | + {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init}, |
---|
| 3152 | {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term}, |
---|
| 3153 | {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr}, |
---|
| 3154 | {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr}, |
---|
| 3155 | @@ -455,7 +460,7 @@ |
---|
| 3156 | static char *argv[] = { "", "-e", "" }; |
---|
| 3157 | |
---|
| 3158 | #if (PERL_REVISION == 5) && (PERL_VERSION >= 10) |
---|
| 3159 | - Perl_sys_init3(&argc, (char***)&argv, NULL); |
---|
| 3160 | + Perl_sys_init(&argc, (char***)&argv); |
---|
| 3161 | #endif |
---|
| 3162 | perl_interp = perl_alloc(); |
---|
| 3163 | perl_construct(perl_interp); |
---|
| 3164 | diff -Naur vim72.orig/src/if_python.c vim72/src/if_python.c |
---|
| 3165 | --- vim72.orig/src/if_python.c 2008-07-17 14:09:32.000000000 -0700 |
---|
[bef6db9] | 3166 | +++ vim72/src/if_python.c 2009-01-19 00:10:59.000000000 -0800 |
---|
[d25b7db] | 3167 | @@ -531,6 +531,12 @@ |
---|
| 3168 | if (PythonMod_Init()) |
---|
| 3169 | goto fail; |
---|
| 3170 | |
---|
| 3171 | + /* Remove the element from sys.path that was added because of our |
---|
| 3172 | + * argv[0] value in PythonMod_Init(). Previously we used an empty |
---|
| 3173 | + * string, but dependinding on the OS we then get an empty entry or |
---|
| 3174 | + * the current directory in sys.path. */ |
---|
| 3175 | + PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)"); |
---|
| 3176 | + |
---|
| 3177 | /* the first python thread is vim's, release the lock */ |
---|
| 3178 | Python_SaveThread(); |
---|
| 3179 | |
---|
[bef6db9] | 3180 | @@ -1145,14 +1151,23 @@ |
---|
| 3181 | |
---|
| 3182 | /* Check if we run into a recursive loop. The item must be in lookupDict |
---|
| 3183 | * then and we can use it again. */ |
---|
| 3184 | - sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv); |
---|
| 3185 | - result = PyDict_GetItemString(lookupDict, ptrBuf); |
---|
| 3186 | - if (result != NULL) |
---|
| 3187 | - Py_INCREF(result); |
---|
| 3188 | - else if (our_tv->v_type == VAR_STRING) |
---|
| 3189 | + if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL) |
---|
| 3190 | + || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL)) |
---|
| 3191 | + { |
---|
| 3192 | + sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, |
---|
| 3193 | + our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list |
---|
| 3194 | + : (long_u)our_tv->vval.v_dict); |
---|
| 3195 | + result = PyDict_GetItemString(lookupDict, ptrBuf); |
---|
| 3196 | + if (result != NULL) |
---|
| 3197 | + { |
---|
| 3198 | + Py_INCREF(result); |
---|
| 3199 | + return result; |
---|
| 3200 | + } |
---|
| 3201 | + } |
---|
| 3202 | + |
---|
| 3203 | + if (our_tv->v_type == VAR_STRING) |
---|
| 3204 | { |
---|
| 3205 | result = Py_BuildValue("s", our_tv->vval.v_string); |
---|
| 3206 | - PyDict_SetItemString(lookupDict, ptrBuf, result); |
---|
| 3207 | } |
---|
| 3208 | else if (our_tv->v_type == VAR_NUMBER) |
---|
| 3209 | { |
---|
| 3210 | @@ -1161,7 +1176,6 @@ |
---|
| 3211 | /* For backwards compatibility numbers are stored as strings. */ |
---|
| 3212 | sprintf(buf, "%ld", (long)our_tv->vval.v_number); |
---|
| 3213 | result = Py_BuildValue("s", buf); |
---|
| 3214 | - PyDict_SetItemString(lookupDict, ptrBuf, result); |
---|
| 3215 | } |
---|
| 3216 | # ifdef FEAT_FLOAT |
---|
| 3217 | else if (our_tv->v_type == VAR_FLOAT) |
---|
| 3218 | @@ -1170,7 +1184,6 @@ |
---|
| 3219 | |
---|
| 3220 | sprintf(buf, "%f", our_tv->vval.v_float); |
---|
| 3221 | result = Py_BuildValue("s", buf); |
---|
| 3222 | - PyDict_SetItemString(lookupDict, ptrBuf, result); |
---|
| 3223 | } |
---|
| 3224 | # endif |
---|
| 3225 | else if (our_tv->v_type == VAR_LIST) |
---|
| 3226 | @@ -1179,10 +1192,11 @@ |
---|
| 3227 | listitem_T *curr; |
---|
| 3228 | |
---|
| 3229 | result = PyList_New(0); |
---|
| 3230 | - PyDict_SetItemString(lookupDict, ptrBuf, result); |
---|
| 3231 | |
---|
| 3232 | if (list != NULL) |
---|
| 3233 | { |
---|
| 3234 | + PyDict_SetItemString(lookupDict, ptrBuf, result); |
---|
| 3235 | + |
---|
| 3236 | for (curr = list->lv_first; curr != NULL; curr = curr->li_next) |
---|
| 3237 | { |
---|
| 3238 | newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict); |
---|
| 3239 | @@ -1194,7 +1208,6 @@ |
---|
| 3240 | else if (our_tv->v_type == VAR_DICT) |
---|
| 3241 | { |
---|
| 3242 | result = PyDict_New(); |
---|
| 3243 | - PyDict_SetItemString(lookupDict, ptrBuf, result); |
---|
| 3244 | |
---|
| 3245 | if (our_tv->vval.v_dict != NULL) |
---|
| 3246 | { |
---|
| 3247 | @@ -1203,6 +1216,8 @@ |
---|
| 3248 | hashitem_T *hi; |
---|
| 3249 | dictitem_T *di; |
---|
| 3250 | |
---|
| 3251 | + PyDict_SetItemString(lookupDict, ptrBuf, result); |
---|
| 3252 | + |
---|
| 3253 | for (hi = ht->ht_array; todo > 0; ++hi) |
---|
| 3254 | { |
---|
| 3255 | if (!HASHITEM_EMPTY(hi)) |
---|
| 3256 | @@ -2345,7 +2360,8 @@ |
---|
[d25b7db] | 3257 | { |
---|
| 3258 | PyObject *mod; |
---|
| 3259 | PyObject *dict; |
---|
| 3260 | - static char *(argv[2]) = {"", NULL}; |
---|
| 3261 | + /* The special value is removed from sys.path in Python_Init(). */ |
---|
| 3262 | + static char *(argv[2]) = {"/must>not&exist/foo", NULL}; |
---|
| 3263 | |
---|
| 3264 | /* Fixups... */ |
---|
| 3265 | BufferType.ob_type = &PyType_Type; |
---|
| 3266 | diff -Naur vim72.orig/src/if_xcmdsrv.c vim72/src/if_xcmdsrv.c |
---|
| 3267 | --- vim72.orig/src/if_xcmdsrv.c 2008-07-18 06:05:03.000000000 -0700 |
---|
[bef6db9] | 3268 | +++ vim72/src/if_xcmdsrv.c 2009-01-19 00:08:50.000000000 -0800 |
---|
[d25b7db] | 3269 | @@ -736,7 +736,7 @@ |
---|
| 3270 | + serverReply.ga_len; |
---|
| 3271 | e.id = w; |
---|
| 3272 | ga_init2(&e.strings, 1, 100); |
---|
| 3273 | - memcpy(p, &e, sizeof(e)); |
---|
| 3274 | + mch_memmove(p, &e, sizeof(e)); |
---|
| 3275 | serverReply.ga_len++; |
---|
| 3276 | } |
---|
| 3277 | } |
---|
| 3278 | @@ -1018,7 +1018,7 @@ |
---|
| 3279 | p++; |
---|
| 3280 | count = numItems - (p - regProp); |
---|
| 3281 | if (count > 0) |
---|
| 3282 | - memcpy(entry, p, count); |
---|
| 3283 | + mch_memmove(entry, p, count); |
---|
| 3284 | XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING, |
---|
| 3285 | 8, PropModeReplace, regProp, |
---|
| 3286 | (int)(numItems - (p - entry))); |
---|
| 3287 | @@ -1072,7 +1072,7 @@ |
---|
| 3288 | p++; |
---|
| 3289 | lastHalf = numItems - (p - regProp); |
---|
| 3290 | if (lastHalf > 0) |
---|
| 3291 | - memcpy(entry, p, lastHalf); |
---|
| 3292 | + mch_memmove(entry, p, lastHalf); |
---|
| 3293 | numItems = (entry - regProp) + lastHalf; |
---|
| 3294 | p = entry; |
---|
| 3295 | continue; |
---|
| 3296 | diff -Naur vim72.orig/src/main.c vim72/src/main.c |
---|
| 3297 | --- vim72.orig/src/main.c 2008-07-24 01:40:56.000000000 -0700 |
---|
[bef6db9] | 3298 | +++ vim72/src/main.c 2009-01-19 00:09:39.000000000 -0800 |
---|
[d25b7db] | 3299 | @@ -645,11 +645,12 @@ |
---|
| 3300 | |
---|
| 3301 | #ifdef FEAT_VIMINFO |
---|
| 3302 | /* |
---|
| 3303 | - * Read in registers, history etc, but not marks, from the viminfo file |
---|
| 3304 | + * Read in registers, history etc, but not marks, from the viminfo file. |
---|
| 3305 | + * This is where v:oldfiles gets filled. |
---|
| 3306 | */ |
---|
| 3307 | if (*p_viminfo != NUL) |
---|
| 3308 | { |
---|
| 3309 | - read_viminfo(NULL, TRUE, FALSE, FALSE); |
---|
| 3310 | + read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES); |
---|
| 3311 | TIME_MSG("reading viminfo"); |
---|
| 3312 | } |
---|
| 3313 | #endif |
---|
| 3314 | @@ -1457,7 +1458,8 @@ |
---|
| 3315 | ++initstr; |
---|
| 3316 | } |
---|
| 3317 | |
---|
| 3318 | - if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k') |
---|
| 3319 | + /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */ |
---|
| 3320 | + if (TOLOWER_ASC(initstr[0]) == 'g') |
---|
| 3321 | { |
---|
| 3322 | main_start_gui(); |
---|
| 3323 | #ifdef FEAT_GUI |
---|
| 3324 | @@ -1508,7 +1510,8 @@ |
---|
| 3325 | early_arg_scan(parmp) |
---|
| 3326 | mparm_T *parmp; |
---|
| 3327 | { |
---|
| 3328 | -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) |
---|
| 3329 | +#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \ |
---|
| 3330 | + || !defined(FEAT_NETBEANS_INTG) |
---|
| 3331 | int argc = parmp->argc; |
---|
| 3332 | char **argv = parmp->argv; |
---|
| 3333 | int i; |
---|
| 3334 | @@ -1580,6 +1583,14 @@ |
---|
| 3335 | else if (STRICMP(argv[i], "--echo-wid") == 0) |
---|
| 3336 | echo_wid_arg = TRUE; |
---|
| 3337 | # endif |
---|
| 3338 | +# ifndef FEAT_NETBEANS_INTG |
---|
| 3339 | + else if (strncmp(argv[i], "-nb", (size_t)3) == 0) |
---|
| 3340 | + { |
---|
| 3341 | + mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n")); |
---|
| 3342 | + mch_exit(2); |
---|
| 3343 | + } |
---|
| 3344 | +# endif |
---|
| 3345 | + |
---|
| 3346 | } |
---|
| 3347 | #endif |
---|
| 3348 | } |
---|
| 3349 | @@ -2361,7 +2372,7 @@ |
---|
| 3350 | * Is there any other system that cannot do this? |
---|
| 3351 | */ |
---|
| 3352 | close(0); |
---|
| 3353 | - dup(2); |
---|
| 3354 | + ignored = dup(2); |
---|
| 3355 | #endif |
---|
| 3356 | } |
---|
| 3357 | |
---|
| 3358 | diff -Naur vim72.orig/src/mark.c vim72/src/mark.c |
---|
| 3359 | --- vim72.orig/src/mark.c 2008-08-08 15:06:49.000000000 -0700 |
---|
[bef6db9] | 3360 | +++ vim72/src/mark.c 2009-01-19 00:08:31.000000000 -0800 |
---|
[d25b7db] | 3361 | @@ -1627,15 +1627,17 @@ |
---|
| 3362 | |
---|
| 3363 | /* |
---|
| 3364 | * Handle marks in the viminfo file: |
---|
| 3365 | - * fp_out == NULL read marks for current buffer only |
---|
| 3366 | - * fp_out != NULL copy marks for buffers not in buffer list |
---|
| 3367 | + * fp_out != NULL: copy marks for buffers not in buffer list |
---|
| 3368 | + * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only |
---|
| 3369 | + * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles |
---|
| 3370 | */ |
---|
| 3371 | void |
---|
| 3372 | -copy_viminfo_marks(virp, fp_out, count, eof) |
---|
| 3373 | +copy_viminfo_marks(virp, fp_out, count, eof, flags) |
---|
| 3374 | vir_T *virp; |
---|
| 3375 | FILE *fp_out; |
---|
| 3376 | int count; |
---|
| 3377 | int eof; |
---|
| 3378 | + int flags; |
---|
| 3379 | { |
---|
| 3380 | char_u *line = virp->vir_line; |
---|
| 3381 | buf_T *buf; |
---|
| 3382 | @@ -1647,10 +1649,23 @@ |
---|
| 3383 | char_u *p; |
---|
| 3384 | char_u *name_buf; |
---|
| 3385 | pos_T pos; |
---|
| 3386 | +#ifdef FEAT_EVAL |
---|
| 3387 | + list_T *list = NULL; |
---|
| 3388 | +#endif |
---|
| 3389 | |
---|
| 3390 | if ((name_buf = alloc(LSIZE)) == NULL) |
---|
| 3391 | return; |
---|
| 3392 | *name_buf = NUL; |
---|
| 3393 | + |
---|
| 3394 | +#ifdef FEAT_EVAL |
---|
| 3395 | + if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT))) |
---|
| 3396 | + { |
---|
| 3397 | + list = list_alloc(); |
---|
| 3398 | + if (list != NULL) |
---|
| 3399 | + set_vim_var_list(VV_OLDFILES, list); |
---|
| 3400 | + } |
---|
| 3401 | +#endif |
---|
| 3402 | + |
---|
| 3403 | num_marked_files = get_viminfo_parameter('\''); |
---|
| 3404 | while (!eof && (count < num_marked_files || fp_out == NULL)) |
---|
| 3405 | { |
---|
| 3406 | @@ -1681,6 +1696,11 @@ |
---|
| 3407 | p++; |
---|
| 3408 | *p = NUL; |
---|
| 3409 | |
---|
| 3410 | +#ifdef FEAT_EVAL |
---|
| 3411 | + if (list != NULL) |
---|
| 3412 | + list_append_string(list, str, -1); |
---|
| 3413 | +#endif |
---|
| 3414 | + |
---|
| 3415 | /* |
---|
| 3416 | * If fp_out == NULL, load marks for current buffer. |
---|
| 3417 | * If fp_out != NULL, copy marks for buffers not in buflist. |
---|
| 3418 | @@ -1688,7 +1708,7 @@ |
---|
| 3419 | load_marks = copy_marks_out = FALSE; |
---|
| 3420 | if (fp_out == NULL) |
---|
| 3421 | { |
---|
| 3422 | - if (curbuf->b_ffname != NULL) |
---|
| 3423 | + if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL) |
---|
| 3424 | { |
---|
| 3425 | if (*name_buf == NUL) /* only need to do this once */ |
---|
| 3426 | home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE); |
---|
| 3427 | diff -Naur vim72.orig/src/mbyte.c vim72/src/mbyte.c |
---|
| 3428 | --- vim72.orig/src/mbyte.c 2008-07-14 05:38:05.000000000 -0700 |
---|
[bef6db9] | 3429 | +++ vim72/src/mbyte.c 2009-01-19 00:09:39.000000000 -0800 |
---|
[d25b7db] | 3430 | @@ -717,7 +717,7 @@ |
---|
| 3431 | * where mblen() returns 0 for invalid character. |
---|
| 3432 | * Therefore, following condition includes 0. |
---|
| 3433 | */ |
---|
| 3434 | - (void)mblen(NULL, 0); /* First reset the state. */ |
---|
| 3435 | + ignored = mblen(NULL, 0); /* First reset the state. */ |
---|
| 3436 | if (mblen(buf, (size_t)1) <= 0) |
---|
| 3437 | n = 2; |
---|
| 3438 | else |
---|
| 3439 | @@ -2540,7 +2540,6 @@ |
---|
| 3440 | return (int)(p - q); |
---|
| 3441 | } |
---|
| 3442 | |
---|
| 3443 | -#if defined(FEAT_EVAL) || defined(PROTO) |
---|
| 3444 | /* |
---|
| 3445 | * Copy a character from "*fp" to "*tp" and advance the pointers. |
---|
| 3446 | */ |
---|
| 3447 | @@ -2555,7 +2554,6 @@ |
---|
| 3448 | *tp += l; |
---|
| 3449 | *fp += l; |
---|
| 3450 | } |
---|
| 3451 | -#endif |
---|
| 3452 | |
---|
| 3453 | /* |
---|
| 3454 | * Return the offset from "p" to the first byte of a character. When "p" is |
---|
| 3455 | @@ -3133,7 +3131,7 @@ |
---|
| 3456 | else |
---|
| 3457 | s = p + 1; |
---|
| 3458 | } |
---|
| 3459 | - for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i) |
---|
| 3460 | + for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i) |
---|
| 3461 | { |
---|
| 3462 | if (s[i] == '_' || s[i] == '-') |
---|
| 3463 | buf[i] = '-'; |
---|
| 3464 | @@ -5280,7 +5278,7 @@ |
---|
| 3465 | |
---|
| 3466 | /*ARGSUSED*/ |
---|
| 3467 | static void |
---|
| 3468 | -preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data) |
---|
| 3469 | +preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data) |
---|
| 3470 | { |
---|
| 3471 | #ifdef XIM_DEBUG |
---|
| 3472 | xim_log("xim_decide_input_style()\n"); |
---|
| 3473 | @@ -5314,7 +5312,7 @@ |
---|
| 3474 | |
---|
| 3475 | /*ARGSUSED*/ |
---|
| 3476 | static void |
---|
| 3477 | -preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data) |
---|
| 3478 | +preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data) |
---|
| 3479 | { |
---|
| 3480 | XIMPreeditDrawCallbackStruct *draw_data; |
---|
| 3481 | XIMText *text; |
---|
| 3482 | @@ -5386,7 +5384,7 @@ |
---|
| 3483 | draw_feedback = (char *)alloc(draw_data->chg_first |
---|
| 3484 | + text->length); |
---|
| 3485 | else |
---|
| 3486 | - draw_feedback = realloc(draw_feedback, |
---|
| 3487 | + draw_feedback = vim_realloc(draw_feedback, |
---|
| 3488 | draw_data->chg_first + text->length); |
---|
| 3489 | if (draw_feedback != NULL) |
---|
| 3490 | { |
---|
| 3491 | @@ -5455,7 +5453,7 @@ |
---|
| 3492 | |
---|
| 3493 | /*ARGSUSED*/ |
---|
| 3494 | static void |
---|
| 3495 | -preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data) |
---|
| 3496 | +preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data) |
---|
| 3497 | { |
---|
| 3498 | #ifdef XIM_DEBUG |
---|
| 3499 | xim_log("preedit_caret_cbproc()\n"); |
---|
| 3500 | @@ -5464,7 +5462,7 @@ |
---|
| 3501 | |
---|
| 3502 | /*ARGSUSED*/ |
---|
| 3503 | static void |
---|
| 3504 | -preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data) |
---|
| 3505 | +preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data) |
---|
| 3506 | { |
---|
| 3507 | #ifdef XIM_DEBUG |
---|
| 3508 | xim_log("preedit_done_cbproc()\n"); |
---|
| 3509 | diff -Naur vim72.orig/src/menu.c vim72/src/menu.c |
---|
| 3510 | --- vim72.orig/src/menu.c 2008-06-21 12:53:43.000000000 -0700 |
---|
[bef6db9] | 3511 | +++ vim72/src/menu.c 2009-01-19 00:07:05.000000000 -0800 |
---|
[d25b7db] | 3512 | @@ -1120,6 +1120,7 @@ |
---|
| 3513 | parent = menu; |
---|
| 3514 | menu = menu->children; |
---|
| 3515 | } |
---|
| 3516 | + vim_free(path_name); |
---|
| 3517 | |
---|
| 3518 | /* Now we have found the matching menu, and we list the mappings */ |
---|
| 3519 | /* Highlight title */ |
---|
| 3520 | diff -Naur vim72.orig/src/message.c vim72/src/message.c |
---|
| 3521 | --- vim72.orig/src/message.c 2008-07-09 11:24:55.000000000 -0700 |
---|
[bef6db9] | 3522 | +++ vim72/src/message.c 2009-01-19 00:10:51.000000000 -0800 |
---|
| 3523 | @@ -4556,7 +4556,13 @@ |
---|
| 3524 | remove_trailing_zeroes = TRUE; |
---|
| 3525 | } |
---|
| 3526 | |
---|
| 3527 | - if (fmt_spec == 'f' && abs_f > 1.0e307) |
---|
| 3528 | + if (fmt_spec == 'f' && |
---|
| 3529 | +#ifdef VAX |
---|
| 3530 | + abs_f > 1.0e38 |
---|
| 3531 | +#else |
---|
| 3532 | + abs_f > 1.0e307 |
---|
| 3533 | +#endif |
---|
| 3534 | + ) |
---|
| 3535 | { |
---|
| 3536 | /* Avoid a buffer overflow */ |
---|
| 3537 | strcpy(tmp, "inf"); |
---|
| 3538 | @@ -4585,61 +4591,62 @@ |
---|
[d25b7db] | 3539 | if (remove_trailing_zeroes) |
---|
| 3540 | { |
---|
| 3541 | int i; |
---|
| 3542 | - char *p; |
---|
| 3543 | + char *tp; |
---|
| 3544 | |
---|
| 3545 | /* Using %g or %G: remove superfluous zeroes. */ |
---|
| 3546 | if (fmt_spec == 'f') |
---|
| 3547 | - p = tmp + str_arg_l - 1; |
---|
| 3548 | + tp = tmp + str_arg_l - 1; |
---|
| 3549 | else |
---|
| 3550 | { |
---|
| 3551 | - p = (char *)vim_strchr((char_u *)tmp, |
---|
| 3552 | + tp = (char *)vim_strchr((char_u *)tmp, |
---|
| 3553 | fmt_spec == 'e' ? 'e' : 'E'); |
---|
| 3554 | - if (p != NULL) |
---|
| 3555 | + if (tp != NULL) |
---|
| 3556 | { |
---|
| 3557 | /* Remove superfluous '+' and leading |
---|
| 3558 | * zeroes from the exponent. */ |
---|
| 3559 | - if (p[1] == '+') |
---|
| 3560 | + if (tp[1] == '+') |
---|
| 3561 | { |
---|
| 3562 | /* Change "1.0e+07" to "1.0e07" */ |
---|
| 3563 | - STRMOVE(p + 1, p + 2); |
---|
| 3564 | + STRMOVE(tp + 1, tp + 2); |
---|
| 3565 | --str_arg_l; |
---|
| 3566 | } |
---|
| 3567 | - i = (p[1] == '-') ? 2 : 1; |
---|
| 3568 | - while (p[i] == '0') |
---|
| 3569 | + i = (tp[1] == '-') ? 2 : 1; |
---|
| 3570 | + while (tp[i] == '0') |
---|
| 3571 | { |
---|
| 3572 | /* Change "1.0e07" to "1.0e7" */ |
---|
| 3573 | - STRMOVE(p + i, p + i + 1); |
---|
| 3574 | + STRMOVE(tp + i, tp + i + 1); |
---|
| 3575 | --str_arg_l; |
---|
| 3576 | } |
---|
| 3577 | - --p; |
---|
| 3578 | + --tp; |
---|
| 3579 | } |
---|
| 3580 | } |
---|
| 3581 | |
---|
| 3582 | - if (p != NULL && !precision_specified) |
---|
| 3583 | + if (tp != NULL && !precision_specified) |
---|
| 3584 | /* Remove trailing zeroes, but keep the one |
---|
| 3585 | * just after a dot. */ |
---|
| 3586 | - while (p > tmp + 2 && *p == '0' && p[-1] != '.') |
---|
| 3587 | + while (tp > tmp + 2 && *tp == '0' |
---|
| 3588 | + && tp[-1] != '.') |
---|
| 3589 | { |
---|
| 3590 | - STRMOVE(p, p + 1); |
---|
| 3591 | - --p; |
---|
| 3592 | + STRMOVE(tp, tp + 1); |
---|
| 3593 | + --tp; |
---|
| 3594 | --str_arg_l; |
---|
| 3595 | } |
---|
| 3596 | } |
---|
| 3597 | else |
---|
| 3598 | { |
---|
| 3599 | - char *p; |
---|
| 3600 | + char *tp; |
---|
| 3601 | |
---|
| 3602 | /* Be consistent: some printf("%e") use 1.0e+12 |
---|
| 3603 | * and some 1.0e+012. Remove one zero in the last |
---|
| 3604 | * case. */ |
---|
| 3605 | - p = (char *)vim_strchr((char_u *)tmp, |
---|
| 3606 | + tp = (char *)vim_strchr((char_u *)tmp, |
---|
| 3607 | fmt_spec == 'e' ? 'e' : 'E'); |
---|
| 3608 | - if (p != NULL && (p[1] == '+' || p[1] == '-') |
---|
| 3609 | - && p[2] == '0' |
---|
| 3610 | - && vim_isdigit(p[3]) |
---|
| 3611 | - && vim_isdigit(p[4])) |
---|
| 3612 | + if (tp != NULL && (tp[1] == '+' || tp[1] == '-') |
---|
| 3613 | + && tp[2] == '0' |
---|
| 3614 | + && vim_isdigit(tp[3]) |
---|
| 3615 | + && vim_isdigit(tp[4])) |
---|
| 3616 | { |
---|
| 3617 | - STRMOVE(p + 2, p + 3); |
---|
| 3618 | + STRMOVE(tp + 2, tp + 3); |
---|
| 3619 | --str_arg_l; |
---|
| 3620 | } |
---|
| 3621 | } |
---|
| 3622 | diff -Naur vim72.orig/src/misc1.c vim72/src/misc1.c |
---|
| 3623 | --- vim72.orig/src/misc1.c 2008-07-12 12:20:53.000000000 -0700 |
---|
[bef6db9] | 3624 | +++ vim72/src/misc1.c 2009-01-19 00:08:31.000000000 -0800 |
---|
[d25b7db] | 3625 | @@ -3245,9 +3245,9 @@ |
---|
| 3626 | |
---|
| 3627 | /* When using ":silent" assume that <CR> was entered. */ |
---|
| 3628 | if (mouse_used != NULL) |
---|
| 3629 | - MSG_PUTS(_("Type number or click with mouse (<Enter> cancels): ")); |
---|
| 3630 | + MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): ")); |
---|
| 3631 | else |
---|
| 3632 | - MSG_PUTS(_("Choice number (<Enter> cancels): ")); |
---|
| 3633 | + MSG_PUTS(_("Type number and <Enter> (empty cancels): ")); |
---|
| 3634 | |
---|
| 3635 | /* Set the state such that text can be selected/copied/pasted and we still |
---|
| 3636 | * get mouse events. */ |
---|
| 3637 | diff -Naur vim72.orig/src/misc2.c vim72/src/misc2.c |
---|
| 3638 | --- vim72.orig/src/misc2.c 2008-07-23 12:12:56.000000000 -0700 |
---|
[bef6db9] | 3639 | +++ vim72/src/misc2.c 2009-01-19 00:10:29.000000000 -0800 |
---|
[d25b7db] | 3640 | @@ -873,7 +873,7 @@ |
---|
| 3641 | /* 3. check for available memory: call mch_avail_mem() */ |
---|
| 3642 | if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing) |
---|
| 3643 | { |
---|
| 3644 | - vim_free((char *)p); /* System is low... no go! */ |
---|
| 3645 | + free((char *)p); /* System is low... no go! */ |
---|
| 3646 | p = NULL; |
---|
| 3647 | } |
---|
| 3648 | else |
---|
| 3649 | @@ -1257,7 +1257,6 @@ |
---|
| 3650 | return escaped_string; |
---|
| 3651 | } |
---|
| 3652 | |
---|
| 3653 | -#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO) |
---|
| 3654 | /* |
---|
| 3655 | * Return TRUE when 'shell' has "csh" in the tail. |
---|
| 3656 | */ |
---|
| 3657 | @@ -1266,9 +1265,7 @@ |
---|
| 3658 | { |
---|
| 3659 | return (strstr((char *)gettail(p_sh), "csh") != NULL); |
---|
| 3660 | } |
---|
| 3661 | -#endif |
---|
| 3662 | |
---|
| 3663 | -#if defined(FEAT_EVAL) || defined(PROTO) |
---|
| 3664 | /* |
---|
| 3665 | * Escape "string" for use as a shell argument with system(). |
---|
| 3666 | * This uses single quotes, except when we know we need to use double qoutes |
---|
| 3667 | @@ -1391,7 +1388,6 @@ |
---|
| 3668 | |
---|
| 3669 | return escaped_string; |
---|
| 3670 | } |
---|
| 3671 | -#endif |
---|
| 3672 | |
---|
| 3673 | /* |
---|
| 3674 | * Like vim_strsave(), but make all characters uppercase. |
---|
| 3675 | @@ -2565,7 +2561,7 @@ |
---|
| 3676 | int key; |
---|
| 3677 | int dlen = 0; |
---|
| 3678 | |
---|
| 3679 | - key = find_special_key(srcp, &modifiers, keycode); |
---|
| 3680 | + key = find_special_key(srcp, &modifiers, keycode, FALSE); |
---|
| 3681 | if (key == 0) |
---|
| 3682 | return 0; |
---|
| 3683 | |
---|
| 3684 | @@ -2601,10 +2597,11 @@ |
---|
| 3685 | * returns 0 if there is no match. |
---|
| 3686 | */ |
---|
| 3687 | int |
---|
| 3688 | -find_special_key(srcp, modp, keycode) |
---|
| 3689 | +find_special_key(srcp, modp, keycode, keep_x_key) |
---|
| 3690 | char_u **srcp; |
---|
| 3691 | int *modp; |
---|
| 3692 | - int keycode; /* prefer key code, e.g. K_DEL instead of DEL */ |
---|
| 3693 | + int keycode; /* prefer key code, e.g. K_DEL instead of DEL */ |
---|
| 3694 | + int keep_x_key; /* don't translate xHome to Home key */ |
---|
| 3695 | { |
---|
| 3696 | char_u *last_dash; |
---|
| 3697 | char_u *end_of_name; |
---|
| 3698 | @@ -2672,7 +2669,8 @@ |
---|
| 3699 | else |
---|
| 3700 | { |
---|
| 3701 | key = get_special_key_code(last_dash + 1); |
---|
| 3702 | - key = handle_x_keys(key); |
---|
| 3703 | + if (!keep_x_key) |
---|
| 3704 | + key = handle_x_keys(key); |
---|
| 3705 | } |
---|
| 3706 | |
---|
| 3707 | /* |
---|
| 3708 | diff -Naur vim72.orig/src/move.c vim72/src/move.c |
---|
| 3709 | --- vim72.orig/src/move.c 2008-07-12 09:26:47.000000000 -0700 |
---|
[bef6db9] | 3710 | +++ vim72/src/move.c 2009-01-19 00:09:02.000000000 -0800 |
---|
[d25b7db] | 3711 | @@ -280,18 +280,20 @@ |
---|
| 3712 | |
---|
| 3713 | if (curwin->w_botline <= curbuf->b_ml.ml_line_count) |
---|
| 3714 | { |
---|
| 3715 | - if (curwin->w_cursor.lnum < curwin->w_botline |
---|
| 3716 | - && ((long)curwin->w_cursor.lnum |
---|
| 3717 | + if (curwin->w_cursor.lnum < curwin->w_botline) |
---|
| 3718 | + { |
---|
| 3719 | + if (((long)curwin->w_cursor.lnum |
---|
| 3720 | >= (long)curwin->w_botline - p_so |
---|
| 3721 | #ifdef FEAT_FOLDING |
---|
| 3722 | || hasAnyFolding(curwin) |
---|
| 3723 | #endif |
---|
| 3724 | )) |
---|
| 3725 | - { |
---|
| 3726 | + { |
---|
| 3727 | lineoff_T loff; |
---|
| 3728 | |
---|
| 3729 | - /* Cursor is above botline, check if there are 'scrolloff' |
---|
| 3730 | - * window lines below the cursor. If not, need to scroll. */ |
---|
| 3731 | + /* Cursor is (a few lines) above botline, check if there are |
---|
| 3732 | + * 'scrolloff' window lines below the cursor. If not, need to |
---|
| 3733 | + * scroll. */ |
---|
| 3734 | n = curwin->w_empty_rows; |
---|
| 3735 | loff.lnum = curwin->w_cursor.lnum; |
---|
| 3736 | #ifdef FEAT_FOLDING |
---|
| 3737 | @@ -317,6 +319,10 @@ |
---|
| 3738 | if (n >= p_so) |
---|
| 3739 | /* sufficient context, no need to scroll */ |
---|
| 3740 | check_botline = FALSE; |
---|
| 3741 | + } |
---|
| 3742 | + else |
---|
| 3743 | + /* sufficient context, no need to scroll */ |
---|
| 3744 | + check_botline = FALSE; |
---|
| 3745 | } |
---|
| 3746 | if (check_botline) |
---|
| 3747 | { |
---|
| 3748 | @@ -509,6 +515,9 @@ |
---|
| 3749 | /* Approximate the value of w_botline */ |
---|
| 3750 | wp->w_botline += lnum - wp->w_topline; |
---|
| 3751 | wp->w_topline = lnum; |
---|
| 3752 | +#ifdef FEAT_AUTOCMD |
---|
| 3753 | + wp->w_topline_was_set = TRUE; |
---|
| 3754 | +#endif |
---|
| 3755 | #ifdef FEAT_DIFF |
---|
| 3756 | wp->w_topfill = 0; |
---|
| 3757 | #endif |
---|
| 3758 | diff -Naur vim72.orig/src/netbeans.c vim72/src/netbeans.c |
---|
| 3759 | --- vim72.orig/src/netbeans.c 2008-07-13 09:19:54.000000000 -0700 |
---|
[bef6db9] | 3760 | +++ vim72/src/netbeans.c 2009-01-19 00:10:45.000000000 -0800 |
---|
[d25b7db] | 3761 | @@ -1043,7 +1043,7 @@ |
---|
| 3762 | nbdebug(("EVT: %s", buf)); |
---|
| 3763 | /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */ |
---|
| 3764 | if (sd >= 0) |
---|
| 3765 | - sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */ |
---|
| 3766 | + ignored = sock_write(sd, buf, (int)STRLEN(buf)); |
---|
| 3767 | } |
---|
| 3768 | } |
---|
| 3769 | |
---|
| 3770 | @@ -2277,9 +2277,6 @@ |
---|
| 3771 | int serNum; |
---|
| 3772 | int localTypeNum; |
---|
| 3773 | int typeNum; |
---|
| 3774 | -# ifdef NBDEBUG |
---|
| 3775 | - int len; |
---|
| 3776 | -# endif |
---|
| 3777 | pos_T *pos; |
---|
| 3778 | |
---|
| 3779 | if (buf == NULL || buf->bufp == NULL) |
---|
| 3780 | @@ -2303,13 +2300,10 @@ |
---|
| 3781 | pos = get_off_or_lnum(buf->bufp, &args); |
---|
| 3782 | |
---|
| 3783 | cp = (char *)args; |
---|
| 3784 | -# ifdef NBDEBUG |
---|
| 3785 | - len = |
---|
| 3786 | -# endif |
---|
| 3787 | - strtol(cp, &cp, 10); |
---|
| 3788 | + ignored = (int)strtol(cp, &cp, 10); |
---|
| 3789 | args = (char_u *)cp; |
---|
| 3790 | # ifdef NBDEBUG |
---|
| 3791 | - if (len != -1) |
---|
| 3792 | + if (ignored != -1) |
---|
| 3793 | { |
---|
| 3794 | nbdebug((" partial line annotation -- Not Yet Implemented!\n")); |
---|
| 3795 | } |
---|
[bef6db9] | 3796 | @@ -2924,44 +2918,26 @@ |
---|
| 3797 | } |
---|
| 3798 | |
---|
| 3799 | /* |
---|
| 3800 | - * Tell netbeans a file was closed. |
---|
| 3801 | + * Tell netbeans that a file was deleted or wiped out. |
---|
| 3802 | */ |
---|
| 3803 | void |
---|
| 3804 | -netbeans_file_closed(buf_T *bufp) |
---|
| 3805 | +netbeans_file_killed(buf_T *bufp) |
---|
| 3806 | { |
---|
| 3807 | int bufno = nb_getbufno(bufp); |
---|
| 3808 | nbbuf_T *nbbuf = nb_get_buf(bufno); |
---|
| 3809 | char buffer[2*MAXPATHL]; |
---|
| 3810 | |
---|
| 3811 | - if (!haveConnection || bufno < 0) |
---|
| 3812 | - return; |
---|
| 3813 | - |
---|
| 3814 | - if (!netbeansCloseFile) |
---|
| 3815 | - { |
---|
| 3816 | - nbdebug(("Ignoring file_closed for %s. File was closed from IDE\n", |
---|
| 3817 | - bufp->b_ffname)); |
---|
| 3818 | + if (!haveConnection || bufno == -1) |
---|
| 3819 | return; |
---|
| 3820 | - } |
---|
| 3821 | - |
---|
| 3822 | - nbdebug(("netbeans_file_closed:\n")); |
---|
| 3823 | - nbdebug((" Closing bufno: %d", bufno)); |
---|
| 3824 | - if (curbuf != NULL && curbuf != bufp) |
---|
| 3825 | - { |
---|
| 3826 | - nbdebug((" Curbuf bufno: %d\n", nb_getbufno(curbuf))); |
---|
| 3827 | - } |
---|
| 3828 | - else if (curbuf == bufp) |
---|
| 3829 | - { |
---|
| 3830 | - nbdebug((" curbuf == bufp\n")); |
---|
| 3831 | - } |
---|
| 3832 | |
---|
| 3833 | - if (bufno <= 0) |
---|
| 3834 | - return; |
---|
| 3835 | + nbdebug(("netbeans_file_killed:\n")); |
---|
| 3836 | + nbdebug((" Killing bufno: %d", bufno)); |
---|
| 3837 | |
---|
| 3838 | sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno); |
---|
| 3839 | |
---|
| 3840 | nbdebug(("EVT: %s", buffer)); |
---|
| 3841 | |
---|
| 3842 | - nb_send(buffer, "netbeans_file_closed"); |
---|
| 3843 | + nb_send(buffer, "netbeans_file_killed"); |
---|
| 3844 | |
---|
| 3845 | if (nbbuf != NULL) |
---|
| 3846 | nbbuf->bufp = NULL; |
---|
[d25b7db] | 3847 | diff -Naur vim72.orig/src/normal.c vim72/src/normal.c |
---|
| 3848 | --- vim72.orig/src/normal.c 2008-07-31 13:03:08.000000000 -0700 |
---|
[bef6db9] | 3849 | +++ vim72/src/normal.c 2009-01-19 00:09:18.000000000 -0800 |
---|
[d25b7db] | 3850 | @@ -183,6 +183,8 @@ |
---|
| 3851 | static void nv_cursorhold __ARGS((cmdarg_T *cap)); |
---|
| 3852 | #endif |
---|
| 3853 | |
---|
| 3854 | +static char *e_noident = N_("E349: No identifier under cursor"); |
---|
| 3855 | + |
---|
| 3856 | /* |
---|
| 3857 | * Function to be called for a Normal or Visual mode command. |
---|
| 3858 | * The argument is a cmdarg_T. |
---|
| 3859 | @@ -578,6 +580,9 @@ |
---|
| 3860 | static int old_mapped_len = 0; |
---|
| 3861 | #endif |
---|
| 3862 | int idx; |
---|
| 3863 | +#ifdef FEAT_EVAL |
---|
| 3864 | + int set_prevcount = FALSE; |
---|
| 3865 | +#endif |
---|
| 3866 | |
---|
| 3867 | vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */ |
---|
| 3868 | ca.oap = oap; |
---|
| 3869 | @@ -613,7 +618,12 @@ |
---|
| 3870 | /* When not finishing an operator and no register name typed, reset the |
---|
| 3871 | * count. */ |
---|
| 3872 | if (!finish_op && !oap->regname) |
---|
| 3873 | + { |
---|
| 3874 | ca.opcount = 0; |
---|
| 3875 | +#ifdef FEAT_EVAL |
---|
| 3876 | + set_prevcount = TRUE; |
---|
| 3877 | +#endif |
---|
| 3878 | + } |
---|
| 3879 | |
---|
| 3880 | #ifdef FEAT_AUTOCMD |
---|
| 3881 | /* Restore counts from before receiving K_CURSORHOLD. This means after |
---|
| 3882 | @@ -717,7 +727,15 @@ |
---|
| 3883 | * command, so that v:count can be used in an expression mapping |
---|
| 3884 | * right after the count. */ |
---|
| 3885 | if (toplevel && stuff_empty()) |
---|
| 3886 | - set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0); |
---|
| 3887 | + { |
---|
| 3888 | + long count = ca.count0; |
---|
| 3889 | + |
---|
| 3890 | + /* multiply with ca.opcount the same way as below */ |
---|
| 3891 | + if (ca.opcount != 0) |
---|
| 3892 | + count = ca.opcount * (count == 0 ? 1 : count); |
---|
| 3893 | + set_vcount(count, count == 0 ? 1 : count, set_prevcount); |
---|
| 3894 | + set_prevcount = FALSE; /* only set v:prevcount once */ |
---|
| 3895 | + } |
---|
| 3896 | #endif |
---|
| 3897 | if (ctrl_w) |
---|
| 3898 | { |
---|
| 3899 | @@ -804,7 +822,7 @@ |
---|
| 3900 | * Only set v:count when called from main() and not a stuffed command. |
---|
| 3901 | */ |
---|
| 3902 | if (toplevel && stuff_empty()) |
---|
| 3903 | - set_vcount(ca.count0, ca.count1); |
---|
| 3904 | + set_vcount(ca.count0, ca.count1, set_prevcount); |
---|
| 3905 | #endif |
---|
| 3906 | |
---|
| 3907 | /* |
---|
| 3908 | @@ -1132,7 +1150,8 @@ |
---|
| 3909 | out_flush(); |
---|
| 3910 | #endif |
---|
| 3911 | #ifdef FEAT_AUTOCMD |
---|
| 3912 | - did_cursorhold = FALSE; |
---|
| 3913 | + if (ca.cmdchar != K_IGNORE) |
---|
| 3914 | + did_cursorhold = FALSE; |
---|
| 3915 | #endif |
---|
| 3916 | |
---|
| 3917 | State = NORMAL; |
---|
| 3918 | @@ -3509,7 +3528,7 @@ |
---|
| 3919 | if (find_type & FIND_STRING) |
---|
| 3920 | EMSG(_("E348: No string under cursor")); |
---|
| 3921 | else |
---|
| 3922 | - EMSG(_("E349: No identifier under cursor")); |
---|
| 3923 | + EMSG(_(e_noident)); |
---|
| 3924 | return 0; |
---|
| 3925 | } |
---|
| 3926 | ptr += col; |
---|
| 3927 | @@ -5469,6 +5488,20 @@ |
---|
| 3928 | STRCPY(buf, "he! "); |
---|
| 3929 | else |
---|
| 3930 | { |
---|
| 3931 | + /* An external command will probably use an argument starting |
---|
| 3932 | + * with "-" as an option. To avoid trouble we skip the "-". */ |
---|
| 3933 | + while (*ptr == '-' && n > 0) |
---|
| 3934 | + { |
---|
| 3935 | + ++ptr; |
---|
| 3936 | + --n; |
---|
| 3937 | + } |
---|
| 3938 | + if (n == 0) |
---|
| 3939 | + { |
---|
| 3940 | + EMSG(_(e_noident)); /* found dashes only */ |
---|
| 3941 | + vim_free(buf); |
---|
| 3942 | + return; |
---|
| 3943 | + } |
---|
| 3944 | + |
---|
| 3945 | /* When a count is given, turn it into a range. Is this |
---|
| 3946 | * really what we want? */ |
---|
| 3947 | isman = (STRCMP(kp, "man") == 0); |
---|
| 3948 | @@ -5511,37 +5544,59 @@ |
---|
| 3949 | /* |
---|
| 3950 | * Now grab the chars in the identifier |
---|
| 3951 | */ |
---|
| 3952 | - if (cmdchar == '*') |
---|
| 3953 | - aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\"); |
---|
| 3954 | - else if (cmdchar == '#') |
---|
| 3955 | - aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\"); |
---|
| 3956 | - else if (cmdchar == 'K' && !kp_help) |
---|
| 3957 | - aux_ptr = (char_u *)" \t\\\"|!"; |
---|
| 3958 | - else |
---|
| 3959 | - /* Don't escape spaces and Tabs in a tag with a backslash */ |
---|
| 3960 | - aux_ptr = (char_u *)"\\|\""; |
---|
| 3961 | - |
---|
| 3962 | - p = buf + STRLEN(buf); |
---|
| 3963 | - while (n-- > 0) |
---|
| 3964 | - { |
---|
| 3965 | - /* put a backslash before \ and some others */ |
---|
| 3966 | - if (vim_strchr(aux_ptr, *ptr) != NULL) |
---|
| 3967 | - *p++ = '\\'; |
---|
| 3968 | -#ifdef FEAT_MBYTE |
---|
| 3969 | - /* When current byte is a part of multibyte character, copy all bytes |
---|
| 3970 | - * of that character. */ |
---|
| 3971 | - if (has_mbyte) |
---|
| 3972 | + if (cmdchar == 'K' && !kp_help) |
---|
| 3973 | + { |
---|
| 3974 | + /* Escape the argument properly for a shell command */ |
---|
| 3975 | + ptr = vim_strnsave(ptr, n); |
---|
| 3976 | + p = vim_strsave_shellescape(ptr, TRUE); |
---|
| 3977 | + vim_free(ptr); |
---|
| 3978 | + if (p == NULL) |
---|
| 3979 | { |
---|
| 3980 | - int i; |
---|
| 3981 | - int len = (*mb_ptr2len)(ptr) - 1; |
---|
| 3982 | - |
---|
| 3983 | - for (i = 0; i < len && n >= 1; ++i, --n) |
---|
| 3984 | - *p++ = *ptr++; |
---|
| 3985 | + vim_free(buf); |
---|
| 3986 | + return; |
---|
| 3987 | } |
---|
| 3988 | + buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1); |
---|
| 3989 | + if (buf == NULL) |
---|
| 3990 | + { |
---|
| 3991 | + vim_free(buf); |
---|
| 3992 | + vim_free(p); |
---|
| 3993 | + return; |
---|
| 3994 | + } |
---|
| 3995 | + STRCAT(buf, p); |
---|
| 3996 | + vim_free(p); |
---|
| 3997 | + } |
---|
| 3998 | + else |
---|
| 3999 | + { |
---|
| 4000 | + if (cmdchar == '*') |
---|
| 4001 | + aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\"); |
---|
| 4002 | + else if (cmdchar == '#') |
---|
| 4003 | + aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\"); |
---|
| 4004 | + else |
---|
| 4005 | + /* Don't escape spaces and Tabs in a tag with a backslash */ |
---|
| 4006 | + aux_ptr = (char_u *)"\\|\"\n*?["; |
---|
| 4007 | + |
---|
| 4008 | + p = buf + STRLEN(buf); |
---|
| 4009 | + while (n-- > 0) |
---|
| 4010 | + { |
---|
| 4011 | + /* put a backslash before \ and some others */ |
---|
| 4012 | + if (vim_strchr(aux_ptr, *ptr) != NULL) |
---|
| 4013 | + *p++ = '\\'; |
---|
| 4014 | +#ifdef FEAT_MBYTE |
---|
| 4015 | + /* When current byte is a part of multibyte character, copy all |
---|
| 4016 | + * bytes of that character. */ |
---|
| 4017 | + if (has_mbyte) |
---|
| 4018 | + { |
---|
| 4019 | + int i; |
---|
| 4020 | + int len = (*mb_ptr2len)(ptr) - 1; |
---|
| 4021 | + |
---|
| 4022 | + for (i = 0; i < len && n >= 1; ++i, --n) |
---|
| 4023 | + *p++ = *ptr++; |
---|
| 4024 | + } |
---|
| 4025 | #endif |
---|
| 4026 | - *p++ = *ptr++; |
---|
| 4027 | + *p++ = *ptr++; |
---|
| 4028 | + } |
---|
| 4029 | + *p = NUL; |
---|
| 4030 | } |
---|
| 4031 | - *p = NUL; |
---|
| 4032 | |
---|
| 4033 | /* |
---|
| 4034 | * Execute the command. |
---|
| 4035 | diff -Naur vim72.orig/src/ops.c vim72/src/ops.c |
---|
| 4036 | --- vim72.orig/src/ops.c 2008-06-21 13:08:59.000000000 -0700 |
---|
[bef6db9] | 4037 | +++ vim72/src/ops.c 2009-01-19 00:10:04.000000000 -0800 |
---|
[d25b7db] | 4038 | @@ -2209,12 +2209,15 @@ |
---|
| 4039 | { |
---|
| 4040 | for (; pos.lnum <= oap->end.lnum; ++pos.lnum) |
---|
| 4041 | { |
---|
| 4042 | + int one_change; |
---|
| 4043 | + |
---|
| 4044 | block_prep(oap, &bd, pos.lnum, FALSE); |
---|
| 4045 | pos.col = bd.textcol; |
---|
| 4046 | - did_change = swapchars(oap->op_type, &pos, bd.textlen); |
---|
| 4047 | + one_change = swapchars(oap->op_type, &pos, bd.textlen); |
---|
| 4048 | + did_change |= one_change; |
---|
| 4049 | |
---|
| 4050 | # ifdef FEAT_NETBEANS_INTG |
---|
| 4051 | - if (usingNetbeans && did_change) |
---|
| 4052 | + if (usingNetbeans && one_change) |
---|
| 4053 | { |
---|
| 4054 | char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE); |
---|
| 4055 | |
---|
| 4056 | diff -Naur vim72.orig/src/option.c vim72/src/option.c |
---|
| 4057 | --- vim72.orig/src/option.c 2008-07-18 06:05:33.000000000 -0700 |
---|
[bef6db9] | 4058 | +++ vim72/src/option.c 2009-01-19 00:10:29.000000000 -0800 |
---|
[d25b7db] | 4059 | @@ -2593,13 +2593,13 @@ |
---|
| 4060 | #ifdef FEAT_VIMINFO |
---|
| 4061 | (char_u *)&p_viminfo, PV_NONE, |
---|
| 4062 | #if defined(MSDOS) || defined(MSWIN) || defined(OS2) |
---|
| 4063 | - {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"} |
---|
| 4064 | + {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"} |
---|
| 4065 | #else |
---|
| 4066 | # ifdef AMIGA |
---|
| 4067 | {(char_u *)"", |
---|
| 4068 | - (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"} |
---|
| 4069 | + (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"} |
---|
| 4070 | # else |
---|
| 4071 | - {(char_u *)"", (char_u *)"'20,<50,s10,h"} |
---|
| 4072 | + {(char_u *)"", (char_u *)"'100,<50,s10,h"} |
---|
| 4073 | # endif |
---|
| 4074 | #endif |
---|
| 4075 | #else |
---|
| 4076 | @@ -7974,6 +7974,11 @@ |
---|
| 4077 | else /* curwin->w_p_scr > curwin->w_height */ |
---|
| 4078 | curwin->w_p_scr = curwin->w_height; |
---|
| 4079 | } |
---|
| 4080 | + if (p_hi < 0) |
---|
| 4081 | + { |
---|
| 4082 | + errmsg = e_positive; |
---|
| 4083 | + p_hi = 0; |
---|
| 4084 | + } |
---|
| 4085 | if (p_report < 0) |
---|
| 4086 | { |
---|
| 4087 | errmsg = e_positive; |
---|
| 4088 | @@ -8227,13 +8232,13 @@ |
---|
| 4089 | { |
---|
| 4090 | if (number == 0 && string != NULL) |
---|
| 4091 | { |
---|
| 4092 | - int index; |
---|
| 4093 | + int idx; |
---|
| 4094 | |
---|
| 4095 | /* Either we are given a string or we are setting option |
---|
| 4096 | * to zero. */ |
---|
| 4097 | - for (index = 0; string[index] == '0'; ++index) |
---|
| 4098 | + for (idx = 0; string[idx] == '0'; ++idx) |
---|
| 4099 | ; |
---|
| 4100 | - if (string[index] != NUL || index == 0) |
---|
| 4101 | + if (string[idx] != NUL || idx == 0) |
---|
| 4102 | { |
---|
| 4103 | /* There's another character after zeros or the string |
---|
| 4104 | * is empty. In both cases, we are trying to set a |
---|
| 4105 | @@ -8323,7 +8328,7 @@ |
---|
| 4106 | { |
---|
| 4107 | --arg; /* put arg at the '<' */ |
---|
| 4108 | modifiers = 0; |
---|
| 4109 | - key = find_special_key(&arg, &modifiers, TRUE); |
---|
| 4110 | + key = find_special_key(&arg, &modifiers, TRUE, TRUE); |
---|
| 4111 | if (modifiers) /* can't handle modifiers here */ |
---|
| 4112 | key = 0; |
---|
| 4113 | } |
---|
| 4114 | diff -Naur vim72.orig/src/os_unix.c vim72/src/os_unix.c |
---|
| 4115 | --- vim72.orig/src/os_unix.c 2008-08-06 04:01:40.000000000 -0700 |
---|
[bef6db9] | 4116 | +++ vim72/src/os_unix.c 2009-01-19 00:09:40.000000000 -0800 |
---|
[d25b7db] | 4117 | @@ -315,12 +315,15 @@ |
---|
| 4118 | {-1, "Unknown!", FALSE} |
---|
| 4119 | }; |
---|
| 4120 | |
---|
| 4121 | +/* |
---|
| 4122 | + * Write s[len] to the screen. |
---|
| 4123 | + */ |
---|
| 4124 | void |
---|
| 4125 | mch_write(s, len) |
---|
| 4126 | char_u *s; |
---|
| 4127 | int len; |
---|
| 4128 | { |
---|
| 4129 | - write(1, (char *)s, len); |
---|
| 4130 | + ignored = (int)write(1, (char *)s, len); |
---|
| 4131 | if (p_wd) /* Unix is too fast, slow down a bit more */ |
---|
| 4132 | RealWaitForChar(read_cmd_fd, p_wd, NULL); |
---|
| 4133 | } |
---|
| 4134 | @@ -2905,7 +2908,7 @@ |
---|
| 4135 | * Ignore any errors. |
---|
| 4136 | */ |
---|
| 4137 | #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK) |
---|
| 4138 | - signal_stack = malloc(SIGSTKSZ); |
---|
| 4139 | + signal_stack = (char *)alloc(SIGSTKSZ); |
---|
| 4140 | init_signal_stack(); |
---|
| 4141 | #endif |
---|
| 4142 | } |
---|
| 4143 | @@ -2936,7 +2939,8 @@ |
---|
| 4144 | } |
---|
| 4145 | # endif |
---|
| 4146 | # endif |
---|
| 4147 | -# ifdef FEAT_X11 |
---|
| 4148 | + /* Don't close the display for GTK 1, it is done in exit(). */ |
---|
| 4149 | +# if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2)) |
---|
| 4150 | if (x11_display != NULL |
---|
| 4151 | # ifdef FEAT_XCLIPBOARD |
---|
| 4152 | && x11_display != xterm_dpy |
---|
| 4153 | @@ -3926,9 +3930,9 @@ |
---|
| 4154 | */ |
---|
| 4155 | if (fd >= 0) |
---|
| 4156 | { |
---|
| 4157 | - dup(fd); /* To replace stdin (file descriptor 0) */ |
---|
| 4158 | - dup(fd); /* To replace stdout (file descriptor 1) */ |
---|
| 4159 | - dup(fd); /* To replace stderr (file descriptor 2) */ |
---|
| 4160 | + ignored = dup(fd); /* To replace stdin (fd 0) */ |
---|
| 4161 | + ignored = dup(fd); /* To replace stdout (fd 1) */ |
---|
| 4162 | + ignored = dup(fd); /* To replace stderr (fd 2) */ |
---|
| 4163 | |
---|
| 4164 | /* Don't need this now that we've duplicated it */ |
---|
| 4165 | close(fd); |
---|
| 4166 | @@ -3996,13 +4000,13 @@ |
---|
| 4167 | |
---|
| 4168 | /* set up stdin/stdout/stderr for the child */ |
---|
| 4169 | close(0); |
---|
| 4170 | - dup(pty_slave_fd); |
---|
| 4171 | + ignored = dup(pty_slave_fd); |
---|
| 4172 | close(1); |
---|
| 4173 | - dup(pty_slave_fd); |
---|
| 4174 | + ignored = dup(pty_slave_fd); |
---|
| 4175 | if (gui.in_use) |
---|
| 4176 | { |
---|
| 4177 | close(2); |
---|
| 4178 | - dup(pty_slave_fd); |
---|
| 4179 | + ignored = dup(pty_slave_fd); |
---|
| 4180 | } |
---|
| 4181 | |
---|
| 4182 | close(pty_slave_fd); /* has been dupped, close it now */ |
---|
| 4183 | @@ -4013,13 +4017,13 @@ |
---|
| 4184 | /* set up stdin for the child */ |
---|
| 4185 | close(fd_toshell[1]); |
---|
| 4186 | close(0); |
---|
| 4187 | - dup(fd_toshell[0]); |
---|
| 4188 | + ignored = dup(fd_toshell[0]); |
---|
| 4189 | close(fd_toshell[0]); |
---|
| 4190 | |
---|
| 4191 | /* set up stdout for the child */ |
---|
| 4192 | close(fd_fromshell[0]); |
---|
| 4193 | close(1); |
---|
| 4194 | - dup(fd_fromshell[1]); |
---|
| 4195 | + ignored = dup(fd_fromshell[1]); |
---|
| 4196 | close(fd_fromshell[1]); |
---|
| 4197 | |
---|
| 4198 | # ifdef FEAT_GUI |
---|
| 4199 | @@ -4027,7 +4031,7 @@ |
---|
| 4200 | { |
---|
| 4201 | /* set up stderr for the child */ |
---|
| 4202 | close(2); |
---|
| 4203 | - dup(1); |
---|
| 4204 | + ignored = dup(1); |
---|
| 4205 | } |
---|
| 4206 | # endif |
---|
| 4207 | } |
---|
| 4208 | @@ -4158,7 +4162,8 @@ |
---|
| 4209 | && (lnum != |
---|
| 4210 | curbuf->b_ml.ml_line_count |
---|
| 4211 | || curbuf->b_p_eol))) |
---|
| 4212 | - write(toshell_fd, "\n", (size_t)1); |
---|
| 4213 | + ignored = write(toshell_fd, "\n", |
---|
| 4214 | + (size_t)1); |
---|
| 4215 | ++lnum; |
---|
| 4216 | if (lnum > curbuf->b_op_end.lnum) |
---|
| 4217 | { |
---|
| 4218 | @@ -6814,7 +6819,8 @@ |
---|
| 4219 | if (xsmp_icefd != -1) |
---|
| 4220 | { |
---|
| 4221 | SmcCloseConnection(xsmp.smcconn, 0, NULL); |
---|
| 4222 | - vim_free(xsmp.clientid); |
---|
| 4223 | + if (xsmp.clientid != NULL) |
---|
| 4224 | + free(xsmp.clientid); |
---|
| 4225 | xsmp.clientid = NULL; |
---|
| 4226 | xsmp_icefd = -1; |
---|
| 4227 | } |
---|
| 4228 | diff -Naur vim72.orig/src/proto/eval.pro vim72/src/proto/eval.pro |
---|
| 4229 | --- vim72.orig/src/proto/eval.pro 2008-08-09 07:31:25.000000000 -0700 |
---|
[bef6db9] | 4230 | +++ vim72/src/proto/eval.pro 2009-01-19 00:09:18.000000000 -0800 |
---|
[d25b7db] | 4231 | @@ -17,7 +17,7 @@ |
---|
| 4232 | int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip)); |
---|
| 4233 | char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip)); |
---|
| 4234 | int skip_expr __ARGS((char_u **pp)); |
---|
| 4235 | -char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist)); |
---|
| 4236 | +char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert)); |
---|
| 4237 | char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox)); |
---|
| 4238 | int eval_to_number __ARGS((char_u *expr)); |
---|
| 4239 | list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr)); |
---|
| 4240 | @@ -46,7 +46,9 @@ |
---|
| 4241 | void list_unref __ARGS((list_T *l)); |
---|
| 4242 | void list_free __ARGS((list_T *l, int recurse)); |
---|
| 4243 | dictitem_T *dict_lookup __ARGS((hashitem_T *hi)); |
---|
| 4244 | +char_u *list_find_str __ARGS((list_T *l, long idx)); |
---|
| 4245 | int list_append_dict __ARGS((list_T *list, dict_T *dict)); |
---|
| 4246 | +int list_append_string __ARGS((list_T *l, char_u *str, int len)); |
---|
| 4247 | int garbage_collect __ARGS((void)); |
---|
| 4248 | dict_T *dict_alloc __ARGS((void)); |
---|
| 4249 | int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str)); |
---|
| 4250 | @@ -58,8 +60,10 @@ |
---|
| 4251 | void set_vim_var_nr __ARGS((int idx, long val)); |
---|
| 4252 | long get_vim_var_nr __ARGS((int idx)); |
---|
| 4253 | char_u *get_vim_var_str __ARGS((int idx)); |
---|
| 4254 | -void set_vcount __ARGS((long count, long count1)); |
---|
| 4255 | +list_T *get_vim_var_list __ARGS((int idx)); |
---|
| 4256 | +void set_vcount __ARGS((long count, long count1, int set_prevcount)); |
---|
| 4257 | void set_vim_var_string __ARGS((int idx, char_u *val, int len)); |
---|
| 4258 | +void set_vim_var_list __ARGS((int idx, list_T *val)); |
---|
| 4259 | void set_reg_var __ARGS((int c)); |
---|
| 4260 | char_u *v_exception __ARGS((char_u *oldval)); |
---|
| 4261 | char_u *v_throwpoint __ARGS((char_u *oldval)); |
---|
| 4262 | @@ -94,6 +98,7 @@ |
---|
| 4263 | void write_viminfo_varlist __ARGS((FILE *fp)); |
---|
| 4264 | int store_session_globals __ARGS((FILE *fd)); |
---|
| 4265 | void last_set_msg __ARGS((scid_T scriptID)); |
---|
| 4266 | +void ex_oldfiles __ARGS((exarg_T *eap)); |
---|
| 4267 | int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen)); |
---|
| 4268 | char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags)); |
---|
| 4269 | /* vim: set ft=c : */ |
---|
| 4270 | diff -Naur vim72.orig/src/proto/ex_cmds.pro vim72/src/proto/ex_cmds.pro |
---|
| 4271 | --- vim72.orig/src/proto/ex_cmds.pro 2008-08-09 07:31:25.000000000 -0700 |
---|
[bef6db9] | 4272 | +++ vim72/src/proto/ex_cmds.pro 2009-01-19 00:08:31.000000000 -0800 |
---|
[d25b7db] | 4273 | @@ -11,7 +11,7 @@ |
---|
| 4274 | char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp)); |
---|
| 4275 | void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname)); |
---|
| 4276 | int viminfo_error __ARGS((char *errnum, char *message, char_u *line)); |
---|
| 4277 | -int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit)); |
---|
| 4278 | +int read_viminfo __ARGS((char_u *file, int flags)); |
---|
| 4279 | void write_viminfo __ARGS((char_u *file, int forceit)); |
---|
| 4280 | int viminfo_readline __ARGS((vir_T *virp)); |
---|
| 4281 | char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert)); |
---|
| 4282 | diff -Naur vim72.orig/src/proto/ex_getln.pro vim72/src/proto/ex_getln.pro |
---|
| 4283 | --- vim72.orig/src/proto/ex_getln.pro 2008-08-09 07:31:28.000000000 -0700 |
---|
[bef6db9] | 4284 | +++ vim72/src/proto/ex_getln.pro 2009-01-19 00:09:28.000000000 -0800 |
---|
[d25b7db] | 4285 | @@ -31,7 +31,7 @@ |
---|
| 4286 | void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col)); |
---|
| 4287 | int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches)); |
---|
| 4288 | int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int)))); |
---|
| 4289 | -char_u *globpath __ARGS((char_u *path, char_u *file)); |
---|
| 4290 | +char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options)); |
---|
| 4291 | void init_history __ARGS((void)); |
---|
| 4292 | int get_histtype __ARGS((char_u *name)); |
---|
| 4293 | void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep)); |
---|
| 4294 | diff -Naur vim72.orig/src/proto/mark.pro vim72/src/proto/mark.pro |
---|
| 4295 | --- vim72.orig/src/proto/mark.pro 2008-08-09 07:31:36.000000000 -0700 |
---|
[bef6db9] | 4296 | +++ vim72/src/proto/mark.pro 2009-01-19 00:08:31.000000000 -0800 |
---|
[d25b7db] | 4297 | @@ -26,5 +26,5 @@ |
---|
| 4298 | void write_viminfo_filemarks __ARGS((FILE *fp)); |
---|
| 4299 | int removable __ARGS((char_u *name)); |
---|
| 4300 | int write_viminfo_marks __ARGS((FILE *fp_out)); |
---|
| 4301 | -void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof)); |
---|
| 4302 | +void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags)); |
---|
| 4303 | /* vim: set ft=c : */ |
---|
| 4304 | diff -Naur vim72.orig/src/proto/misc2.pro vim72/src/proto/misc2.pro |
---|
| 4305 | --- vim72.orig/src/proto/misc2.pro 2008-08-09 07:31:40.000000000 -0700 |
---|
[bef6db9] | 4306 | +++ vim72/src/proto/misc2.pro 2009-01-19 00:10:29.000000000 -0800 |
---|
[d25b7db] | 4307 | @@ -59,7 +59,7 @@ |
---|
| 4308 | int handle_x_keys __ARGS((int key)); |
---|
| 4309 | char_u *get_special_key_name __ARGS((int c, int modifiers)); |
---|
| 4310 | int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode)); |
---|
| 4311 | -int find_special_key __ARGS((char_u **srcp, int *modp, int keycode)); |
---|
| 4312 | +int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key)); |
---|
| 4313 | int extract_modifiers __ARGS((int key, int *modp)); |
---|
| 4314 | int find_special_key_in_table __ARGS((int c)); |
---|
| 4315 | int get_special_key_code __ARGS((char_u *name)); |
---|
[bef6db9] | 4316 | diff -Naur vim72.orig/src/proto/netbeans.pro vim72/src/proto/netbeans.pro |
---|
| 4317 | --- vim72.orig/src/proto/netbeans.pro 2008-08-09 07:31:56.000000000 -0700 |
---|
| 4318 | +++ vim72/src/proto/netbeans.pro 2009-01-19 00:10:45.000000000 -0800 |
---|
| 4319 | @@ -11,7 +11,7 @@ |
---|
| 4320 | void netbeans_frame_moved __ARGS((int new_x, int new_y)); |
---|
| 4321 | void netbeans_file_activated __ARGS((buf_T *bufp)); |
---|
| 4322 | void netbeans_file_opened __ARGS((buf_T *bufp)); |
---|
| 4323 | -void netbeans_file_closed __ARGS((buf_T *bufp)); |
---|
| 4324 | +void netbeans_file_killed __ARGS((buf_T *bufp)); |
---|
| 4325 | void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen)); |
---|
| 4326 | void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len)); |
---|
| 4327 | void netbeans_unmodified __ARGS((buf_T *bufp)); |
---|
[d25b7db] | 4328 | diff -Naur vim72.orig/src/pty.c vim72/src/pty.c |
---|
| 4329 | --- vim72.orig/src/pty.c 2008-06-21 11:52:58.000000000 -0700 |
---|
[bef6db9] | 4330 | +++ vim72/src/pty.c 2009-01-19 00:07:02.000000000 -0800 |
---|
[d25b7db] | 4331 | @@ -270,9 +270,10 @@ |
---|
| 4332 | } |
---|
| 4333 | #endif |
---|
| 4334 | |
---|
| 4335 | -#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) |
---|
| 4336 | +#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X) |
---|
| 4337 | |
---|
| 4338 | -/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */ |
---|
| 4339 | +/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! |
---|
| 4340 | + * Same for Mac OS X Leopard. */ |
---|
| 4341 | #define PTY_DONE |
---|
| 4342 | int |
---|
| 4343 | OpenPTY(ttyn) |
---|
| 4344 | diff -Naur vim72.orig/src/screen.c vim72/src/screen.c |
---|
| 4345 | --- vim72.orig/src/screen.c 2008-07-24 07:45:07.000000000 -0700 |
---|
[bef6db9] | 4346 | +++ vim72/src/screen.c 2009-01-19 00:08:07.000000000 -0800 |
---|
[d25b7db] | 4347 | @@ -2439,9 +2439,17 @@ |
---|
| 4348 | |
---|
| 4349 | #ifdef FEAT_SYN_HL |
---|
| 4350 | /* Show 'cursorcolumn' in the fold line. */ |
---|
| 4351 | - if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp)) |
---|
| 4352 | - ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr( |
---|
| 4353 | - ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC)); |
---|
| 4354 | + if (wp->w_p_cuc) |
---|
| 4355 | + { |
---|
| 4356 | + txtcol += wp->w_virtcol; |
---|
| 4357 | + if (wp->w_p_wrap) |
---|
| 4358 | + txtcol -= wp->w_skipcol; |
---|
| 4359 | + else |
---|
| 4360 | + txtcol -= wp->w_leftcol; |
---|
| 4361 | + if (txtcol >= 0 && txtcol < W_WIDTH(wp)) |
---|
| 4362 | + ScreenAttrs[off + txtcol] = hl_combine_attr( |
---|
| 4363 | + ScreenAttrs[off + txtcol], hl_attr(HLF_CUC)); |
---|
| 4364 | + } |
---|
| 4365 | #endif |
---|
| 4366 | |
---|
| 4367 | SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp), |
---|
| 4368 | diff -Naur vim72.orig/src/spell.c vim72/src/spell.c |
---|
| 4369 | --- vim72.orig/src/spell.c 2008-07-12 12:20:55.000000000 -0700 |
---|
[bef6db9] | 4370 | +++ vim72/src/spell.c 2009-01-19 00:10:18.000000000 -0800 |
---|
[d25b7db] | 4371 | @@ -77,7 +77,7 @@ |
---|
| 4372 | |
---|
| 4373 | /* |
---|
| 4374 | * Do the opposite: based on a maximum end score and a known sound score, |
---|
| 4375 | - * compute the the maximum word score that can be used. |
---|
| 4376 | + * compute the maximum word score that can be used. |
---|
| 4377 | */ |
---|
| 4378 | #define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3) |
---|
| 4379 | |
---|
| 4380 | @@ -469,6 +469,7 @@ |
---|
| 4381 | garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */ |
---|
| 4382 | regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm |
---|
| 4383 | * (NULL when no compounding) */ |
---|
| 4384 | + char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */ |
---|
| 4385 | char_u *sl_compstartflags; /* flags for first compound word */ |
---|
| 4386 | char_u *sl_compallflags; /* all flags for compound words */ |
---|
| 4387 | char_u sl_nobreak; /* When TRUE: no spaces between words */ |
---|
| 4388 | @@ -625,7 +626,7 @@ |
---|
| 4389 | /* TRUE if a word appears in the list of banned words. */ |
---|
| 4390 | #define WAS_BANNED(su, word) (!HASHITEM_EMPTY(hash_find(&su->su_banned, word))) |
---|
| 4391 | |
---|
| 4392 | -/* Number of suggestions kept when cleaning up. we need to keep more than |
---|
| 4393 | +/* Number of suggestions kept when cleaning up. We need to keep more than |
---|
| 4394 | * what is displayed, because when rescore_suggestions() is called the score |
---|
| 4395 | * may change and wrong suggestions may be removed later. */ |
---|
| 4396 | #define SUG_CLEAN_COUNT(su) ((su)->su_maxcount < 130 ? 150 : (su)->su_maxcount + 20) |
---|
| 4397 | @@ -839,7 +840,10 @@ |
---|
| 4398 | static void slang_clear __ARGS((slang_T *lp)); |
---|
| 4399 | static void slang_clear_sug __ARGS((slang_T *lp)); |
---|
| 4400 | static void find_word __ARGS((matchinf_T *mip, int mode)); |
---|
| 4401 | +static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap)); |
---|
| 4402 | static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags)); |
---|
| 4403 | +static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag)); |
---|
| 4404 | +static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags)); |
---|
| 4405 | static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req)); |
---|
| 4406 | static void find_prefix __ARGS((matchinf_T *mip, int mode)); |
---|
| 4407 | static int fold_more __ARGS((matchinf_T *mip)); |
---|
| 4408 | @@ -1519,6 +1523,11 @@ |
---|
| 4409 | ((unsigned)flags >> 24))) |
---|
| 4410 | continue; |
---|
| 4411 | |
---|
| 4412 | + /* If there is a match with a CHECKCOMPOUNDPATTERN rule |
---|
| 4413 | + * discard the compound word. */ |
---|
| 4414 | + if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat)) |
---|
| 4415 | + continue; |
---|
| 4416 | + |
---|
| 4417 | if (mode == FIND_COMPOUND) |
---|
| 4418 | { |
---|
| 4419 | int capflags; |
---|
| 4420 | @@ -1577,6 +1586,11 @@ |
---|
| 4421 | if (!can_compound(slang, fword, mip->mi_compflags)) |
---|
| 4422 | continue; |
---|
| 4423 | } |
---|
| 4424 | + else if (slang->sl_comprules != NULL |
---|
| 4425 | + && !match_compoundrule(slang, mip->mi_compflags)) |
---|
| 4426 | + /* The compound flags collected so far do not match any |
---|
| 4427 | + * COMPOUNDRULE, discard the compounded word. */ |
---|
| 4428 | + continue; |
---|
| 4429 | } |
---|
| 4430 | |
---|
| 4431 | /* Check NEEDCOMPOUND: can't use word without compounding. */ |
---|
| 4432 | @@ -1727,6 +1741,39 @@ |
---|
| 4433 | } |
---|
| 4434 | |
---|
| 4435 | /* |
---|
| 4436 | + * Return TRUE if there is a match between the word ptr[wlen] and |
---|
| 4437 | + * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another |
---|
| 4438 | + * word. |
---|
| 4439 | + * A match means that the first part of CHECKCOMPOUNDPATTERN matches at the |
---|
| 4440 | + * end of ptr[wlen] and the second part matches after it. |
---|
| 4441 | + */ |
---|
| 4442 | + static int |
---|
| 4443 | +match_checkcompoundpattern(ptr, wlen, gap) |
---|
| 4444 | + char_u *ptr; |
---|
| 4445 | + int wlen; |
---|
| 4446 | + garray_T *gap; /* &sl_comppat */ |
---|
| 4447 | +{ |
---|
| 4448 | + int i; |
---|
| 4449 | + char_u *p; |
---|
| 4450 | + int len; |
---|
| 4451 | + |
---|
| 4452 | + for (i = 0; i + 1 < gap->ga_len; i += 2) |
---|
| 4453 | + { |
---|
| 4454 | + p = ((char_u **)gap->ga_data)[i + 1]; |
---|
| 4455 | + if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0) |
---|
| 4456 | + { |
---|
| 4457 | + /* Second part matches at start of following compound word, now |
---|
| 4458 | + * check if first part matches at end of previous word. */ |
---|
| 4459 | + p = ((char_u **)gap->ga_data)[i]; |
---|
| 4460 | + len = (int)STRLEN(p); |
---|
| 4461 | + if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0) |
---|
| 4462 | + return TRUE; |
---|
| 4463 | + } |
---|
| 4464 | + } |
---|
| 4465 | + return FALSE; |
---|
| 4466 | +} |
---|
| 4467 | + |
---|
| 4468 | +/* |
---|
| 4469 | * Return TRUE if "flags" is a valid sequence of compound flags and "word" |
---|
| 4470 | * does not have too many syllables. |
---|
| 4471 | */ |
---|
| 4472 | @@ -1773,6 +1820,98 @@ |
---|
| 4473 | } |
---|
| 4474 | |
---|
| 4475 | /* |
---|
| 4476 | + * Return TRUE when the sequence of flags in "compflags" plus "flag" can |
---|
| 4477 | + * possibly form a valid compounded word. This also checks the COMPOUNDRULE |
---|
| 4478 | + * lines if they don't contain wildcards. |
---|
| 4479 | + */ |
---|
| 4480 | + static int |
---|
| 4481 | +can_be_compound(sp, slang, compflags, flag) |
---|
| 4482 | + trystate_T *sp; |
---|
| 4483 | + slang_T *slang; |
---|
| 4484 | + char_u *compflags; |
---|
| 4485 | + int flag; |
---|
| 4486 | +{ |
---|
| 4487 | + /* If the flag doesn't appear in sl_compstartflags or sl_compallflags |
---|
| 4488 | + * then it can't possibly compound. */ |
---|
| 4489 | + if (!byte_in_str(sp->ts_complen == sp->ts_compsplit |
---|
| 4490 | + ? slang->sl_compstartflags : slang->sl_compallflags, flag)) |
---|
| 4491 | + return FALSE; |
---|
| 4492 | + |
---|
| 4493 | + /* If there are no wildcards, we can check if the flags collected so far |
---|
| 4494 | + * possibly can form a match with COMPOUNDRULE patterns. This only |
---|
| 4495 | + * makes sense when we have two or more words. */ |
---|
| 4496 | + if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit) |
---|
| 4497 | + { |
---|
| 4498 | + int v; |
---|
| 4499 | + |
---|
| 4500 | + compflags[sp->ts_complen] = flag; |
---|
| 4501 | + compflags[sp->ts_complen + 1] = NUL; |
---|
| 4502 | + v = match_compoundrule(slang, compflags + sp->ts_compsplit); |
---|
| 4503 | + compflags[sp->ts_complen] = NUL; |
---|
| 4504 | + return v; |
---|
| 4505 | + } |
---|
| 4506 | + |
---|
| 4507 | + return TRUE; |
---|
| 4508 | +} |
---|
| 4509 | + |
---|
| 4510 | + |
---|
| 4511 | +/* |
---|
| 4512 | + * Return TRUE if the compound flags in compflags[] match the start of any |
---|
| 4513 | + * compound rule. This is used to stop trying a compound if the flags |
---|
| 4514 | + * collected so far can't possibly match any compound rule. |
---|
| 4515 | + * Caller must check that slang->sl_comprules is not NULL. |
---|
| 4516 | + */ |
---|
| 4517 | + static int |
---|
| 4518 | +match_compoundrule(slang, compflags) |
---|
| 4519 | + slang_T *slang; |
---|
| 4520 | + char_u *compflags; |
---|
| 4521 | +{ |
---|
| 4522 | + char_u *p; |
---|
| 4523 | + int i; |
---|
| 4524 | + int c; |
---|
| 4525 | + |
---|
| 4526 | + /* loop over all the COMPOUNDRULE entries */ |
---|
| 4527 | + for (p = slang->sl_comprules; *p != NUL; ++p) |
---|
| 4528 | + { |
---|
| 4529 | + /* loop over the flags in the compound word we have made, match |
---|
| 4530 | + * them against the current rule entry */ |
---|
| 4531 | + for (i = 0; ; ++i) |
---|
| 4532 | + { |
---|
| 4533 | + c = compflags[i]; |
---|
| 4534 | + if (c == NUL) |
---|
| 4535 | + /* found a rule that matches for the flags we have so far */ |
---|
| 4536 | + return TRUE; |
---|
| 4537 | + if (*p == '/' || *p == NUL) |
---|
| 4538 | + break; /* end of rule, it's too short */ |
---|
| 4539 | + if (*p == '[') |
---|
| 4540 | + { |
---|
| 4541 | + int match = FALSE; |
---|
| 4542 | + |
---|
| 4543 | + /* compare against all the flags in [] */ |
---|
| 4544 | + ++p; |
---|
| 4545 | + while (*p != ']' && *p != NUL) |
---|
| 4546 | + if (*p++ == c) |
---|
| 4547 | + match = TRUE; |
---|
| 4548 | + if (!match) |
---|
| 4549 | + break; /* none matches */ |
---|
| 4550 | + } |
---|
| 4551 | + else if (*p != c) |
---|
| 4552 | + break; /* flag of word doesn't match flag in pattern */ |
---|
| 4553 | + ++p; |
---|
| 4554 | + } |
---|
| 4555 | + |
---|
| 4556 | + /* Skip to the next "/", where the next pattern starts. */ |
---|
| 4557 | + p = vim_strchr(p, '/'); |
---|
| 4558 | + if (p == NULL) |
---|
| 4559 | + break; |
---|
| 4560 | + } |
---|
| 4561 | + |
---|
| 4562 | + /* Checked all the rules and none of them match the flags, so there |
---|
| 4563 | + * can't possibly be a compound starting with these flags. */ |
---|
| 4564 | + return FALSE; |
---|
| 4565 | +} |
---|
| 4566 | + |
---|
| 4567 | +/* |
---|
| 4568 | * Return non-zero if the prefix indicated by "arridx" matches with the prefix |
---|
| 4569 | * ID in "flags" for the word "word". |
---|
| 4570 | * The WF_RAREPFX flag is included in the return value for a rare prefix. |
---|
| 4571 | @@ -2513,9 +2652,11 @@ |
---|
| 4572 | lp->sl_midword = NULL; |
---|
| 4573 | |
---|
| 4574 | vim_free(lp->sl_compprog); |
---|
| 4575 | + vim_free(lp->sl_comprules); |
---|
| 4576 | vim_free(lp->sl_compstartflags); |
---|
| 4577 | vim_free(lp->sl_compallflags); |
---|
| 4578 | lp->sl_compprog = NULL; |
---|
| 4579 | + lp->sl_comprules = NULL; |
---|
| 4580 | lp->sl_compstartflags = NULL; |
---|
| 4581 | lp->sl_compallflags = NULL; |
---|
| 4582 | |
---|
| 4583 | @@ -3460,6 +3601,7 @@ |
---|
| 4584 | char_u *pp; |
---|
| 4585 | char_u *cp; |
---|
| 4586 | char_u *ap; |
---|
| 4587 | + char_u *crp; |
---|
| 4588 | int cnt; |
---|
| 4589 | garray_T *gap; |
---|
| 4590 | |
---|
| 4591 | @@ -3545,6 +3687,12 @@ |
---|
| 4592 | slang->sl_compallflags = ap; |
---|
| 4593 | *ap = NUL; |
---|
| 4594 | |
---|
| 4595 | + /* And a list of all patterns in their original form, for checking whether |
---|
| 4596 | + * compounding may work in match_compoundrule(). This is freed when we |
---|
| 4597 | + * encounter a wildcard, the check doesn't work then. */ |
---|
| 4598 | + crp = alloc(todo + 1); |
---|
| 4599 | + slang->sl_comprules = crp; |
---|
| 4600 | + |
---|
| 4601 | pp = pat; |
---|
| 4602 | *pp++ = '^'; |
---|
| 4603 | *pp++ = '\\'; |
---|
| 4604 | @@ -3587,6 +3735,20 @@ |
---|
| 4605 | atstart = 0; |
---|
| 4606 | } |
---|
| 4607 | } |
---|
| 4608 | + |
---|
| 4609 | + /* Copy flag to "sl_comprules", unless we run into a wildcard. */ |
---|
| 4610 | + if (crp != NULL) |
---|
| 4611 | + { |
---|
| 4612 | + if (c == '+' || c == '*') |
---|
| 4613 | + { |
---|
| 4614 | + vim_free(slang->sl_comprules); |
---|
| 4615 | + slang->sl_comprules = NULL; |
---|
| 4616 | + crp = NULL; |
---|
| 4617 | + } |
---|
| 4618 | + else |
---|
| 4619 | + *crp++ = c; |
---|
| 4620 | + } |
---|
| 4621 | + |
---|
| 4622 | if (c == '/') /* slash separates two items */ |
---|
| 4623 | { |
---|
| 4624 | *pp++ = '\\'; |
---|
| 4625 | @@ -3611,6 +3773,9 @@ |
---|
| 4626 | *pp++ = '$'; |
---|
| 4627 | *pp = NUL; |
---|
| 4628 | |
---|
| 4629 | + if (crp != NULL) |
---|
| 4630 | + *crp = NUL; |
---|
| 4631 | + |
---|
| 4632 | slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT); |
---|
| 4633 | vim_free(pat); |
---|
| 4634 | if (slang->sl_compprog == NULL) |
---|
| 4635 | @@ -4915,6 +5080,7 @@ |
---|
| 4636 | } spellinfo_T; |
---|
| 4637 | |
---|
| 4638 | static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname)); |
---|
| 4639 | +static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount)); |
---|
| 4640 | static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry)); |
---|
| 4641 | static int spell_info_item __ARGS((char_u *s)); |
---|
| 4642 | static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum)); |
---|
| 4643 | @@ -4950,7 +5116,7 @@ |
---|
| 4644 | static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd)); |
---|
| 4645 | static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname)); |
---|
| 4646 | static void clear_node __ARGS((wordnode_T *node)); |
---|
| 4647 | -static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree)); |
---|
| 4648 | +static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree)); |
---|
| 4649 | static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname)); |
---|
| 4650 | static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang)); |
---|
| 4651 | static int sug_maketable __ARGS((spellinfo_T *spin)); |
---|
| 4652 | @@ -5223,8 +5389,7 @@ |
---|
| 4653 | /* Handle non-empty lines. */ |
---|
| 4654 | if (itemcnt > 0) |
---|
| 4655 | { |
---|
| 4656 | - if (STRCMP(items[0], "SET") == 0 && itemcnt == 2 |
---|
| 4657 | - && aff->af_enc == NULL) |
---|
| 4658 | + if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL) |
---|
| 4659 | { |
---|
| 4660 | #ifdef FEAT_MBYTE |
---|
| 4661 | /* Setup for conversion from "ENC" to 'encoding'. */ |
---|
| 4662 | @@ -5239,7 +5404,7 @@ |
---|
| 4663 | smsg((char_u *)_("Conversion in %s not supported"), fname); |
---|
| 4664 | #endif |
---|
| 4665 | } |
---|
| 4666 | - else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2 |
---|
| 4667 | + else if (is_aff_rule(items, itemcnt, "FLAG", 2) |
---|
| 4668 | && aff->af_flagtype == AFT_CHAR) |
---|
| 4669 | { |
---|
| 4670 | if (STRCMP(items[1], "long") == 0) |
---|
| 4671 | @@ -5284,69 +5449,71 @@ |
---|
| 4672 | spin->si_info = p; |
---|
| 4673 | } |
---|
| 4674 | } |
---|
| 4675 | - else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2 |
---|
| 4676 | + else if (is_aff_rule(items, itemcnt, "MIDWORD", 2) |
---|
| 4677 | && midword == NULL) |
---|
| 4678 | { |
---|
| 4679 | midword = getroom_save(spin, items[1]); |
---|
| 4680 | } |
---|
| 4681 | - else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2) |
---|
| 4682 | + else if (is_aff_rule(items, itemcnt, "TRY", 2)) |
---|
| 4683 | { |
---|
| 4684 | /* ignored, we look in the tree for what chars may appear */ |
---|
| 4685 | } |
---|
| 4686 | /* TODO: remove "RAR" later */ |
---|
| 4687 | - else if ((STRCMP(items[0], "RAR") == 0 |
---|
| 4688 | - || STRCMP(items[0], "RARE") == 0) && itemcnt == 2 |
---|
| 4689 | - && aff->af_rare == 0) |
---|
| 4690 | + else if ((is_aff_rule(items, itemcnt, "RAR", 2) |
---|
| 4691 | + || is_aff_rule(items, itemcnt, "RARE", 2)) |
---|
| 4692 | + && aff->af_rare == 0) |
---|
| 4693 | { |
---|
| 4694 | aff->af_rare = affitem2flag(aff->af_flagtype, items[1], |
---|
| 4695 | fname, lnum); |
---|
| 4696 | } |
---|
| 4697 | /* TODO: remove "KEP" later */ |
---|
| 4698 | - else if ((STRCMP(items[0], "KEP") == 0 |
---|
| 4699 | - || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2 |
---|
| 4700 | + else if ((is_aff_rule(items, itemcnt, "KEP", 2) |
---|
| 4701 | + || is_aff_rule(items, itemcnt, "KEEPCASE", 2)) |
---|
| 4702 | && aff->af_keepcase == 0) |
---|
| 4703 | { |
---|
| 4704 | aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1], |
---|
| 4705 | fname, lnum); |
---|
| 4706 | } |
---|
| 4707 | - else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2 |
---|
| 4708 | - && aff->af_bad == 0) |
---|
| 4709 | + else if ((is_aff_rule(items, itemcnt, "BAD", 2) |
---|
| 4710 | + || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2)) |
---|
| 4711 | + && aff->af_bad == 0) |
---|
| 4712 | { |
---|
| 4713 | aff->af_bad = affitem2flag(aff->af_flagtype, items[1], |
---|
| 4714 | fname, lnum); |
---|
| 4715 | } |
---|
| 4716 | - else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2 |
---|
| 4717 | + else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2) |
---|
| 4718 | && aff->af_needaffix == 0) |
---|
| 4719 | { |
---|
| 4720 | aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1], |
---|
| 4721 | fname, lnum); |
---|
| 4722 | } |
---|
| 4723 | - else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2 |
---|
| 4724 | + else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2) |
---|
| 4725 | && aff->af_circumfix == 0) |
---|
| 4726 | { |
---|
| 4727 | aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1], |
---|
| 4728 | fname, lnum); |
---|
| 4729 | } |
---|
| 4730 | - else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2 |
---|
| 4731 | + else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2) |
---|
| 4732 | && aff->af_nosuggest == 0) |
---|
| 4733 | { |
---|
| 4734 | aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1], |
---|
| 4735 | fname, lnum); |
---|
| 4736 | } |
---|
| 4737 | - else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2 |
---|
| 4738 | + else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2) |
---|
| 4739 | + || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2)) |
---|
| 4740 | && aff->af_needcomp == 0) |
---|
| 4741 | { |
---|
| 4742 | aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1], |
---|
| 4743 | fname, lnum); |
---|
| 4744 | } |
---|
| 4745 | - else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2 |
---|
| 4746 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2) |
---|
| 4747 | && aff->af_comproot == 0) |
---|
| 4748 | { |
---|
| 4749 | aff->af_comproot = affitem2flag(aff->af_flagtype, items[1], |
---|
| 4750 | fname, lnum); |
---|
| 4751 | } |
---|
| 4752 | - else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0 |
---|
| 4753 | - && itemcnt == 2 && aff->af_compforbid == 0) |
---|
| 4754 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2) |
---|
| 4755 | + && aff->af_compforbid == 0) |
---|
| 4756 | { |
---|
| 4757 | aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1], |
---|
| 4758 | fname, lnum); |
---|
| 4759 | @@ -5354,8 +5521,8 @@ |
---|
| 4760 | smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), |
---|
| 4761 | fname, lnum); |
---|
| 4762 | } |
---|
| 4763 | - else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0 |
---|
| 4764 | - && itemcnt == 2 && aff->af_comppermit == 0) |
---|
| 4765 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2) |
---|
| 4766 | + && aff->af_comppermit == 0) |
---|
| 4767 | { |
---|
| 4768 | aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1], |
---|
| 4769 | fname, lnum); |
---|
| 4770 | @@ -5363,7 +5530,7 @@ |
---|
| 4771 | smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), |
---|
| 4772 | fname, lnum); |
---|
| 4773 | } |
---|
| 4774 | - else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2 |
---|
| 4775 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2) |
---|
| 4776 | && compflags == NULL) |
---|
| 4777 | { |
---|
| 4778 | /* Turn flag "c" into COMPOUNDRULE compatible string "c+", |
---|
| 4779 | @@ -5376,7 +5543,15 @@ |
---|
| 4780 | compflags = p; |
---|
| 4781 | } |
---|
| 4782 | } |
---|
| 4783 | - else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2) |
---|
| 4784 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2)) |
---|
| 4785 | + { |
---|
| 4786 | + /* We don't use the count, but do check that it's a number and |
---|
| 4787 | + * not COMPOUNDRULE mistyped. */ |
---|
| 4788 | + if (atoi((char *)items[1]) == 0) |
---|
| 4789 | + smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"), |
---|
| 4790 | + fname, lnum, items[1]); |
---|
| 4791 | + } |
---|
| 4792 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) |
---|
| 4793 | { |
---|
| 4794 | /* Concatenate this string to previously defined ones, using a |
---|
| 4795 | * slash to separate them. */ |
---|
| 4796 | @@ -5395,7 +5570,7 @@ |
---|
| 4797 | compflags = p; |
---|
| 4798 | } |
---|
| 4799 | } |
---|
| 4800 | - else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2 |
---|
| 4801 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2) |
---|
| 4802 | && compmax == 0) |
---|
| 4803 | { |
---|
| 4804 | compmax = atoi((char *)items[1]); |
---|
| 4805 | @@ -5403,7 +5578,7 @@ |
---|
| 4806 | smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), |
---|
| 4807 | fname, lnum, items[1]); |
---|
| 4808 | } |
---|
| 4809 | - else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2 |
---|
| 4810 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2) |
---|
| 4811 | && compminlen == 0) |
---|
| 4812 | { |
---|
| 4813 | compminlen = atoi((char *)items[1]); |
---|
| 4814 | @@ -5411,7 +5586,7 @@ |
---|
| 4815 | smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"), |
---|
| 4816 | fname, lnum, items[1]); |
---|
| 4817 | } |
---|
| 4818 | - else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2 |
---|
| 4819 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2) |
---|
| 4820 | && compsylmax == 0) |
---|
| 4821 | { |
---|
| 4822 | compsylmax = atoi((char *)items[1]); |
---|
| 4823 | @@ -5419,32 +5594,29 @@ |
---|
| 4824 | smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), |
---|
| 4825 | fname, lnum, items[1]); |
---|
| 4826 | } |
---|
| 4827 | - else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1) |
---|
| 4828 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1)) |
---|
| 4829 | { |
---|
| 4830 | compoptions |= COMP_CHECKDUP; |
---|
| 4831 | } |
---|
| 4832 | - else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1) |
---|
| 4833 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1)) |
---|
| 4834 | { |
---|
| 4835 | compoptions |= COMP_CHECKREP; |
---|
| 4836 | } |
---|
| 4837 | - else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1) |
---|
| 4838 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1)) |
---|
| 4839 | { |
---|
| 4840 | compoptions |= COMP_CHECKCASE; |
---|
| 4841 | } |
---|
| 4842 | - else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0 |
---|
| 4843 | - && itemcnt == 1) |
---|
| 4844 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1)) |
---|
| 4845 | { |
---|
| 4846 | compoptions |= COMP_CHECKTRIPLE; |
---|
| 4847 | } |
---|
| 4848 | - else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0 |
---|
| 4849 | - && itemcnt == 2) |
---|
| 4850 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2)) |
---|
| 4851 | { |
---|
| 4852 | if (atoi((char *)items[1]) == 0) |
---|
| 4853 | smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), |
---|
| 4854 | fname, lnum, items[1]); |
---|
| 4855 | } |
---|
| 4856 | - else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0 |
---|
| 4857 | - && itemcnt == 3) |
---|
| 4858 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3)) |
---|
| 4859 | { |
---|
| 4860 | garray_T *gap = &spin->si_comppat; |
---|
| 4861 | int i; |
---|
| 4862 | @@ -5463,24 +5635,24 @@ |
---|
| 4863 | = getroom_save(spin, items[2]); |
---|
| 4864 | } |
---|
| 4865 | } |
---|
| 4866 | - else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2 |
---|
| 4867 | + else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2) |
---|
| 4868 | && syllable == NULL) |
---|
| 4869 | { |
---|
| 4870 | syllable = getroom_save(spin, items[1]); |
---|
| 4871 | } |
---|
| 4872 | - else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1) |
---|
| 4873 | + else if (is_aff_rule(items, itemcnt, "NOBREAK", 1)) |
---|
| 4874 | { |
---|
| 4875 | spin->si_nobreak = TRUE; |
---|
| 4876 | } |
---|
| 4877 | - else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1) |
---|
| 4878 | + else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1)) |
---|
| 4879 | { |
---|
| 4880 | spin->si_nosplitsugs = TRUE; |
---|
| 4881 | } |
---|
| 4882 | - else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1) |
---|
| 4883 | + else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1)) |
---|
| 4884 | { |
---|
| 4885 | spin->si_nosugfile = TRUE; |
---|
| 4886 | } |
---|
| 4887 | - else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1) |
---|
| 4888 | + else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1)) |
---|
| 4889 | { |
---|
| 4890 | aff->af_pfxpostpone = TRUE; |
---|
| 4891 | } |
---|
| 4892 | @@ -5771,24 +5943,20 @@ |
---|
| 4893 | } |
---|
| 4894 | } |
---|
| 4895 | } |
---|
| 4896 | - else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2 |
---|
| 4897 | - && fol == NULL) |
---|
| 4898 | + else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL) |
---|
| 4899 | { |
---|
| 4900 | fol = vim_strsave(items[1]); |
---|
| 4901 | } |
---|
| 4902 | - else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2 |
---|
| 4903 | - && low == NULL) |
---|
| 4904 | + else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL) |
---|
| 4905 | { |
---|
| 4906 | low = vim_strsave(items[1]); |
---|
| 4907 | } |
---|
| 4908 | - else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2 |
---|
| 4909 | - && upp == NULL) |
---|
| 4910 | + else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL) |
---|
| 4911 | { |
---|
| 4912 | upp = vim_strsave(items[1]); |
---|
| 4913 | } |
---|
| 4914 | - else if ((STRCMP(items[0], "REP") == 0 |
---|
| 4915 | - || STRCMP(items[0], "REPSAL") == 0) |
---|
| 4916 | - && itemcnt == 2) |
---|
| 4917 | + else if (is_aff_rule(items, itemcnt, "REP", 2) |
---|
| 4918 | + || is_aff_rule(items, itemcnt, "REPSAL", 2)) |
---|
| 4919 | { |
---|
| 4920 | /* Ignore REP/REPSAL count */; |
---|
| 4921 | if (!isdigit(*items[1])) |
---|
| 4922 | @@ -5819,7 +5987,7 @@ |
---|
| 4923 | : &spin->si_rep, items[1], items[2]); |
---|
| 4924 | } |
---|
| 4925 | } |
---|
| 4926 | - else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2) |
---|
| 4927 | + else if (is_aff_rule(items, itemcnt, "MAP", 2)) |
---|
| 4928 | { |
---|
| 4929 | /* MAP item or count */ |
---|
| 4930 | if (!found_map) |
---|
| 4931 | @@ -5856,9 +6024,8 @@ |
---|
| 4932 | ga_append(&spin->si_map, '/'); |
---|
| 4933 | } |
---|
| 4934 | } |
---|
| 4935 | - /* Accept "SAL from to" and "SAL from to # comment". */ |
---|
| 4936 | - else if (STRCMP(items[0], "SAL") == 0 |
---|
| 4937 | - && (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#'))) |
---|
| 4938 | + /* Accept "SAL from to" and "SAL from to #comment". */ |
---|
| 4939 | + else if (is_aff_rule(items, itemcnt, "SAL", 3)) |
---|
| 4940 | { |
---|
| 4941 | if (do_sal) |
---|
| 4942 | { |
---|
| 4943 | @@ -5877,12 +6044,12 @@ |
---|
| 4944 | : items[2]); |
---|
| 4945 | } |
---|
| 4946 | } |
---|
| 4947 | - else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2 |
---|
| 4948 | + else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2) |
---|
| 4949 | && sofofrom == NULL) |
---|
| 4950 | { |
---|
| 4951 | sofofrom = getroom_save(spin, items[1]); |
---|
| 4952 | } |
---|
| 4953 | - else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2 |
---|
| 4954 | + else if (is_aff_rule(items, itemcnt, "SOFOTO", 2) |
---|
| 4955 | && sofoto == NULL) |
---|
| 4956 | { |
---|
| 4957 | sofoto = getroom_save(spin, items[1]); |
---|
| 4958 | @@ -5980,7 +6147,7 @@ |
---|
| 4959 | else if (spin->si_newprefID == 0 || spin->si_newprefID == 127) |
---|
| 4960 | MSG(_("Too many compound flags")); |
---|
| 4961 | else |
---|
| 4962 | - MSG(_("Too many posponed prefixes and/or compound flags")); |
---|
| 4963 | + MSG(_("Too many postponed prefixes and/or compound flags")); |
---|
| 4964 | } |
---|
| 4965 | |
---|
| 4966 | if (syllable != NULL) |
---|
| 4967 | @@ -6017,6 +6184,22 @@ |
---|
| 4968 | } |
---|
| 4969 | |
---|
| 4970 | /* |
---|
| 4971 | + * Return TRUE when items[0] equals "rulename", there are "mincount" items or |
---|
| 4972 | + * a comment is following after item "mincount". |
---|
| 4973 | + */ |
---|
| 4974 | + static int |
---|
| 4975 | +is_aff_rule(items, itemcnt, rulename, mincount) |
---|
| 4976 | + char_u **items; |
---|
| 4977 | + int itemcnt; |
---|
| 4978 | + char *rulename; |
---|
| 4979 | + int mincount; |
---|
| 4980 | +{ |
---|
| 4981 | + return (STRCMP(items[0], rulename) == 0 |
---|
| 4982 | + && (itemcnt == mincount |
---|
| 4983 | + || (itemcnt > mincount && items[mincount][0] == '#'))); |
---|
| 4984 | +} |
---|
| 4985 | + |
---|
| 4986 | +/* |
---|
| 4987 | * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from |
---|
| 4988 | * ae_flags to ae_comppermit and ae_compforbid. |
---|
| 4989 | */ |
---|
| 4990 | @@ -7926,6 +8109,8 @@ |
---|
| 4991 | char_u *p; |
---|
| 4992 | int rr; |
---|
| 4993 | int retval = OK; |
---|
| 4994 | + size_t fwv = 1; /* collect return value of fwrite() to avoid |
---|
| 4995 | + warnings from picky compiler */ |
---|
| 4996 | |
---|
| 4997 | fd = mch_fopen((char *)fname, "w"); |
---|
| 4998 | if (fd == NULL) |
---|
| 4999 | @@ -7936,11 +8121,11 @@ |
---|
| 5000 | |
---|
| 5001 | /* <HEADER>: <fileID> <versionnr> */ |
---|
| 5002 | /* <fileID> */ |
---|
| 5003 | - if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1) |
---|
| 5004 | - { |
---|
| 5005 | - EMSG(_(e_write)); |
---|
| 5006 | - retval = FAIL; |
---|
| 5007 | - } |
---|
| 5008 | + fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd); |
---|
| 5009 | + if (fwv != (size_t)1) |
---|
| 5010 | + /* Catch first write error, don't try writing more. */ |
---|
| 5011 | + goto theend; |
---|
| 5012 | + |
---|
| 5013 | putc(VIMSPELLVERSION, fd); /* <versionnr> */ |
---|
| 5014 | |
---|
| 5015 | /* |
---|
| 5016 | @@ -7955,7 +8140,7 @@ |
---|
| 5017 | |
---|
| 5018 | i = (int)STRLEN(spin->si_info); |
---|
| 5019 | put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ |
---|
| 5020 | - fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */ |
---|
| 5021 | + fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */ |
---|
| 5022 | } |
---|
| 5023 | |
---|
| 5024 | /* SN_REGION: <regionname> ... |
---|
| 5025 | @@ -7966,7 +8151,7 @@ |
---|
| 5026 | putc(SNF_REQUIRED, fd); /* <sectionflags> */ |
---|
| 5027 | l = spin->si_region_count * 2; |
---|
| 5028 | put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ |
---|
| 5029 | - fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd); |
---|
| 5030 | + fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd); |
---|
| 5031 | /* <regionname> ... */ |
---|
| 5032 | regionmask = (1 << spin->si_region_count) - 1; |
---|
| 5033 | } |
---|
| 5034 | @@ -8016,7 +8201,7 @@ |
---|
| 5035 | } |
---|
| 5036 | |
---|
| 5037 | put_bytes(fd, (long_u)l, 2); /* <folcharslen> */ |
---|
| 5038 | - fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */ |
---|
| 5039 | + fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */ |
---|
| 5040 | } |
---|
| 5041 | |
---|
| 5042 | /* SN_MIDWORD: <midword> */ |
---|
| 5043 | @@ -8027,7 +8212,8 @@ |
---|
| 5044 | |
---|
| 5045 | i = (int)STRLEN(spin->si_midword); |
---|
| 5046 | put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ |
---|
| 5047 | - fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */ |
---|
| 5048 | + fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); |
---|
| 5049 | + /* <midword> */ |
---|
| 5050 | } |
---|
| 5051 | |
---|
| 5052 | /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */ |
---|
| 5053 | @@ -8113,7 +8299,8 @@ |
---|
| 5054 | p = rr == 1 ? ftp->ft_from : ftp->ft_to; |
---|
| 5055 | l = (int)STRLEN(p); |
---|
| 5056 | putc(l, fd); |
---|
| 5057 | - fwrite(p, l, (size_t)1, fd); |
---|
| 5058 | + if (l > 0) |
---|
| 5059 | + fwv &= fwrite(p, l, (size_t)1, fd); |
---|
| 5060 | } |
---|
| 5061 | } |
---|
| 5062 | |
---|
| 5063 | @@ -8131,11 +8318,11 @@ |
---|
| 5064 | /* <sectionlen> */ |
---|
| 5065 | |
---|
| 5066 | put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */ |
---|
| 5067 | - fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */ |
---|
| 5068 | + fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */ |
---|
| 5069 | |
---|
| 5070 | l = (int)STRLEN(spin->si_sofoto); |
---|
| 5071 | put_bytes(fd, (long_u)l, 2); /* <sofotolen> */ |
---|
| 5072 | - fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */ |
---|
| 5073 | + fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */ |
---|
| 5074 | } |
---|
| 5075 | |
---|
| 5076 | /* SN_WORDS: <word> ... |
---|
| 5077 | @@ -8160,7 +8347,7 @@ |
---|
| 5078 | l = (int)STRLEN(hi->hi_key) + 1; |
---|
| 5079 | len += l; |
---|
| 5080 | if (round == 2) /* <word> */ |
---|
| 5081 | - fwrite(hi->hi_key, (size_t)l, (size_t)1, fd); |
---|
| 5082 | + fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd); |
---|
| 5083 | --todo; |
---|
| 5084 | } |
---|
| 5085 | if (round == 1) |
---|
| 5086 | @@ -8176,7 +8363,7 @@ |
---|
| 5087 | putc(0, fd); /* <sectionflags> */ |
---|
| 5088 | l = spin->si_map.ga_len; |
---|
| 5089 | put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ |
---|
| 5090 | - fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd); |
---|
| 5091 | + fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd); |
---|
| 5092 | /* <mapstr> */ |
---|
| 5093 | } |
---|
| 5094 | |
---|
| 5095 | @@ -8232,10 +8419,11 @@ |
---|
| 5096 | { |
---|
| 5097 | p = ((char_u **)(spin->si_comppat.ga_data))[i]; |
---|
| 5098 | putc((int)STRLEN(p), fd); /* <comppatlen> */ |
---|
| 5099 | - fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */ |
---|
| 5100 | + fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd); |
---|
| 5101 | + /* <comppattext> */ |
---|
| 5102 | } |
---|
| 5103 | /* <compflags> */ |
---|
| 5104 | - fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags), |
---|
| 5105 | + fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags), |
---|
| 5106 | (size_t)1, fd); |
---|
| 5107 | } |
---|
| 5108 | |
---|
| 5109 | @@ -8259,7 +8447,8 @@ |
---|
| 5110 | |
---|
| 5111 | l = (int)STRLEN(spin->si_syllable); |
---|
| 5112 | put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ |
---|
| 5113 | - fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */ |
---|
| 5114 | + fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); |
---|
| 5115 | + /* <syllable> */ |
---|
| 5116 | } |
---|
| 5117 | |
---|
| 5118 | /* end of <SECTIONS> */ |
---|
| 5119 | @@ -8295,13 +8484,18 @@ |
---|
| 5120 | (void)put_node(fd, tree, 0, regionmask, round == 3); |
---|
| 5121 | } |
---|
| 5122 | |
---|
| 5123 | - /* Write another byte to check for errors. */ |
---|
| 5124 | + /* Write another byte to check for errors (file system full). */ |
---|
| 5125 | if (putc(0, fd) == EOF) |
---|
| 5126 | retval = FAIL; |
---|
| 5127 | - |
---|
| 5128 | +theend: |
---|
| 5129 | if (fclose(fd) == EOF) |
---|
| 5130 | retval = FAIL; |
---|
| 5131 | |
---|
| 5132 | + if (fwv != (size_t)1) |
---|
| 5133 | + retval = FAIL; |
---|
| 5134 | + if (retval == FAIL) |
---|
| 5135 | + EMSG(_(e_write)); |
---|
| 5136 | + |
---|
| 5137 | return retval; |
---|
| 5138 | } |
---|
| 5139 | |
---|
| 5140 | @@ -9890,6 +10084,7 @@ |
---|
| 5141 | char_u *p; |
---|
| 5142 | int len; |
---|
| 5143 | int totlen; |
---|
| 5144 | + size_t x = 1; /* collect return value of fwrite() */ |
---|
| 5145 | |
---|
| 5146 | if (fd != NULL) |
---|
| 5147 | put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */ |
---|
| 5148 | @@ -9906,7 +10101,7 @@ |
---|
| 5149 | if (fd != NULL) |
---|
| 5150 | { |
---|
| 5151 | fputc(len, fd); |
---|
| 5152 | - fwrite(p, (size_t)len, (size_t)1, fd); |
---|
| 5153 | + x &= fwrite(p, (size_t)len, (size_t)1, fd); |
---|
| 5154 | } |
---|
| 5155 | totlen += len; |
---|
| 5156 | } |
---|
| 5157 | @@ -11480,15 +11675,24 @@ |
---|
| 5158 | vim_strncpy(preword + sp->ts_prewordlen, |
---|
| 5159 | tword + sp->ts_splitoff, |
---|
| 5160 | sp->ts_twordlen - sp->ts_splitoff); |
---|
| 5161 | - p = preword; |
---|
| 5162 | - while (*skiptowhite(p) != NUL) |
---|
| 5163 | - p = skipwhite(skiptowhite(p)); |
---|
| 5164 | - if (fword_ends && !can_compound(slang, p, |
---|
| 5165 | - compflags + sp->ts_compsplit)) |
---|
| 5166 | - /* Compound is not allowed. But it may still be |
---|
| 5167 | - * possible if we add another (short) word. */ |
---|
| 5168 | + |
---|
| 5169 | + /* Verify CHECKCOMPOUNDPATTERN rules. */ |
---|
| 5170 | + if (match_checkcompoundpattern(preword, sp->ts_prewordlen, |
---|
| 5171 | + &slang->sl_comppat)) |
---|
| 5172 | compound_ok = FALSE; |
---|
| 5173 | |
---|
| 5174 | + if (compound_ok) |
---|
| 5175 | + { |
---|
| 5176 | + p = preword; |
---|
| 5177 | + while (*skiptowhite(p) != NUL) |
---|
| 5178 | + p = skipwhite(skiptowhite(p)); |
---|
| 5179 | + if (fword_ends && !can_compound(slang, p, |
---|
| 5180 | + compflags + sp->ts_compsplit)) |
---|
| 5181 | + /* Compound is not allowed. But it may still be |
---|
| 5182 | + * possible if we add another (short) word. */ |
---|
| 5183 | + compound_ok = FALSE; |
---|
| 5184 | + } |
---|
| 5185 | + |
---|
| 5186 | /* Get pointer to last char of previous word. */ |
---|
| 5187 | p = preword + sp->ts_prewordlen; |
---|
| 5188 | mb_ptr_back(preword, p); |
---|
| 5189 | @@ -11685,10 +11889,9 @@ |
---|
| 5190 | && (slang->sl_compsylmax < MAXWLEN |
---|
| 5191 | || sp->ts_complen + 1 - sp->ts_compsplit |
---|
| 5192 | < slang->sl_compmax) |
---|
| 5193 | - && (byte_in_str(sp->ts_complen == sp->ts_compsplit |
---|
| 5194 | - ? slang->sl_compstartflags |
---|
| 5195 | - : slang->sl_compallflags, |
---|
| 5196 | - ((unsigned)flags >> 24)))) |
---|
| 5197 | + && (can_be_compound(sp, slang, |
---|
| 5198 | + compflags, ((unsigned)flags >> 24)))) |
---|
| 5199 | + |
---|
| 5200 | { |
---|
| 5201 | try_compound = TRUE; |
---|
| 5202 | compflags[sp->ts_complen] = ((unsigned)flags >> 24); |
---|
| 5203 | diff -Naur vim72.orig/src/structs.h vim72/src/structs.h |
---|
| 5204 | --- vim72.orig/src/structs.h 2008-07-30 13:02:50.000000000 -0700 |
---|
[bef6db9] | 5205 | +++ vim72/src/structs.h 2009-01-19 00:09:02.000000000 -0800 |
---|
[d25b7db] | 5206 | @@ -459,7 +459,7 @@ |
---|
| 5207 | typedef struct |
---|
| 5208 | { |
---|
| 5209 | int hide; /* TRUE when ":hide" was used */ |
---|
| 5210 | -# ifdef FEAT_BROWSE |
---|
| 5211 | +# ifdef FEAT_BROWSE_CMD |
---|
| 5212 | int browse; /* TRUE to invoke file dialog */ |
---|
| 5213 | # endif |
---|
| 5214 | # ifdef FEAT_WINDOWS |
---|
| 5215 | @@ -1784,10 +1784,15 @@ |
---|
| 5216 | #endif |
---|
| 5217 | |
---|
| 5218 | /* |
---|
| 5219 | - * The next three specify the offsets for displaying the buffer: |
---|
| 5220 | + * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for |
---|
| 5221 | + * displaying the buffer. |
---|
| 5222 | */ |
---|
| 5223 | linenr_T w_topline; /* buffer line number of the line at the |
---|
| 5224 | top of the window */ |
---|
| 5225 | +#ifdef FEAT_AUTOCMD |
---|
| 5226 | + char w_topline_was_set; /* flag set to TRUE when topline is set, |
---|
| 5227 | + e.g. by winrestview() */ |
---|
| 5228 | +#endif |
---|
| 5229 | #ifdef FEAT_DIFF |
---|
| 5230 | int w_topfill; /* number of filler lines above w_topline */ |
---|
| 5231 | int w_old_topfill; /* w_topfill at last redraw */ |
---|
| 5232 | diff -Naur vim72.orig/src/tag.c vim72/src/tag.c |
---|
| 5233 | --- vim72.orig/src/tag.c 2008-07-16 14:31:30.000000000 -0700 |
---|
[bef6db9] | 5234 | +++ vim72/src/tag.c 2009-01-19 00:10:57.000000000 -0800 |
---|
| 5235 | @@ -515,7 +515,7 @@ |
---|
| 5236 | * If a count is supplied to the ":tag <name>" command, then |
---|
| 5237 | * jump to count'th matching tag. |
---|
| 5238 | */ |
---|
| 5239 | - if (type == DT_TAG && count > 0) |
---|
| 5240 | + if (type == DT_TAG && *tag != NUL && count > 0) |
---|
| 5241 | cur_match = count - 1; |
---|
| 5242 | |
---|
| 5243 | if (type == DT_SELECT || type == DT_JUMP |
---|
[d25b7db] | 5244 | @@ -2725,7 +2725,24 @@ |
---|
| 5245 | */ |
---|
| 5246 | p_7f = vim_strchr(lbuf, 0x7f); |
---|
| 5247 | if (p_7f == NULL) |
---|
| 5248 | + { |
---|
| 5249 | +etag_fail: |
---|
| 5250 | + if (vim_strchr(lbuf, '\n') == NULL) |
---|
| 5251 | + { |
---|
| 5252 | + /* Truncated line. Ignore it. */ |
---|
| 5253 | + if (p_verbose >= 5) |
---|
| 5254 | + { |
---|
| 5255 | + verbose_enter(); |
---|
| 5256 | + MSG(_("Ignoring long line in tags file")); |
---|
| 5257 | + verbose_leave(); |
---|
| 5258 | + } |
---|
| 5259 | + tagp->command = lbuf; |
---|
| 5260 | + tagp->tagname = lbuf; |
---|
| 5261 | + tagp->tagname_end = lbuf; |
---|
| 5262 | + return OK; |
---|
| 5263 | + } |
---|
| 5264 | return FAIL; |
---|
| 5265 | + } |
---|
| 5266 | |
---|
| 5267 | /* Find ^A. If not found the line number is after the 0x7f */ |
---|
| 5268 | p = vim_strchr(p_7f, Ctrl_A); |
---|
| 5269 | @@ -2735,7 +2752,7 @@ |
---|
| 5270 | ++p; |
---|
| 5271 | |
---|
| 5272 | if (!VIM_ISDIGIT(*p)) /* check for start of line number */ |
---|
| 5273 | - return FAIL; |
---|
| 5274 | + goto etag_fail; |
---|
| 5275 | tagp->command = p; |
---|
| 5276 | |
---|
| 5277 | |
---|
| 5278 | @@ -2749,7 +2766,7 @@ |
---|
| 5279 | /* find end of tagname */ |
---|
| 5280 | for (p = p_7f - 1; !vim_iswordc(*p); --p) |
---|
| 5281 | if (p == lbuf) |
---|
| 5282 | - return FAIL; |
---|
| 5283 | + goto etag_fail; |
---|
| 5284 | tagp->tagname_end = p + 1; |
---|
| 5285 | while (p >= lbuf && vim_iswordc(*p)) |
---|
| 5286 | --p; |
---|
| 5287 | diff -Naur vim72.orig/src/testdir/Make_ming.mak vim72/src/testdir/Make_ming.mak |
---|
| 5288 | --- vim72.orig/src/testdir/Make_ming.mak 1969-12-31 16:00:00.000000000 -0800 |
---|
[bef6db9] | 5289 | +++ vim72/src/testdir/Make_ming.mak 2009-01-19 00:08:05.000000000 -0800 |
---|
[d25b7db] | 5290 | @@ -0,0 +1,91 @@ |
---|
| 5291 | +# Makefile to run tests for Vim, on Dos-like machines |
---|
| 5292 | +# with sh.exe or zsh.exe in the path or not. |
---|
| 5293 | +# |
---|
| 5294 | +# Author: Bill McCarthy |
---|
| 5295 | +# |
---|
| 5296 | +# Note that test54 has been removed until it is fixed. |
---|
| 5297 | +# |
---|
| 5298 | +# Requires a set of Unix tools: echo, diff, etc. |
---|
| 5299 | + |
---|
| 5300 | +ifneq (sh.exe, $(SHELL)) |
---|
| 5301 | +DEL = rm -f |
---|
| 5302 | +MV = mv |
---|
| 5303 | +CP = cp |
---|
| 5304 | +DIRSLASH = / |
---|
| 5305 | +else |
---|
| 5306 | +DEL = del |
---|
| 5307 | +MV = rename |
---|
| 5308 | +CP = copy |
---|
| 5309 | +DIRSLASH = \\ |
---|
| 5310 | +endif |
---|
| 5311 | + |
---|
| 5312 | +VIMPROG = ..$(DIRSLASH)vim |
---|
| 5313 | + |
---|
| 5314 | +# Omitted: |
---|
| 5315 | +# test2 "\\tmp" doesn't work. |
---|
| 5316 | +# test10 'errorformat' is different |
---|
| 5317 | +# test12 can't unlink a swap file |
---|
| 5318 | +# test25 uses symbolic link |
---|
| 5319 | +# test27 can't edit file with "*" in file name |
---|
| 5320 | +# test31 16 bit version runs out of memory... |
---|
| 5321 | + |
---|
| 5322 | +SCRIPTS16 = test1.out test19.out test20.out test22.out \ |
---|
| 5323 | + test23.out test24.out test28.out test29.out \ |
---|
| 5324 | + test35.out test36.out test43.out \ |
---|
| 5325 | + test44.out test45.out test46.out test47.out \ |
---|
| 5326 | + test48.out test51.out test53.out \ |
---|
| 5327 | + test55.out test56.out test57.out test58.out test59.out \ |
---|
| 5328 | + test60.out test61.out test62.out test63.out test64.out |
---|
| 5329 | + |
---|
| 5330 | +# Had to remove test54 which doesn't work yet. |
---|
| 5331 | +# test54.out |
---|
| 5332 | + |
---|
| 5333 | +SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ |
---|
| 5334 | + test8.out test9.out test11.out test13.out test14.out \ |
---|
| 5335 | + test15.out test17.out test18.out test21.out test26.out \ |
---|
| 5336 | + test30.out test31.out test32.out test33.out test34.out \ |
---|
| 5337 | + test37.out test38.out test39.out test40.out test41.out \ |
---|
| 5338 | + test42.out test52.out test65.out |
---|
| 5339 | + |
---|
| 5340 | +SCRIPTS32 = test50.out |
---|
| 5341 | + |
---|
| 5342 | +SCRIPTS_GUI = test16.out |
---|
| 5343 | + |
---|
| 5344 | +.SUFFIXES: .in .out |
---|
| 5345 | + |
---|
| 5346 | +vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32) |
---|
| 5347 | + echo ALL DONE |
---|
| 5348 | + |
---|
| 5349 | +nongui: fixff $(SCRIPTS16) $(SCRIPTS) |
---|
| 5350 | + echo ALL DONE |
---|
| 5351 | + |
---|
| 5352 | +small: |
---|
| 5353 | + echo ALL DONE |
---|
| 5354 | + |
---|
| 5355 | +gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) |
---|
| 5356 | + echo ALL DONE |
---|
| 5357 | + |
---|
| 5358 | +win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) |
---|
| 5359 | + echo ALL DONE |
---|
| 5360 | + |
---|
| 5361 | +fixff: |
---|
| 5362 | + -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok |
---|
| 5363 | + |
---|
| 5364 | +clean: |
---|
| 5365 | + -$(DEL) *.out |
---|
| 5366 | + -$(DEL) test.ok |
---|
| 5367 | + -$(DEL) small.vim |
---|
| 5368 | + -$(DEL) tiny.vim |
---|
| 5369 | + -$(DEL) mbyte.vim |
---|
| 5370 | + -$(DEL) X* |
---|
| 5371 | + -$(DEL) viminfo |
---|
| 5372 | + |
---|
| 5373 | +.in.out: |
---|
| 5374 | + $(CP) $*.ok test.ok |
---|
| 5375 | + $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in |
---|
| 5376 | + diff test.out $*.ok |
---|
| 5377 | + -$(DEL) $*.out |
---|
| 5378 | + $(MV) test.out $*.out |
---|
| 5379 | + -$(DEL) X* |
---|
| 5380 | + -$(DEL) test.ok |
---|
| 5381 | + -$(DEL) viminfo |
---|
| 5382 | diff -Naur vim72.orig/src/testdir/Makefile vim72/src/testdir/Makefile |
---|
| 5383 | --- vim72.orig/src/testdir/Makefile 2008-06-19 13:29:46.000000000 -0700 |
---|
[bef6db9] | 5384 | +++ vim72/src/testdir/Makefile 2009-01-19 00:07:44.000000000 -0800 |
---|
[d25b7db] | 5385 | @@ -26,15 +26,17 @@ |
---|
| 5386 | |
---|
| 5387 | .SUFFIXES: .in .out |
---|
| 5388 | |
---|
| 5389 | -nongui: nolog $(SCRIPTS) |
---|
| 5390 | - @echo |
---|
| 5391 | - @cat test.log |
---|
| 5392 | - @echo ALL DONE |
---|
| 5393 | +nongui: nolog $(SCRIPTS) report |
---|
| 5394 | + |
---|
| 5395 | +gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report |
---|
| 5396 | |
---|
| 5397 | -gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) |
---|
| 5398 | +report: |
---|
| 5399 | @echo |
---|
| 5400 | - @cat test.log |
---|
| 5401 | - @echo ALL DONE |
---|
| 5402 | + @echo 'Test results:' |
---|
| 5403 | + @/bin/sh -c "if test -f test.log; \ |
---|
| 5404 | + then cat test.log; echo TEST FAILURE; exit 1; \ |
---|
| 5405 | + else echo ALL DONE; \ |
---|
| 5406 | + fi" |
---|
| 5407 | |
---|
| 5408 | $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG) |
---|
| 5409 | |
---|
| 5410 | @@ -71,4 +73,4 @@ |
---|
| 5411 | test60.out: test60.vim |
---|
| 5412 | |
---|
| 5413 | nolog: |
---|
| 5414 | - -echo Test results: >test.log |
---|
| 5415 | + -rm -f test.log |
---|
| 5416 | diff -Naur vim72.orig/src/testdir/test42.ok vim72/src/testdir/test42.ok |
---|
| 5417 | --- vim72.orig/src/testdir/test42.ok 2008-02-20 04:27:37.000000000 -0800 |
---|
[bef6db9] | 5418 | +++ vim72/src/testdir/test42.ok 2009-01-19 00:08:36.000000000 -0800 |
---|
[d25b7db] | 5419 | @@ -20,7 +20,7 @@ |
---|
| 5420 | ucs-2 |
---|
| 5421 | |
---|
| 5422 | |
---|
| 5423 | - fileencoding=ucs-2le |
---|
| 5424 | + fileencoding=utf-16le |
---|
| 5425 | bomb |
---|
| 5426 | ucs-2le |
---|
| 5427 | |
---|
| 5428 | diff -Naur vim72.orig/src/ui.c vim72/src/ui.c |
---|
| 5429 | --- vim72.orig/src/ui.c 2008-07-14 11:14:56.000000000 -0700 |
---|
[bef6db9] | 5430 | +++ vim72/src/ui.c 2009-01-19 00:09:40.000000000 -0800 |
---|
[d25b7db] | 5431 | @@ -1820,7 +1820,7 @@ |
---|
| 5432 | #ifdef HAVE_DUP |
---|
| 5433 | /* Use stderr for stdin, also works for shell commands. */ |
---|
| 5434 | close(0); |
---|
| 5435 | - dup(2); |
---|
| 5436 | + ignored = dup(2); |
---|
| 5437 | #else |
---|
| 5438 | read_cmd_fd = 2; /* read from stderr instead of stdin */ |
---|
| 5439 | #endif |
---|
| 5440 | @@ -2020,7 +2020,7 @@ |
---|
| 5441 | |
---|
| 5442 | if (value == NULL || *length == 0) |
---|
| 5443 | { |
---|
| 5444 | - clip_free_selection(cbd); /* ??? [what's the query?] */ |
---|
| 5445 | + clip_free_selection(cbd); /* nothing received, clear register */ |
---|
| 5446 | *(int *)success = FALSE; |
---|
| 5447 | return; |
---|
| 5448 | } |
---|
| 5449 | @@ -2076,7 +2076,7 @@ |
---|
| 5450 | text_prop.value = (unsigned char *)value; |
---|
| 5451 | text_prop.encoding = *type; |
---|
| 5452 | text_prop.format = *format; |
---|
| 5453 | - text_prop.nitems = STRLEN(value); |
---|
| 5454 | + text_prop.nitems = len; |
---|
| 5455 | status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop, |
---|
| 5456 | &text_list, &n_text); |
---|
| 5457 | if (status != Success || n_text < 1) |
---|
| 5458 | @@ -2110,6 +2110,8 @@ |
---|
| 5459 | int i; |
---|
| 5460 | int nbytes = 0; |
---|
| 5461 | char_u *buffer; |
---|
| 5462 | + time_t start_time; |
---|
| 5463 | + int timed_out = FALSE; |
---|
| 5464 | |
---|
| 5465 | for (i = |
---|
| 5466 | #ifdef FEAT_MBYTE |
---|
| 5467 | @@ -2129,6 +2131,7 @@ |
---|
| 5468 | case 3: type = text_atom; break; |
---|
| 5469 | default: type = XA_STRING; |
---|
| 5470 | } |
---|
| 5471 | + success = MAYBE; |
---|
| 5472 | XtGetSelectionValue(myShell, cbd->sel_atom, type, |
---|
| 5473 | clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime); |
---|
| 5474 | |
---|
| 5475 | @@ -2141,27 +2144,48 @@ |
---|
| 5476 | * characters, then they will appear before the one that requested the |
---|
| 5477 | * paste! Don't worry, we will catch up with any other events later. |
---|
| 5478 | */ |
---|
| 5479 | - for (;;) |
---|
| 5480 | + start_time = time(NULL); |
---|
| 5481 | + while (success == MAYBE) |
---|
| 5482 | { |
---|
| 5483 | - if (XCheckTypedEvent(dpy, SelectionNotify, &event)) |
---|
| 5484 | - break; |
---|
| 5485 | - if (XCheckTypedEvent(dpy, SelectionRequest, &event)) |
---|
| 5486 | - /* We may get a SelectionRequest here and if we don't handle |
---|
| 5487 | - * it we hang. KDE klipper does this, for example. */ |
---|
| 5488 | + if (XCheckTypedEvent(dpy, SelectionNotify, &event) |
---|
| 5489 | + || XCheckTypedEvent(dpy, SelectionRequest, &event) |
---|
| 5490 | + || XCheckTypedEvent(dpy, PropertyNotify, &event)) |
---|
| 5491 | + { |
---|
| 5492 | + /* This is where clip_x11_request_selection_cb() should be |
---|
| 5493 | + * called. It may actually happen a bit later, so we loop |
---|
| 5494 | + * until "success" changes. |
---|
| 5495 | + * We may get a SelectionRequest here and if we don't handle |
---|
| 5496 | + * it we hang. KDE klipper does this, for example. |
---|
| 5497 | + * We need to handle a PropertyNotify for large selections. */ |
---|
| 5498 | XtDispatchEvent(&event); |
---|
| 5499 | + continue; |
---|
| 5500 | + } |
---|
| 5501 | + |
---|
| 5502 | + /* Time out after 2 to 3 seconds to avoid that we hang when the |
---|
| 5503 | + * other process doesn't respond. Note that the SelectionNotify |
---|
| 5504 | + * event may still come later when the selection owner comes back |
---|
| 5505 | + * to life and the text gets inserted unexpectedly. Don't know |
---|
| 5506 | + * why that happens or how to avoid that :-(. */ |
---|
| 5507 | + if (time(NULL) > start_time + 2) |
---|
| 5508 | + { |
---|
| 5509 | + timed_out = TRUE; |
---|
| 5510 | + break; |
---|
| 5511 | + } |
---|
| 5512 | |
---|
| 5513 | /* Do we need this? Probably not. */ |
---|
| 5514 | XSync(dpy, False); |
---|
| 5515 | |
---|
| 5516 | - /* Bernhard Walle solved a slow paste response in an X terminal by |
---|
| 5517 | - * adding: usleep(10000); here. */ |
---|
| 5518 | + /* Wait for 1 msec to avoid that we eat up all CPU time. */ |
---|
| 5519 | + ui_delay(1L, TRUE); |
---|
| 5520 | } |
---|
| 5521 | |
---|
| 5522 | - /* this is where clip_x11_request_selection_cb() is actually called */ |
---|
| 5523 | - XtDispatchEvent(&event); |
---|
| 5524 | - |
---|
| 5525 | - if (success) |
---|
| 5526 | + if (success == TRUE) |
---|
| 5527 | return; |
---|
| 5528 | + |
---|
| 5529 | + /* don't do a retry with another type after timing out, otherwise we |
---|
| 5530 | + * hang for 15 seconds. */ |
---|
| 5531 | + if (timed_out) |
---|
| 5532 | + break; |
---|
| 5533 | } |
---|
| 5534 | |
---|
| 5535 | /* Final fallback position - use the X CUT_BUFFER0 store */ |
---|
| 5536 | diff -Naur vim72.orig/src/version.c vim72/src/version.c |
---|
| 5537 | --- vim72.orig/src/version.c 2008-08-09 07:24:52.000000000 -0700 |
---|
[bef6db9] | 5538 | +++ vim72/src/version.c 2009-01-19 00:10:59.000000000 -0800 |
---|
| 5539 | @@ -677,9 +677,176 @@ |
---|
[d25b7db] | 5540 | static int included_patches[] = |
---|
| 5541 | { /* Add new patch number below this line */ |
---|
| 5542 | /**/ |
---|
[bef6db9] | 5543 | + 84, |
---|
| 5544 | +/**/ |
---|
| 5545 | + 83, |
---|
| 5546 | +/**/ |
---|
| 5547 | + 82, |
---|
| 5548 | +/**/ |
---|
| 5549 | + 81, |
---|
| 5550 | +/**/ |
---|
| 5551 | + 80, |
---|
| 5552 | +/**/ |
---|
| 5553 | + 79, |
---|
| 5554 | +/**/ |
---|
| 5555 | + 78, |
---|
| 5556 | +/**/ |
---|
| 5557 | + 77, |
---|
| 5558 | +/**/ |
---|
[d25b7db] | 5559 | + 76, |
---|
| 5560 | +/**/ |
---|
| 5561 | + 75, |
---|
| 5562 | +/**/ |
---|
| 5563 | + 73, |
---|
| 5564 | +/**/ |
---|
| 5565 | + 70, |
---|
| 5566 | +/**/ |
---|
| 5567 | + 69, |
---|
| 5568 | +/**/ |
---|
| 5569 | + 68, |
---|
| 5570 | +/**/ |
---|
| 5571 | + 67, |
---|
| 5572 | +/**/ |
---|
| 5573 | + 66, |
---|
| 5574 | +/**/ |
---|
| 5575 | + 65, |
---|
| 5576 | +/**/ |
---|
| 5577 | + 64, |
---|
| 5578 | +/**/ |
---|
| 5579 | + 63, |
---|
| 5580 | +/**/ |
---|
| 5581 | + 62, |
---|
| 5582 | +/**/ |
---|
| 5583 | + 61, |
---|
| 5584 | +/**/ |
---|
| 5585 | + 60, |
---|
| 5586 | +/**/ |
---|
| 5587 | + 59, |
---|
| 5588 | +/**/ |
---|
| 5589 | + 58, |
---|
| 5590 | +/**/ |
---|
| 5591 | + 57, |
---|
| 5592 | +/**/ |
---|
| 5593 | + 56, |
---|
| 5594 | +/**/ |
---|
| 5595 | + 55, |
---|
| 5596 | +/**/ |
---|
| 5597 | + 54, |
---|
| 5598 | +/**/ |
---|
| 5599 | + 53, |
---|
| 5600 | +/**/ |
---|
| 5601 | + 52, |
---|
| 5602 | +/**/ |
---|
| 5603 | + 51, |
---|
| 5604 | +/**/ |
---|
| 5605 | + 50, |
---|
| 5606 | +/**/ |
---|
| 5607 | + 48, |
---|
| 5608 | +/**/ |
---|
| 5609 | + 47, |
---|
| 5610 | +/**/ |
---|
| 5611 | + 46, |
---|
| 5612 | +/**/ |
---|
| 5613 | + 45, |
---|
| 5614 | +/**/ |
---|
| 5615 | + 44, |
---|
| 5616 | +/**/ |
---|
| 5617 | + 43, |
---|
| 5618 | +/**/ |
---|
| 5619 | + 42, |
---|
| 5620 | +/**/ |
---|
| 5621 | + 40, |
---|
| 5622 | +/**/ |
---|
| 5623 | + 39, |
---|
| 5624 | +/**/ |
---|
| 5625 | + 38, |
---|
| 5626 | +/**/ |
---|
| 5627 | + 37, |
---|
| 5628 | +/**/ |
---|
| 5629 | + 35, |
---|
| 5630 | +/**/ |
---|
| 5631 | + 34, |
---|
| 5632 | +/**/ |
---|
| 5633 | + 33, |
---|
| 5634 | +/**/ |
---|
| 5635 | + 32, |
---|
| 5636 | +/**/ |
---|
| 5637 | + 31, |
---|
| 5638 | +/**/ |
---|
| 5639 | + 30, |
---|
| 5640 | +/**/ |
---|
| 5641 | + 29, |
---|
| 5642 | +/**/ |
---|
| 5643 | + 28, |
---|
| 5644 | +/**/ |
---|
| 5645 | + 27, |
---|
| 5646 | +/**/ |
---|
| 5647 | + 26, |
---|
| 5648 | +/**/ |
---|
| 5649 | + 25, |
---|
| 5650 | +/**/ |
---|
| 5651 | + 24, |
---|
| 5652 | +/**/ |
---|
| 5653 | + 23, |
---|
| 5654 | +/**/ |
---|
| 5655 | + 22, |
---|
| 5656 | +/**/ |
---|
| 5657 | + 21, |
---|
| 5658 | +/**/ |
---|
| 5659 | + 20, |
---|
| 5660 | +/**/ |
---|
| 5661 | + 19, |
---|
| 5662 | +/**/ |
---|
| 5663 | + 18, |
---|
| 5664 | +/**/ |
---|
| 5665 | + 17, |
---|
| 5666 | +/**/ |
---|
| 5667 | + 16, |
---|
| 5668 | +/**/ |
---|
| 5669 | + 15, |
---|
| 5670 | +/**/ |
---|
| 5671 | + 14, |
---|
| 5672 | +/**/ |
---|
| 5673 | + 13, |
---|
| 5674 | +/**/ |
---|
| 5675 | + 12, |
---|
| 5676 | +/**/ |
---|
| 5677 | + 11, |
---|
| 5678 | +/**/ |
---|
| 5679 | + 10, |
---|
| 5680 | +/**/ |
---|
| 5681 | + 9, |
---|
| 5682 | +/**/ |
---|
| 5683 | + 8, |
---|
| 5684 | +/**/ |
---|
| 5685 | + 6, |
---|
| 5686 | +/**/ |
---|
| 5687 | + 5, |
---|
| 5688 | +/**/ |
---|
| 5689 | + 4, |
---|
| 5690 | +/**/ |
---|
| 5691 | + 3, |
---|
| 5692 | +/**/ |
---|
| 5693 | + 2, |
---|
| 5694 | +/**/ |
---|
| 5695 | + 1, |
---|
| 5696 | +/**/ |
---|
| 5697 | 0 |
---|
| 5698 | }; |
---|
| 5699 | |
---|
| 5700 | +/* |
---|
| 5701 | + * Place to put a short description when adding a feature with a patch. |
---|
| 5702 | + * Keep it short, e.g.,: "relative numbers", "persistent undo". |
---|
| 5703 | + * Also add a comment marker to separate the lines. |
---|
| 5704 | + * See the official Vim patches for the diff format: It must use a context of |
---|
| 5705 | + * one line only. Create it by hand or use "diff -C2" and edit the patch. |
---|
| 5706 | + */ |
---|
| 5707 | +static char *(extra_patches[]) = |
---|
| 5708 | +{ /* Add your patch description below this line */ |
---|
| 5709 | +/**/ |
---|
| 5710 | + NULL |
---|
| 5711 | +}; |
---|
| 5712 | + |
---|
| 5713 | int |
---|
| 5714 | highest_patch() |
---|
| 5715 | { |
---|
[bef6db9] | 5716 | @@ -786,7 +953,7 @@ |
---|
[d25b7db] | 5717 | MSG_PUTS(_("\nRISC OS version")); |
---|
| 5718 | #endif |
---|
| 5719 | #ifdef VMS |
---|
| 5720 | - MSG_PUTS("\nOpenVMS version"); |
---|
| 5721 | + MSG_PUTS(_("\nOpenVMS version")); |
---|
| 5722 | # ifdef HAVE_PATHDEF |
---|
| 5723 | if (*compiled_arch != NUL) |
---|
| 5724 | { |
---|
[bef6db9] | 5725 | @@ -825,6 +992,19 @@ |
---|
[d25b7db] | 5726 | } |
---|
| 5727 | } |
---|
| 5728 | |
---|
| 5729 | + /* Print the list of extra patch descriptions if there is at least one. */ |
---|
| 5730 | + if (extra_patches[0] != NULL) |
---|
| 5731 | + { |
---|
| 5732 | + MSG_PUTS(_("\nExtra patches: ")); |
---|
| 5733 | + s = ""; |
---|
| 5734 | + for (i = 0; extra_patches[i] != NULL; ++i) |
---|
| 5735 | + { |
---|
| 5736 | + MSG_PUTS(s); |
---|
| 5737 | + s = ", "; |
---|
| 5738 | + MSG_PUTS(extra_patches[i]); |
---|
| 5739 | + } |
---|
| 5740 | + } |
---|
| 5741 | + |
---|
| 5742 | #ifdef MODIFIED_BY |
---|
| 5743 | MSG_PUTS("\n"); |
---|
| 5744 | MSG_PUTS(_("Modified by ")); |
---|
| 5745 | diff -Naur vim72.orig/src/vim.h vim72/src/vim.h |
---|
| 5746 | --- vim72.orig/src/vim.h 2008-08-09 09:03:38.000000000 -0700 |
---|
[bef6db9] | 5747 | +++ vim72/src/vim.h 2009-01-19 00:09:15.000000000 -0800 |
---|
[d25b7db] | 5748 | @@ -341,8 +341,14 @@ |
---|
| 5749 | #ifdef BACKSLASH_IN_FILENAME |
---|
| 5750 | # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<") |
---|
| 5751 | #else |
---|
| 5752 | -# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<") |
---|
| 5753 | -# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&") |
---|
| 5754 | +# ifdef VMS |
---|
| 5755 | + /* VMS allows a lot of characters in the file name */ |
---|
| 5756 | +# define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!") |
---|
| 5757 | +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&") |
---|
| 5758 | +# else |
---|
| 5759 | +# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<") |
---|
| 5760 | +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&") |
---|
| 5761 | +# endif |
---|
| 5762 | #endif |
---|
| 5763 | |
---|
| 5764 | #define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */ |
---|
| 5765 | @@ -370,7 +376,7 @@ |
---|
| 5766 | * Define __w64 as an empty token for everything but MSVC 7.x or later. |
---|
| 5767 | */ |
---|
| 5768 | # if !defined(_MSC_VER) || (_MSC_VER < 1300) |
---|
| 5769 | -# define __w64 |
---|
| 5770 | +# define __w64 |
---|
| 5771 | # endif |
---|
| 5772 | typedef unsigned long __w64 long_u; |
---|
| 5773 | typedef long __w64 long_i; |
---|
| 5774 | @@ -1728,7 +1734,8 @@ |
---|
| 5775 | #define VV_MOUSE_COL 51 |
---|
| 5776 | #define VV_OP 52 |
---|
| 5777 | #define VV_SEARCHFORWARD 53 |
---|
| 5778 | -#define VV_LEN 54 /* number of v: vars */ |
---|
| 5779 | +#define VV_OLDFILES 54 |
---|
| 5780 | +#define VV_LEN 55 /* number of v: vars */ |
---|
| 5781 | |
---|
| 5782 | #ifdef FEAT_CLIPBOARD |
---|
| 5783 | |
---|
| 5784 | @@ -1979,6 +1986,9 @@ |
---|
| 5785 | # endif |
---|
| 5786 | #endif |
---|
| 5787 | |
---|
| 5788 | +#ifndef FEAT_NETBEANS_INTG |
---|
| 5789 | +# undef NBDEBUG |
---|
| 5790 | +#endif |
---|
| 5791 | #ifdef NBDEBUG /* Netbeans debugging. */ |
---|
| 5792 | # include "nbdebug.h" |
---|
| 5793 | #else |
---|
| 5794 | @@ -2054,4 +2064,10 @@ |
---|
| 5795 | #define DOSO_VIMRC 1 /* loading vimrc file */ |
---|
| 5796 | #define DOSO_GVIMRC 2 /* loading gvimrc file */ |
---|
| 5797 | |
---|
| 5798 | +/* flags for read_viminfo() and children */ |
---|
| 5799 | +#define VIF_WANT_INFO 1 /* load non-mark info */ |
---|
| 5800 | +#define VIF_WANT_MARKS 2 /* load file marks */ |
---|
| 5801 | +#define VIF_FORCEIT 4 /* overwrite info already read */ |
---|
| 5802 | +#define VIF_GET_OLDFILES 8 /* load v:oldfiles */ |
---|
| 5803 | + |
---|
| 5804 | #endif /* VIM__H */ |
---|
| 5805 | diff -Naur vim72.orig/src/window.c vim72/src/window.c |
---|
| 5806 | --- vim72.orig/src/window.c 2008-08-06 04:00:30.000000000 -0700 |
---|
[bef6db9] | 5807 | +++ vim72/src/window.c 2009-01-19 00:09:40.000000000 -0800 |
---|
[d25b7db] | 5808 | @@ -4028,14 +4028,14 @@ |
---|
| 5809 | if (mch_dirname(cwd, MAXPATHL) == OK) |
---|
| 5810 | globaldir = vim_strsave(cwd); |
---|
| 5811 | } |
---|
| 5812 | - mch_chdir((char *)curwin->w_localdir); |
---|
| 5813 | - shorten_fnames(TRUE); |
---|
| 5814 | + if (mch_chdir((char *)curwin->w_localdir) == 0) |
---|
| 5815 | + shorten_fnames(TRUE); |
---|
| 5816 | } |
---|
| 5817 | else if (globaldir != NULL) |
---|
| 5818 | { |
---|
| 5819 | /* Window doesn't have a local directory and we are not in the global |
---|
| 5820 | * directory: Change to the global directory. */ |
---|
| 5821 | - mch_chdir((char *)globaldir); |
---|
| 5822 | + ignored = mch_chdir((char *)globaldir); |
---|
| 5823 | vim_free(globaldir); |
---|
| 5824 | globaldir = NULL; |
---|
| 5825 | shorten_fnames(TRUE); |
---|
| 5826 | diff -Naur vim72.orig/src/workshop.c vim72/src/workshop.c |
---|
| 5827 | --- vim72.orig/src/workshop.c 2008-06-21 11:53:26.000000000 -0700 |
---|
[bef6db9] | 5828 | +++ vim72/src/workshop.c 2009-01-19 00:09:33.000000000 -0800 |
---|
[d25b7db] | 5829 | @@ -1121,8 +1121,12 @@ |
---|
| 5830 | ? (char *)curbuf->b_sfname : "<None>"); |
---|
| 5831 | #endif |
---|
| 5832 | |
---|
| 5833 | - strcpy(ffname, (char *) curbuf->b_ffname); |
---|
| 5834 | - *filename = ffname; /* copy so nobody can change b_ffname */ |
---|
| 5835 | + if (curbuf->b_ffname == NULL) |
---|
| 5836 | + ffname[0] = NUL; |
---|
| 5837 | + else |
---|
| 5838 | + /* copy so nobody can change b_ffname */ |
---|
| 5839 | + strcpy(ffname, (char *) curbuf->b_ffname); |
---|
| 5840 | + *filename = ffname; |
---|
| 5841 | *curLine = curwin->w_cursor.lnum; |
---|
| 5842 | *curCol = curwin->w_cursor.col; |
---|
| 5843 | |
---|