[43c52a1] | 1 | Submitted By: Jim Gifford (jim at cross-lfs dot org)
|
---|
[54f612f] | 2 | Date: 02-22-2009
|
---|
[76dd250] | 3 | Initial Package Version: 7.2
|
---|
| 4 | Origin: Upstream
|
---|
| 5 | Upstream Status: Applied
|
---|
[54f612f] | 6 | Description: Contains all upstream patches up to 7.2.124
|
---|
[76dd250] | 7 | The following patches were skipped
|
---|
[9a875fd] | 8 | 007 036 041 049 071 072 074 088 089 093 101
|
---|
[76dd250] | 9 |
|
---|
| 10 | diff -Naur vim72.orig/Filelist vim72/Filelist
|
---|
| 11 | --- vim72.orig/Filelist 2008-07-06 11:02:23.000000000 -0700
|
---|
[54f612f] | 12 | +++ vim72/Filelist 2009-02-22 21:57:28.764584997 -0800
|
---|
[76dd250] | 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
|
---|
[54f612f] | 23 | +++ vim72/runtime/doc/cmdline.txt 2009-02-22 21:57:28.892594217 -0800
|
---|
[76dd250] | 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
|
---|
[54f612f] | 82 | +++ vim72/runtime/doc/eval.txt 2009-02-22 21:57:40.793357172 -0800
|
---|
[76dd250] | 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|.
|
---|
[43c52a1] | 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
|
---|
[54f612f] | 202 | +++ vim72/runtime/doc/netbeans.txt 2009-02-22 21:57:51.694055594 -0800
|
---|
[43c52a1] | 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
|
---|
[76dd250] | 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
|
---|
[54f612f] | 224 | +++ vim72/runtime/doc/options.txt 2009-02-22 21:58:02.958777762 -0800
|
---|
[76dd250] | 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
|
---|
[54f612f] | 231 | @@ -4175,9 +4175,6 @@
|
---|
| 232 | be able to execute Normal mode commands.
|
---|
| 233 | This is the opposite of the 'keymap' option, where characters are
|
---|
| 234 | mapped in Insert mode.
|
---|
| 235 | - This only works for 8-bit characters. The value of 'langmap' may be
|
---|
| 236 | - specified with multi-byte characters (e.g., UTF-8), but only the lower
|
---|
| 237 | - 8 bits of each character will be used.
|
---|
| 238 |
|
---|
| 239 | Example (for Greek, in UTF-8): *greek* >
|
---|
| 240 | :set langmap=ÎA,ÎB,ΚC,ÎD,ÎE,ΊF,ÎG,ÎH,ÎI,ÎJ,ÎK,ÎL,ÎM,ÎN,ÎO,Î P,QQ,ΡR,ΣS,΀T,ÎU,ΩV,WW,ΧX,Î¥Y,ÎZ,αa,βb,Ïc,ÎŽd,εe,Ïf,γg,ηh,ιi,Οj,κk,λl,ÎŒm,Îœn,οo,Ïp,qq,Ïr,Ïs,Ït,Ξu,Ïv,Ïw,Ïx,Ï
|
---|
| 241 | y,ζz
|
---|
[76dd250] | 242 | @@ -7472,7 +7469,9 @@
|
---|
| 243 | {not available when compiled without the |+wildignore|
|
---|
| 244 | feature}
|
---|
| 245 | A list of file patterns. A file that matches with one of these
|
---|
| 246 | - patterns is ignored when completing file or directory names.
|
---|
| 247 | + patterns is ignored when completing file or directory names, and
|
---|
| 248 | + influences the result of |expand()|, |glob()| and |globpath()| unless
|
---|
| 249 | + a flag is passed to disable this.
|
---|
| 250 | The pattern is used like with |:autocmd|, see |autocmd-patterns|.
|
---|
| 251 | Also see 'suffixes'.
|
---|
| 252 | Example: >
|
---|
| 253 | diff -Naur vim72.orig/runtime/doc/spell.txt vim72/runtime/doc/spell.txt
|
---|
[54f612f] | 254 | --- vim72.orig/runtime/doc/spell.txt 2008-08-09 07:23:00.000000000 -0700
|
---|
[76dd250] | 255 | +++ vim72/runtime/doc/spell.txt 2009-02-22 21:57:40.717352144 -0800
|
---|
| 256 | @@ -1,4 +1,4 @@
|
---|
| 257 | -*spell.txt* For Vim version 7.2. Last change: 2008 Jun 21
|
---|
| 258 | +*spell.txt* For Vim version 7.2. Last change: 2008 Nov 30
|
---|
| 259 |
|
---|
| 260 |
|
---|
| 261 | VIM REFERENCE MANUAL by Bram Moolenaar
|
---|
| 262 | @@ -831,8 +831,11 @@
|
---|
| 263 |
|
---|
| 264 | # comment line ~
|
---|
| 265 |
|
---|
| 266 | -With some items it's also possible to put a comment after it, but this isn't
|
---|
| 267 | -supported in general.
|
---|
| 268 | +Items with a fixed number of arguments can be followed by a comment. But only
|
---|
| 269 | +if none of the arguments can contain white space. The comment must start with
|
---|
| 270 | +a "#" character. Example:
|
---|
| 271 | +
|
---|
| 272 | + KEEPCASE = # fix case for words with this flag ~
|
---|
| 273 |
|
---|
| 274 |
|
---|
| 275 | ENCODING *spell-SET*
|
---|
| 276 | @@ -965,6 +968,9 @@
|
---|
| 277 |
|
---|
| 278 | Note: When using utf-8 only characters up to 65000 may be used for flags.
|
---|
| 279 |
|
---|
| 280 | +Note: even when using "num" or "long" the number of flags available to
|
---|
| 281 | +compounding and prefixes is limited to about 250.
|
---|
| 282 | +
|
---|
| 283 |
|
---|
| 284 | AFFIXES
|
---|
| 285 | *spell-PFX* *spell-SFX*
|
---|
| 286 | @@ -1178,6 +1184,9 @@
|
---|
| 287 | The flag also applies to the word with affixes, thus this can be used to mark
|
---|
| 288 | a whole bunch of related words as bad.
|
---|
| 289 |
|
---|
| 290 | + *spell-FORBIDDENWORD*
|
---|
| 291 | +FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell.
|
---|
| 292 | +
|
---|
| 293 | *spell-NEEDAFFIX*
|
---|
| 294 | The NEEDAFFIX flag is used to require that a word is used with an affix. The
|
---|
| 295 | word itself is not a good word (unless there is an empty affix). Example:
|
---|
| 296 | @@ -1268,6 +1277,10 @@
|
---|
| 297 |
|
---|
| 298 | NEEDCOMPOUND & ~
|
---|
| 299 |
|
---|
| 300 | + *spell-ONLYINCOMPOUND*
|
---|
| 301 | +The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for
|
---|
| 302 | +compatiblity with Hunspell.
|
---|
| 303 | +
|
---|
| 304 | *spell-COMPOUNDMIN*
|
---|
| 305 | The minimal character length of a word used for compounding is specified with
|
---|
| 306 | COMPOUNDMIN. Example:
|
---|
| 307 | @@ -1328,6 +1341,20 @@
|
---|
| 308 | rules. Can also be used for an affix to count the affix as a compounding
|
---|
| 309 | word.
|
---|
| 310 |
|
---|
| 311 | + *spell-CHECKCOMPOUNDPATTERN*
|
---|
| 312 | +CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
|
---|
| 313 | +position where two words are compounded together forbids the compound.
|
---|
| 314 | +For example:
|
---|
| 315 | + CHECKCOMPOUNDPATTERN o e ~
|
---|
| 316 | +
|
---|
| 317 | +This forbids compounding if the first word ends in "o" and the second word
|
---|
| 318 | +starts with "e".
|
---|
| 319 | +
|
---|
| 320 | +The arguments must be plain text, no patterns are actually supported, despite
|
---|
| 321 | +the item name. Case is always ignored.
|
---|
| 322 | +
|
---|
| 323 | +The Hunspell feature to use three arguments and flags is not supported.
|
---|
| 324 | +
|
---|
| 325 | *spell-SYLLABLE*
|
---|
| 326 | The SYLLABLE item defines characters or character sequences that are used to
|
---|
| 327 | count the number of syllables in a word. Example:
|
---|
| 328 | @@ -1496,6 +1523,10 @@
|
---|
| 329 | ACCENT (Hunspell) *spell-ACCENT*
|
---|
| 330 | Use MAP instead. |spell-MAP|
|
---|
| 331 |
|
---|
| 332 | +BREAK (Hunspell) *spell-BREAK*
|
---|
| 333 | + Define break points. Unclear how it works exactly.
|
---|
| 334 | + Not supported.
|
---|
| 335 | +
|
---|
| 336 | CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE*
|
---|
| 337 | Disallow uppercase letters at compound word boundaries.
|
---|
| 338 | Not supported.
|
---|
| 339 | @@ -1512,9 +1543,6 @@
|
---|
| 340 | Forbid three identical characters when compounding. Not
|
---|
| 341 | supported.
|
---|
| 342 |
|
---|
| 343 | -CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN*
|
---|
| 344 | - Forbid compounding when patterns match. Not supported.
|
---|
| 345 | -
|
---|
| 346 | COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES*
|
---|
| 347 | Enables using two prefixes. Not supported.
|
---|
| 348 |
|
---|
| 349 | @@ -1536,13 +1564,18 @@
|
---|
| 350 | COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
|
---|
| 351 | Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
|
---|
| 352 |
|
---|
| 353 | +COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES*
|
---|
| 354 | + Number of COMPOUNDRULE lines following. Ignored, but the
|
---|
| 355 | + argument must be a number.
|
---|
| 356 | +
|
---|
| 357 | COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
|
---|
| 358 | Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
|
---|
| 359 | |spell-COMPOUNDSYLMAX|
|
---|
| 360 |
|
---|
| 361 | -FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD*
|
---|
| 362 | - Use BAD instead. |spell-BAD|
|
---|
| 363 | -
|
---|
| 364 | +KEY (Hunspell) *spell-KEY*
|
---|
| 365 | + Define characters that are close together on the keyboard.
|
---|
| 366 | + Used to give better suggestions. Not supported.
|
---|
| 367 | +
|
---|
| 368 | LANG (Hunspell) *spell-LANG*
|
---|
| 369 | This specifies language-specific behavior. This actually
|
---|
| 370 | moves part of the language knowledge into the program,
|
---|
| 371 | @@ -1553,10 +1586,7 @@
|
---|
| 372 | Only needed for morphological analysis.
|
---|
| 373 |
|
---|
| 374 | MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
|
---|
| 375 | - Not supported.
|
---|
| 376 | -
|
---|
| 377 | -ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND*
|
---|
| 378 | - Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND|
|
---|
| 379 | + Set number of n-gram suggestions. Not supported.
|
---|
| 380 |
|
---|
| 381 | PSEUDOROOT (Hunspell) *spell-PSEUDOROOT*
|
---|
| 382 | Use NEEDAFFIX instead. |spell-NEEDAFFIX|
|
---|
| 383 | diff -Naur vim72.orig/runtime/doc/starting.txt vim72/runtime/doc/starting.txt
|
---|
[54f612f] | 384 | --- vim72.orig/runtime/doc/starting.txt 2008-08-09 07:23:00.000000000 -0700
|
---|
[76dd250] | 385 | +++ vim72/runtime/doc/starting.txt 2009-02-22 21:57:28.896592820 -0800
|
---|
| 386 | @@ -1,4 +1,4 @@
|
---|
| 387 | -*starting.txt* For Vim version 7.2. Last change: 2008 Jun 21
|
---|
| 388 | +*starting.txt* For Vim version 7.2. Last change: 2008 Nov 09
|
---|
| 389 |
|
---|
| 390 |
|
---|
| 391 | VIM REFERENCE MANUAL by Bram Moolenaar
|
---|
| 392 | @@ -1337,8 +1337,9 @@
|
---|
| 393 | *viminfo-read*
|
---|
| 394 | When Vim is started and the 'viminfo' option is non-empty, the contents of
|
---|
| 395 | the viminfo file are read and the info can be used in the appropriate places.
|
---|
| 396 | -The marks are not read in at startup (but file marks are). See
|
---|
| 397 | -|initialization| for how to set the 'viminfo' option upon startup.
|
---|
| 398 | +The |v:oldfiles| variable is filled. The marks are not read in at startup
|
---|
| 399 | +(but file marks are). See |initialization| for how to set the 'viminfo'
|
---|
| 400 | +option upon startup.
|
---|
| 401 |
|
---|
| 402 | *viminfo-write*
|
---|
| 403 | When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo
|
---|
| 404 | @@ -1372,6 +1373,8 @@
|
---|
| 405 | that start with any string given with the "r" flag in 'viminfo'. This can be
|
---|
| 406 | used to avoid saving marks for files on removable media (for MS-DOS you would
|
---|
| 407 | use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:").
|
---|
| 408 | +The |v:oldfiles| variable is filled with the file names that the viminfo file
|
---|
| 409 | +has marks for.
|
---|
| 410 |
|
---|
| 411 | *viminfo-file-marks*
|
---|
| 412 | Uppercase marks ('A to 'Z) are stored when writing the viminfo file. The
|
---|
| 413 | @@ -1463,8 +1466,8 @@
|
---|
| 414 | *:rv* *:rviminfo* *E195*
|
---|
| 415 | :rv[iminfo][!] [file] Read from viminfo file [file] (default: see above).
|
---|
| 416 | If [!] is given, then any information that is
|
---|
| 417 | - already set (registers, marks, etc.) will be
|
---|
| 418 | - overwritten. {not in Vi}
|
---|
| 419 | + already set (registers, marks, |v:oldfiles|, etc.)
|
---|
| 420 | + will be overwritten {not in Vi}
|
---|
| 421 |
|
---|
| 422 | *:wv* *:wviminfo* *E137* *E138* *E574*
|
---|
| 423 | :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
|
---|
| 424 | @@ -1479,4 +1482,20 @@
|
---|
| 425 | the .viminfo file.
|
---|
| 426 | {not in Vi}
|
---|
| 427 |
|
---|
| 428 | + *:ol* *:oldfiles*
|
---|
| 429 | +:ol[dfiles] List the files that have marks stored in the viminfo
|
---|
| 430 | + file. This list is read on startup and only changes
|
---|
| 431 | + afterwards with ":rviminfo!". Also see |v:oldfiles|.
|
---|
| 432 | + The number can be used with |c_#<|.
|
---|
| 433 | + {not in Vi, only when compiled with the +eval feature}
|
---|
| 434 | +
|
---|
| 435 | +:bro[wse] ol[dfiles][!]
|
---|
| 436 | + List file names as with |:oldfiles|, and then prompt
|
---|
| 437 | + for a number. When the number is valid that file from
|
---|
| 438 | + the list is edited.
|
---|
| 439 | + If you get the |press-enter| prompt you can press "q"
|
---|
| 440 | + and still get the prompt to enter a file number.
|
---|
| 441 | + Use ! to abondon a modified buffer. |abandon|
|
---|
| 442 | + {not when compiled with tiny or small features}
|
---|
| 443 | +
|
---|
| 444 | vim:tw=78:ts=8:ft=help:norl:
|
---|
| 445 | diff -Naur vim72.orig/runtime/doc/usr_21.txt vim72/runtime/doc/usr_21.txt
|
---|
[54f612f] | 446 | --- vim72.orig/runtime/doc/usr_21.txt 2008-08-09 07:23:01.000000000 -0700
|
---|
[76dd250] | 447 | +++ vim72/runtime/doc/usr_21.txt 2009-02-22 21:57:28.896592820 -0800
|
---|
| 448 | @@ -1,4 +1,4 @@
|
---|
| 449 | -*usr_21.txt* For Vim version 7.2. Last change: 2007 May 01
|
---|
| 450 | +*usr_21.txt* For Vim version 7.2. Last change: 2008 Nov 09
|
---|
| 451 |
|
---|
| 452 | VIM USER MANUAL - by Bram Moolenaar
|
---|
| 453 |
|
---|
| 454 | @@ -153,7 +153,7 @@
|
---|
| 455 | to be lost. Each item can be remembered only once.
|
---|
| 456 |
|
---|
| 457 |
|
---|
| 458 | -GETTING BACK TO WHERE YOU WERE
|
---|
| 459 | +GETTING BACK TO WHERE YOU STOPPED VIM
|
---|
| 460 |
|
---|
| 461 | You are halfway editing a file and it's time to leave for holidays. You exit
|
---|
| 462 | Vim and go enjoy yourselves, forgetting all about your work. After a couple
|
---|
| 463 | @@ -168,6 +168,48 @@
|
---|
| 464 | The |:marks| command is useful to find out where '0 to '9 will take you.
|
---|
| 465 |
|
---|
| 466 |
|
---|
| 467 | +GETTING BACK TO SOME FILE
|
---|
| 468 | +
|
---|
| 469 | +If you want to go back to a file that you edited recently, but not when
|
---|
| 470 | +exiting Vim, there is a slightly more complicated way. You can see a list of
|
---|
| 471 | +files by typing the command: >
|
---|
| 472 | +
|
---|
| 473 | + :oldfiles
|
---|
| 474 | +< 1: ~/.viminfo ~
|
---|
| 475 | + 2: ~/text/resume.txt ~
|
---|
| 476 | + 3: /tmp/draft ~
|
---|
| 477 | +
|
---|
| 478 | +Now you would like to edit the second file, which is in the list preceded by
|
---|
| 479 | +"2:". You type: >
|
---|
| 480 | +
|
---|
| 481 | + :e #<2
|
---|
| 482 | +
|
---|
| 483 | +Instead of ":e" you can use any command that has a file name argument, the
|
---|
| 484 | +"#<2" item works in the same place as "%" (current file name) and "#"
|
---|
| 485 | +(alternate file name). So you can also split the window to edit the third
|
---|
| 486 | +file: >
|
---|
| 487 | +
|
---|
| 488 | + :split #<3
|
---|
| 489 | +
|
---|
| 490 | +That #<123 thing is a bit complicated when you just want to edit a file.
|
---|
| 491 | +Fortunately there is a simpler way: >
|
---|
| 492 | +
|
---|
| 493 | + :browse oldfiles
|
---|
| 494 | +< 1: ~/.viminfo ~
|
---|
| 495 | + 2: ~/text/resume.txt ~
|
---|
| 496 | + 3: /tmp/draft ~
|
---|
| 497 | + -- More --
|
---|
| 498 | +
|
---|
| 499 | +You get the same list of files as with |:oldfiles|. If you want to edit
|
---|
| 500 | +"resume.txt" first press "q" to stop the listing. You will get a prompt:
|
---|
| 501 | +
|
---|
| 502 | + Type number and <Enter> (empty cancels): ~
|
---|
| 503 | +
|
---|
| 504 | +Type "2" and press <Enter> to edit the second file.
|
---|
| 505 | +
|
---|
| 506 | +More info at |:oldfiles|, |v:oldfiles| and |c_#<|.
|
---|
| 507 | +
|
---|
| 508 | +
|
---|
| 509 | MOVE INFO FROM ONE VIM TO ANOTHER
|
---|
| 510 |
|
---|
| 511 | You can use the ":wviminfo" and ":rviminfo" commands to save and restore the
|
---|
| 512 | diff -Naur vim72.orig/runtime/scripts.vim vim72/runtime/scripts.vim
|
---|
[54f612f] | 513 | --- vim72.orig/runtime/scripts.vim 2008-08-08 15:27:21.000000000 -0700
|
---|
[76dd250] | 514 | +++ vim72/runtime/scripts.vim 2009-02-22 21:57:25.668388043 -0800
|
---|
| 515 | @@ -234,6 +234,10 @@
|
---|
| 516 | elseif s:line1 =~ '\<DTD\s\+XHTML\s'
|
---|
| 517 | set ft=xhtml
|
---|
| 518 |
|
---|
| 519 | + " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
|
---|
| 520 | + elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
|
---|
| 521 | + set ft=html
|
---|
| 522 | +
|
---|
| 523 | " PDF
|
---|
| 524 | elseif s:line1 =~ '^%PDF-'
|
---|
| 525 | set ft=pdf
|
---|
| 526 | diff -Naur vim72.orig/src/auto/configure vim72/src/auto/configure
|
---|
[54f612f] | 527 | --- vim72.orig/src/auto/configure 2008-07-24 05:40:36.000000000 -0700
|
---|
[76dd250] | 528 | +++ vim72/src/auto/configure 2009-02-22 21:57:36.313067746 -0800
|
---|
| 529 | @@ -16819,21 +16819,29 @@
|
---|
| 530 | LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
|
---|
| 531 | fi
|
---|
| 532 |
|
---|
| 533 | -{ $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
|
---|
| 534 | -$as_echo_n "checking for GCC 3 or later... " >&6; }
|
---|
| 535 | DEPEND_CFLAGS_FILTER=
|
---|
| 536 | if test "$GCC" = yes; then
|
---|
| 537 | + { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
|
---|
| 538 | +$as_echo_n "checking for GCC 3 or later... " >&6; }
|
---|
| 539 | gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
|
---|
| 540 | if test "$gccmajor" -gt "2"; then
|
---|
| 541 | DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
|
---|
| 542 | - fi
|
---|
| 543 | -fi
|
---|
| 544 | -if test "$DEPEND_CFLAGS_FILTER" = ""; then
|
---|
| 545 | - { $as_echo "$as_me:$LINENO: result: no" >&5
|
---|
| 546 | + { $as_echo "$as_me:$LINENO: result: yes" >&5
|
---|
| 547 | +$as_echo "yes" >&6; }
|
---|
| 548 | + else
|
---|
| 549 | + { $as_echo "$as_me:$LINENO: result: no" >&5
|
---|
| 550 | $as_echo "no" >&6; }
|
---|
| 551 | -else
|
---|
| 552 | - { $as_echo "$as_me:$LINENO: result: yes" >&5
|
---|
| 553 | + fi
|
---|
| 554 | + { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5
|
---|
| 555 | +$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
|
---|
| 556 | + if test "$gccmajor" -gt "3"; then
|
---|
| 557 | + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
|
---|
| 558 | + { $as_echo "$as_me:$LINENO: result: yes" >&5
|
---|
| 559 | $as_echo "yes" >&6; }
|
---|
| 560 | + else
|
---|
| 561 | + { $as_echo "$as_me:$LINENO: result: no" >&5
|
---|
| 562 | +$as_echo "no" >&6; }
|
---|
| 563 | + fi
|
---|
| 564 | fi
|
---|
| 565 |
|
---|
| 566 |
|
---|
| 567 | diff -Naur vim72.orig/src/buffer.c vim72/src/buffer.c
|
---|
[54f612f] | 568 | --- vim72.orig/src/buffer.c 2008-08-06 04:00:48.000000000 -0700
|
---|
[43c52a1] | 569 | +++ vim72/src/buffer.c 2009-02-22 21:58:03.050783349 -0800
|
---|
| 570 | @@ -437,10 +437,6 @@
|
---|
| 571 | return;
|
---|
| 572 | #endif
|
---|
| 573 |
|
---|
| 574 | -#ifdef FEAT_NETBEANS_INTG
|
---|
| 575 | - if (usingNetbeans)
|
---|
| 576 | - netbeans_file_closed(buf);
|
---|
| 577 | -#endif
|
---|
| 578 | /* Change directories when the 'acd' option is set. */
|
---|
| 579 | DO_AUTOCHDIR
|
---|
| 580 |
|
---|
| 581 | @@ -639,6 +635,10 @@
|
---|
| 582 | #ifdef FEAT_SIGNS
|
---|
| 583 | buf_delete_signs(buf); /* delete any signs */
|
---|
| 584 | #endif
|
---|
| 585 | +#ifdef FEAT_NETBEANS_INTG
|
---|
| 586 | + if (usingNetbeans)
|
---|
| 587 | + netbeans_file_killed(buf);
|
---|
| 588 | +#endif
|
---|
| 589 | #ifdef FEAT_LOCALMAP
|
---|
| 590 | map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
|
---|
[76dd250] | 591 | map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
|
---|
| 592 | @@ -647,6 +647,9 @@
|
---|
| 593 | vim_free(buf->b_start_fenc);
|
---|
| 594 | buf->b_start_fenc = NULL;
|
---|
| 595 | #endif
|
---|
| 596 | +#ifdef FEAT_SPELL
|
---|
| 597 | + ga_clear(&buf->b_langp);
|
---|
| 598 | +#endif
|
---|
| 599 | }
|
---|
| 600 |
|
---|
[43c52a1] | 601 | /*
|
---|
| 602 | @@ -812,9 +815,6 @@
|
---|
| 603 | int bnr; /* buffer number */
|
---|
| 604 | char_u *p;
|
---|
| 605 |
|
---|
| 606 | -#ifdef FEAT_NETBEANS_INTG
|
---|
| 607 | - netbeansCloseFile = 1;
|
---|
| 608 | -#endif
|
---|
| 609 | if (addr_count == 0)
|
---|
| 610 | {
|
---|
| 611 | (void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit);
|
---|
| 612 | @@ -909,9 +909,6 @@
|
---|
| 613 | }
|
---|
| 614 | }
|
---|
| 615 |
|
---|
| 616 | -#ifdef FEAT_NETBEANS_INTG
|
---|
| 617 | - netbeansCloseFile = 0;
|
---|
| 618 | -#endif
|
---|
| 619 |
|
---|
| 620 | return errormsg;
|
---|
| 621 | }
|
---|
[76dd250] | 622 | @@ -1237,7 +1234,7 @@
|
---|
| 623 | * "buf" if one exists */
|
---|
| 624 | if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
|
---|
| 625 | return OK;
|
---|
| 626 | - /* If 'switchbuf' contians "usetab": jump to first window in any tab
|
---|
| 627 | + /* If 'switchbuf' contains "usetab": jump to first window in any tab
|
---|
| 628 | * page containing "buf" if one exists */
|
---|
| 629 | if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
|
---|
[43c52a1] | 630 | return OK;
|
---|
[76dd250] | 631 | @@ -1351,11 +1348,12 @@
|
---|
| 632 | }
|
---|
| 633 | }
|
---|
| 634 | #ifdef FEAT_AUTOCMD
|
---|
| 635 | + /* An autocommand may have deleted "buf", already entered it (e.g., when
|
---|
| 636 | + * it did ":bunload") or aborted the script processing! */
|
---|
| 637 | # ifdef FEAT_EVAL
|
---|
| 638 | - /* An autocommand may have deleted buf or aborted the script processing! */
|
---|
| 639 | - if (buf_valid(buf) && !aborting())
|
---|
| 640 | + if (buf_valid(buf) && buf != curbuf && !aborting())
|
---|
| 641 | # else
|
---|
| 642 | - if (buf_valid(buf)) /* an autocommand may have deleted buf! */
|
---|
| 643 | + if (buf_valid(buf) && buf != curbuf)
|
---|
| 644 | # endif
|
---|
| 645 | #endif
|
---|
[43c52a1] | 646 | enter_buffer(buf);
|
---|
[76dd250] | 647 | @@ -1397,6 +1395,9 @@
|
---|
| 648 | curwin->w_cursor.coladd = 0;
|
---|
| 649 | #endif
|
---|
| 650 | curwin->w_set_curswant = TRUE;
|
---|
| 651 | +#ifdef FEAT_AUTOCMD
|
---|
| 652 | + curwin->w_topline_was_set = FALSE;
|
---|
| 653 | +#endif
|
---|
| 654 |
|
---|
| 655 | /* Make sure the buffer is loaded. */
|
---|
[43c52a1] | 656 | if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
|
---|
[76dd250] | 657 | @@ -1436,7 +1437,8 @@
|
---|
| 658 | maketitle();
|
---|
| 659 | #endif
|
---|
| 660 | #ifdef FEAT_AUTOCMD
|
---|
| 661 | - if (curwin->w_topline == 1) /* when autocmds didn't change it */
|
---|
| 662 | + /* when autocmds didn't change it */
|
---|
| 663 | + if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
|
---|
| 664 | #endif
|
---|
| 665 | scroll_cursor_halfway(FALSE); /* redisplay at correct position */
|
---|
[43c52a1] | 666 |
|
---|
[76dd250] | 667 | @@ -3963,7 +3965,7 @@
|
---|
| 668 | width = vim_strsize(out);
|
---|
| 669 | if (maxwidth > 0 && width > maxwidth)
|
---|
| 670 | {
|
---|
| 671 | - /* Result is too long, must trunctate somewhere. */
|
---|
| 672 | + /* Result is too long, must truncate somewhere. */
|
---|
| 673 | l = 0;
|
---|
| 674 | if (itemcnt == 0)
|
---|
[54f612f] | 675 | s = out;
|
---|
| 676 | @@ -5048,7 +5050,8 @@
|
---|
| 677 | */
|
---|
| 678 | FOR_ALL_TAB_WINDOWS(tp, win)
|
---|
| 679 | if (win->w_buffer == buf)
|
---|
| 680 | - break;
|
---|
| 681 | + goto win_found;
|
---|
| 682 | +win_found:
|
---|
| 683 | if (win != NULL && win->w_llist_ref != NULL)
|
---|
| 684 | return _("[Location List]");
|
---|
| 685 | else
|
---|
[76dd250] | 686 | @@ -5062,7 +5065,7 @@
|
---|
| 687 | {
|
---|
| 688 | if (buf->b_sfname != NULL)
|
---|
| 689 | return (char *)buf->b_sfname;
|
---|
| 690 | - return "[Scratch]";
|
---|
| 691 | + return _("[Scratch]");
|
---|
| 692 | }
|
---|
| 693 | #endif
|
---|
| 694 | if (buf->b_fname == NULL)
|
---|
| 695 | diff -Naur vim72.orig/src/configure.in vim72/src/configure.in
|
---|
[54f612f] | 696 | --- vim72.orig/src/configure.in 2008-07-24 05:40:26.000000000 -0700
|
---|
[76dd250] | 697 | +++ vim72/src/configure.in 2009-02-22 21:57:36.313067746 -0800
|
---|
| 698 | @@ -3152,18 +3152,25 @@
|
---|
| 699 | dnl But only when making dependencies, cproto and lint don't take "-isystem".
|
---|
| 700 | dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
|
---|
| 701 | dnl the number before the version number.
|
---|
| 702 | -AC_MSG_CHECKING(for GCC 3 or later)
|
---|
| 703 | DEPEND_CFLAGS_FILTER=
|
---|
| 704 | if test "$GCC" = yes; then
|
---|
| 705 | + AC_MSG_CHECKING(for GCC 3 or later)
|
---|
| 706 | gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
|
---|
| 707 | if test "$gccmajor" -gt "2"; then
|
---|
| 708 | DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
|
---|
| 709 | + AC_MSG_RESULT(yes)
|
---|
| 710 | + else
|
---|
| 711 | + AC_MSG_RESULT(no)
|
---|
| 712 | + fi
|
---|
| 713 | + dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
|
---|
| 714 | + dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
|
---|
| 715 | + AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
|
---|
| 716 | + if test "$gccmajor" -gt "3"; then
|
---|
| 717 | + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
|
---|
| 718 | + AC_MSG_RESULT(yes)
|
---|
| 719 | + else
|
---|
| 720 | + AC_MSG_RESULT(no)
|
---|
| 721 | fi
|
---|
| 722 | -fi
|
---|
| 723 | -if test "$DEPEND_CFLAGS_FILTER" = ""; then
|
---|
| 724 | - AC_MSG_RESULT(no)
|
---|
| 725 | -else
|
---|
| 726 | - AC_MSG_RESULT(yes)
|
---|
| 727 | fi
|
---|
| 728 | AC_SUBST(DEPEND_CFLAGS_FILTER)
|
---|
| 729 |
|
---|
| 730 | diff -Naur vim72.orig/src/diff.c vim72/src/diff.c
|
---|
[54f612f] | 731 | --- vim72.orig/src/diff.c 2008-03-05 03:16:56.000000000 -0800
|
---|
[5f4a45c9] | 732 | +++ vim72/src/diff.c 2009-02-22 21:57:51.762059784 -0800
|
---|
| 733 | @@ -8,7 +8,7 @@
|
---|
| 734 | */
|
---|
| 735 |
|
---|
| 736 | /*
|
---|
| 737 | - * diff.c: code for diff'ing two or three buffers.
|
---|
| 738 | + * diff.c: code for diff'ing two, three or four buffers.
|
---|
| 739 | */
|
---|
| 740 |
|
---|
[76dd250] | 741 | #include "vim.h"
|
---|
| 742 | @@ -73,6 +73,8 @@
|
---|
| 743 | {
|
---|
| 744 | tp->tp_diffbuf[i] = NULL;
|
---|
| 745 | tp->tp_diff_invalid = TRUE;
|
---|
| 746 | + if (tp == curtab)
|
---|
| 747 | + diff_redraw(TRUE);
|
---|
| 748 | }
|
---|
| 749 | }
|
---|
| 750 | }
|
---|
| 751 | @@ -102,6 +104,7 @@
|
---|
| 752 | {
|
---|
| 753 | curtab->tp_diffbuf[i] = NULL;
|
---|
| 754 | curtab->tp_diff_invalid = TRUE;
|
---|
| 755 | + diff_redraw(TRUE);
|
---|
| 756 | }
|
---|
| 757 | }
|
---|
[5f4a45c9] | 758 | }
|
---|
| 759 | @@ -113,7 +116,7 @@
|
---|
| 760 | * Add a buffer to make diffs for.
|
---|
| 761 | * Call this when a new buffer is being edited in the current window where
|
---|
| 762 | * 'diff' is set.
|
---|
| 763 | - * Marks the current buffer as being part of the diff and requireing updating.
|
---|
| 764 | + * Marks the current buffer as being part of the diff and requiring updating.
|
---|
| 765 | * This must be done before any autocmd, because a command may use info
|
---|
| 766 | * about the screen contents.
|
---|
[76dd250] | 767 | */
|
---|
| 768 | @@ -131,6 +134,7 @@
|
---|
| 769 | {
|
---|
| 770 | curtab->tp_diffbuf[i] = buf;
|
---|
| 771 | curtab->tp_diff_invalid = TRUE;
|
---|
| 772 | + diff_redraw(TRUE);
|
---|
| 773 | return;
|
---|
| 774 | }
|
---|
| 775 |
|
---|
| 776 | @@ -661,6 +665,7 @@
|
---|
| 777 | char_u *tmp_diff;
|
---|
| 778 | FILE *fd;
|
---|
| 779 | int ok;
|
---|
| 780 | + int io_error = FALSE;
|
---|
| 781 |
|
---|
| 782 | /* Delete all diffblocks. */
|
---|
| 783 | diff_clear(curtab);
|
---|
| 784 | @@ -697,18 +702,26 @@
|
---|
| 785 | {
|
---|
| 786 | ok = FALSE;
|
---|
| 787 | fd = mch_fopen((char *)tmp_orig, "w");
|
---|
| 788 | - if (fd != NULL)
|
---|
| 789 | + if (fd == NULL)
|
---|
| 790 | + io_error = TRUE;
|
---|
| 791 | + else
|
---|
| 792 | {
|
---|
| 793 | - fwrite("line1\n", (size_t)6, (size_t)1, fd);
|
---|
| 794 | + if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1)
|
---|
| 795 | + io_error = TRUE;
|
---|
| 796 | fclose(fd);
|
---|
| 797 | fd = mch_fopen((char *)tmp_new, "w");
|
---|
| 798 | - if (fd != NULL)
|
---|
| 799 | + if (fd == NULL)
|
---|
| 800 | + io_error = TRUE;
|
---|
| 801 | + else
|
---|
| 802 | {
|
---|
| 803 | - fwrite("line2\n", (size_t)6, (size_t)1, fd);
|
---|
| 804 | + if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1)
|
---|
| 805 | + io_error = TRUE;
|
---|
| 806 | fclose(fd);
|
---|
| 807 | diff_file(tmp_orig, tmp_new, tmp_diff);
|
---|
| 808 | fd = mch_fopen((char *)tmp_diff, "r");
|
---|
| 809 | - if (fd != NULL)
|
---|
| 810 | + if (fd == NULL)
|
---|
| 811 | + io_error = TRUE;
|
---|
| 812 | + else
|
---|
| 813 | {
|
---|
| 814 | char_u linebuf[LBUFLEN];
|
---|
| 815 |
|
---|
| 816 | @@ -761,6 +774,8 @@
|
---|
| 817 | }
|
---|
| 818 | if (!ok)
|
---|
| 819 | {
|
---|
| 820 | + if (io_error)
|
---|
| 821 | + EMSG(_("E810: Cannot read or write temp files"));
|
---|
| 822 | EMSG(_("E97: Cannot create diffs"));
|
---|
| 823 | diff_a_works = MAYBE;
|
---|
[5f4a45c9] | 824 | #if defined(MSWIN) || defined(MSDOS)
|
---|
| 825 | @@ -914,7 +929,7 @@
|
---|
| 826 | goto theend;
|
---|
| 827 |
|
---|
| 828 | #ifdef UNIX
|
---|
| 829 | - /* Temporaraly chdir to /tmp, to avoid patching files in the current
|
---|
| 830 | + /* Temporarily chdir to /tmp, to avoid patching files in the current
|
---|
| 831 | * directory when the patch file contains more than one patch. When we
|
---|
| 832 | * have our own temp dir use that instead, it will be cleaned up when we
|
---|
[76dd250] | 833 | * exit (any .rej files created). Don't change directory if we can't
|
---|
| 834 | @@ -925,10 +940,10 @@
|
---|
| 835 | {
|
---|
| 836 | # ifdef TEMPDIRNAMES
|
---|
| 837 | if (vim_tempdir != NULL)
|
---|
| 838 | - mch_chdir((char *)vim_tempdir);
|
---|
| 839 | + ignored = mch_chdir((char *)vim_tempdir);
|
---|
| 840 | else
|
---|
| 841 | # endif
|
---|
| 842 | - mch_chdir("/tmp");
|
---|
| 843 | + ignored = mch_chdir("/tmp");
|
---|
| 844 | shorten_fnames(TRUE);
|
---|
| 845 | }
|
---|
[5f4a45c9] | 846 | #endif
|
---|
| 847 | @@ -2114,6 +2129,8 @@
|
---|
| 848 | EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg);
|
---|
| 849 | return;
|
---|
| 850 | }
|
---|
| 851 | + if (buf == curbuf)
|
---|
| 852 | + return; /* nothing to do */
|
---|
| 853 | idx_other = diff_buf_idx(buf);
|
---|
| 854 | if (idx_other == DB_COUNT)
|
---|
[7352c10] | 855 | {
|
---|
| 856 | diff -Naur vim72.orig/src/edit.c vim72/src/edit.c
|
---|
[54f612f] | 857 | --- vim72.orig/src/edit.c 2008-08-06 05:51:17.000000000 -0700
|
---|
[7352c10] | 858 | +++ vim72/src/edit.c 2009-02-22 21:58:02.962778041 -0800
|
---|
| 859 | @@ -147,6 +147,7 @@
|
---|
| 860 | static int ins_compl_bs __ARGS((void));
|
---|
| 861 | static void ins_compl_new_leader __ARGS((void));
|
---|
| 862 | static void ins_compl_addleader __ARGS((int c));
|
---|
| 863 | +static int ins_compl_len __ARGS((void));
|
---|
| 864 | static void ins_compl_restart __ARGS((void));
|
---|
| 865 | static void ins_compl_set_original_text __ARGS((char_u *str));
|
---|
| 866 | static void ins_compl_addfrommatch __ARGS((void));
|
---|
| 867 | @@ -197,7 +198,8 @@
|
---|
| 868 | static void mb_replace_pop_ins __ARGS((int cc));
|
---|
| 869 | #endif
|
---|
| 870 | static void replace_flush __ARGS((void));
|
---|
| 871 | -static void replace_do_bs __ARGS((void));
|
---|
| 872 | +static void replace_do_bs __ARGS((int limit_col));
|
---|
| 873 | +static int del_char_after_col __ARGS((int limit_col));
|
---|
| 874 | #ifdef FEAT_CINDENT
|
---|
| 875 | static int cindent_on __ARGS((void));
|
---|
| 876 | #endif
|
---|
| 877 | @@ -1933,6 +1935,8 @@
|
---|
| 878 | /*
|
---|
| 879 | * Backspace the cursor until the given column. Handles REPLACE and VREPLACE
|
---|
| 880 | * modes correctly. May also be used when not in insert mode at all.
|
---|
| 881 | + * Will attempt not to go before "col" even when there is a composing
|
---|
| 882 | + * character.
|
---|
| 883 | */
|
---|
| 884 | void
|
---|
[9a875fd] | 885 | backspace_until_column(col)
|
---|
[7352c10] | 886 | @@ -1942,13 +1946,50 @@
|
---|
| 887 | {
|
---|
| 888 | curwin->w_cursor.col--;
|
---|
| 889 | if (State & REPLACE_FLAG)
|
---|
| 890 | - replace_do_bs();
|
---|
| 891 | - else
|
---|
| 892 | - (void)del_char(FALSE);
|
---|
| 893 | + replace_do_bs(col);
|
---|
| 894 | + else if (!del_char_after_col(col))
|
---|
| 895 | + break;
|
---|
| 896 | }
|
---|
| 897 | }
|
---|
| 898 | #endif
|
---|
| 899 |
|
---|
| 900 | +/*
|
---|
| 901 | + * Like del_char(), but make sure not to go before column "limit_col".
|
---|
| 902 | + * Only matters when there are composing characters.
|
---|
| 903 | + * Return TRUE when something was deleted.
|
---|
[9a875fd] | 904 | + */
|
---|
[7352c10] | 905 | +/*ARGSUSED*/
|
---|
| 906 | + static int
|
---|
| 907 | +del_char_after_col(limit_col)
|
---|
| 908 | + int limit_col;
|
---|
| 909 | +{
|
---|
| 910 | +#ifdef FEAT_MBYTE
|
---|
| 911 | + if (enc_utf8 && limit_col >= 0)
|
---|
| 912 | + {
|
---|
| 913 | + int ecol = curwin->w_cursor.col + 1;
|
---|
| 914 | +
|
---|
| 915 | + /* Make sure the cursor is at the start of a character, but
|
---|
| 916 | + * skip forward again when going too far back because of a
|
---|
| 917 | + * composing character. */
|
---|
[9a875fd] | 918 | + mb_adjust_cursor();
|
---|
[7352c10] | 919 | + while (curwin->w_cursor.col < (colnr_T)limit_col)
|
---|
| 920 | + {
|
---|
| 921 | + int l = utf_ptr2len(ml_get_cursor());
|
---|
| 922 | +
|
---|
| 923 | + if (l == 0) /* end of line */
|
---|
| 924 | + break;
|
---|
| 925 | + curwin->w_cursor.col += l;
|
---|
| 926 | + }
|
---|
| 927 | + if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol)
|
---|
| 928 | + return FALSE;
|
---|
| 929 | + del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE);
|
---|
| 930 | + }
|
---|
| 931 | + else
|
---|
| 932 | +#endif
|
---|
| 933 | + (void)del_char(FALSE);
|
---|
| 934 | + return TRUE;
|
---|
| 935 | +}
|
---|
| 936 | +
|
---|
| 937 | #if defined(FEAT_INS_EXPAND) || defined(PROTO)
|
---|
| 938 | /*
|
---|
[9a875fd] | 939 | * CTRL-X pressed in Insert mode.
|
---|
[7352c10] | 940 | @@ -2418,7 +2459,7 @@
|
---|
| 941 | {
|
---|
| 942 | had_match = (curwin->w_cursor.col > compl_col);
|
---|
| 943 | ins_compl_delete();
|
---|
| 944 | - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
---|
| 945 | + ins_bytes(compl_leader + ins_compl_len());
|
---|
| 946 | ins_redraw(FALSE);
|
---|
| 947 |
|
---|
[9a875fd] | 948 | /* When the match isn't there (to avoid matching itself) remove it
|
---|
[7352c10] | 949 | @@ -2470,7 +2511,7 @@
|
---|
| 950 | *p = NUL;
|
---|
| 951 | had_match = (curwin->w_cursor.col > compl_col);
|
---|
| 952 | ins_compl_delete();
|
---|
| 953 | - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
---|
| 954 | + ins_bytes(compl_leader + ins_compl_len());
|
---|
| 955 | ins_redraw(FALSE);
|
---|
| 956 |
|
---|
[9a875fd] | 957 | /* When the match isn't there (to avoid matching itself) remove it
|
---|
[7352c10] | 958 | @@ -3209,7 +3250,7 @@
|
---|
| 959 | {
|
---|
| 960 | ins_compl_del_pum();
|
---|
| 961 | ins_compl_delete();
|
---|
| 962 | - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
---|
| 963 | + ins_bytes(compl_leader + ins_compl_len());
|
---|
| 964 | compl_used_match = FALSE;
|
---|
| 965 |
|
---|
[9a875fd] | 966 | if (compl_started)
|
---|
[7352c10] | 967 | @@ -3264,6 +3305,20 @@
|
---|
| 968 | }
|
---|
| 969 |
|
---|
| 970 | /*
|
---|
| 971 | + * Return the length of the completion, from the completion start column to
|
---|
| 972 | + * the cursor column. Making sure it never goes below zero.
|
---|
| 973 | + */
|
---|
| 974 | + static int
|
---|
| 975 | +ins_compl_len()
|
---|
| 976 | +{
|
---|
| 977 | + int off = curwin->w_cursor.col - compl_col;
|
---|
| 978 | +
|
---|
| 979 | + if (off < 0)
|
---|
| 980 | + return 0;
|
---|
| 981 | + return off;
|
---|
| 982 | +}
|
---|
| 983 | +
|
---|
| 984 | +/*
|
---|
| 985 | * Append one character to the match leader. May reduce the number of
|
---|
| 986 | * matches.
|
---|
[9a875fd] | 987 | */
|
---|
[7352c10] | 988 | @@ -3621,10 +3676,9 @@
|
---|
| 989 | {
|
---|
| 990 | ins_compl_delete();
|
---|
| 991 | if (compl_leader != NULL)
|
---|
| 992 | - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
---|
| 993 | + ins_bytes(compl_leader + ins_compl_len());
|
---|
| 994 | else if (compl_first_match != NULL)
|
---|
| 995 | - ins_bytes(compl_orig_text
|
---|
| 996 | - + curwin->w_cursor.col - compl_col);
|
---|
| 997 | + ins_bytes(compl_orig_text + ins_compl_len());
|
---|
| 998 | retval = TRUE;
|
---|
| 999 | }
|
---|
[9a875fd] | 1000 |
|
---|
| 1001 | @@ -4187,7 +4241,7 @@
|
---|
| 1002 | }
|
---|
| 1003 |
|
---|
| 1004 | /* check if compl_curr_match has changed, (e.g. other type of
|
---|
| 1005 | - * expansion added somenthing) */
|
---|
| 1006 | + * expansion added something) */
|
---|
| 1007 | if (type != 0 && compl_curr_match != old_match)
|
---|
| 1008 | found_new_match = OK;
|
---|
| 1009 |
|
---|
[7352c10] | 1010 | @@ -4256,7 +4310,7 @@
|
---|
| 1011 | static void
|
---|
| 1012 | ins_compl_insert()
|
---|
| 1013 | {
|
---|
| 1014 | - ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col);
|
---|
| 1015 | + ins_bytes(compl_shown_match->cp_str + ins_compl_len());
|
---|
| 1016 | if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
|
---|
| 1017 | compl_used_match = FALSE;
|
---|
[9a875fd] | 1018 | else
|
---|
[7352c10] | 1019 | @@ -4425,7 +4479,7 @@
|
---|
| 1020 | if (!compl_get_longest || compl_used_match)
|
---|
| 1021 | ins_compl_insert();
|
---|
| 1022 | else
|
---|
| 1023 | - ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
---|
| 1024 | + ins_bytes(compl_leader + ins_compl_len());
|
---|
| 1025 | }
|
---|
| 1026 | else
|
---|
[9a875fd] | 1027 | compl_used_match = FALSE;
|
---|
| 1028 | @@ -4688,7 +4742,7 @@
|
---|
| 1029 | }
|
---|
| 1030 | compl_length = curwin->w_cursor.col - (int)compl_col;
|
---|
| 1031 | /* IObuff is used to add a "word from the next line" would we
|
---|
| 1032 | - * have enough space? just being paranoic */
|
---|
| 1033 | + * have enough space? just being paranoid */
|
---|
| 1034 | #define MIN_SPACE 75
|
---|
| 1035 | if (compl_length > (IOSIZE - MIN_SPACE))
|
---|
| 1036 | {
|
---|
[7352c10] | 1037 | @@ -7123,9 +7177,12 @@
|
---|
| 1038 | * cc == 0: character was inserted, delete it
|
---|
| 1039 | * cc > 0: character was replaced, put cc (first byte of original char) back
|
---|
| 1040 | * and check for more characters to be put back
|
---|
| 1041 | + * When "limit_col" is >= 0, don't delete before this column. Matters when
|
---|
| 1042 | + * using composing characters, use del_char_after_col() instead of del_char().
|
---|
| 1043 | */
|
---|
| 1044 | static void
|
---|
| 1045 | -replace_do_bs()
|
---|
| 1046 | +replace_do_bs(limit_col)
|
---|
| 1047 | + int limit_col;
|
---|
| 1048 | {
|
---|
| 1049 | int cc;
|
---|
[9a875fd] | 1050 | #ifdef FEAT_VREPLACE
|
---|
[7352c10] | 1051 | @@ -7153,7 +7210,7 @@
|
---|
| 1052 | #ifdef FEAT_MBYTE
|
---|
| 1053 | if (has_mbyte)
|
---|
| 1054 | {
|
---|
| 1055 | - del_char(FALSE);
|
---|
| 1056 | + (void)del_char_after_col(limit_col);
|
---|
| 1057 | # ifdef FEAT_VREPLACE
|
---|
| 1058 | if (State & VREPLACE_FLAG)
|
---|
[9a875fd] | 1059 | orig_len = (int)STRLEN(ml_get_cursor());
|
---|
[7352c10] | 1060 | @@ -7203,7 +7260,7 @@
|
---|
| 1061 | changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
|
---|
| 1062 | }
|
---|
| 1063 | else if (cc == 0)
|
---|
| 1064 | - (void)del_char(FALSE);
|
---|
| 1065 | + (void)del_char_after_col(limit_col);
|
---|
| 1066 | }
|
---|
| 1067 |
|
---|
[54f612f] | 1068 | #ifdef FEAT_CINDENT
|
---|
| 1069 | @@ -7646,9 +7703,7 @@
|
---|
| 1070 | */
|
---|
| 1071 | ++no_mapping;
|
---|
| 1072 | regname = plain_vgetc();
|
---|
| 1073 | -#ifdef FEAT_LANGMAP
|
---|
| 1074 | LANGMAP_ADJUST(regname, TRUE);
|
---|
| 1075 | -#endif
|
---|
| 1076 | if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P)
|
---|
| 1077 | {
|
---|
| 1078 | /* Get a third key for literal register insertion */
|
---|
| 1079 | @@ -7657,9 +7712,7 @@
|
---|
| 1080 | add_to_showcmd_c(literally);
|
---|
| 1081 | #endif
|
---|
| 1082 | regname = plain_vgetc();
|
---|
| 1083 | -#ifdef FEAT_LANGMAP
|
---|
| 1084 | LANGMAP_ADJUST(regname, TRUE);
|
---|
| 1085 | -#endif
|
---|
| 1086 | }
|
---|
| 1087 | --no_mapping;
|
---|
| 1088 |
|
---|
[9a875fd] | 1089 | @@ -8150,7 +8203,7 @@
|
---|
| 1090 | /*
|
---|
| 1091 | * If the cursor is on an indent, ^T/^D insert/delete one
|
---|
| 1092 | * shiftwidth. Otherwise ^T/^D behave like a "<<" or ">>".
|
---|
| 1093 | - * Always round the indent to 'shiftwith', this is compatible
|
---|
| 1094 | + * Always round the indent to 'shiftwidth', this is compatible
|
---|
| 1095 | * with vi. But vi only supports ^T and ^D after an
|
---|
| 1096 | * autoindent, we support it everywhere.
|
---|
[54f612f] | 1097 | */
|
---|
[7352c10] | 1098 | @@ -8239,7 +8292,7 @@
|
---|
| 1099 | * Replace mode */
|
---|
| 1100 | if (curwin->w_cursor.lnum != Insstart.lnum
|
---|
| 1101 | || curwin->w_cursor.col >= Insstart.col)
|
---|
| 1102 | - replace_do_bs();
|
---|
| 1103 | + replace_do_bs(-1);
|
---|
| 1104 | }
|
---|
| 1105 | else
|
---|
[54f612f] | 1106 | (void)del_char(FALSE);
|
---|
[7352c10] | 1107 | @@ -8556,7 +8609,7 @@
|
---|
| 1108 | break;
|
---|
| 1109 | }
|
---|
| 1110 | if (State & REPLACE_FLAG)
|
---|
| 1111 | - replace_do_bs();
|
---|
| 1112 | + replace_do_bs(-1);
|
---|
| 1113 | else
|
---|
| 1114 | {
|
---|
[76dd250] | 1115 | #ifdef FEAT_MBYTE
|
---|
| 1116 | diff -Naur vim72.orig/src/eval.c vim72/src/eval.c
|
---|
[54f612f] | 1117 | --- vim72.orig/src/eval.c 2008-08-07 12:37:22.000000000 -0700
|
---|
[1f22c7c] | 1118 | +++ vim72/src/eval.c 2009-02-22 21:58:00.290604274 -0800
|
---|
| 1119 | @@ -32,6 +32,9 @@
|
---|
| 1120 |
|
---|
| 1121 | #define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
|
---|
| 1122 |
|
---|
| 1123 | +#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not
|
---|
| 1124 | + be freed. */
|
---|
| 1125 | +
|
---|
| 1126 | /*
|
---|
| 1127 | * In a hashtab item "hi_key" points to "di_key" in a dictitem.
|
---|
| 1128 | * This avoids adding a pointer to the hashtab item.
|
---|
[76dd250] | 1129 | @@ -348,6 +351,7 @@
|
---|
| 1130 | {VV_NAME("mouse_col", VAR_NUMBER), 0},
|
---|
| 1131 | {VV_NAME("operator", VAR_STRING), VV_RO},
|
---|
| 1132 | {VV_NAME("searchforward", VAR_NUMBER), 0},
|
---|
| 1133 | + {VV_NAME("oldfiles", VAR_LIST), 0},
|
---|
| 1134 | };
|
---|
| 1135 |
|
---|
[1f22c7c] | 1136 | /* shorthand */
|
---|
[76dd250] | 1137 | @@ -355,6 +359,7 @@
|
---|
| 1138 | #define vv_nr vv_di.di_tv.vval.v_number
|
---|
| 1139 | #define vv_float vv_di.di_tv.vval.v_float
|
---|
| 1140 | #define vv_str vv_di.di_tv.vval.v_string
|
---|
| 1141 | +#define vv_list vv_di.di_tv.vval.v_list
|
---|
| 1142 | #define vv_tv vv_di.di_tv
|
---|
| 1143 |
|
---|
[1f22c7c] | 1144 | /*
|
---|
[76dd250] | 1145 | @@ -426,7 +431,6 @@
|
---|
| 1146 | static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
|
---|
| 1147 | static void list_append __ARGS((list_T *l, listitem_T *item));
|
---|
| 1148 | static int list_append_tv __ARGS((list_T *l, typval_T *tv));
|
---|
| 1149 | -static int list_append_string __ARGS((list_T *l, char_u *str, int len));
|
---|
| 1150 | static int list_append_number __ARGS((list_T *l, varnumber_T n));
|
---|
| 1151 | static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
|
---|
[1f22c7c] | 1152 | static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef));
|
---|
| 1153 | @@ -788,6 +792,8 @@
|
---|
| 1154 | static void func_unref __ARGS((char_u *name));
|
---|
| 1155 | static void func_ref __ARGS((char_u *name));
|
---|
| 1156 | 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));
|
---|
| 1157 | +static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ;
|
---|
| 1158 | +static void free_funccal __ARGS((funccall_T *fc, int free_val));
|
---|
| 1159 | static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr));
|
---|
| 1160 | static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp));
|
---|
| 1161 | static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
|
---|
[76dd250] | 1162 | @@ -845,11 +851,17 @@
|
---|
| 1163 | p = &vimvars[i];
|
---|
| 1164 | if (p->vv_di.di_tv.v_type == VAR_STRING)
|
---|
| 1165 | {
|
---|
| 1166 | - vim_free(p->vv_di.di_tv.vval.v_string);
|
---|
| 1167 | - p->vv_di.di_tv.vval.v_string = NULL;
|
---|
| 1168 | + vim_free(p->vv_str);
|
---|
| 1169 | + p->vv_str = NULL;
|
---|
| 1170 | + }
|
---|
| 1171 | + else if (p->vv_di.di_tv.v_type == VAR_LIST)
|
---|
| 1172 | + {
|
---|
| 1173 | + list_unref(p->vv_list);
|
---|
| 1174 | + p->vv_list = NULL;
|
---|
| 1175 | }
|
---|
| 1176 | }
|
---|
| 1177 | hash_clear(&vimvarht);
|
---|
| 1178 | + hash_init(&vimvarht); /* garbage_collect() will access it */
|
---|
| 1179 | hash_clear(&compat_hashtab);
|
---|
| 1180 |
|
---|
[1f22c7c] | 1181 | /* script-local variables */
|
---|
| 1182 | @@ -916,6 +928,10 @@
|
---|
| 1183 | /* pointer to funccal for currently active function */
|
---|
| 1184 | funccall_T *current_funccal = NULL;
|
---|
| 1185 |
|
---|
| 1186 | +/* pointer to list of previously used funccal, still around because some
|
---|
| 1187 | + * item in it is still being used. */
|
---|
| 1188 | +funccall_T *previous_funccal = NULL;
|
---|
| 1189 | +
|
---|
| 1190 | /*
|
---|
| 1191 | * Return TRUE when a function was ended by a ":return" command.
|
---|
| 1192 | */
|
---|
[76dd250] | 1193 | @@ -1256,23 +1272,26 @@
|
---|
| 1194 |
|
---|
| 1195 | /*
|
---|
| 1196 | * Top level evaluation function, returning a string.
|
---|
| 1197 | + * When "convert" is TRUE convert a List into a sequence of lines and convert
|
---|
| 1198 | + * a Float to a String.
|
---|
| 1199 | * Return pointer to allocated memory, or NULL for failure.
|
---|
| 1200 | */
|
---|
| 1201 | char_u *
|
---|
| 1202 | -eval_to_string(arg, nextcmd, dolist)
|
---|
| 1203 | +eval_to_string(arg, nextcmd, convert)
|
---|
| 1204 | char_u *arg;
|
---|
| 1205 | char_u **nextcmd;
|
---|
| 1206 | - int dolist; /* turn List into sequence of lines */
|
---|
| 1207 | + int convert;
|
---|
| 1208 | {
|
---|
| 1209 | typval_T tv;
|
---|
| 1210 | char_u *retval;
|
---|
| 1211 | garray_T ga;
|
---|
| 1212 | + char_u numbuf[NUMBUFLEN];
|
---|
| 1213 |
|
---|
| 1214 | if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
|
---|
| 1215 | retval = NULL;
|
---|
| 1216 | else
|
---|
| 1217 | {
|
---|
| 1218 | - if (dolist && tv.v_type == VAR_LIST)
|
---|
| 1219 | + if (convert && tv.v_type == VAR_LIST)
|
---|
| 1220 | {
|
---|
| 1221 | ga_init2(&ga, (int)sizeof(char), 80);
|
---|
[1f22c7c] | 1222 | if (tv.vval.v_list != NULL)
|
---|
[76dd250] | 1223 | @@ -1280,6 +1299,13 @@
|
---|
| 1224 | ga_append(&ga, NUL);
|
---|
| 1225 | retval = (char_u *)ga.ga_data;
|
---|
| 1226 | }
|
---|
| 1227 | +#ifdef FEAT_FLOAT
|
---|
| 1228 | + else if (convert && tv.v_type == VAR_FLOAT)
|
---|
| 1229 | + {
|
---|
| 1230 | + vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
|
---|
| 1231 | + retval = vim_strsave(numbuf);
|
---|
| 1232 | + }
|
---|
| 1233 | +#endif
|
---|
| 1234 | else
|
---|
| 1235 | retval = vim_strsave(get_tv_string(&tv));
|
---|
[1f22c7c] | 1236 | clear_tv(&tv);
|
---|
[76dd250] | 1237 | @@ -3277,7 +3303,7 @@
|
---|
| 1238 |
|
---|
| 1239 | if (*startarg != '(')
|
---|
| 1240 | {
|
---|
| 1241 | - EMSG2(_("E107: Missing braces: %s"), eap->arg);
|
---|
| 1242 | + EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
|
---|
| 1243 | goto end;
|
---|
| 1244 | }
|
---|
[1f22c7c] | 1245 |
|
---|
[76dd250] | 1246 | @@ -3657,8 +3683,8 @@
|
---|
| 1247 | }
|
---|
| 1248 |
|
---|
| 1249 | /*
|
---|
| 1250 | - * Return TRUE if typeval "tv" is locked: Either tha value is locked itself or
|
---|
| 1251 | - * it refers to a List or Dictionary that is locked.
|
---|
| 1252 | + * Return TRUE if typeval "tv" is locked: Either that value is locked itself
|
---|
| 1253 | + * or it refers to a List or Dictionary that is locked.
|
---|
| 1254 | */
|
---|
| 1255 | static int
|
---|
[9a875fd] | 1256 | tv_islocked(tv)
|
---|
| 1257 | @@ -3902,7 +3928,7 @@
|
---|
| 1258 |
|
---|
| 1259 | /*
|
---|
| 1260 | * Handle top level expression:
|
---|
| 1261 | - * expr1 ? expr0 : expr0
|
---|
| 1262 | + * expr2 ? expr1 : expr1
|
---|
| 1263 | *
|
---|
| 1264 | * "arg" must point to the first non-white of the expression.
|
---|
[1f22c7c] | 1265 | * "arg" is advanced to the next non-white after the recognized expression.
|
---|
[76dd250] | 1266 | @@ -6047,6 +6073,25 @@
|
---|
| 1267 | }
|
---|
| 1268 |
|
---|
| 1269 | /*
|
---|
| 1270 | + * Get list item "l[idx - 1]" as a string. Returns NULL for failure.
|
---|
| 1271 | + */
|
---|
| 1272 | + char_u *
|
---|
| 1273 | +list_find_str(l, idx)
|
---|
| 1274 | + list_T *l;
|
---|
| 1275 | + long idx;
|
---|
| 1276 | +{
|
---|
| 1277 | + listitem_T *li;
|
---|
| 1278 | +
|
---|
| 1279 | + li = list_find(l, idx - 1);
|
---|
| 1280 | + if (li == NULL)
|
---|
| 1281 | + {
|
---|
| 1282 | + EMSGN(_(e_listidx), idx);
|
---|
| 1283 | + return NULL;
|
---|
| 1284 | + }
|
---|
| 1285 | + return get_tv_string(&li->li_tv);
|
---|
| 1286 | +}
|
---|
| 1287 | +
|
---|
| 1288 | +/*
|
---|
| 1289 | * Locate "item" list "l" and return its index.
|
---|
| 1290 | * Returns -1 when "item" is not in the list.
|
---|
[1f22c7c] | 1291 | */
|
---|
[76dd250] | 1292 | @@ -6137,7 +6182,7 @@
|
---|
| 1293 | * When "len" >= 0 use "str[len]".
|
---|
| 1294 | * Returns FAIL when out of memory.
|
---|
| 1295 | */
|
---|
| 1296 | - static int
|
---|
| 1297 | + int
|
---|
| 1298 | list_append_string(l, str, len)
|
---|
| 1299 | list_T *l;
|
---|
[1f22c7c] | 1300 | char_u *str;
|
---|
| 1301 | @@ -6454,7 +6499,7 @@
|
---|
| 1302 | buf_T *buf;
|
---|
| 1303 | win_T *wp;
|
---|
| 1304 | int i;
|
---|
| 1305 | - funccall_T *fc;
|
---|
| 1306 | + funccall_T *fc, **pfc;
|
---|
| 1307 | int did_free = FALSE;
|
---|
| 1308 | #ifdef FEAT_WINDOWS
|
---|
| 1309 | tabpage_T *tp;
|
---|
[76dd250] | 1310 | @@ -6497,6 +6542,9 @@
|
---|
| 1311 | set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
|
---|
| 1312 | }
|
---|
| 1313 |
|
---|
| 1314 | + /* v: vars */
|
---|
| 1315 | + set_ref_in_ht(&vimvarht, copyID);
|
---|
| 1316 | +
|
---|
| 1317 | /*
|
---|
| 1318 | * 2. Go through the list of dicts and free items without the copyID.
|
---|
[1f22c7c] | 1319 | */
|
---|
| 1320 | @@ -6535,6 +6583,20 @@
|
---|
| 1321 | else
|
---|
| 1322 | ll = ll->lv_used_next;
|
---|
| 1323 |
|
---|
| 1324 | + /* check if any funccal can be freed now */
|
---|
| 1325 | + for (pfc = &previous_funccal; *pfc != NULL; )
|
---|
| 1326 | + {
|
---|
| 1327 | + if (can_free_funccal(*pfc, copyID))
|
---|
| 1328 | + {
|
---|
| 1329 | + fc = *pfc;
|
---|
| 1330 | + *pfc = fc->caller;
|
---|
| 1331 | + free_funccal(fc, TRUE);
|
---|
| 1332 | + did_free = TRUE;
|
---|
| 1333 | + }
|
---|
| 1334 | + else
|
---|
| 1335 | + pfc = &(*pfc)->caller;
|
---|
| 1336 | + }
|
---|
| 1337 | +
|
---|
| 1338 | return did_free;
|
---|
| 1339 | }
|
---|
| 1340 |
|
---|
[76dd250] | 1341 | @@ -6587,7 +6649,7 @@
|
---|
| 1342 | {
|
---|
| 1343 | case VAR_DICT:
|
---|
| 1344 | dd = tv->vval.v_dict;
|
---|
| 1345 | - if (dd->dv_copyID != copyID)
|
---|
| 1346 | + if (dd != NULL && dd->dv_copyID != copyID)
|
---|
| 1347 | {
|
---|
| 1348 | /* Didn't see this dict yet. */
|
---|
[1f22c7c] | 1349 | dd->dv_copyID = copyID;
|
---|
[76dd250] | 1350 | @@ -6597,7 +6659,7 @@
|
---|
| 1351 |
|
---|
| 1352 | case VAR_LIST:
|
---|
| 1353 | ll = tv->vval.v_list;
|
---|
| 1354 | - if (ll->lv_copyID != copyID)
|
---|
| 1355 | + if (ll != NULL && ll->lv_copyID != copyID)
|
---|
| 1356 | {
|
---|
| 1357 | /* Didn't see this list yet. */
|
---|
[1f22c7c] | 1358 | ll->lv_copyID = copyID;
|
---|
[76dd250] | 1359 | @@ -7525,8 +7587,8 @@
|
---|
| 1360 | {"getwinposx", 0, 0, f_getwinposx},
|
---|
| 1361 | {"getwinposy", 0, 0, f_getwinposy},
|
---|
| 1362 | {"getwinvar", 2, 2, f_getwinvar},
|
---|
| 1363 | - {"glob", 1, 1, f_glob},
|
---|
| 1364 | - {"globpath", 2, 2, f_globpath},
|
---|
| 1365 | + {"glob", 1, 2, f_glob},
|
---|
| 1366 | + {"globpath", 2, 3, f_globpath},
|
---|
| 1367 | {"has", 1, 1, f_has},
|
---|
| 1368 | {"has_key", 2, 2, f_has_key},
|
---|
[5f4a45c9] | 1369 | {"haslocaldir", 0, 0, f_haslocaldir},
|
---|
| 1370 | @@ -7856,9 +7918,9 @@
|
---|
| 1371 | else if (!aborting())
|
---|
| 1372 | {
|
---|
| 1373 | if (argcount == MAX_FUNC_ARGS)
|
---|
| 1374 | - emsg_funcname("E740: Too many arguments for function %s", name);
|
---|
| 1375 | + emsg_funcname(N_("E740: Too many arguments for function %s"), name);
|
---|
| 1376 | else
|
---|
| 1377 | - emsg_funcname("E116: Invalid arguments for function %s", name);
|
---|
| 1378 | + emsg_funcname(N_("E116: Invalid arguments for function %s"), name);
|
---|
| 1379 | }
|
---|
| 1380 |
|
---|
| 1381 | while (--argcount >= 0)
|
---|
| 1382 | @@ -8091,6 +8153,7 @@
|
---|
| 1383 |
|
---|
| 1384 | /*
|
---|
| 1385 | * Give an error message with a function name. Handle <SNR> things.
|
---|
| 1386 | + * "ermsg" is to be passed without translation, use N_() instead of _().
|
---|
| 1387 | */
|
---|
| 1388 | static void
|
---|
| 1389 | emsg_funcname(ermsg, name)
|
---|
[76dd250] | 1390 | @@ -9518,7 +9581,7 @@
|
---|
| 1391 | else
|
---|
| 1392 | {
|
---|
| 1393 | /* When the optional second argument is non-zero, don't remove matches
|
---|
| 1394 | - * for 'suffixes' and 'wildignore' */
|
---|
| 1395 | + * for 'wildignore' and don't put matches for 'suffixes' at the end. */
|
---|
| 1396 | if (argvars[1].v_type != VAR_UNKNOWN
|
---|
| 1397 | && get_tv_number_chk(&argvars[1], &error))
|
---|
[5f4a45c9] | 1398 | flags |= WILD_KEEP_ALL;
|
---|
[76dd250] | 1399 | @@ -10300,7 +10363,8 @@
|
---|
| 1400 | s = get_tv_string(&argvars[0]);
|
---|
| 1401 | if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
|
---|
| 1402 | EMSG2(_(e_invarg2), s);
|
---|
| 1403 | - else if (!function_exists(s))
|
---|
| 1404 | + /* Don't check an autoload name for existence here. */
|
---|
| 1405 | + else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
|
---|
| 1406 | EMSG2(_("E700: Unknown function: %s"), s);
|
---|
| 1407 | else
|
---|
[5f4a45c9] | 1408 | {
|
---|
[76dd250] | 1409 | @@ -10602,7 +10666,7 @@
|
---|
| 1410 | # ifdef FEAT_WINDOWS
|
---|
| 1411 | win_T *wp;
|
---|
| 1412 | # endif
|
---|
| 1413 | - int n = 1;
|
---|
| 1414 | + int winnr = 1;
|
---|
| 1415 |
|
---|
| 1416 | if (row >= 0 && col >= 0)
|
---|
[5f4a45c9] | 1417 | {
|
---|
[76dd250] | 1418 | @@ -10612,9 +10676,9 @@
|
---|
| 1419 | (void)mouse_comp_pos(win, &row, &col, &lnum);
|
---|
| 1420 | # ifdef FEAT_WINDOWS
|
---|
| 1421 | for (wp = firstwin; wp != win; wp = wp->w_next)
|
---|
| 1422 | - ++n;
|
---|
| 1423 | + ++winnr;
|
---|
| 1424 | # endif
|
---|
| 1425 | - vimvars[VV_MOUSE_WIN].vv_nr = n;
|
---|
| 1426 | + vimvars[VV_MOUSE_WIN].vv_nr = winnr;
|
---|
| 1427 | vimvars[VV_MOUSE_LNUM].vv_nr = lnum;
|
---|
| 1428 | vimvars[VV_MOUSE_COL].vv_nr = col + 1;
|
---|
[5f4a45c9] | 1429 | }
|
---|
[76dd250] | 1430 | @@ -11284,13 +11348,25 @@
|
---|
| 1431 | typval_T *argvars;
|
---|
| 1432 | typval_T *rettv;
|
---|
| 1433 | {
|
---|
| 1434 | + int flags = WILD_SILENT|WILD_USE_NL;
|
---|
| 1435 | expand_T xpc;
|
---|
| 1436 | + int error = FALSE;
|
---|
| 1437 |
|
---|
| 1438 | - ExpandInit(&xpc);
|
---|
| 1439 | - xpc.xp_context = EXPAND_FILES;
|
---|
| 1440 | + /* When the optional second argument is non-zero, don't remove matches
|
---|
| 1441 | + * for 'wildignore' and don't put matches for 'suffixes' at the end. */
|
---|
| 1442 | + if (argvars[1].v_type != VAR_UNKNOWN
|
---|
| 1443 | + && get_tv_number_chk(&argvars[1], &error))
|
---|
| 1444 | + flags |= WILD_KEEP_ALL;
|
---|
| 1445 | rettv->v_type = VAR_STRING;
|
---|
| 1446 | - rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
|
---|
| 1447 | - NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
|
---|
| 1448 | + if (!error)
|
---|
| 1449 | + {
|
---|
| 1450 | + ExpandInit(&xpc);
|
---|
| 1451 | + xpc.xp_context = EXPAND_FILES;
|
---|
| 1452 | + rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
|
---|
| 1453 | + NULL, flags, WILD_ALL);
|
---|
| 1454 | + }
|
---|
| 1455 | + else
|
---|
| 1456 | + rettv->vval.v_string = NULL;
|
---|
| 1457 | }
|
---|
| 1458 |
|
---|
[5f4a45c9] | 1459 | /*
|
---|
[76dd250] | 1460 | @@ -11301,14 +11377,22 @@
|
---|
| 1461 | typval_T *argvars;
|
---|
| 1462 | typval_T *rettv;
|
---|
| 1463 | {
|
---|
| 1464 | + int flags = 0;
|
---|
| 1465 | char_u buf1[NUMBUFLEN];
|
---|
| 1466 | char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
|
---|
| 1467 | + int error = FALSE;
|
---|
| 1468 |
|
---|
| 1469 | + /* When the optional second argument is non-zero, don't remove matches
|
---|
| 1470 | + * for 'wildignore' and don't put matches for 'suffixes' at the end. */
|
---|
| 1471 | + if (argvars[2].v_type != VAR_UNKNOWN
|
---|
| 1472 | + && get_tv_number_chk(&argvars[2], &error))
|
---|
| 1473 | + flags |= WILD_KEEP_ALL;
|
---|
| 1474 | rettv->v_type = VAR_STRING;
|
---|
| 1475 | - if (file == NULL)
|
---|
| 1476 | + if (file == NULL || error)
|
---|
| 1477 | rettv->vval.v_string = NULL;
|
---|
| 1478 | else
|
---|
| 1479 | - rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
|
---|
| 1480 | + rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
|
---|
| 1481 | + flags);
|
---|
| 1482 | }
|
---|
| 1483 |
|
---|
[5f4a45c9] | 1484 | /*
|
---|
[76dd250] | 1485 | @@ -11782,6 +11866,10 @@
|
---|
| 1486 | n = has_patch(atoi((char *)name + 5));
|
---|
| 1487 | else if (STRICMP(name, "vim_starting") == 0)
|
---|
| 1488 | n = (starting != 0);
|
---|
| 1489 | +#ifdef FEAT_MBYTE
|
---|
| 1490 | + else if (STRICMP(name, "multi_byte_encoding") == 0)
|
---|
| 1491 | + n = has_mbyte;
|
---|
| 1492 | +#endif
|
---|
| 1493 | #if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32)
|
---|
| 1494 | else if (STRICMP(name, "balloon_multiline") == 0)
|
---|
[5f4a45c9] | 1495 | n = multiline_balloon_available();
|
---|
[76dd250] | 1496 | @@ -15838,10 +15926,9 @@
|
---|
| 1497 | if (res == FAIL)
|
---|
| 1498 | res = ITEM_COMPARE_FAIL;
|
---|
| 1499 | else
|
---|
| 1500 | - /* return value has wrong type */
|
---|
| 1501 | res = get_tv_number_chk(&rettv, &item_compare_func_err);
|
---|
| 1502 | if (item_compare_func_err)
|
---|
| 1503 | - res = ITEM_COMPARE_FAIL;
|
---|
| 1504 | + res = ITEM_COMPARE_FAIL; /* return value has wrong type */
|
---|
| 1505 | clear_tv(&rettv);
|
---|
| 1506 | return res;
|
---|
[5f4a45c9] | 1507 | }
|
---|
[76dd250] | 1508 | @@ -16590,8 +16677,11 @@
|
---|
| 1509 | p = highlight_has_attr(id, HL_INVERSE, modec);
|
---|
| 1510 | break;
|
---|
| 1511 |
|
---|
| 1512 | - case 's': /* standout */
|
---|
| 1513 | - p = highlight_has_attr(id, HL_STANDOUT, modec);
|
---|
| 1514 | + case 's':
|
---|
| 1515 | + if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */
|
---|
| 1516 | + p = highlight_color(id, what, modec);
|
---|
| 1517 | + else /* standout */
|
---|
| 1518 | + p = highlight_has_attr(id, HL_STANDOUT, modec);
|
---|
| 1519 | break;
|
---|
| 1520 |
|
---|
[5f4a45c9] | 1521 | case 'u':
|
---|
[76dd250] | 1522 | @@ -16658,7 +16748,7 @@
|
---|
| 1523 | col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
|
---|
| 1524 |
|
---|
| 1525 | if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
|
---|
| 1526 | - && col >= 0 && col < (long)STRLEN(ml_get(lnum))
|
---|
| 1527 | + && col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum)))
|
---|
| 1528 | && rettv_list_alloc(rettv) != FAIL)
|
---|
| 1529 | {
|
---|
[5f4a45c9] | 1530 | (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
|
---|
[76dd250] | 1531 | @@ -18097,14 +18187,28 @@
|
---|
| 1532 | }
|
---|
| 1533 |
|
---|
| 1534 | /*
|
---|
| 1535 | - * Set v:count, v:count1 and v:prevcount.
|
---|
| 1536 | + * Get List v: variable value. Caller must take care of reference count when
|
---|
| 1537 | + * needed.
|
---|
| 1538 | + */
|
---|
| 1539 | + list_T *
|
---|
| 1540 | +get_vim_var_list(idx)
|
---|
| 1541 | + int idx;
|
---|
| 1542 | +{
|
---|
| 1543 | + return vimvars[idx].vv_list;
|
---|
| 1544 | +}
|
---|
| 1545 | +
|
---|
| 1546 | +/*
|
---|
| 1547 | + * Set v:count to "count" and v:count1 to "count1".
|
---|
| 1548 | + * When "set_prevcount" is TRUE first set v:prevcount from v:count.
|
---|
| 1549 | */
|
---|
| 1550 | void
|
---|
| 1551 | -set_vcount(count, count1)
|
---|
| 1552 | +set_vcount(count, count1, set_prevcount)
|
---|
| 1553 | long count;
|
---|
| 1554 | long count1;
|
---|
| 1555 | + int set_prevcount;
|
---|
| 1556 | {
|
---|
| 1557 | - vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
|
---|
| 1558 | + if (set_prevcount)
|
---|
| 1559 | + vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
|
---|
| 1560 | vimvars[VV_COUNT].vv_nr = count;
|
---|
| 1561 | vimvars[VV_COUNT1].vv_nr = count1;
|
---|
[5f4a45c9] | 1562 | }
|
---|
[76dd250] | 1563 | @@ -18132,6 +18236,20 @@
|
---|
| 1564 | }
|
---|
| 1565 |
|
---|
| 1566 | /*
|
---|
| 1567 | + * Set List v: variable to "val".
|
---|
| 1568 | + */
|
---|
| 1569 | + void
|
---|
| 1570 | +set_vim_var_list(idx, val)
|
---|
| 1571 | + int idx;
|
---|
| 1572 | + list_T *val;
|
---|
| 1573 | +{
|
---|
| 1574 | + list_unref(vimvars[idx].vv_list);
|
---|
| 1575 | + vimvars[idx].vv_list = val;
|
---|
| 1576 | + if (val != NULL)
|
---|
| 1577 | + ++val->lv_refcount;
|
---|
| 1578 | +}
|
---|
| 1579 | +
|
---|
| 1580 | +/*
|
---|
| 1581 | * Set v:register if needed.
|
---|
| 1582 | */
|
---|
[5f4a45c9] | 1583 | void
|
---|
[1f22c7c] | 1584 | @@ -18868,7 +18986,7 @@
|
---|
| 1585 | dictitem_T *dict_var;
|
---|
| 1586 | {
|
---|
| 1587 | hash_init(&dict->dv_hashtab);
|
---|
| 1588 | - dict->dv_refcount = 99999;
|
---|
| 1589 | + dict->dv_refcount = DO_NOT_FREE_CNT;
|
---|
| 1590 | dict_var->di_tv.vval.v_dict = dict;
|
---|
| 1591 | dict_var->di_tv.v_type = VAR_DICT;
|
---|
[5f4a45c9] | 1592 | dict_var->di_tv.v_lock = VAR_FIXED;
|
---|
[1f22c7c] | 1593 | @@ -19205,6 +19323,8 @@
|
---|
| 1594 | * Copy the values from typval_T "from" to typval_T "to".
|
---|
| 1595 | * When needed allocates string or increases reference count.
|
---|
| 1596 | * Does not make a copy of a list or dict but copies the reference!
|
---|
| 1597 | + * It is OK for "from" and "to" to point to the same item. This is used to
|
---|
| 1598 | + * make a copy later.
|
---|
| 1599 | */
|
---|
| 1600 | static void
|
---|
[5f4a45c9] | 1601 | copy_tv(from, to)
|
---|
| 1602 | @@ -19748,7 +19868,7 @@
|
---|
| 1603 | }
|
---|
| 1604 | }
|
---|
| 1605 | else
|
---|
| 1606 | - emsg_funcname("E123: Undefined function: %s", name);
|
---|
| 1607 | + emsg_funcname(N_("E123: Undefined function: %s"), name);
|
---|
| 1608 | }
|
---|
| 1609 | goto ret_free;
|
---|
| 1610 | }
|
---|
| 1611 | @@ -19792,7 +19912,7 @@
|
---|
| 1612 | : eval_isnamec(arg[j])))
|
---|
| 1613 | ++j;
|
---|
| 1614 | if (arg[j] != NUL)
|
---|
[9a875fd] | 1615 | - emsg_funcname(_(e_invarg2), arg);
|
---|
[5f4a45c9] | 1616 | + emsg_funcname((char *)e_invarg2, arg);
|
---|
| 1617 | }
|
---|
| 1618 | }
|
---|
| 1619 |
|
---|
| 1620 | @@ -20064,7 +20184,7 @@
|
---|
| 1621 | v = find_var(name, &ht);
|
---|
| 1622 | if (v != NULL && v->di_tv.v_type == VAR_FUNC)
|
---|
| 1623 | {
|
---|
| 1624 | - emsg_funcname("E707: Function name conflicts with variable: %s",
|
---|
| 1625 | + emsg_funcname(N_("E707: Function name conflicts with variable: %s"),
|
---|
| 1626 | name);
|
---|
| 1627 | goto erret;
|
---|
| 1628 | }
|
---|
| 1629 | @@ -20079,7 +20199,7 @@
|
---|
| 1630 | }
|
---|
| 1631 | if (fp->uf_calls > 0)
|
---|
| 1632 | {
|
---|
| 1633 | - emsg_funcname("E127: Cannot redefine function %s: It is in use",
|
---|
| 1634 | + emsg_funcname(N_("E127: Cannot redefine function %s: It is in use"),
|
---|
| 1635 | name);
|
---|
| 1636 | goto erret;
|
---|
| 1637 | }
|
---|
[76dd250] | 1638 | @@ -20590,6 +20710,9 @@
|
---|
| 1639 | int st_len = 0;
|
---|
| 1640 |
|
---|
| 1641 | todo = (int)func_hashtab.ht_used;
|
---|
| 1642 | + if (todo == 0)
|
---|
| 1643 | + return; /* nothing to dump */
|
---|
| 1644 | +
|
---|
| 1645 | sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
|
---|
| 1646 |
|
---|
[5f4a45c9] | 1647 | for (hi = func_hashtab.ht_array; todo > 0; ++hi)
|
---|
[76dd250] | 1648 | @@ -20638,6 +20761,8 @@
|
---|
| 1649 | prof_self_cmp);
|
---|
| 1650 | prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
|
---|
| 1651 | }
|
---|
| 1652 | +
|
---|
| 1653 | + vim_free(sorttab);
|
---|
| 1654 | }
|
---|
| 1655 |
|
---|
[5f4a45c9] | 1656 | static void
|
---|
[1f22c7c] | 1657 | @@ -21012,7 +21137,7 @@
|
---|
| 1658 | char_u *save_sourcing_name;
|
---|
| 1659 | linenr_T save_sourcing_lnum;
|
---|
| 1660 | scid_T save_current_SID;
|
---|
| 1661 | - funccall_T fc;
|
---|
| 1662 | + funccall_T *fc;
|
---|
| 1663 | int save_did_emsg;
|
---|
| 1664 | static int depth = 0;
|
---|
[5f4a45c9] | 1665 | dictitem_T *v;
|
---|
[1f22c7c] | 1666 | @@ -21038,36 +21163,37 @@
|
---|
| 1667 |
|
---|
| 1668 | line_breakcheck(); /* check for CTRL-C hit */
|
---|
| 1669 |
|
---|
| 1670 | - fc.caller = current_funccal;
|
---|
| 1671 | - current_funccal = &fc;
|
---|
| 1672 | - fc.func = fp;
|
---|
| 1673 | - fc.rettv = rettv;
|
---|
| 1674 | + fc = (funccall_T *)alloc(sizeof(funccall_T));
|
---|
| 1675 | + fc->caller = current_funccal;
|
---|
| 1676 | + current_funccal = fc;
|
---|
| 1677 | + fc->func = fp;
|
---|
| 1678 | + fc->rettv = rettv;
|
---|
| 1679 | rettv->vval.v_number = 0;
|
---|
| 1680 | - fc.linenr = 0;
|
---|
| 1681 | - fc.returned = FALSE;
|
---|
| 1682 | - fc.level = ex_nesting_level;
|
---|
| 1683 | + fc->linenr = 0;
|
---|
| 1684 | + fc->returned = FALSE;
|
---|
| 1685 | + fc->level = ex_nesting_level;
|
---|
| 1686 | /* Check if this function has a breakpoint. */
|
---|
| 1687 | - fc.breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
|
---|
| 1688 | - fc.dbg_tick = debug_tick;
|
---|
| 1689 | + fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
|
---|
| 1690 | + fc->dbg_tick = debug_tick;
|
---|
| 1691 |
|
---|
| 1692 | /*
|
---|
| 1693 | - * Note about using fc.fixvar[]: This is an array of FIXVAR_CNT variables
|
---|
| 1694 | + * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables
|
---|
| 1695 | * with names up to VAR_SHORT_LEN long. This avoids having to alloc/free
|
---|
| 1696 | * each argument variable and saves a lot of time.
|
---|
| 1697 | */
|
---|
| 1698 | /*
|
---|
| 1699 | * Init l: variables.
|
---|
| 1700 | */
|
---|
| 1701 | - init_var_dict(&fc.l_vars, &fc.l_vars_var);
|
---|
| 1702 | + init_var_dict(&fc->l_vars, &fc->l_vars_var);
|
---|
| 1703 | if (selfdict != NULL)
|
---|
| 1704 | {
|
---|
| 1705 | /* Set l:self to "selfdict". Use "name" to avoid a warning from
|
---|
| 1706 | * some compiler that checks the destination size. */
|
---|
| 1707 | - v = &fc.fixvar[fixvar_idx++].var;
|
---|
| 1708 | + v = &fc->fixvar[fixvar_idx++].var;
|
---|
| 1709 | name = v->di_key;
|
---|
| 1710 | STRCPY(name, "self");
|
---|
| 1711 | v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX;
|
---|
| 1712 | - hash_add(&fc.l_vars.dv_hashtab, DI2HIKEY(v));
|
---|
| 1713 | + hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
|
---|
| 1714 | v->di_tv.v_type = VAR_DICT;
|
---|
| 1715 | v->di_tv.v_lock = 0;
|
---|
[5f4a45c9] | 1716 | v->di_tv.vval.v_dict = selfdict;
|
---|
[1f22c7c] | 1717 | @@ -21079,28 +21205,31 @@
|
---|
| 1718 | * Set a:0 to "argcount".
|
---|
| 1719 | * Set a:000 to a list with room for the "..." arguments.
|
---|
| 1720 | */
|
---|
| 1721 | - init_var_dict(&fc.l_avars, &fc.l_avars_var);
|
---|
| 1722 | - add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
|
---|
| 1723 | + init_var_dict(&fc->l_avars, &fc->l_avars_var);
|
---|
[76dd250] | 1724 | + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0",
|
---|
[1f22c7c] | 1725 | (varnumber_T)(argcount - fp->uf_args.ga_len));
|
---|
| 1726 | - v = &fc.fixvar[fixvar_idx++].var;
|
---|
[76dd250] | 1727 | - STRCPY(v->di_key, "000");
|
---|
| 1728 | + /* Use "name" to avoid a warning from some compiler that checks the
|
---|
[1f22c7c] | 1729 | + * destination size. */
|
---|
[76dd250] | 1730 | + v = &fc->fixvar[fixvar_idx++].var;
|
---|
| 1731 | + name = v->di_key;
|
---|
| 1732 | + STRCPY(name, "000");
|
---|
[1f22c7c] | 1733 | v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
---|
| 1734 | - hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
|
---|
[76dd250] | 1735 | + hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
|
---|
[1f22c7c] | 1736 | v->di_tv.v_type = VAR_LIST;
|
---|
| 1737 | v->di_tv.v_lock = VAR_FIXED;
|
---|
| 1738 | - v->di_tv.vval.v_list = &fc.l_varlist;
|
---|
| 1739 | - vim_memset(&fc.l_varlist, 0, sizeof(list_T));
|
---|
| 1740 | - fc.l_varlist.lv_refcount = 99999;
|
---|
| 1741 | - fc.l_varlist.lv_lock = VAR_FIXED;
|
---|
| 1742 | + v->di_tv.vval.v_list = &fc->l_varlist;
|
---|
| 1743 | + vim_memset(&fc->l_varlist, 0, sizeof(list_T));
|
---|
| 1744 | + fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
|
---|
| 1745 | + fc->l_varlist.lv_lock = VAR_FIXED;
|
---|
| 1746 |
|
---|
| 1747 | /*
|
---|
| 1748 | * Set a:firstline to "firstline" and a:lastline to "lastline".
|
---|
| 1749 | * Set a:name to named arguments.
|
---|
| 1750 | * Set a:N to the "..." arguments.
|
---|
| 1751 | */
|
---|
| 1752 | - add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "firstline",
|
---|
| 1753 | + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline",
|
---|
| 1754 | (varnumber_T)firstline);
|
---|
| 1755 | - add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "lastline",
|
---|
| 1756 | + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline",
|
---|
| 1757 | (varnumber_T)lastline);
|
---|
| 1758 | for (i = 0; i < argcount; ++i)
|
---|
[5f4a45c9] | 1759 | {
|
---|
[1f22c7c] | 1760 | @@ -21116,7 +21245,7 @@
|
---|
| 1761 | }
|
---|
| 1762 | if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN)
|
---|
| 1763 | {
|
---|
| 1764 | - v = &fc.fixvar[fixvar_idx++].var;
|
---|
| 1765 | + v = &fc->fixvar[fixvar_idx++].var;
|
---|
| 1766 | v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
---|
| 1767 | }
|
---|
[5f4a45c9] | 1768 | else
|
---|
[1f22c7c] | 1769 | @@ -21128,7 +21257,7 @@
|
---|
| 1770 | v->di_flags = DI_FLAGS_RO;
|
---|
| 1771 | }
|
---|
| 1772 | STRCPY(v->di_key, name);
|
---|
| 1773 | - hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
|
---|
| 1774 | + hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
|
---|
| 1775 |
|
---|
| 1776 | /* Note: the values are copied directly to avoid alloc/free.
|
---|
[5f4a45c9] | 1777 | * "argvars" must have VAR_FIXED for v_lock. */
|
---|
[1f22c7c] | 1778 | @@ -21137,9 +21266,9 @@
|
---|
| 1779 |
|
---|
| 1780 | if (ai >= 0 && ai < MAX_FUNC_ARGS)
|
---|
| 1781 | {
|
---|
| 1782 | - list_append(&fc.l_varlist, &fc.l_listitems[ai]);
|
---|
| 1783 | - fc.l_listitems[ai].li_tv = argvars[i];
|
---|
| 1784 | - fc.l_listitems[ai].li_tv.v_lock = VAR_FIXED;
|
---|
| 1785 | + list_append(&fc->l_varlist, &fc->l_listitems[ai]);
|
---|
| 1786 | + fc->l_listitems[ai].li_tv = argvars[i];
|
---|
| 1787 | + fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED;
|
---|
| 1788 | }
|
---|
| 1789 | }
|
---|
[5f4a45c9] | 1790 |
|
---|
[76dd250] | 1791 | @@ -21204,7 +21333,7 @@
|
---|
| 1792 | if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
|
---|
| 1793 | func_do_profile(fp);
|
---|
| 1794 | if (fp->uf_profiling
|
---|
[1f22c7c] | 1795 | - || (fc.caller != NULL && &fc.caller->func->uf_profiling))
|
---|
[76dd250] | 1796 | + || (fc->caller != NULL && fc->caller->func->uf_profiling))
|
---|
| 1797 | {
|
---|
| 1798 | ++fp->uf_tm_count;
|
---|
[5f4a45c9] | 1799 | profile_start(&call_start);
|
---|
[1f22c7c] | 1800 | @@ -21220,7 +21349,7 @@
|
---|
| 1801 | did_emsg = FALSE;
|
---|
| 1802 |
|
---|
| 1803 | /* call do_cmdline() to execute the lines */
|
---|
| 1804 | - do_cmdline(NULL, get_func_line, (void *)&fc,
|
---|
| 1805 | + do_cmdline(NULL, get_func_line, (void *)fc,
|
---|
| 1806 | DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
|
---|
| 1807 |
|
---|
[5f4a45c9] | 1808 | --RedrawingDisabled;
|
---|
[76dd250] | 1809 | @@ -21235,16 +21364,16 @@
|
---|
| 1810 |
|
---|
| 1811 | #ifdef FEAT_PROFILE
|
---|
| 1812 | if (do_profiling == PROF_YES && (fp->uf_profiling
|
---|
[1f22c7c] | 1813 | - || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
|
---|
[76dd250] | 1814 | + || (fc->caller != NULL && fc->caller->func->uf_profiling)))
|
---|
| 1815 | {
|
---|
| 1816 | profile_end(&call_start);
|
---|
| 1817 | profile_sub_wait(&wait_start, &call_start);
|
---|
| 1818 | profile_add(&fp->uf_tm_total, &call_start);
|
---|
| 1819 | profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
|
---|
[1f22c7c] | 1820 | - if (fc.caller != NULL && &fc.caller->func->uf_profiling)
|
---|
[76dd250] | 1821 | + if (fc->caller != NULL && fc->caller->func->uf_profiling)
|
---|
[1f22c7c] | 1822 | {
|
---|
| 1823 | - profile_add(&fc.caller->func->uf_tm_children, &call_start);
|
---|
| 1824 | - profile_add(&fc.caller->func->uf_tml_children, &call_start);
|
---|
| 1825 | + profile_add(&fc->caller->func->uf_tm_children, &call_start);
|
---|
| 1826 | + profile_add(&fc->caller->func->uf_tml_children, &call_start);
|
---|
| 1827 | }
|
---|
| 1828 | }
|
---|
[5f4a45c9] | 1829 | #endif
|
---|
[1f22c7c] | 1830 | @@ -21257,9 +21386,9 @@
|
---|
| 1831 |
|
---|
| 1832 | if (aborting())
|
---|
| 1833 | smsg((char_u *)_("%s aborted"), sourcing_name);
|
---|
| 1834 | - else if (fc.rettv->v_type == VAR_NUMBER)
|
---|
| 1835 | + else if (fc->rettv->v_type == VAR_NUMBER)
|
---|
| 1836 | smsg((char_u *)_("%s returning #%ld"), sourcing_name,
|
---|
| 1837 | - (long)fc.rettv->vval.v_number);
|
---|
| 1838 | + (long)fc->rettv->vval.v_number);
|
---|
| 1839 | else
|
---|
| 1840 | {
|
---|
[5f4a45c9] | 1841 | char_u buf[MSG_BUF_LEN];
|
---|
[1f22c7c] | 1842 | @@ -21270,7 +21399,7 @@
|
---|
| 1843 | /* The value may be very long. Skip the middle part, so that we
|
---|
| 1844 | * have some idea how it starts and ends. smsg() would always
|
---|
| 1845 | * truncate it at the end. */
|
---|
| 1846 | - s = tv2string(fc.rettv, &tofree, numbuf2, 0);
|
---|
| 1847 | + s = tv2string(fc->rettv, &tofree, numbuf2, 0);
|
---|
| 1848 | if (s != NULL)
|
---|
| 1849 | {
|
---|
[5f4a45c9] | 1850 | trunc_string(s, buf, MSG_BUF_CLEN);
|
---|
[1f22c7c] | 1851 | @@ -21306,14 +21435,84 @@
|
---|
| 1852 | }
|
---|
| 1853 |
|
---|
| 1854 | did_emsg |= save_did_emsg;
|
---|
| 1855 | - current_funccal = fc.caller;
|
---|
| 1856 | + current_funccal = fc->caller;
|
---|
| 1857 | + --depth;
|
---|
| 1858 |
|
---|
| 1859 | - /* The a: variables typevals were not allocated, only free the allocated
|
---|
| 1860 | - * variables. */
|
---|
| 1861 | - vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE);
|
---|
| 1862 | + /* if the a:000 list and the a: dict are not referenced we can free the
|
---|
| 1863 | + * funccall_T and what's in it. */
|
---|
| 1864 | + if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT
|
---|
| 1865 | + && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT
|
---|
| 1866 | + && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT)
|
---|
| 1867 | + {
|
---|
| 1868 | + free_funccal(fc, FALSE);
|
---|
| 1869 | + }
|
---|
| 1870 | + else
|
---|
| 1871 | + {
|
---|
| 1872 | + hashitem_T *hi;
|
---|
| 1873 | + listitem_T *li;
|
---|
| 1874 | + int todo;
|
---|
| 1875 |
|
---|
| 1876 | - vars_clear(&fc.l_vars.dv_hashtab); /* free all l: variables */
|
---|
| 1877 | - --depth;
|
---|
| 1878 | + /* "fc" is still in use. This can happen when returning "a:000" or
|
---|
| 1879 | + * assigning "l:" to a global variable.
|
---|
| 1880 | + * Link "fc" in the list for garbage collection later. */
|
---|
| 1881 | + fc->caller = previous_funccal;
|
---|
| 1882 | + previous_funccal = fc;
|
---|
| 1883 | +
|
---|
| 1884 | + /* Make a copy of the a: variables, since we didn't do that above. */
|
---|
| 1885 | + todo = (int)fc->l_avars.dv_hashtab.ht_used;
|
---|
| 1886 | + for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
|
---|
| 1887 | + {
|
---|
| 1888 | + if (!HASHITEM_EMPTY(hi))
|
---|
| 1889 | + {
|
---|
| 1890 | + --todo;
|
---|
| 1891 | + v = HI2DI(hi);
|
---|
| 1892 | + copy_tv(&v->di_tv, &v->di_tv);
|
---|
| 1893 | + }
|
---|
| 1894 | + }
|
---|
| 1895 | +
|
---|
| 1896 | + /* Make a copy of the a:000 items, since we didn't do that above. */
|
---|
| 1897 | + for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
|
---|
| 1898 | + copy_tv(&li->li_tv, &li->li_tv);
|
---|
| 1899 | + }
|
---|
| 1900 | +}
|
---|
| 1901 | +
|
---|
| 1902 | +/*
|
---|
[5f4a45c9] | 1903 | + * Return TRUE if items in "fc" do not have "copyID". That means they are not
|
---|
[1f22c7c] | 1904 | + * referenced from anywhere.
|
---|
| 1905 | + */
|
---|
| 1906 | + static int
|
---|
| 1907 | +can_free_funccal(fc, copyID)
|
---|
| 1908 | + funccall_T *fc;
|
---|
| 1909 | + int copyID;
|
---|
| 1910 | +{
|
---|
| 1911 | + return (fc->l_varlist.lv_copyID != copyID
|
---|
| 1912 | + && fc->l_vars.dv_copyID != copyID
|
---|
| 1913 | + && fc->l_avars.dv_copyID != copyID);
|
---|
| 1914 | +}
|
---|
| 1915 | +
|
---|
| 1916 | +/*
|
---|
| 1917 | + * Free "fc" and what it contains.
|
---|
| 1918 | + */
|
---|
| 1919 | + static void
|
---|
| 1920 | +free_funccal(fc, free_val)
|
---|
| 1921 | + funccall_T *fc;
|
---|
| 1922 | + int free_val; /* a: vars were allocated */
|
---|
| 1923 | +{
|
---|
| 1924 | + listitem_T *li;
|
---|
| 1925 | +
|
---|
| 1926 | + /* The a: variables typevals may not have been allocated, only free the
|
---|
| 1927 | + * allocated variables. */
|
---|
| 1928 | + vars_clear_ext(&fc->l_avars.dv_hashtab, free_val);
|
---|
| 1929 | +
|
---|
| 1930 | + /* free all l: variables */
|
---|
| 1931 | + vars_clear(&fc->l_vars.dv_hashtab);
|
---|
| 1932 | +
|
---|
| 1933 | + /* Free the a:000 variables if they were allocated. */
|
---|
| 1934 | + if (free_val)
|
---|
| 1935 | + for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
|
---|
| 1936 | + clear_tv(&li->li_tv);
|
---|
| 1937 | +
|
---|
| 1938 | + vim_free(fc);
|
---|
| 1939 | }
|
---|
| 1940 |
|
---|
[5f4a45c9] | 1941 | /*
|
---|
[76dd250] | 1942 | @@ -21886,6 +22085,62 @@
|
---|
| 1943 | }
|
---|
| 1944 | }
|
---|
| 1945 |
|
---|
| 1946 | +/*
|
---|
| 1947 | + * List v:oldfiles in a nice way.
|
---|
| 1948 | + */
|
---|
| 1949 | +/*ARGSUSED*/
|
---|
| 1950 | + void
|
---|
| 1951 | +ex_oldfiles(eap)
|
---|
| 1952 | + exarg_T *eap;
|
---|
| 1953 | +{
|
---|
| 1954 | + list_T *l = vimvars[VV_OLDFILES].vv_list;
|
---|
| 1955 | + listitem_T *li;
|
---|
| 1956 | + int nr = 0;
|
---|
| 1957 | +
|
---|
| 1958 | + if (l == NULL)
|
---|
| 1959 | + msg((char_u *)_("No old files"));
|
---|
| 1960 | + else
|
---|
| 1961 | + {
|
---|
| 1962 | + msg_start();
|
---|
| 1963 | + msg_scroll = TRUE;
|
---|
| 1964 | + for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
|
---|
| 1965 | + {
|
---|
| 1966 | + msg_outnum((long)++nr);
|
---|
| 1967 | + MSG_PUTS(": ");
|
---|
| 1968 | + msg_outtrans(get_tv_string(&li->li_tv));
|
---|
| 1969 | + msg_putchar('\n');
|
---|
| 1970 | + out_flush(); /* output one line at a time */
|
---|
| 1971 | + ui_breakcheck();
|
---|
| 1972 | + }
|
---|
| 1973 | + /* Assume "got_int" was set to truncate the listing. */
|
---|
| 1974 | + got_int = FALSE;
|
---|
| 1975 | +
|
---|
| 1976 | +#ifdef FEAT_BROWSE_CMD
|
---|
| 1977 | + if (cmdmod.browse)
|
---|
| 1978 | + {
|
---|
| 1979 | + quit_more = FALSE;
|
---|
| 1980 | + nr = prompt_for_number(FALSE);
|
---|
| 1981 | + msg_starthere();
|
---|
| 1982 | + if (nr > 0)
|
---|
| 1983 | + {
|
---|
| 1984 | + char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
|
---|
| 1985 | + (long)nr);
|
---|
| 1986 | +
|
---|
| 1987 | + if (p != NULL)
|
---|
| 1988 | + {
|
---|
| 1989 | + p = expand_env_save(p);
|
---|
| 1990 | + eap->arg = p;
|
---|
| 1991 | + eap->cmdidx = CMD_edit;
|
---|
| 1992 | + cmdmod.browse = FALSE;
|
---|
| 1993 | + do_exedit(eap, NULL);
|
---|
| 1994 | + vim_free(p);
|
---|
| 1995 | + }
|
---|
| 1996 | + }
|
---|
| 1997 | + }
|
---|
| 1998 | +#endif
|
---|
| 1999 | + }
|
---|
| 2000 | +}
|
---|
| 2001 | +
|
---|
| 2002 | #endif /* FEAT_EVAL */
|
---|
| 2003 |
|
---|
[5f4a45c9] | 2004 |
|
---|
| 2005 | diff -Naur vim72.orig/src/ex_cmds2.c vim72/src/ex_cmds2.c
|
---|
[54f612f] | 2006 | --- vim72.orig/src/ex_cmds2.c 2008-07-13 09:18:22.000000000 -0700
|
---|
[9a875fd] | 2007 | +++ vim72/src/ex_cmds2.c 2009-02-22 21:58:02.862770777 -0800
|
---|
| 2008 | @@ -2842,6 +2842,7 @@
|
---|
| 2009 | linenr_T save_sourcing_lnum;
|
---|
| 2010 | char_u *p;
|
---|
| 2011 | char_u *fname_exp;
|
---|
| 2012 | + char_u *firstline = NULL;
|
---|
| 2013 | int retval = FAIL;
|
---|
| 2014 | #ifdef FEAT_EVAL
|
---|
| 2015 | scid_T save_current_SID;
|
---|
| 2016 | @@ -2992,23 +2993,6 @@
|
---|
| 2017 |
|
---|
| 2018 | cookie.level = ex_nesting_level;
|
---|
| 2019 | #endif
|
---|
| 2020 | -#ifdef FEAT_MBYTE
|
---|
| 2021 | - cookie.conv.vc_type = CONV_NONE; /* no conversion */
|
---|
| 2022 | -
|
---|
| 2023 | - /* Try reading the first few bytes to check for a UTF-8 BOM. */
|
---|
| 2024 | - {
|
---|
| 2025 | - char_u buf[3];
|
---|
| 2026 | -
|
---|
| 2027 | - if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)
|
---|
| 2028 | - == (size_t)3
|
---|
| 2029 | - && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
|
---|
| 2030 | - /* Found BOM, setup conversion and skip over it. */
|
---|
| 2031 | - convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
|
---|
| 2032 | - else
|
---|
| 2033 | - /* No BOM found, rewind. */
|
---|
| 2034 | - fseek(cookie.fp, 0L, SEEK_SET);
|
---|
| 2035 | - }
|
---|
| 2036 | -#endif
|
---|
| 2037 |
|
---|
| 2038 | /*
|
---|
| 2039 | * Keep the sourcing name/lnum, for recursive calls.
|
---|
| 2040 | @@ -3018,6 +3002,27 @@
|
---|
| 2041 | save_sourcing_lnum = sourcing_lnum;
|
---|
| 2042 | sourcing_lnum = 0;
|
---|
| 2043 |
|
---|
| 2044 | +#ifdef FEAT_MBYTE
|
---|
| 2045 | + cookie.conv.vc_type = CONV_NONE; /* no conversion */
|
---|
| 2046 | +
|
---|
| 2047 | + /* Read the first line so we can check for a UTF-8 BOM. */
|
---|
| 2048 | + firstline = getsourceline(0, (void *)&cookie, 0);
|
---|
| 2049 | + if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
|
---|
| 2050 | + && firstline[1] == 0xbb && firstline[2] == 0xbf)
|
---|
| 2051 | + {
|
---|
| 2052 | + /* Found BOM; setup conversion, skip over BOM and recode the line. */
|
---|
| 2053 | + convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
|
---|
| 2054 | + p = string_convert(&cookie.conv, firstline + 3, NULL);
|
---|
| 2055 | + if (p == NULL)
|
---|
| 2056 | + p = vim_strsave(firstline + 3);
|
---|
| 2057 | + if (p != NULL)
|
---|
| 2058 | + {
|
---|
| 2059 | + vim_free(firstline);
|
---|
| 2060 | + firstline = p;
|
---|
| 2061 | + }
|
---|
| 2062 | + }
|
---|
| 2063 | +#endif
|
---|
| 2064 | +
|
---|
| 2065 | #ifdef STARTUPTIME
|
---|
| 2066 | time_push(&tv_rel, &tv_start);
|
---|
| 2067 | #endif
|
---|
| 2068 | @@ -3111,9 +3116,8 @@
|
---|
| 2069 | /*
|
---|
| 2070 | * Call do_cmdline, which will call getsourceline() to get the lines.
|
---|
| 2071 | */
|
---|
| 2072 | - do_cmdline(NULL, getsourceline, (void *)&cookie,
|
---|
| 2073 | + do_cmdline(firstline, getsourceline, (void *)&cookie,
|
---|
| 2074 | DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
|
---|
| 2075 | -
|
---|
| 2076 | retval = OK;
|
---|
| 2077 |
|
---|
| 2078 | #ifdef FEAT_PROFILE
|
---|
[5f4a45c9] | 2079 | @@ -3145,8 +3149,8 @@
|
---|
| 2080 | verbose_leave();
|
---|
| 2081 | }
|
---|
| 2082 | #ifdef STARTUPTIME
|
---|
| 2083 | - vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname);
|
---|
| 2084 | - time_msg(IObuff, &tv_start);
|
---|
| 2085 | + vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
|
---|
| 2086 | + time_msg((char *)IObuff, &tv_start);
|
---|
| 2087 | time_pop(&tv_rel);
|
---|
| 2088 | #endif
|
---|
[9a875fd] | 2089 |
|
---|
| 2090 | @@ -3171,6 +3175,7 @@
|
---|
| 2091 | #endif
|
---|
| 2092 | fclose(cookie.fp);
|
---|
| 2093 | vim_free(cookie.nextline);
|
---|
| 2094 | + vim_free(firstline);
|
---|
| 2095 | #ifdef FEAT_MBYTE
|
---|
| 2096 | convert_setup(&cookie.conv, NULL, NULL);
|
---|
[76dd250] | 2097 | #endif
|
---|
| 2098 | diff -Naur vim72.orig/src/ex_cmds.c vim72/src/ex_cmds.c
|
---|
[54f612f] | 2099 | --- vim72.orig/src/ex_cmds.c 2008-08-04 12:15:00.000000000 -0700
|
---|
[76dd250] | 2100 | +++ vim72/src/ex_cmds.c 2009-02-22 21:58:02.886772733 -0800
|
---|
| 2101 | @@ -24,7 +24,7 @@
|
---|
| 2102 | static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out));
|
---|
| 2103 | #ifdef FEAT_VIMINFO
|
---|
| 2104 | static char_u *viminfo_filename __ARGS((char_u *));
|
---|
| 2105 | -static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read));
|
---|
| 2106 | +static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags));
|
---|
| 2107 | static int viminfo_encoding __ARGS((vir_T *virp));
|
---|
| 2108 | static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing));
|
---|
[7352c10] | 2109 | #endif
|
---|
| 2110 | @@ -49,6 +49,7 @@
|
---|
| 2111 | exarg_T *eap;
|
---|
| 2112 | {
|
---|
| 2113 | int c;
|
---|
| 2114 | + int cval;
|
---|
| 2115 | char buf1[20];
|
---|
| 2116 | char buf2[20];
|
---|
| 2117 | char_u buf3[7];
|
---|
| 2118 | @@ -75,6 +76,10 @@
|
---|
| 2119 | {
|
---|
| 2120 | if (c == NL) /* NUL is stored as NL */
|
---|
| 2121 | c = NUL;
|
---|
| 2122 | + if (c == CAR && get_fileformat(curbuf) == EOL_MAC)
|
---|
| 2123 | + cval = NL; /* NL is stored as CR */
|
---|
| 2124 | + else
|
---|
| 2125 | + cval = c;
|
---|
| 2126 | if (vim_isprintc_strict(c) && (c < ' '
|
---|
| 2127 | #ifndef EBCDIC
|
---|
| 2128 | || c > '~'
|
---|
| 2129 | @@ -94,7 +99,7 @@
|
---|
| 2130 | buf2[0] = NUL;
|
---|
| 2131 | vim_snprintf((char *)IObuff, IOSIZE,
|
---|
| 2132 | _("<%s>%s%s %d, Hex %02x, Octal %03o"),
|
---|
| 2133 | - transchar(c), buf1, buf2, c, c, c);
|
---|
| 2134 | + transchar(c), buf1, buf2, cval, cval, cval);
|
---|
| 2135 | #ifdef FEAT_MBYTE
|
---|
| 2136 | if (enc_utf8)
|
---|
| 2137 | c = cc[ci++];
|
---|
[76dd250] | 2138 | @@ -1676,14 +1681,12 @@
|
---|
| 2139 |
|
---|
| 2140 | /*
|
---|
| 2141 | * read_viminfo() -- Read the viminfo file. Registers etc. which are already
|
---|
| 2142 | - * set are not over-written unless force is TRUE. -- webb
|
---|
| 2143 | + * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb
|
---|
| 2144 | */
|
---|
| 2145 | int
|
---|
| 2146 | -read_viminfo(file, want_info, want_marks, forceit)
|
---|
| 2147 | - char_u *file;
|
---|
| 2148 | - int want_info;
|
---|
| 2149 | - int want_marks;
|
---|
| 2150 | - int forceit;
|
---|
| 2151 | +read_viminfo(file, flags)
|
---|
| 2152 | + char_u *file; /* file name or NULL to use default name */
|
---|
| 2153 | + int flags; /* VIF_WANT_INFO et al. */
|
---|
| 2154 | {
|
---|
| 2155 | FILE *fp;
|
---|
[7352c10] | 2156 | char_u *fname;
|
---|
[76dd250] | 2157 | @@ -1691,7 +1694,7 @@
|
---|
| 2158 | if (no_viminfo())
|
---|
| 2159 | return FAIL;
|
---|
| 2160 |
|
---|
| 2161 | - fname = viminfo_filename(file); /* may set to default if NULL */
|
---|
| 2162 | + fname = viminfo_filename(file); /* get file name in allocated buffer */
|
---|
| 2163 | if (fname == NULL)
|
---|
| 2164 | return FAIL;
|
---|
[7352c10] | 2165 | fp = mch_fopen((char *)fname, READBIN);
|
---|
[76dd250] | 2166 | @@ -1701,8 +1704,9 @@
|
---|
| 2167 | verbose_enter();
|
---|
| 2168 | smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
|
---|
| 2169 | fname,
|
---|
| 2170 | - want_info ? _(" info") : "",
|
---|
| 2171 | - want_marks ? _(" marks") : "",
|
---|
| 2172 | + (flags & VIF_WANT_INFO) ? _(" info") : "",
|
---|
| 2173 | + (flags & VIF_WANT_MARKS) ? _(" marks") : "",
|
---|
| 2174 | + (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "",
|
---|
| 2175 | fp == NULL ? _(" FAILED") : "");
|
---|
| 2176 | verbose_leave();
|
---|
[7352c10] | 2177 | }
|
---|
[76dd250] | 2178 | @@ -1712,10 +1716,9 @@
|
---|
| 2179 | return FAIL;
|
---|
| 2180 |
|
---|
| 2181 | viminfo_errcnt = 0;
|
---|
| 2182 | - do_viminfo(fp, NULL, want_info, want_marks, forceit);
|
---|
| 2183 | + do_viminfo(fp, NULL, flags);
|
---|
| 2184 |
|
---|
| 2185 | fclose(fp);
|
---|
| 2186 | -
|
---|
| 2187 | return OK;
|
---|
| 2188 | }
|
---|
[7352c10] | 2189 |
|
---|
[76dd250] | 2190 | @@ -1943,7 +1946,7 @@
|
---|
| 2191 | * root.
|
---|
| 2192 | */
|
---|
| 2193 | if (fp_out != NULL)
|
---|
| 2194 | - (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
|
---|
| 2195 | + ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
|
---|
| 2196 | #endif
|
---|
| 2197 | }
|
---|
[7352c10] | 2198 | }
|
---|
[76dd250] | 2199 | @@ -1968,7 +1971,7 @@
|
---|
| 2200 | }
|
---|
| 2201 |
|
---|
| 2202 | viminfo_errcnt = 0;
|
---|
| 2203 | - do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);
|
---|
| 2204 | + do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS));
|
---|
| 2205 |
|
---|
| 2206 | fclose(fp_out); /* errors are ignored !? */
|
---|
[7352c10] | 2207 | if (fp_in != NULL)
|
---|
[76dd250] | 2208 | @@ -2041,12 +2044,10 @@
|
---|
| 2209 | * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
|
---|
| 2210 | */
|
---|
| 2211 | static void
|
---|
| 2212 | -do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
|
---|
| 2213 | +do_viminfo(fp_in, fp_out, flags)
|
---|
| 2214 | FILE *fp_in;
|
---|
| 2215 | FILE *fp_out;
|
---|
| 2216 | - int want_info;
|
---|
| 2217 | - int want_marks;
|
---|
| 2218 | - int force_read;
|
---|
| 2219 | + int flags;
|
---|
| 2220 | {
|
---|
| 2221 | int count = 0;
|
---|
[7352c10] | 2222 | int eof = FALSE;
|
---|
[76dd250] | 2223 | @@ -2061,8 +2062,9 @@
|
---|
| 2224 |
|
---|
| 2225 | if (fp_in != NULL)
|
---|
| 2226 | {
|
---|
| 2227 | - if (want_info)
|
---|
| 2228 | - eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL);
|
---|
| 2229 | + if (flags & VIF_WANT_INFO)
|
---|
| 2230 | + eof = read_viminfo_up_to_marks(&vir,
|
---|
| 2231 | + flags & VIF_FORCEIT, fp_out != NULL);
|
---|
| 2232 | else
|
---|
| 2233 | /* Skip info, find start of marks */
|
---|
[7352c10] | 2234 | while (!(eof = viminfo_readline(&vir))
|
---|
[76dd250] | 2235 | @@ -2092,8 +2094,9 @@
|
---|
| 2236 | write_viminfo_bufferlist(fp_out);
|
---|
| 2237 | count = write_viminfo_marks(fp_out);
|
---|
| 2238 | }
|
---|
| 2239 | - if (fp_in != NULL && want_marks)
|
---|
| 2240 | - copy_viminfo_marks(&vir, fp_out, count, eof);
|
---|
| 2241 | + if (fp_in != NULL
|
---|
| 2242 | + && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
|
---|
| 2243 | + copy_viminfo_marks(&vir, fp_out, count, eof, flags);
|
---|
| 2244 |
|
---|
| 2245 | vim_free(vir.vir_line);
|
---|
[9a875fd] | 2246 | #ifdef FEAT_MBYTE
|
---|
| 2247 | @@ -2414,8 +2417,8 @@
|
---|
| 2248 | cursor_on(); /* msg_start() switches it off */
|
---|
| 2249 | out_flush();
|
---|
| 2250 | silent_mode = save_silent;
|
---|
| 2251 | - info_message = FALSE;
|
---|
| 2252 | }
|
---|
| 2253 | + info_message = FALSE;
|
---|
| 2254 | }
|
---|
| 2255 |
|
---|
[61a83e8] | 2256 | /*
|
---|
| 2257 | @@ -2704,7 +2707,12 @@
|
---|
| 2258 | if (eap->cmdidx == CMD_saveas)
|
---|
| 2259 | {
|
---|
| 2260 | if (retval == OK)
|
---|
| 2261 | + {
|
---|
| 2262 | curbuf->b_p_ro = FALSE;
|
---|
| 2263 | +#ifdef FEAT_WINDOWS
|
---|
| 2264 | + redraw_tabline = TRUE;
|
---|
| 2265 | +#endif
|
---|
| 2266 | + }
|
---|
| 2267 | /* Change directories when the 'acd' option is set. */
|
---|
| 2268 | DO_AUTOCHDIR
|
---|
| 2269 | }
|
---|
[76dd250] | 2270 | @@ -5059,6 +5067,7 @@
|
---|
| 2271 |
|
---|
| 2272 | if (did_sub)
|
---|
| 2273 | ++sub_nlines;
|
---|
| 2274 | + vim_free(new_start); /* for when substitute was cancelled */
|
---|
| 2275 | vim_free(sub_firstline); /* free the copy of the original line */
|
---|
| 2276 | sub_firstline = NULL;
|
---|
| 2277 | }
|
---|
| 2278 | diff -Naur vim72.orig/src/ex_cmds.h vim72/src/ex_cmds.h
|
---|
[54f612f] | 2279 | --- vim72.orig/src/ex_cmds.h 2008-06-21 11:47:57.000000000 -0700
|
---|
[76dd250] | 2280 | +++ vim72/src/ex_cmds.h 2009-02-22 21:57:28.904593099 -0800
|
---|
| 2281 | @@ -278,7 +278,7 @@
|
---|
| 2282 | EX(CMD_crewind, "crewind", ex_cc,
|
---|
| 2283 | RANGE|NOTADR|COUNT|TRLBAR|BANG),
|
---|
| 2284 | EX(CMD_cscope, "cscope", do_cscope,
|
---|
| 2285 | - EXTRA|NOTRLCOM|SBOXOK|XFILE),
|
---|
| 2286 | + EXTRA|NOTRLCOM|XFILE),
|
---|
| 2287 | EX(CMD_cstag, "cstag", do_cstag,
|
---|
| 2288 | BANG|TRLBAR|WORD1),
|
---|
| 2289 | EX(CMD_cunmap, "cunmap", ex_unmap,
|
---|
| 2290 | @@ -506,7 +506,7 @@
|
---|
| 2291 | EX(CMD_lclose, "lclose", ex_cclose,
|
---|
| 2292 | RANGE|NOTADR|COUNT|TRLBAR),
|
---|
| 2293 | EX(CMD_lcscope, "lcscope", do_cscope,
|
---|
| 2294 | - EXTRA|NOTRLCOM|SBOXOK|XFILE),
|
---|
| 2295 | + EXTRA|NOTRLCOM|XFILE),
|
---|
| 2296 | EX(CMD_left, "left", ex_align,
|
---|
| 2297 | TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
|
---|
| 2298 | EX(CMD_leftabove, "leftabove", ex_wrongmodifier,
|
---|
| 2299 | @@ -635,6 +635,8 @@
|
---|
| 2300 | RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
---|
| 2301 | EX(CMD_noremap, "noremap", ex_map,
|
---|
| 2302 | BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
---|
| 2303 | +EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier,
|
---|
| 2304 | + NEEDARG|EXTRA|NOTRLCOM),
|
---|
| 2305 | EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch,
|
---|
| 2306 | TRLBAR|SBOXOK|CMDWIN),
|
---|
| 2307 | EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate,
|
---|
| 2308 | @@ -651,6 +653,8 @@
|
---|
| 2309 | EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
---|
| 2310 | EX(CMD_open, "open", ex_open,
|
---|
| 2311 | RANGE|EXTRA),
|
---|
| 2312 | +EX(CMD_oldfiles, "oldfiles", ex_oldfiles,
|
---|
| 2313 | + BANG|TRLBAR|SBOXOK|CMDWIN),
|
---|
| 2314 | EX(CMD_omap, "omap", ex_map,
|
---|
| 2315 | EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
---|
| 2316 | EX(CMD_omapclear, "omapclear", ex_mapclear,
|
---|
| 2317 | @@ -802,7 +806,7 @@
|
---|
| 2318 | EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
|
---|
| 2319 | WORD1|TRLBAR|CMDWIN),
|
---|
| 2320 | EX(CMD_scscope, "scscope", do_scscope,
|
---|
| 2321 | - EXTRA|NOTRLCOM|SBOXOK),
|
---|
| 2322 | + EXTRA|NOTRLCOM),
|
---|
| 2323 | EX(CMD_set, "set", ex_set,
|
---|
| 2324 | TRLBAR|EXTRA|CMDWIN|SBOXOK),
|
---|
| 2325 | EX(CMD_setfiletype, "setfiletype", ex_setfiletype,
|
---|
| 2326 | diff -Naur vim72.orig/src/ex_docmd.c vim72/src/ex_docmd.c
|
---|
[54f612f] | 2327 | --- vim72.orig/src/ex_docmd.c 2008-07-26 04:51:05.000000000 -0700
|
---|
[76dd250] | 2328 | +++ vim72/src/ex_docmd.c 2009-02-22 21:58:02.982779158 -0800
|
---|
| 2329 | @@ -364,6 +364,7 @@
|
---|
| 2330 | # define ex_function ex_ni
|
---|
| 2331 | # define ex_delfunction ex_ni
|
---|
| 2332 | # define ex_return ex_ni
|
---|
| 2333 | +# define ex_oldfiles ex_ni
|
---|
| 2334 | #endif
|
---|
| 2335 | static char_u *arg_all __ARGS((void));
|
---|
| 2336 | #ifdef FEAT_SESSION
|
---|
| 2337 | @@ -1770,7 +1771,7 @@
|
---|
| 2338 | }
|
---|
| 2339 | if (checkforcmd(&ea.cmd, "browse", 3))
|
---|
| 2340 | {
|
---|
| 2341 | -#ifdef FEAT_BROWSE
|
---|
| 2342 | +#ifdef FEAT_BROWSE_CMD
|
---|
| 2343 | cmdmod.browse = TRUE;
|
---|
| 2344 | #endif
|
---|
| 2345 | continue;
|
---|
| 2346 | @@ -2978,6 +2979,7 @@
|
---|
| 2347 | {"keepmarks", 3, FALSE},
|
---|
| 2348 | {"leftabove", 5, FALSE},
|
---|
| 2349 | {"lockmarks", 3, FALSE},
|
---|
| 2350 | + {"noautocmd", 3, FALSE},
|
---|
| 2351 | {"rightbelow", 6, FALSE},
|
---|
| 2352 | {"sandbox", 3, FALSE},
|
---|
| 2353 | {"silent", 3, FALSE},
|
---|
| 2354 | @@ -3608,6 +3610,7 @@
|
---|
| 2355 | return set_context_in_autocmd(xp, arg, FALSE);
|
---|
| 2356 |
|
---|
| 2357 | case CMD_doautocmd:
|
---|
| 2358 | + case CMD_doautoall:
|
---|
| 2359 | return set_context_in_autocmd(xp, arg, TRUE);
|
---|
| 2360 | #endif
|
---|
[5f4a45c9] | 2361 | case CMD_set:
|
---|
| 2362 | @@ -5479,6 +5482,9 @@
|
---|
| 2363 | return OK;
|
---|
| 2364 | }
|
---|
| 2365 |
|
---|
| 2366 | +/*
|
---|
| 2367 | + * ":command ..."
|
---|
| 2368 | + */
|
---|
| 2369 | static void
|
---|
| 2370 | ex_command(eap)
|
---|
[54f612f] | 2371 | exarg_T *eap;
|
---|
| 2372 | @@ -5910,7 +5916,8 @@
|
---|
[5f4a45c9] | 2373 | char_u *q;
|
---|
| 2374 |
|
---|
[54f612f] | 2375 | char_u *start;
|
---|
| 2376 | - char_u *end;
|
---|
[5f4a45c9] | 2377 | + char_u *end = NULL;
|
---|
| 2378 | + char_u *ksp;
|
---|
| 2379 | size_t len, totlen;
|
---|
| 2380 |
|
---|
| 2381 | size_t split_len = 0;
|
---|
| 2382 | @@ -5927,16 +5934,51 @@
|
---|
| 2383 |
|
---|
| 2384 | /*
|
---|
| 2385 | * Replace <> in the command by the arguments.
|
---|
| 2386 | + * First round: "buf" is NULL, compute length, allocate "buf".
|
---|
| 2387 | + * Second round: copy result into "buf".
|
---|
| 2388 | */
|
---|
| 2389 | buf = NULL;
|
---|
| 2390 | for (;;)
|
---|
| 2391 | {
|
---|
| 2392 | - p = cmd->uc_rep;
|
---|
| 2393 | - q = buf;
|
---|
| 2394 | + p = cmd->uc_rep; /* source */
|
---|
| 2395 | + q = buf; /* destinateion */
|
---|
| 2396 | totlen = 0;
|
---|
| 2397 | - while ((start = vim_strchr(p, '<')) != NULL
|
---|
| 2398 | - && (end = vim_strchr(start + 1, '>')) != NULL)
|
---|
| 2399 | +
|
---|
| 2400 | + for (;;)
|
---|
| 2401 | {
|
---|
| 2402 | + start = vim_strchr(p, '<');
|
---|
| 2403 | + if (start != NULL)
|
---|
| 2404 | + end = vim_strchr(start + 1, '>');
|
---|
| 2405 | + if (buf != NULL)
|
---|
| 2406 | + {
|
---|
| 2407 | + ksp = vim_strchr(p, K_SPECIAL);
|
---|
| 2408 | + if (ksp != NULL && (start == NULL || ksp < start || end == NULL)
|
---|
| 2409 | + && ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER)
|
---|
| 2410 | +# ifdef FEAT_GUI
|
---|
| 2411 | + || (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI)
|
---|
| 2412 | +# endif
|
---|
| 2413 | + ))
|
---|
| 2414 | + {
|
---|
| 2415 | + /* K_SPECIAL han been put in the buffer as K_SPECIAL
|
---|
| 2416 | + * KS_SPECIAL KE_FILLER, like for mappings, but
|
---|
| 2417 | + * do_cmdline() doesn't handle that, so convert it back.
|
---|
| 2418 | + * Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */
|
---|
| 2419 | + len = ksp - p;
|
---|
| 2420 | + if (len > 0)
|
---|
| 2421 | + {
|
---|
| 2422 | + mch_memmove(q, p, len);
|
---|
| 2423 | + q += len;
|
---|
| 2424 | + }
|
---|
| 2425 | + *q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI;
|
---|
| 2426 | + p = ksp + 3;
|
---|
| 2427 | + continue;
|
---|
| 2428 | + }
|
---|
| 2429 | + }
|
---|
| 2430 | +
|
---|
| 2431 | + /* break if there no <item> is found */
|
---|
| 2432 | + if (start == NULL || end == NULL)
|
---|
| 2433 | + break;
|
---|
| 2434 | +
|
---|
| 2435 | /* Include the '>' */
|
---|
| 2436 | ++end;
|
---|
| 2437 |
|
---|
[76dd250] | 2438 | @@ -8749,8 +8791,8 @@
|
---|
| 2439 | else if (*dirnow != NUL
|
---|
| 2440 | && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
|
---|
| 2441 | {
|
---|
| 2442 | - (void)mch_chdir((char *)globaldir);
|
---|
| 2443 | - shorten_fnames(TRUE);
|
---|
| 2444 | + if (mch_chdir((char *)globaldir) == OK)
|
---|
| 2445 | + shorten_fnames(TRUE);
|
---|
| 2446 | }
|
---|
| 2447 |
|
---|
[5f4a45c9] | 2448 | failed |= (makeopens(fd, dirnow) == FAIL);
|
---|
[76dd250] | 2449 | @@ -9506,24 +9548,50 @@
|
---|
| 2450 | break;
|
---|
| 2451 | }
|
---|
| 2452 | s = src + 1;
|
---|
| 2453 | + if (*s == '<') /* "#<99" uses v:oldfiles */
|
---|
| 2454 | + ++s;
|
---|
| 2455 | i = (int)getdigits(&s);
|
---|
| 2456 | *usedlen = (int)(s - src); /* length of what we expand */
|
---|
| 2457 |
|
---|
| 2458 | - buf = buflist_findnr(i);
|
---|
| 2459 | - if (buf == NULL)
|
---|
| 2460 | + if (src[1] == '<')
|
---|
| 2461 | {
|
---|
| 2462 | - *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
|
---|
| 2463 | + if (*usedlen < 2)
|
---|
| 2464 | + {
|
---|
| 2465 | + /* Should we give an error message for #<text? */
|
---|
| 2466 | + *usedlen = 1;
|
---|
| 2467 | + return NULL;
|
---|
| 2468 | + }
|
---|
| 2469 | +#ifdef FEAT_EVAL
|
---|
| 2470 | + result = list_find_str(get_vim_var_list(VV_OLDFILES),
|
---|
| 2471 | + (long)i);
|
---|
| 2472 | + if (result == NULL)
|
---|
| 2473 | + {
|
---|
| 2474 | + *errormsg = (char_u *)"";
|
---|
| 2475 | + return NULL;
|
---|
| 2476 | + }
|
---|
| 2477 | +#else
|
---|
| 2478 | + *errormsg = (char_u *)_("E809: #< is not available without the +eval feature");
|
---|
| 2479 | return NULL;
|
---|
| 2480 | +#endif
|
---|
| 2481 | }
|
---|
| 2482 | - if (lnump != NULL)
|
---|
| 2483 | - *lnump = ECMD_LAST;
|
---|
| 2484 | - if (buf->b_fname == NULL)
|
---|
| 2485 | + else
|
---|
| 2486 | {
|
---|
| 2487 | - result = (char_u *)"";
|
---|
| 2488 | - valid = 0; /* Must have ":p:h" to be valid */
|
---|
| 2489 | + buf = buflist_findnr(i);
|
---|
| 2490 | + if (buf == NULL)
|
---|
| 2491 | + {
|
---|
| 2492 | + *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
|
---|
| 2493 | + return NULL;
|
---|
| 2494 | + }
|
---|
| 2495 | + if (lnump != NULL)
|
---|
| 2496 | + *lnump = ECMD_LAST;
|
---|
| 2497 | + if (buf->b_fname == NULL)
|
---|
| 2498 | + {
|
---|
| 2499 | + result = (char_u *)"";
|
---|
| 2500 | + valid = 0; /* Must have ":p:h" to be valid */
|
---|
| 2501 | + }
|
---|
| 2502 | + else
|
---|
| 2503 | + result = buf->b_fname;
|
---|
| 2504 | }
|
---|
| 2505 | - else
|
---|
| 2506 | - result = buf->b_fname;
|
---|
| 2507 | break;
|
---|
| 2508 |
|
---|
[5f4a45c9] | 2509 | #ifdef FEAT_SEARCHPATH
|
---|
[76dd250] | 2510 | @@ -9541,6 +9609,15 @@
|
---|
| 2511 | #ifdef FEAT_AUTOCMD
|
---|
| 2512 | case SPEC_AFILE: /* file name for autocommand */
|
---|
| 2513 | result = autocmd_fname;
|
---|
| 2514 | + if (result != NULL && !autocmd_fname_full)
|
---|
| 2515 | + {
|
---|
| 2516 | + /* Still need to turn the fname into a full path. It is
|
---|
| 2517 | + * postponed to avoid a delay when <afile> is not used. */
|
---|
| 2518 | + autocmd_fname_full = TRUE;
|
---|
| 2519 | + result = FullName_save(autocmd_fname, FALSE);
|
---|
| 2520 | + vim_free(autocmd_fname);
|
---|
| 2521 | + autocmd_fname = result;
|
---|
| 2522 | + }
|
---|
| 2523 | if (result == NULL)
|
---|
| 2524 | {
|
---|
[5f4a45c9] | 2525 | *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
|
---|
[76dd250] | 2526 | @@ -10067,7 +10144,7 @@
|
---|
| 2527 | */
|
---|
| 2528 | if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
|
---|
| 2529 | || put_line(fd, "if file_readable(s:sx)") == FAIL
|
---|
| 2530 | - || put_line(fd, " exe \"source \" . s:sx") == FAIL
|
---|
| 2531 | + || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL
|
---|
| 2532 | || put_line(fd, "endif") == FAIL)
|
---|
| 2533 | return FAIL;
|
---|
[5f4a45c9] | 2534 |
|
---|
[76dd250] | 2535 | @@ -10689,7 +10766,8 @@
|
---|
| 2536 | p_viminfo = (char_u *)"'100";
|
---|
| 2537 | if (eap->cmdidx == CMD_rviminfo)
|
---|
| 2538 | {
|
---|
| 2539 | - if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL)
|
---|
| 2540 | + if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS
|
---|
| 2541 | + | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL)
|
---|
| 2542 | EMSG(_("E195: Cannot open viminfo file for reading"));
|
---|
| 2543 | }
|
---|
| 2544 | else
|
---|
| 2545 | diff -Naur vim72.orig/src/ex_getln.c vim72/src/ex_getln.c
|
---|
[54f612f] | 2546 | --- vim72.orig/src/ex_getln.c 2008-08-08 02:31:33.000000000 -0700
|
---|
[76dd250] | 2547 | +++ vim72/src/ex_getln.c 2009-02-22 21:57:40.525339851 -0800
|
---|
| 2548 | @@ -31,6 +31,8 @@
|
---|
| 2549 | int cmdattr; /* attributes for prompt */
|
---|
| 2550 | int overstrike; /* Typing mode on the command line. Shared by
|
---|
| 2551 | getcmdline() and put_on_cmdline(). */
|
---|
| 2552 | + expand_T *xpc; /* struct being used for expansion, xp_pattern
|
---|
| 2553 | + may point into cmdbuff */
|
---|
| 2554 | int xp_context; /* type of expansion */
|
---|
| 2555 | # ifdef FEAT_EVAL
|
---|
| 2556 | char_u *xp_arg; /* user-defined expansion arg */
|
---|
| 2557 | @@ -38,7 +40,11 @@
|
---|
| 2558 | # endif
|
---|
| 2559 | };
|
---|
| 2560 |
|
---|
| 2561 | -static struct cmdline_info ccline; /* current cmdline_info */
|
---|
| 2562 | +/* The current cmdline_info. It is initialized in getcmdline() and after that
|
---|
| 2563 | + * used by other functions. When invoking getcmdline() recursively it needs
|
---|
| 2564 | + * to be saved with save_cmdline() and restored with restore_cmdline().
|
---|
| 2565 | + * TODO: make it local to getcmdline() and pass it around. */
|
---|
| 2566 | +static struct cmdline_info ccline;
|
---|
| 2567 |
|
---|
| 2568 | static int cmd_showtail; /* Only show path tail in lists ? */
|
---|
| 2569 |
|
---|
| 2570 | @@ -238,6 +244,7 @@
|
---|
| 2571 | }
|
---|
| 2572 |
|
---|
| 2573 | ExpandInit(&xpc);
|
---|
| 2574 | + ccline.xpc = &xpc;
|
---|
| 2575 |
|
---|
| 2576 | #ifdef FEAT_RIGHTLEFT
|
---|
| 2577 | if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
|
---|
| 2578 | @@ -408,9 +415,10 @@
|
---|
| 2579 | #endif
|
---|
| 2580 |
|
---|
| 2581 | /*
|
---|
| 2582 | - * <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>).
|
---|
| 2583 | + * When there are matching completions to select <S-Tab> works like
|
---|
| 2584 | + * CTRL-P (unless 'wc' is <S-Tab>).
|
---|
| 2585 | */
|
---|
| 2586 | - if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)
|
---|
| 2587 | + if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
|
---|
| 2588 | c = Ctrl_P;
|
---|
| 2589 |
|
---|
| 2590 | #ifdef FEAT_WILDMENU
|
---|
| 2591 | @@ -1513,6 +1521,7 @@
|
---|
| 2592 | int old_firstc;
|
---|
| 2593 |
|
---|
| 2594 | vim_free(ccline.cmdbuff);
|
---|
| 2595 | + xpc.xp_context = EXPAND_NOTHING;
|
---|
| 2596 | if (hiscnt == hislen)
|
---|
| 2597 | p = lookfor; /* back to the old one */
|
---|
| 2598 | else
|
---|
| 2599 | @@ -1839,6 +1848,7 @@
|
---|
| 2600 | #endif
|
---|
| 2601 |
|
---|
| 2602 | ExpandCleanup(&xpc);
|
---|
| 2603 | + ccline.xpc = NULL;
|
---|
| 2604 |
|
---|
| 2605 | #ifdef FEAT_SEARCH_EXTRA
|
---|
| 2606 | if (did_incsearch)
|
---|
| 2607 | @@ -2508,6 +2518,20 @@
|
---|
| 2608 | }
|
---|
| 2609 | mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
|
---|
| 2610 | vim_free(p);
|
---|
| 2611 | +
|
---|
| 2612 | + if (ccline.xpc != NULL
|
---|
| 2613 | + && ccline.xpc->xp_pattern != NULL
|
---|
| 2614 | + && ccline.xpc->xp_context != EXPAND_NOTHING
|
---|
| 2615 | + && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
|
---|
| 2616 | + {
|
---|
| 2617 | + int i = (int)(ccline.xpc->xp_pattern - p);
|
---|
| 2618 | +
|
---|
| 2619 | + /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
|
---|
| 2620 | + * to point into the newly allocated memory. */
|
---|
| 2621 | + if (i >= 0 && i <= ccline.cmdlen)
|
---|
| 2622 | + ccline.xpc->xp_pattern = ccline.cmdbuff + i;
|
---|
| 2623 | + }
|
---|
| 2624 | +
|
---|
| 2625 | return OK;
|
---|
| 2626 | }
|
---|
| 2627 |
|
---|
| 2628 | @@ -2875,6 +2899,7 @@
|
---|
| 2629 | prev_ccline = ccline;
|
---|
| 2630 | ccline.cmdbuff = NULL;
|
---|
| 2631 | ccline.cmdprompt = NULL;
|
---|
| 2632 | + ccline.xpc = NULL;
|
---|
| 2633 | }
|
---|
| 2634 |
|
---|
| 2635 | /*
|
---|
| 2636 | @@ -3582,6 +3607,7 @@
|
---|
| 2637 | ExpandInit(xp)
|
---|
| 2638 | expand_T *xp;
|
---|
| 2639 | {
|
---|
| 2640 | + xp->xp_pattern = NULL;
|
---|
| 2641 | xp->xp_backslash = XP_BS_NONE;
|
---|
| 2642 | #ifndef BACKSLASH_IN_FILENAME
|
---|
| 2643 | xp->xp_shell = FALSE;
|
---|
| 2644 | @@ -4871,7 +4897,7 @@
|
---|
| 2645 | if (s == NULL)
|
---|
| 2646 | return FAIL;
|
---|
| 2647 | sprintf((char *)s, "%s/%s*.vim", dirname, pat);
|
---|
| 2648 | - all = globpath(p_rtp, s);
|
---|
| 2649 | + all = globpath(p_rtp, s, 0);
|
---|
| 2650 | vim_free(s);
|
---|
| 2651 | if (all == NULL)
|
---|
| 2652 | return FAIL;
|
---|
| 2653 | @@ -4912,9 +4938,10 @@
|
---|
| 2654 | * newlines. Returns NULL for an error or no matches.
|
---|
| 2655 | */
|
---|
| 2656 | char_u *
|
---|
| 2657 | -globpath(path, file)
|
---|
| 2658 | +globpath(path, file, expand_options)
|
---|
| 2659 | char_u *path;
|
---|
| 2660 | char_u *file;
|
---|
| 2661 | + int expand_options;
|
---|
| 2662 | {
|
---|
| 2663 | expand_T xpc;
|
---|
| 2664 | char_u *buf;
|
---|
| 2665 | @@ -4943,10 +4970,10 @@
|
---|
| 2666 | {
|
---|
| 2667 | add_pathsep(buf);
|
---|
| 2668 | STRCAT(buf, file);
|
---|
| 2669 | - if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
|
---|
| 2670 | - && num_p > 0)
|
---|
| 2671 | + if (ExpandFromContext(&xpc, buf, &num_p, &p,
|
---|
| 2672 | + WILD_SILENT|expand_options) != FAIL && num_p > 0)
|
---|
| 2673 | {
|
---|
| 2674 | - ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
|
---|
| 2675 | + ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
|
---|
| 2676 | for (len = 0, i = 0; i < num_p; ++i)
|
---|
| 2677 | len += (int)STRLEN(p[i]) + 1;
|
---|
| 2678 |
|
---|
| 2679 | diff -Naur vim72.orig/src/feature.h vim72/src/feature.h
|
---|
[54f612f] | 2680 | --- vim72.orig/src/feature.h 2008-08-06 04:00:39.000000000 -0700
|
---|
[76dd250] | 2681 | +++ vim72/src/feature.h 2009-02-22 21:57:28.908593378 -0800
|
---|
| 2682 | @@ -767,9 +767,13 @@
|
---|
| 2683 |
|
---|
| 2684 | /*
|
---|
| 2685 | * +browse ":browse" command.
|
---|
| 2686 | + * or just the ":browse" command modifier
|
---|
| 2687 | */
|
---|
| 2688 | -#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))
|
---|
| 2689 | -# define FEAT_BROWSE
|
---|
| 2690 | +#if defined(FEAT_NORMAL)
|
---|
| 2691 | +# define FEAT_BROWSE_CMD
|
---|
| 2692 | +# 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)
|
---|
| 2693 | +# define FEAT_BROWSE
|
---|
| 2694 | +# endif
|
---|
| 2695 | #endif
|
---|
| 2696 |
|
---|
| 2697 | /*
|
---|
| 2698 | diff -Naur vim72.orig/src/fileio.c vim72/src/fileio.c
|
---|
[54f612f] | 2699 | --- vim72.orig/src/fileio.c 2008-08-06 04:01:03.000000000 -0700
|
---|
[76dd250] | 2700 | +++ vim72/src/fileio.c 2009-02-22 21:57:51.674054756 -0800
|
---|
| 2701 | @@ -932,7 +932,10 @@
|
---|
| 2702 | else
|
---|
| 2703 | {
|
---|
| 2704 | if (eap != NULL && eap->force_ff != 0)
|
---|
| 2705 | + {
|
---|
| 2706 | fileformat = get_fileformat_force(curbuf, eap);
|
---|
| 2707 | + try_unix = try_dos = try_mac = FALSE;
|
---|
| 2708 | + }
|
---|
| 2709 | else if (curbuf->b_p_bin)
|
---|
| 2710 | fileformat = EOL_UNIX; /* binary: use Unix format */
|
---|
| 2711 | else if (*p_ffs == NUL)
|
---|
| 2712 | @@ -2211,7 +2214,7 @@
|
---|
| 2713 | {
|
---|
| 2714 | /* Use stderr for stdin, makes shell commands work. */
|
---|
| 2715 | close(0);
|
---|
| 2716 | - dup(2);
|
---|
| 2717 | + ignored = dup(2);
|
---|
| 2718 | }
|
---|
| 2719 | #endif
|
---|
| 2720 |
|
---|
| 2721 | @@ -2341,11 +2344,6 @@
|
---|
| 2722 | STRCAT(IObuff, _("[CR missing]"));
|
---|
| 2723 | c = TRUE;
|
---|
| 2724 | }
|
---|
| 2725 | - if (ff_error == EOL_MAC)
|
---|
| 2726 | - {
|
---|
| 2727 | - STRCAT(IObuff, _("[NL found]"));
|
---|
| 2728 | - c = TRUE;
|
---|
| 2729 | - }
|
---|
| 2730 | if (split)
|
---|
| 2731 | {
|
---|
| 2732 | STRCAT(IObuff, _("[long lines split]"));
|
---|
| 2733 | @@ -2711,7 +2709,7 @@
|
---|
| 2734 | {
|
---|
| 2735 | if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
|
---|
| 2736 | && curbuf->b_ffname != NULL)
|
---|
| 2737 | - read_viminfo(NULL, FALSE, TRUE, FALSE);
|
---|
| 2738 | + read_viminfo(NULL, VIF_WANT_MARKS);
|
---|
| 2739 |
|
---|
| 2740 | /* Always set b_marks_read; needed when 'viminfo' is changed to include
|
---|
| 2741 | * the ' parameter after opening a buffer. */
|
---|
| 2742 | @@ -3451,7 +3449,7 @@
|
---|
| 2743 | {
|
---|
| 2744 | # ifdef UNIX
|
---|
| 2745 | # ifdef HAVE_FCHOWN
|
---|
| 2746 | - fchown(fd, st_old.st_uid, st_old.st_gid);
|
---|
| 2747 | + ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
|
---|
| 2748 | # endif
|
---|
| 2749 | if (mch_stat((char *)IObuff, &st) < 0
|
---|
| 2750 | || st.st_uid != st_old.st_uid
|
---|
| 2751 | @@ -4367,7 +4365,7 @@
|
---|
| 2752 | || st.st_uid != st_old.st_uid
|
---|
| 2753 | || st.st_gid != st_old.st_gid)
|
---|
| 2754 | {
|
---|
| 2755 | - fchown(fd, st_old.st_uid, st_old.st_gid);
|
---|
| 2756 | + ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
|
---|
| 2757 | if (perm >= 0) /* set permission again, may have changed */
|
---|
| 2758 | (void)mch_setperm(wfname, perm);
|
---|
| 2759 | }
|
---|
| 2760 | @@ -5550,9 +5548,10 @@
|
---|
| 2761 | name = "ucs-4le"; /* FF FE 00 00 */
|
---|
| 2762 | len = 4;
|
---|
| 2763 | }
|
---|
| 2764 | - else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L))
|
---|
| 2765 | + else if (flags == (FIO_UCS2 | FIO_ENDIAN_L))
|
---|
| 2766 | name = "ucs-2le"; /* FF FE */
|
---|
| 2767 | - else if (flags == (FIO_UTF16 | FIO_ENDIAN_L))
|
---|
| 2768 | + else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L))
|
---|
| 2769 | + /* utf-16le is preferred, it also works for ucs-2le text */
|
---|
| 2770 | name = "utf-16le"; /* FF FE */
|
---|
| 2771 | }
|
---|
| 2772 | else if (p[0] == 0xfe && p[1] == 0xff
|
---|
| 2773 | @@ -6031,9 +6030,9 @@
|
---|
| 2774 | {
|
---|
| 2775 | tbuf[FGETS_SIZE - 2] = NUL;
|
---|
| 2776 | #ifdef USE_CR
|
---|
| 2777 | - fgets_cr((char *)tbuf, FGETS_SIZE, fp);
|
---|
| 2778 | + ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
|
---|
| 2779 | #else
|
---|
| 2780 | - fgets((char *)tbuf, FGETS_SIZE, fp);
|
---|
| 2781 | + ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
|
---|
| 2782 | #endif
|
---|
| 2783 | } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
|
---|
[43c52a1] | 2784 | }
|
---|
| 2785 | @@ -6107,12 +6106,24 @@
|
---|
| 2786 | #ifdef HAVE_ACL
|
---|
| 2787 | vim_acl_T acl; /* ACL from original file */
|
---|
| 2788 | #endif
|
---|
| 2789 | +#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
|
---|
| 2790 | + int use_tmp_file = FALSE;
|
---|
| 2791 | +#endif
|
---|
| 2792 |
|
---|
| 2793 | /*
|
---|
| 2794 | - * When the names are identical, there is nothing to do.
|
---|
| 2795 | + * When the names are identical, there is nothing to do. When they refer
|
---|
| 2796 | + * to the same file (ignoring case and slash/backslash differences) but
|
---|
| 2797 | + * the file name differs we need to go through a temp file.
|
---|
| 2798 | */
|
---|
| 2799 | if (fnamecmp(from, to) == 0)
|
---|
| 2800 | - return 0;
|
---|
| 2801 | + {
|
---|
| 2802 | +#ifdef CASE_INSENSITIVE_FILENAME
|
---|
| 2803 | + if (STRCMP(gettail(from), gettail(to)) != 0)
|
---|
| 2804 | + use_tmp_file = TRUE;
|
---|
| 2805 | + else
|
---|
| 2806 | +#endif
|
---|
| 2807 | + return 0;
|
---|
| 2808 | + }
|
---|
| 2809 |
|
---|
| 2810 | /*
|
---|
| 2811 | * Fail if the "from" file doesn't exist. Avoids that "to" is deleted.
|
---|
[1f22c7c] | 2812 | @@ -6120,6 +6131,55 @@
|
---|
| 2813 | if (mch_stat((char *)from, &st) < 0)
|
---|
| 2814 | return -1;
|
---|
| 2815 |
|
---|
| 2816 | +#ifdef UNIX
|
---|
| 2817 | + {
|
---|
| 2818 | + struct stat st_to;
|
---|
| 2819 | +
|
---|
| 2820 | + /* It's possible for the source and destination to be the same file.
|
---|
| 2821 | + * This happens when "from" and "to" differ in case and are on a FAT32
|
---|
| 2822 | + * filesystem. In that case go through a temp file name. */
|
---|
| 2823 | + if (mch_stat((char *)to, &st_to) >= 0
|
---|
| 2824 | + && st.st_dev == st_to.st_dev
|
---|
[43c52a1] | 2825 | + && st.st_ino == st_to.st_ino)
|
---|
| 2826 | + use_tmp_file = TRUE;
|
---|
| 2827 | + }
|
---|
| 2828 | +#endif
|
---|
| 2829 | +
|
---|
| 2830 | +#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
|
---|
| 2831 | + if (use_tmp_file)
|
---|
| 2832 | + {
|
---|
| 2833 | + char tempname[MAXPATHL + 1];
|
---|
| 2834 | +
|
---|
| 2835 | + /*
|
---|
| 2836 | + * Find a name that doesn't exist and is in the same directory.
|
---|
| 2837 | + * Rename "from" to "tempname" and then rename "tempname" to "to".
|
---|
| 2838 | + */
|
---|
| 2839 | + if (STRLEN(from) >= MAXPATHL - 5)
|
---|
| 2840 | + return -1;
|
---|
| 2841 | + STRCPY(tempname, from);
|
---|
[1f22c7c] | 2842 | + for (n = 123; n < 99999; ++n)
|
---|
[43c52a1] | 2843 | + {
|
---|
| 2844 | + sprintf((char *)gettail((char_u *)tempname), "%d", n);
|
---|
[1f22c7c] | 2845 | + if (mch_stat(tempname, &st) < 0)
|
---|
[43c52a1] | 2846 | + {
|
---|
[1f22c7c] | 2847 | + if (mch_rename((char *)from, tempname) == 0)
|
---|
[43c52a1] | 2848 | + {
|
---|
| 2849 | + if (mch_rename(tempname, (char *)to) == 0)
|
---|
| 2850 | + return 0;
|
---|
| 2851 | + /* Strange, the second step failed. Try moving the
|
---|
| 2852 | + * file back and return failure. */
|
---|
[1f22c7c] | 2853 | + mch_rename(tempname, (char *)from);
|
---|
| 2854 | + return -1;
|
---|
[43c52a1] | 2855 | + }
|
---|
| 2856 | + /* If it fails for one temp name it will most likely fail
|
---|
| 2857 | + * for any temp name, give up. */
|
---|
[1f22c7c] | 2858 | + return -1;
|
---|
| 2859 | + }
|
---|
[43c52a1] | 2860 | + }
|
---|
[1f22c7c] | 2861 | + return -1;
|
---|
| 2862 | + }
|
---|
| 2863 | +#endif
|
---|
| 2864 | +
|
---|
| 2865 | /*
|
---|
| 2866 | * Delete the "to" file, this is required on some systems to make the
|
---|
[43c52a1] | 2867 | * mch_rename() work, on other systems it makes sure that we don't have
|
---|
[76dd250] | 2868 | @@ -8523,6 +8583,7 @@
|
---|
| 2869 | char_u *save_sourcing_name;
|
---|
| 2870 | linenr_T save_sourcing_lnum;
|
---|
| 2871 | char_u *save_autocmd_fname;
|
---|
| 2872 | + int save_autocmd_fname_full;
|
---|
| 2873 | int save_autocmd_bufnr;
|
---|
| 2874 | char_u *save_autocmd_match;
|
---|
[43c52a1] | 2875 | int save_autocmd_busy;
|
---|
[76dd250] | 2876 | @@ -8601,6 +8662,7 @@
|
---|
| 2877 | * Save the autocmd_* variables and info about the current buffer.
|
---|
| 2878 | */
|
---|
| 2879 | save_autocmd_fname = autocmd_fname;
|
---|
| 2880 | + save_autocmd_fname_full = autocmd_fname_full;
|
---|
| 2881 | save_autocmd_bufnr = autocmd_bufnr;
|
---|
| 2882 | save_autocmd_match = autocmd_match;
|
---|
[43c52a1] | 2883 | save_autocmd_busy = autocmd_busy;
|
---|
[76dd250] | 2884 | @@ -8618,14 +8680,15 @@
|
---|
| 2885 | if (fname != NULL && *fname != NUL)
|
---|
| 2886 | autocmd_fname = fname;
|
---|
| 2887 | else if (buf != NULL)
|
---|
| 2888 | - autocmd_fname = buf->b_fname;
|
---|
| 2889 | + autocmd_fname = buf->b_ffname;
|
---|
| 2890 | else
|
---|
| 2891 | autocmd_fname = NULL;
|
---|
| 2892 | }
|
---|
| 2893 | else
|
---|
| 2894 | autocmd_fname = fname_io;
|
---|
| 2895 | if (autocmd_fname != NULL)
|
---|
| 2896 | - autocmd_fname = FullName_save(autocmd_fname, FALSE);
|
---|
| 2897 | + autocmd_fname = vim_strsave(autocmd_fname);
|
---|
| 2898 | + autocmd_fname_full = FALSE; /* call FullName_save() later */
|
---|
| 2899 |
|
---|
| 2900 | /*
|
---|
[43c52a1] | 2901 | * Set the buffer number to be used for <abuf>.
|
---|
[76dd250] | 2902 | @@ -8810,6 +8873,7 @@
|
---|
| 2903 | sourcing_lnum = save_sourcing_lnum;
|
---|
| 2904 | vim_free(autocmd_fname);
|
---|
| 2905 | autocmd_fname = save_autocmd_fname;
|
---|
| 2906 | + autocmd_fname_full = save_autocmd_fname_full;
|
---|
| 2907 | autocmd_bufnr = save_autocmd_bufnr;
|
---|
| 2908 | autocmd_match = save_autocmd_match;
|
---|
[43c52a1] | 2909 | #ifdef FEAT_EVAL
|
---|
[76dd250] | 2910 | @@ -8918,7 +8982,7 @@
|
---|
| 2911 | {
|
---|
| 2912 | apc->curpat = NULL;
|
---|
| 2913 |
|
---|
| 2914 | - /* only use a pattern when it has not been removed, has commands and
|
---|
| 2915 | + /* Only use a pattern when it has not been removed, has commands and
|
---|
| 2916 | * the group matches. For buffer-local autocommands only check the
|
---|
| 2917 | * buffer number. */
|
---|
[43c52a1] | 2918 | if (ap->pat != NULL && ap->cmds != NULL
|
---|
[76dd250] | 2919 | @@ -9104,7 +9168,7 @@
|
---|
| 2920 | set_context_in_autocmd(xp, arg, doautocmd)
|
---|
| 2921 | expand_T *xp;
|
---|
| 2922 | char_u *arg;
|
---|
| 2923 | - int doautocmd; /* TRUE for :doautocmd, FALSE for :autocmd */
|
---|
| 2924 | + int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */
|
---|
| 2925 | {
|
---|
| 2926 | char_u *p;
|
---|
| 2927 | int group;
|
---|
| 2928 | diff -Naur vim72.orig/src/fold.c vim72/src/fold.c
|
---|
[54f612f] | 2929 | --- vim72.orig/src/fold.c 2008-08-06 04:01:12.000000000 -0700
|
---|
[76dd250] | 2930 | +++ vim72/src/fold.c 2009-02-22 21:57:51.682054476 -0800
|
---|
| 2931 | @@ -48,7 +48,7 @@
|
---|
| 2932 | static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp));
|
---|
| 2933 | static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum));
|
---|
| 2934 | static void checkupdate __ARGS((win_T *wp));
|
---|
| 2935 | -static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open));
|
---|
| 2936 | +static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open));
|
---|
| 2937 | static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep));
|
---|
| 2938 | static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep));
|
---|
[43c52a1] | 2939 | static void foldOpenNested __ARGS((fold_T *fpr));
|
---|
| 2940 | @@ -740,7 +740,7 @@
|
---|
| 2941 | garray_T *found_ga;
|
---|
| 2942 | fold_T *found_fp = NULL;
|
---|
| 2943 | linenr_T found_off = 0;
|
---|
| 2944 | - int use_level = FALSE;
|
---|
| 2945 | + int use_level;
|
---|
| 2946 | int maybe_small = FALSE;
|
---|
| 2947 | int level = 0;
|
---|
| 2948 | linenr_T lnum = start;
|
---|
| 2949 | @@ -757,6 +757,7 @@
|
---|
| 2950 | gap = &curwin->w_folds;
|
---|
| 2951 | found_ga = NULL;
|
---|
| 2952 | lnum_off = 0;
|
---|
| 2953 | + use_level = FALSE;
|
---|
| 2954 | for (;;)
|
---|
| 2955 | {
|
---|
| 2956 | if (!foldFind(gap, lnum - lnum_off, &fp))
|
---|
| 2957 | @@ -783,20 +784,21 @@
|
---|
| 2958 | else
|
---|
| 2959 | {
|
---|
| 2960 | lnum = found_fp->fd_top + found_fp->fd_len + found_off;
|
---|
| 2961 | - did_one = TRUE;
|
---|
| 2962 |
|
---|
| 2963 | if (foldmethodIsManual(curwin))
|
---|
| 2964 | deleteFoldEntry(found_ga,
|
---|
| 2965 | (int)(found_fp - (fold_T *)found_ga->ga_data), recursive);
|
---|
| 2966 | else
|
---|
| 2967 | {
|
---|
| 2968 | - if (found_fp->fd_top + found_off < first_lnum)
|
---|
| 2969 | - first_lnum = found_fp->fd_top;
|
---|
| 2970 | - if (lnum > last_lnum)
|
---|
| 2971 | + if (first_lnum > found_fp->fd_top + found_off)
|
---|
| 2972 | + first_lnum = found_fp->fd_top + found_off;
|
---|
| 2973 | + if (last_lnum < lnum)
|
---|
| 2974 | last_lnum = lnum;
|
---|
| 2975 | - parseMarker(curwin);
|
---|
| 2976 | + if (!did_one)
|
---|
| 2977 | + parseMarker(curwin);
|
---|
| 2978 | deleteFoldMarkers(found_fp, recursive, found_off);
|
---|
| 2979 | }
|
---|
| 2980 | + did_one = TRUE;
|
---|
| 2981 |
|
---|
| 2982 | /* redraw window */
|
---|
| 2983 | changed_window_setting();
|
---|
| 2984 | @@ -811,6 +813,10 @@
|
---|
| 2985 | redraw_curbuf_later(INVERTED);
|
---|
| 2986 | #endif
|
---|
| 2987 | }
|
---|
| 2988 | + else
|
---|
| 2989 | + /* Deleting markers may make cursor column invalid. */
|
---|
| 2990 | + check_cursor_col();
|
---|
| 2991 | +
|
---|
| 2992 | if (last_lnum > 0)
|
---|
| 2993 | changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L);
|
---|
| 2994 | }
|
---|
[76dd250] | 2995 | @@ -1241,10 +1247,10 @@
|
---|
| 2996 | * Repeat "count" times.
|
---|
| 2997 | */
|
---|
| 2998 | static void
|
---|
| 2999 | -setFoldRepeat(lnum, count, open)
|
---|
| 3000 | +setFoldRepeat(lnum, count, do_open)
|
---|
| 3001 | linenr_T lnum;
|
---|
| 3002 | long count;
|
---|
| 3003 | - int open;
|
---|
| 3004 | + int do_open;
|
---|
| 3005 | {
|
---|
| 3006 | int done;
|
---|
[43c52a1] | 3007 | long n;
|
---|
[76dd250] | 3008 | @@ -1252,7 +1258,7 @@
|
---|
| 3009 | for (n = 0; n < count; ++n)
|
---|
| 3010 | {
|
---|
| 3011 | done = DONE_NOTHING;
|
---|
| 3012 | - (void)setManualFold(lnum, open, FALSE, &done);
|
---|
| 3013 | + (void)setManualFold(lnum, do_open, FALSE, &done);
|
---|
| 3014 | if (!(done & DONE_ACTION))
|
---|
| 3015 | {
|
---|
| 3016 | /* Only give an error message when no fold could be opened. */
|
---|
| 3017 | diff -Naur vim72.orig/src/getchar.c vim72/src/getchar.c
|
---|
[54f612f] | 3018 | --- vim72.orig/src/getchar.c 2008-07-22 09:57:48.000000000 -0700
|
---|
| 3019 | +++ vim72/src/getchar.c 2009-02-22 21:58:03.122787819 -0800
|
---|
| 3020 | @@ -3816,7 +3816,11 @@
|
---|
| 3021 | int len = 1;
|
---|
| 3022 |
|
---|
| 3023 | if (msg_didout || msg_silent != 0)
|
---|
| 3024 | + {
|
---|
| 3025 | msg_putchar('\n');
|
---|
| 3026 | + if (got_int) /* 'q' typed at MORE prompt */
|
---|
| 3027 | + return;
|
---|
| 3028 | + }
|
---|
| 3029 | if ((mp->m_mode & (INSERT + CMDLINE)) == INSERT + CMDLINE)
|
---|
| 3030 | msg_putchar('!'); /* :map! */
|
---|
| 3031 | else if (mp->m_mode & INSERT)
|
---|
[76dd250] | 3032 | @@ -4702,7 +4706,7 @@
|
---|
| 3033 | return FAIL;
|
---|
| 3034 | if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0)
|
---|
| 3035 | return FAIL;
|
---|
| 3036 | - if (fprintf(fd, cmd) < 0)
|
---|
| 3037 | + if (fputs(cmd, fd) < 0)
|
---|
| 3038 | return FAIL;
|
---|
| 3039 | if (buf != NULL && fputs(" <buffer>", fd) < 0)
|
---|
[54f612f] | 3040 | return FAIL;
|
---|
[76dd250] | 3041 | @@ -4801,7 +4805,7 @@
|
---|
| 3042 | }
|
---|
| 3043 | if (IS_SPECIAL(c) || modifiers) /* special key */
|
---|
| 3044 | {
|
---|
| 3045 | - if (fprintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)
|
---|
| 3046 | + if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0)
|
---|
| 3047 | return FAIL;
|
---|
| 3048 | continue;
|
---|
| 3049 | }
|
---|
| 3050 | diff -Naur vim72.orig/src/globals.h vim72/src/globals.h
|
---|
[54f612f] | 3051 | --- vim72.orig/src/globals.h 2008-07-26 04:53:29.000000000 -0700
|
---|
[76dd250] | 3052 | +++ vim72/src/globals.h 2009-02-22 21:57:51.694055594 -0800
|
---|
| 3053 | @@ -1022,6 +1022,7 @@
|
---|
| 3054 | #endif
|
---|
| 3055 | #ifdef FEAT_AUTOCMD
|
---|
| 3056 | EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
|
---|
| 3057 | +EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
|
---|
| 3058 | EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
|
---|
| 3059 | EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
|
---|
[43c52a1] | 3060 | EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
|
---|
| 3061 | @@ -1339,7 +1340,6 @@
|
---|
| 3062 |
|
---|
| 3063 | #ifdef FEAT_NETBEANS_INTG
|
---|
| 3064 | EXTERN char *netbeansArg INIT(= NULL); /* the -nb[:host:port:passwd] arg */
|
---|
| 3065 | -EXTERN int netbeansCloseFile INIT(= 0); /* send killed if != 0 */
|
---|
| 3066 | EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */
|
---|
| 3067 | EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */
|
---|
| 3068 | EXTERN int netbeansReadFile INIT(= 1); /* OK to read from disk if != 0 */
|
---|
[76dd250] | 3069 | @@ -1548,6 +1548,14 @@
|
---|
| 3070 | EXTERN time_t starttime;
|
---|
| 3071 |
|
---|
| 3072 | /*
|
---|
| 3073 | + * Some compilers warn for not using a return value, but in some situations we
|
---|
| 3074 | + * can't do anything useful with the value. Assign to this variable to avoid
|
---|
| 3075 | + * the warning.
|
---|
| 3076 | + */
|
---|
| 3077 | +EXTERN int ignored;
|
---|
| 3078 | +EXTERN char *ignoredp;
|
---|
| 3079 | +
|
---|
| 3080 | +/*
|
---|
| 3081 | * Optional Farsi support. Include it here, so EXTERN and INIT are defined.
|
---|
| 3082 | */
|
---|
[5f4a45c9] | 3083 | #ifdef FEAT_FKMAP
|
---|
| 3084 | diff -Naur vim72.orig/src/gui_at_sb.c vim72/src/gui_at_sb.c
|
---|
[54f612f] | 3085 | --- vim72.orig/src/gui_at_sb.c 2004-06-07 07:32:25.000000000 -0700
|
---|
[5f4a45c9] | 3086 | +++ vim72/src/gui_at_sb.c 2009-02-22 21:57:40.637347115 -0800
|
---|
| 3087 | @@ -1078,6 +1078,12 @@
|
---|
| 3088 | Cardinal *num_params; /* unused */
|
---|
| 3089 | {
|
---|
| 3090 | ScrollbarWidget sbw = (ScrollbarWidget)w;
|
---|
| 3091 | + /* Use a union to avoid a warning for the weird conversion from float to
|
---|
| 3092 | + * XtPointer. Comes from Xaw/Scrollbar.c. */
|
---|
| 3093 | + union {
|
---|
| 3094 | + XtPointer xtp;
|
---|
| 3095 | + float xtf;
|
---|
| 3096 | + } xtpf;
|
---|
| 3097 |
|
---|
| 3098 | if (LookAhead(w, event))
|
---|
| 3099 | return;
|
---|
| 3100 | @@ -1085,7 +1091,8 @@
|
---|
| 3101 | /* thumbProc is not pretty, but is necessary for backwards
|
---|
| 3102 | compatibility on those architectures for which it work{s,ed};
|
---|
| 3103 | the intent is to pass a (truncated) float by value. */
|
---|
| 3104 | - XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top);
|
---|
| 3105 | + xtpf.xtf = sbw->scrollbar.top;
|
---|
| 3106 | + XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
|
---|
| 3107 | XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
|
---|
| 3108 | }
|
---|
[76dd250] | 3109 |
|
---|
| 3110 | diff -Naur vim72.orig/src/gui.c vim72/src/gui.c
|
---|
[54f612f] | 3111 | --- vim72.orig/src/gui.c 2008-07-27 12:32:14.000000000 -0700
|
---|
[76dd250] | 3112 | +++ vim72/src/gui.c 2009-02-22 21:57:40.773355217 -0800
|
---|
| 3113 | @@ -139,7 +139,7 @@
|
---|
| 3114 | /* The read returns when the child closes the pipe (or when
|
---|
| 3115 | * the child dies for some reason). */
|
---|
| 3116 | close(pipefd[1]);
|
---|
| 3117 | - (void)read(pipefd[0], &dummy, (size_t)1);
|
---|
| 3118 | + ignored = (int)read(pipefd[0], &dummy, (size_t)1);
|
---|
| 3119 | close(pipefd[0]);
|
---|
| 3120 | }
|
---|
| 3121 |
|
---|
| 3122 | @@ -3241,7 +3241,7 @@
|
---|
| 3123 | i = Rows;
|
---|
| 3124 | gui_update_tabline();
|
---|
| 3125 | Rows = i;
|
---|
| 3126 | - need_set_size = RESIZE_VERT;
|
---|
| 3127 | + need_set_size |= RESIZE_VERT;
|
---|
| 3128 | if (using_tabline)
|
---|
| 3129 | fix_size = TRUE;
|
---|
| 3130 | if (!gui_use_tabline())
|
---|
| 3131 | @@ -3275,9 +3275,9 @@
|
---|
| 3132 | if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
|
---|
| 3133 | {
|
---|
| 3134 | if (i == SBAR_BOTTOM)
|
---|
| 3135 | - need_set_size = RESIZE_VERT;
|
---|
| 3136 | + need_set_size |= RESIZE_VERT;
|
---|
| 3137 | else
|
---|
| 3138 | - need_set_size = RESIZE_HOR;
|
---|
| 3139 | + need_set_size |= RESIZE_HOR;
|
---|
| 3140 | if (gui.which_scrollbars[i])
|
---|
| 3141 | fix_size = TRUE;
|
---|
| 3142 | }
|
---|
| 3143 | @@ -3297,7 +3297,7 @@
|
---|
| 3144 | gui_mch_enable_menu(gui.menu_is_active);
|
---|
| 3145 | Rows = i;
|
---|
| 3146 | prev_menu_is_active = gui.menu_is_active;
|
---|
| 3147 | - need_set_size = RESIZE_VERT;
|
---|
| 3148 | + need_set_size |= RESIZE_VERT;
|
---|
| 3149 | if (gui.menu_is_active)
|
---|
| 3150 | fix_size = TRUE;
|
---|
| 3151 | }
|
---|
| 3152 | @@ -3308,7 +3308,7 @@
|
---|
| 3153 | {
|
---|
| 3154 | gui_mch_show_toolbar(using_toolbar);
|
---|
| 3155 | prev_toolbar = using_toolbar;
|
---|
| 3156 | - need_set_size = RESIZE_VERT;
|
---|
| 3157 | + need_set_size |= RESIZE_VERT;
|
---|
| 3158 | if (using_toolbar)
|
---|
| 3159 | fix_size = TRUE;
|
---|
| 3160 | }
|
---|
| 3161 | @@ -3318,7 +3318,7 @@
|
---|
| 3162 | {
|
---|
| 3163 | gui_mch_enable_footer(using_footer);
|
---|
| 3164 | prev_footer = using_footer;
|
---|
| 3165 | - need_set_size = RESIZE_VERT;
|
---|
| 3166 | + need_set_size |= RESIZE_VERT;
|
---|
| 3167 | if (using_footer)
|
---|
| 3168 | fix_size = TRUE;
|
---|
| 3169 | }
|
---|
| 3170 | @@ -3330,10 +3330,11 @@
|
---|
| 3171 | prev_tearoff = using_tearoff;
|
---|
| 3172 | }
|
---|
| 3173 | #endif
|
---|
| 3174 | - if (need_set_size)
|
---|
| 3175 | + if (need_set_size != 0)
|
---|
| 3176 | {
|
---|
| 3177 | #ifdef FEAT_GUI_GTK
|
---|
| 3178 | - long c = Columns;
|
---|
| 3179 | + long prev_Columns = Columns;
|
---|
| 3180 | + long prev_Rows = Rows;
|
---|
| 3181 | #endif
|
---|
| 3182 | /* Adjust the size of the window to make the text area keep the
|
---|
| 3183 | * same size and to avoid that part of our window is off-screen
|
---|
| 3184 | @@ -3349,11 +3350,14 @@
|
---|
| 3185 | * If you remove this, please test this command for resizing
|
---|
| 3186 | * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
|
---|
| 3187 | * Don't do this while starting up though.
|
---|
| 3188 | - * And don't change Rows, it may have be reduced intentionally
|
---|
| 3189 | - * when adding menu/toolbar/tabline. */
|
---|
| 3190 | - if (!gui.starting)
|
---|
| 3191 | + * Don't change Rows when adding menu/toolbar/tabline.
|
---|
| 3192 | + * Don't change Columns when adding vertical toolbar. */
|
---|
| 3193 | + if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
|
---|
| 3194 | (void)char_avail();
|
---|
| 3195 | - Columns = c;
|
---|
| 3196 | + if ((need_set_size & RESIZE_VERT) == 0)
|
---|
| 3197 | + Rows = prev_Rows;
|
---|
| 3198 | + if ((need_set_size & RESIZE_HOR) == 0)
|
---|
| 3199 | + Columns = prev_Columns;
|
---|
| 3200 | #endif
|
---|
| 3201 | }
|
---|
| 3202 | #ifdef FEAT_WINDOWS
|
---|
| 3203 | diff -Naur vim72.orig/src/gui_gtk_x11.c vim72/src/gui_gtk_x11.c
|
---|
[54f612f] | 3204 | --- vim72.orig/src/gui_gtk_x11.c 2008-07-04 03:46:24.000000000 -0700
|
---|
[76dd250] | 3205 | +++ vim72/src/gui_gtk_x11.c 2009-02-22 21:57:40.637347115 -0800
|
---|
| 3206 | @@ -4070,14 +4070,14 @@
|
---|
| 3207 |
|
---|
| 3208 | if (mask & (XValue | YValue))
|
---|
| 3209 | {
|
---|
| 3210 | - int w, h;
|
---|
| 3211 | - gui_mch_get_screen_dimensions(&w, &h);
|
---|
| 3212 | - h += p_ghr + get_menu_tool_height();
|
---|
| 3213 | - w += get_menu_tool_width();
|
---|
| 3214 | + int ww, hh;
|
---|
| 3215 | + gui_mch_get_screen_dimensions(&ww, &hh);
|
---|
| 3216 | + hh += p_ghr + get_menu_tool_height();
|
---|
| 3217 | + ww += get_menu_tool_width();
|
---|
| 3218 | if (mask & XNegative)
|
---|
| 3219 | - x += w - pixel_width;
|
---|
| 3220 | + x += ww - pixel_width;
|
---|
| 3221 | if (mask & YNegative)
|
---|
| 3222 | - y += h - pixel_height;
|
---|
| 3223 | + y += hh - pixel_height;
|
---|
| 3224 | #ifdef HAVE_GTK2
|
---|
| 3225 | gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
|
---|
| 3226 | #else
|
---|
| 3227 | diff -Naur vim72.orig/src/gui_x11.c vim72/src/gui_x11.c
|
---|
[54f612f] | 3228 | --- vim72.orig/src/gui_x11.c 2008-06-08 08:13:45.000000000 -0700
|
---|
[76dd250] | 3229 | +++ vim72/src/gui_x11.c 2009-02-22 21:57:28.972599804 -0800
|
---|
| 3230 | @@ -2450,7 +2450,7 @@
|
---|
| 3231 | *colorPtr = colortable[closest];
|
---|
| 3232 | }
|
---|
| 3233 |
|
---|
| 3234 | - free(colortable);
|
---|
| 3235 | + vim_free(colortable);
|
---|
| 3236 | return OK;
|
---|
| 3237 | }
|
---|
| 3238 |
|
---|
| 3239 | diff -Naur vim72.orig/src/gui_xmdlg.c vim72/src/gui_xmdlg.c
|
---|
[54f612f] | 3240 | --- vim72.orig/src/gui_xmdlg.c 2008-06-21 09:05:32.000000000 -0700
|
---|
[76dd250] | 3241 | +++ vim72/src/gui_xmdlg.c 2009-02-22 21:57:40.637347115 -0800
|
---|
| 3242 | @@ -369,10 +369,10 @@
|
---|
| 3243 | char buf[TEMP_BUF_SIZE];
|
---|
| 3244 | XmString items[MAX_ENTRIES_IN_LIST];
|
---|
| 3245 | int i;
|
---|
| 3246 | - int index;
|
---|
| 3247 | + int idx;
|
---|
| 3248 |
|
---|
| 3249 | - for (index = (int)ENCODING; index < (int)NONE; ++index)
|
---|
| 3250 | - count[index] = 0;
|
---|
| 3251 | + for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
|
---|
| 3252 | + count[idx] = 0;
|
---|
| 3253 |
|
---|
| 3254 | /* First we insert the wild char into every single list. */
|
---|
| 3255 | if (fix != ENCODING)
|
---|
| 3256 | @@ -503,14 +503,14 @@
|
---|
| 3257 | /*
|
---|
| 3258 | * Now loop trough the remaining lists and set them up.
|
---|
| 3259 | */
|
---|
| 3260 | - for (index = (int)NAME; index < (int)NONE; ++index)
|
---|
| 3261 | + for (idx = (int)NAME; idx < (int)NONE; ++idx)
|
---|
| 3262 | {
|
---|
| 3263 | Widget w;
|
---|
| 3264 |
|
---|
| 3265 | - if (fix == (enum ListSpecifier)index)
|
---|
| 3266 | + if (fix == (enum ListSpecifier)idx)
|
---|
| 3267 | continue;
|
---|
| 3268 |
|
---|
| 3269 | - switch ((enum ListSpecifier)index)
|
---|
| 3270 | + switch ((enum ListSpecifier)idx)
|
---|
| 3271 | {
|
---|
| 3272 | case NAME:
|
---|
| 3273 | w = data->list[NAME];
|
---|
| 3274 | @@ -525,21 +525,21 @@
|
---|
| 3275 | w = (Widget)0; /* for lint */
|
---|
| 3276 | }
|
---|
| 3277 |
|
---|
| 3278 | - for (i = 0; i < count[index]; ++i)
|
---|
| 3279 | + for (i = 0; i < count[idx]; ++i)
|
---|
| 3280 | {
|
---|
| 3281 | - items[i] = XmStringCreateLocalized(list[index][i]);
|
---|
| 3282 | - XtFree(list[index][i]);
|
---|
| 3283 | + items[i] = XmStringCreateLocalized(list[idx][i]);
|
---|
| 3284 | + XtFree(list[idx][i]);
|
---|
| 3285 | }
|
---|
| 3286 | XmListDeleteAllItems(w);
|
---|
| 3287 | - XmListAddItems(w, items, count[index], 1);
|
---|
| 3288 | - if (data->sel[index])
|
---|
| 3289 | + XmListAddItems(w, items, count[idx], 1);
|
---|
| 3290 | + if (data->sel[idx])
|
---|
| 3291 | {
|
---|
| 3292 | XmStringFree(items[0]);
|
---|
| 3293 | - items[0] = XmStringCreateLocalized(data->sel[index]);
|
---|
| 3294 | + items[0] = XmStringCreateLocalized(data->sel[idx]);
|
---|
| 3295 | XmListSelectItem(w, items[0], False);
|
---|
| 3296 | XmListSetBottomItem(w, items[0]);
|
---|
| 3297 | }
|
---|
| 3298 | - for (i = 0; i < count[index]; ++i)
|
---|
| 3299 | + for (i = 0; i < count[idx]; ++i)
|
---|
| 3300 | XmStringFree(items[i]);
|
---|
| 3301 | }
|
---|
| 3302 | }
|
---|
| 3303 | @@ -695,14 +695,14 @@
|
---|
| 3304 | int n;
|
---|
| 3305 | XmString str;
|
---|
| 3306 | Arg args[4];
|
---|
| 3307 | - char *msg = _("no specific match");
|
---|
| 3308 | + char *nomatch_msg = _("no specific match");
|
---|
| 3309 |
|
---|
| 3310 | n = 0;
|
---|
| 3311 | - str = XmStringCreateLocalized(msg);
|
---|
| 3312 | + str = XmStringCreateLocalized(nomatch_msg);
|
---|
| 3313 | XtSetArg(args[n], XmNlabelString, str); ++n;
|
---|
| 3314 | XtSetValues(data->sample, args, n);
|
---|
| 3315 | apply_fontlist(data->sample);
|
---|
| 3316 | - XmTextSetString(data->name, msg);
|
---|
| 3317 | + XmTextSetString(data->name, nomatch_msg);
|
---|
| 3318 | XmStringFree(str);
|
---|
| 3319 |
|
---|
| 3320 | return False;
|
---|
| 3321 | @@ -886,21 +886,21 @@
|
---|
| 3322 | {
|
---|
| 3323 | int i;
|
---|
| 3324 | int max;
|
---|
| 3325 | - int index = 0;
|
---|
| 3326 | + int idx = 0;
|
---|
| 3327 | int size;
|
---|
| 3328 | - char str[128];
|
---|
| 3329 | + char buf[128];
|
---|
| 3330 |
|
---|
| 3331 | for (i = 0, max = 0; i < data->num; i++)
|
---|
| 3332 | {
|
---|
| 3333 | - get_part(fn(data, i), 7, str);
|
---|
| 3334 | - size = atoi(str);
|
---|
| 3335 | + get_part(fn(data, i), 7, buf);
|
---|
| 3336 | + size = atoi(buf);
|
---|
| 3337 | if ((size > max) && (size < MAX_DISPLAY_SIZE))
|
---|
| 3338 | {
|
---|
| 3339 | - index = i;
|
---|
| 3340 | + idx = i;
|
---|
| 3341 | max = size;
|
---|
| 3342 | }
|
---|
| 3343 | }
|
---|
| 3344 | - strcpy(big_font, fn(data, index));
|
---|
| 3345 | + strcpy(big_font, fn(data, idx));
|
---|
| 3346 | }
|
---|
| 3347 | data->old = XLoadQueryFont(XtDisplay(parent), big_font);
|
---|
| 3348 | data->old_list = gui_motif_create_fontlist(data->old);
|
---|
| 3349 | @@ -1217,28 +1217,28 @@
|
---|
| 3350 |
|
---|
| 3351 | if (i != 0)
|
---|
| 3352 | {
|
---|
| 3353 | - char name[TEMP_BUF_SIZE];
|
---|
| 3354 | - char style[TEMP_BUF_SIZE];
|
---|
| 3355 | - char size[TEMP_BUF_SIZE];
|
---|
| 3356 | - char encoding[TEMP_BUF_SIZE];
|
---|
| 3357 | + char namebuf[TEMP_BUF_SIZE];
|
---|
| 3358 | + char stylebuf[TEMP_BUF_SIZE];
|
---|
| 3359 | + char sizebuf[TEMP_BUF_SIZE];
|
---|
| 3360 | + char encodingbuf[TEMP_BUF_SIZE];
|
---|
| 3361 | char *found;
|
---|
| 3362 |
|
---|
| 3363 | found = names[0];
|
---|
| 3364 |
|
---|
| 3365 | - name_part(found, name);
|
---|
| 3366 | - style_part(found, style);
|
---|
| 3367 | - size_part(found, size, data->in_pixels);
|
---|
| 3368 | - encoding_part(found, encoding);
|
---|
| 3369 | -
|
---|
| 3370 | - if (strlen(name) > 0
|
---|
| 3371 | - && strlen(style) > 0
|
---|
| 3372 | - && strlen(size) > 0
|
---|
| 3373 | - && strlen(encoding) > 0)
|
---|
| 3374 | + name_part(found, namebuf);
|
---|
| 3375 | + style_part(found, stylebuf);
|
---|
| 3376 | + size_part(found, sizebuf, data->in_pixels);
|
---|
| 3377 | + encoding_part(found, encodingbuf);
|
---|
| 3378 | +
|
---|
| 3379 | + if (strlen(namebuf) > 0
|
---|
| 3380 | + && strlen(stylebuf) > 0
|
---|
| 3381 | + && strlen(sizebuf) > 0
|
---|
| 3382 | + && strlen(encodingbuf) > 0)
|
---|
| 3383 | {
|
---|
| 3384 | - data->sel[NAME] = XtNewString(name);
|
---|
| 3385 | - data->sel[STYLE] = XtNewString(style);
|
---|
| 3386 | - data->sel[SIZE] = XtNewString(size);
|
---|
| 3387 | - data->sel[ENCODING] = XtNewString(encoding);
|
---|
| 3388 | + data->sel[NAME] = XtNewString(namebuf);
|
---|
| 3389 | + data->sel[STYLE] = XtNewString(stylebuf);
|
---|
| 3390 | + data->sel[SIZE] = XtNewString(sizebuf);
|
---|
| 3391 | + data->sel[ENCODING] = XtNewString(encodingbuf);
|
---|
| 3392 | data->font_name = XtNewString(names[0]);
|
---|
| 3393 | display_sample(data);
|
---|
| 3394 | XmTextSetString(data->name, data->font_name);
|
---|
| 3395 | diff -Naur vim72.orig/src/gui_xmebw.c vim72/src/gui_xmebw.c
|
---|
[54f612f] | 3396 | --- vim72.orig/src/gui_xmebw.c 2007-09-06 03:57:51.000000000 -0700
|
---|
[76dd250] | 3397 | +++ vim72/src/gui_xmebw.c 2009-02-22 21:57:40.637347115 -0800
|
---|
| 3398 | @@ -1256,7 +1256,7 @@
|
---|
| 3399 | }
|
---|
| 3400 | else
|
---|
| 3401 | {
|
---|
| 3402 | - int adjust = 0;
|
---|
| 3403 | + adjust = 0;
|
---|
| 3404 |
|
---|
| 3405 | #if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
|
---|
| 3406 | /*
|
---|
| 3407 | @@ -1268,12 +1268,11 @@
|
---|
| 3408 | {
|
---|
| 3409 | case XmEXTERNAL_HIGHLIGHT:
|
---|
| 3410 | adjust = (eb->primitive.highlight_thickness -
|
---|
| 3411 | - (eb->pushbutton.default_button_shadow_thickness ?
|
---|
| 3412 | - Xm3D_ENHANCE_PIXEL : 0));
|
---|
| 3413 | + (eb->pushbutton.default_button_shadow_thickness
|
---|
| 3414 | + ? Xm3D_ENHANCE_PIXEL : 0));
|
---|
| 3415 | break;
|
---|
| 3416 |
|
---|
| 3417 | case XmINTERNAL_HIGHLIGHT:
|
---|
| 3418 | - adjust = 0;
|
---|
| 3419 | break;
|
---|
| 3420 |
|
---|
| 3421 | default:
|
---|
| 3422 | diff -Naur vim72.orig/src/if_cscope.c vim72/src/if_cscope.c
|
---|
[54f612f] | 3423 | --- vim72.orig/src/if_cscope.c 2008-06-24 09:32:34.000000000 -0700
|
---|
[76dd250] | 3424 | +++ vim72/src/if_cscope.c 2009-02-22 21:57:57.086400893 -0800
|
---|
| 3425 | @@ -74,7 +74,7 @@
|
---|
| 3426 | { "add", cs_add,
|
---|
| 3427 | N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 },
|
---|
| 3428 | { "find", cs_find,
|
---|
| 3429 | - N_("Query for a pattern"), FIND_USAGE, 1 },
|
---|
| 3430 | + N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 },
|
---|
| 3431 | { "help", cs_help,
|
---|
| 3432 | N_("Show this message"), "help", 0 },
|
---|
[5f4a45c9] | 3433 | { "kill", cs_kill,
|
---|
| 3434 | @@ -1177,10 +1177,27 @@
|
---|
| 3435 | (void)MSG_PUTS(_("cscope commands:\n"));
|
---|
| 3436 | while (cmdp->name != NULL)
|
---|
| 3437 | {
|
---|
| 3438 | - (void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
|
---|
| 3439 | - cmdp->name, _(cmdp->help), cmdp->usage);
|
---|
| 3440 | + char *help = _(cmdp->help);
|
---|
| 3441 | + int space_cnt = 30 - vim_strsize((char_u *)help);
|
---|
| 3442 | +
|
---|
| 3443 | + /* Use %*s rather than %30s to ensure proper alignment in utf-8 */
|
---|
| 3444 | + if (space_cnt < 0)
|
---|
| 3445 | + space_cnt = 0;
|
---|
| 3446 | + (void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"),
|
---|
| 3447 | + cmdp->name,
|
---|
| 3448 | + help, space_cnt, " ",
|
---|
[76dd250] | 3449 | + cmdp->usage);
|
---|
| 3450 | if (strcmp(cmdp->name, "find") == 0)
|
---|
| 3451 | - MSG_PUTS(FIND_HELP);
|
---|
| 3452 | + MSG_PUTS(_("\n"
|
---|
| 3453 | + " c: Find functions calling this function\n"
|
---|
| 3454 | + " d: Find functions called by this function\n"
|
---|
| 3455 | + " e: Find this egrep pattern\n"
|
---|
| 3456 | + " f: Find this file\n"
|
---|
| 3457 | + " g: Find this definition\n"
|
---|
| 3458 | + " i: Find files #including this file\n"
|
---|
| 3459 | + " s: Find this C symbol\n"
|
---|
| 3460 | + " t: Find assignments to\n"));
|
---|
| 3461 | +
|
---|
| 3462 | cmdp++;
|
---|
| 3463 | }
|
---|
| 3464 |
|
---|
| 3465 | diff -Naur vim72.orig/src/if_cscope.h vim72/src/if_cscope.h
|
---|
[54f612f] | 3466 | --- vim72.orig/src/if_cscope.h 2007-09-02 07:51:08.000000000 -0700
|
---|
[76dd250] | 3467 | +++ vim72/src/if_cscope.h 2009-02-22 21:57:25.644386646 -0800
|
---|
| 3468 | @@ -42,17 +42,6 @@
|
---|
| 3469 | * f 7name Find this file
|
---|
| 3470 | * i 8name Find files #including this file
|
---|
| 3471 | */
|
---|
| 3472 | -#define FIND_USAGE "find c|d|e|f|g|i|s|t name"
|
---|
| 3473 | -#define FIND_HELP "\n\
|
---|
| 3474 | - c: Find functions calling this function\n\
|
---|
| 3475 | - d: Find functions called by this function\n\
|
---|
| 3476 | - e: Find this egrep pattern\n\
|
---|
| 3477 | - f: Find this file\n\
|
---|
| 3478 | - g: Find this definition\n\
|
---|
| 3479 | - i: Find files #including this file\n\
|
---|
| 3480 | - s: Find this C symbol\n\
|
---|
| 3481 | - t: Find assignments to\n"
|
---|
| 3482 | -
|
---|
| 3483 |
|
---|
| 3484 | typedef struct {
|
---|
| 3485 | char * name;
|
---|
| 3486 | diff -Naur vim72.orig/src/if_perl.xs vim72/src/if_perl.xs
|
---|
[54f612f] | 3487 | --- vim72.orig/src/if_perl.xs 2008-07-17 13:55:09.000000000 -0700
|
---|
[76dd250] | 3488 | +++ vim72/src/if_perl.xs 2009-02-22 21:57:40.757353820 -0800
|
---|
| 3489 | @@ -136,6 +136,9 @@
|
---|
| 3490 | # define Perl_newXS_flags dll_Perl_newXS_flags
|
---|
| 3491 | #endif
|
---|
| 3492 | # define Perl_sv_free dll_Perl_sv_free
|
---|
| 3493 | +# if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
|
---|
| 3494 | +# define Perl_sv_free2 dll_Perl_sv_free2
|
---|
| 3495 | +# endif
|
---|
| 3496 | # define Perl_sv_isa dll_Perl_sv_isa
|
---|
| 3497 | # define Perl_sv_magic dll_Perl_sv_magic
|
---|
| 3498 | # define Perl_sv_setiv dll_Perl_sv_setiv
|
---|
| 3499 | @@ -163,7 +166,7 @@
|
---|
| 3500 | # define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr
|
---|
| 3501 | # define boot_DynaLoader dll_boot_DynaLoader
|
---|
| 3502 |
|
---|
| 3503 | -# define Perl_sys_init3 dll_Perl_sys_init3
|
---|
| 3504 | +# define Perl_sys_init dll_Perl_sys_init
|
---|
| 3505 | # define Perl_sys_term dll_Perl_sys_term
|
---|
| 3506 | # define Perl_ISv_ptr dll_Perl_ISv_ptr
|
---|
| 3507 | # define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr
|
---|
| 3508 | @@ -268,7 +271,8 @@
|
---|
| 3509 | static void (*boot_DynaLoader)_((pTHX_ CV*));
|
---|
| 3510 |
|
---|
| 3511 | #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
|
---|
| 3512 | -static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
|
---|
| 3513 | +static void (*Perl_sv_free2)(pTHX_ SV*);
|
---|
| 3514 | +static void (*Perl_sys_init)(int* argc, char*** argv);
|
---|
| 3515 | static void (*Perl_sys_term)(void);
|
---|
| 3516 | static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
|
---|
| 3517 | static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*);
|
---|
| 3518 | @@ -367,7 +371,8 @@
|
---|
| 3519 | {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr},
|
---|
| 3520 | {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
|
---|
| 3521 | #else
|
---|
| 3522 | - {"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
|
---|
| 3523 | + {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
|
---|
| 3524 | + {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init},
|
---|
| 3525 | {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
|
---|
| 3526 | {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
|
---|
| 3527 | {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr},
|
---|
| 3528 | @@ -455,7 +460,7 @@
|
---|
| 3529 | static char *argv[] = { "", "-e", "" };
|
---|
| 3530 |
|
---|
| 3531 | #if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
|
---|
| 3532 | - Perl_sys_init3(&argc, (char***)&argv, NULL);
|
---|
| 3533 | + Perl_sys_init(&argc, (char***)&argv);
|
---|
| 3534 | #endif
|
---|
| 3535 | perl_interp = perl_alloc();
|
---|
| 3536 | perl_construct(perl_interp);
|
---|
| 3537 | diff -Naur vim72.orig/src/if_python.c vim72/src/if_python.c
|
---|
[54f612f] | 3538 | --- vim72.orig/src/if_python.c 2008-07-17 14:09:32.000000000 -0700
|
---|
[76dd250] | 3539 | +++ vim72/src/if_python.c 2009-02-22 21:57:51.746058667 -0800
|
---|
| 3540 | @@ -531,6 +531,12 @@
|
---|
| 3541 | if (PythonMod_Init())
|
---|
| 3542 | goto fail;
|
---|
| 3543 |
|
---|
| 3544 | + /* Remove the element from sys.path that was added because of our
|
---|
| 3545 | + * argv[0] value in PythonMod_Init(). Previously we used an empty
|
---|
| 3546 | + * string, but dependinding on the OS we then get an empty entry or
|
---|
| 3547 | + * the current directory in sys.path. */
|
---|
| 3548 | + PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
|
---|
| 3549 | +
|
---|
| 3550 | /* the first python thread is vim's, release the lock */
|
---|
| 3551 | Python_SaveThread();
|
---|
[7352c10] | 3552 |
|
---|
| 3553 | @@ -1145,14 +1151,23 @@
|
---|
| 3554 |
|
---|
| 3555 | /* Check if we run into a recursive loop. The item must be in lookupDict
|
---|
| 3556 | * then and we can use it again. */
|
---|
| 3557 | - sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv);
|
---|
| 3558 | - result = PyDict_GetItemString(lookupDict, ptrBuf);
|
---|
| 3559 | - if (result != NULL)
|
---|
| 3560 | - Py_INCREF(result);
|
---|
| 3561 | - else if (our_tv->v_type == VAR_STRING)
|
---|
| 3562 | + if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
|
---|
| 3563 | + || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
|
---|
| 3564 | + {
|
---|
| 3565 | + sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U,
|
---|
| 3566 | + our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list
|
---|
| 3567 | + : (long_u)our_tv->vval.v_dict);
|
---|
| 3568 | + result = PyDict_GetItemString(lookupDict, ptrBuf);
|
---|
| 3569 | + if (result != NULL)
|
---|
| 3570 | + {
|
---|
| 3571 | + Py_INCREF(result);
|
---|
| 3572 | + return result;
|
---|
| 3573 | + }
|
---|
| 3574 | + }
|
---|
| 3575 | +
|
---|
| 3576 | + if (our_tv->v_type == VAR_STRING)
|
---|
| 3577 | {
|
---|
| 3578 | result = Py_BuildValue("s", our_tv->vval.v_string);
|
---|
| 3579 | - PyDict_SetItemString(lookupDict, ptrBuf, result);
|
---|
| 3580 | }
|
---|
| 3581 | else if (our_tv->v_type == VAR_NUMBER)
|
---|
| 3582 | {
|
---|
| 3583 | @@ -1161,7 +1176,6 @@
|
---|
| 3584 | /* For backwards compatibility numbers are stored as strings. */
|
---|
| 3585 | sprintf(buf, "%ld", (long)our_tv->vval.v_number);
|
---|
| 3586 | result = Py_BuildValue("s", buf);
|
---|
| 3587 | - PyDict_SetItemString(lookupDict, ptrBuf, result);
|
---|
| 3588 | }
|
---|
| 3589 | # ifdef FEAT_FLOAT
|
---|
| 3590 | else if (our_tv->v_type == VAR_FLOAT)
|
---|
| 3591 | @@ -1170,7 +1184,6 @@
|
---|
| 3592 |
|
---|
| 3593 | sprintf(buf, "%f", our_tv->vval.v_float);
|
---|
| 3594 | result = Py_BuildValue("s", buf);
|
---|
| 3595 | - PyDict_SetItemString(lookupDict, ptrBuf, result);
|
---|
| 3596 | }
|
---|
| 3597 | # endif
|
---|
| 3598 | else if (our_tv->v_type == VAR_LIST)
|
---|
| 3599 | @@ -1179,10 +1192,11 @@
|
---|
| 3600 | listitem_T *curr;
|
---|
| 3601 |
|
---|
| 3602 | result = PyList_New(0);
|
---|
| 3603 | - PyDict_SetItemString(lookupDict, ptrBuf, result);
|
---|
| 3604 |
|
---|
| 3605 | if (list != NULL)
|
---|
| 3606 | {
|
---|
| 3607 | + PyDict_SetItemString(lookupDict, ptrBuf, result);
|
---|
| 3608 | +
|
---|
| 3609 | for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
|
---|
| 3610 | {
|
---|
| 3611 | newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
|
---|
| 3612 | @@ -1194,7 +1208,6 @@
|
---|
| 3613 | else if (our_tv->v_type == VAR_DICT)
|
---|
| 3614 | {
|
---|
| 3615 | result = PyDict_New();
|
---|
| 3616 | - PyDict_SetItemString(lookupDict, ptrBuf, result);
|
---|
| 3617 |
|
---|
| 3618 | if (our_tv->vval.v_dict != NULL)
|
---|
| 3619 | {
|
---|
| 3620 | @@ -1203,6 +1216,8 @@
|
---|
| 3621 | hashitem_T *hi;
|
---|
| 3622 | dictitem_T *di;
|
---|
| 3623 |
|
---|
| 3624 | + PyDict_SetItemString(lookupDict, ptrBuf, result);
|
---|
| 3625 | +
|
---|
| 3626 | for (hi = ht->ht_array; todo > 0; ++hi)
|
---|
| 3627 | {
|
---|
| 3628 | if (!HASHITEM_EMPTY(hi))
|
---|
[76dd250] | 3629 | @@ -2345,7 +2360,8 @@
|
---|
| 3630 | {
|
---|
| 3631 | PyObject *mod;
|
---|
| 3632 | PyObject *dict;
|
---|
| 3633 | - static char *(argv[2]) = {"", NULL};
|
---|
| 3634 | + /* The special value is removed from sys.path in Python_Init(). */
|
---|
| 3635 | + static char *(argv[2]) = {"/must>not&exist/foo", NULL};
|
---|
| 3636 |
|
---|
| 3637 | /* Fixups... */
|
---|
| 3638 | BufferType.ob_type = &PyType_Type;
|
---|
| 3639 | diff -Naur vim72.orig/src/if_xcmdsrv.c vim72/src/if_xcmdsrv.c
|
---|
[54f612f] | 3640 | --- vim72.orig/src/if_xcmdsrv.c 2008-07-18 06:05:03.000000000 -0700
|
---|
[76dd250] | 3641 | +++ vim72/src/if_xcmdsrv.c 2009-02-22 21:57:32.260810448 -0800
|
---|
| 3642 | @@ -736,7 +736,7 @@
|
---|
| 3643 | + serverReply.ga_len;
|
---|
| 3644 | e.id = w;
|
---|
| 3645 | ga_init2(&e.strings, 1, 100);
|
---|
| 3646 | - memcpy(p, &e, sizeof(e));
|
---|
| 3647 | + mch_memmove(p, &e, sizeof(e));
|
---|
| 3648 | serverReply.ga_len++;
|
---|
| 3649 | }
|
---|
| 3650 | }
|
---|
| 3651 | @@ -1018,7 +1018,7 @@
|
---|
| 3652 | p++;
|
---|
| 3653 | count = numItems - (p - regProp);
|
---|
| 3654 | if (count > 0)
|
---|
| 3655 | - memcpy(entry, p, count);
|
---|
| 3656 | + mch_memmove(entry, p, count);
|
---|
| 3657 | XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
|
---|
| 3658 | 8, PropModeReplace, regProp,
|
---|
| 3659 | (int)(numItems - (p - entry)));
|
---|
| 3660 | @@ -1072,7 +1072,7 @@
|
---|
| 3661 | p++;
|
---|
| 3662 | lastHalf = numItems - (p - regProp);
|
---|
| 3663 | if (lastHalf > 0)
|
---|
| 3664 | - memcpy(entry, p, lastHalf);
|
---|
| 3665 | + mch_memmove(entry, p, lastHalf);
|
---|
| 3666 | numItems = (entry - regProp) + lastHalf;
|
---|
| 3667 | p = entry;
|
---|
[54f612f] | 3668 | continue;
|
---|
| 3669 | diff -Naur vim72.orig/src/macros.h vim72/src/macros.h
|
---|
| 3670 | --- vim72.orig/src/macros.h 2007-08-04 04:44:18.000000000 -0700
|
---|
| 3671 | +++ vim72/src/macros.h 2009-02-22 21:58:02.962778041 -0800
|
---|
| 3672 | @@ -127,15 +127,31 @@
|
---|
| 3673 | #ifdef FEAT_LANGMAP
|
---|
| 3674 | /*
|
---|
| 3675 | * Adjust chars in a language according to 'langmap' option.
|
---|
| 3676 | - * NOTE that there is NO overhead if 'langmap' is not set; but even
|
---|
| 3677 | - * when set we only have to do 2 ifs and an array lookup.
|
---|
| 3678 | + * NOTE that there is no noticeable overhead if 'langmap' is not set.
|
---|
| 3679 | + * When set the overhead for characters < 256 is small.
|
---|
| 3680 | * Don't apply 'langmap' if the character comes from the Stuff buffer.
|
---|
| 3681 | * The do-while is just to ignore a ';' after the macro.
|
---|
| 3682 | */
|
---|
| 3683 | -# define LANGMAP_ADJUST(c, condition) do { \
|
---|
| 3684 | - if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
|
---|
| 3685 | - c = langmap_mapchar[c]; \
|
---|
| 3686 | +# ifdef FEAT_MBYTE
|
---|
| 3687 | +# define LANGMAP_ADJUST(c, condition) \
|
---|
| 3688 | + do { \
|
---|
| 3689 | + if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \
|
---|
| 3690 | + { \
|
---|
| 3691 | + if ((c) < 256) \
|
---|
| 3692 | + c = langmap_mapchar[c]; \
|
---|
| 3693 | + else \
|
---|
| 3694 | + c = langmap_adjust_mb(c); \
|
---|
| 3695 | + } \
|
---|
| 3696 | } while (0)
|
---|
| 3697 | +# else
|
---|
| 3698 | +# define LANGMAP_ADJUST(c, condition) \
|
---|
| 3699 | + do { \
|
---|
| 3700 | + if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
|
---|
| 3701 | + c = langmap_mapchar[c]; \
|
---|
| 3702 | + } while (0)
|
---|
| 3703 | +# endif
|
---|
| 3704 | +#else
|
---|
| 3705 | +# define LANGMAP_ADJUST(c, condition) /* nop */
|
---|
| 3706 | #endif
|
---|
| 3707 |
|
---|
[76dd250] | 3708 | /*
|
---|
| 3709 | diff -Naur vim72.orig/src/main.c vim72/src/main.c
|
---|
[54f612f] | 3710 | --- vim72.orig/src/main.c 2008-07-24 01:40:56.000000000 -0700
|
---|
[76dd250] | 3711 | +++ vim72/src/main.c 2009-02-22 21:57:40.641347674 -0800
|
---|
| 3712 | @@ -645,11 +645,12 @@
|
---|
| 3713 |
|
---|
| 3714 | #ifdef FEAT_VIMINFO
|
---|
| 3715 | /*
|
---|
| 3716 | - * Read in registers, history etc, but not marks, from the viminfo file
|
---|
| 3717 | + * Read in registers, history etc, but not marks, from the viminfo file.
|
---|
| 3718 | + * This is where v:oldfiles gets filled.
|
---|
| 3719 | */
|
---|
| 3720 | if (*p_viminfo != NUL)
|
---|
| 3721 | {
|
---|
| 3722 | - read_viminfo(NULL, TRUE, FALSE, FALSE);
|
---|
| 3723 | + read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
|
---|
| 3724 | TIME_MSG("reading viminfo");
|
---|
| 3725 | }
|
---|
| 3726 | #endif
|
---|
| 3727 | @@ -1457,7 +1458,8 @@
|
---|
| 3728 | ++initstr;
|
---|
| 3729 | }
|
---|
| 3730 |
|
---|
| 3731 | - if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k')
|
---|
| 3732 | + /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */
|
---|
| 3733 | + if (TOLOWER_ASC(initstr[0]) == 'g')
|
---|
| 3734 | {
|
---|
| 3735 | main_start_gui();
|
---|
| 3736 | #ifdef FEAT_GUI
|
---|
| 3737 | @@ -1508,7 +1510,8 @@
|
---|
| 3738 | early_arg_scan(parmp)
|
---|
| 3739 | mparm_T *parmp;
|
---|
| 3740 | {
|
---|
| 3741 | -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER)
|
---|
| 3742 | +#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
|
---|
| 3743 | + || !defined(FEAT_NETBEANS_INTG)
|
---|
| 3744 | int argc = parmp->argc;
|
---|
| 3745 | char **argv = parmp->argv;
|
---|
| 3746 | int i;
|
---|
| 3747 | @@ -1580,6 +1583,14 @@
|
---|
| 3748 | else if (STRICMP(argv[i], "--echo-wid") == 0)
|
---|
| 3749 | echo_wid_arg = TRUE;
|
---|
| 3750 | # endif
|
---|
| 3751 | +# ifndef FEAT_NETBEANS_INTG
|
---|
| 3752 | + else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
|
---|
| 3753 | + {
|
---|
| 3754 | + mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
|
---|
| 3755 | + mch_exit(2);
|
---|
| 3756 | + }
|
---|
| 3757 | +# endif
|
---|
| 3758 | +
|
---|
| 3759 | }
|
---|
| 3760 | #endif
|
---|
| 3761 | }
|
---|
| 3762 | @@ -2361,7 +2372,7 @@
|
---|
| 3763 | * Is there any other system that cannot do this?
|
---|
| 3764 | */
|
---|
| 3765 | close(0);
|
---|
| 3766 | - dup(2);
|
---|
| 3767 | + ignored = dup(2);
|
---|
| 3768 | #endif
|
---|
| 3769 | }
|
---|
| 3770 |
|
---|
| 3771 | diff -Naur vim72.orig/src/mark.c vim72/src/mark.c
|
---|
[54f612f] | 3772 | --- vim72.orig/src/mark.c 2008-08-08 15:06:49.000000000 -0700
|
---|
[76dd250] | 3773 | +++ vim72/src/mark.c 2009-02-22 21:57:28.912593658 -0800
|
---|
| 3774 | @@ -1627,15 +1627,17 @@
|
---|
| 3775 |
|
---|
| 3776 | /*
|
---|
| 3777 | * Handle marks in the viminfo file:
|
---|
| 3778 | - * fp_out == NULL read marks for current buffer only
|
---|
| 3779 | - * fp_out != NULL copy marks for buffers not in buffer list
|
---|
| 3780 | + * fp_out != NULL: copy marks for buffers not in buffer list
|
---|
| 3781 | + * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
|
---|
| 3782 | + * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
|
---|
| 3783 | */
|
---|
| 3784 | void
|
---|
| 3785 | -copy_viminfo_marks(virp, fp_out, count, eof)
|
---|
| 3786 | +copy_viminfo_marks(virp, fp_out, count, eof, flags)
|
---|
| 3787 | vir_T *virp;
|
---|
| 3788 | FILE *fp_out;
|
---|
| 3789 | int count;
|
---|
| 3790 | int eof;
|
---|
| 3791 | + int flags;
|
---|
| 3792 | {
|
---|
| 3793 | char_u *line = virp->vir_line;
|
---|
| 3794 | buf_T *buf;
|
---|
| 3795 | @@ -1647,10 +1649,23 @@
|
---|
| 3796 | char_u *p;
|
---|
| 3797 | char_u *name_buf;
|
---|
| 3798 | pos_T pos;
|
---|
| 3799 | +#ifdef FEAT_EVAL
|
---|
| 3800 | + list_T *list = NULL;
|
---|
| 3801 | +#endif
|
---|
| 3802 |
|
---|
| 3803 | if ((name_buf = alloc(LSIZE)) == NULL)
|
---|
| 3804 | return;
|
---|
| 3805 | *name_buf = NUL;
|
---|
| 3806 | +
|
---|
| 3807 | +#ifdef FEAT_EVAL
|
---|
| 3808 | + if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT)))
|
---|
| 3809 | + {
|
---|
| 3810 | + list = list_alloc();
|
---|
| 3811 | + if (list != NULL)
|
---|
| 3812 | + set_vim_var_list(VV_OLDFILES, list);
|
---|
| 3813 | + }
|
---|
| 3814 | +#endif
|
---|
| 3815 | +
|
---|
| 3816 | num_marked_files = get_viminfo_parameter('\'');
|
---|
| 3817 | while (!eof && (count < num_marked_files || fp_out == NULL))
|
---|
| 3818 | {
|
---|
| 3819 | @@ -1681,6 +1696,11 @@
|
---|
| 3820 | p++;
|
---|
| 3821 | *p = NUL;
|
---|
| 3822 |
|
---|
| 3823 | +#ifdef FEAT_EVAL
|
---|
| 3824 | + if (list != NULL)
|
---|
| 3825 | + list_append_string(list, str, -1);
|
---|
| 3826 | +#endif
|
---|
| 3827 | +
|
---|
| 3828 | /*
|
---|
| 3829 | * If fp_out == NULL, load marks for current buffer.
|
---|
| 3830 | * If fp_out != NULL, copy marks for buffers not in buflist.
|
---|
| 3831 | @@ -1688,7 +1708,7 @@
|
---|
| 3832 | load_marks = copy_marks_out = FALSE;
|
---|
| 3833 | if (fp_out == NULL)
|
---|
| 3834 | {
|
---|
| 3835 | - if (curbuf->b_ffname != NULL)
|
---|
| 3836 | + if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL)
|
---|
| 3837 | {
|
---|
| 3838 | if (*name_buf == NUL) /* only need to do this once */
|
---|
| 3839 | home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE);
|
---|
| 3840 | diff -Naur vim72.orig/src/mbyte.c vim72/src/mbyte.c
|
---|
[54f612f] | 3841 | --- vim72.orig/src/mbyte.c 2008-07-14 05:38:05.000000000 -0700
|
---|
[76dd250] | 3842 | +++ vim72/src/mbyte.c 2009-02-22 21:57:40.641347674 -0800
|
---|
| 3843 | @@ -717,7 +717,7 @@
|
---|
| 3844 | * where mblen() returns 0 for invalid character.
|
---|
| 3845 | * Therefore, following condition includes 0.
|
---|
| 3846 | */
|
---|
| 3847 | - (void)mblen(NULL, 0); /* First reset the state. */
|
---|
| 3848 | + ignored = mblen(NULL, 0); /* First reset the state. */
|
---|
| 3849 | if (mblen(buf, (size_t)1) <= 0)
|
---|
| 3850 | n = 2;
|
---|
| 3851 | else
|
---|
| 3852 | @@ -2540,7 +2540,6 @@
|
---|
| 3853 | return (int)(p - q);
|
---|
| 3854 | }
|
---|
| 3855 |
|
---|
| 3856 | -#if defined(FEAT_EVAL) || defined(PROTO)
|
---|
| 3857 | /*
|
---|
| 3858 | * Copy a character from "*fp" to "*tp" and advance the pointers.
|
---|
| 3859 | */
|
---|
| 3860 | @@ -2555,7 +2554,6 @@
|
---|
| 3861 | *tp += l;
|
---|
| 3862 | *fp += l;
|
---|
| 3863 | }
|
---|
| 3864 | -#endif
|
---|
| 3865 |
|
---|
| 3866 | /*
|
---|
| 3867 | * Return the offset from "p" to the first byte of a character. When "p" is
|
---|
| 3868 | @@ -3133,7 +3131,7 @@
|
---|
| 3869 | else
|
---|
| 3870 | s = p + 1;
|
---|
| 3871 | }
|
---|
| 3872 | - for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i)
|
---|
| 3873 | + for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i)
|
---|
| 3874 | {
|
---|
| 3875 | if (s[i] == '_' || s[i] == '-')
|
---|
| 3876 | buf[i] = '-';
|
---|
| 3877 | @@ -5280,7 +5278,7 @@
|
---|
| 3878 |
|
---|
| 3879 | /*ARGSUSED*/
|
---|
| 3880 | static void
|
---|
| 3881 | -preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
|
---|
| 3882 | +preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
|
---|
| 3883 | {
|
---|
| 3884 | #ifdef XIM_DEBUG
|
---|
| 3885 | xim_log("xim_decide_input_style()\n");
|
---|
| 3886 | @@ -5314,7 +5312,7 @@
|
---|
| 3887 |
|
---|
| 3888 | /*ARGSUSED*/
|
---|
| 3889 | static void
|
---|
| 3890 | -preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
|
---|
| 3891 | +preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
|
---|
| 3892 | {
|
---|
| 3893 | XIMPreeditDrawCallbackStruct *draw_data;
|
---|
| 3894 | XIMText *text;
|
---|
| 3895 | @@ -5386,7 +5384,7 @@
|
---|
| 3896 | draw_feedback = (char *)alloc(draw_data->chg_first
|
---|
| 3897 | + text->length);
|
---|
| 3898 | else
|
---|
| 3899 | - draw_feedback = realloc(draw_feedback,
|
---|
| 3900 | + draw_feedback = vim_realloc(draw_feedback,
|
---|
| 3901 | draw_data->chg_first + text->length);
|
---|
| 3902 | if (draw_feedback != NULL)
|
---|
| 3903 | {
|
---|
| 3904 | @@ -5455,7 +5453,7 @@
|
---|
| 3905 |
|
---|
| 3906 | /*ARGSUSED*/
|
---|
| 3907 | static void
|
---|
| 3908 | -preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
|
---|
| 3909 | +preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
|
---|
| 3910 | {
|
---|
| 3911 | #ifdef XIM_DEBUG
|
---|
| 3912 | xim_log("preedit_caret_cbproc()\n");
|
---|
| 3913 | @@ -5464,7 +5462,7 @@
|
---|
| 3914 |
|
---|
| 3915 | /*ARGSUSED*/
|
---|
| 3916 | static void
|
---|
| 3917 | -preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
|
---|
| 3918 | +preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
|
---|
| 3919 | {
|
---|
| 3920 | #ifdef XIM_DEBUG
|
---|
| 3921 | xim_log("preedit_done_cbproc()\n");
|
---|
| 3922 | diff -Naur vim72.orig/src/menu.c vim72/src/menu.c
|
---|
[54f612f] | 3923 | --- vim72.orig/src/menu.c 2008-06-21 12:53:43.000000000 -0700
|
---|
[76dd250] | 3924 | +++ vim72/src/menu.c 2009-02-22 21:57:25.620383014 -0800
|
---|
| 3925 | @@ -1120,6 +1120,7 @@
|
---|
| 3926 | parent = menu;
|
---|
| 3927 | menu = menu->children;
|
---|
| 3928 | }
|
---|
| 3929 | + vim_free(path_name);
|
---|
| 3930 |
|
---|
| 3931 | /* Now we have found the matching menu, and we list the mappings */
|
---|
| 3932 | /* Highlight title */
|
---|
| 3933 | diff -Naur vim72.orig/src/message.c vim72/src/message.c
|
---|
[54f612f] | 3934 | --- vim72.orig/src/message.c 2008-07-09 11:24:55.000000000 -0700
|
---|
| 3935 | +++ vim72/src/message.c 2009-02-22 21:58:03.062784187 -0800
|
---|
| 3936 | @@ -976,7 +976,7 @@
|
---|
| 3937 | }
|
---|
| 3938 | }
|
---|
| 3939 | else if (msg_scrolled > Rows - 2
|
---|
| 3940 | - && (c == 'j' || c == K_DOWN || c == 'd'))
|
---|
| 3941 | + && (c == 'j' || c == K_DOWN || c == 'd' || c == 'f'))
|
---|
| 3942 | c = K_IGNORE;
|
---|
| 3943 | }
|
---|
| 3944 | } while ((had_got_int && c == Ctrl_C)
|
---|
| 3945 | @@ -2504,7 +2504,6 @@
|
---|
| 3946 | break;
|
---|
| 3947 |
|
---|
| 3948 | case 'u': /* Up half a page */
|
---|
| 3949 | - case K_PAGEUP:
|
---|
| 3950 | scroll = -(Rows / 2);
|
---|
| 3951 | break;
|
---|
| 3952 |
|
---|
| 3953 | @@ -2513,10 +2512,12 @@
|
---|
| 3954 | break;
|
---|
| 3955 |
|
---|
| 3956 | case 'b': /* one page back */
|
---|
| 3957 | + case K_PAGEUP:
|
---|
| 3958 | scroll = -(Rows - 1);
|
---|
| 3959 | break;
|
---|
| 3960 |
|
---|
| 3961 | case ' ': /* one extra page */
|
---|
| 3962 | + case 'f':
|
---|
| 3963 | case K_PAGEDOWN:
|
---|
| 3964 | case K_LEFTMOUSE:
|
---|
| 3965 | scroll = Rows - 1;
|
---|
[61a83e8] | 3966 | @@ -3309,7 +3310,10 @@
|
---|
| 3967 | {
|
---|
| 3968 | c = gui_mch_dialog(type, title, message, buttons, dfltbutton,
|
---|
| 3969 | textfield);
|
---|
| 3970 | - msg_end_prompt();
|
---|
| 3971 | + /* avoid a hit-enter prompt without clearing the cmdline */
|
---|
| 3972 | + need_wait_return = FALSE;
|
---|
| 3973 | + emsg_on_display = FALSE;
|
---|
| 3974 | + cmdline_row = msg_row;
|
---|
| 3975 |
|
---|
| 3976 | /* Flush output to avoid that further messages and redrawing is done
|
---|
[54f612f] | 3977 | * in the wrong order. */
|
---|
[7352c10] | 3978 | @@ -4556,7 +4560,13 @@
|
---|
| 3979 | remove_trailing_zeroes = TRUE;
|
---|
| 3980 | }
|
---|
| 3981 |
|
---|
| 3982 | - if (fmt_spec == 'f' && abs_f > 1.0e307)
|
---|
| 3983 | + if (fmt_spec == 'f' &&
|
---|
| 3984 | +#ifdef VAX
|
---|
| 3985 | + abs_f > 1.0e38
|
---|
| 3986 | +#else
|
---|
| 3987 | + abs_f > 1.0e307
|
---|
| 3988 | +#endif
|
---|
| 3989 | + )
|
---|
| 3990 | {
|
---|
| 3991 | /* Avoid a buffer overflow */
|
---|
[54f612f] | 3992 | strcpy(tmp, "inf");
|
---|
[76dd250] | 3993 | @@ -4585,61 +4595,62 @@
|
---|
| 3994 | if (remove_trailing_zeroes)
|
---|
| 3995 | {
|
---|
| 3996 | int i;
|
---|
| 3997 | - char *p;
|
---|
| 3998 | + char *tp;
|
---|
| 3999 |
|
---|
| 4000 | /* Using %g or %G: remove superfluous zeroes. */
|
---|
| 4001 | if (fmt_spec == 'f')
|
---|
| 4002 | - p = tmp + str_arg_l - 1;
|
---|
| 4003 | + tp = tmp + str_arg_l - 1;
|
---|
| 4004 | else
|
---|
| 4005 | {
|
---|
| 4006 | - p = (char *)vim_strchr((char_u *)tmp,
|
---|
| 4007 | + tp = (char *)vim_strchr((char_u *)tmp,
|
---|
| 4008 | fmt_spec == 'e' ? 'e' : 'E');
|
---|
| 4009 | - if (p != NULL)
|
---|
| 4010 | + if (tp != NULL)
|
---|
| 4011 | {
|
---|
| 4012 | /* Remove superfluous '+' and leading
|
---|
| 4013 | * zeroes from the exponent. */
|
---|
| 4014 | - if (p[1] == '+')
|
---|
| 4015 | + if (tp[1] == '+')
|
---|
| 4016 | {
|
---|
| 4017 | /* Change "1.0e+07" to "1.0e07" */
|
---|
| 4018 | - STRMOVE(p + 1, p + 2);
|
---|
| 4019 | + STRMOVE(tp + 1, tp + 2);
|
---|
| 4020 | --str_arg_l;
|
---|
| 4021 | }
|
---|
| 4022 | - i = (p[1] == '-') ? 2 : 1;
|
---|
| 4023 | - while (p[i] == '0')
|
---|
| 4024 | + i = (tp[1] == '-') ? 2 : 1;
|
---|
| 4025 | + while (tp[i] == '0')
|
---|
| 4026 | {
|
---|
| 4027 | /* Change "1.0e07" to "1.0e7" */
|
---|
| 4028 | - STRMOVE(p + i, p + i + 1);
|
---|
| 4029 | + STRMOVE(tp + i, tp + i + 1);
|
---|
| 4030 | --str_arg_l;
|
---|
| 4031 | }
|
---|
| 4032 | - --p;
|
---|
| 4033 | + --tp;
|
---|
| 4034 | }
|
---|
| 4035 | }
|
---|
| 4036 |
|
---|
| 4037 | - if (p != NULL && !precision_specified)
|
---|
| 4038 | + if (tp != NULL && !precision_specified)
|
---|
| 4039 | /* Remove trailing zeroes, but keep the one
|
---|
| 4040 | * just after a dot. */
|
---|
| 4041 | - while (p > tmp + 2 && *p == '0' && p[-1] != '.')
|
---|
| 4042 | + while (tp > tmp + 2 && *tp == '0'
|
---|
| 4043 | + && tp[-1] != '.')
|
---|
| 4044 | {
|
---|
| 4045 | - STRMOVE(p, p + 1);
|
---|
| 4046 | - --p;
|
---|
| 4047 | + STRMOVE(tp, tp + 1);
|
---|
| 4048 | + --tp;
|
---|
| 4049 | --str_arg_l;
|
---|
| 4050 | }
|
---|
| 4051 | }
|
---|
| 4052 | else
|
---|
| 4053 | {
|
---|
| 4054 | - char *p;
|
---|
| 4055 | + char *tp;
|
---|
| 4056 |
|
---|
| 4057 | /* Be consistent: some printf("%e") use 1.0e+12
|
---|
| 4058 | * and some 1.0e+012. Remove one zero in the last
|
---|
| 4059 | * case. */
|
---|
| 4060 | - p = (char *)vim_strchr((char_u *)tmp,
|
---|
| 4061 | + tp = (char *)vim_strchr((char_u *)tmp,
|
---|
| 4062 | fmt_spec == 'e' ? 'e' : 'E');
|
---|
| 4063 | - if (p != NULL && (p[1] == '+' || p[1] == '-')
|
---|
| 4064 | - && p[2] == '0'
|
---|
| 4065 | - && vim_isdigit(p[3])
|
---|
| 4066 | - && vim_isdigit(p[4]))
|
---|
| 4067 | + if (tp != NULL && (tp[1] == '+' || tp[1] == '-')
|
---|
| 4068 | + && tp[2] == '0'
|
---|
| 4069 | + && vim_isdigit(tp[3])
|
---|
| 4070 | + && vim_isdigit(tp[4]))
|
---|
| 4071 | {
|
---|
| 4072 | - STRMOVE(p + 2, p + 3);
|
---|
| 4073 | + STRMOVE(tp + 2, tp + 3);
|
---|
| 4074 | --str_arg_l;
|
---|
| 4075 | }
|
---|
| 4076 | }
|
---|
| 4077 | diff -Naur vim72.orig/src/misc1.c vim72/src/misc1.c
|
---|
[54f612f] | 4078 | --- vim72.orig/src/misc1.c 2008-07-12 12:20:53.000000000 -0700
|
---|
[76dd250] | 4079 | +++ vim72/src/misc1.c 2009-02-22 21:57:28.916594496 -0800
|
---|
| 4080 | @@ -3245,9 +3245,9 @@
|
---|
| 4081 |
|
---|
| 4082 | /* When using ":silent" assume that <CR> was entered. */
|
---|
| 4083 | if (mouse_used != NULL)
|
---|
| 4084 | - MSG_PUTS(_("Type number or click with mouse (<Enter> cancels): "));
|
---|
| 4085 | + MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): "));
|
---|
| 4086 | else
|
---|
| 4087 | - MSG_PUTS(_("Choice number (<Enter> cancels): "));
|
---|
| 4088 | + MSG_PUTS(_("Type number and <Enter> (empty cancels): "));
|
---|
| 4089 |
|
---|
| 4090 | /* Set the state such that text can be selected/copied/pasted and we still
|
---|
| 4091 | * get mouse events. */
|
---|
| 4092 | diff -Naur vim72.orig/src/misc2.c vim72/src/misc2.c
|
---|
[54f612f] | 4093 | --- vim72.orig/src/misc2.c 2008-07-23 12:12:56.000000000 -0700
|
---|
[76dd250] | 4094 | +++ vim72/src/misc2.c 2009-02-22 21:57:51.770060343 -0800
|
---|
| 4095 | @@ -873,7 +873,7 @@
|
---|
| 4096 | /* 3. check for available memory: call mch_avail_mem() */
|
---|
| 4097 | if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
|
---|
| 4098 | {
|
---|
| 4099 | - vim_free((char *)p); /* System is low... no go! */
|
---|
| 4100 | + free((char *)p); /* System is low... no go! */
|
---|
| 4101 | p = NULL;
|
---|
| 4102 | }
|
---|
| 4103 | else
|
---|
| 4104 | @@ -1257,7 +1257,6 @@
|
---|
| 4105 | return escaped_string;
|
---|
| 4106 | }
|
---|
| 4107 |
|
---|
| 4108 | -#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
|
---|
| 4109 | /*
|
---|
| 4110 | * Return TRUE when 'shell' has "csh" in the tail.
|
---|
| 4111 | */
|
---|
| 4112 | @@ -1266,9 +1265,7 @@
|
---|
| 4113 | {
|
---|
| 4114 | return (strstr((char *)gettail(p_sh), "csh") != NULL);
|
---|
| 4115 | }
|
---|
| 4116 | -#endif
|
---|
| 4117 |
|
---|
| 4118 | -#if defined(FEAT_EVAL) || defined(PROTO)
|
---|
| 4119 | /*
|
---|
| 4120 | * Escape "string" for use as a shell argument with system().
|
---|
| 4121 | * This uses single quotes, except when we know we need to use double qoutes
|
---|
| 4122 | @@ -1391,7 +1388,6 @@
|
---|
| 4123 |
|
---|
| 4124 | return escaped_string;
|
---|
| 4125 | }
|
---|
| 4126 | -#endif
|
---|
| 4127 |
|
---|
| 4128 | /*
|
---|
[1f22c7c] | 4129 | * Like vim_strsave(), but make all characters uppercase.
|
---|
| 4130 | @@ -2565,7 +2561,7 @@
|
---|
| 4131 | int key;
|
---|
| 4132 | int dlen = 0;
|
---|
| 4133 |
|
---|
| 4134 | - key = find_special_key(srcp, &modifiers, keycode);
|
---|
| 4135 | + key = find_special_key(srcp, &modifiers, keycode, FALSE);
|
---|
| 4136 | if (key == 0)
|
---|
| 4137 | return 0;
|
---|
| 4138 |
|
---|
| 4139 | @@ -2601,10 +2597,11 @@
|
---|
| 4140 | * returns 0 if there is no match.
|
---|
| 4141 | */
|
---|
| 4142 | int
|
---|
| 4143 | -find_special_key(srcp, modp, keycode)
|
---|
| 4144 | +find_special_key(srcp, modp, keycode, keep_x_key)
|
---|
| 4145 | char_u **srcp;
|
---|
| 4146 | int *modp;
|
---|
| 4147 | - int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
|
---|
| 4148 | + int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
|
---|
| 4149 | + int keep_x_key; /* don't translate xHome to Home key */
|
---|
| 4150 | {
|
---|
| 4151 | char_u *last_dash;
|
---|
| 4152 | char_u *end_of_name;
|
---|
| 4153 | @@ -2672,7 +2669,8 @@
|
---|
| 4154 | else
|
---|
| 4155 | {
|
---|
| 4156 | key = get_special_key_code(last_dash + 1);
|
---|
| 4157 | - key = handle_x_keys(key);
|
---|
| 4158 | + if (!keep_x_key)
|
---|
| 4159 | + key = handle_x_keys(key);
|
---|
| 4160 | }
|
---|
| 4161 |
|
---|
[5f4a45c9] | 4162 | /*
|
---|
| 4163 | @@ -4698,7 +4696,8 @@
|
---|
| 4164 | stackp->ffs_filearray_cur = i + 1;
|
---|
| 4165 | ff_push(search_ctx, stackp);
|
---|
| 4166 |
|
---|
| 4167 | - simplify_filename(file_path);
|
---|
| 4168 | + if (!path_with_url(file_path))
|
---|
| 4169 | + simplify_filename(file_path);
|
---|
| 4170 | if (mch_dirname(ff_expand_buffer, MAXPATHL)
|
---|
| 4171 | == OK)
|
---|
[76dd250] | 4172 | {
|
---|
| 4173 | diff -Naur vim72.orig/src/move.c vim72/src/move.c
|
---|
[54f612f] | 4174 | --- vim72.orig/src/move.c 2008-07-12 09:26:47.000000000 -0700
|
---|
[76dd250] | 4175 | +++ vim72/src/move.c 2009-02-22 21:57:36.281067746 -0800
|
---|
| 4176 | @@ -280,18 +280,20 @@
|
---|
| 4177 |
|
---|
| 4178 | if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
|
---|
| 4179 | {
|
---|
| 4180 | - if (curwin->w_cursor.lnum < curwin->w_botline
|
---|
| 4181 | - && ((long)curwin->w_cursor.lnum
|
---|
| 4182 | + if (curwin->w_cursor.lnum < curwin->w_botline)
|
---|
| 4183 | + {
|
---|
| 4184 | + if (((long)curwin->w_cursor.lnum
|
---|
| 4185 | >= (long)curwin->w_botline - p_so
|
---|
| 4186 | #ifdef FEAT_FOLDING
|
---|
| 4187 | || hasAnyFolding(curwin)
|
---|
| 4188 | #endif
|
---|
| 4189 | ))
|
---|
| 4190 | - {
|
---|
| 4191 | + {
|
---|
| 4192 | lineoff_T loff;
|
---|
| 4193 |
|
---|
| 4194 | - /* Cursor is above botline, check if there are 'scrolloff'
|
---|
| 4195 | - * window lines below the cursor. If not, need to scroll. */
|
---|
| 4196 | + /* Cursor is (a few lines) above botline, check if there are
|
---|
| 4197 | + * 'scrolloff' window lines below the cursor. If not, need to
|
---|
| 4198 | + * scroll. */
|
---|
| 4199 | n = curwin->w_empty_rows;
|
---|
| 4200 | loff.lnum = curwin->w_cursor.lnum;
|
---|
| 4201 | #ifdef FEAT_FOLDING
|
---|
| 4202 | @@ -317,6 +319,10 @@
|
---|
| 4203 | if (n >= p_so)
|
---|
| 4204 | /* sufficient context, no need to scroll */
|
---|
| 4205 | check_botline = FALSE;
|
---|
| 4206 | + }
|
---|
| 4207 | + else
|
---|
| 4208 | + /* sufficient context, no need to scroll */
|
---|
| 4209 | + check_botline = FALSE;
|
---|
| 4210 | }
|
---|
| 4211 | if (check_botline)
|
---|
| 4212 | {
|
---|
| 4213 | @@ -509,6 +515,9 @@
|
---|
| 4214 | /* Approximate the value of w_botline */
|
---|
| 4215 | wp->w_botline += lnum - wp->w_topline;
|
---|
| 4216 | wp->w_topline = lnum;
|
---|
| 4217 | +#ifdef FEAT_AUTOCMD
|
---|
| 4218 | + wp->w_topline_was_set = TRUE;
|
---|
| 4219 | +#endif
|
---|
| 4220 | #ifdef FEAT_DIFF
|
---|
| 4221 | wp->w_topfill = 0;
|
---|
[54f612f] | 4222 | #endif
|
---|
| 4223 | diff -Naur vim72.orig/src/nbdebug.c vim72/src/nbdebug.c
|
---|
| 4224 | --- vim72.orig/src/nbdebug.c 2008-06-22 08:38:58.000000000 -0700
|
---|
| 4225 | +++ vim72/src/nbdebug.c 2009-02-22 21:58:03.030781673 -0800
|
---|
| 4226 | @@ -33,7 +33,6 @@
|
---|
| 4227 | u_int nb_dlevel = 0; /* nb_debug verbosity level */
|
---|
| 4228 |
|
---|
| 4229 | void nbdb(char *, ...);
|
---|
| 4230 | -void nbtrace(char *, ...);
|
---|
| 4231 |
|
---|
| 4232 | static int lookup(char *);
|
---|
| 4233 | #ifdef USE_NB_ERRORHANDLER
|
---|
| 4234 | @@ -100,25 +99,6 @@
|
---|
| 4235 | } /* end nbdebug_log_init */
|
---|
| 4236 |
|
---|
| 4237 |
|
---|
| 4238 | -
|
---|
| 4239 | -
|
---|
| 4240 | -void
|
---|
| 4241 | -nbtrace(
|
---|
| 4242 | - char *fmt,
|
---|
| 4243 | - ...)
|
---|
| 4244 | -{
|
---|
| 4245 | - va_list ap;
|
---|
| 4246 | -
|
---|
| 4247 | - if (nb_debug!= NULL && (nb_dlevel & (NB_TRACE | NB_TRACE_VERBOSE))) {
|
---|
| 4248 | - va_start(ap, fmt);
|
---|
| 4249 | - vfprintf(nb_debug, fmt, ap);
|
---|
| 4250 | - va_end(ap);
|
---|
| 4251 | - fflush(nb_debug);
|
---|
| 4252 | - }
|
---|
| 4253 | -
|
---|
| 4254 | -} /* end nbtrace */
|
---|
| 4255 | -
|
---|
| 4256 | -
|
---|
| 4257 | void
|
---|
| 4258 | nbdbg(
|
---|
| 4259 | char *fmt,
|
---|
| 4260 | @@ -136,23 +116,6 @@
|
---|
| 4261 | } /* end nbdbg */
|
---|
| 4262 |
|
---|
| 4263 |
|
---|
| 4264 | -void
|
---|
| 4265 | -nbprt(
|
---|
| 4266 | - char *fmt,
|
---|
| 4267 | - ...)
|
---|
| 4268 | -{
|
---|
| 4269 | - va_list ap;
|
---|
| 4270 | -
|
---|
| 4271 | - if (nb_debug != NULL && nb_dlevel & NB_PRINT) {
|
---|
| 4272 | - va_start(ap, fmt);
|
---|
| 4273 | - vfprintf(nb_debug, fmt, ap);
|
---|
| 4274 | - va_end(ap);
|
---|
| 4275 | - fflush(nb_debug);
|
---|
| 4276 | - }
|
---|
| 4277 | -
|
---|
| 4278 | -} /* end nbprt */
|
---|
| 4279 | -
|
---|
| 4280 | -
|
---|
| 4281 | static int
|
---|
| 4282 | lookup(
|
---|
| 4283 | char *file)
|
---|
| 4284 | diff -Naur vim72.orig/src/nbdebug.h vim72/src/nbdebug.h
|
---|
| 4285 | --- vim72.orig/src/nbdebug.h 2008-06-22 07:31:50.000000000 -0700
|
---|
| 4286 | +++ vim72/src/nbdebug.h 2009-02-22 21:58:03.030781673 -0800
|
---|
| 4287 | @@ -43,8 +43,6 @@
|
---|
| 4288 |
|
---|
| 4289 |
|
---|
| 4290 | void nbdbg(char *, ...);
|
---|
| 4291 | -void nbprt(char *, ...);
|
---|
| 4292 | -void nbtrace(char *, ...);
|
---|
| 4293 |
|
---|
| 4294 | void nbdebug_wait __ARGS((u_int wait_flags, char *wait_var, u_int wait_secs));
|
---|
| 4295 | void nbdebug_log_init __ARGS((char *log_var, char *level_var));
|
---|
| 4296 | @@ -70,19 +68,5 @@
|
---|
| 4297 | {
|
---|
| 4298 | }
|
---|
| 4299 |
|
---|
| 4300 | -void
|
---|
| 4301 | -nbprt(
|
---|
| 4302 | - char *fmt,
|
---|
| 4303 | - ...)
|
---|
| 4304 | -{
|
---|
| 4305 | -}
|
---|
| 4306 | -
|
---|
| 4307 | -void
|
---|
| 4308 | -nbtrace(
|
---|
| 4309 | - char *fmt,
|
---|
| 4310 | - ...)
|
---|
| 4311 | -{
|
---|
| 4312 | -}
|
---|
| 4313 | -
|
---|
| 4314 | #endif /* NBDEBUG */
|
---|
[76dd250] | 4315 | #endif /* NBDEBUG_H */
|
---|
| 4316 | diff -Naur vim72.orig/src/netbeans.c vim72/src/netbeans.c
|
---|
[54f612f] | 4317 | --- vim72.orig/src/netbeans.c 2008-07-13 09:19:54.000000000 -0700
|
---|
[76dd250] | 4318 | +++ vim72/src/netbeans.c 2009-02-22 21:58:03.022781673 -0800
|
---|
| 4319 | @@ -1043,7 +1043,7 @@
|
---|
| 4320 | nbdebug(("EVT: %s", buf));
|
---|
| 4321 | /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */
|
---|
| 4322 | if (sd >= 0)
|
---|
| 4323 | - sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */
|
---|
| 4324 | + ignored = sock_write(sd, buf, (int)STRLEN(buf));
|
---|
| 4325 | }
|
---|
| 4326 | }
|
---|
[54f612f] | 4327 |
|
---|
| 4328 | @@ -1921,7 +1921,7 @@
|
---|
| 4329 | vim_free(path);
|
---|
| 4330 | if (bufp == NULL)
|
---|
| 4331 | {
|
---|
| 4332 | - nbdebug((" File %s not found in setBufferNumber\n", args));
|
---|
| 4333 | + nbdebug((" File %s not found in setBufferNumber\n", args));
|
---|
| 4334 | EMSG2("E642: File %s not found in setBufferNumber", args);
|
---|
| 4335 | return FAIL;
|
---|
[76dd250] | 4336 | }
|
---|
| 4337 | @@ -2277,9 +2277,6 @@
|
---|
| 4338 | int serNum;
|
---|
| 4339 | int localTypeNum;
|
---|
| 4340 | int typeNum;
|
---|
| 4341 | -# ifdef NBDEBUG
|
---|
| 4342 | - int len;
|
---|
| 4343 | -# endif
|
---|
| 4344 | pos_T *pos;
|
---|
| 4345 |
|
---|
| 4346 | if (buf == NULL || buf->bufp == NULL)
|
---|
| 4347 | @@ -2303,13 +2300,10 @@
|
---|
| 4348 | pos = get_off_or_lnum(buf->bufp, &args);
|
---|
| 4349 |
|
---|
| 4350 | cp = (char *)args;
|
---|
| 4351 | -# ifdef NBDEBUG
|
---|
| 4352 | - len =
|
---|
| 4353 | -# endif
|
---|
| 4354 | - strtol(cp, &cp, 10);
|
---|
| 4355 | + ignored = (int)strtol(cp, &cp, 10);
|
---|
| 4356 | args = (char_u *)cp;
|
---|
| 4357 | # ifdef NBDEBUG
|
---|
| 4358 | - if (len != -1)
|
---|
| 4359 | + if (ignored != -1)
|
---|
| 4360 | {
|
---|
| 4361 | nbdebug((" partial line annotation -- Not Yet Implemented!\n"));
|
---|
[54f612f] | 4362 | }
|
---|
| 4363 | @@ -2321,7 +2315,7 @@
|
---|
| 4364 | }
|
---|
| 4365 | if (pos)
|
---|
| 4366 | {
|
---|
| 4367 | - coloncmd(":sign place %d line=%d name=%d buffer=%d",
|
---|
| 4368 | + coloncmd(":sign place %d line=%ld name=%d buffer=%d",
|
---|
| 4369 | serNum, pos->lnum, typeNum, buf->bufp->b_fnum);
|
---|
| 4370 | if (typeNum == curPCtype)
|
---|
| 4371 | coloncmd(":sign jump %d buffer=%d", serNum,
|
---|
| 4372 | @@ -2425,7 +2419,7 @@
|
---|
| 4373 | GUARDED) == 0)
|
---|
| 4374 | {
|
---|
| 4375 | coloncmd(
|
---|
| 4376 | - ":sign place %d line=%d name=%d buffer=%d",
|
---|
| 4377 | + ":sign place %d line=%ld name=%d buffer=%d",
|
---|
| 4378 | guardId++, lnum, GUARDED,
|
---|
| 4379 | buf->bufp->b_fnum);
|
---|
[43c52a1] | 4380 | }
|
---|
| 4381 | @@ -2924,44 +2918,26 @@
|
---|
| 4382 | }
|
---|
| 4383 |
|
---|
| 4384 | /*
|
---|
| 4385 | - * Tell netbeans a file was closed.
|
---|
| 4386 | + * Tell netbeans that a file was deleted or wiped out.
|
---|
| 4387 | */
|
---|
| 4388 | void
|
---|
| 4389 | -netbeans_file_closed(buf_T *bufp)
|
---|
| 4390 | +netbeans_file_killed(buf_T *bufp)
|
---|
| 4391 | {
|
---|
| 4392 | int bufno = nb_getbufno(bufp);
|
---|
| 4393 | nbbuf_T *nbbuf = nb_get_buf(bufno);
|
---|
| 4394 | char buffer[2*MAXPATHL];
|
---|
| 4395 |
|
---|
| 4396 | - if (!haveConnection || bufno < 0)
|
---|
| 4397 | - return;
|
---|
| 4398 | -
|
---|
| 4399 | - if (!netbeansCloseFile)
|
---|
| 4400 | - {
|
---|
| 4401 | - nbdebug(("Ignoring file_closed for %s. File was closed from IDE\n",
|
---|
| 4402 | - bufp->b_ffname));
|
---|
| 4403 | + if (!haveConnection || bufno == -1)
|
---|
| 4404 | return;
|
---|
| 4405 | - }
|
---|
| 4406 | -
|
---|
| 4407 | - nbdebug(("netbeans_file_closed:\n"));
|
---|
| 4408 | - nbdebug((" Closing bufno: %d", bufno));
|
---|
| 4409 | - if (curbuf != NULL && curbuf != bufp)
|
---|
| 4410 | - {
|
---|
| 4411 | - nbdebug((" Curbuf bufno: %d\n", nb_getbufno(curbuf)));
|
---|
| 4412 | - }
|
---|
| 4413 | - else if (curbuf == bufp)
|
---|
| 4414 | - {
|
---|
| 4415 | - nbdebug((" curbuf == bufp\n"));
|
---|
| 4416 | - }
|
---|
| 4417 |
|
---|
| 4418 | - if (bufno <= 0)
|
---|
| 4419 | - return;
|
---|
| 4420 | + nbdebug(("netbeans_file_killed:\n"));
|
---|
| 4421 | + nbdebug((" Killing bufno: %d", bufno));
|
---|
| 4422 |
|
---|
| 4423 | sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno);
|
---|
| 4424 |
|
---|
| 4425 | nbdebug(("EVT: %s", buffer));
|
---|
| 4426 |
|
---|
| 4427 | - nb_send(buffer, "netbeans_file_closed");
|
---|
| 4428 | + nb_send(buffer, "netbeans_file_killed");
|
---|
| 4429 |
|
---|
| 4430 | if (nbbuf != NULL)
|
---|
[76dd250] | 4431 | nbbuf->bufp = NULL;
|
---|
| 4432 | diff -Naur vim72.orig/src/normal.c vim72/src/normal.c
|
---|
[54f612f] | 4433 | --- vim72.orig/src/normal.c 2008-07-31 13:03:08.000000000 -0700
|
---|
[76dd250] | 4434 | +++ vim72/src/normal.c 2009-02-22 21:58:02.962778041 -0800
|
---|
| 4435 | @@ -183,6 +183,8 @@
|
---|
| 4436 | static void nv_cursorhold __ARGS((cmdarg_T *cap));
|
---|
| 4437 | #endif
|
---|
| 4438 |
|
---|
| 4439 | +static char *e_noident = N_("E349: No identifier under cursor");
|
---|
| 4440 | +
|
---|
| 4441 | /*
|
---|
| 4442 | * Function to be called for a Normal or Visual mode command.
|
---|
| 4443 | * The argument is a cmdarg_T.
|
---|
| 4444 | @@ -578,6 +580,9 @@
|
---|
| 4445 | static int old_mapped_len = 0;
|
---|
| 4446 | #endif
|
---|
| 4447 | int idx;
|
---|
| 4448 | +#ifdef FEAT_EVAL
|
---|
| 4449 | + int set_prevcount = FALSE;
|
---|
| 4450 | +#endif
|
---|
| 4451 |
|
---|
| 4452 | vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
|
---|
| 4453 | ca.oap = oap;
|
---|
| 4454 | @@ -613,7 +618,12 @@
|
---|
| 4455 | /* When not finishing an operator and no register name typed, reset the
|
---|
| 4456 | * count. */
|
---|
| 4457 | if (!finish_op && !oap->regname)
|
---|
| 4458 | + {
|
---|
| 4459 | ca.opcount = 0;
|
---|
| 4460 | +#ifdef FEAT_EVAL
|
---|
| 4461 | + set_prevcount = TRUE;
|
---|
| 4462 | +#endif
|
---|
| 4463 | + }
|
---|
| 4464 |
|
---|
| 4465 | #ifdef FEAT_AUTOCMD
|
---|
[54f612f] | 4466 | /* Restore counts from before receiving K_CURSORHOLD. This means after
|
---|
| 4467 | @@ -641,10 +651,7 @@
|
---|
| 4468 | * Get the command character from the user.
|
---|
| 4469 | */
|
---|
| 4470 | c = safe_vgetc();
|
---|
| 4471 | -
|
---|
| 4472 | -#ifdef FEAT_LANGMAP
|
---|
| 4473 | LANGMAP_ADJUST(c, TRUE);
|
---|
| 4474 | -#endif
|
---|
| 4475 |
|
---|
| 4476 | #ifdef FEAT_VISUAL
|
---|
| 4477 | /*
|
---|
[76dd250] | 4478 | @@ -717,7 +724,15 @@
|
---|
| 4479 | * command, so that v:count can be used in an expression mapping
|
---|
| 4480 | * right after the count. */
|
---|
| 4481 | if (toplevel && stuff_empty())
|
---|
| 4482 | - set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0);
|
---|
| 4483 | + {
|
---|
| 4484 | + long count = ca.count0;
|
---|
| 4485 | +
|
---|
| 4486 | + /* multiply with ca.opcount the same way as below */
|
---|
| 4487 | + if (ca.opcount != 0)
|
---|
| 4488 | + count = ca.opcount * (count == 0 ? 1 : count);
|
---|
| 4489 | + set_vcount(count, count == 0 ? 1 : count, set_prevcount);
|
---|
| 4490 | + set_prevcount = FALSE; /* only set v:prevcount once */
|
---|
| 4491 | + }
|
---|
| 4492 | #endif
|
---|
| 4493 | if (ctrl_w)
|
---|
[54f612f] | 4494 | {
|
---|
| 4495 | @@ -726,9 +741,7 @@
|
---|
| 4496 | }
|
---|
| 4497 | ++no_zero_mapping; /* don't map zero here */
|
---|
| 4498 | c = plain_vgetc();
|
---|
| 4499 | -#ifdef FEAT_LANGMAP
|
---|
| 4500 | LANGMAP_ADJUST(c, TRUE);
|
---|
| 4501 | -#endif
|
---|
| 4502 | --no_zero_mapping;
|
---|
| 4503 | if (ctrl_w)
|
---|
| 4504 | {
|
---|
| 4505 | @@ -751,9 +764,7 @@
|
---|
| 4506 | ++no_mapping;
|
---|
| 4507 | ++allow_keys; /* no mapping for nchar, but keys */
|
---|
| 4508 | c = plain_vgetc(); /* get next character */
|
---|
| 4509 | -#ifdef FEAT_LANGMAP
|
---|
| 4510 | LANGMAP_ADJUST(c, TRUE);
|
---|
| 4511 | -#endif
|
---|
| 4512 | --no_mapping;
|
---|
| 4513 | --allow_keys;
|
---|
| 4514 | #ifdef FEAT_CMDL_INFO
|
---|
[76dd250] | 4515 | @@ -804,7 +815,7 @@
|
---|
| 4516 | * Only set v:count when called from main() and not a stuffed command.
|
---|
| 4517 | */
|
---|
| 4518 | if (toplevel && stuff_empty())
|
---|
| 4519 | - set_vcount(ca.count0, ca.count1);
|
---|
| 4520 | + set_vcount(ca.count0, ca.count1, set_prevcount);
|
---|
| 4521 | #endif
|
---|
| 4522 |
|
---|
[54f612f] | 4523 | /*
|
---|
| 4524 | @@ -941,9 +952,7 @@
|
---|
| 4525 | * "gr", "g'" and "g`".
|
---|
| 4526 | */
|
---|
| 4527 | ca.nchar = plain_vgetc();
|
---|
| 4528 | -#ifdef FEAT_LANGMAP
|
---|
| 4529 | LANGMAP_ADJUST(ca.nchar, TRUE);
|
---|
| 4530 | -#endif
|
---|
| 4531 | #ifdef FEAT_CMDL_INFO
|
---|
| 4532 | need_flushbuf |= add_to_showcmd(ca.nchar);
|
---|
| 4533 | #endif
|
---|
| 4534 | @@ -1044,10 +1053,8 @@
|
---|
| 4535 | }
|
---|
| 4536 | #endif
|
---|
| 4537 |
|
---|
| 4538 | -#ifdef FEAT_LANGMAP
|
---|
| 4539 | /* adjust chars > 127, except after "tTfFr" commands */
|
---|
| 4540 | LANGMAP_ADJUST(*cp, !lang);
|
---|
| 4541 | -#endif
|
---|
| 4542 | #ifdef FEAT_RIGHTLEFT
|
---|
| 4543 | /* adjust Hebrew mapped char */
|
---|
| 4544 | if (p_hkmap && lang && KeyTyped)
|
---|
[76dd250] | 4545 | @@ -1132,7 +1139,8 @@
|
---|
| 4546 | out_flush();
|
---|
| 4547 | #endif
|
---|
| 4548 | #ifdef FEAT_AUTOCMD
|
---|
| 4549 | - did_cursorhold = FALSE;
|
---|
| 4550 | + if (ca.cmdchar != K_IGNORE)
|
---|
| 4551 | + did_cursorhold = FALSE;
|
---|
| 4552 | #endif
|
---|
| 4553 |
|
---|
[54f612f] | 4554 | State = NORMAL;
|
---|
[76dd250] | 4555 | @@ -3509,7 +3517,7 @@
|
---|
| 4556 | if (find_type & FIND_STRING)
|
---|
| 4557 | EMSG(_("E348: No string under cursor"));
|
---|
| 4558 | else
|
---|
| 4559 | - EMSG(_("E349: No identifier under cursor"));
|
---|
| 4560 | + EMSG(_(e_noident));
|
---|
| 4561 | return 0;
|
---|
| 4562 | }
|
---|
[54f612f] | 4563 | ptr += col;
|
---|
| 4564 | @@ -4611,9 +4619,7 @@
|
---|
| 4565 | ++no_mapping;
|
---|
| 4566 | ++allow_keys; /* no mapping for nchar, but allow key codes */
|
---|
| 4567 | nchar = plain_vgetc();
|
---|
| 4568 | -#ifdef FEAT_LANGMAP
|
---|
| 4569 | LANGMAP_ADJUST(nchar, TRUE);
|
---|
| 4570 | -#endif
|
---|
| 4571 | --no_mapping;
|
---|
| 4572 | --allow_keys;
|
---|
| 4573 | #ifdef FEAT_CMDL_INFO
|
---|
| 4574 | @@ -4969,9 +4975,7 @@
|
---|
| 4575 | ++no_mapping;
|
---|
| 4576 | ++allow_keys; /* no mapping for nchar, but allow key codes */
|
---|
| 4577 | nchar = plain_vgetc();
|
---|
| 4578 | -#ifdef FEAT_LANGMAP
|
---|
| 4579 | LANGMAP_ADJUST(nchar, TRUE);
|
---|
| 4580 | -#endif
|
---|
| 4581 | --no_mapping;
|
---|
| 4582 | --allow_keys;
|
---|
| 4583 | #ifdef FEAT_CMDL_INFO
|
---|
[76dd250] | 4584 | @@ -5469,6 +5473,20 @@
|
---|
| 4585 | STRCPY(buf, "he! ");
|
---|
| 4586 | else
|
---|
| 4587 | {
|
---|
| 4588 | + /* An external command will probably use an argument starting
|
---|
| 4589 | + * with "-" as an option. To avoid trouble we skip the "-". */
|
---|
| 4590 | + while (*ptr == '-' && n > 0)
|
---|
| 4591 | + {
|
---|
| 4592 | + ++ptr;
|
---|
| 4593 | + --n;
|
---|
| 4594 | + }
|
---|
| 4595 | + if (n == 0)
|
---|
| 4596 | + {
|
---|
| 4597 | + EMSG(_(e_noident)); /* found dashes only */
|
---|
| 4598 | + vim_free(buf);
|
---|
| 4599 | + return;
|
---|
| 4600 | + }
|
---|
| 4601 | +
|
---|
| 4602 | /* When a count is given, turn it into a range. Is this
|
---|
| 4603 | * really what we want? */
|
---|
[54f612f] | 4604 | isman = (STRCMP(kp, "man") == 0);
|
---|
[76dd250] | 4605 | @@ -5511,37 +5529,59 @@
|
---|
| 4606 | /*
|
---|
| 4607 | * Now grab the chars in the identifier
|
---|
| 4608 | */
|
---|
| 4609 | - if (cmdchar == '*')
|
---|
| 4610 | - aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
|
---|
| 4611 | - else if (cmdchar == '#')
|
---|
| 4612 | - aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
|
---|
| 4613 | - else if (cmdchar == 'K' && !kp_help)
|
---|
| 4614 | - aux_ptr = (char_u *)" \t\\\"|!";
|
---|
| 4615 | - else
|
---|
| 4616 | - /* Don't escape spaces and Tabs in a tag with a backslash */
|
---|
| 4617 | - aux_ptr = (char_u *)"\\|\"";
|
---|
| 4618 | -
|
---|
| 4619 | - p = buf + STRLEN(buf);
|
---|
| 4620 | - while (n-- > 0)
|
---|
| 4621 | - {
|
---|
| 4622 | - /* put a backslash before \ and some others */
|
---|
| 4623 | - if (vim_strchr(aux_ptr, *ptr) != NULL)
|
---|
| 4624 | - *p++ = '\\';
|
---|
| 4625 | -#ifdef FEAT_MBYTE
|
---|
| 4626 | - /* When current byte is a part of multibyte character, copy all bytes
|
---|
| 4627 | - * of that character. */
|
---|
| 4628 | - if (has_mbyte)
|
---|
| 4629 | + if (cmdchar == 'K' && !kp_help)
|
---|
| 4630 | + {
|
---|
| 4631 | + /* Escape the argument properly for a shell command */
|
---|
| 4632 | + ptr = vim_strnsave(ptr, n);
|
---|
| 4633 | + p = vim_strsave_shellescape(ptr, TRUE);
|
---|
| 4634 | + vim_free(ptr);
|
---|
| 4635 | + if (p == NULL)
|
---|
| 4636 | {
|
---|
| 4637 | - int i;
|
---|
| 4638 | - int len = (*mb_ptr2len)(ptr) - 1;
|
---|
| 4639 | -
|
---|
| 4640 | - for (i = 0; i < len && n >= 1; ++i, --n)
|
---|
| 4641 | - *p++ = *ptr++;
|
---|
| 4642 | + vim_free(buf);
|
---|
[54f612f] | 4643 | + return;
|
---|
[76dd250] | 4644 | + }
|
---|
| 4645 | + buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
|
---|
| 4646 | + if (buf == NULL)
|
---|
| 4647 | + {
|
---|
| 4648 | + vim_free(buf);
|
---|
| 4649 | + vim_free(p);
|
---|
[54f612f] | 4650 | + return;
|
---|
[76dd250] | 4651 | }
|
---|
| 4652 | + STRCAT(buf, p);
|
---|
| 4653 | + vim_free(p);
|
---|
| 4654 | + }
|
---|
| 4655 | + else
|
---|
| 4656 | + {
|
---|
| 4657 | + if (cmdchar == '*')
|
---|
| 4658 | + aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
|
---|
| 4659 | + else if (cmdchar == '#')
|
---|
| 4660 | + aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
|
---|
| 4661 | + else
|
---|
| 4662 | + /* Don't escape spaces and Tabs in a tag with a backslash */
|
---|
| 4663 | + aux_ptr = (char_u *)"\\|\"\n*?[";
|
---|
| 4664 | +
|
---|
| 4665 | + p = buf + STRLEN(buf);
|
---|
| 4666 | + while (n-- > 0)
|
---|
| 4667 | + {
|
---|
| 4668 | + /* put a backslash before \ and some others */
|
---|
| 4669 | + if (vim_strchr(aux_ptr, *ptr) != NULL)
|
---|
| 4670 | + *p++ = '\\';
|
---|
| 4671 | +#ifdef FEAT_MBYTE
|
---|
| 4672 | + /* When current byte is a part of multibyte character, copy all
|
---|
| 4673 | + * bytes of that character. */
|
---|
| 4674 | + if (has_mbyte)
|
---|
| 4675 | + {
|
---|
| 4676 | + int i;
|
---|
| 4677 | + int len = (*mb_ptr2len)(ptr) - 1;
|
---|
| 4678 | +
|
---|
| 4679 | + for (i = 0; i < len && n >= 1; ++i, --n)
|
---|
| 4680 | + *p++ = *ptr++;
|
---|
| 4681 | + }
|
---|
| 4682 | #endif
|
---|
| 4683 | - *p++ = *ptr++;
|
---|
| 4684 | + *p++ = *ptr++;
|
---|
| 4685 | + }
|
---|
| 4686 | + *p = NUL;
|
---|
| 4687 | }
|
---|
| 4688 | - *p = NUL;
|
---|
| 4689 |
|
---|
| 4690 | /*
|
---|
[54f612f] | 4691 | * Execute the command.
|
---|
[9a875fd] | 4692 | @@ -6728,6 +6768,8 @@
|
---|
| 4693 | /* Visual mode "r" */
|
---|
| 4694 | if (VIsual_active)
|
---|
| 4695 | {
|
---|
| 4696 | + if (got_int)
|
---|
| 4697 | + reset_VIsual();
|
---|
| 4698 | nv_operator(cap);
|
---|
| 4699 | return;
|
---|
[54f612f] | 4700 | }
|
---|
[9a875fd] | 4701 | @@ -7784,7 +7826,7 @@
|
---|
| 4702 | else
|
---|
| 4703 | i = curwin->w_leftcol;
|
---|
| 4704 | /* Go to the middle of the screen line. When 'number' is on and lines
|
---|
| 4705 | - * are wrapping the middle can be more to the left.*/
|
---|
| 4706 | + * are wrapping the middle can be more to the left. */
|
---|
| 4707 | if (cap->nchar == 'm')
|
---|
| 4708 | i += (W_WIDTH(curwin) - curwin_col_off()
|
---|
[76dd250] | 4709 | + ((curwin->w_p_wrap && i > 0)
|
---|
| 4710 | diff -Naur vim72.orig/src/ops.c vim72/src/ops.c
|
---|
[54f612f] | 4711 | --- vim72.orig/src/ops.c 2008-06-21 13:08:59.000000000 -0700
|
---|
[76dd250] | 4712 | +++ vim72/src/ops.c 2009-02-22 21:57:40.765356613 -0800
|
---|
| 4713 | @@ -2209,12 +2209,15 @@
|
---|
| 4714 | {
|
---|
| 4715 | for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
|
---|
| 4716 | {
|
---|
| 4717 | + int one_change;
|
---|
| 4718 | +
|
---|
| 4719 | block_prep(oap, &bd, pos.lnum, FALSE);
|
---|
| 4720 | pos.col = bd.textcol;
|
---|
| 4721 | - did_change = swapchars(oap->op_type, &pos, bd.textlen);
|
---|
| 4722 | + one_change = swapchars(oap->op_type, &pos, bd.textlen);
|
---|
| 4723 | + did_change |= one_change;
|
---|
| 4724 |
|
---|
| 4725 | # ifdef FEAT_NETBEANS_INTG
|
---|
| 4726 | - if (usingNetbeans && did_change)
|
---|
| 4727 | + if (usingNetbeans && one_change)
|
---|
| 4728 | {
|
---|
| 4729 | char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
|
---|
| 4730 |
|
---|
| 4731 | diff -Naur vim72.orig/src/option.c vim72/src/option.c
|
---|
[54f612f] | 4732 | --- vim72.orig/src/option.c 2008-07-18 06:05:33.000000000 -0700
|
---|
[76dd250] | 4733 | +++ vim72/src/option.c 2009-02-22 21:58:02.966778320 -0800
|
---|
| 4734 | @@ -2593,13 +2593,13 @@
|
---|
| 4735 | #ifdef FEAT_VIMINFO
|
---|
| 4736 | (char_u *)&p_viminfo, PV_NONE,
|
---|
| 4737 | #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
---|
| 4738 | - {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
|
---|
| 4739 | + {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
|
---|
| 4740 | #else
|
---|
| 4741 | # ifdef AMIGA
|
---|
| 4742 | {(char_u *)"",
|
---|
| 4743 | - (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
|
---|
| 4744 | + (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
|
---|
| 4745 | # else
|
---|
| 4746 | - {(char_u *)"", (char_u *)"'20,<50,s10,h"}
|
---|
| 4747 | + {(char_u *)"", (char_u *)"'100,<50,s10,h"}
|
---|
| 4748 | # endif
|
---|
| 4749 | #endif
|
---|
[61a83e8] | 4750 | #else
|
---|
| 4751 | @@ -4119,11 +4119,23 @@
|
---|
| 4752 | && options[opt_idx].var == VAR_WIN)
|
---|
| 4753 | goto skip;
|
---|
| 4754 |
|
---|
| 4755 | - /* Disallow changing some options from modelines */
|
---|
| 4756 | - if ((opt_flags & OPT_MODELINE) && (flags & P_SECURE))
|
---|
| 4757 | + /* Disallow changing some options from modelines. */
|
---|
| 4758 | + if (opt_flags & OPT_MODELINE)
|
---|
| 4759 | {
|
---|
| 4760 | - errmsg = (char_u *)_("E520: Not allowed in a modeline");
|
---|
| 4761 | - goto skip;
|
---|
| 4762 | + if (flags & P_SECURE)
|
---|
| 4763 | + {
|
---|
| 4764 | + errmsg = (char_u *)_("E520: Not allowed in a modeline");
|
---|
| 4765 | + goto skip;
|
---|
| 4766 | + }
|
---|
| 4767 | +#ifdef FEAT_DIFF
|
---|
| 4768 | + /* In diff mode some options are overruled. This avoids that
|
---|
| 4769 | + * 'foldmethod' becomes "marker" instead of "diff" and that
|
---|
| 4770 | + * "wrap" gets set. */
|
---|
| 4771 | + if (curwin->w_p_diff
|
---|
| 4772 | + && (options[opt_idx].indir == PV_FDM
|
---|
| 4773 | + || options[opt_idx].indir == PV_WRAP))
|
---|
| 4774 | + goto skip;
|
---|
| 4775 | +#endif
|
---|
| 4776 | }
|
---|
| 4777 |
|
---|
| 4778 | #ifdef HAVE_SANDBOX
|
---|
| 4779 | @@ -5268,6 +5280,21 @@
|
---|
| 4780 | }
|
---|
| 4781 | #endif
|
---|
| 4782 |
|
---|
| 4783 | +#ifdef FEAT_TITLE
|
---|
| 4784 | +static void redraw_titles __ARGS((void));
|
---|
| 4785 | +
|
---|
| 4786 | +/*
|
---|
| 4787 | + * Redraw the window title and/or tab page text later.
|
---|
| 4788 | + */
|
---|
| 4789 | +static void redraw_titles()
|
---|
| 4790 | +{
|
---|
| 4791 | + need_maketitle = TRUE;
|
---|
| 4792 | +# ifdef FEAT_WINDOWS
|
---|
| 4793 | + redraw_tabline = TRUE;
|
---|
| 4794 | +# endif
|
---|
| 4795 | +}
|
---|
| 4796 | +#endif
|
---|
| 4797 | +
|
---|
| 4798 | /*
|
---|
| 4799 | * Set a string option to a new value (without checking the effect).
|
---|
| 4800 | * The string is copied into allocated memory.
|
---|
[9a875fd] | 4801 | @@ -5407,6 +5434,10 @@
|
---|
| 4802 | int did_chartab = FALSE;
|
---|
| 4803 | char_u **gvarp;
|
---|
| 4804 | long_u free_oldval = (options[opt_idx].flags & P_ALLOCED);
|
---|
| 4805 | +#ifdef FEAT_GUI
|
---|
| 4806 | + /* set when changing an option that only requires a redraw in the GUI */
|
---|
| 4807 | + int redraw_gui_only = FALSE;
|
---|
| 4808 | +#endif
|
---|
| 4809 |
|
---|
| 4810 | /* Get the global option to compare with, otherwise we would have to check
|
---|
[61a83e8] | 4811 | * two values for all local options. */
|
---|
| 4812 | @@ -5668,7 +5699,7 @@
|
---|
| 4813 | {
|
---|
| 4814 | # ifdef FEAT_TITLE
|
---|
| 4815 | /* May show a "+" in the title now. */
|
---|
| 4816 | - need_maketitle = TRUE;
|
---|
| 4817 | + redraw_titles();
|
---|
| 4818 | # endif
|
---|
| 4819 | /* Add 'fileencoding' to the swap file. */
|
---|
| 4820 | ml_setflags(curbuf);
|
---|
| 4821 | @@ -5687,7 +5718,7 @@
|
---|
| 4822 | {
|
---|
| 4823 | errmsg = mb_init();
|
---|
| 4824 | # ifdef FEAT_TITLE
|
---|
| 4825 | - need_maketitle = TRUE;
|
---|
| 4826 | + redraw_titles();
|
---|
| 4827 | # endif
|
---|
| 4828 | }
|
---|
| 4829 | }
|
---|
| 4830 | @@ -5796,7 +5827,7 @@
|
---|
| 4831 | else
|
---|
| 4832 | curbuf->b_p_tx = FALSE;
|
---|
| 4833 | #ifdef FEAT_TITLE
|
---|
| 4834 | - need_maketitle = TRUE;
|
---|
| 4835 | + redraw_titles();
|
---|
| 4836 | #endif
|
---|
| 4837 | /* update flag in swap file */
|
---|
| 4838 | ml_setflags(curbuf);
|
---|
[9a875fd] | 4839 | @@ -6055,6 +6086,7 @@
|
---|
| 4840 | errmsg = (char_u *)N_("E596: Invalid font(s)");
|
---|
| 4841 | }
|
---|
| 4842 | }
|
---|
| 4843 | + redraw_gui_only = TRUE;
|
---|
| 4844 | }
|
---|
| 4845 | # ifdef FEAT_XFONTSET
|
---|
[61a83e8] | 4846 | else if (varp == &p_guifontset)
|
---|
[9a875fd] | 4847 | @@ -6063,6 +6095,7 @@
|
---|
| 4848 | errmsg = (char_u *)N_("E597: can't select fontset");
|
---|
| 4849 | else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
|
---|
| 4850 | errmsg = (char_u *)N_("E598: Invalid fontset");
|
---|
| 4851 | + redraw_gui_only = TRUE;
|
---|
| 4852 | }
|
---|
| 4853 | # endif
|
---|
[61a83e8] | 4854 | # ifdef FEAT_MBYTE
|
---|
[9a875fd] | 4855 | @@ -6072,6 +6105,7 @@
|
---|
| 4856 | errmsg = (char_u *)N_("E533: can't select wide font");
|
---|
| 4857 | else if (gui_get_wide_font() == FAIL)
|
---|
| 4858 | errmsg = (char_u *)N_("E534: Invalid wide font");
|
---|
| 4859 | + redraw_gui_only = TRUE;
|
---|
| 4860 | }
|
---|
| 4861 | # endif
|
---|
[61a83e8] | 4862 | #endif
|
---|
[9a875fd] | 4863 | @@ -6133,13 +6167,24 @@
|
---|
| 4864 | #ifdef FEAT_GUI
|
---|
| 4865 | /* 'guioptions' */
|
---|
| 4866 | else if (varp == &p_go)
|
---|
| 4867 | + {
|
---|
| 4868 | gui_init_which_components(oldval);
|
---|
| 4869 | + redraw_gui_only = TRUE;
|
---|
| 4870 | + }
|
---|
| 4871 | #endif
|
---|
| 4872 |
|
---|
| 4873 | #if defined(FEAT_GUI_TABLINE)
|
---|
| 4874 | /* 'guitablabel' */
|
---|
| 4875 | else if (varp == &p_gtl)
|
---|
| 4876 | + {
|
---|
| 4877 | redraw_tabline = TRUE;
|
---|
| 4878 | + redraw_gui_only = TRUE;
|
---|
| 4879 | + }
|
---|
| 4880 | + /* 'guitabtooltip' */
|
---|
| 4881 | + else if (varp == &p_gtt)
|
---|
| 4882 | + {
|
---|
| 4883 | + redraw_gui_only = TRUE;
|
---|
| 4884 | + }
|
---|
| 4885 | #endif
|
---|
| 4886 |
|
---|
[61a83e8] | 4887 | #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
|
---|
[9a875fd] | 4888 | @@ -6717,7 +6762,11 @@
|
---|
| 4889 |
|
---|
| 4890 | if (curwin->w_curswant != MAXCOL)
|
---|
| 4891 | curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */
|
---|
| 4892 | - check_redraw(options[opt_idx].flags);
|
---|
| 4893 | +#ifdef FEAT_GUI
|
---|
| 4894 | + /* check redraw when it's not a GUI option or the GUI is active. */
|
---|
| 4895 | + if (!redraw_gui_only || gui.in_use)
|
---|
| 4896 | +#endif
|
---|
| 4897 | + check_redraw(options[opt_idx].flags);
|
---|
| 4898 |
|
---|
| 4899 | return errmsg;
|
---|
[61a83e8] | 4900 | }
|
---|
| 4901 | @@ -7105,22 +7154,28 @@
|
---|
| 4902 | curbuf->b_did_warn = FALSE;
|
---|
| 4903 |
|
---|
| 4904 | #ifdef FEAT_TITLE
|
---|
| 4905 | - need_maketitle = TRUE;
|
---|
| 4906 | + redraw_titles();
|
---|
| 4907 | #endif
|
---|
| 4908 | }
|
---|
| 4909 |
|
---|
| 4910 | #ifdef FEAT_TITLE
|
---|
| 4911 | /* when 'modifiable' is changed, redraw the window title */
|
---|
| 4912 | else if ((int *)varp == &curbuf->b_p_ma)
|
---|
| 4913 | - need_maketitle = TRUE;
|
---|
| 4914 | + {
|
---|
| 4915 | + redraw_titles();
|
---|
| 4916 | + }
|
---|
| 4917 | /* when 'endofline' is changed, redraw the window title */
|
---|
| 4918 | else if ((int *)varp == &curbuf->b_p_eol)
|
---|
| 4919 | - need_maketitle = TRUE;
|
---|
| 4920 | -#ifdef FEAT_MBYTE
|
---|
| 4921 | - /* when 'bomb' is changed, redraw the window title */
|
---|
| 4922 | + {
|
---|
| 4923 | + redraw_titles();
|
---|
| 4924 | + }
|
---|
| 4925 | +# ifdef FEAT_MBYTE
|
---|
| 4926 | + /* when 'bomb' is changed, redraw the window title and tab page text */
|
---|
| 4927 | else if ((int *)varp == &curbuf->b_p_bomb)
|
---|
| 4928 | - need_maketitle = TRUE;
|
---|
| 4929 | -#endif
|
---|
| 4930 | + {
|
---|
| 4931 | + redraw_titles();
|
---|
| 4932 | + }
|
---|
| 4933 | +# endif
|
---|
| 4934 | #endif
|
---|
| 4935 |
|
---|
| 4936 | /* when 'bin' is set also set some other options */
|
---|
| 4937 | @@ -7128,7 +7183,7 @@
|
---|
| 4938 | {
|
---|
| 4939 | set_options_bin(old_value, curbuf->b_p_bin, opt_flags);
|
---|
| 4940 | #ifdef FEAT_TITLE
|
---|
| 4941 | - need_maketitle = TRUE;
|
---|
| 4942 | + redraw_titles();
|
---|
| 4943 | #endif
|
---|
| 4944 | }
|
---|
| 4945 |
|
---|
| 4946 | @@ -7279,7 +7334,7 @@
|
---|
| 4947 | if (!value)
|
---|
| 4948 | save_file_ff(curbuf); /* Buffer is unchanged */
|
---|
| 4949 | #ifdef FEAT_TITLE
|
---|
| 4950 | - need_maketitle = TRUE;
|
---|
| 4951 | + redraw_titles();
|
---|
| 4952 | #endif
|
---|
| 4953 | #ifdef FEAT_AUTOCMD
|
---|
| 4954 | modified_was_set = value;
|
---|
| 4955 | @@ -7714,7 +7769,7 @@
|
---|
| 4956 | newFoldLevel();
|
---|
| 4957 | }
|
---|
| 4958 |
|
---|
| 4959 | - /* 'foldminlevel' */
|
---|
| 4960 | + /* 'foldminlines' */
|
---|
| 4961 | else if (pp == &curwin->w_p_fml)
|
---|
| 4962 | {
|
---|
| 4963 | foldUpdateAll(curwin);
|
---|
[76dd250] | 4964 | @@ -7974,6 +8029,11 @@
|
---|
| 4965 | else /* curwin->w_p_scr > curwin->w_height */
|
---|
| 4966 | curwin->w_p_scr = curwin->w_height;
|
---|
| 4967 | }
|
---|
| 4968 | + if (p_hi < 0)
|
---|
| 4969 | + {
|
---|
| 4970 | + errmsg = e_positive;
|
---|
| 4971 | + p_hi = 0;
|
---|
| 4972 | + }
|
---|
| 4973 | if (p_report < 0)
|
---|
| 4974 | {
|
---|
[61a83e8] | 4975 | errmsg = e_positive;
|
---|
[76dd250] | 4976 | @@ -8227,13 +8287,13 @@
|
---|
| 4977 | {
|
---|
| 4978 | if (number == 0 && string != NULL)
|
---|
| 4979 | {
|
---|
| 4980 | - int index;
|
---|
| 4981 | + int idx;
|
---|
| 4982 |
|
---|
| 4983 | /* Either we are given a string or we are setting option
|
---|
| 4984 | * to zero. */
|
---|
| 4985 | - for (index = 0; string[index] == '0'; ++index)
|
---|
| 4986 | + for (idx = 0; string[idx] == '0'; ++idx)
|
---|
| 4987 | ;
|
---|
| 4988 | - if (string[index] != NUL || index == 0)
|
---|
| 4989 | + if (string[idx] != NUL || idx == 0)
|
---|
| 4990 | {
|
---|
| 4991 | /* There's another character after zeros or the string
|
---|
[61a83e8] | 4992 | * is empty. In both cases, we are trying to set a
|
---|
[1f22c7c] | 4993 | @@ -8323,7 +8383,7 @@
|
---|
| 4994 | {
|
---|
| 4995 | --arg; /* put arg at the '<' */
|
---|
| 4996 | modifiers = 0;
|
---|
| 4997 | - key = find_special_key(&arg, &modifiers, TRUE);
|
---|
| 4998 | + key = find_special_key(&arg, &modifiers, TRUE, TRUE);
|
---|
| 4999 | if (modifiers) /* can't handle modifiers here */
|
---|
| 5000 | key = 0;
|
---|
[54f612f] | 5001 | }
|
---|
| 5002 | @@ -10093,25 +10153,110 @@
|
---|
| 5003 |
|
---|
| 5004 | #ifdef FEAT_LANGMAP
|
---|
| 5005 | /*
|
---|
| 5006 | - * Any character has an equivalent character. This is used for keyboards that
|
---|
| 5007 | - * have a special language mode that sends characters above 128 (although
|
---|
| 5008 | - * other characters can be translated too).
|
---|
| 5009 | + * Any character has an equivalent 'langmap' character. This is used for
|
---|
| 5010 | + * keyboards that have a special language mode that sends characters above
|
---|
| 5011 | + * 128 (although other characters can be translated too). The "to" field is a
|
---|
| 5012 | + * Vim command character. This avoids having to switch the keyboard back to
|
---|
| 5013 | + * ASCII mode when leaving Insert mode.
|
---|
| 5014 | + *
|
---|
| 5015 | + * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
|
---|
| 5016 | + * commands.
|
---|
| 5017 | + * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
|
---|
| 5018 | + * langmap_entry_T. This does the same as langmap_mapchar[] for characters >=
|
---|
| 5019 | + * 256.
|
---|
| 5020 | + */
|
---|
| 5021 | +# ifdef FEAT_MBYTE
|
---|
| 5022 | +/*
|
---|
| 5023 | + * With multi-byte support use growarray for 'langmap' chars >= 256
|
---|
| 5024 | */
|
---|
| 5025 | +typedef struct
|
---|
| 5026 | +{
|
---|
| 5027 | + int from;
|
---|
| 5028 | + int to;
|
---|
| 5029 | +} langmap_entry_T;
|
---|
| 5030 | +
|
---|
| 5031 | +static garray_T langmap_mapga;
|
---|
| 5032 | +static void langmap_set_entry __ARGS((int from, int to));
|
---|
| 5033 |
|
---|
| 5034 | /*
|
---|
| 5035 | - * char_u langmap_mapchar[256];
|
---|
| 5036 | - * Normally maps each of the 128 upper chars to an <128 ascii char; used to
|
---|
| 5037 | - * "translate" native lang chars in normal mode or some cases of
|
---|
| 5038 | - * insert mode without having to tediously switch lang mode back&forth.
|
---|
| 5039 | + * Search for an entry in "langmap_mapga" for "from". If found set the "to"
|
---|
| 5040 | + * field. If not found insert a new entry at the appropriate location.
|
---|
| 5041 | */
|
---|
| 5042 | + static void
|
---|
| 5043 | +langmap_set_entry(from, to)
|
---|
| 5044 | + int from;
|
---|
| 5045 | + int to;
|
---|
| 5046 | +{
|
---|
| 5047 | + langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
|
---|
| 5048 | + int a = 0;
|
---|
| 5049 | + int b = langmap_mapga.ga_len;
|
---|
| 5050 | +
|
---|
| 5051 | + /* Do a binary search for an existing entry. */
|
---|
| 5052 | + while (a != b)
|
---|
| 5053 | + {
|
---|
| 5054 | + int i = (a + b) / 2;
|
---|
| 5055 | + int d = entries[i].from - from;
|
---|
| 5056 | +
|
---|
| 5057 | + if (d == 0)
|
---|
| 5058 | + {
|
---|
| 5059 | + entries[i].to = to;
|
---|
| 5060 | + return;
|
---|
| 5061 | + }
|
---|
| 5062 | + if (d < 0)
|
---|
| 5063 | + a = i + 1;
|
---|
| 5064 | + else
|
---|
| 5065 | + b = i;
|
---|
| 5066 | + }
|
---|
| 5067 | +
|
---|
| 5068 | + if (ga_grow(&langmap_mapga, 1) != OK)
|
---|
| 5069 | + return; /* out of memory */
|
---|
| 5070 | +
|
---|
| 5071 | + /* insert new entry at position "a" */
|
---|
| 5072 | + entries = (langmap_entry_T *)(langmap_mapga.ga_data) + a;
|
---|
| 5073 | + mch_memmove(entries + 1, entries,
|
---|
| 5074 | + (langmap_mapga.ga_len - a) * sizeof(langmap_entry_T));
|
---|
| 5075 | + ++langmap_mapga.ga_len;
|
---|
| 5076 | + entries[0].from = from;
|
---|
| 5077 | + entries[0].to = to;
|
---|
| 5078 | +}
|
---|
| 5079 | +
|
---|
| 5080 | +/*
|
---|
| 5081 | + * Apply 'langmap' to multi-byte character "c" and return the result.
|
---|
| 5082 | + */
|
---|
| 5083 | + int
|
---|
| 5084 | +langmap_adjust_mb(c)
|
---|
| 5085 | + int c;
|
---|
| 5086 | +{
|
---|
| 5087 | + langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
|
---|
| 5088 | + int a = 0;
|
---|
| 5089 | + int b = langmap_mapga.ga_len;
|
---|
| 5090 | +
|
---|
| 5091 | + while (a != b)
|
---|
| 5092 | + {
|
---|
| 5093 | + int i = (a + b) / 2;
|
---|
| 5094 | + int d = entries[i].from - c;
|
---|
| 5095 | +
|
---|
| 5096 | + if (d == 0)
|
---|
| 5097 | + return entries[i].to; /* found matching entry */
|
---|
| 5098 | + if (d < 0)
|
---|
| 5099 | + a = i + 1;
|
---|
| 5100 | + else
|
---|
| 5101 | + b = i;
|
---|
| 5102 | + }
|
---|
| 5103 | + return c; /* no entry found, return "c" unmodified */
|
---|
| 5104 | +}
|
---|
| 5105 | +# endif
|
---|
| 5106 |
|
---|
| 5107 | static void
|
---|
| 5108 | langmap_init()
|
---|
| 5109 | {
|
---|
| 5110 | int i;
|
---|
| 5111 |
|
---|
| 5112 | - for (i = 0; i < 256; i++) /* we init with a-one-to one map */
|
---|
| 5113 | - langmap_mapchar[i] = i;
|
---|
| 5114 | + for (i = 0; i < 256; i++)
|
---|
| 5115 | + langmap_mapchar[i] = i; /* we init with a one-to-one map */
|
---|
| 5116 | +# ifdef FEAT_MBYTE
|
---|
| 5117 | + ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8);
|
---|
| 5118 | +# endif
|
---|
| 5119 | }
|
---|
| 5120 |
|
---|
| 5121 | /*
|
---|
| 5122 | @@ -10125,7 +10270,10 @@
|
---|
| 5123 | char_u *p2;
|
---|
| 5124 | int from, to;
|
---|
| 5125 |
|
---|
| 5126 | - langmap_init(); /* back to one-to-one map first */
|
---|
| 5127 | +#ifdef FEAT_MBYTE
|
---|
| 5128 | + ga_clear(&langmap_mapga); /* clear the previous map first */
|
---|
| 5129 | +#endif
|
---|
| 5130 | + langmap_init(); /* back to one-to-one map */
|
---|
| 5131 |
|
---|
| 5132 | for (p = p_langmap; p[0] != NUL; )
|
---|
| 5133 | {
|
---|
| 5134 | @@ -10175,7 +10323,13 @@
|
---|
| 5135 | transchar(from));
|
---|
| 5136 | return;
|
---|
| 5137 | }
|
---|
| 5138 | - langmap_mapchar[from & 255] = to;
|
---|
| 5139 | +
|
---|
| 5140 | +#ifdef FEAT_MBYTE
|
---|
| 5141 | + if (from >= 256)
|
---|
| 5142 | + langmap_set_entry(from, to);
|
---|
| 5143 | + else
|
---|
| 5144 | +#endif
|
---|
| 5145 | + langmap_mapchar[from & 255] = to;
|
---|
| 5146 |
|
---|
| 5147 | /* Advance to next pair */
|
---|
[76dd250] | 5148 | mb_ptr_adv(p);
|
---|
| 5149 | diff -Naur vim72.orig/src/os_unix.c vim72/src/os_unix.c
|
---|
[54f612f] | 5150 | --- vim72.orig/src/os_unix.c 2008-08-06 04:01:40.000000000 -0700
|
---|
[76dd250] | 5151 | +++ vim72/src/os_unix.c 2009-02-22 21:58:03.102786422 -0800
|
---|
| 5152 | @@ -315,12 +315,15 @@
|
---|
| 5153 | {-1, "Unknown!", FALSE}
|
---|
| 5154 | };
|
---|
| 5155 |
|
---|
| 5156 | +/*
|
---|
| 5157 | + * Write s[len] to the screen.
|
---|
| 5158 | + */
|
---|
| 5159 | void
|
---|
| 5160 | mch_write(s, len)
|
---|
| 5161 | char_u *s;
|
---|
| 5162 | int len;
|
---|
| 5163 | {
|
---|
| 5164 | - write(1, (char *)s, len);
|
---|
| 5165 | + ignored = (int)write(1, (char *)s, len);
|
---|
| 5166 | if (p_wd) /* Unix is too fast, slow down a bit more */
|
---|
| 5167 | RealWaitForChar(read_cmd_fd, p_wd, NULL);
|
---|
| 5168 | }
|
---|
| 5169 | @@ -2905,7 +2908,7 @@
|
---|
| 5170 | * Ignore any errors.
|
---|
| 5171 | */
|
---|
| 5172 | #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
|
---|
| 5173 | - signal_stack = malloc(SIGSTKSZ);
|
---|
| 5174 | + signal_stack = (char *)alloc(SIGSTKSZ);
|
---|
| 5175 | init_signal_stack();
|
---|
| 5176 | #endif
|
---|
| 5177 | }
|
---|
| 5178 | @@ -2936,7 +2939,8 @@
|
---|
| 5179 | }
|
---|
| 5180 | # endif
|
---|
| 5181 | # endif
|
---|
| 5182 | -# ifdef FEAT_X11
|
---|
| 5183 | + /* Don't close the display for GTK 1, it is done in exit(). */
|
---|
| 5184 | +# if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2))
|
---|
| 5185 | if (x11_display != NULL
|
---|
| 5186 | # ifdef FEAT_XCLIPBOARD
|
---|
| 5187 | && x11_display != xterm_dpy
|
---|
| 5188 | @@ -3926,9 +3930,9 @@
|
---|
| 5189 | */
|
---|
| 5190 | if (fd >= 0)
|
---|
| 5191 | {
|
---|
| 5192 | - dup(fd); /* To replace stdin (file descriptor 0) */
|
---|
| 5193 | - dup(fd); /* To replace stdout (file descriptor 1) */
|
---|
| 5194 | - dup(fd); /* To replace stderr (file descriptor 2) */
|
---|
| 5195 | + ignored = dup(fd); /* To replace stdin (fd 0) */
|
---|
| 5196 | + ignored = dup(fd); /* To replace stdout (fd 1) */
|
---|
| 5197 | + ignored = dup(fd); /* To replace stderr (fd 2) */
|
---|
| 5198 |
|
---|
| 5199 | /* Don't need this now that we've duplicated it */
|
---|
[9a875fd] | 5200 | close(fd);
|
---|
| 5201 | @@ -3946,7 +3950,17 @@
|
---|
| 5202 | * children can be kill()ed. Don't do this when using pipes,
|
---|
| 5203 | * because stdin is not a tty, we would lose /dev/tty. */
|
---|
| 5204 | if (p_stmp)
|
---|
| 5205 | + {
|
---|
| 5206 | (void)setsid();
|
---|
| 5207 | +# if defined(SIGHUP)
|
---|
| 5208 | + /* When doing "!xterm&" and 'shell' is bash: the shell
|
---|
| 5209 | + * will exit and send SIGHUP to all processes in its
|
---|
| 5210 | + * group, killing the just started process. Ignore SIGHUP
|
---|
| 5211 | + * to avoid that. (suggested by Simon Schubert)
|
---|
| 5212 | + */
|
---|
| 5213 | + signal(SIGHUP, SIG_IGN);
|
---|
| 5214 | +# endif
|
---|
| 5215 | + }
|
---|
| 5216 | # endif
|
---|
| 5217 | # ifdef FEAT_GUI
|
---|
| 5218 | if (pty_slave_fd >= 0)
|
---|
[76dd250] | 5219 | @@ -3996,13 +4010,13 @@
|
---|
| 5220 |
|
---|
| 5221 | /* set up stdin/stdout/stderr for the child */
|
---|
| 5222 | close(0);
|
---|
| 5223 | - dup(pty_slave_fd);
|
---|
| 5224 | + ignored = dup(pty_slave_fd);
|
---|
| 5225 | close(1);
|
---|
| 5226 | - dup(pty_slave_fd);
|
---|
| 5227 | + ignored = dup(pty_slave_fd);
|
---|
| 5228 | if (gui.in_use)
|
---|
| 5229 | {
|
---|
| 5230 | close(2);
|
---|
| 5231 | - dup(pty_slave_fd);
|
---|
| 5232 | + ignored = dup(pty_slave_fd);
|
---|
| 5233 | }
|
---|
| 5234 |
|
---|
[9a875fd] | 5235 | close(pty_slave_fd); /* has been dupped, close it now */
|
---|
[76dd250] | 5236 | @@ -4013,13 +4027,13 @@
|
---|
| 5237 | /* set up stdin for the child */
|
---|
| 5238 | close(fd_toshell[1]);
|
---|
| 5239 | close(0);
|
---|
| 5240 | - dup(fd_toshell[0]);
|
---|
| 5241 | + ignored = dup(fd_toshell[0]);
|
---|
| 5242 | close(fd_toshell[0]);
|
---|
| 5243 |
|
---|
| 5244 | /* set up stdout for the child */
|
---|
| 5245 | close(fd_fromshell[0]);
|
---|
| 5246 | close(1);
|
---|
| 5247 | - dup(fd_fromshell[1]);
|
---|
| 5248 | + ignored = dup(fd_fromshell[1]);
|
---|
| 5249 | close(fd_fromshell[1]);
|
---|
| 5250 |
|
---|
[9a875fd] | 5251 | # ifdef FEAT_GUI
|
---|
[76dd250] | 5252 | @@ -4027,7 +4041,7 @@
|
---|
| 5253 | {
|
---|
| 5254 | /* set up stderr for the child */
|
---|
| 5255 | close(2);
|
---|
| 5256 | - dup(1);
|
---|
| 5257 | + ignored = dup(1);
|
---|
| 5258 | }
|
---|
| 5259 | # endif
|
---|
[54f612f] | 5260 | }
|
---|
| 5261 | @@ -4078,6 +4092,9 @@
|
---|
| 5262 | int fromshell_fd;
|
---|
| 5263 | garray_T ga;
|
---|
| 5264 | int noread_cnt;
|
---|
| 5265 | +# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
|
---|
| 5266 | + struct timeval start_tv;
|
---|
| 5267 | +# endif
|
---|
| 5268 |
|
---|
| 5269 | # ifdef FEAT_GUI
|
---|
| 5270 | if (pty_master_fd >= 0)
|
---|
[76dd250] | 5271 | @@ -4158,7 +4175,8 @@
|
---|
| 5272 | && (lnum !=
|
---|
| 5273 | curbuf->b_ml.ml_line_count
|
---|
| 5274 | || curbuf->b_p_eol)))
|
---|
| 5275 | - write(toshell_fd, "\n", (size_t)1);
|
---|
| 5276 | + ignored = write(toshell_fd, "\n",
|
---|
| 5277 | + (size_t)1);
|
---|
| 5278 | ++lnum;
|
---|
| 5279 | if (lnum > curbuf->b_op_end.lnum)
|
---|
[54f612f] | 5280 | {
|
---|
| 5281 | @@ -4186,7 +4204,9 @@
|
---|
| 5282 | ga_init2(&ga, 1, BUFLEN);
|
---|
| 5283 |
|
---|
| 5284 | noread_cnt = 0;
|
---|
| 5285 | -
|
---|
| 5286 | +# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
|
---|
| 5287 | + gettimeofday(&start_tv, NULL);
|
---|
| 5288 | +# endif
|
---|
| 5289 | for (;;)
|
---|
| 5290 | {
|
---|
| 5291 | /*
|
---|
| 5292 | @@ -4199,25 +4219,34 @@
|
---|
| 5293 | * that a typed password is echoed for ssh or gpg command.
|
---|
| 5294 | * Don't get characters when the child has already
|
---|
| 5295 | * finished (wait_pid == 0).
|
---|
| 5296 | - * Don't get extra characters when we already have one.
|
---|
| 5297 | * Don't read characters unless we didn't get output for a
|
---|
| 5298 | - * while, avoids that ":r !ls" eats typeahead.
|
---|
| 5299 | + * while (noread_cnt > 4), avoids that ":r !ls" eats
|
---|
| 5300 | + * typeahead.
|
---|
| 5301 | */
|
---|
| 5302 | len = 0;
|
---|
| 5303 | if (!(options & SHELL_EXPAND)
|
---|
| 5304 | && ((options &
|
---|
| 5305 | (SHELL_READ|SHELL_WRITE|SHELL_COOKED))
|
---|
| 5306 | != (SHELL_READ|SHELL_WRITE|SHELL_COOKED)
|
---|
| 5307 | -#ifdef FEAT_GUI
|
---|
| 5308 | +# ifdef FEAT_GUI
|
---|
| 5309 | || gui.in_use
|
---|
| 5310 | -#endif
|
---|
| 5311 | +# endif
|
---|
| 5312 | )
|
---|
| 5313 | && wait_pid == 0
|
---|
| 5314 | - && (ta_len > 0
|
---|
| 5315 | - || (noread_cnt > 4
|
---|
| 5316 | - && (len = ui_inchar(ta_buf,
|
---|
| 5317 | - BUFLEN, 10L, 0)) > 0)))
|
---|
| 5318 | + && (ta_len > 0 || noread_cnt > 4))
|
---|
| 5319 | {
|
---|
| 5320 | + if (ta_len == 0)
|
---|
| 5321 | + {
|
---|
| 5322 | + /* Get extra characters when we don't have any.
|
---|
| 5323 | + * Reset the counter and timer. */
|
---|
| 5324 | + noread_cnt = 0;
|
---|
| 5325 | +# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
|
---|
| 5326 | + gettimeofday(&start_tv, NULL);
|
---|
| 5327 | +# endif
|
---|
| 5328 | + len = ui_inchar(ta_buf, BUFLEN, 10L, 0);
|
---|
| 5329 | + }
|
---|
| 5330 | + if (ta_len > 0 || len > 0)
|
---|
| 5331 | + {
|
---|
| 5332 | /*
|
---|
| 5333 | * For pipes:
|
---|
| 5334 | * Check for CTRL-C: send interrupt signal to child.
|
---|
| 5335 | @@ -4319,9 +4348,9 @@
|
---|
| 5336 | {
|
---|
| 5337 | ta_len -= len;
|
---|
| 5338 | mch_memmove(ta_buf, ta_buf + len, ta_len);
|
---|
| 5339 | - noread_cnt = 0;
|
---|
| 5340 | }
|
---|
| 5341 | }
|
---|
| 5342 | + }
|
---|
| 5343 | }
|
---|
| 5344 |
|
---|
| 5345 | if (got_int)
|
---|
| 5346 | @@ -4429,6 +4458,25 @@
|
---|
| 5347 | out_flush();
|
---|
| 5348 | if (got_int)
|
---|
| 5349 | break;
|
---|
| 5350 | +
|
---|
| 5351 | +# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
|
---|
| 5352 | + {
|
---|
| 5353 | + struct timeval now_tv;
|
---|
| 5354 | + long msec;
|
---|
| 5355 | +
|
---|
| 5356 | + /* Avoid that we keep looping here without
|
---|
| 5357 | + * checking for a CTRL-C for a long time. Don't
|
---|
| 5358 | + * break out too often to avoid losing typeahead. */
|
---|
| 5359 | + gettimeofday(&now_tv, NULL);
|
---|
| 5360 | + msec = (now_tv.tv_sec - start_tv.tv_sec) * 1000L
|
---|
| 5361 | + + (now_tv.tv_usec - start_tv.tv_usec) / 1000L;
|
---|
| 5362 | + if (msec > 2000)
|
---|
| 5363 | + {
|
---|
| 5364 | + noread_cnt = 5;
|
---|
| 5365 | + break;
|
---|
| 5366 | + }
|
---|
| 5367 | + }
|
---|
| 5368 | +# endif
|
---|
| 5369 | }
|
---|
| 5370 |
|
---|
| 5371 | /* If we already detected the child has finished break the
|
---|
[76dd250] | 5372 | @@ -6814,7 +6862,8 @@
|
---|
| 5373 | if (xsmp_icefd != -1)
|
---|
| 5374 | {
|
---|
| 5375 | SmcCloseConnection(xsmp.smcconn, 0, NULL);
|
---|
| 5376 | - vim_free(xsmp.clientid);
|
---|
| 5377 | + if (xsmp.clientid != NULL)
|
---|
| 5378 | + free(xsmp.clientid);
|
---|
| 5379 | xsmp.clientid = NULL;
|
---|
| 5380 | xsmp_icefd = -1;
|
---|
| 5381 | }
|
---|
| 5382 | diff -Naur vim72.orig/src/proto/eval.pro vim72/src/proto/eval.pro
|
---|
[54f612f] | 5383 | --- vim72.orig/src/proto/eval.pro 2008-08-09 07:31:25.000000000 -0700
|
---|
[76dd250] | 5384 | +++ vim72/src/proto/eval.pro 2009-02-22 21:57:36.373071657 -0800
|
---|
| 5385 | @@ -17,7 +17,7 @@
|
---|
| 5386 | int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip));
|
---|
| 5387 | char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip));
|
---|
| 5388 | int skip_expr __ARGS((char_u **pp));
|
---|
| 5389 | -char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));
|
---|
| 5390 | +char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert));
|
---|
| 5391 | char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox));
|
---|
| 5392 | int eval_to_number __ARGS((char_u *expr));
|
---|
| 5393 | list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
|
---|
| 5394 | @@ -46,7 +46,9 @@
|
---|
| 5395 | void list_unref __ARGS((list_T *l));
|
---|
| 5396 | void list_free __ARGS((list_T *l, int recurse));
|
---|
| 5397 | dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
|
---|
| 5398 | +char_u *list_find_str __ARGS((list_T *l, long idx));
|
---|
| 5399 | int list_append_dict __ARGS((list_T *list, dict_T *dict));
|
---|
| 5400 | +int list_append_string __ARGS((list_T *l, char_u *str, int len));
|
---|
| 5401 | int garbage_collect __ARGS((void));
|
---|
| 5402 | dict_T *dict_alloc __ARGS((void));
|
---|
| 5403 | int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
|
---|
| 5404 | @@ -58,8 +60,10 @@
|
---|
| 5405 | void set_vim_var_nr __ARGS((int idx, long val));
|
---|
| 5406 | long get_vim_var_nr __ARGS((int idx));
|
---|
| 5407 | char_u *get_vim_var_str __ARGS((int idx));
|
---|
| 5408 | -void set_vcount __ARGS((long count, long count1));
|
---|
| 5409 | +list_T *get_vim_var_list __ARGS((int idx));
|
---|
| 5410 | +void set_vcount __ARGS((long count, long count1, int set_prevcount));
|
---|
| 5411 | void set_vim_var_string __ARGS((int idx, char_u *val, int len));
|
---|
| 5412 | +void set_vim_var_list __ARGS((int idx, list_T *val));
|
---|
| 5413 | void set_reg_var __ARGS((int c));
|
---|
| 5414 | char_u *v_exception __ARGS((char_u *oldval));
|
---|
| 5415 | char_u *v_throwpoint __ARGS((char_u *oldval));
|
---|
| 5416 | @@ -94,6 +98,7 @@
|
---|
| 5417 | void write_viminfo_varlist __ARGS((FILE *fp));
|
---|
| 5418 | int store_session_globals __ARGS((FILE *fd));
|
---|
| 5419 | void last_set_msg __ARGS((scid_T scriptID));
|
---|
| 5420 | +void ex_oldfiles __ARGS((exarg_T *eap));
|
---|
| 5421 | int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
|
---|
| 5422 | char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
|
---|
| 5423 | /* vim: set ft=c : */
|
---|
| 5424 | diff -Naur vim72.orig/src/proto/ex_cmds.pro vim72/src/proto/ex_cmds.pro
|
---|
[54f612f] | 5425 | --- vim72.orig/src/proto/ex_cmds.pro 2008-08-09 07:31:25.000000000 -0700
|
---|
[76dd250] | 5426 | +++ vim72/src/proto/ex_cmds.pro 2009-02-22 21:57:28.916594496 -0800
|
---|
| 5427 | @@ -11,7 +11,7 @@
|
---|
| 5428 | char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
|
---|
| 5429 | void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
|
---|
| 5430 | int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
|
---|
| 5431 | -int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
|
---|
| 5432 | +int read_viminfo __ARGS((char_u *file, int flags));
|
---|
| 5433 | void write_viminfo __ARGS((char_u *file, int forceit));
|
---|
| 5434 | int viminfo_readline __ARGS((vir_T *virp));
|
---|
| 5435 | char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
|
---|
| 5436 | diff -Naur vim72.orig/src/proto/ex_getln.pro vim72/src/proto/ex_getln.pro
|
---|
[54f612f] | 5437 | --- vim72.orig/src/proto/ex_getln.pro 2008-08-09 07:31:28.000000000 -0700
|
---|
[76dd250] | 5438 | +++ vim72/src/proto/ex_getln.pro 2009-02-22 21:57:40.525339851 -0800
|
---|
| 5439 | @@ -31,7 +31,7 @@
|
---|
| 5440 | void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
|
---|
| 5441 | int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
|
---|
| 5442 | int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
|
---|
| 5443 | -char_u *globpath __ARGS((char_u *path, char_u *file));
|
---|
| 5444 | +char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
|
---|
| 5445 | void init_history __ARGS((void));
|
---|
| 5446 | int get_histtype __ARGS((char_u *name));
|
---|
| 5447 | void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
|
---|
| 5448 | diff -Naur vim72.orig/src/proto/mark.pro vim72/src/proto/mark.pro
|
---|
[54f612f] | 5449 | --- vim72.orig/src/proto/mark.pro 2008-08-09 07:31:36.000000000 -0700
|
---|
[76dd250] | 5450 | +++ vim72/src/proto/mark.pro 2009-02-22 21:57:28.916594496 -0800
|
---|
| 5451 | @@ -26,5 +26,5 @@
|
---|
| 5452 | void write_viminfo_filemarks __ARGS((FILE *fp));
|
---|
| 5453 | int removable __ARGS((char_u *name));
|
---|
| 5454 | int write_viminfo_marks __ARGS((FILE *fp_out));
|
---|
| 5455 | -void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof));
|
---|
| 5456 | +void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags));
|
---|
[1f22c7c] | 5457 | /* vim: set ft=c : */
|
---|
| 5458 | diff -Naur vim72.orig/src/proto/misc2.pro vim72/src/proto/misc2.pro
|
---|
[54f612f] | 5459 | --- vim72.orig/src/proto/misc2.pro 2008-08-09 07:31:40.000000000 -0700
|
---|
[1f22c7c] | 5460 | +++ vim72/src/proto/misc2.pro 2009-02-22 21:57:46.089694370 -0800
|
---|
| 5461 | @@ -59,7 +59,7 @@
|
---|
| 5462 | int handle_x_keys __ARGS((int key));
|
---|
| 5463 | char_u *get_special_key_name __ARGS((int c, int modifiers));
|
---|
| 5464 | int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode));
|
---|
| 5465 | -int find_special_key __ARGS((char_u **srcp, int *modp, int keycode));
|
---|
| 5466 | +int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key));
|
---|
| 5467 | int extract_modifiers __ARGS((int key, int *modp));
|
---|
| 5468 | int find_special_key_in_table __ARGS((int c));
|
---|
[43c52a1] | 5469 | int get_special_key_code __ARGS((char_u *name));
|
---|
| 5470 | diff -Naur vim72.orig/src/proto/netbeans.pro vim72/src/proto/netbeans.pro
|
---|
[54f612f] | 5471 | --- vim72.orig/src/proto/netbeans.pro 2008-08-09 07:31:56.000000000 -0700
|
---|
[43c52a1] | 5472 | +++ vim72/src/proto/netbeans.pro 2009-02-22 21:57:51.698055873 -0800
|
---|
| 5473 | @@ -11,7 +11,7 @@
|
---|
| 5474 | void netbeans_frame_moved __ARGS((int new_x, int new_y));
|
---|
| 5475 | void netbeans_file_activated __ARGS((buf_T *bufp));
|
---|
| 5476 | void netbeans_file_opened __ARGS((buf_T *bufp));
|
---|
| 5477 | -void netbeans_file_closed __ARGS((buf_T *bufp));
|
---|
| 5478 | +void netbeans_file_killed __ARGS((buf_T *bufp));
|
---|
| 5479 | void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen));
|
---|
| 5480 | void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
|
---|
[54f612f] | 5481 | void netbeans_unmodified __ARGS((buf_T *bufp));
|
---|
| 5482 | diff -Naur vim72.orig/src/proto/option.pro vim72/src/proto/option.pro
|
---|
| 5483 | --- vim72.orig/src/proto/option.pro 2008-08-09 07:31:43.000000000 -0700
|
---|
| 5484 | +++ vim72/src/proto/option.pro 2009-02-22 21:58:02.966778320 -0800
|
---|
| 5485 | @@ -44,6 +44,7 @@
|
---|
| 5486 | void set_context_in_set_cmd __ARGS((expand_T *xp, char_u *arg, int opt_flags));
|
---|
| 5487 | int ExpandSettings __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
|
---|
| 5488 | int ExpandOldSetting __ARGS((int *num_file, char_u ***file));
|
---|
| 5489 | +int langmap_adjust_mb __ARGS((int c));
|
---|
| 5490 | int has_format_option __ARGS((int x));
|
---|
| 5491 | int shortmess __ARGS((int x));
|
---|
[76dd250] | 5492 | void vimrc_found __ARGS((char_u *fname, char_u *envname));
|
---|
| 5493 | diff -Naur vim72.orig/src/pty.c vim72/src/pty.c
|
---|
[54f612f] | 5494 | --- vim72.orig/src/pty.c 2008-06-21 11:52:58.000000000 -0700
|
---|
[76dd250] | 5495 | +++ vim72/src/pty.c 2009-02-22 21:57:25.600383852 -0800
|
---|
| 5496 | @@ -270,9 +270,10 @@
|
---|
| 5497 | }
|
---|
| 5498 | #endif
|
---|
| 5499 |
|
---|
| 5500 | -#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux)
|
---|
| 5501 | +#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X)
|
---|
| 5502 |
|
---|
| 5503 | -/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */
|
---|
| 5504 | +/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
|
---|
| 5505 | + * Same for Mac OS X Leopard. */
|
---|
| 5506 | #define PTY_DONE
|
---|
| 5507 | int
|
---|
[54f612f] | 5508 | OpenPTY(ttyn)
|
---|
| 5509 | diff -Naur vim72.orig/src/quickfix.c vim72/src/quickfix.c
|
---|
| 5510 | --- vim72.orig/src/quickfix.c 2008-07-18 05:53:02.000000000 -0700
|
---|
| 5511 | +++ vim72/src/quickfix.c 2009-02-22 21:58:03.086785863 -0800
|
---|
| 5512 | @@ -1419,6 +1419,7 @@
|
---|
| 5513 | int opened_window = FALSE;
|
---|
| 5514 | win_T *win;
|
---|
| 5515 | win_T *altwin;
|
---|
| 5516 | + int flags;
|
---|
| 5517 | #endif
|
---|
| 5518 | int print_message = TRUE;
|
---|
| 5519 | int len;
|
---|
| 5520 | @@ -1530,7 +1531,6 @@
|
---|
| 5521 | if (qf_ptr->qf_type == 1 && (!curwin->w_buffer->b_help || cmdmod.tab != 0))
|
---|
| 5522 | {
|
---|
| 5523 | win_T *wp;
|
---|
| 5524 | - int n;
|
---|
| 5525 |
|
---|
| 5526 | if (cmdmod.tab != 0)
|
---|
| 5527 | wp = NULL;
|
---|
| 5528 | @@ -1546,13 +1546,16 @@
|
---|
| 5529 | * Split off help window; put it at far top if no position
|
---|
| 5530 | * specified, the current window is vertically split and narrow.
|
---|
| 5531 | */
|
---|
| 5532 | - n = WSP_HELP;
|
---|
| 5533 | + flags = WSP_HELP;
|
---|
| 5534 | # ifdef FEAT_VERTSPLIT
|
---|
| 5535 | if (cmdmod.split == 0 && curwin->w_width != Columns
|
---|
| 5536 | && curwin->w_width < 80)
|
---|
| 5537 | - n |= WSP_TOP;
|
---|
| 5538 | + flags |= WSP_TOP;
|
---|
| 5539 | # endif
|
---|
| 5540 | - if (win_split(0, n) == FAIL)
|
---|
| 5541 | + if (qi != &ql_info)
|
---|
| 5542 | + flags |= WSP_NEWLOC; /* don't copy the location list */
|
---|
| 5543 | +
|
---|
| 5544 | + if (win_split(0, flags) == FAIL)
|
---|
| 5545 | goto theend;
|
---|
| 5546 | opened_window = TRUE; /* close it when fail */
|
---|
| 5547 |
|
---|
| 5548 | @@ -1562,7 +1565,6 @@
|
---|
| 5549 | if (qi != &ql_info) /* not a quickfix list */
|
---|
| 5550 | {
|
---|
| 5551 | /* The new window should use the supplied location list */
|
---|
| 5552 | - qf_free_all(curwin);
|
---|
| 5553 | curwin->w_llist = qi;
|
---|
| 5554 | qi->qf_refcount++;
|
---|
| 5555 | }
|
---|
| 5556 | @@ -1609,10 +1611,11 @@
|
---|
| 5557 | {
|
---|
| 5558 | goto_tabpage_win(tp, wp);
|
---|
| 5559 | usable_win = 1;
|
---|
| 5560 | - break;
|
---|
| 5561 | + goto win_found;
|
---|
| 5562 | }
|
---|
| 5563 | }
|
---|
| 5564 | }
|
---|
| 5565 | +win_found:
|
---|
| 5566 |
|
---|
| 5567 | /*
|
---|
| 5568 | * If there is only one window and it is the quickfix window, create a
|
---|
| 5569 | @@ -1622,7 +1625,10 @@
|
---|
| 5570 | {
|
---|
| 5571 | ll_ref = curwin->w_llist_ref;
|
---|
| 5572 |
|
---|
| 5573 | - if (win_split(0, WSP_ABOVE) == FAIL)
|
---|
| 5574 | + flags = WSP_ABOVE;
|
---|
| 5575 | + if (ll_ref != NULL)
|
---|
| 5576 | + flags |= WSP_NEWLOC;
|
---|
| 5577 | + if (win_split(0, flags) == FAIL)
|
---|
| 5578 | goto failed; /* not enough room for window */
|
---|
| 5579 | opened_window = TRUE; /* close it when fail */
|
---|
| 5580 | p_swb = empty_option; /* don't split again */
|
---|
| 5581 | @@ -1634,7 +1640,6 @@
|
---|
| 5582 | {
|
---|
| 5583 | /* The new window should use the location list from the
|
---|
| 5584 | * location list window */
|
---|
| 5585 | - qf_free_all(curwin);
|
---|
| 5586 | curwin->w_llist = ll_ref;
|
---|
| 5587 | ll_ref->qf_refcount++;
|
---|
| 5588 | }
|
---|
| 5589 | @@ -2307,15 +2312,12 @@
|
---|
| 5590 | if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
|
---|
| 5591 | /* Create the new window at the very bottom. */
|
---|
| 5592 | win_goto(lastwin);
|
---|
| 5593 | - if (win_split(height, WSP_BELOW) == FAIL)
|
---|
| 5594 | + if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
|
---|
| 5595 | return; /* not enough room for window */
|
---|
| 5596 | #ifdef FEAT_SCROLLBIND
|
---|
| 5597 | curwin->w_p_scb = FALSE;
|
---|
| 5598 | #endif
|
---|
| 5599 |
|
---|
| 5600 | - /* Remove the location list for the quickfix window */
|
---|
| 5601 | - qf_free_all(curwin);
|
---|
| 5602 | -
|
---|
| 5603 | if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
|
---|
| 5604 | {
|
---|
| 5605 | /*
|
---|
| 5606 | diff -Naur vim72.orig/src/regexp.c vim72/src/regexp.c
|
---|
| 5607 | --- vim72.orig/src/regexp.c 2008-08-07 12:58:50.000000000 -0700
|
---|
| 5608 | +++ vim72/src/regexp.c 2009-02-22 21:58:03.014779438 -0800
|
---|
| 5609 | @@ -4532,7 +4532,7 @@
|
---|
| 5610 | cleanup_subexpr();
|
---|
| 5611 | if (!REG_MULTI) /* Single-line regexp */
|
---|
| 5612 | {
|
---|
| 5613 | - if (reg_endp[no] == NULL)
|
---|
| 5614 | + if (reg_startp[no] == NULL || reg_endp[no] == NULL)
|
---|
| 5615 | {
|
---|
| 5616 | /* Backref was not set: Match an empty string. */
|
---|
| 5617 | len = 0;
|
---|
| 5618 | @@ -4548,7 +4548,7 @@
|
---|
| 5619 | }
|
---|
| 5620 | else /* Multi-line regexp */
|
---|
| 5621 | {
|
---|
| 5622 | - if (reg_endpos[no].lnum < 0)
|
---|
| 5623 | + if (reg_startpos[no].lnum < 0 || reg_endpos[no].lnum < 0)
|
---|
| 5624 | {
|
---|
| 5625 | /* Backref was not set: Match an empty string. */
|
---|
| 5626 | len = 0;
|
---|
| 5627 | @@ -7279,13 +7279,11 @@
|
---|
| 5628 | }
|
---|
| 5629 | else
|
---|
| 5630 | {
|
---|
| 5631 | - if (submatch_match->endp[no] == NULL)
|
---|
| 5632 | + s = submatch_match->startp[no];
|
---|
| 5633 | + if (s == NULL || submatch_match->endp[no] == NULL)
|
---|
| 5634 | retval = NULL;
|
---|
| 5635 | else
|
---|
| 5636 | - {
|
---|
| 5637 | - s = submatch_match->startp[no];
|
---|
| 5638 | retval = vim_strnsave(s, (int)(submatch_match->endp[no] - s));
|
---|
| 5639 | - }
|
---|
| 5640 | }
|
---|
| 5641 |
|
---|
[76dd250] | 5642 | return retval;
|
---|
| 5643 | diff -Naur vim72.orig/src/screen.c vim72/src/screen.c
|
---|
[54f612f] | 5644 | --- vim72.orig/src/screen.c 2008-07-24 07:45:07.000000000 -0700
|
---|
[76dd250] | 5645 | +++ vim72/src/screen.c 2009-02-22 21:58:03.114787819 -0800
|
---|
| 5646 | @@ -2439,9 +2439,17 @@
|
---|
| 5647 |
|
---|
| 5648 | #ifdef FEAT_SYN_HL
|
---|
| 5649 | /* Show 'cursorcolumn' in the fold line. */
|
---|
| 5650 | - if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp))
|
---|
| 5651 | - ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr(
|
---|
| 5652 | - ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC));
|
---|
| 5653 | + if (wp->w_p_cuc)
|
---|
| 5654 | + {
|
---|
| 5655 | + txtcol += wp->w_virtcol;
|
---|
| 5656 | + if (wp->w_p_wrap)
|
---|
| 5657 | + txtcol -= wp->w_skipcol;
|
---|
| 5658 | + else
|
---|
| 5659 | + txtcol -= wp->w_leftcol;
|
---|
| 5660 | + if (txtcol >= 0 && txtcol < W_WIDTH(wp))
|
---|
| 5661 | + ScreenAttrs[off + txtcol] = hl_combine_attr(
|
---|
| 5662 | + ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
|
---|
| 5663 | + }
|
---|
| 5664 | #endif
|
---|
| 5665 |
|
---|
[54f612f] | 5666 | SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
|
---|
| 5667 | @@ -2588,6 +2596,7 @@
|
---|
| 5668 | int noinvcur = FALSE; /* don't invert the cursor */
|
---|
| 5669 | #ifdef FEAT_VISUAL
|
---|
| 5670 | pos_T *top, *bot;
|
---|
| 5671 | + int lnum_in_visual_area = FALSE;
|
---|
| 5672 | #endif
|
---|
| 5673 | pos_T pos;
|
---|
| 5674 | long v;
|
---|
| 5675 | @@ -2784,9 +2793,10 @@
|
---|
| 5676 | top = &VIsual;
|
---|
| 5677 | bot = &curwin->w_cursor;
|
---|
| 5678 | }
|
---|
| 5679 | + lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum);
|
---|
| 5680 | if (VIsual_mode == Ctrl_V) /* block mode */
|
---|
| 5681 | {
|
---|
| 5682 | - if (lnum >= top->lnum && lnum <= bot->lnum)
|
---|
| 5683 | + if (lnum_in_visual_area)
|
---|
| 5684 | {
|
---|
| 5685 | fromcol = wp->w_old_cursor_fcol;
|
---|
| 5686 | tocol = wp->w_old_cursor_lcol;
|
---|
| 5687 | @@ -3412,6 +3422,7 @@
|
---|
| 5688 | && (*mb_ptr2cells)(ptr) > 1)
|
---|
| 5689 | #endif
|
---|
| 5690 | || ((int)vcol_prev == fromcol_prev
|
---|
| 5691 | + && vcol_prev < vcol /* not at margin */
|
---|
| 5692 | && vcol < tocol))
|
---|
| 5693 | area_attr = attr; /* start highlighting */
|
---|
| 5694 | else if (area_attr != 0
|
---|
| 5695 | @@ -4549,7 +4560,8 @@
|
---|
| 5696 | * highlight the cursor position itself. */
|
---|
| 5697 | if (wp->w_p_cuc && vcol == (long)wp->w_virtcol
|
---|
| 5698 | && lnum != wp->w_cursor.lnum
|
---|
| 5699 | - && draw_state == WL_LINE)
|
---|
| 5700 | + && draw_state == WL_LINE
|
---|
| 5701 | + && !lnum_in_visual_area)
|
---|
| 5702 | {
|
---|
| 5703 | vcol_save_attr = char_attr;
|
---|
| 5704 | char_attr = hl_combine_attr(char_attr, hl_attr(HLF_CUC));
|
---|
| 5705 | @@ -6350,7 +6362,7 @@
|
---|
| 5706 | && c == 0x8e
|
---|
| 5707 | && ScreenLines2[off] != ptr[1])
|
---|
| 5708 | || (enc_utf8
|
---|
| 5709 | - && (ScreenLinesUC[off] != (u8char_T)u8c
|
---|
| 5710 | + && (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0)
|
---|
| 5711 | || screen_comp_differs(off, u8cc)))
|
---|
| 5712 | #endif
|
---|
| 5713 | || ScreenAttrs[off] != attr
|
---|
| 5714 | @@ -7356,7 +7368,11 @@
|
---|
| 5715 | #endif
|
---|
| 5716 | static int entered = FALSE; /* avoid recursiveness */
|
---|
| 5717 | static int done_outofmem_msg = FALSE; /* did outofmem message */
|
---|
| 5718 | +#ifdef FEAT_AUTOCMD
|
---|
| 5719 | + int retry_count = 0;
|
---|
| 5720 |
|
---|
| 5721 | +retry:
|
---|
| 5722 | +#endif
|
---|
| 5723 | /*
|
---|
| 5724 | * Allocation of the screen buffers is done only when the size changes and
|
---|
| 5725 | * when Rows and Columns have been set and we have started doing full
|
---|
| 5726 | @@ -7440,10 +7456,13 @@
|
---|
| 5727 | {
|
---|
| 5728 | outofmem = TRUE;
|
---|
| 5729 | #ifdef FEAT_WINDOWS
|
---|
| 5730 | - break;
|
---|
| 5731 | + goto give_up;
|
---|
| 5732 | #endif
|
---|
| 5733 | }
|
---|
| 5734 | }
|
---|
| 5735 | +#ifdef FEAT_WINDOWS
|
---|
| 5736 | +give_up:
|
---|
| 5737 | +#endif
|
---|
| 5738 |
|
---|
| 5739 | #ifdef FEAT_MBYTE
|
---|
| 5740 | for (i = 0; i < p_mco; ++i)
|
---|
| 5741 | @@ -7628,8 +7647,17 @@
|
---|
| 5742 | --RedrawingDisabled;
|
---|
| 5743 |
|
---|
| 5744 | #ifdef FEAT_AUTOCMD
|
---|
| 5745 | - if (starting == 0)
|
---|
| 5746 | + /*
|
---|
| 5747 | + * Do not apply autocommands more than 3 times to avoid an endless loop
|
---|
| 5748 | + * in case applying autocommands always changes Rows or Columns.
|
---|
| 5749 | + */
|
---|
| 5750 | + if (starting == 0 && ++retry_count <= 3)
|
---|
| 5751 | + {
|
---|
| 5752 | apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
|
---|
| 5753 | + /* In rare cases, autocommands may have altered Rows or Columns,
|
---|
| 5754 | + * jump back to check if we need to allocate the screen again. */
|
---|
| 5755 | + goto retry;
|
---|
| 5756 | + }
|
---|
| 5757 | #endif
|
---|
| 5758 | }
|
---|
[76dd250] | 5759 |
|
---|
| 5760 | diff -Naur vim72.orig/src/spell.c vim72/src/spell.c
|
---|
[54f612f] | 5761 | --- vim72.orig/src/spell.c 2008-07-12 12:20:55.000000000 -0700
|
---|
[76dd250] | 5762 | +++ vim72/src/spell.c 2009-02-22 21:58:02.914775247 -0800
|
---|
| 5763 | @@ -77,7 +77,7 @@
|
---|
| 5764 |
|
---|
| 5765 | /*
|
---|
| 5766 | * Do the opposite: based on a maximum end score and a known sound score,
|
---|
| 5767 | - * compute the the maximum word score that can be used.
|
---|
| 5768 | + * compute the maximum word score that can be used.
|
---|
| 5769 | */
|
---|
| 5770 | #define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3)
|
---|
| 5771 |
|
---|
| 5772 | @@ -469,6 +469,7 @@
|
---|
| 5773 | garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */
|
---|
| 5774 | regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm
|
---|
| 5775 | * (NULL when no compounding) */
|
---|
| 5776 | + char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */
|
---|
| 5777 | char_u *sl_compstartflags; /* flags for first compound word */
|
---|
| 5778 | char_u *sl_compallflags; /* all flags for compound words */
|
---|
| 5779 | char_u sl_nobreak; /* When TRUE: no spaces between words */
|
---|
| 5780 | @@ -625,7 +626,7 @@
|
---|
| 5781 | /* TRUE if a word appears in the list of banned words. */
|
---|
| 5782 | #define WAS_BANNED(su, word) (!HASHITEM_EMPTY(hash_find(&su->su_banned, word)))
|
---|
| 5783 |
|
---|
| 5784 | -/* Number of suggestions kept when cleaning up. we need to keep more than
|
---|
| 5785 | +/* Number of suggestions kept when cleaning up. We need to keep more than
|
---|
| 5786 | * what is displayed, because when rescore_suggestions() is called the score
|
---|
| 5787 | * may change and wrong suggestions may be removed later. */
|
---|
| 5788 | #define SUG_CLEAN_COUNT(su) ((su)->su_maxcount < 130 ? 150 : (su)->su_maxcount + 20)
|
---|
| 5789 | @@ -839,7 +840,10 @@
|
---|
| 5790 | static void slang_clear __ARGS((slang_T *lp));
|
---|
| 5791 | static void slang_clear_sug __ARGS((slang_T *lp));
|
---|
| 5792 | static void find_word __ARGS((matchinf_T *mip, int mode));
|
---|
| 5793 | +static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap));
|
---|
| 5794 | static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags));
|
---|
| 5795 | +static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag));
|
---|
| 5796 | +static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags));
|
---|
| 5797 | static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req));
|
---|
| 5798 | static void find_prefix __ARGS((matchinf_T *mip, int mode));
|
---|
| 5799 | static int fold_more __ARGS((matchinf_T *mip));
|
---|
| 5800 | @@ -1519,6 +1523,11 @@
|
---|
| 5801 | ((unsigned)flags >> 24)))
|
---|
| 5802 | continue;
|
---|
| 5803 |
|
---|
| 5804 | + /* If there is a match with a CHECKCOMPOUNDPATTERN rule
|
---|
| 5805 | + * discard the compound word. */
|
---|
| 5806 | + if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
|
---|
| 5807 | + continue;
|
---|
| 5808 | +
|
---|
| 5809 | if (mode == FIND_COMPOUND)
|
---|
| 5810 | {
|
---|
| 5811 | int capflags;
|
---|
| 5812 | @@ -1577,6 +1586,11 @@
|
---|
| 5813 | if (!can_compound(slang, fword, mip->mi_compflags))
|
---|
| 5814 | continue;
|
---|
| 5815 | }
|
---|
| 5816 | + else if (slang->sl_comprules != NULL
|
---|
| 5817 | + && !match_compoundrule(slang, mip->mi_compflags))
|
---|
| 5818 | + /* The compound flags collected so far do not match any
|
---|
| 5819 | + * COMPOUNDRULE, discard the compounded word. */
|
---|
| 5820 | + continue;
|
---|
| 5821 | }
|
---|
| 5822 |
|
---|
| 5823 | /* Check NEEDCOMPOUND: can't use word without compounding. */
|
---|
| 5824 | @@ -1727,6 +1741,39 @@
|
---|
| 5825 | }
|
---|
| 5826 |
|
---|
| 5827 | /*
|
---|
| 5828 | + * Return TRUE if there is a match between the word ptr[wlen] and
|
---|
| 5829 | + * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
|
---|
| 5830 | + * word.
|
---|
| 5831 | + * A match means that the first part of CHECKCOMPOUNDPATTERN matches at the
|
---|
| 5832 | + * end of ptr[wlen] and the second part matches after it.
|
---|
| 5833 | + */
|
---|
| 5834 | + static int
|
---|
| 5835 | +match_checkcompoundpattern(ptr, wlen, gap)
|
---|
| 5836 | + char_u *ptr;
|
---|
| 5837 | + int wlen;
|
---|
| 5838 | + garray_T *gap; /* &sl_comppat */
|
---|
| 5839 | +{
|
---|
| 5840 | + int i;
|
---|
| 5841 | + char_u *p;
|
---|
| 5842 | + int len;
|
---|
| 5843 | +
|
---|
| 5844 | + for (i = 0; i + 1 < gap->ga_len; i += 2)
|
---|
| 5845 | + {
|
---|
| 5846 | + p = ((char_u **)gap->ga_data)[i + 1];
|
---|
| 5847 | + if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
|
---|
| 5848 | + {
|
---|
| 5849 | + /* Second part matches at start of following compound word, now
|
---|
| 5850 | + * check if first part matches at end of previous word. */
|
---|
| 5851 | + p = ((char_u **)gap->ga_data)[i];
|
---|
| 5852 | + len = (int)STRLEN(p);
|
---|
| 5853 | + if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
|
---|
| 5854 | + return TRUE;
|
---|
| 5855 | + }
|
---|
| 5856 | + }
|
---|
| 5857 | + return FALSE;
|
---|
| 5858 | +}
|
---|
| 5859 | +
|
---|
| 5860 | +/*
|
---|
| 5861 | * Return TRUE if "flags" is a valid sequence of compound flags and "word"
|
---|
| 5862 | * does not have too many syllables.
|
---|
| 5863 | */
|
---|
| 5864 | @@ -1773,6 +1820,98 @@
|
---|
| 5865 | }
|
---|
| 5866 |
|
---|
| 5867 | /*
|
---|
| 5868 | + * Return TRUE when the sequence of flags in "compflags" plus "flag" can
|
---|
| 5869 | + * possibly form a valid compounded word. This also checks the COMPOUNDRULE
|
---|
| 5870 | + * lines if they don't contain wildcards.
|
---|
| 5871 | + */
|
---|
| 5872 | + static int
|
---|
| 5873 | +can_be_compound(sp, slang, compflags, flag)
|
---|
| 5874 | + trystate_T *sp;
|
---|
| 5875 | + slang_T *slang;
|
---|
| 5876 | + char_u *compflags;
|
---|
| 5877 | + int flag;
|
---|
| 5878 | +{
|
---|
| 5879 | + /* If the flag doesn't appear in sl_compstartflags or sl_compallflags
|
---|
| 5880 | + * then it can't possibly compound. */
|
---|
| 5881 | + if (!byte_in_str(sp->ts_complen == sp->ts_compsplit
|
---|
| 5882 | + ? slang->sl_compstartflags : slang->sl_compallflags, flag))
|
---|
| 5883 | + return FALSE;
|
---|
| 5884 | +
|
---|
| 5885 | + /* If there are no wildcards, we can check if the flags collected so far
|
---|
| 5886 | + * possibly can form a match with COMPOUNDRULE patterns. This only
|
---|
| 5887 | + * makes sense when we have two or more words. */
|
---|
| 5888 | + if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit)
|
---|
| 5889 | + {
|
---|
| 5890 | + int v;
|
---|
| 5891 | +
|
---|
| 5892 | + compflags[sp->ts_complen] = flag;
|
---|
| 5893 | + compflags[sp->ts_complen + 1] = NUL;
|
---|
| 5894 | + v = match_compoundrule(slang, compflags + sp->ts_compsplit);
|
---|
| 5895 | + compflags[sp->ts_complen] = NUL;
|
---|
| 5896 | + return v;
|
---|
| 5897 | + }
|
---|
| 5898 | +
|
---|
| 5899 | + return TRUE;
|
---|
| 5900 | +}
|
---|
| 5901 | +
|
---|
| 5902 | +
|
---|
| 5903 | +/*
|
---|
| 5904 | + * Return TRUE if the compound flags in compflags[] match the start of any
|
---|
| 5905 | + * compound rule. This is used to stop trying a compound if the flags
|
---|
| 5906 | + * collected so far can't possibly match any compound rule.
|
---|
| 5907 | + * Caller must check that slang->sl_comprules is not NULL.
|
---|
| 5908 | + */
|
---|
| 5909 | + static int
|
---|
| 5910 | +match_compoundrule(slang, compflags)
|
---|
| 5911 | + slang_T *slang;
|
---|
| 5912 | + char_u *compflags;
|
---|
| 5913 | +{
|
---|
| 5914 | + char_u *p;
|
---|
| 5915 | + int i;
|
---|
| 5916 | + int c;
|
---|
| 5917 | +
|
---|
| 5918 | + /* loop over all the COMPOUNDRULE entries */
|
---|
| 5919 | + for (p = slang->sl_comprules; *p != NUL; ++p)
|
---|
| 5920 | + {
|
---|
| 5921 | + /* loop over the flags in the compound word we have made, match
|
---|
| 5922 | + * them against the current rule entry */
|
---|
| 5923 | + for (i = 0; ; ++i)
|
---|
| 5924 | + {
|
---|
| 5925 | + c = compflags[i];
|
---|
| 5926 | + if (c == NUL)
|
---|
| 5927 | + /* found a rule that matches for the flags we have so far */
|
---|
| 5928 | + return TRUE;
|
---|
| 5929 | + if (*p == '/' || *p == NUL)
|
---|
| 5930 | + break; /* end of rule, it's too short */
|
---|
| 5931 | + if (*p == '[')
|
---|
| 5932 | + {
|
---|
| 5933 | + int match = FALSE;
|
---|
| 5934 | +
|
---|
| 5935 | + /* compare against all the flags in [] */
|
---|
| 5936 | + ++p;
|
---|
| 5937 | + while (*p != ']' && *p != NUL)
|
---|
| 5938 | + if (*p++ == c)
|
---|
| 5939 | + match = TRUE;
|
---|
| 5940 | + if (!match)
|
---|
| 5941 | + break; /* none matches */
|
---|
| 5942 | + }
|
---|
| 5943 | + else if (*p != c)
|
---|
| 5944 | + break; /* flag of word doesn't match flag in pattern */
|
---|
| 5945 | + ++p;
|
---|
| 5946 | + }
|
---|
| 5947 | +
|
---|
| 5948 | + /* Skip to the next "/", where the next pattern starts. */
|
---|
| 5949 | + p = vim_strchr(p, '/');
|
---|
| 5950 | + if (p == NULL)
|
---|
| 5951 | + break;
|
---|
| 5952 | + }
|
---|
| 5953 | +
|
---|
| 5954 | + /* Checked all the rules and none of them match the flags, so there
|
---|
| 5955 | + * can't possibly be a compound starting with these flags. */
|
---|
| 5956 | + return FALSE;
|
---|
| 5957 | +}
|
---|
| 5958 | +
|
---|
| 5959 | +/*
|
---|
| 5960 | * Return non-zero if the prefix indicated by "arridx" matches with the prefix
|
---|
| 5961 | * ID in "flags" for the word "word".
|
---|
[61a83e8] | 5962 | * The WF_RAREPFX flag is included in the return value for a rare prefix.
|
---|
| 5963 | @@ -2237,7 +2376,7 @@
|
---|
| 5964 |
|
---|
| 5965 | /* If we are back at the starting line and there is no match then
|
---|
| 5966 | * give up. */
|
---|
| 5967 | - if (lnum == wp->w_cursor.lnum && !found_one)
|
---|
| 5968 | + if (lnum == wp->w_cursor.lnum && (!found_one || wrapped))
|
---|
| 5969 | break;
|
---|
| 5970 |
|
---|
[76dd250] | 5971 | /* Skip the characters at the start of the next line that were
|
---|
| 5972 | @@ -2513,9 +2652,11 @@
|
---|
| 5973 | lp->sl_midword = NULL;
|
---|
| 5974 |
|
---|
| 5975 | vim_free(lp->sl_compprog);
|
---|
| 5976 | + vim_free(lp->sl_comprules);
|
---|
| 5977 | vim_free(lp->sl_compstartflags);
|
---|
| 5978 | vim_free(lp->sl_compallflags);
|
---|
| 5979 | lp->sl_compprog = NULL;
|
---|
| 5980 | + lp->sl_comprules = NULL;
|
---|
| 5981 | lp->sl_compstartflags = NULL;
|
---|
| 5982 | lp->sl_compallflags = NULL;
|
---|
| 5983 |
|
---|
| 5984 | @@ -3460,6 +3601,7 @@
|
---|
| 5985 | char_u *pp;
|
---|
| 5986 | char_u *cp;
|
---|
| 5987 | char_u *ap;
|
---|
| 5988 | + char_u *crp;
|
---|
| 5989 | int cnt;
|
---|
| 5990 | garray_T *gap;
|
---|
| 5991 |
|
---|
| 5992 | @@ -3545,6 +3687,12 @@
|
---|
| 5993 | slang->sl_compallflags = ap;
|
---|
| 5994 | *ap = NUL;
|
---|
| 5995 |
|
---|
| 5996 | + /* And a list of all patterns in their original form, for checking whether
|
---|
| 5997 | + * compounding may work in match_compoundrule(). This is freed when we
|
---|
| 5998 | + * encounter a wildcard, the check doesn't work then. */
|
---|
| 5999 | + crp = alloc(todo + 1);
|
---|
| 6000 | + slang->sl_comprules = crp;
|
---|
| 6001 | +
|
---|
| 6002 | pp = pat;
|
---|
| 6003 | *pp++ = '^';
|
---|
| 6004 | *pp++ = '\\';
|
---|
| 6005 | @@ -3587,6 +3735,20 @@
|
---|
| 6006 | atstart = 0;
|
---|
| 6007 | }
|
---|
| 6008 | }
|
---|
| 6009 | +
|
---|
| 6010 | + /* Copy flag to "sl_comprules", unless we run into a wildcard. */
|
---|
| 6011 | + if (crp != NULL)
|
---|
| 6012 | + {
|
---|
| 6013 | + if (c == '+' || c == '*')
|
---|
| 6014 | + {
|
---|
| 6015 | + vim_free(slang->sl_comprules);
|
---|
| 6016 | + slang->sl_comprules = NULL;
|
---|
| 6017 | + crp = NULL;
|
---|
| 6018 | + }
|
---|
| 6019 | + else
|
---|
| 6020 | + *crp++ = c;
|
---|
| 6021 | + }
|
---|
| 6022 | +
|
---|
| 6023 | if (c == '/') /* slash separates two items */
|
---|
| 6024 | {
|
---|
| 6025 | *pp++ = '\\';
|
---|
| 6026 | @@ -3611,6 +3773,9 @@
|
---|
| 6027 | *pp++ = '$';
|
---|
| 6028 | *pp = NUL;
|
---|
| 6029 |
|
---|
| 6030 | + if (crp != NULL)
|
---|
| 6031 | + *crp = NUL;
|
---|
| 6032 | +
|
---|
| 6033 | slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
|
---|
| 6034 | vim_free(pat);
|
---|
[61a83e8] | 6035 | if (slang->sl_compprog == NULL)
|
---|
| 6036 | @@ -4791,13 +4956,16 @@
|
---|
| 6037 | * Structure that is used to store the items in the word tree. This avoids
|
---|
| 6038 | * the need to keep track of each allocated thing, everything is freed all at
|
---|
| 6039 | * once after ":mkspell" is done.
|
---|
| 6040 | + * Note: "sb_next" must be just before "sb_data" to make sure the alignment of
|
---|
| 6041 | + * "sb_data" is correct for systems where pointers must be aligned on
|
---|
| 6042 | + * pointer-size boundaries and sizeof(pointer) > sizeof(int) (e.g., Sparc).
|
---|
| 6043 | */
|
---|
| 6044 | #define SBLOCKSIZE 16000 /* size of sb_data */
|
---|
| 6045 | typedef struct sblock_S sblock_T;
|
---|
| 6046 | struct sblock_S
|
---|
| 6047 | {
|
---|
| 6048 | - sblock_T *sb_next; /* next block in list */
|
---|
| 6049 | int sb_used; /* nr of bytes already in use */
|
---|
| 6050 | + sblock_T *sb_next; /* next block in list */
|
---|
| 6051 | char_u sb_data[1]; /* data, actually longer */
|
---|
| 6052 | };
|
---|
| 6053 |
|
---|
[76dd250] | 6054 | @@ -4915,6 +5083,7 @@
|
---|
| 6055 | } spellinfo_T;
|
---|
| 6056 |
|
---|
| 6057 | static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
|
---|
| 6058 | +static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount));
|
---|
| 6059 | static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry));
|
---|
| 6060 | static int spell_info_item __ARGS((char_u *s));
|
---|
[61a83e8] | 6061 | static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
|
---|
[76dd250] | 6062 | @@ -4950,7 +5119,7 @@
|
---|
| 6063 | static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd));
|
---|
| 6064 | static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname));
|
---|
| 6065 | static void clear_node __ARGS((wordnode_T *node));
|
---|
| 6066 | -static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree));
|
---|
| 6067 | +static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree));
|
---|
| 6068 | static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname));
|
---|
| 6069 | static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang));
|
---|
[61a83e8] | 6070 | static int sug_maketable __ARGS((spellinfo_T *spin));
|
---|
[76dd250] | 6071 | @@ -5223,8 +5392,7 @@
|
---|
| 6072 | /* Handle non-empty lines. */
|
---|
| 6073 | if (itemcnt > 0)
|
---|
| 6074 | {
|
---|
| 6075 | - if (STRCMP(items[0], "SET") == 0 && itemcnt == 2
|
---|
| 6076 | - && aff->af_enc == NULL)
|
---|
| 6077 | + if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
|
---|
| 6078 | {
|
---|
| 6079 | #ifdef FEAT_MBYTE
|
---|
[61a83e8] | 6080 | /* Setup for conversion from "ENC" to 'encoding'. */
|
---|
[76dd250] | 6081 | @@ -5239,7 +5407,7 @@
|
---|
| 6082 | smsg((char_u *)_("Conversion in %s not supported"), fname);
|
---|
| 6083 | #endif
|
---|
| 6084 | }
|
---|
| 6085 | - else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2
|
---|
| 6086 | + else if (is_aff_rule(items, itemcnt, "FLAG", 2)
|
---|
| 6087 | && aff->af_flagtype == AFT_CHAR)
|
---|
| 6088 | {
|
---|
[61a83e8] | 6089 | if (STRCMP(items[1], "long") == 0)
|
---|
[76dd250] | 6090 | @@ -5284,69 +5452,71 @@
|
---|
| 6091 | spin->si_info = p;
|
---|
| 6092 | }
|
---|
| 6093 | }
|
---|
| 6094 | - else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
|
---|
| 6095 | + else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
|
---|
| 6096 | && midword == NULL)
|
---|
| 6097 | {
|
---|
| 6098 | midword = getroom_save(spin, items[1]);
|
---|
| 6099 | }
|
---|
| 6100 | - else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
|
---|
| 6101 | + else if (is_aff_rule(items, itemcnt, "TRY", 2))
|
---|
| 6102 | {
|
---|
| 6103 | /* ignored, we look in the tree for what chars may appear */
|
---|
| 6104 | }
|
---|
| 6105 | /* TODO: remove "RAR" later */
|
---|
| 6106 | - else if ((STRCMP(items[0], "RAR") == 0
|
---|
| 6107 | - || STRCMP(items[0], "RARE") == 0) && itemcnt == 2
|
---|
| 6108 | - && aff->af_rare == 0)
|
---|
| 6109 | + else if ((is_aff_rule(items, itemcnt, "RAR", 2)
|
---|
| 6110 | + || is_aff_rule(items, itemcnt, "RARE", 2))
|
---|
| 6111 | + && aff->af_rare == 0)
|
---|
| 6112 | {
|
---|
| 6113 | aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
|
---|
| 6114 | fname, lnum);
|
---|
| 6115 | }
|
---|
| 6116 | /* TODO: remove "KEP" later */
|
---|
| 6117 | - else if ((STRCMP(items[0], "KEP") == 0
|
---|
| 6118 | - || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2
|
---|
| 6119 | + else if ((is_aff_rule(items, itemcnt, "KEP", 2)
|
---|
| 6120 | + || is_aff_rule(items, itemcnt, "KEEPCASE", 2))
|
---|
| 6121 | && aff->af_keepcase == 0)
|
---|
| 6122 | {
|
---|
| 6123 | aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
|
---|
| 6124 | fname, lnum);
|
---|
| 6125 | }
|
---|
| 6126 | - else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2
|
---|
| 6127 | - && aff->af_bad == 0)
|
---|
| 6128 | + else if ((is_aff_rule(items, itemcnt, "BAD", 2)
|
---|
| 6129 | + || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2))
|
---|
| 6130 | + && aff->af_bad == 0)
|
---|
| 6131 | {
|
---|
| 6132 | aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
|
---|
| 6133 | fname, lnum);
|
---|
| 6134 | }
|
---|
| 6135 | - else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2
|
---|
| 6136 | + else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2)
|
---|
| 6137 | && aff->af_needaffix == 0)
|
---|
| 6138 | {
|
---|
| 6139 | aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
|
---|
| 6140 | fname, lnum);
|
---|
| 6141 | }
|
---|
| 6142 | - else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2
|
---|
| 6143 | + else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2)
|
---|
| 6144 | && aff->af_circumfix == 0)
|
---|
| 6145 | {
|
---|
| 6146 | aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
|
---|
| 6147 | fname, lnum);
|
---|
| 6148 | }
|
---|
| 6149 | - else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2
|
---|
| 6150 | + else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2)
|
---|
| 6151 | && aff->af_nosuggest == 0)
|
---|
| 6152 | {
|
---|
| 6153 | aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
|
---|
| 6154 | fname, lnum);
|
---|
| 6155 | }
|
---|
| 6156 | - else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2
|
---|
| 6157 | + else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2)
|
---|
| 6158 | + || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2))
|
---|
| 6159 | && aff->af_needcomp == 0)
|
---|
| 6160 | {
|
---|
| 6161 | aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
|
---|
| 6162 | fname, lnum);
|
---|
| 6163 | }
|
---|
| 6164 | - else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2
|
---|
| 6165 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2)
|
---|
| 6166 | && aff->af_comproot == 0)
|
---|
| 6167 | {
|
---|
| 6168 | aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
|
---|
| 6169 | fname, lnum);
|
---|
| 6170 | }
|
---|
| 6171 | - else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0
|
---|
| 6172 | - && itemcnt == 2 && aff->af_compforbid == 0)
|
---|
| 6173 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2)
|
---|
| 6174 | + && aff->af_compforbid == 0)
|
---|
| 6175 | {
|
---|
| 6176 | aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
|
---|
[61a83e8] | 6177 | fname, lnum);
|
---|
[76dd250] | 6178 | @@ -5354,8 +5524,8 @@
|
---|
| 6179 | smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
|
---|
| 6180 | fname, lnum);
|
---|
| 6181 | }
|
---|
| 6182 | - else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0
|
---|
| 6183 | - && itemcnt == 2 && aff->af_comppermit == 0)
|
---|
| 6184 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
|
---|
| 6185 | + && aff->af_comppermit == 0)
|
---|
| 6186 | {
|
---|
| 6187 | aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
|
---|
[61a83e8] | 6188 | fname, lnum);
|
---|
[76dd250] | 6189 | @@ -5363,7 +5533,7 @@
|
---|
| 6190 | smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
|
---|
| 6191 | fname, lnum);
|
---|
| 6192 | }
|
---|
| 6193 | - else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
|
---|
| 6194 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
|
---|
| 6195 | && compflags == NULL)
|
---|
| 6196 | {
|
---|
[61a83e8] | 6197 | /* Turn flag "c" into COMPOUNDRULE compatible string "c+",
|
---|
[76dd250] | 6198 | @@ -5376,7 +5546,15 @@
|
---|
| 6199 | compflags = p;
|
---|
| 6200 | }
|
---|
| 6201 | }
|
---|
| 6202 | - else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
|
---|
| 6203 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
|
---|
| 6204 | + {
|
---|
| 6205 | + /* We don't use the count, but do check that it's a number and
|
---|
| 6206 | + * not COMPOUNDRULE mistyped. */
|
---|
| 6207 | + if (atoi((char *)items[1]) == 0)
|
---|
| 6208 | + smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"),
|
---|
| 6209 | + fname, lnum, items[1]);
|
---|
| 6210 | + }
|
---|
| 6211 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
|
---|
| 6212 | {
|
---|
| 6213 | /* Concatenate this string to previously defined ones, using a
|
---|
[61a83e8] | 6214 | * slash to separate them. */
|
---|
[76dd250] | 6215 | @@ -5395,7 +5573,7 @@
|
---|
| 6216 | compflags = p;
|
---|
| 6217 | }
|
---|
| 6218 | }
|
---|
| 6219 | - else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
|
---|
| 6220 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
|
---|
| 6221 | && compmax == 0)
|
---|
| 6222 | {
|
---|
[61a83e8] | 6223 | compmax = atoi((char *)items[1]);
|
---|
[76dd250] | 6224 | @@ -5403,7 +5581,7 @@
|
---|
| 6225 | smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
|
---|
| 6226 | fname, lnum, items[1]);
|
---|
| 6227 | }
|
---|
| 6228 | - else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
|
---|
| 6229 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
|
---|
| 6230 | && compminlen == 0)
|
---|
| 6231 | {
|
---|
[61a83e8] | 6232 | compminlen = atoi((char *)items[1]);
|
---|
[76dd250] | 6233 | @@ -5411,7 +5589,7 @@
|
---|
| 6234 | smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
|
---|
| 6235 | fname, lnum, items[1]);
|
---|
| 6236 | }
|
---|
| 6237 | - else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
|
---|
| 6238 | + else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
|
---|
| 6239 | && compsylmax == 0)
|
---|
| 6240 | {
|
---|
[61a83e8] | 6241 | compsylmax = atoi((char *)items[1]);
|
---|
[76dd250] | 6242 | @@ -5419,32 +5597,29 @@
|
---|
| 6243 | smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
|
---|
| 6244 | fname, lnum, items[1]);
|
---|
| 6245 | }
|
---|
| 6246 | - else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
|
---|
| 6247 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
|
---|
| 6248 | {
|
---|
| 6249 | compoptions |= COMP_CHECKDUP;
|
---|
| 6250 | }
|
---|
| 6251 | - else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
|
---|
| 6252 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
|
---|
| 6253 | {
|
---|
| 6254 | compoptions |= COMP_CHECKREP;
|
---|
| 6255 | }
|
---|
| 6256 | - else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
|
---|
| 6257 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
|
---|
| 6258 | {
|
---|
| 6259 | compoptions |= COMP_CHECKCASE;
|
---|
| 6260 | }
|
---|
| 6261 | - else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
|
---|
| 6262 | - && itemcnt == 1)
|
---|
| 6263 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
|
---|
| 6264 | {
|
---|
| 6265 | compoptions |= COMP_CHECKTRIPLE;
|
---|
| 6266 | }
|
---|
| 6267 | - else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
|
---|
| 6268 | - && itemcnt == 2)
|
---|
| 6269 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
|
---|
| 6270 | {
|
---|
| 6271 | if (atoi((char *)items[1]) == 0)
|
---|
| 6272 | smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
|
---|
| 6273 | fname, lnum, items[1]);
|
---|
| 6274 | }
|
---|
| 6275 | - else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
|
---|
| 6276 | - && itemcnt == 3)
|
---|
| 6277 | + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
|
---|
| 6278 | {
|
---|
| 6279 | garray_T *gap = &spin->si_comppat;
|
---|
[61a83e8] | 6280 | int i;
|
---|
[76dd250] | 6281 | @@ -5463,24 +5638,24 @@
|
---|
| 6282 | = getroom_save(spin, items[2]);
|
---|
| 6283 | }
|
---|
| 6284 | }
|
---|
| 6285 | - else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
|
---|
| 6286 | + else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
|
---|
| 6287 | && syllable == NULL)
|
---|
| 6288 | {
|
---|
| 6289 | syllable = getroom_save(spin, items[1]);
|
---|
| 6290 | }
|
---|
| 6291 | - else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
|
---|
| 6292 | + else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
|
---|
| 6293 | {
|
---|
| 6294 | spin->si_nobreak = TRUE;
|
---|
| 6295 | }
|
---|
| 6296 | - else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
|
---|
| 6297 | + else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
|
---|
| 6298 | {
|
---|
| 6299 | spin->si_nosplitsugs = TRUE;
|
---|
| 6300 | }
|
---|
| 6301 | - else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
|
---|
| 6302 | + else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
|
---|
| 6303 | {
|
---|
| 6304 | spin->si_nosugfile = TRUE;
|
---|
| 6305 | }
|
---|
| 6306 | - else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
|
---|
| 6307 | + else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
|
---|
| 6308 | {
|
---|
| 6309 | aff->af_pfxpostpone = TRUE;
|
---|
[61a83e8] | 6310 | }
|
---|
[76dd250] | 6311 | @@ -5771,24 +5946,20 @@
|
---|
| 6312 | }
|
---|
| 6313 | }
|
---|
| 6314 | }
|
---|
| 6315 | - else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
|
---|
| 6316 | - && fol == NULL)
|
---|
| 6317 | + else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
|
---|
| 6318 | {
|
---|
| 6319 | fol = vim_strsave(items[1]);
|
---|
| 6320 | }
|
---|
| 6321 | - else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
|
---|
| 6322 | - && low == NULL)
|
---|
| 6323 | + else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
|
---|
| 6324 | {
|
---|
| 6325 | low = vim_strsave(items[1]);
|
---|
| 6326 | }
|
---|
| 6327 | - else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
|
---|
| 6328 | - && upp == NULL)
|
---|
| 6329 | + else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
|
---|
| 6330 | {
|
---|
| 6331 | upp = vim_strsave(items[1]);
|
---|
| 6332 | }
|
---|
| 6333 | - else if ((STRCMP(items[0], "REP") == 0
|
---|
| 6334 | - || STRCMP(items[0], "REPSAL") == 0)
|
---|
| 6335 | - && itemcnt == 2)
|
---|
| 6336 | + else if (is_aff_rule(items, itemcnt, "REP", 2)
|
---|
| 6337 | + || is_aff_rule(items, itemcnt, "REPSAL", 2))
|
---|
| 6338 | {
|
---|
| 6339 | /* Ignore REP/REPSAL count */;
|
---|
[61a83e8] | 6340 | if (!isdigit(*items[1]))
|
---|
[76dd250] | 6341 | @@ -5819,7 +5990,7 @@
|
---|
| 6342 | : &spin->si_rep, items[1], items[2]);
|
---|
| 6343 | }
|
---|
| 6344 | }
|
---|
| 6345 | - else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
|
---|
| 6346 | + else if (is_aff_rule(items, itemcnt, "MAP", 2))
|
---|
| 6347 | {
|
---|
| 6348 | /* MAP item or count */
|
---|
[61a83e8] | 6349 | if (!found_map)
|
---|
[76dd250] | 6350 | @@ -5856,9 +6027,8 @@
|
---|
| 6351 | ga_append(&spin->si_map, '/');
|
---|
| 6352 | }
|
---|
| 6353 | }
|
---|
| 6354 | - /* Accept "SAL from to" and "SAL from to # comment". */
|
---|
| 6355 | - else if (STRCMP(items[0], "SAL") == 0
|
---|
| 6356 | - && (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#')))
|
---|
| 6357 | + /* Accept "SAL from to" and "SAL from to #comment". */
|
---|
| 6358 | + else if (is_aff_rule(items, itemcnt, "SAL", 3))
|
---|
| 6359 | {
|
---|
| 6360 | if (do_sal)
|
---|
[61a83e8] | 6361 | {
|
---|
[76dd250] | 6362 | @@ -5877,12 +6047,12 @@
|
---|
| 6363 | : items[2]);
|
---|
| 6364 | }
|
---|
| 6365 | }
|
---|
| 6366 | - else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
|
---|
| 6367 | + else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
|
---|
| 6368 | && sofofrom == NULL)
|
---|
| 6369 | {
|
---|
| 6370 | sofofrom = getroom_save(spin, items[1]);
|
---|
| 6371 | }
|
---|
| 6372 | - else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
|
---|
| 6373 | + else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
|
---|
| 6374 | && sofoto == NULL)
|
---|
| 6375 | {
|
---|
[61a83e8] | 6376 | sofoto = getroom_save(spin, items[1]);
|
---|
[76dd250] | 6377 | @@ -5980,7 +6150,7 @@
|
---|
| 6378 | else if (spin->si_newprefID == 0 || spin->si_newprefID == 127)
|
---|
| 6379 | MSG(_("Too many compound flags"));
|
---|
| 6380 | else
|
---|
| 6381 | - MSG(_("Too many posponed prefixes and/or compound flags"));
|
---|
| 6382 | + MSG(_("Too many postponed prefixes and/or compound flags"));
|
---|
| 6383 | }
|
---|
| 6384 |
|
---|
[61a83e8] | 6385 | if (syllable != NULL)
|
---|
[76dd250] | 6386 | @@ -6017,6 +6187,22 @@
|
---|
| 6387 | }
|
---|
| 6388 |
|
---|
| 6389 | /*
|
---|
| 6390 | + * Return TRUE when items[0] equals "rulename", there are "mincount" items or
|
---|
| 6391 | + * a comment is following after item "mincount".
|
---|
| 6392 | + */
|
---|
| 6393 | + static int
|
---|
| 6394 | +is_aff_rule(items, itemcnt, rulename, mincount)
|
---|
| 6395 | + char_u **items;
|
---|
| 6396 | + int itemcnt;
|
---|
| 6397 | + char *rulename;
|
---|
| 6398 | + int mincount;
|
---|
| 6399 | +{
|
---|
| 6400 | + return (STRCMP(items[0], rulename) == 0
|
---|
| 6401 | + && (itemcnt == mincount
|
---|
| 6402 | + || (itemcnt > mincount && items[mincount][0] == '#')));
|
---|
| 6403 | +}
|
---|
| 6404 | +
|
---|
| 6405 | +/*
|
---|
| 6406 | * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
|
---|
| 6407 | * ae_flags to ae_comppermit and ae_compforbid.
|
---|
[61a83e8] | 6408 | */
|
---|
[76dd250] | 6409 | @@ -7926,6 +8112,8 @@
|
---|
| 6410 | char_u *p;
|
---|
| 6411 | int rr;
|
---|
| 6412 | int retval = OK;
|
---|
| 6413 | + size_t fwv = 1; /* collect return value of fwrite() to avoid
|
---|
| 6414 | + warnings from picky compiler */
|
---|
| 6415 |
|
---|
| 6416 | fd = mch_fopen((char *)fname, "w");
|
---|
[61a83e8] | 6417 | if (fd == NULL)
|
---|
[76dd250] | 6418 | @@ -7936,11 +8124,11 @@
|
---|
| 6419 |
|
---|
| 6420 | /* <HEADER>: <fileID> <versionnr> */
|
---|
| 6421 | /* <fileID> */
|
---|
| 6422 | - if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)
|
---|
| 6423 | - {
|
---|
| 6424 | - EMSG(_(e_write));
|
---|
| 6425 | - retval = FAIL;
|
---|
| 6426 | - }
|
---|
| 6427 | + fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
|
---|
| 6428 | + if (fwv != (size_t)1)
|
---|
| 6429 | + /* Catch first write error, don't try writing more. */
|
---|
| 6430 | + goto theend;
|
---|
| 6431 | +
|
---|
| 6432 | putc(VIMSPELLVERSION, fd); /* <versionnr> */
|
---|
| 6433 |
|
---|
[61a83e8] | 6434 | /*
|
---|
[76dd250] | 6435 | @@ -7955,7 +8143,7 @@
|
---|
| 6436 |
|
---|
| 6437 | i = (int)STRLEN(spin->si_info);
|
---|
| 6438 | put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
|
---|
| 6439 | - fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
|
---|
| 6440 | + fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
|
---|
| 6441 | }
|
---|
| 6442 |
|
---|
[61a83e8] | 6443 | /* SN_REGION: <regionname> ...
|
---|
[76dd250] | 6444 | @@ -7966,7 +8154,7 @@
|
---|
| 6445 | putc(SNF_REQUIRED, fd); /* <sectionflags> */
|
---|
| 6446 | l = spin->si_region_count * 2;
|
---|
| 6447 | put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
|
---|
| 6448 | - fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
|
---|
| 6449 | + fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
|
---|
| 6450 | /* <regionname> ... */
|
---|
| 6451 | regionmask = (1 << spin->si_region_count) - 1;
|
---|
[61a83e8] | 6452 | }
|
---|
[76dd250] | 6453 | @@ -8016,7 +8204,7 @@
|
---|
| 6454 | }
|
---|
| 6455 |
|
---|
| 6456 | put_bytes(fd, (long_u)l, 2); /* <folcharslen> */
|
---|
| 6457 | - fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
|
---|
| 6458 | + fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
|
---|
| 6459 | }
|
---|
| 6460 |
|
---|
[61a83e8] | 6461 | /* SN_MIDWORD: <midword> */
|
---|
[76dd250] | 6462 | @@ -8027,7 +8215,8 @@
|
---|
| 6463 |
|
---|
| 6464 | i = (int)STRLEN(spin->si_midword);
|
---|
| 6465 | put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
|
---|
| 6466 | - fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */
|
---|
| 6467 | + fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd);
|
---|
| 6468 | + /* <midword> */
|
---|
| 6469 | }
|
---|
| 6470 |
|
---|
[61a83e8] | 6471 | /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
|
---|
[76dd250] | 6472 | @@ -8113,7 +8302,8 @@
|
---|
| 6473 | p = rr == 1 ? ftp->ft_from : ftp->ft_to;
|
---|
| 6474 | l = (int)STRLEN(p);
|
---|
| 6475 | putc(l, fd);
|
---|
| 6476 | - fwrite(p, l, (size_t)1, fd);
|
---|
| 6477 | + if (l > 0)
|
---|
| 6478 | + fwv &= fwrite(p, l, (size_t)1, fd);
|
---|
| 6479 | }
|
---|
| 6480 | }
|
---|
[61a83e8] | 6481 |
|
---|
[76dd250] | 6482 | @@ -8131,11 +8321,11 @@
|
---|
| 6483 | /* <sectionlen> */
|
---|
| 6484 |
|
---|
| 6485 | put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
|
---|
| 6486 | - fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
|
---|
| 6487 | + fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
|
---|
| 6488 |
|
---|
| 6489 | l = (int)STRLEN(spin->si_sofoto);
|
---|
| 6490 | put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
|
---|
| 6491 | - fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
|
---|
| 6492 | + fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
|
---|
| 6493 | }
|
---|
| 6494 |
|
---|
[61a83e8] | 6495 | /* SN_WORDS: <word> ...
|
---|
[76dd250] | 6496 | @@ -8160,7 +8350,7 @@
|
---|
| 6497 | l = (int)STRLEN(hi->hi_key) + 1;
|
---|
| 6498 | len += l;
|
---|
| 6499 | if (round == 2) /* <word> */
|
---|
| 6500 | - fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
|
---|
| 6501 | + fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
|
---|
| 6502 | --todo;
|
---|
| 6503 | }
|
---|
[61a83e8] | 6504 | if (round == 1)
|
---|
[76dd250] | 6505 | @@ -8176,7 +8366,7 @@
|
---|
| 6506 | putc(0, fd); /* <sectionflags> */
|
---|
| 6507 | l = spin->si_map.ga_len;
|
---|
| 6508 | put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
|
---|
| 6509 | - fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
|
---|
| 6510 | + fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
|
---|
| 6511 | /* <mapstr> */
|
---|
| 6512 | }
|
---|
[61a83e8] | 6513 |
|
---|
[76dd250] | 6514 | @@ -8232,10 +8422,11 @@
|
---|
| 6515 | {
|
---|
| 6516 | p = ((char_u **)(spin->si_comppat.ga_data))[i];
|
---|
| 6517 | putc((int)STRLEN(p), fd); /* <comppatlen> */
|
---|
| 6518 | - fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */
|
---|
| 6519 | + fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);
|
---|
| 6520 | + /* <comppattext> */
|
---|
| 6521 | }
|
---|
| 6522 | /* <compflags> */
|
---|
| 6523 | - fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
|
---|
| 6524 | + fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
|
---|
| 6525 | (size_t)1, fd);
|
---|
| 6526 | }
|
---|
[61a83e8] | 6527 |
|
---|
[76dd250] | 6528 | @@ -8259,7 +8450,8 @@
|
---|
| 6529 |
|
---|
| 6530 | l = (int)STRLEN(spin->si_syllable);
|
---|
| 6531 | put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
|
---|
| 6532 | - fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */
|
---|
| 6533 | + fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd);
|
---|
| 6534 | + /* <syllable> */
|
---|
| 6535 | }
|
---|
| 6536 |
|
---|
[61a83e8] | 6537 | /* end of <SECTIONS> */
|
---|
[76dd250] | 6538 | @@ -8295,13 +8487,18 @@
|
---|
| 6539 | (void)put_node(fd, tree, 0, regionmask, round == 3);
|
---|
| 6540 | }
|
---|
| 6541 |
|
---|
| 6542 | - /* Write another byte to check for errors. */
|
---|
| 6543 | + /* Write another byte to check for errors (file system full). */
|
---|
| 6544 | if (putc(0, fd) == EOF)
|
---|
| 6545 | retval = FAIL;
|
---|
| 6546 | -
|
---|
| 6547 | +theend:
|
---|
| 6548 | if (fclose(fd) == EOF)
|
---|
| 6549 | retval = FAIL;
|
---|
| 6550 |
|
---|
| 6551 | + if (fwv != (size_t)1)
|
---|
| 6552 | + retval = FAIL;
|
---|
| 6553 | + if (retval == FAIL)
|
---|
| 6554 | + EMSG(_(e_write));
|
---|
| 6555 | +
|
---|
| 6556 | return retval;
|
---|
| 6557 | }
|
---|
[61a83e8] | 6558 |
|
---|
[76dd250] | 6559 | @@ -9890,6 +10087,7 @@
|
---|
| 6560 | char_u *p;
|
---|
| 6561 | int len;
|
---|
| 6562 | int totlen;
|
---|
| 6563 | + size_t x = 1; /* collect return value of fwrite() */
|
---|
| 6564 |
|
---|
| 6565 | if (fd != NULL)
|
---|
[61a83e8] | 6566 | put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
|
---|
[76dd250] | 6567 | @@ -9906,7 +10104,7 @@
|
---|
| 6568 | if (fd != NULL)
|
---|
| 6569 | {
|
---|
| 6570 | fputc(len, fd);
|
---|
| 6571 | - fwrite(p, (size_t)len, (size_t)1, fd);
|
---|
| 6572 | + x &= fwrite(p, (size_t)len, (size_t)1, fd);
|
---|
| 6573 | }
|
---|
| 6574 | totlen += len;
|
---|
[61a83e8] | 6575 | }
|
---|
[76dd250] | 6576 | @@ -11480,15 +11678,24 @@
|
---|
| 6577 | vim_strncpy(preword + sp->ts_prewordlen,
|
---|
| 6578 | tword + sp->ts_splitoff,
|
---|
| 6579 | sp->ts_twordlen - sp->ts_splitoff);
|
---|
| 6580 | - p = preword;
|
---|
| 6581 | - while (*skiptowhite(p) != NUL)
|
---|
| 6582 | - p = skipwhite(skiptowhite(p));
|
---|
| 6583 | - if (fword_ends && !can_compound(slang, p,
|
---|
| 6584 | - compflags + sp->ts_compsplit))
|
---|
| 6585 | - /* Compound is not allowed. But it may still be
|
---|
| 6586 | - * possible if we add another (short) word. */
|
---|
| 6587 | +
|
---|
| 6588 | + /* Verify CHECKCOMPOUNDPATTERN rules. */
|
---|
| 6589 | + if (match_checkcompoundpattern(preword, sp->ts_prewordlen,
|
---|
| 6590 | + &slang->sl_comppat))
|
---|
| 6591 | compound_ok = FALSE;
|
---|
| 6592 |
|
---|
| 6593 | + if (compound_ok)
|
---|
| 6594 | + {
|
---|
| 6595 | + p = preword;
|
---|
| 6596 | + while (*skiptowhite(p) != NUL)
|
---|
| 6597 | + p = skipwhite(skiptowhite(p));
|
---|
| 6598 | + if (fword_ends && !can_compound(slang, p,
|
---|
| 6599 | + compflags + sp->ts_compsplit))
|
---|
| 6600 | + /* Compound is not allowed. But it may still be
|
---|
| 6601 | + * possible if we add another (short) word. */
|
---|
| 6602 | + compound_ok = FALSE;
|
---|
| 6603 | + }
|
---|
| 6604 | +
|
---|
| 6605 | /* Get pointer to last char of previous word. */
|
---|
| 6606 | p = preword + sp->ts_prewordlen;
|
---|
[61a83e8] | 6607 | mb_ptr_back(preword, p);
|
---|
[76dd250] | 6608 | @@ -11685,10 +11892,9 @@
|
---|
| 6609 | && (slang->sl_compsylmax < MAXWLEN
|
---|
| 6610 | || sp->ts_complen + 1 - sp->ts_compsplit
|
---|
| 6611 | < slang->sl_compmax)
|
---|
| 6612 | - && (byte_in_str(sp->ts_complen == sp->ts_compsplit
|
---|
| 6613 | - ? slang->sl_compstartflags
|
---|
| 6614 | - : slang->sl_compallflags,
|
---|
| 6615 | - ((unsigned)flags >> 24))))
|
---|
| 6616 | + && (can_be_compound(sp, slang,
|
---|
| 6617 | + compflags, ((unsigned)flags >> 24))))
|
---|
| 6618 | +
|
---|
| 6619 | {
|
---|
| 6620 | try_compound = TRUE;
|
---|
[61a83e8] | 6621 | compflags[sp->ts_complen] = ((unsigned)flags >> 24);
|
---|
| 6622 | @@ -14808,7 +15014,7 @@
|
---|
| 6623 |
|
---|
| 6624 | case 0:
|
---|
| 6625 | /*
|
---|
| 6626 | - * Lenghts are equal, thus changes must result in same length: An
|
---|
| 6627 | + * Lengths are equal, thus changes must result in same length: An
|
---|
| 6628 | * insert is only possible in combination with a delete.
|
---|
| 6629 | * 1: check if for identical strings
|
---|
[76dd250] | 6630 | */
|
---|
| 6631 | diff -Naur vim72.orig/src/structs.h vim72/src/structs.h
|
---|
[54f612f] | 6632 | --- vim72.orig/src/structs.h 2008-07-30 13:02:50.000000000 -0700
|
---|
[76dd250] | 6633 | +++ vim72/src/structs.h 2009-02-22 21:57:36.281067746 -0800
|
---|
| 6634 | @@ -459,7 +459,7 @@
|
---|
| 6635 | typedef struct
|
---|
| 6636 | {
|
---|
| 6637 | int hide; /* TRUE when ":hide" was used */
|
---|
| 6638 | -# ifdef FEAT_BROWSE
|
---|
| 6639 | +# ifdef FEAT_BROWSE_CMD
|
---|
| 6640 | int browse; /* TRUE to invoke file dialog */
|
---|
| 6641 | # endif
|
---|
| 6642 | # ifdef FEAT_WINDOWS
|
---|
| 6643 | @@ -1784,10 +1784,15 @@
|
---|
| 6644 | #endif
|
---|
| 6645 |
|
---|
| 6646 | /*
|
---|
| 6647 | - * The next three specify the offsets for displaying the buffer:
|
---|
| 6648 | + * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
|
---|
| 6649 | + * displaying the buffer.
|
---|
| 6650 | */
|
---|
| 6651 | linenr_T w_topline; /* buffer line number of the line at the
|
---|
| 6652 | top of the window */
|
---|
| 6653 | +#ifdef FEAT_AUTOCMD
|
---|
| 6654 | + char w_topline_was_set; /* flag set to TRUE when topline is set,
|
---|
| 6655 | + e.g. by winrestview() */
|
---|
| 6656 | +#endif
|
---|
| 6657 | #ifdef FEAT_DIFF
|
---|
| 6658 | int w_topfill; /* number of filler lines above w_topline */
|
---|
| 6659 | int w_old_topfill; /* w_topfill at last redraw */
|
---|
| 6660 | diff -Naur vim72.orig/src/tag.c vim72/src/tag.c
|
---|
[54f612f] | 6661 | --- vim72.orig/src/tag.c 2008-07-16 14:31:30.000000000 -0700
|
---|
[7352c10] | 6662 | +++ vim72/src/tag.c 2009-02-22 21:58:03.130788378 -0800
|
---|
| 6663 | @@ -515,7 +515,7 @@
|
---|
| 6664 | * If a count is supplied to the ":tag <name>" command, then
|
---|
| 6665 | * jump to count'th matching tag.
|
---|
| 6666 | */
|
---|
| 6667 | - if (type == DT_TAG && count > 0)
|
---|
| 6668 | + if (type == DT_TAG && *tag != NUL && count > 0)
|
---|
| 6669 | cur_match = count - 1;
|
---|
| 6670 |
|
---|
[54f612f] | 6671 | if (type == DT_SELECT || type == DT_JUMP
|
---|
| 6672 | @@ -618,7 +618,7 @@
|
---|
| 6673 | taglen_advance(taglen);
|
---|
| 6674 | MSG_PUTS_ATTR(_("file\n"), hl_attr(HLF_T));
|
---|
| 6675 |
|
---|
| 6676 | - for (i = 0; i < num_matches; ++i)
|
---|
| 6677 | + for (i = 0; i < num_matches && !got_int; ++i)
|
---|
| 6678 | {
|
---|
| 6679 | parse_match(matches[i], &tagp);
|
---|
| 6680 | if (!new_tag && (
|
---|
| 6681 | @@ -655,6 +655,8 @@
|
---|
| 6682 | }
|
---|
| 6683 | if (msg_col > 0)
|
---|
| 6684 | msg_putchar('\n');
|
---|
| 6685 | + if (got_int)
|
---|
| 6686 | + break;
|
---|
| 6687 | msg_advance(15);
|
---|
| 6688 |
|
---|
| 6689 | /* print any extra fields */
|
---|
| 6690 | @@ -689,6 +691,8 @@
|
---|
| 6691 | if (msg_col + ptr2cells(p) >= Columns)
|
---|
| 6692 | {
|
---|
| 6693 | msg_putchar('\n');
|
---|
| 6694 | + if (got_int)
|
---|
| 6695 | + break;
|
---|
| 6696 | msg_advance(15);
|
---|
| 6697 | }
|
---|
| 6698 | p = msg_outtrans_one(p, attr);
|
---|
| 6699 | @@ -704,6 +708,8 @@
|
---|
| 6700 | if (msg_col > 15)
|
---|
| 6701 | {
|
---|
| 6702 | msg_putchar('\n');
|
---|
| 6703 | + if (got_int)
|
---|
| 6704 | + break;
|
---|
| 6705 | msg_advance(15);
|
---|
| 6706 | }
|
---|
| 6707 | }
|
---|
| 6708 | @@ -734,6 +740,8 @@
|
---|
| 6709 | {
|
---|
| 6710 | if (msg_col + (*p == TAB ? 1 : ptr2cells(p)) > Columns)
|
---|
| 6711 | msg_putchar('\n');
|
---|
| 6712 | + if (got_int)
|
---|
| 6713 | + break;
|
---|
| 6714 | msg_advance(15);
|
---|
| 6715 |
|
---|
| 6716 | /* skip backslash used for escaping command char */
|
---|
| 6717 | @@ -760,12 +768,9 @@
|
---|
| 6718 | if (msg_col)
|
---|
| 6719 | msg_putchar('\n');
|
---|
| 6720 | ui_breakcheck();
|
---|
| 6721 | - if (got_int)
|
---|
| 6722 | - {
|
---|
| 6723 | - got_int = FALSE; /* only stop the listing */
|
---|
| 6724 | - break;
|
---|
| 6725 | - }
|
---|
| 6726 | }
|
---|
| 6727 | + if (got_int)
|
---|
| 6728 | + got_int = FALSE; /* only stop the listing */
|
---|
| 6729 | ask_for_selection = TRUE;
|
---|
| 6730 | }
|
---|
| 6731 | #if defined(FEAT_QUICKFIX) && defined(FEAT_EVAL)
|
---|
| 6732 | @@ -2542,6 +2547,15 @@
|
---|
| 6733 | {
|
---|
| 6734 | ga_clear_strings(&tag_fnames);
|
---|
| 6735 | do_tag(NULL, DT_FREE, 0, 0, 0);
|
---|
| 6736 | + tag_freematch();
|
---|
| 6737 | +
|
---|
| 6738 | +# if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
---|
| 6739 | + if (ptag_entry.tagname)
|
---|
| 6740 | + {
|
---|
| 6741 | + vim_free(ptag_entry.tagname);
|
---|
| 6742 | + ptag_entry.tagname = NULL;
|
---|
| 6743 | + }
|
---|
| 6744 | +# endif
|
---|
| 6745 | }
|
---|
| 6746 | #endif
|
---|
| 6747 |
|
---|
[76dd250] | 6748 | @@ -2725,7 +2739,24 @@
|
---|
| 6749 | */
|
---|
| 6750 | p_7f = vim_strchr(lbuf, 0x7f);
|
---|
| 6751 | if (p_7f == NULL)
|
---|
| 6752 | + {
|
---|
| 6753 | +etag_fail:
|
---|
| 6754 | + if (vim_strchr(lbuf, '\n') == NULL)
|
---|
| 6755 | + {
|
---|
| 6756 | + /* Truncated line. Ignore it. */
|
---|
| 6757 | + if (p_verbose >= 5)
|
---|
| 6758 | + {
|
---|
| 6759 | + verbose_enter();
|
---|
| 6760 | + MSG(_("Ignoring long line in tags file"));
|
---|
| 6761 | + verbose_leave();
|
---|
| 6762 | + }
|
---|
| 6763 | + tagp->command = lbuf;
|
---|
| 6764 | + tagp->tagname = lbuf;
|
---|
| 6765 | + tagp->tagname_end = lbuf;
|
---|
| 6766 | + return OK;
|
---|
| 6767 | + }
|
---|
| 6768 | return FAIL;
|
---|
| 6769 | + }
|
---|
| 6770 |
|
---|
| 6771 | /* Find ^A. If not found the line number is after the 0x7f */
|
---|
[54f612f] | 6772 | p = vim_strchr(p_7f, Ctrl_A);
|
---|
[76dd250] | 6773 | @@ -2735,7 +2766,7 @@
|
---|
| 6774 | ++p;
|
---|
| 6775 |
|
---|
| 6776 | if (!VIM_ISDIGIT(*p)) /* check for start of line number */
|
---|
| 6777 | - return FAIL;
|
---|
| 6778 | + goto etag_fail;
|
---|
| 6779 | tagp->command = p;
|
---|
| 6780 |
|
---|
[54f612f] | 6781 |
|
---|
[76dd250] | 6782 | @@ -2749,7 +2780,7 @@
|
---|
| 6783 | /* find end of tagname */
|
---|
| 6784 | for (p = p_7f - 1; !vim_iswordc(*p); --p)
|
---|
| 6785 | if (p == lbuf)
|
---|
| 6786 | - return FAIL;
|
---|
| 6787 | + goto etag_fail;
|
---|
| 6788 | tagp->tagname_end = p + 1;
|
---|
| 6789 | while (p >= lbuf && vim_iswordc(*p))
|
---|
[5f4a45c9] | 6790 | --p;
|
---|
| 6791 | diff -Naur vim72.orig/src/term.c vim72/src/term.c
|
---|
[54f612f] | 6792 | --- vim72.orig/src/term.c 2008-07-27 04:48:06.000000000 -0700
|
---|
[5f4a45c9] | 6793 | +++ vim72/src/term.c 2009-02-22 21:57:51.754057829 -0800
|
---|
| 6794 | @@ -4920,7 +4920,15 @@
|
---|
| 6795 | key_name[0] = KEY2TERMCAP0(key);
|
---|
| 6796 | key_name[1] = KEY2TERMCAP1(key);
|
---|
| 6797 | if (key_name[0] == KS_KEY)
|
---|
| 6798 | - string[new_slen++] = key_name[1]; /* from ":set <M-b>=xx" */
|
---|
| 6799 | + {
|
---|
| 6800 | + /* from ":set <M-b>=xx" */
|
---|
| 6801 | +#ifdef FEAT_MBYTE
|
---|
| 6802 | + if (has_mbyte)
|
---|
| 6803 | + new_slen += (*mb_char2bytes)(key_name[1], string + new_slen);
|
---|
| 6804 | + else
|
---|
| 6805 | +#endif
|
---|
| 6806 | + string[new_slen++] = key_name[1];
|
---|
| 6807 | + }
|
---|
| 6808 | else
|
---|
| 6809 | {
|
---|
| 6810 | string[new_slen++] = K_SPECIAL;
|
---|
| 6811 | diff -Naur vim72.orig/src/testdir/Makefile vim72/src/testdir/Makefile
|
---|
[54f612f] | 6812 | --- vim72.orig/src/testdir/Makefile 2008-06-19 13:29:46.000000000 -0700
|
---|
[5f4a45c9] | 6813 | +++ vim72/src/testdir/Makefile 2009-02-22 21:57:28.688580807 -0800
|
---|
| 6814 | @@ -26,15 +26,17 @@
|
---|
| 6815 |
|
---|
| 6816 | .SUFFIXES: .in .out
|
---|
| 6817 |
|
---|
| 6818 | -nongui: nolog $(SCRIPTS)
|
---|
| 6819 | - @echo
|
---|
| 6820 | - @cat test.log
|
---|
| 6821 | - @echo ALL DONE
|
---|
| 6822 | +nongui: nolog $(SCRIPTS) report
|
---|
| 6823 | +
|
---|
| 6824 | +gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
|
---|
| 6825 |
|
---|
| 6826 | -gui: nolog $(SCRIPTS) $(SCRIPTS_GUI)
|
---|
| 6827 | +report:
|
---|
| 6828 | @echo
|
---|
| 6829 | - @cat test.log
|
---|
| 6830 | - @echo ALL DONE
|
---|
| 6831 | + @echo 'Test results:'
|
---|
| 6832 | + @/bin/sh -c "if test -f test.log; \
|
---|
| 6833 | + then cat test.log; echo TEST FAILURE; exit 1; \
|
---|
| 6834 | + else echo ALL DONE; \
|
---|
| 6835 | + fi"
|
---|
| 6836 |
|
---|
| 6837 | $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
|
---|
| 6838 |
|
---|
| 6839 | @@ -71,4 +73,4 @@
|
---|
| 6840 | test60.out: test60.vim
|
---|
| 6841 |
|
---|
| 6842 | nolog:
|
---|
| 6843 | - -echo Test results: >test.log
|
---|
[76dd250] | 6844 | + -rm -f test.log
|
---|
| 6845 | diff -Naur vim72.orig/src/testdir/Make_ming.mak vim72/src/testdir/Make_ming.mak
|
---|
[54f612f] | 6846 | --- vim72.orig/src/testdir/Make_ming.mak 1969-12-31 16:00:00.000000000 -0800
|
---|
[76dd250] | 6847 | +++ vim72/src/testdir/Make_ming.mak 2009-02-22 21:57:28.764584997 -0800
|
---|
| 6848 | @@ -0,0 +1,91 @@
|
---|
| 6849 | +# Makefile to run tests for Vim, on Dos-like machines
|
---|
| 6850 | +# with sh.exe or zsh.exe in the path or not.
|
---|
| 6851 | +#
|
---|
| 6852 | +# Author: Bill McCarthy
|
---|
| 6853 | +#
|
---|
| 6854 | +# Note that test54 has been removed until it is fixed.
|
---|
| 6855 | +#
|
---|
| 6856 | +# Requires a set of Unix tools: echo, diff, etc.
|
---|
| 6857 | +
|
---|
| 6858 | +ifneq (sh.exe, $(SHELL))
|
---|
| 6859 | +DEL = rm -f
|
---|
| 6860 | +MV = mv
|
---|
| 6861 | +CP = cp
|
---|
| 6862 | +DIRSLASH = /
|
---|
| 6863 | +else
|
---|
| 6864 | +DEL = del
|
---|
| 6865 | +MV = rename
|
---|
| 6866 | +CP = copy
|
---|
| 6867 | +DIRSLASH = \\
|
---|
| 6868 | +endif
|
---|
| 6869 | +
|
---|
| 6870 | +VIMPROG = ..$(DIRSLASH)vim
|
---|
| 6871 | +
|
---|
| 6872 | +# Omitted:
|
---|
| 6873 | +# test2 "\\tmp" doesn't work.
|
---|
| 6874 | +# test10 'errorformat' is different
|
---|
| 6875 | +# test12 can't unlink a swap file
|
---|
| 6876 | +# test25 uses symbolic link
|
---|
| 6877 | +# test27 can't edit file with "*" in file name
|
---|
| 6878 | +# test31 16 bit version runs out of memory...
|
---|
| 6879 | +
|
---|
| 6880 | +SCRIPTS16 = test1.out test19.out test20.out test22.out \
|
---|
| 6881 | + test23.out test24.out test28.out test29.out \
|
---|
| 6882 | + test35.out test36.out test43.out \
|
---|
| 6883 | + test44.out test45.out test46.out test47.out \
|
---|
| 6884 | + test48.out test51.out test53.out \
|
---|
| 6885 | + test55.out test56.out test57.out test58.out test59.out \
|
---|
| 6886 | + test60.out test61.out test62.out test63.out test64.out
|
---|
| 6887 | +
|
---|
| 6888 | +# Had to remove test54 which doesn't work yet.
|
---|
| 6889 | +# test54.out
|
---|
| 6890 | +
|
---|
| 6891 | +SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
---|
| 6892 | + test8.out test9.out test11.out test13.out test14.out \
|
---|
| 6893 | + test15.out test17.out test18.out test21.out test26.out \
|
---|
| 6894 | + test30.out test31.out test32.out test33.out test34.out \
|
---|
| 6895 | + test37.out test38.out test39.out test40.out test41.out \
|
---|
| 6896 | + test42.out test52.out test65.out
|
---|
| 6897 | +
|
---|
| 6898 | +SCRIPTS32 = test50.out
|
---|
| 6899 | +
|
---|
| 6900 | +SCRIPTS_GUI = test16.out
|
---|
| 6901 | +
|
---|
| 6902 | +.SUFFIXES: .in .out
|
---|
| 6903 | +
|
---|
| 6904 | +vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
|
---|
| 6905 | + echo ALL DONE
|
---|
| 6906 | +
|
---|
| 6907 | +nongui: fixff $(SCRIPTS16) $(SCRIPTS)
|
---|
| 6908 | + echo ALL DONE
|
---|
| 6909 | +
|
---|
| 6910 | +small:
|
---|
| 6911 | + echo ALL DONE
|
---|
| 6912 | +
|
---|
| 6913 | +gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
|
---|
| 6914 | + echo ALL DONE
|
---|
| 6915 | +
|
---|
| 6916 | +win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
|
---|
| 6917 | + echo ALL DONE
|
---|
| 6918 | +
|
---|
| 6919 | +fixff:
|
---|
| 6920 | + -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
|
---|
| 6921 | +
|
---|
| 6922 | +clean:
|
---|
| 6923 | + -$(DEL) *.out
|
---|
| 6924 | + -$(DEL) test.ok
|
---|
| 6925 | + -$(DEL) small.vim
|
---|
| 6926 | + -$(DEL) tiny.vim
|
---|
| 6927 | + -$(DEL) mbyte.vim
|
---|
| 6928 | + -$(DEL) X*
|
---|
| 6929 | + -$(DEL) viminfo
|
---|
| 6930 | +
|
---|
| 6931 | +.in.out:
|
---|
| 6932 | + $(CP) $*.ok test.ok
|
---|
| 6933 | + $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
|
---|
| 6934 | + diff test.out $*.ok
|
---|
| 6935 | + -$(DEL) $*.out
|
---|
| 6936 | + $(MV) test.out $*.out
|
---|
| 6937 | + -$(DEL) X*
|
---|
| 6938 | + -$(DEL) test.ok
|
---|
| 6939 | + -$(DEL) viminfo
|
---|
| 6940 | diff -Naur vim72.orig/src/testdir/test42.ok vim72/src/testdir/test42.ok
|
---|
[54f612f] | 6941 | --- vim72.orig/src/testdir/test42.ok 2008-02-20 04:27:37.000000000 -0800
|
---|
[76dd250] | 6942 | +++ vim72/src/testdir/test42.ok 2009-02-22 21:57:28.948596172 -0800
|
---|
| 6943 | @@ -20,7 +20,7 @@
|
---|
| 6944 | ucs-2
|
---|
| 6945 |
|
---|
| 6946 |
|
---|
| 6947 | - fileencoding=ucs-2le
|
---|
| 6948 | + fileencoding=utf-16le
|
---|
| 6949 | bomb
|
---|
| 6950 | ucs-2le
|
---|
| 6951 |
|
---|
| 6952 | diff -Naur vim72.orig/src/ui.c vim72/src/ui.c
|
---|
[54f612f] | 6953 | --- vim72.orig/src/ui.c 2008-07-14 11:14:56.000000000 -0700
|
---|
[76dd250] | 6954 | +++ vim72/src/ui.c 2009-02-22 21:57:40.653347953 -0800
|
---|
| 6955 | @@ -1820,7 +1820,7 @@
|
---|
| 6956 | #ifdef HAVE_DUP
|
---|
| 6957 | /* Use stderr for stdin, also works for shell commands. */
|
---|
| 6958 | close(0);
|
---|
| 6959 | - dup(2);
|
---|
| 6960 | + ignored = dup(2);
|
---|
| 6961 | #else
|
---|
| 6962 | read_cmd_fd = 2; /* read from stderr instead of stdin */
|
---|
| 6963 | #endif
|
---|
| 6964 | @@ -2020,7 +2020,7 @@
|
---|
| 6965 |
|
---|
| 6966 | if (value == NULL || *length == 0)
|
---|
| 6967 | {
|
---|
| 6968 | - clip_free_selection(cbd); /* ??? [what's the query?] */
|
---|
| 6969 | + clip_free_selection(cbd); /* nothing received, clear register */
|
---|
| 6970 | *(int *)success = FALSE;
|
---|
| 6971 | return;
|
---|
| 6972 | }
|
---|
| 6973 | @@ -2076,7 +2076,7 @@
|
---|
| 6974 | text_prop.value = (unsigned char *)value;
|
---|
| 6975 | text_prop.encoding = *type;
|
---|
| 6976 | text_prop.format = *format;
|
---|
| 6977 | - text_prop.nitems = STRLEN(value);
|
---|
| 6978 | + text_prop.nitems = len;
|
---|
| 6979 | status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
|
---|
| 6980 | &text_list, &n_text);
|
---|
| 6981 | if (status != Success || n_text < 1)
|
---|
| 6982 | @@ -2110,6 +2110,8 @@
|
---|
| 6983 | int i;
|
---|
| 6984 | int nbytes = 0;
|
---|
| 6985 | char_u *buffer;
|
---|
| 6986 | + time_t start_time;
|
---|
| 6987 | + int timed_out = FALSE;
|
---|
| 6988 |
|
---|
| 6989 | for (i =
|
---|
| 6990 | #ifdef FEAT_MBYTE
|
---|
| 6991 | @@ -2129,6 +2131,7 @@
|
---|
| 6992 | case 3: type = text_atom; break;
|
---|
| 6993 | default: type = XA_STRING;
|
---|
| 6994 | }
|
---|
| 6995 | + success = MAYBE;
|
---|
| 6996 | XtGetSelectionValue(myShell, cbd->sel_atom, type,
|
---|
| 6997 | clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
|
---|
| 6998 |
|
---|
| 6999 | @@ -2141,27 +2144,48 @@
|
---|
| 7000 | * characters, then they will appear before the one that requested the
|
---|
| 7001 | * paste! Don't worry, we will catch up with any other events later.
|
---|
| 7002 | */
|
---|
| 7003 | - for (;;)
|
---|
| 7004 | + start_time = time(NULL);
|
---|
| 7005 | + while (success == MAYBE)
|
---|
| 7006 | {
|
---|
| 7007 | - if (XCheckTypedEvent(dpy, SelectionNotify, &event))
|
---|
| 7008 | - break;
|
---|
| 7009 | - if (XCheckTypedEvent(dpy, SelectionRequest, &event))
|
---|
| 7010 | - /* We may get a SelectionRequest here and if we don't handle
|
---|
| 7011 | - * it we hang. KDE klipper does this, for example. */
|
---|
| 7012 | + if (XCheckTypedEvent(dpy, SelectionNotify, &event)
|
---|
| 7013 | + || XCheckTypedEvent(dpy, SelectionRequest, &event)
|
---|
| 7014 | + || XCheckTypedEvent(dpy, PropertyNotify, &event))
|
---|
| 7015 | + {
|
---|
| 7016 | + /* This is where clip_x11_request_selection_cb() should be
|
---|
| 7017 | + * called. It may actually happen a bit later, so we loop
|
---|
| 7018 | + * until "success" changes.
|
---|
| 7019 | + * We may get a SelectionRequest here and if we don't handle
|
---|
| 7020 | + * it we hang. KDE klipper does this, for example.
|
---|
| 7021 | + * We need to handle a PropertyNotify for large selections. */
|
---|
| 7022 | XtDispatchEvent(&event);
|
---|
| 7023 | + continue;
|
---|
| 7024 | + }
|
---|
| 7025 | +
|
---|
| 7026 | + /* Time out after 2 to 3 seconds to avoid that we hang when the
|
---|
| 7027 | + * other process doesn't respond. Note that the SelectionNotify
|
---|
| 7028 | + * event may still come later when the selection owner comes back
|
---|
| 7029 | + * to life and the text gets inserted unexpectedly. Don't know
|
---|
| 7030 | + * why that happens or how to avoid that :-(. */
|
---|
| 7031 | + if (time(NULL) > start_time + 2)
|
---|
| 7032 | + {
|
---|
| 7033 | + timed_out = TRUE;
|
---|
| 7034 | + break;
|
---|
| 7035 | + }
|
---|
| 7036 |
|
---|
| 7037 | /* Do we need this? Probably not. */
|
---|
| 7038 | XSync(dpy, False);
|
---|
| 7039 |
|
---|
| 7040 | - /* Bernhard Walle solved a slow paste response in an X terminal by
|
---|
| 7041 | - * adding: usleep(10000); here. */
|
---|
| 7042 | + /* Wait for 1 msec to avoid that we eat up all CPU time. */
|
---|
| 7043 | + ui_delay(1L, TRUE);
|
---|
| 7044 | }
|
---|
| 7045 |
|
---|
| 7046 | - /* this is where clip_x11_request_selection_cb() is actually called */
|
---|
| 7047 | - XtDispatchEvent(&event);
|
---|
| 7048 | -
|
---|
| 7049 | - if (success)
|
---|
| 7050 | + if (success == TRUE)
|
---|
| 7051 | return;
|
---|
| 7052 | +
|
---|
| 7053 | + /* don't do a retry with another type after timing out, otherwise we
|
---|
| 7054 | + * hang for 15 seconds. */
|
---|
| 7055 | + if (timed_out)
|
---|
| 7056 | + break;
|
---|
| 7057 | }
|
---|
| 7058 |
|
---|
| 7059 | /* Final fallback position - use the X CUT_BUFFER0 store */
|
---|
| 7060 | diff -Naur vim72.orig/src/version.c vim72/src/version.c
|
---|
[54f612f] | 7061 | --- vim72.orig/src/version.c 2008-08-09 07:24:52.000000000 -0700
|
---|
| 7062 | +++ vim72/src/version.c 2009-02-22 21:58:03.130788378 -0800
|
---|
[76dd250] | 7063 | @@ -677,9 +677,248 @@
|
---|
| 7064 | static int included_patches[] =
|
---|
| 7065 | { /* Add new patch number below this line */
|
---|
[54f612f] | 7066 | /**/
|
---|
| 7067 | + 124,
|
---|
| 7068 | +/**/
|
---|
| 7069 | + 123,
|
---|
| 7070 | +/**/
|
---|
| 7071 | + 122,
|
---|
| 7072 | +/**/
|
---|
| 7073 | + 121,
|
---|
| 7074 | +/**/
|
---|
| 7075 | + 120,
|
---|
| 7076 | +/**/
|
---|
| 7077 | + 119,
|
---|
| 7078 | +/**/
|
---|
| 7079 | + 118,
|
---|
| 7080 | +/**/
|
---|
| 7081 | + 117,
|
---|
| 7082 | +/**/
|
---|
| 7083 | + 116,
|
---|
| 7084 | +/**/
|
---|
| 7085 | + 115,
|
---|
| 7086 | +/**/
|
---|
| 7087 | + 114,
|
---|
| 7088 | +/**/
|
---|
| 7089 | + 113,
|
---|
| 7090 | +/**/
|
---|
| 7091 | + 112,
|
---|
| 7092 | +/**/
|
---|
| 7093 | + 111,
|
---|
| 7094 | +/**/
|
---|
| 7095 | + 110,
|
---|
| 7096 | +/**/
|
---|
| 7097 | + 109,
|
---|
[61a83e8] | 7098 | +/**/
|
---|
| 7099 | + 108,
|
---|
| 7100 | +/**/
|
---|
| 7101 | + 107,
|
---|
| 7102 | +/**/
|
---|
| 7103 | + 106,
|
---|
| 7104 | +/**/
|
---|
| 7105 | + 105,
|
---|
| 7106 | +/**/
|
---|
| 7107 | + 104,
|
---|
| 7108 | +/**/
|
---|
| 7109 | + 103,
|
---|
[9a875fd] | 7110 | +/**/
|
---|
| 7111 | + 102,
|
---|
| 7112 | +/**/
|
---|
| 7113 | + 100,
|
---|
| 7114 | +/**/
|
---|
| 7115 | + 99,
|
---|
| 7116 | +/**/
|
---|
| 7117 | + 98,
|
---|
| 7118 | +/**/
|
---|
| 7119 | + 97,
|
---|
| 7120 | +/**/
|
---|
| 7121 | + 96,
|
---|
| 7122 | +/**/
|
---|
| 7123 | + 95,
|
---|
| 7124 | +/**/
|
---|
| 7125 | + 94,
|
---|
[5f4a45c9] | 7126 | +/**/
|
---|
| 7127 | + 92,
|
---|
| 7128 | +/**/
|
---|
| 7129 | + 91,
|
---|
| 7130 | +/**/
|
---|
| 7131 | + 90,
|
---|
| 7132 | +/**/
|
---|
| 7133 | + 87,
|
---|
| 7134 | +/**/
|
---|
| 7135 | + 86,
|
---|
| 7136 | +/**/
|
---|
| 7137 | + 85,
|
---|
[7352c10] | 7138 | +/**/
|
---|
| 7139 | + 84,
|
---|
| 7140 | +/**/
|
---|
| 7141 | + 83,
|
---|
| 7142 | +/**/
|
---|
| 7143 | + 82,
|
---|
| 7144 | +/**/
|
---|
| 7145 | + 81,
|
---|
| 7146 | +/**/
|
---|
| 7147 | + 80,
|
---|
[43c52a1] | 7148 | +/**/
|
---|
| 7149 | + 79,
|
---|
| 7150 | +/**/
|
---|
| 7151 | + 78,
|
---|
| 7152 | +/**/
|
---|
| 7153 | + 77,
|
---|
[1f22c7c] | 7154 | +/**/
|
---|
| 7155 | + 76,
|
---|
| 7156 | +/**/
|
---|
| 7157 | + 75,
|
---|
| 7158 | +/**/
|
---|
| 7159 | + 73,
|
---|
| 7160 | +/**/
|
---|
| 7161 | + 70,
|
---|
[76dd250] | 7162 | +/**/
|
---|
| 7163 | + 69,
|
---|
| 7164 | +/**/
|
---|
| 7165 | + 68,
|
---|
| 7166 | +/**/
|
---|
| 7167 | + 67,
|
---|
| 7168 | +/**/
|
---|
| 7169 | + 66,
|
---|
| 7170 | +/**/
|
---|
| 7171 | + 65,
|
---|
| 7172 | +/**/
|
---|
| 7173 | + 64,
|
---|
| 7174 | +/**/
|
---|
| 7175 | + 63,
|
---|
| 7176 | +/**/
|
---|
| 7177 | + 62,
|
---|
| 7178 | +/**/
|
---|
| 7179 | + 61,
|
---|
| 7180 | +/**/
|
---|
| 7181 | + 60,
|
---|
| 7182 | +/**/
|
---|
| 7183 | + 59,
|
---|
| 7184 | +/**/
|
---|
| 7185 | + 58,
|
---|
| 7186 | +/**/
|
---|
| 7187 | + 57,
|
---|
| 7188 | +/**/
|
---|
| 7189 | + 56,
|
---|
| 7190 | +/**/
|
---|
| 7191 | + 55,
|
---|
| 7192 | +/**/
|
---|
| 7193 | + 54,
|
---|
| 7194 | +/**/
|
---|
| 7195 | + 53,
|
---|
| 7196 | +/**/
|
---|
| 7197 | + 52,
|
---|
| 7198 | +/**/
|
---|
| 7199 | + 51,
|
---|
| 7200 | +/**/
|
---|
| 7201 | + 50,
|
---|
| 7202 | +/**/
|
---|
| 7203 | + 48,
|
---|
| 7204 | +/**/
|
---|
| 7205 | + 47,
|
---|
| 7206 | +/**/
|
---|
| 7207 | + 46,
|
---|
| 7208 | +/**/
|
---|
| 7209 | + 45,
|
---|
| 7210 | +/**/
|
---|
| 7211 | + 44,
|
---|
| 7212 | +/**/
|
---|
| 7213 | + 43,
|
---|
| 7214 | +/**/
|
---|
| 7215 | + 42,
|
---|
| 7216 | +/**/
|
---|
| 7217 | + 40,
|
---|
| 7218 | +/**/
|
---|
| 7219 | + 39,
|
---|
| 7220 | +/**/
|
---|
| 7221 | + 38,
|
---|
| 7222 | +/**/
|
---|
| 7223 | + 37,
|
---|
| 7224 | +/**/
|
---|
| 7225 | + 35,
|
---|
| 7226 | +/**/
|
---|
| 7227 | + 34,
|
---|
| 7228 | +/**/
|
---|
| 7229 | + 33,
|
---|
| 7230 | +/**/
|
---|
| 7231 | + 32,
|
---|
| 7232 | +/**/
|
---|
| 7233 | + 31,
|
---|
| 7234 | +/**/
|
---|
| 7235 | + 30,
|
---|
| 7236 | +/**/
|
---|
| 7237 | + 29,
|
---|
| 7238 | +/**/
|
---|
| 7239 | + 28,
|
---|
| 7240 | +/**/
|
---|
| 7241 | + 27,
|
---|
| 7242 | +/**/
|
---|
| 7243 | + 26,
|
---|
| 7244 | +/**/
|
---|
| 7245 | + 25,
|
---|
| 7246 | +/**/
|
---|
| 7247 | + 24,
|
---|
| 7248 | +/**/
|
---|
| 7249 | + 23,
|
---|
| 7250 | +/**/
|
---|
| 7251 | + 22,
|
---|
| 7252 | +/**/
|
---|
| 7253 | + 21,
|
---|
| 7254 | +/**/
|
---|
| 7255 | + 20,
|
---|
| 7256 | +/**/
|
---|
| 7257 | + 19,
|
---|
| 7258 | +/**/
|
---|
| 7259 | + 18,
|
---|
| 7260 | +/**/
|
---|
| 7261 | + 17,
|
---|
| 7262 | +/**/
|
---|
| 7263 | + 16,
|
---|
| 7264 | +/**/
|
---|
| 7265 | + 15,
|
---|
| 7266 | +/**/
|
---|
| 7267 | + 14,
|
---|
| 7268 | +/**/
|
---|
| 7269 | + 13,
|
---|
| 7270 | +/**/
|
---|
| 7271 | + 12,
|
---|
| 7272 | +/**/
|
---|
| 7273 | + 11,
|
---|
| 7274 | +/**/
|
---|
| 7275 | + 10,
|
---|
| 7276 | +/**/
|
---|
| 7277 | + 9,
|
---|
| 7278 | +/**/
|
---|
| 7279 | + 8,
|
---|
| 7280 | +/**/
|
---|
| 7281 | + 6,
|
---|
| 7282 | +/**/
|
---|
| 7283 | + 5,
|
---|
| 7284 | +/**/
|
---|
| 7285 | + 4,
|
---|
| 7286 | +/**/
|
---|
| 7287 | + 3,
|
---|
| 7288 | +/**/
|
---|
| 7289 | + 2,
|
---|
| 7290 | +/**/
|
---|
| 7291 | + 1,
|
---|
| 7292 | +/**/
|
---|
| 7293 | 0
|
---|
| 7294 | };
|
---|
| 7295 |
|
---|
| 7296 | +/*
|
---|
| 7297 | + * Place to put a short description when adding a feature with a patch.
|
---|
| 7298 | + * Keep it short, e.g.,: "relative numbers", "persistent undo".
|
---|
| 7299 | + * Also add a comment marker to separate the lines.
|
---|
[1f22c7c] | 7300 | + * See the official Vim patches for the diff format: It must use a context of
|
---|
[76dd250] | 7301 | + * one line only. Create it by hand or use "diff -C2" and edit the patch.
|
---|
| 7302 | + */
|
---|
| 7303 | +static char *(extra_patches[]) =
|
---|
| 7304 | +{ /* Add your patch description below this line */
|
---|
| 7305 | +/**/
|
---|
| 7306 | + NULL
|
---|
| 7307 | +};
|
---|
| 7308 | +
|
---|
| 7309 | int
|
---|
| 7310 | highest_patch()
|
---|
[54f612f] | 7311 | {
|
---|
[76dd250] | 7312 | @@ -786,7 +1025,7 @@
|
---|
| 7313 | MSG_PUTS(_("\nRISC OS version"));
|
---|
| 7314 | #endif
|
---|
| 7315 | #ifdef VMS
|
---|
| 7316 | - MSG_PUTS("\nOpenVMS version");
|
---|
| 7317 | + MSG_PUTS(_("\nOpenVMS version"));
|
---|
| 7318 | # ifdef HAVE_PATHDEF
|
---|
| 7319 | if (*compiled_arch != NUL)
|
---|
[54f612f] | 7320 | {
|
---|
[76dd250] | 7321 | @@ -825,6 +1064,19 @@
|
---|
| 7322 | }
|
---|
| 7323 | }
|
---|
| 7324 |
|
---|
| 7325 | + /* Print the list of extra patch descriptions if there is at least one. */
|
---|
| 7326 | + if (extra_patches[0] != NULL)
|
---|
| 7327 | + {
|
---|
| 7328 | + MSG_PUTS(_("\nExtra patches: "));
|
---|
| 7329 | + s = "";
|
---|
| 7330 | + for (i = 0; extra_patches[i] != NULL; ++i)
|
---|
| 7331 | + {
|
---|
| 7332 | + MSG_PUTS(s);
|
---|
| 7333 | + s = ", ";
|
---|
| 7334 | + MSG_PUTS(extra_patches[i]);
|
---|
| 7335 | + }
|
---|
| 7336 | + }
|
---|
| 7337 | +
|
---|
| 7338 | #ifdef MODIFIED_BY
|
---|
| 7339 | MSG_PUTS("\n");
|
---|
| 7340 | MSG_PUTS(_("Modified by "));
|
---|
| 7341 | diff -Naur vim72.orig/src/vim.h vim72/src/vim.h
|
---|
[54f612f] | 7342 | --- vim72.orig/src/vim.h 2008-08-09 09:03:38.000000000 -0700
|
---|
[76dd250] | 7343 | +++ vim72/src/vim.h 2009-02-22 21:58:03.090785025 -0800
|
---|
| 7344 | @@ -341,8 +341,14 @@
|
---|
| 7345 | #ifdef BACKSLASH_IN_FILENAME
|
---|
| 7346 | # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<")
|
---|
| 7347 | #else
|
---|
| 7348 | -# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
|
---|
| 7349 | -# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
|
---|
| 7350 | +# ifdef VMS
|
---|
| 7351 | + /* VMS allows a lot of characters in the file name */
|
---|
| 7352 | +# define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!")
|
---|
| 7353 | +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&")
|
---|
| 7354 | +# else
|
---|
| 7355 | +# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
|
---|
| 7356 | +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
|
---|
| 7357 | +# endif
|
---|
| 7358 | #endif
|
---|
| 7359 |
|
---|
| 7360 | #define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */
|
---|
| 7361 | @@ -370,7 +376,7 @@
|
---|
| 7362 | * Define __w64 as an empty token for everything but MSVC 7.x or later.
|
---|
| 7363 | */
|
---|
| 7364 | # if !defined(_MSC_VER) || (_MSC_VER < 1300)
|
---|
| 7365 | -# define __w64
|
---|
| 7366 | +# define __w64
|
---|
| 7367 | # endif
|
---|
| 7368 | typedef unsigned long __w64 long_u;
|
---|
[54f612f] | 7369 | typedef long __w64 long_i;
|
---|
| 7370 | @@ -1051,6 +1057,7 @@
|
---|
| 7371 | #define WSP_HELP 16 /* creating the help window */
|
---|
| 7372 | #define WSP_BELOW 32 /* put new window below/right */
|
---|
| 7373 | #define WSP_ABOVE 64 /* put new window above/left */
|
---|
| 7374 | +#define WSP_NEWLOC 128 /* don't copy location list */
|
---|
| 7375 |
|
---|
| 7376 | /*
|
---|
| 7377 | * arguments for gui_set_shellsize()
|
---|
[76dd250] | 7378 | @@ -1728,7 +1735,8 @@
|
---|
| 7379 | #define VV_MOUSE_COL 51
|
---|
| 7380 | #define VV_OP 52
|
---|
| 7381 | #define VV_SEARCHFORWARD 53
|
---|
| 7382 | -#define VV_LEN 54 /* number of v: vars */
|
---|
| 7383 | +#define VV_OLDFILES 54
|
---|
| 7384 | +#define VV_LEN 55 /* number of v: vars */
|
---|
| 7385 |
|
---|
| 7386 | #ifdef FEAT_CLIPBOARD
|
---|
[54f612f] | 7387 |
|
---|
[76dd250] | 7388 | @@ -1979,6 +1987,9 @@
|
---|
| 7389 | # endif
|
---|
| 7390 | #endif
|
---|
| 7391 |
|
---|
| 7392 | +#ifndef FEAT_NETBEANS_INTG
|
---|
| 7393 | +# undef NBDEBUG
|
---|
| 7394 | +#endif
|
---|
| 7395 | #ifdef NBDEBUG /* Netbeans debugging. */
|
---|
| 7396 | # include "nbdebug.h"
|
---|
[54f612f] | 7397 | #else
|
---|
[76dd250] | 7398 | @@ -2054,4 +2065,10 @@
|
---|
| 7399 | #define DOSO_VIMRC 1 /* loading vimrc file */
|
---|
| 7400 | #define DOSO_GVIMRC 2 /* loading gvimrc file */
|
---|
| 7401 |
|
---|
| 7402 | +/* flags for read_viminfo() and children */
|
---|
| 7403 | +#define VIF_WANT_INFO 1 /* load non-mark info */
|
---|
| 7404 | +#define VIF_WANT_MARKS 2 /* load file marks */
|
---|
| 7405 | +#define VIF_FORCEIT 4 /* overwrite info already read */
|
---|
| 7406 | +#define VIF_GET_OLDFILES 8 /* load v:oldfiles */
|
---|
| 7407 | +
|
---|
| 7408 | #endif /* VIM__H */
|
---|
| 7409 | diff -Naur vim72.orig/src/window.c vim72/src/window.c
|
---|
[54f612f] | 7410 | --- vim72.orig/src/window.c 2008-08-06 04:00:30.000000000 -0700
|
---|
| 7411 | +++ vim72/src/window.c 2009-02-22 21:58:03.090785025 -0800
|
---|
| 7412 | @@ -12,7 +12,7 @@
|
---|
| 7413 | static int path_is_url __ARGS((char_u *p));
|
---|
| 7414 | #if defined(FEAT_WINDOWS) || defined(PROTO)
|
---|
| 7415 | static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir));
|
---|
| 7416 | -static void win_init __ARGS((win_T *newp, win_T *oldp));
|
---|
| 7417 | +static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
|
---|
| 7418 | static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
|
---|
| 7419 | static void frame_setheight __ARGS((frame_T *curfrp, int height));
|
---|
| 7420 | #ifdef FEAT_VERTSPLIT
|
---|
| 7421 | @@ -593,9 +593,7 @@
|
---|
| 7422 | ++allow_keys; /* no mapping for xchar, but allow key codes */
|
---|
| 7423 | if (xchar == NUL)
|
---|
| 7424 | xchar = plain_vgetc();
|
---|
| 7425 | -#ifdef FEAT_LANGMAP
|
---|
| 7426 | LANGMAP_ADJUST(xchar, TRUE);
|
---|
| 7427 | -#endif
|
---|
| 7428 | --no_mapping;
|
---|
| 7429 | --allow_keys;
|
---|
| 7430 | #ifdef FEAT_CMDL_INFO
|
---|
| 7431 | @@ -912,7 +910,7 @@
|
---|
| 7432 | return FAIL;
|
---|
| 7433 |
|
---|
| 7434 | /* make the contents of the new window the same as the current one */
|
---|
| 7435 | - win_init(wp, curwin);
|
---|
| 7436 | + win_init(wp, curwin, flags);
|
---|
| 7437 | }
|
---|
| 7438 |
|
---|
| 7439 | /*
|
---|
| 7440 | @@ -1161,11 +1159,15 @@
|
---|
| 7441 | * Initialize window "newp" from window "oldp".
|
---|
| 7442 | * Used when splitting a window and when creating a new tab page.
|
---|
| 7443 | * The windows will both edit the same buffer.
|
---|
| 7444 | + * WSP_NEWLOC may be specified in flags to prevent the location list from
|
---|
| 7445 | + * being copied.
|
---|
| 7446 | */
|
---|
| 7447 | +/*ARGSUSED*/
|
---|
| 7448 | static void
|
---|
| 7449 | -win_init(newp, oldp)
|
---|
| 7450 | +win_init(newp, oldp, flags)
|
---|
| 7451 | win_T *newp;
|
---|
| 7452 | win_T *oldp;
|
---|
| 7453 | + int flags;
|
---|
| 7454 | {
|
---|
| 7455 | int i;
|
---|
| 7456 |
|
---|
| 7457 | @@ -1190,7 +1192,14 @@
|
---|
| 7458 | copy_jumplist(oldp, newp);
|
---|
| 7459 | #endif
|
---|
| 7460 | #ifdef FEAT_QUICKFIX
|
---|
| 7461 | - copy_loclist(oldp, newp);
|
---|
| 7462 | + if (flags & WSP_NEWLOC)
|
---|
| 7463 | + {
|
---|
| 7464 | + /* Don't copy the location list. */
|
---|
| 7465 | + newp->w_llist = NULL;
|
---|
| 7466 | + newp->w_llist_ref = NULL;
|
---|
| 7467 | + }
|
---|
| 7468 | + else
|
---|
| 7469 | + copy_loclist(oldp, newp);
|
---|
| 7470 | #endif
|
---|
| 7471 | if (oldp->w_localdir != NULL)
|
---|
| 7472 | newp->w_localdir = vim_strsave(oldp->w_localdir);
|
---|
| 7473 | @@ -3220,7 +3229,7 @@
|
---|
| 7474 | else
|
---|
| 7475 | {
|
---|
| 7476 | /* First window in new tab page, initialize it from "oldwin". */
|
---|
| 7477 | - win_init(curwin, oldwin);
|
---|
| 7478 | + win_init(curwin, oldwin, 0);
|
---|
| 7479 |
|
---|
| 7480 | # ifdef FEAT_SCROLLBIND
|
---|
| 7481 | /* We don't want scroll-binding in the first window. */
|
---|
[76dd250] | 7482 | @@ -4028,14 +4037,14 @@
|
---|
| 7483 | if (mch_dirname(cwd, MAXPATHL) == OK)
|
---|
| 7484 | globaldir = vim_strsave(cwd);
|
---|
| 7485 | }
|
---|
| 7486 | - mch_chdir((char *)curwin->w_localdir);
|
---|
| 7487 | - shorten_fnames(TRUE);
|
---|
| 7488 | + if (mch_chdir((char *)curwin->w_localdir) == 0)
|
---|
| 7489 | + shorten_fnames(TRUE);
|
---|
| 7490 | }
|
---|
| 7491 | else if (globaldir != NULL)
|
---|
| 7492 | {
|
---|
| 7493 | /* Window doesn't have a local directory and we are not in the global
|
---|
| 7494 | * directory: Change to the global directory. */
|
---|
| 7495 | - mch_chdir((char *)globaldir);
|
---|
| 7496 | + ignored = mch_chdir((char *)globaldir);
|
---|
| 7497 | vim_free(globaldir);
|
---|
| 7498 | globaldir = NULL;
|
---|
| 7499 | shorten_fnames(TRUE);
|
---|
| 7500 | diff -Naur vim72.orig/src/workshop.c vim72/src/workshop.c
|
---|
[54f612f] | 7501 | --- vim72.orig/src/workshop.c 2008-06-21 11:53:26.000000000 -0700
|
---|
[76dd250] | 7502 | +++ vim72/src/workshop.c 2009-02-22 21:57:40.565341248 -0800
|
---|
| 7503 | @@ -1121,8 +1121,12 @@
|
---|
| 7504 | ? (char *)curbuf->b_sfname : "<None>");
|
---|
| 7505 | #endif
|
---|
| 7506 |
|
---|
| 7507 | - strcpy(ffname, (char *) curbuf->b_ffname);
|
---|
| 7508 | - *filename = ffname; /* copy so nobody can change b_ffname */
|
---|
| 7509 | + if (curbuf->b_ffname == NULL)
|
---|
| 7510 | + ffname[0] = NUL;
|
---|
| 7511 | + else
|
---|
| 7512 | + /* copy so nobody can change b_ffname */
|
---|
| 7513 | + strcpy(ffname, (char *) curbuf->b_ffname);
|
---|
| 7514 | + *filename = ffname;
|
---|
| 7515 | *curLine = curwin->w_cursor.lnum;
|
---|
| 7516 | *curCol = curwin->w_cursor.col;
|
---|
| 7517 |
|
---|