source:
patches/vim-7.2-branch_update-3.patch@
7f8be39
Last change on this file since 7f8be39 was 1f22c7c, checked in by , 16 years ago | |
---|---|
|
|
File size: 160.4 KB |
-
Filelist
Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 12-30-2008 Initial Package Version: 7.2 Origin: Upstream Upstream Status: Applied Description: Contains all upstream patches up to 7.2.076 The following patches were skipped 007 036 041 049 071 072 074 diff -Naur vim72.orig/Filelist vim72/Filelist
old new 285 285 src/proto/os_win32.pro \ 286 286 src/proto/os_mswin.pro \ 287 287 src/testdir/Make_dos.mak \ 288 src/testdir/Make_ming.mak \ 288 289 src/testdir/dos.vim \ 289 290 src/uninstal.c \ 290 291 src/vim.def \ -
runtime/doc/cmdline.txt
diff -Naur vim72.orig/runtime/doc/cmdline.txt vim72/runtime/doc/cmdline.txt
old new 1 *cmdline.txt* For Vim version 7.2. Last change: 2008 Jul 291 *cmdline.txt* For Vim version 7.2. Last change: 2008 Sep 18 2 2 3 3 4 4 VIM REFERENCE MANUAL by Bram Moolenaar … … 157 157 (doesn't work at the expression prompt; some 158 158 things such as changing the buffer or current 159 159 window are not allowed to avoid side effects) 160 When the result is a |List| the items are used 161 as lines. They can have line breaks inside 162 too. 163 When the result is a Float it's automatically 164 converted to a String. 160 165 See |registers| about registers. {not in Vi} 161 166 Implementation detail: When using the |expression| register 162 167 and invoking setcmdpos(), this sets the position before … … 730 735 In Ex commands, at places where a file name can be used, the following 731 736 characters have a special meaning. These can also be used in the expression 732 737 function expand() |expand()|. 733 % is replaced with the current file name *:_%*734 # is replaced with the alternate file name *:_#*738 % Is replaced with the current file name. *:_%* *c_%* 739 # Is replaced with the alternate file name. *:_#* *c_#* 735 740 #n (where n is a number) is replaced with the file name of 736 buffer n. "#0" is the same as "#" 737 ## is replaced with all names in the argument list *:_##*741 buffer n. "#0" is the same as "#". 742 ## Is replaced with all names in the argument list *:_##* *c_##* 738 743 concatenated, separated by spaces. Each space in a name 739 744 is preceded with a backslash. 740 Note that these give the file name as it was typed. If an absolute path is 741 needed (when using the file name from a different directory), you need to add 742 ":p". See |filename-modifiers|. 745 #<n (where n is a number > 0) is replaced with old *:_#<* *c_#<* 746 file name n. See |:oldfiles| or |v:oldfiles| to get the 747 number. *E809* 748 {only when compiled with the +eval and +viminfo features} 749 750 Note that these, except "#<n", give the file name as it was typed. If an 751 absolute path is needed (when using the file name from a different directory), 752 you need to add ":p". See |filename-modifiers|. 753 754 The "#<n" item returns an absolute path, but it will start with "~/" for files 755 below your home directory. 756 743 757 Note that backslashes are inserted before spaces, so that the command will 744 758 correctly interpret the file name. But this doesn't happen for shell 745 commands. For those you probably have to use quotes: > 759 commands. For those you probably have to use quotes (this fails for files 760 that contain a quote and wildcards): > 746 761 :!ls "%" 747 762 :r !spell "%" 748 763 -
runtime/doc/eval.txt
diff -Naur vim72.orig/runtime/doc/eval.txt vim72/runtime/doc/eval.txt
old new 1 *eval.txt* For Vim version 7.2. Last change: 2008 Aug 091 *eval.txt* For Vim version 7.2. Last change: 2008 Nov 27 2 2 3 3 4 4 VIM REFERENCE MANUAL by Bram Moolenaar … … 1484 1484 This is the screen column number, like with |virtcol()|. The 1485 1485 value is zero when there was no mouse button click. 1486 1486 1487 *v:oldfiles* *oldfiles-variable* 1488 v:oldfiles List of file names that is loaded from the |viminfo| file on 1489 startup. These are the files that Vim remembers marks for. 1490 The length of the List is limited by the ' argument of the 1491 'viminfo' option (default is 100). 1492 Also see |:oldfiles| and |c_#<|. 1493 The List can be modified, but this has no effect on what is 1494 stored in the |viminfo| file later. If you use values other 1495 than String this will cause trouble. 1496 {only when compiled with the +viminfo feature} 1497 1487 1498 *v:operator* *operator-variable* 1488 1499 v:operator The last operator given in Normal mode. This is a single 1489 1500 character except for commands starting with <g> or <z>, … … 1695 1706 exists( {expr}) Number TRUE if {expr} exists 1696 1707 extend({expr1}, {expr2} [, {expr3}]) 1697 1708 List/Dict insert items of {expr2} into {expr1} 1698 expand( {expr} )String expand special keywords in {expr}1709 expand( {expr} [, {flag}]) String expand special keywords in {expr} 1699 1710 feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer 1700 1711 filereadable( {file}) Number TRUE if {file} is a readable file 1701 1712 filewritable( {file}) Number TRUE if {file} is a writable file … … 1747 1758 getwinposx() Number X coord in pixels of GUI Vim window 1748 1759 getwinposy() Number Y coord in pixels of GUI Vim window 1749 1760 getwinvar( {nr}, {varname}) any variable {varname} in window {nr} 1750 glob( {expr}) String expand file wildcards in {expr} 1751 globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path} 1761 glob( {expr} [, {flag}]) String expand file wildcards in {expr} 1762 globpath( {path}, {expr} [, {flag}]) 1763 String do glob({expr}) for all dirs in {path} 1752 1764 has( {feature}) Number TRUE if feature {feature} supported 1753 1765 has_key( {dict}, {key}) Number TRUE if {dict} has entry {key} 1754 1766 haslocaldir() Number TRUE if current window executed |:lcd| … … 3275 3287 :let list_is_on = getwinvar(2, '&list') 3276 3288 :echo "myvar = " . getwinvar(1, 'myvar') 3277 3289 < 3278 3279 glob({expr})Expand the file wildcards in {expr}. See |wildcards| for the3290 glob({expr} [, {flag}]) *glob()* 3291 Expand the file wildcards in {expr}. See |wildcards| for the 3280 3292 use of special characters. 3281 3293 The result is a String. 3282 3294 When there are several matches, they are separated by <NL> 3283 3295 characters. 3284 The 'wildignore' option applies: Names matching one of the 3285 patterns in 'wildignore' will be skipped. 3296 Unless the optional {flag} argument is given and is non-zero, 3297 the 'suffixes' and 'wildignore' options apply: Names matching 3298 one of the patterns in 'wildignore' will be skipped and 3299 'suffixes' affect the ordering of matches. 3286 3300 If the expansion fails, the result is an empty string. 3287 3301 A name for a non-existing file is not included. 3288 3302 … … 3296 3310 See |expand()| for expanding special Vim variables. See 3297 3311 |system()| for getting the raw output of an external command. 3298 3312 3299 globpath({path}, {expr} )*globpath()*3313 globpath({path}, {expr} [, {flag}]) *globpath()* 3300 3314 Perform glob() on all directories in {path} and concatenate 3301 3315 the results. Example: > 3302 3316 :echo globpath(&rtp, "syntax/c.vim") 3303 3317 < {path} is a comma-separated list of directory names. Each 3304 3318 directory name is prepended to {expr} and expanded like with 3305 glob(). A path separator is inserted when needed.3319 |glob()|. A path separator is inserted when needed. 3306 3320 To add a comma inside a directory name escape it with a 3307 3321 backslash. Note that on MS-Windows a directory may have a 3308 3322 trailing backslash, remove it if you put a comma after it. 3309 3323 If the expansion fails for one of the directories, there is no 3310 3324 error message. 3311 The 'wildignore' option applies: Names matching one of the 3312 patterns in 'wildignore' will be skipped. 3325 Unless the optional {flag} argument is given and is non-zero, 3326 the 'suffixes' and 'wildignore' options apply: Names matching 3327 one of the patterns in 'wildignore' will be skipped and 3328 'suffixes' affect the ordering of matches. 3313 3329 3314 3330 The "**" item can be used to search in a directory tree. 3315 3331 For example, to find all "README.txt" files in the directories … … 5332 5348 "fg" foreground color (GUI: color name used to set 5333 5349 the color, cterm: color number as a string, 5334 5350 term: empty string) 5335 "bg" background color (like "fg") 5351 "bg" background color (as with "fg") 5352 "sp" special color (as with "fg") |highlight-guisp| 5336 5353 "fg#" like "fg", but for the GUI and the GUI is 5337 5354 running the name in "#RRGGBB" form 5338 5355 "bg#" like "fg#" for "bg" 5356 "sp#" like "fg#" for "sp" 5339 5357 "bold" "1" if bold 5340 5358 "italic" "1" if italic 5341 5359 "reverse" "1" if reverse … … 5823 5841 mouse_pterm Compiled with support for qnx pterm mouse. 5824 5842 mouse_sysmouse Compiled with support for sysmouse (*BSD console mouse) 5825 5843 mouse_xterm Compiled with support for xterm mouse. 5826 multi_byte Compiled with support for editing Korean et al. 5844 multi_byte Compiled with support for 'encoding' 5845 multi_byte_encoding 'encoding' is set to a multi-byte encoding. 5827 5846 multi_byte_ime Compiled with support for IME input method. 5828 5847 multi_lang Compiled with support for multiple languages. 5829 5848 mzscheme Compiled with MzScheme interface |mzscheme|. -
runtime/doc/options.txt
diff -Naur vim72.orig/runtime/doc/options.txt vim72/runtime/doc/options.txt
old new 1 *options.txt* For Vim version 7.2. Last change: 2008 Aug 061 *options.txt* For Vim version 7.2. Last change: 2008 Nov 25 2 2 3 3 4 4 VIM REFERENCE MANUAL by Bram Moolenaar … … 7472 7472 {not available when compiled without the |+wildignore| 7473 7473 feature} 7474 7474 A list of file patterns. A file that matches with one of these 7475 patterns is ignored when completing file or directory names. 7475 patterns is ignored when completing file or directory names, and 7476 influences the result of |expand()|, |glob()| and |globpath()| unless 7477 a flag is passed to disable this. 7476 7478 The pattern is used like with |:autocmd|, see |autocmd-patterns|. 7477 7479 Also see 'suffixes'. 7478 7480 Example: > -
runtime/doc/spell.txt
diff -Naur vim72.orig/runtime/doc/spell.txt vim72/runtime/doc/spell.txt
old new 1 *spell.txt* For Vim version 7.2. Last change: 2008 Jun 211 *spell.txt* For Vim version 7.2. Last change: 2008 Nov 30 2 2 3 3 4 4 VIM REFERENCE MANUAL by Bram Moolenaar … … 831 831 832 832 # comment line ~ 833 833 834 With some items it's also possible to put a comment after it, but this isn't 835 supported in general. 834 Items with a fixed number of arguments can be followed by a comment. But only 835 if none of the arguments can contain white space. The comment must start with 836 a "#" character. Example: 837 838 KEEPCASE = # fix case for words with this flag ~ 836 839 837 840 838 841 ENCODING *spell-SET* … … 965 968 966 969 Note: When using utf-8 only characters up to 65000 may be used for flags. 967 970 971 Note: even when using "num" or "long" the number of flags available to 972 compounding and prefixes is limited to about 250. 973 968 974 969 975 AFFIXES 970 976 *spell-PFX* *spell-SFX* … … 1178 1184 The flag also applies to the word with affixes, thus this can be used to mark 1179 1185 a whole bunch of related words as bad. 1180 1186 1187 *spell-FORBIDDENWORD* 1188 FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell. 1189 1181 1190 *spell-NEEDAFFIX* 1182 1191 The NEEDAFFIX flag is used to require that a word is used with an affix. The 1183 1192 word itself is not a good word (unless there is an empty affix). Example: … … 1268 1277 1269 1278 NEEDCOMPOUND & ~ 1270 1279 1280 *spell-ONLYINCOMPOUND* 1281 The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for 1282 compatiblity with Hunspell. 1283 1271 1284 *spell-COMPOUNDMIN* 1272 1285 The minimal character length of a word used for compounding is specified with 1273 1286 COMPOUNDMIN. Example: … … 1328 1341 rules. Can also be used for an affix to count the affix as a compounding 1329 1342 word. 1330 1343 1344 *spell-CHECKCOMPOUNDPATTERN* 1345 CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the 1346 position where two words are compounded together forbids the compound. 1347 For example: 1348 CHECKCOMPOUNDPATTERN o e ~ 1349 1350 This forbids compounding if the first word ends in "o" and the second word 1351 starts with "e". 1352 1353 The arguments must be plain text, no patterns are actually supported, despite 1354 the item name. Case is always ignored. 1355 1356 The Hunspell feature to use three arguments and flags is not supported. 1357 1331 1358 *spell-SYLLABLE* 1332 1359 The SYLLABLE item defines characters or character sequences that are used to 1333 1360 count the number of syllables in a word. Example: … … 1496 1523 ACCENT (Hunspell) *spell-ACCENT* 1497 1524 Use MAP instead. |spell-MAP| 1498 1525 1526 BREAK (Hunspell) *spell-BREAK* 1527 Define break points. Unclear how it works exactly. 1528 Not supported. 1529 1499 1530 CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE* 1500 1531 Disallow uppercase letters at compound word boundaries. 1501 1532 Not supported. … … 1512 1543 Forbid three identical characters when compounding. Not 1513 1544 supported. 1514 1545 1515 CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN*1516 Forbid compounding when patterns match. Not supported.1517 1518 1546 COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES* 1519 1547 Enables using two prefixes. Not supported. 1520 1548 … … 1536 1564 COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE* 1537 1565 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE| 1538 1566 1567 COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES* 1568 Number of COMPOUNDRULE lines following. Ignored, but the 1569 argument must be a number. 1570 1539 1571 COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE* 1540 1572 Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE| 1541 1573 |spell-COMPOUNDSYLMAX| 1542 1574 1543 FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD* 1544 Use BAD instead. |spell-BAD| 1545 1575 KEY (Hunspell) *spell-KEY* 1576 Define characters that are close together on the keyboard. 1577 Used to give better suggestions. Not supported. 1578 1546 1579 LANG (Hunspell) *spell-LANG* 1547 1580 This specifies language-specific behavior. This actually 1548 1581 moves part of the language knowledge into the program, … … 1553 1586 Only needed for morphological analysis. 1554 1587 1555 1588 MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS* 1556 Not supported. 1557 1558 ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND* 1559 Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND| 1589 Set number of n-gram suggestions. Not supported. 1560 1590 1561 1591 PSEUDOROOT (Hunspell) *spell-PSEUDOROOT* 1562 1592 Use NEEDAFFIX instead. |spell-NEEDAFFIX| -
runtime/doc/starting.txt
diff -Naur vim72.orig/runtime/doc/starting.txt vim72/runtime/doc/starting.txt
old new 1 *starting.txt* For Vim version 7.2. Last change: 2008 Jun 211 *starting.txt* For Vim version 7.2. Last change: 2008 Nov 09 2 2 3 3 4 4 VIM REFERENCE MANUAL by Bram Moolenaar … … 1337 1337 *viminfo-read* 1338 1338 When Vim is started and the 'viminfo' option is non-empty, the contents of 1339 1339 the viminfo file are read and the info can be used in the appropriate places. 1340 The marks are not read in at startup (but file marks are). See 1341 |initialization| for how to set the 'viminfo' option upon startup. 1340 The |v:oldfiles| variable is filled. The marks are not read in at startup 1341 (but file marks are). See |initialization| for how to set the 'viminfo' 1342 option upon startup. 1342 1343 1343 1344 *viminfo-write* 1344 1345 When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo … … 1372 1373 that start with any string given with the "r" flag in 'viminfo'. This can be 1373 1374 used to avoid saving marks for files on removable media (for MS-DOS you would 1374 1375 use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:"). 1376 The |v:oldfiles| variable is filled with the file names that the viminfo file 1377 has marks for. 1375 1378 1376 1379 *viminfo-file-marks* 1377 1380 Uppercase marks ('A to 'Z) are stored when writing the viminfo file. The … … 1463 1466 *:rv* *:rviminfo* *E195* 1464 1467 :rv[iminfo][!] [file] Read from viminfo file [file] (default: see above). 1465 1468 If [!] is given, then any information that is 1466 already set (registers, marks, etc.) will be1467 overwritten.{not in Vi}1469 already set (registers, marks, |v:oldfiles|, etc.) 1470 will be overwritten {not in Vi} 1468 1471 1469 1472 *:wv* *:wviminfo* *E137* *E138* *E574* 1470 1473 :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above). … … 1479 1482 the .viminfo file. 1480 1483 {not in Vi} 1481 1484 1485 *:ol* *:oldfiles* 1486 :ol[dfiles] List the files that have marks stored in the viminfo 1487 file. This list is read on startup and only changes 1488 afterwards with ":rviminfo!". Also see |v:oldfiles|. 1489 The number can be used with |c_#<|. 1490 {not in Vi, only when compiled with the +eval feature} 1491 1492 :bro[wse] ol[dfiles][!] 1493 List file names as with |:oldfiles|, and then prompt 1494 for a number. When the number is valid that file from 1495 the list is edited. 1496 If you get the |press-enter| prompt you can press "q" 1497 and still get the prompt to enter a file number. 1498 Use ! to abondon a modified buffer. |abandon| 1499 {not when compiled with tiny or small features} 1500 1482 1501 vim:tw=78:ts=8:ft=help:norl: -
runtime/doc/usr_21.txt
diff -Naur vim72.orig/runtime/doc/usr_21.txt vim72/runtime/doc/usr_21.txt
old new 1 *usr_21.txt* For Vim version 7.2. Last change: 200 7 May 011 *usr_21.txt* For Vim version 7.2. Last change: 2008 Nov 09 2 2 3 3 VIM USER MANUAL - by Bram Moolenaar 4 4 … … 153 153 to be lost. Each item can be remembered only once. 154 154 155 155 156 GETTING BACK TO WHERE YOU WERE156 GETTING BACK TO WHERE YOU STOPPED VIM 157 157 158 158 You are halfway editing a file and it's time to leave for holidays. You exit 159 159 Vim and go enjoy yourselves, forgetting all about your work. After a couple … … 168 168 The |:marks| command is useful to find out where '0 to '9 will take you. 169 169 170 170 171 GETTING BACK TO SOME FILE 172 173 If you want to go back to a file that you edited recently, but not when 174 exiting Vim, there is a slightly more complicated way. You can see a list of 175 files by typing the command: > 176 177 :oldfiles 178 < 1: ~/.viminfo ~ 179 2: ~/text/resume.txt ~ 180 3: /tmp/draft ~ 181 182 Now you would like to edit the second file, which is in the list preceded by 183 "2:". You type: > 184 185 :e #<2 186 187 Instead of ":e" you can use any command that has a file name argument, the 188 "#<2" item works in the same place as "%" (current file name) and "#" 189 (alternate file name). So you can also split the window to edit the third 190 file: > 191 192 :split #<3 193 194 That #<123 thing is a bit complicated when you just want to edit a file. 195 Fortunately there is a simpler way: > 196 197 :browse oldfiles 198 < 1: ~/.viminfo ~ 199 2: ~/text/resume.txt ~ 200 3: /tmp/draft ~ 201 -- More -- 202 203 You get the same list of files as with |:oldfiles|. If you want to edit 204 "resume.txt" first press "q" to stop the listing. You will get a prompt: 205 206 Type number and <Enter> (empty cancels): ~ 207 208 Type "2" and press <Enter> to edit the second file. 209 210 More info at |:oldfiles|, |v:oldfiles| and |c_#<|. 211 212 171 213 MOVE INFO FROM ONE VIM TO ANOTHER 172 214 173 215 You can use the ":wviminfo" and ":rviminfo" commands to save and restore the -
runtime/scripts.vim
diff -Naur vim72.orig/runtime/scripts.vim vim72/runtime/scripts.vim
old new 234 234 elseif s:line1 =~ '\<DTD\s\+XHTML\s' 235 235 set ft=xhtml 236 236 237 " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN") 238 elseif s:line1 =~? '\<DOCTYPE\s\+html\>' 239 set ft=html 240 237 241 " PDF 238 242 elseif s:line1 =~ '^%PDF-' 239 243 set ft=pdf -
src/auto/configure
diff -Naur vim72.orig/src/auto/configure vim72/src/auto/configure
old new 16819 16819 LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" 16820 16820 fi 16821 16821 16822 { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&516823 $as_echo_n "checking for GCC 3 or later... " >&6; }16824 16822 DEPEND_CFLAGS_FILTER= 16825 16823 if test "$GCC" = yes; then 16824 { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5 16825 $as_echo_n "checking for GCC 3 or later... " >&6; } 16826 16826 gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'` 16827 16827 if test "$gccmajor" -gt "2"; then 16828 16828 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'" 16829 fi16830 fi 16831 if test "$DEPEND_CFLAGS_FILTER" = ""; then 16832 { $as_echo "$as_me:$LINENO: result: no" >&516829 { $as_echo "$as_me:$LINENO: result: yes" >&5 16830 $as_echo "yes" >&6; } 16831 else 16832 { $as_echo "$as_me:$LINENO: result: no" >&5 16833 16833 $as_echo "no" >&6; } 16834 else 16835 { $as_echo "$as_me:$LINENO: result: yes" >&5 16834 fi 16835 { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5 16836 $as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; } 16837 if test "$gccmajor" -gt "3"; then 16838 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1" 16839 { $as_echo "$as_me:$LINENO: result: yes" >&5 16836 16840 $as_echo "yes" >&6; } 16841 else 16842 { $as_echo "$as_me:$LINENO: result: no" >&5 16843 $as_echo "no" >&6; } 16844 fi 16837 16845 fi 16838 16846 16839 16847 -
src/buffer.c
diff -Naur vim72.orig/src/buffer.c vim72/src/buffer.c
old new 647 647 vim_free(buf->b_start_fenc); 648 648 buf->b_start_fenc = NULL; 649 649 #endif 650 #ifdef FEAT_SPELL 651 ga_clear(&buf->b_langp); 652 #endif 650 653 } 651 654 652 655 /* … … 1237 1240 * "buf" if one exists */ 1238 1241 if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf)) 1239 1242 return OK; 1240 /* If 'switchbuf' cont ians "usetab": jump to first window in any tab1243 /* If 'switchbuf' contains "usetab": jump to first window in any tab 1241 1244 * page containing "buf" if one exists */ 1242 1245 if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf)) 1243 1246 return OK; … … 1351 1354 } 1352 1355 } 1353 1356 #ifdef FEAT_AUTOCMD 1357 /* An autocommand may have deleted "buf", already entered it (e.g., when 1358 * it did ":bunload") or aborted the script processing! */ 1354 1359 # ifdef FEAT_EVAL 1355 /* An autocommand may have deleted buf or aborted the script processing! */ 1356 if (buf_valid(buf) && !aborting()) 1360 if (buf_valid(buf) && buf != curbuf && !aborting()) 1357 1361 # else 1358 if (buf_valid(buf) ) /* an autocommand may have deleted buf! */1362 if (buf_valid(buf) && buf != curbuf) 1359 1363 # endif 1360 1364 #endif 1361 1365 enter_buffer(buf); … … 1397 1401 curwin->w_cursor.coladd = 0; 1398 1402 #endif 1399 1403 curwin->w_set_curswant = TRUE; 1404 #ifdef FEAT_AUTOCMD 1405 curwin->w_topline_was_set = FALSE; 1406 #endif 1400 1407 1401 1408 /* Make sure the buffer is loaded. */ 1402 1409 if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */ … … 1436 1443 maketitle(); 1437 1444 #endif 1438 1445 #ifdef FEAT_AUTOCMD 1439 if (curwin->w_topline == 1) /* when autocmds didn't change it */ 1446 /* when autocmds didn't change it */ 1447 if (curwin->w_topline == 1 && !curwin->w_topline_was_set) 1440 1448 #endif 1441 1449 scroll_cursor_halfway(FALSE); /* redisplay at correct position */ 1442 1450 … … 3963 3971 width = vim_strsize(out); 3964 3972 if (maxwidth > 0 && width > maxwidth) 3965 3973 { 3966 /* Result is too long, must trunc tate somewhere. */3974 /* Result is too long, must truncate somewhere. */ 3967 3975 l = 0; 3968 3976 if (itemcnt == 0) 3969 3977 s = out; … … 5062 5070 { 5063 5071 if (buf->b_sfname != NULL) 5064 5072 return (char *)buf->b_sfname; 5065 return "[Scratch]";5073 return _("[Scratch]"); 5066 5074 } 5067 5075 #endif 5068 5076 if (buf->b_fname == NULL) -
src/configure.in
diff -Naur vim72.orig/src/configure.in vim72/src/configure.in
old new 3152 3152 dnl But only when making dependencies, cproto and lint don't take "-isystem". 3153 3153 dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow 3154 3154 dnl the number before the version number. 3155 AC_MSG_CHECKING(for GCC 3 or later)3156 3155 DEPEND_CFLAGS_FILTER= 3157 3156 if test "$GCC" = yes; then 3157 AC_MSG_CHECKING(for GCC 3 or later) 3158 3158 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'` 3159 3159 if test "$gccmajor" -gt "2"; then 3160 3160 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'" 3161 AC_MSG_RESULT(yes) 3162 else 3163 AC_MSG_RESULT(no) 3164 fi 3165 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is 3166 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0. 3167 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1) 3168 if test "$gccmajor" -gt "3"; then 3169 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1" 3170 AC_MSG_RESULT(yes) 3171 else 3172 AC_MSG_RESULT(no) 3161 3173 fi 3162 fi3163 if test "$DEPEND_CFLAGS_FILTER" = ""; then3164 AC_MSG_RESULT(no)3165 else3166 AC_MSG_RESULT(yes)3167 3174 fi 3168 3175 AC_SUBST(DEPEND_CFLAGS_FILTER) 3169 3176 -
src/diff.c
diff -Naur vim72.orig/src/diff.c vim72/src/diff.c
old new 73 73 { 74 74 tp->tp_diffbuf[i] = NULL; 75 75 tp->tp_diff_invalid = TRUE; 76 if (tp == curtab) 77 diff_redraw(TRUE); 76 78 } 77 79 } 78 80 } … … 102 104 { 103 105 curtab->tp_diffbuf[i] = NULL; 104 106 curtab->tp_diff_invalid = TRUE; 107 diff_redraw(TRUE); 105 108 } 106 109 } 107 110 } … … 131 134 { 132 135 curtab->tp_diffbuf[i] = buf; 133 136 curtab->tp_diff_invalid = TRUE; 137 diff_redraw(TRUE); 134 138 return; 135 139 } 136 140 … … 661 665 char_u *tmp_diff; 662 666 FILE *fd; 663 667 int ok; 668 int io_error = FALSE; 664 669 665 670 /* Delete all diffblocks. */ 666 671 diff_clear(curtab); … … 697 702 { 698 703 ok = FALSE; 699 704 fd = mch_fopen((char *)tmp_orig, "w"); 700 if (fd != NULL) 705 if (fd == NULL) 706 io_error = TRUE; 707 else 701 708 { 702 fwrite("line1\n", (size_t)6, (size_t)1, fd); 709 if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1) 710 io_error = TRUE; 703 711 fclose(fd); 704 712 fd = mch_fopen((char *)tmp_new, "w"); 705 if (fd != NULL) 713 if (fd == NULL) 714 io_error = TRUE; 715 else 706 716 { 707 fwrite("line2\n", (size_t)6, (size_t)1, fd); 717 if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1) 718 io_error = TRUE; 708 719 fclose(fd); 709 720 diff_file(tmp_orig, tmp_new, tmp_diff); 710 721 fd = mch_fopen((char *)tmp_diff, "r"); 711 if (fd != NULL) 722 if (fd == NULL) 723 io_error = TRUE; 724 else 712 725 { 713 726 char_u linebuf[LBUFLEN]; 714 727 … … 761 774 } 762 775 if (!ok) 763 776 { 777 if (io_error) 778 EMSG(_("E810: Cannot read or write temp files")); 764 779 EMSG(_("E97: Cannot create diffs")); 765 780 diff_a_works = MAYBE; 766 781 #if defined(MSWIN) || defined(MSDOS) … … 925 940 { 926 941 # ifdef TEMPDIRNAMES 927 942 if (vim_tempdir != NULL) 928 mch_chdir((char *)vim_tempdir);943 ignored = mch_chdir((char *)vim_tempdir); 929 944 else 930 945 # endif 931 mch_chdir("/tmp");946 ignored = mch_chdir("/tmp"); 932 947 shorten_fnames(TRUE); 933 948 } 934 949 #endif -
src/eval.c
diff -Naur vim72.orig/src/eval.c vim72/src/eval.c
old new 32 32 33 33 #define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */ 34 34 35 #define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not 36 be freed. */ 37 35 38 /* 36 39 * In a hashtab item "hi_key" points to "di_key" in a dictitem. 37 40 * This avoids adding a pointer to the hashtab item. … … 348 351 {VV_NAME("mouse_col", VAR_NUMBER), 0}, 349 352 {VV_NAME("operator", VAR_STRING), VV_RO}, 350 353 {VV_NAME("searchforward", VAR_NUMBER), 0}, 354 {VV_NAME("oldfiles", VAR_LIST), 0}, 351 355 }; 352 356 353 357 /* shorthand */ … … 355 359 #define vv_nr vv_di.di_tv.vval.v_number 356 360 #define vv_float vv_di.di_tv.vval.v_float 357 361 #define vv_str vv_di.di_tv.vval.v_string 362 #define vv_list vv_di.di_tv.vval.v_list 358 363 #define vv_tv vv_di.di_tv 359 364 360 365 /* … … 426 431 static long list_idx_of_item __ARGS((list_T *l, listitem_T *item)); 427 432 static void list_append __ARGS((list_T *l, listitem_T *item)); 428 433 static int list_append_tv __ARGS((list_T *l, typval_T *tv)); 429 static int list_append_string __ARGS((list_T *l, char_u *str, int len));430 434 static int list_append_number __ARGS((list_T *l, varnumber_T n)); 431 435 static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item)); 432 436 static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef)); … … 788 792 static void func_unref __ARGS((char_u *name)); 789 793 static void func_ref __ARGS((char_u *name)); 790 794 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)); 795 static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ; 796 static void free_funccal __ARGS((funccall_T *fc, int free_val)); 791 797 static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr)); 792 798 static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp)); 793 799 static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off)); … … 845 851 p = &vimvars[i]; 846 852 if (p->vv_di.di_tv.v_type == VAR_STRING) 847 853 { 848 vim_free(p->vv_di.di_tv.vval.v_string); 849 p->vv_di.di_tv.vval.v_string = NULL; 854 vim_free(p->vv_str); 855 p->vv_str = NULL; 856 } 857 else if (p->vv_di.di_tv.v_type == VAR_LIST) 858 { 859 list_unref(p->vv_list); 860 p->vv_list = NULL; 850 861 } 851 862 } 852 863 hash_clear(&vimvarht); 864 hash_init(&vimvarht); /* garbage_collect() will access it */ 853 865 hash_clear(&compat_hashtab); 854 866 855 867 /* script-local variables */ … … 916 928 /* pointer to funccal for currently active function */ 917 929 funccall_T *current_funccal = NULL; 918 930 931 /* pointer to list of previously used funccal, still around because some 932 * item in it is still being used. */ 933 funccall_T *previous_funccal = NULL; 934 919 935 /* 920 936 * Return TRUE when a function was ended by a ":return" command. 921 937 */ … … 1256 1272 1257 1273 /* 1258 1274 * Top level evaluation function, returning a string. 1275 * When "convert" is TRUE convert a List into a sequence of lines and convert 1276 * a Float to a String. 1259 1277 * Return pointer to allocated memory, or NULL for failure. 1260 1278 */ 1261 1279 char_u * 1262 eval_to_string(arg, nextcmd, dolist)1280 eval_to_string(arg, nextcmd, convert) 1263 1281 char_u *arg; 1264 1282 char_u **nextcmd; 1265 int dolist; /* turn List into sequence of lines */1283 int convert; 1266 1284 { 1267 1285 typval_T tv; 1268 1286 char_u *retval; 1269 1287 garray_T ga; 1288 char_u numbuf[NUMBUFLEN]; 1270 1289 1271 1290 if (eval0(arg, &tv, nextcmd, TRUE) == FAIL) 1272 1291 retval = NULL; 1273 1292 else 1274 1293 { 1275 if ( dolist && tv.v_type == VAR_LIST)1294 if (convert && tv.v_type == VAR_LIST) 1276 1295 { 1277 1296 ga_init2(&ga, (int)sizeof(char), 80); 1278 1297 if (tv.vval.v_list != NULL) … … 1280 1299 ga_append(&ga, NUL); 1281 1300 retval = (char_u *)ga.ga_data; 1282 1301 } 1302 #ifdef FEAT_FLOAT 1303 else if (convert && tv.v_type == VAR_FLOAT) 1304 { 1305 vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float); 1306 retval = vim_strsave(numbuf); 1307 } 1308 #endif 1283 1309 else 1284 1310 retval = vim_strsave(get_tv_string(&tv)); 1285 1311 clear_tv(&tv); … … 3277 3303 3278 3304 if (*startarg != '(') 3279 3305 { 3280 EMSG2(_("E107: Missing braces: %s"), eap->arg);3306 EMSG2(_("E107: Missing parentheses: %s"), eap->arg); 3281 3307 goto end; 3282 3308 } 3283 3309 … … 3657 3683 } 3658 3684 3659 3685 /* 3660 * Return TRUE if typeval "tv" is locked: Either tha value is locked itself or3661 * it refers to a List or Dictionary that is locked.3686 * Return TRUE if typeval "tv" is locked: Either that value is locked itself 3687 * or it refers to a List or Dictionary that is locked. 3662 3688 */ 3663 3689 static int 3664 3690 tv_islocked(tv) … … 6047 6073 } 6048 6074 6049 6075 /* 6076 * Get list item "l[idx - 1]" as a string. Returns NULL for failure. 6077 */ 6078 char_u * 6079 list_find_str(l, idx) 6080 list_T *l; 6081 long idx; 6082 { 6083 listitem_T *li; 6084 6085 li = list_find(l, idx - 1); 6086 if (li == NULL) 6087 { 6088 EMSGN(_(e_listidx), idx); 6089 return NULL; 6090 } 6091 return get_tv_string(&li->li_tv); 6092 } 6093 6094 /* 6050 6095 * Locate "item" list "l" and return its index. 6051 6096 * Returns -1 when "item" is not in the list. 6052 6097 */ … … 6137 6182 * When "len" >= 0 use "str[len]". 6138 6183 * Returns FAIL when out of memory. 6139 6184 */ 6140 staticint6185 int 6141 6186 list_append_string(l, str, len) 6142 6187 list_T *l; 6143 6188 char_u *str; … … 6454 6499 buf_T *buf; 6455 6500 win_T *wp; 6456 6501 int i; 6457 funccall_T *fc ;6502 funccall_T *fc, **pfc; 6458 6503 int did_free = FALSE; 6459 6504 #ifdef FEAT_WINDOWS 6460 6505 tabpage_T *tp; … … 6497 6542 set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID); 6498 6543 } 6499 6544 6545 /* v: vars */ 6546 set_ref_in_ht(&vimvarht, copyID); 6547 6500 6548 /* 6501 6549 * 2. Go through the list of dicts and free items without the copyID. 6502 6550 */ … … 6535 6583 else 6536 6584 ll = ll->lv_used_next; 6537 6585 6586 /* check if any funccal can be freed now */ 6587 for (pfc = &previous_funccal; *pfc != NULL; ) 6588 { 6589 if (can_free_funccal(*pfc, copyID)) 6590 { 6591 fc = *pfc; 6592 *pfc = fc->caller; 6593 free_funccal(fc, TRUE); 6594 did_free = TRUE; 6595 } 6596 else 6597 pfc = &(*pfc)->caller; 6598 } 6599 6538 6600 return did_free; 6539 6601 } 6540 6602 … … 6587 6649 { 6588 6650 case VAR_DICT: 6589 6651 dd = tv->vval.v_dict; 6590 if (dd ->dv_copyID != copyID)6652 if (dd != NULL && dd->dv_copyID != copyID) 6591 6653 { 6592 6654 /* Didn't see this dict yet. */ 6593 6655 dd->dv_copyID = copyID; … … 6597 6659 6598 6660 case VAR_LIST: 6599 6661 ll = tv->vval.v_list; 6600 if (ll ->lv_copyID != copyID)6662 if (ll != NULL && ll->lv_copyID != copyID) 6601 6663 { 6602 6664 /* Didn't see this list yet. */ 6603 6665 ll->lv_copyID = copyID; … … 7525 7587 {"getwinposx", 0, 0, f_getwinposx}, 7526 7588 {"getwinposy", 0, 0, f_getwinposy}, 7527 7589 {"getwinvar", 2, 2, f_getwinvar}, 7528 {"glob", 1, 1, f_glob},7529 {"globpath", 2, 2, f_globpath},7590 {"glob", 1, 2, f_glob}, 7591 {"globpath", 2, 3, f_globpath}, 7530 7592 {"has", 1, 1, f_has}, 7531 7593 {"has_key", 2, 2, f_has_key}, 7532 7594 {"haslocaldir", 0, 0, f_haslocaldir}, … … 9518 9580 else 9519 9581 { 9520 9582 /* When the optional second argument is non-zero, don't remove matches 9521 * for ' suffixes' and 'wildignore'*/9583 * for 'wildignore' and don't put matches for 'suffixes' at the end. */ 9522 9584 if (argvars[1].v_type != VAR_UNKNOWN 9523 9585 && get_tv_number_chk(&argvars[1], &error)) 9524 9586 flags |= WILD_KEEP_ALL; … … 10300 10362 s = get_tv_string(&argvars[0]); 10301 10363 if (s == NULL || *s == NUL || VIM_ISDIGIT(*s)) 10302 10364 EMSG2(_(e_invarg2), s); 10303 else if (!function_exists(s)) 10365 /* Don't check an autoload name for existence here. */ 10366 else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s)) 10304 10367 EMSG2(_("E700: Unknown function: %s"), s); 10305 10368 else 10306 10369 { … … 10602 10665 # ifdef FEAT_WINDOWS 10603 10666 win_T *wp; 10604 10667 # endif 10605 int n= 1;10668 int winnr = 1; 10606 10669 10607 10670 if (row >= 0 && col >= 0) 10608 10671 { … … 10612 10675 (void)mouse_comp_pos(win, &row, &col, &lnum); 10613 10676 # ifdef FEAT_WINDOWS 10614 10677 for (wp = firstwin; wp != win; wp = wp->w_next) 10615 ++ n;10678 ++winnr; 10616 10679 # endif 10617 vimvars[VV_MOUSE_WIN].vv_nr = n;10680 vimvars[VV_MOUSE_WIN].vv_nr = winnr; 10618 10681 vimvars[VV_MOUSE_LNUM].vv_nr = lnum; 10619 10682 vimvars[VV_MOUSE_COL].vv_nr = col + 1; 10620 10683 } … … 11284 11347 typval_T *argvars; 11285 11348 typval_T *rettv; 11286 11349 { 11350 int flags = WILD_SILENT|WILD_USE_NL; 11287 11351 expand_T xpc; 11352 int error = FALSE; 11288 11353 11289 ExpandInit(&xpc); 11290 xpc.xp_context = EXPAND_FILES; 11354 /* When the optional second argument is non-zero, don't remove matches 11355 * for 'wildignore' and don't put matches for 'suffixes' at the end. */ 11356 if (argvars[1].v_type != VAR_UNKNOWN 11357 && get_tv_number_chk(&argvars[1], &error)) 11358 flags |= WILD_KEEP_ALL; 11291 11359 rettv->v_type = VAR_STRING; 11292 rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]), 11293 NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL); 11360 if (!error) 11361 { 11362 ExpandInit(&xpc); 11363 xpc.xp_context = EXPAND_FILES; 11364 rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]), 11365 NULL, flags, WILD_ALL); 11366 } 11367 else 11368 rettv->vval.v_string = NULL; 11294 11369 } 11295 11370 11296 11371 /* … … 11301 11376 typval_T *argvars; 11302 11377 typval_T *rettv; 11303 11378 { 11379 int flags = 0; 11304 11380 char_u buf1[NUMBUFLEN]; 11305 11381 char_u *file = get_tv_string_buf_chk(&argvars[1], buf1); 11382 int error = FALSE; 11306 11383 11384 /* When the optional second argument is non-zero, don't remove matches 11385 * for 'wildignore' and don't put matches for 'suffixes' at the end. */ 11386 if (argvars[2].v_type != VAR_UNKNOWN 11387 && get_tv_number_chk(&argvars[2], &error)) 11388 flags |= WILD_KEEP_ALL; 11307 11389 rettv->v_type = VAR_STRING; 11308 if (file == NULL )11390 if (file == NULL || error) 11309 11391 rettv->vval.v_string = NULL; 11310 11392 else 11311 rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file); 11393 rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file, 11394 flags); 11312 11395 } 11313 11396 11314 11397 /* … … 11782 11865 n = has_patch(atoi((char *)name + 5)); 11783 11866 else if (STRICMP(name, "vim_starting") == 0) 11784 11867 n = (starting != 0); 11868 #ifdef FEAT_MBYTE 11869 else if (STRICMP(name, "multi_byte_encoding") == 0) 11870 n = has_mbyte; 11871 #endif 11785 11872 #if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32) 11786 11873 else if (STRICMP(name, "balloon_multiline") == 0) 11787 11874 n = multiline_balloon_available(); … … 15838 15925 if (res == FAIL) 15839 15926 res = ITEM_COMPARE_FAIL; 15840 15927 else 15841 /* return value has wrong type */15842 15928 res = get_tv_number_chk(&rettv, &item_compare_func_err); 15843 15929 if (item_compare_func_err) 15844 res = ITEM_COMPARE_FAIL; 15930 res = ITEM_COMPARE_FAIL; /* return value has wrong type */ 15845 15931 clear_tv(&rettv); 15846 15932 return res; 15847 15933 } … … 16590 16676 p = highlight_has_attr(id, HL_INVERSE, modec); 16591 16677 break; 16592 16678 16593 case 's': /* standout */ 16594 p = highlight_has_attr(id, HL_STANDOUT, modec); 16679 case 's': 16680 if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */ 16681 p = highlight_color(id, what, modec); 16682 else /* standout */ 16683 p = highlight_has_attr(id, HL_STANDOUT, modec); 16595 16684 break; 16596 16685 16597 16686 case 'u': … … 16658 16747 col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */ 16659 16748 16660 16749 if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count 16661 && col >= 0 && col < (long)STRLEN(ml_get(lnum))16750 && col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum))) 16662 16751 && rettv_list_alloc(rettv) != FAIL) 16663 16752 { 16664 16753 (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE); … … 18097 18186 } 18098 18187 18099 18188 /* 18100 * Set v:count, v:count1 and v:prevcount. 18189 * Get List v: variable value. Caller must take care of reference count when 18190 * needed. 18191 */ 18192 list_T * 18193 get_vim_var_list(idx) 18194 int idx; 18195 { 18196 return vimvars[idx].vv_list; 18197 } 18198 18199 /* 18200 * Set v:count to "count" and v:count1 to "count1". 18201 * When "set_prevcount" is TRUE first set v:prevcount from v:count. 18101 18202 */ 18102 18203 void 18103 set_vcount(count, count1 )18204 set_vcount(count, count1, set_prevcount) 18104 18205 long count; 18105 18206 long count1; 18207 int set_prevcount; 18106 18208 { 18107 vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr; 18209 if (set_prevcount) 18210 vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr; 18108 18211 vimvars[VV_COUNT].vv_nr = count; 18109 18212 vimvars[VV_COUNT1].vv_nr = count1; 18110 18213 } … … 18132 18235 } 18133 18236 18134 18237 /* 18238 * Set List v: variable to "val". 18239 */ 18240 void 18241 set_vim_var_list(idx, val) 18242 int idx; 18243 list_T *val; 18244 { 18245 list_unref(vimvars[idx].vv_list); 18246 vimvars[idx].vv_list = val; 18247 if (val != NULL) 18248 ++val->lv_refcount; 18249 } 18250 18251 /* 18135 18252 * Set v:register if needed. 18136 18253 */ 18137 18254 void … … 18868 18985 dictitem_T *dict_var; 18869 18986 { 18870 18987 hash_init(&dict->dv_hashtab); 18871 dict->dv_refcount = 99999;18988 dict->dv_refcount = DO_NOT_FREE_CNT; 18872 18989 dict_var->di_tv.vval.v_dict = dict; 18873 18990 dict_var->di_tv.v_type = VAR_DICT; 18874 18991 dict_var->di_tv.v_lock = VAR_FIXED; … … 19205 19322 * Copy the values from typval_T "from" to typval_T "to". 19206 19323 * When needed allocates string or increases reference count. 19207 19324 * Does not make a copy of a list or dict but copies the reference! 19325 * It is OK for "from" and "to" to point to the same item. This is used to 19326 * make a copy later. 19208 19327 */ 19209 19328 static void 19210 19329 copy_tv(from, to) … … 20590 20709 int st_len = 0; 20591 20710 20592 20711 todo = (int)func_hashtab.ht_used; 20712 if (todo == 0) 20713 return; /* nothing to dump */ 20714 20593 20715 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo)); 20594 20716 20595 20717 for (hi = func_hashtab.ht_array; todo > 0; ++hi) … … 20638 20760 prof_self_cmp); 20639 20761 prof_sort_list(fd, sorttab, st_len, "SELF", TRUE); 20640 20762 } 20763 20764 vim_free(sorttab); 20641 20765 } 20642 20766 20643 20767 static void … … 21012 21136 char_u *save_sourcing_name; 21013 21137 linenr_T save_sourcing_lnum; 21014 21138 scid_T save_current_SID; 21015 funccall_T fc;21139 funccall_T *fc; 21016 21140 int save_did_emsg; 21017 21141 static int depth = 0; 21018 21142 dictitem_T *v; … … 21038 21162 21039 21163 line_breakcheck(); /* check for CTRL-C hit */ 21040 21164 21041 fc.caller = current_funccal; 21042 current_funccal = &fc; 21043 fc.func = fp; 21044 fc.rettv = rettv; 21165 fc = (funccall_T *)alloc(sizeof(funccall_T)); 21166 fc->caller = current_funccal; 21167 current_funccal = fc; 21168 fc->func = fp; 21169 fc->rettv = rettv; 21045 21170 rettv->vval.v_number = 0; 21046 fc .linenr = 0;21047 fc .returned = FALSE;21048 fc .level = ex_nesting_level;21171 fc->linenr = 0; 21172 fc->returned = FALSE; 21173 fc->level = ex_nesting_level; 21049 21174 /* Check if this function has a breakpoint. */ 21050 fc .breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);21051 fc .dbg_tick = debug_tick;21175 fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0); 21176 fc->dbg_tick = debug_tick; 21052 21177 21053 21178 /* 21054 * Note about using fc .fixvar[]: This is an array of FIXVAR_CNT variables21179 * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables 21055 21180 * with names up to VAR_SHORT_LEN long. This avoids having to alloc/free 21056 21181 * each argument variable and saves a lot of time. 21057 21182 */ 21058 21183 /* 21059 21184 * Init l: variables. 21060 21185 */ 21061 init_var_dict(&fc .l_vars, &fc.l_vars_var);21186 init_var_dict(&fc->l_vars, &fc->l_vars_var); 21062 21187 if (selfdict != NULL) 21063 21188 { 21064 21189 /* Set l:self to "selfdict". Use "name" to avoid a warning from 21065 21190 * some compiler that checks the destination size. */ 21066 v = &fc .fixvar[fixvar_idx++].var;21191 v = &fc->fixvar[fixvar_idx++].var; 21067 21192 name = v->di_key; 21068 21193 STRCPY(name, "self"); 21069 21194 v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX; 21070 hash_add(&fc .l_vars.dv_hashtab, DI2HIKEY(v));21195 hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v)); 21071 21196 v->di_tv.v_type = VAR_DICT; 21072 21197 v->di_tv.v_lock = 0; 21073 21198 v->di_tv.vval.v_dict = selfdict; … … 21079 21204 * Set a:0 to "argcount". 21080 21205 * Set a:000 to a list with room for the "..." arguments. 21081 21206 */ 21082 init_var_dict(&fc .l_avars, &fc.l_avars_var);21083 add_nr_var(&fc .l_avars, &fc.fixvar[fixvar_idx++].var, "0",21207 init_var_dict(&fc->l_avars, &fc->l_avars_var); 21208 add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0", 21084 21209 (varnumber_T)(argcount - fp->uf_args.ga_len)); 21085 v = &fc.fixvar[fixvar_idx++].var; 21086 STRCPY(v->di_key, "000"); 21210 /* Use "name" to avoid a warning from some compiler that checks the 21211 * destination size. */ 21212 v = &fc->fixvar[fixvar_idx++].var; 21213 name = v->di_key; 21214 STRCPY(name, "000"); 21087 21215 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; 21088 hash_add(&fc .l_avars.dv_hashtab, DI2HIKEY(v));21216 hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); 21089 21217 v->di_tv.v_type = VAR_LIST; 21090 21218 v->di_tv.v_lock = VAR_FIXED; 21091 v->di_tv.vval.v_list = &fc .l_varlist;21092 vim_memset(&fc .l_varlist, 0, sizeof(list_T));21093 fc .l_varlist.lv_refcount = 99999;21094 fc .l_varlist.lv_lock = VAR_FIXED;21219 v->di_tv.vval.v_list = &fc->l_varlist; 21220 vim_memset(&fc->l_varlist, 0, sizeof(list_T)); 21221 fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT; 21222 fc->l_varlist.lv_lock = VAR_FIXED; 21095 21223 21096 21224 /* 21097 21225 * Set a:firstline to "firstline" and a:lastline to "lastline". 21098 21226 * Set a:name to named arguments. 21099 21227 * Set a:N to the "..." arguments. 21100 21228 */ 21101 add_nr_var(&fc .l_avars, &fc.fixvar[fixvar_idx++].var, "firstline",21229 add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline", 21102 21230 (varnumber_T)firstline); 21103 add_nr_var(&fc .l_avars, &fc.fixvar[fixvar_idx++].var, "lastline",21231 add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline", 21104 21232 (varnumber_T)lastline); 21105 21233 for (i = 0; i < argcount; ++i) 21106 21234 { … … 21116 21244 } 21117 21245 if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN) 21118 21246 { 21119 v = &fc .fixvar[fixvar_idx++].var;21247 v = &fc->fixvar[fixvar_idx++].var; 21120 21248 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; 21121 21249 } 21122 21250 else … … 21128 21256 v->di_flags = DI_FLAGS_RO; 21129 21257 } 21130 21258 STRCPY(v->di_key, name); 21131 hash_add(&fc .l_avars.dv_hashtab, DI2HIKEY(v));21259 hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); 21132 21260 21133 21261 /* Note: the values are copied directly to avoid alloc/free. 21134 21262 * "argvars" must have VAR_FIXED for v_lock. */ … … 21137 21265 21138 21266 if (ai >= 0 && ai < MAX_FUNC_ARGS) 21139 21267 { 21140 list_append(&fc .l_varlist, &fc.l_listitems[ai]);21141 fc .l_listitems[ai].li_tv = argvars[i];21142 fc .l_listitems[ai].li_tv.v_lock = VAR_FIXED;21268 list_append(&fc->l_varlist, &fc->l_listitems[ai]); 21269 fc->l_listitems[ai].li_tv = argvars[i]; 21270 fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED; 21143 21271 } 21144 21272 } 21145 21273 … … 21204 21332 if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL)) 21205 21333 func_do_profile(fp); 21206 21334 if (fp->uf_profiling 21207 || (fc.caller != NULL && &fc.caller->func->uf_profiling))21335 || (fc->caller != NULL && fc->caller->func->uf_profiling)) 21208 21336 { 21209 21337 ++fp->uf_tm_count; 21210 21338 profile_start(&call_start); … … 21220 21348 did_emsg = FALSE; 21221 21349 21222 21350 /* call do_cmdline() to execute the lines */ 21223 do_cmdline(NULL, get_func_line, (void *) &fc,21351 do_cmdline(NULL, get_func_line, (void *)fc, 21224 21352 DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); 21225 21353 21226 21354 --RedrawingDisabled; … … 21235 21363 21236 21364 #ifdef FEAT_PROFILE 21237 21365 if (do_profiling == PROF_YES && (fp->uf_profiling 21238 || (fc .caller != NULL && &fc.caller->func->uf_profiling)))21366 || (fc->caller != NULL && fc->caller->func->uf_profiling))) 21239 21367 { 21240 21368 profile_end(&call_start); 21241 21369 profile_sub_wait(&wait_start, &call_start); 21242 21370 profile_add(&fp->uf_tm_total, &call_start); 21243 21371 profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children); 21244 if (fc .caller != NULL && &fc.caller->func->uf_profiling)21372 if (fc->caller != NULL && fc->caller->func->uf_profiling) 21245 21373 { 21246 profile_add(&fc .caller->func->uf_tm_children, &call_start);21247 profile_add(&fc .caller->func->uf_tml_children, &call_start);21374 profile_add(&fc->caller->func->uf_tm_children, &call_start); 21375 profile_add(&fc->caller->func->uf_tml_children, &call_start); 21248 21376 } 21249 21377 } 21250 21378 #endif … … 21257 21385 21258 21386 if (aborting()) 21259 21387 smsg((char_u *)_("%s aborted"), sourcing_name); 21260 else if (fc .rettv->v_type == VAR_NUMBER)21388 else if (fc->rettv->v_type == VAR_NUMBER) 21261 21389 smsg((char_u *)_("%s returning #%ld"), sourcing_name, 21262 (long)fc .rettv->vval.v_number);21390 (long)fc->rettv->vval.v_number); 21263 21391 else 21264 21392 { 21265 21393 char_u buf[MSG_BUF_LEN]; … … 21270 21398 /* The value may be very long. Skip the middle part, so that we 21271 21399 * have some idea how it starts and ends. smsg() would always 21272 21400 * truncate it at the end. */ 21273 s = tv2string(fc .rettv, &tofree, numbuf2, 0);21401 s = tv2string(fc->rettv, &tofree, numbuf2, 0); 21274 21402 if (s != NULL) 21275 21403 { 21276 21404 trunc_string(s, buf, MSG_BUF_CLEN); … … 21306 21434 } 21307 21435 21308 21436 did_emsg |= save_did_emsg; 21309 current_funccal = fc.caller; 21437 current_funccal = fc->caller; 21438 --depth; 21310 21439 21311 /* The a: variables typevals were not allocated, only free the allocated 21312 * variables. */ 21313 vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE); 21440 /* if the a:000 list and the a: dict are not referenced we can free the 21441 * funccall_T and what's in it. */ 21442 if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT 21443 && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT 21444 && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT) 21445 { 21446 free_funccal(fc, FALSE); 21447 } 21448 else 21449 { 21450 hashitem_T *hi; 21451 listitem_T *li; 21452 int todo; 21314 21453 21315 vars_clear(&fc.l_vars.dv_hashtab); /* free all l: variables */ 21316 --depth; 21454 /* "fc" is still in use. This can happen when returning "a:000" or 21455 * assigning "l:" to a global variable. 21456 * Link "fc" in the list for garbage collection later. */ 21457 fc->caller = previous_funccal; 21458 previous_funccal = fc; 21459 21460 /* Make a copy of the a: variables, since we didn't do that above. */ 21461 todo = (int)fc->l_avars.dv_hashtab.ht_used; 21462 for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi) 21463 { 21464 if (!HASHITEM_EMPTY(hi)) 21465 { 21466 --todo; 21467 v = HI2DI(hi); 21468 copy_tv(&v->di_tv, &v->di_tv); 21469 } 21470 } 21471 21472 /* Make a copy of the a:000 items, since we didn't do that above. */ 21473 for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next) 21474 copy_tv(&li->li_tv, &li->li_tv); 21475 } 21476 } 21477 21478 /* 21479 * Return TRUE if items in "fc" do not have "copyID". That means they are not 21480 * referenced from anywyere. 21481 */ 21482 static int 21483 can_free_funccal(fc, copyID) 21484 funccall_T *fc; 21485 int copyID; 21486 { 21487 return (fc->l_varlist.lv_copyID != copyID 21488 && fc->l_vars.dv_copyID != copyID 21489 && fc->l_avars.dv_copyID != copyID); 21490 } 21491 21492 /* 21493 * Free "fc" and what it contains. 21494 */ 21495 static void 21496 free_funccal(fc, free_val) 21497 funccall_T *fc; 21498 int free_val; /* a: vars were allocated */ 21499 { 21500 listitem_T *li; 21501 21502 /* The a: variables typevals may not have been allocated, only free the 21503 * allocated variables. */ 21504 vars_clear_ext(&fc->l_avars.dv_hashtab, free_val); 21505 21506 /* free all l: variables */ 21507 vars_clear(&fc->l_vars.dv_hashtab); 21508 21509 /* Free the a:000 variables if they were allocated. */ 21510 if (free_val) 21511 for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next) 21512 clear_tv(&li->li_tv); 21513 21514 vim_free(fc); 21317 21515 } 21318 21516 21319 21517 /* … … 21886 22084 } 21887 22085 } 21888 22086 22087 /* 22088 * List v:oldfiles in a nice way. 22089 */ 22090 /*ARGSUSED*/ 22091 void 22092 ex_oldfiles(eap) 22093 exarg_T *eap; 22094 { 22095 list_T *l = vimvars[VV_OLDFILES].vv_list; 22096 listitem_T *li; 22097 int nr = 0; 22098 22099 if (l == NULL) 22100 msg((char_u *)_("No old files")); 22101 else 22102 { 22103 msg_start(); 22104 msg_scroll = TRUE; 22105 for (li = l->lv_first; li != NULL && !got_int; li = li->li_next) 22106 { 22107 msg_outnum((long)++nr); 22108 MSG_PUTS(": "); 22109 msg_outtrans(get_tv_string(&li->li_tv)); 22110 msg_putchar('\n'); 22111 out_flush(); /* output one line at a time */ 22112 ui_breakcheck(); 22113 } 22114 /* Assume "got_int" was set to truncate the listing. */ 22115 got_int = FALSE; 22116 22117 #ifdef FEAT_BROWSE_CMD 22118 if (cmdmod.browse) 22119 { 22120 quit_more = FALSE; 22121 nr = prompt_for_number(FALSE); 22122 msg_starthere(); 22123 if (nr > 0) 22124 { 22125 char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES), 22126 (long)nr); 22127 22128 if (p != NULL) 22129 { 22130 p = expand_env_save(p); 22131 eap->arg = p; 22132 eap->cmdidx = CMD_edit; 22133 cmdmod.browse = FALSE; 22134 do_exedit(eap, NULL); 22135 vim_free(p); 22136 } 22137 } 22138 } 22139 #endif 22140 } 22141 } 22142 21889 22143 #endif /* FEAT_EVAL */ 21890 22144 21891 22145 -
src/ex_cmds.c
diff -Naur vim72.orig/src/ex_cmds.c vim72/src/ex_cmds.c
old new 24 24 static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out)); 25 25 #ifdef FEAT_VIMINFO 26 26 static char_u *viminfo_filename __ARGS((char_u *)); 27 static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read));27 static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags)); 28 28 static int viminfo_encoding __ARGS((vir_T *virp)); 29 29 static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing)); 30 30 #endif … … 1676 1676 1677 1677 /* 1678 1678 * read_viminfo() -- Read the viminfo file. Registers etc. which are already 1679 * set are not over-written unless force is TRUE. -- webb1679 * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb 1680 1680 */ 1681 1681 int 1682 read_viminfo(file, want_info, want_marks, forceit) 1683 char_u *file; 1684 int want_info; 1685 int want_marks; 1686 int forceit; 1682 read_viminfo(file, flags) 1683 char_u *file; /* file name or NULL to use default name */ 1684 int flags; /* VIF_WANT_INFO et al. */ 1687 1685 { 1688 1686 FILE *fp; 1689 1687 char_u *fname; … … 1691 1689 if (no_viminfo()) 1692 1690 return FAIL; 1693 1691 1694 fname = viminfo_filename(file); /* may set to default if NULL*/1692 fname = viminfo_filename(file); /* get file name in allocated buffer */ 1695 1693 if (fname == NULL) 1696 1694 return FAIL; 1697 1695 fp = mch_fopen((char *)fname, READBIN); … … 1701 1699 verbose_enter(); 1702 1700 smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"), 1703 1701 fname, 1704 want_info ? _(" info") : "", 1705 want_marks ? _(" marks") : "", 1702 (flags & VIF_WANT_INFO) ? _(" info") : "", 1703 (flags & VIF_WANT_MARKS) ? _(" marks") : "", 1704 (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "", 1706 1705 fp == NULL ? _(" FAILED") : ""); 1707 1706 verbose_leave(); 1708 1707 } … … 1712 1711 return FAIL; 1713 1712 1714 1713 viminfo_errcnt = 0; 1715 do_viminfo(fp, NULL, want_info, want_marks, forceit);1714 do_viminfo(fp, NULL, flags); 1716 1715 1717 1716 fclose(fp); 1718 1719 1717 return OK; 1720 1718 } 1721 1719 … … 1943 1941 * root. 1944 1942 */ 1945 1943 if (fp_out != NULL) 1946 (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);1944 ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid); 1947 1945 #endif 1948 1946 } 1949 1947 } … … 1968 1966 } 1969 1967 1970 1968 viminfo_errcnt = 0; 1971 do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);1969 do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS)); 1972 1970 1973 1971 fclose(fp_out); /* errors are ignored !? */ 1974 1972 if (fp_in != NULL) … … 2041 2039 * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo(). 2042 2040 */ 2043 2041 static void 2044 do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)2042 do_viminfo(fp_in, fp_out, flags) 2045 2043 FILE *fp_in; 2046 2044 FILE *fp_out; 2047 int want_info; 2048 int want_marks; 2049 int force_read; 2045 int flags; 2050 2046 { 2051 2047 int count = 0; 2052 2048 int eof = FALSE; … … 2061 2057 2062 2058 if (fp_in != NULL) 2063 2059 { 2064 if (want_info) 2065 eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL); 2060 if (flags & VIF_WANT_INFO) 2061 eof = read_viminfo_up_to_marks(&vir, 2062 flags & VIF_FORCEIT, fp_out != NULL); 2066 2063 else 2067 2064 /* Skip info, find start of marks */ 2068 2065 while (!(eof = viminfo_readline(&vir)) … … 2092 2089 write_viminfo_bufferlist(fp_out); 2093 2090 count = write_viminfo_marks(fp_out); 2094 2091 } 2095 if (fp_in != NULL && want_marks) 2096 copy_viminfo_marks(&vir, fp_out, count, eof); 2092 if (fp_in != NULL 2093 && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT))) 2094 copy_viminfo_marks(&vir, fp_out, count, eof, flags); 2097 2095 2098 2096 vim_free(vir.vir_line); 2099 2097 #ifdef FEAT_MBYTE … … 5059 5057 5060 5058 if (did_sub) 5061 5059 ++sub_nlines; 5060 vim_free(new_start); /* for when substitute was cancelled */ 5062 5061 vim_free(sub_firstline); /* free the copy of the original line */ 5063 5062 sub_firstline = NULL; 5064 5063 } -
src/ex_cmds.h
diff -Naur vim72.orig/src/ex_cmds.h vim72/src/ex_cmds.h
old new 278 278 EX(CMD_crewind, "crewind", ex_cc, 279 279 RANGE|NOTADR|COUNT|TRLBAR|BANG), 280 280 EX(CMD_cscope, "cscope", do_cscope, 281 EXTRA|NOTRLCOM| SBOXOK|XFILE),281 EXTRA|NOTRLCOM|XFILE), 282 282 EX(CMD_cstag, "cstag", do_cstag, 283 283 BANG|TRLBAR|WORD1), 284 284 EX(CMD_cunmap, "cunmap", ex_unmap, … … 506 506 EX(CMD_lclose, "lclose", ex_cclose, 507 507 RANGE|NOTADR|COUNT|TRLBAR), 508 508 EX(CMD_lcscope, "lcscope", do_cscope, 509 EXTRA|NOTRLCOM| SBOXOK|XFILE),509 EXTRA|NOTRLCOM|XFILE), 510 510 EX(CMD_left, "left", ex_align, 511 511 TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), 512 512 EX(CMD_leftabove, "leftabove", ex_wrongmodifier, … … 635 635 RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), 636 636 EX(CMD_noremap, "noremap", ex_map, 637 637 BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), 638 EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier, 639 NEEDARG|EXTRA|NOTRLCOM), 638 640 EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch, 639 641 TRLBAR|SBOXOK|CMDWIN), 640 642 EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate, … … 651 653 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), 652 654 EX(CMD_open, "open", ex_open, 653 655 RANGE|EXTRA), 656 EX(CMD_oldfiles, "oldfiles", ex_oldfiles, 657 BANG|TRLBAR|SBOXOK|CMDWIN), 654 658 EX(CMD_omap, "omap", ex_map, 655 659 EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), 656 660 EX(CMD_omapclear, "omapclear", ex_mapclear, … … 802 806 EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding, 803 807 WORD1|TRLBAR|CMDWIN), 804 808 EX(CMD_scscope, "scscope", do_scscope, 805 EXTRA|NOTRLCOM |SBOXOK),809 EXTRA|NOTRLCOM), 806 810 EX(CMD_set, "set", ex_set, 807 811 TRLBAR|EXTRA|CMDWIN|SBOXOK), 808 812 EX(CMD_setfiletype, "setfiletype", ex_setfiletype, -
src/ex_cmds2.c
diff -Naur vim72.orig/src/ex_cmds2.c vim72/src/ex_cmds2.c
old new 3145 3145 verbose_leave(); 3146 3146 } 3147 3147 #ifdef STARTUPTIME 3148 vim_snprintf( IObuff, IOSIZE, "sourcing %s", fname);3149 time_msg( IObuff, &tv_start);3148 vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname); 3149 time_msg((char *)IObuff, &tv_start); 3150 3150 time_pop(&tv_rel); 3151 3151 #endif 3152 3152 -
src/ex_docmd.c
diff -Naur vim72.orig/src/ex_docmd.c vim72/src/ex_docmd.c
old new 364 364 # define ex_function ex_ni 365 365 # define ex_delfunction ex_ni 366 366 # define ex_return ex_ni 367 # define ex_oldfiles ex_ni 367 368 #endif 368 369 static char_u *arg_all __ARGS((void)); 369 370 #ifdef FEAT_SESSION … … 1770 1771 } 1771 1772 if (checkforcmd(&ea.cmd, "browse", 3)) 1772 1773 { 1773 #ifdef FEAT_BROWSE 1774 #ifdef FEAT_BROWSE_CMD 1774 1775 cmdmod.browse = TRUE; 1775 1776 #endif 1776 1777 continue; … … 2978 2979 {"keepmarks", 3, FALSE}, 2979 2980 {"leftabove", 5, FALSE}, 2980 2981 {"lockmarks", 3, FALSE}, 2982 {"noautocmd", 3, FALSE}, 2981 2983 {"rightbelow", 6, FALSE}, 2982 2984 {"sandbox", 3, FALSE}, 2983 2985 {"silent", 3, FALSE}, … … 3608 3610 return set_context_in_autocmd(xp, arg, FALSE); 3609 3611 3610 3612 case CMD_doautocmd: 3613 case CMD_doautoall: 3611 3614 return set_context_in_autocmd(xp, arg, TRUE); 3612 3615 #endif 3613 3616 case CMD_set: … … 8749 8752 else if (*dirnow != NUL 8750 8753 && (ssop_flags & SSOP_CURDIR) && globaldir != NULL) 8751 8754 { 8752 (void)mch_chdir((char *)globaldir);8753 8755 if (mch_chdir((char *)globaldir) == OK) 8756 shorten_fnames(TRUE); 8754 8757 } 8755 8758 8756 8759 failed |= (makeopens(fd, dirnow) == FAIL); … … 9506 9509 break; 9507 9510 } 9508 9511 s = src + 1; 9512 if (*s == '<') /* "#<99" uses v:oldfiles */ 9513 ++s; 9509 9514 i = (int)getdigits(&s); 9510 9515 *usedlen = (int)(s - src); /* length of what we expand */ 9511 9516 9512 buf = buflist_findnr(i); 9513 if (buf == NULL) 9517 if (src[1] == '<') 9514 9518 { 9515 *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'"); 9519 if (*usedlen < 2) 9520 { 9521 /* Should we give an error message for #<text? */ 9522 *usedlen = 1; 9523 return NULL; 9524 } 9525 #ifdef FEAT_EVAL 9526 result = list_find_str(get_vim_var_list(VV_OLDFILES), 9527 (long)i); 9528 if (result == NULL) 9529 { 9530 *errormsg = (char_u *)""; 9531 return NULL; 9532 } 9533 #else 9534 *errormsg = (char_u *)_("E809: #< is not available without the +eval feature"); 9516 9535 return NULL; 9536 #endif 9517 9537 } 9518 if (lnump != NULL) 9519 *lnump = ECMD_LAST; 9520 if (buf->b_fname == NULL) 9538 else 9521 9539 { 9522 result = (char_u *)""; 9523 valid = 0; /* Must have ":p:h" to be valid */ 9540 buf = buflist_findnr(i); 9541 if (buf == NULL) 9542 { 9543 *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'"); 9544 return NULL; 9545 } 9546 if (lnump != NULL) 9547 *lnump = ECMD_LAST; 9548 if (buf->b_fname == NULL) 9549 { 9550 result = (char_u *)""; 9551 valid = 0; /* Must have ":p:h" to be valid */ 9552 } 9553 else 9554 result = buf->b_fname; 9524 9555 } 9525 else9526 result = buf->b_fname;9527 9556 break; 9528 9557 9529 9558 #ifdef FEAT_SEARCHPATH … … 9541 9570 #ifdef FEAT_AUTOCMD 9542 9571 case SPEC_AFILE: /* file name for autocommand */ 9543 9572 result = autocmd_fname; 9573 if (result != NULL && !autocmd_fname_full) 9574 { 9575 /* Still need to turn the fname into a full path. It is 9576 * postponed to avoid a delay when <afile> is not used. */ 9577 autocmd_fname_full = TRUE; 9578 result = FullName_save(autocmd_fname, FALSE); 9579 vim_free(autocmd_fname); 9580 autocmd_fname = result; 9581 } 9544 9582 if (result == NULL) 9545 9583 { 9546 9584 *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\""); … … 10067 10105 */ 10068 10106 if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL 10069 10107 || put_line(fd, "if file_readable(s:sx)") == FAIL 10070 || put_line(fd, " exe \"source \" . s:sx") == FAIL10108 || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL 10071 10109 || put_line(fd, "endif") == FAIL) 10072 10110 return FAIL; 10073 10111 … … 10689 10727 p_viminfo = (char_u *)"'100"; 10690 10728 if (eap->cmdidx == CMD_rviminfo) 10691 10729 { 10692 if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL) 10730 if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS 10731 | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL) 10693 10732 EMSG(_("E195: Cannot open viminfo file for reading")); 10694 10733 } 10695 10734 else -
src/ex_getln.c
diff -Naur vim72.orig/src/ex_getln.c vim72/src/ex_getln.c
old new 31 31 int cmdattr; /* attributes for prompt */ 32 32 int overstrike; /* Typing mode on the command line. Shared by 33 33 getcmdline() and put_on_cmdline(). */ 34 expand_T *xpc; /* struct being used for expansion, xp_pattern 35 may point into cmdbuff */ 34 36 int xp_context; /* type of expansion */ 35 37 # ifdef FEAT_EVAL 36 38 char_u *xp_arg; /* user-defined expansion arg */ … … 38 40 # endif 39 41 }; 40 42 41 static struct cmdline_info ccline; /* current cmdline_info */ 43 /* The current cmdline_info. It is initialized in getcmdline() and after that 44 * used by other functions. When invoking getcmdline() recursively it needs 45 * to be saved with save_cmdline() and restored with restore_cmdline(). 46 * TODO: make it local to getcmdline() and pass it around. */ 47 static struct cmdline_info ccline; 42 48 43 49 static int cmd_showtail; /* Only show path tail in lists ? */ 44 50 … … 238 244 } 239 245 240 246 ExpandInit(&xpc); 247 ccline.xpc = &xpc; 241 248 242 249 #ifdef FEAT_RIGHTLEFT 243 250 if (curwin->w_p_rl && *curwin->w_p_rlc == 's' … … 408 415 #endif 409 416 410 417 /* 411 * <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>). 418 * When there are matching completions to select <S-Tab> works like 419 * CTRL-P (unless 'wc' is <S-Tab>). 412 420 */ 413 if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)421 if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0) 414 422 c = Ctrl_P; 415 423 416 424 #ifdef FEAT_WILDMENU … … 1513 1521 int old_firstc; 1514 1522 1515 1523 vim_free(ccline.cmdbuff); 1524 xpc.xp_context = EXPAND_NOTHING; 1516 1525 if (hiscnt == hislen) 1517 1526 p = lookfor; /* back to the old one */ 1518 1527 else … … 1839 1848 #endif 1840 1849 1841 1850 ExpandCleanup(&xpc); 1851 ccline.xpc = NULL; 1842 1852 1843 1853 #ifdef FEAT_SEARCH_EXTRA 1844 1854 if (did_incsearch) … … 2508 2518 } 2509 2519 mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1); 2510 2520 vim_free(p); 2521 2522 if (ccline.xpc != NULL 2523 && ccline.xpc->xp_pattern != NULL 2524 && ccline.xpc->xp_context != EXPAND_NOTHING 2525 && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) 2526 { 2527 int i = (int)(ccline.xpc->xp_pattern - p); 2528 2529 /* If xp_pattern points inside the old cmdbuff it needs to be adjusted 2530 * to point into the newly allocated memory. */ 2531 if (i >= 0 && i <= ccline.cmdlen) 2532 ccline.xpc->xp_pattern = ccline.cmdbuff + i; 2533 } 2534 2511 2535 return OK; 2512 2536 } 2513 2537 … … 2875 2899 prev_ccline = ccline; 2876 2900 ccline.cmdbuff = NULL; 2877 2901 ccline.cmdprompt = NULL; 2902 ccline.xpc = NULL; 2878 2903 } 2879 2904 2880 2905 /* … … 3582 3607 ExpandInit(xp) 3583 3608 expand_T *xp; 3584 3609 { 3610 xp->xp_pattern = NULL; 3585 3611 xp->xp_backslash = XP_BS_NONE; 3586 3612 #ifndef BACKSLASH_IN_FILENAME 3587 3613 xp->xp_shell = FALSE; … … 4871 4897 if (s == NULL) 4872 4898 return FAIL; 4873 4899 sprintf((char *)s, "%s/%s*.vim", dirname, pat); 4874 all = globpath(p_rtp, s );4900 all = globpath(p_rtp, s, 0); 4875 4901 vim_free(s); 4876 4902 if (all == NULL) 4877 4903 return FAIL; … … 4912 4938 * newlines. Returns NULL for an error or no matches. 4913 4939 */ 4914 4940 char_u * 4915 globpath(path, file )4941 globpath(path, file, expand_options) 4916 4942 char_u *path; 4917 4943 char_u *file; 4944 int expand_options; 4918 4945 { 4919 4946 expand_T xpc; 4920 4947 char_u *buf; … … 4943 4970 { 4944 4971 add_pathsep(buf); 4945 4972 STRCAT(buf, file); 4946 if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL4947 4973 if (ExpandFromContext(&xpc, buf, &num_p, &p, 4974 WILD_SILENT|expand_options) != FAIL && num_p > 0) 4948 4975 { 4949 ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT );4976 ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options); 4950 4977 for (len = 0, i = 0; i < num_p; ++i) 4951 4978 len += (int)STRLEN(p[i]) + 1; 4952 4979 -
src/feature.h
diff -Naur vim72.orig/src/feature.h vim72/src/feature.h
old new 767 767 768 768 /* 769 769 * +browse ":browse" command. 770 * or just the ":browse" command modifier 770 771 */ 771 #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)) 772 # define FEAT_BROWSE 772 #if defined(FEAT_NORMAL) 773 # define FEAT_BROWSE_CMD 774 # 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) 775 # define FEAT_BROWSE 776 # endif 773 777 #endif 774 778 775 779 /* -
src/fileio.c
diff -Naur vim72.orig/src/fileio.c vim72/src/fileio.c
old new 932 932 else 933 933 { 934 934 if (eap != NULL && eap->force_ff != 0) 935 { 935 936 fileformat = get_fileformat_force(curbuf, eap); 937 try_unix = try_dos = try_mac = FALSE; 938 } 936 939 else if (curbuf->b_p_bin) 937 940 fileformat = EOL_UNIX; /* binary: use Unix format */ 938 941 else if (*p_ffs == NUL) … … 2211 2214 { 2212 2215 /* Use stderr for stdin, makes shell commands work. */ 2213 2216 close(0); 2214 dup(2);2217 ignored = dup(2); 2215 2218 } 2216 2219 #endif 2217 2220 … … 2341 2344 STRCAT(IObuff, _("[CR missing]")); 2342 2345 c = TRUE; 2343 2346 } 2344 if (ff_error == EOL_MAC)2345 {2346 STRCAT(IObuff, _("[NL found]"));2347 c = TRUE;2348 }2349 2347 if (split) 2350 2348 { 2351 2349 STRCAT(IObuff, _("[long lines split]")); … … 2711 2709 { 2712 2710 if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0 2713 2711 && curbuf->b_ffname != NULL) 2714 read_viminfo(NULL, FALSE, TRUE, FALSE);2712 read_viminfo(NULL, VIF_WANT_MARKS); 2715 2713 2716 2714 /* Always set b_marks_read; needed when 'viminfo' is changed to include 2717 2715 * the ' parameter after opening a buffer. */ … … 3451 3449 { 3452 3450 # ifdef UNIX 3453 3451 # ifdef HAVE_FCHOWN 3454 fchown(fd, st_old.st_uid, st_old.st_gid);3452 ignored = fchown(fd, st_old.st_uid, st_old.st_gid); 3455 3453 # endif 3456 3454 if (mch_stat((char *)IObuff, &st) < 0 3457 3455 || st.st_uid != st_old.st_uid … … 4367 4365 || st.st_uid != st_old.st_uid 4368 4366 || st.st_gid != st_old.st_gid) 4369 4367 { 4370 fchown(fd, st_old.st_uid, st_old.st_gid);4368 ignored = fchown(fd, st_old.st_uid, st_old.st_gid); 4371 4369 if (perm >= 0) /* set permission again, may have changed */ 4372 4370 (void)mch_setperm(wfname, perm); 4373 4371 } … … 5550 5548 name = "ucs-4le"; /* FF FE 00 00 */ 5551 5549 len = 4; 5552 5550 } 5553 else if (flags == FIO_ALL || flags ==(FIO_UCS2 | FIO_ENDIAN_L))5551 else if (flags == (FIO_UCS2 | FIO_ENDIAN_L)) 5554 5552 name = "ucs-2le"; /* FF FE */ 5555 else if (flags == (FIO_UTF16 | FIO_ENDIAN_L)) 5553 else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L)) 5554 /* utf-16le is preferred, it also works for ucs-2le text */ 5556 5555 name = "utf-16le"; /* FF FE */ 5557 5556 } 5558 5557 else if (p[0] == 0xfe && p[1] == 0xff … … 6031 6030 { 6032 6031 tbuf[FGETS_SIZE - 2] = NUL; 6033 6032 #ifdef USE_CR 6034 fgets_cr((char *)tbuf, FGETS_SIZE, fp);6033 ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp); 6035 6034 #else 6036 fgets((char *)tbuf, FGETS_SIZE, fp);6035 ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp); 6037 6036 #endif 6038 6037 } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n'); 6039 6038 } … … 6120 6119 if (mch_stat((char *)from, &st) < 0) 6121 6120 return -1; 6122 6121 6122 #ifdef UNIX 6123 { 6124 struct stat st_to; 6125 char tempname[MAXPATHL + 1]; 6126 6127 /* It's possible for the source and destination to be the same file. 6128 * This happens when "from" and "to" differ in case and are on a FAT32 6129 * filesystem. In that case go through a temp file name. */ 6130 if (mch_stat((char *)to, &st_to) >= 0 6131 && st.st_dev == st_to.st_dev 6132 && st.st_ino == st_to.st_ino) 6133 { 6134 /* Find a name that doesn't exist and is in the same directory. 6135 * Move "from" to "tempname" and then to "to". */ 6136 if (STRLEN(from) >= MAXPATHL - 5) 6137 return -1; 6138 STRCPY(tempname, from); 6139 for (n = 123; n < 99999; ++n) 6140 { 6141 sprintf(gettail(tempname), "%d", n); 6142 if (mch_stat(tempname, &st_to) < 0) 6143 { 6144 if (mch_rename((char *)from, tempname) == 0) 6145 { 6146 if (mch_rename(tempname, (char *)to) == 0) 6147 return 0; 6148 /* Strange, the second step failed. Try moving the 6149 * file back and return failure. */ 6150 mch_rename(tempname, (char *)from); 6151 return -1; 6152 } 6153 /* If it fails for one temp name it will most likely fail 6154 * for any temp name, give up. */ 6155 return -1; 6156 } 6157 } 6158 return -1; 6159 } 6160 } 6161 #endif 6162 6123 6163 /* 6124 6164 * Delete the "to" file, this is required on some systems to make the 6125 6165 * mch_rename() work, on other systems it makes sure that we don't have … … 8523 8563 char_u *save_sourcing_name; 8524 8564 linenr_T save_sourcing_lnum; 8525 8565 char_u *save_autocmd_fname; 8566 int save_autocmd_fname_full; 8526 8567 int save_autocmd_bufnr; 8527 8568 char_u *save_autocmd_match; 8528 8569 int save_autocmd_busy; … … 8601 8642 * Save the autocmd_* variables and info about the current buffer. 8602 8643 */ 8603 8644 save_autocmd_fname = autocmd_fname; 8645 save_autocmd_fname_full = autocmd_fname_full; 8604 8646 save_autocmd_bufnr = autocmd_bufnr; 8605 8647 save_autocmd_match = autocmd_match; 8606 8648 save_autocmd_busy = autocmd_busy; … … 8618 8660 if (fname != NULL && *fname != NUL) 8619 8661 autocmd_fname = fname; 8620 8662 else if (buf != NULL) 8621 autocmd_fname = buf->b_f name;8663 autocmd_fname = buf->b_ffname; 8622 8664 else 8623 8665 autocmd_fname = NULL; 8624 8666 } 8625 8667 else 8626 8668 autocmd_fname = fname_io; 8627 8669 if (autocmd_fname != NULL) 8628 autocmd_fname = FullName_save(autocmd_fname, FALSE); 8670 autocmd_fname = vim_strsave(autocmd_fname); 8671 autocmd_fname_full = FALSE; /* call FullName_save() later */ 8629 8672 8630 8673 /* 8631 8674 * Set the buffer number to be used for <abuf>. … … 8810 8853 sourcing_lnum = save_sourcing_lnum; 8811 8854 vim_free(autocmd_fname); 8812 8855 autocmd_fname = save_autocmd_fname; 8856 autocmd_fname_full = save_autocmd_fname_full; 8813 8857 autocmd_bufnr = save_autocmd_bufnr; 8814 8858 autocmd_match = save_autocmd_match; 8815 8859 #ifdef FEAT_EVAL … … 8918 8962 { 8919 8963 apc->curpat = NULL; 8920 8964 8921 /* only use a pattern when it has not been removed, has commands and8965 /* Only use a pattern when it has not been removed, has commands and 8922 8966 * the group matches. For buffer-local autocommands only check the 8923 8967 * buffer number. */ 8924 8968 if (ap->pat != NULL && ap->cmds != NULL … … 9104 9148 set_context_in_autocmd(xp, arg, doautocmd) 9105 9149 expand_T *xp; 9106 9150 char_u *arg; 9107 int doautocmd; /* TRUE for :doauto cmd, FALSE for :autocmd */9151 int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */ 9108 9152 { 9109 9153 char_u *p; 9110 9154 int group; -
src/fold.c
diff -Naur vim72.orig/src/fold.c vim72/src/fold.c
old new 48 48 static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp)); 49 49 static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum)); 50 50 static void checkupdate __ARGS((win_T *wp)); 51 static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open));51 static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open)); 52 52 static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep)); 53 53 static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep)); 54 54 static void foldOpenNested __ARGS((fold_T *fpr)); … … 1241 1241 * Repeat "count" times. 1242 1242 */ 1243 1243 static void 1244 setFoldRepeat(lnum, count, open)1244 setFoldRepeat(lnum, count, do_open) 1245 1245 linenr_T lnum; 1246 1246 long count; 1247 int open;1247 int do_open; 1248 1248 { 1249 1249 int done; 1250 1250 long n; … … 1252 1252 for (n = 0; n < count; ++n) 1253 1253 { 1254 1254 done = DONE_NOTHING; 1255 (void)setManualFold(lnum, open, FALSE, &done);1255 (void)setManualFold(lnum, do_open, FALSE, &done); 1256 1256 if (!(done & DONE_ACTION)) 1257 1257 { 1258 1258 /* Only give an error message when no fold could be opened. */ -
src/getchar.c
diff -Naur vim72.orig/src/getchar.c vim72/src/getchar.c
old new 4702 4702 return FAIL; 4703 4703 if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0) 4704 4704 return FAIL; 4705 if (fp rintf(fd, cmd) < 0)4705 if (fputs(cmd, fd) < 0) 4706 4706 return FAIL; 4707 4707 if (buf != NULL && fputs(" <buffer>", fd) < 0) 4708 4708 return FAIL; … … 4801 4801 } 4802 4802 if (IS_SPECIAL(c) || modifiers) /* special key */ 4803 4803 { 4804 if (fp rintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)4804 if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0) 4805 4805 return FAIL; 4806 4806 continue; 4807 4807 } -
src/globals.h
diff -Naur vim72.orig/src/globals.h vim72/src/globals.h
old new 1022 1022 #endif 1023 1023 #ifdef FEAT_AUTOCMD 1024 1024 EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */ 1025 EXTERN int autocmd_fname_full; /* autocmd_fname is full path */ 1025 1026 EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */ 1026 1027 EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */ 1027 1028 EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */ … … 1548 1549 EXTERN time_t starttime; 1549 1550 1550 1551 /* 1552 * Some compilers warn for not using a return value, but in some situations we 1553 * can't do anything useful with the value. Assign to this variable to avoid 1554 * the warning. 1555 */ 1556 EXTERN int ignored; 1557 EXTERN char *ignoredp; 1558 1559 /* 1551 1560 * Optional Farsi support. Include it here, so EXTERN and INIT are defined. 1552 1561 */ 1553 1562 #ifdef FEAT_FKMAP -
src/gui.c
diff -Naur vim72.orig/src/gui.c vim72/src/gui.c
old new 139 139 /* The read returns when the child closes the pipe (or when 140 140 * the child dies for some reason). */ 141 141 close(pipefd[1]); 142 (void)read(pipefd[0], &dummy, (size_t)1);142 ignored = (int)read(pipefd[0], &dummy, (size_t)1); 143 143 close(pipefd[0]); 144 144 } 145 145 … … 3241 3241 i = Rows; 3242 3242 gui_update_tabline(); 3243 3243 Rows = i; 3244 need_set_size = RESIZE_VERT;3244 need_set_size |= RESIZE_VERT; 3245 3245 if (using_tabline) 3246 3246 fix_size = TRUE; 3247 3247 if (!gui_use_tabline()) … … 3275 3275 if (gui.which_scrollbars[i] != prev_which_scrollbars[i]) 3276 3276 { 3277 3277 if (i == SBAR_BOTTOM) 3278 need_set_size = RESIZE_VERT;3278 need_set_size |= RESIZE_VERT; 3279 3279 else 3280 need_set_size = RESIZE_HOR;3280 need_set_size |= RESIZE_HOR; 3281 3281 if (gui.which_scrollbars[i]) 3282 3282 fix_size = TRUE; 3283 3283 } … … 3297 3297 gui_mch_enable_menu(gui.menu_is_active); 3298 3298 Rows = i; 3299 3299 prev_menu_is_active = gui.menu_is_active; 3300 need_set_size = RESIZE_VERT;3300 need_set_size |= RESIZE_VERT; 3301 3301 if (gui.menu_is_active) 3302 3302 fix_size = TRUE; 3303 3303 } … … 3308 3308 { 3309 3309 gui_mch_show_toolbar(using_toolbar); 3310 3310 prev_toolbar = using_toolbar; 3311 need_set_size = RESIZE_VERT;3311 need_set_size |= RESIZE_VERT; 3312 3312 if (using_toolbar) 3313 3313 fix_size = TRUE; 3314 3314 } … … 3318 3318 { 3319 3319 gui_mch_enable_footer(using_footer); 3320 3320 prev_footer = using_footer; 3321 need_set_size = RESIZE_VERT;3321 need_set_size |= RESIZE_VERT; 3322 3322 if (using_footer) 3323 3323 fix_size = TRUE; 3324 3324 } … … 3330 3330 prev_tearoff = using_tearoff; 3331 3331 } 3332 3332 #endif 3333 if (need_set_size )3333 if (need_set_size != 0) 3334 3334 { 3335 3335 #ifdef FEAT_GUI_GTK 3336 long c = Columns; 3336 long prev_Columns = Columns; 3337 long prev_Rows = Rows; 3337 3338 #endif 3338 3339 /* Adjust the size of the window to make the text area keep the 3339 3340 * same size and to avoid that part of our window is off-screen … … 3349 3350 * If you remove this, please test this command for resizing 3350 3351 * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q". 3351 3352 * Don't do this while starting up though. 3352 * And don't change Rows, it may have be reduced intentionally3353 * when adding menu/toolbar/tabline. */3354 if (!gui.starting )3353 * Don't change Rows when adding menu/toolbar/tabline. 3354 * Don't change Columns when adding vertical toolbar. */ 3355 if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR)) 3355 3356 (void)char_avail(); 3356 Columns = c; 3357 if ((need_set_size & RESIZE_VERT) == 0) 3358 Rows = prev_Rows; 3359 if ((need_set_size & RESIZE_HOR) == 0) 3360 Columns = prev_Columns; 3357 3361 #endif 3358 3362 } 3359 3363 #ifdef FEAT_WINDOWS -
src/gui_at_sb.c
diff -Naur vim72.orig/src/gui_at_sb.c vim72/src/gui_at_sb.c
old new 1078 1078 Cardinal *num_params; /* unused */ 1079 1079 { 1080 1080 ScrollbarWidget sbw = (ScrollbarWidget)w; 1081 /* Use a union to avoid a warning for the weird conversion from float to 1082 * XtPointer. Comes from Xaw/Scrollbar.c. */ 1083 union { 1084 XtPointer xtp; 1085 float xtf; 1086 } xtpf; 1081 1087 1082 1088 if (LookAhead(w, event)) 1083 1089 return; … … 1085 1091 /* thumbProc is not pretty, but is necessary for backwards 1086 1092 compatibility on those architectures for which it work{s,ed}; 1087 1093 the intent is to pass a (truncated) float by value. */ 1088 XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top); 1094 xtpf.xtf = sbw->scrollbar.top; 1095 XtCallCallbacks(w, XtNthumbProc, xtpf.xtp); 1089 1096 XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top); 1090 1097 } 1091 1098 -
src/gui_gtk_x11.c
diff -Naur vim72.orig/src/gui_gtk_x11.c vim72/src/gui_gtk_x11.c
old new 4070 4070 4071 4071 if (mask & (XValue | YValue)) 4072 4072 { 4073 int w ,h;4074 gui_mch_get_screen_dimensions(&w , &h);4075 h += p_ghr + get_menu_tool_height();4076 w += get_menu_tool_width();4073 int ww, hh; 4074 gui_mch_get_screen_dimensions(&ww, &hh); 4075 hh += p_ghr + get_menu_tool_height(); 4076 ww += get_menu_tool_width(); 4077 4077 if (mask & XNegative) 4078 x += w - pixel_width;4078 x += ww - pixel_width; 4079 4079 if (mask & YNegative) 4080 y += h - pixel_height;4080 y += hh - pixel_height; 4081 4081 #ifdef HAVE_GTK2 4082 4082 gtk_window_move(GTK_WINDOW(gui.mainwin), x, y); 4083 4083 #else -
src/gui_x11.c
diff -Naur vim72.orig/src/gui_x11.c vim72/src/gui_x11.c
old new 2450 2450 *colorPtr = colortable[closest]; 2451 2451 } 2452 2452 2453 free(colortable);2453 vim_free(colortable); 2454 2454 return OK; 2455 2455 } 2456 2456 -
src/gui_xmdlg.c
diff -Naur vim72.orig/src/gui_xmdlg.c vim72/src/gui_xmdlg.c
old new 369 369 char buf[TEMP_BUF_SIZE]; 370 370 XmString items[MAX_ENTRIES_IN_LIST]; 371 371 int i; 372 int i ndex;372 int idx; 373 373 374 for (i ndex = (int)ENCODING; index < (int)NONE; ++index)375 count[i ndex] = 0;374 for (idx = (int)ENCODING; idx < (int)NONE; ++idx) 375 count[idx] = 0; 376 376 377 377 /* First we insert the wild char into every single list. */ 378 378 if (fix != ENCODING) … … 503 503 /* 504 504 * Now loop trough the remaining lists and set them up. 505 505 */ 506 for (i ndex = (int)NAME; index < (int)NONE; ++index)506 for (idx = (int)NAME; idx < (int)NONE; ++idx) 507 507 { 508 508 Widget w; 509 509 510 if (fix == (enum ListSpecifier)i ndex)510 if (fix == (enum ListSpecifier)idx) 511 511 continue; 512 512 513 switch ((enum ListSpecifier)i ndex)513 switch ((enum ListSpecifier)idx) 514 514 { 515 515 case NAME: 516 516 w = data->list[NAME]; … … 525 525 w = (Widget)0; /* for lint */ 526 526 } 527 527 528 for (i = 0; i < count[i ndex]; ++i)528 for (i = 0; i < count[idx]; ++i) 529 529 { 530 items[i] = XmStringCreateLocalized(list[i ndex][i]);531 XtFree(list[i ndex][i]);530 items[i] = XmStringCreateLocalized(list[idx][i]); 531 XtFree(list[idx][i]); 532 532 } 533 533 XmListDeleteAllItems(w); 534 XmListAddItems(w, items, count[i ndex], 1);535 if (data->sel[i ndex])534 XmListAddItems(w, items, count[idx], 1); 535 if (data->sel[idx]) 536 536 { 537 537 XmStringFree(items[0]); 538 items[0] = XmStringCreateLocalized(data->sel[i ndex]);538 items[0] = XmStringCreateLocalized(data->sel[idx]); 539 539 XmListSelectItem(w, items[0], False); 540 540 XmListSetBottomItem(w, items[0]); 541 541 } 542 for (i = 0; i < count[i ndex]; ++i)542 for (i = 0; i < count[idx]; ++i) 543 543 XmStringFree(items[i]); 544 544 } 545 545 } … … 695 695 int n; 696 696 XmString str; 697 697 Arg args[4]; 698 char * msg = _("no specific match");698 char *nomatch_msg = _("no specific match"); 699 699 700 700 n = 0; 701 str = XmStringCreateLocalized( msg);701 str = XmStringCreateLocalized(nomatch_msg); 702 702 XtSetArg(args[n], XmNlabelString, str); ++n; 703 703 XtSetValues(data->sample, args, n); 704 704 apply_fontlist(data->sample); 705 XmTextSetString(data->name, msg);705 XmTextSetString(data->name, nomatch_msg); 706 706 XmStringFree(str); 707 707 708 708 return False; … … 886 886 { 887 887 int i; 888 888 int max; 889 int i ndex = 0;889 int idx = 0; 890 890 int size; 891 char str[128];891 char buf[128]; 892 892 893 893 for (i = 0, max = 0; i < data->num; i++) 894 894 { 895 get_part(fn(data, i), 7, str);896 size = atoi( str);895 get_part(fn(data, i), 7, buf); 896 size = atoi(buf); 897 897 if ((size > max) && (size < MAX_DISPLAY_SIZE)) 898 898 { 899 i ndex = i;899 idx = i; 900 900 max = size; 901 901 } 902 902 } 903 strcpy(big_font, fn(data, i ndex));903 strcpy(big_font, fn(data, idx)); 904 904 } 905 905 data->old = XLoadQueryFont(XtDisplay(parent), big_font); 906 906 data->old_list = gui_motif_create_fontlist(data->old); … … 1217 1217 1218 1218 if (i != 0) 1219 1219 { 1220 char name [TEMP_BUF_SIZE];1221 char style [TEMP_BUF_SIZE];1222 char size [TEMP_BUF_SIZE];1223 char encoding [TEMP_BUF_SIZE];1220 char namebuf[TEMP_BUF_SIZE]; 1221 char stylebuf[TEMP_BUF_SIZE]; 1222 char sizebuf[TEMP_BUF_SIZE]; 1223 char encodingbuf[TEMP_BUF_SIZE]; 1224 1224 char *found; 1225 1225 1226 1226 found = names[0]; 1227 1227 1228 name_part(found, name );1229 style_part(found, style );1230 size_part(found, size , data->in_pixels);1231 encoding_part(found, encoding );1232 1233 if (strlen(name ) > 01234 && strlen(style ) > 01235 && strlen(size ) > 01236 && strlen(encoding ) > 0)1228 name_part(found, namebuf); 1229 style_part(found, stylebuf); 1230 size_part(found, sizebuf, data->in_pixels); 1231 encoding_part(found, encodingbuf); 1232 1233 if (strlen(namebuf) > 0 1234 && strlen(stylebuf) > 0 1235 && strlen(sizebuf) > 0 1236 && strlen(encodingbuf) > 0) 1237 1237 { 1238 data->sel[NAME] = XtNewString(name );1239 data->sel[STYLE] = XtNewString(style );1240 data->sel[SIZE] = XtNewString(size );1241 data->sel[ENCODING] = XtNewString(encoding );1238 data->sel[NAME] = XtNewString(namebuf); 1239 data->sel[STYLE] = XtNewString(stylebuf); 1240 data->sel[SIZE] = XtNewString(sizebuf); 1241 data->sel[ENCODING] = XtNewString(encodingbuf); 1242 1242 data->font_name = XtNewString(names[0]); 1243 1243 display_sample(data); 1244 1244 XmTextSetString(data->name, data->font_name); -
src/gui_xmebw.c
diff -Naur vim72.orig/src/gui_xmebw.c vim72/src/gui_xmebw.c
old new 1256 1256 } 1257 1257 else 1258 1258 { 1259 intadjust = 0;1259 adjust = 0; 1260 1260 1261 1261 #if !defined(LESSTIF_VERSION) && (XmVersion > 1002) 1262 1262 /* … … 1268 1268 { 1269 1269 case XmEXTERNAL_HIGHLIGHT: 1270 1270 adjust = (eb->primitive.highlight_thickness - 1271 (eb->pushbutton.default_button_shadow_thickness ?1272 Xm3D_ENHANCE_PIXEL : 0));1271 (eb->pushbutton.default_button_shadow_thickness 1272 ? Xm3D_ENHANCE_PIXEL : 0)); 1273 1273 break; 1274 1274 1275 1275 case XmINTERNAL_HIGHLIGHT: 1276 adjust = 0;1277 1276 break; 1278 1277 1279 1278 default: -
src/if_cscope.c
diff -Naur vim72.orig/src/if_cscope.c vim72/src/if_cscope.c
old new 74 74 { "add", cs_add, 75 75 N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 }, 76 76 { "find", cs_find, 77 N_("Query for a pattern"), FIND_USAGE, 1 },77 N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 }, 78 78 { "help", cs_help, 79 79 N_("Show this message"), "help", 0 }, 80 80 { "kill", cs_kill, … … 1180 1180 (void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"), 1181 1181 cmdp->name, _(cmdp->help), cmdp->usage); 1182 1182 if (strcmp(cmdp->name, "find") == 0) 1183 MSG_PUTS(FIND_HELP); 1183 MSG_PUTS(_("\n" 1184 " c: Find functions calling this function\n" 1185 " d: Find functions called by this function\n" 1186 " e: Find this egrep pattern\n" 1187 " f: Find this file\n" 1188 " g: Find this definition\n" 1189 " i: Find files #including this file\n" 1190 " s: Find this C symbol\n" 1191 " t: Find assignments to\n")); 1192 1184 1193 cmdp++; 1185 1194 } 1186 1195 -
src/if_cscope.h
diff -Naur vim72.orig/src/if_cscope.h vim72/src/if_cscope.h
old new 42 42 * f 7name Find this file 43 43 * i 8name Find files #including this file 44 44 */ 45 #define FIND_USAGE "find c|d|e|f|g|i|s|t name"46 #define FIND_HELP "\n\47 c: Find functions calling this function\n\48 d: Find functions called by this function\n\49 e: Find this egrep pattern\n\50 f: Find this file\n\51 g: Find this definition\n\52 i: Find files #including this file\n\53 s: Find this C symbol\n\54 t: Find assignments to\n"55 56 45 57 46 typedef struct { 58 47 char * name; -
src/if_perl.xs
diff -Naur vim72.orig/src/if_perl.xs vim72/src/if_perl.xs
old new 136 136 # define Perl_newXS_flags dll_Perl_newXS_flags 137 137 #endif 138 138 # define Perl_sv_free dll_Perl_sv_free 139 # if (PERL_REVISION == 5) && (PERL_VERSION >= 10) 140 # define Perl_sv_free2 dll_Perl_sv_free2 141 # endif 139 142 # define Perl_sv_isa dll_Perl_sv_isa 140 143 # define Perl_sv_magic dll_Perl_sv_magic 141 144 # define Perl_sv_setiv dll_Perl_sv_setiv … … 163 166 # define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr 164 167 # define boot_DynaLoader dll_boot_DynaLoader 165 168 166 # define Perl_sys_init 3 dll_Perl_sys_init3169 # define Perl_sys_init dll_Perl_sys_init 167 170 # define Perl_sys_term dll_Perl_sys_term 168 171 # define Perl_ISv_ptr dll_Perl_ISv_ptr 169 172 # define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr … … 268 271 static void (*boot_DynaLoader)_((pTHX_ CV*)); 269 272 270 273 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10) 271 static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env); 274 static void (*Perl_sv_free2)(pTHX_ SV*); 275 static void (*Perl_sys_init)(int* argc, char*** argv); 272 276 static void (*Perl_sys_term)(void); 273 277 static SV** (*Perl_ISv_ptr)(register PerlInterpreter*); 274 278 static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*); … … 367 371 {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr}, 368 372 {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr}, 369 373 #else 370 {"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3}, 374 {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2}, 375 {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init}, 371 376 {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term}, 372 377 {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr}, 373 378 {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr}, … … 455 460 static char *argv[] = { "", "-e", "" }; 456 461 457 462 #if (PERL_REVISION == 5) && (PERL_VERSION >= 10) 458 Perl_sys_init 3(&argc, (char***)&argv, NULL);463 Perl_sys_init(&argc, (char***)&argv); 459 464 #endif 460 465 perl_interp = perl_alloc(); 461 466 perl_construct(perl_interp); -
src/if_python.c
diff -Naur vim72.orig/src/if_python.c vim72/src/if_python.c
old new 531 531 if (PythonMod_Init()) 532 532 goto fail; 533 533 534 /* Remove the element from sys.path that was added because of our 535 * argv[0] value in PythonMod_Init(). Previously we used an empty 536 * string, but dependinding on the OS we then get an empty entry or 537 * the current directory in sys.path. */ 538 PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)"); 539 534 540 /* the first python thread is vim's, release the lock */ 535 541 Python_SaveThread(); 536 542 … … 2345 2351 { 2346 2352 PyObject *mod; 2347 2353 PyObject *dict; 2348 static char *(argv[2]) = {"", NULL}; 2354 /* The special value is removed from sys.path in Python_Init(). */ 2355 static char *(argv[2]) = {"/must>not&exist/foo", NULL}; 2349 2356 2350 2357 /* Fixups... */ 2351 2358 BufferType.ob_type = &PyType_Type; -
src/if_xcmdsrv.c
diff -Naur vim72.orig/src/if_xcmdsrv.c vim72/src/if_xcmdsrv.c
old new 736 736 + serverReply.ga_len; 737 737 e.id = w; 738 738 ga_init2(&e.strings, 1, 100); 739 m emcpy(p, &e, sizeof(e));739 mch_memmove(p, &e, sizeof(e)); 740 740 serverReply.ga_len++; 741 741 } 742 742 } … … 1018 1018 p++; 1019 1019 count = numItems - (p - regProp); 1020 1020 if (count > 0) 1021 m emcpy(entry, p, count);1021 mch_memmove(entry, p, count); 1022 1022 XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING, 1023 1023 8, PropModeReplace, regProp, 1024 1024 (int)(numItems - (p - entry))); … … 1072 1072 p++; 1073 1073 lastHalf = numItems - (p - regProp); 1074 1074 if (lastHalf > 0) 1075 m emcpy(entry, p, lastHalf);1075 mch_memmove(entry, p, lastHalf); 1076 1076 numItems = (entry - regProp) + lastHalf; 1077 1077 p = entry; 1078 1078 continue; -
src/main.c
diff -Naur vim72.orig/src/main.c vim72/src/main.c
old new 645 645 646 646 #ifdef FEAT_VIMINFO 647 647 /* 648 * Read in registers, history etc, but not marks, from the viminfo file 648 * Read in registers, history etc, but not marks, from the viminfo file. 649 * This is where v:oldfiles gets filled. 649 650 */ 650 651 if (*p_viminfo != NUL) 651 652 { 652 read_viminfo(NULL, TRUE, FALSE, FALSE);653 read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES); 653 654 TIME_MSG("reading viminfo"); 654 655 } 655 656 #endif … … 1457 1458 ++initstr; 1458 1459 } 1459 1460 1460 if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k') 1461 /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */ 1462 if (TOLOWER_ASC(initstr[0]) == 'g') 1461 1463 { 1462 1464 main_start_gui(); 1463 1465 #ifdef FEAT_GUI … … 1508 1510 early_arg_scan(parmp) 1509 1511 mparm_T *parmp; 1510 1512 { 1511 #if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) 1513 #if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \ 1514 || !defined(FEAT_NETBEANS_INTG) 1512 1515 int argc = parmp->argc; 1513 1516 char **argv = parmp->argv; 1514 1517 int i; … … 1580 1583 else if (STRICMP(argv[i], "--echo-wid") == 0) 1581 1584 echo_wid_arg = TRUE; 1582 1585 # endif 1586 # ifndef FEAT_NETBEANS_INTG 1587 else if (strncmp(argv[i], "-nb", (size_t)3) == 0) 1588 { 1589 mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n")); 1590 mch_exit(2); 1591 } 1592 # endif 1593 1583 1594 } 1584 1595 #endif 1585 1596 } … … 2361 2372 * Is there any other system that cannot do this? 2362 2373 */ 2363 2374 close(0); 2364 dup(2);2375 ignored = dup(2); 2365 2376 #endif 2366 2377 } 2367 2378 -
src/mark.c
diff -Naur vim72.orig/src/mark.c vim72/src/mark.c
old new 1627 1627 1628 1628 /* 1629 1629 * Handle marks in the viminfo file: 1630 * fp_out == NULL read marks for current buffer only 1631 * fp_out != NULL copy marks for buffers not in buffer list 1630 * fp_out != NULL: copy marks for buffers not in buffer list 1631 * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only 1632 * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles 1632 1633 */ 1633 1634 void 1634 copy_viminfo_marks(virp, fp_out, count, eof )1635 copy_viminfo_marks(virp, fp_out, count, eof, flags) 1635 1636 vir_T *virp; 1636 1637 FILE *fp_out; 1637 1638 int count; 1638 1639 int eof; 1640 int flags; 1639 1641 { 1640 1642 char_u *line = virp->vir_line; 1641 1643 buf_T *buf; … … 1647 1649 char_u *p; 1648 1650 char_u *name_buf; 1649 1651 pos_T pos; 1652 #ifdef FEAT_EVAL 1653 list_T *list = NULL; 1654 #endif 1650 1655 1651 1656 if ((name_buf = alloc(LSIZE)) == NULL) 1652 1657 return; 1653 1658 *name_buf = NUL; 1659 1660 #ifdef FEAT_EVAL 1661 if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT))) 1662 { 1663 list = list_alloc(); 1664 if (list != NULL) 1665 set_vim_var_list(VV_OLDFILES, list); 1666 } 1667 #endif 1668 1654 1669 num_marked_files = get_viminfo_parameter('\''); 1655 1670 while (!eof && (count < num_marked_files || fp_out == NULL)) 1656 1671 { … … 1681 1696 p++; 1682 1697 *p = NUL; 1683 1698 1699 #ifdef FEAT_EVAL 1700 if (list != NULL) 1701 list_append_string(list, str, -1); 1702 #endif 1703 1684 1704 /* 1685 1705 * If fp_out == NULL, load marks for current buffer. 1686 1706 * If fp_out != NULL, copy marks for buffers not in buflist. … … 1688 1708 load_marks = copy_marks_out = FALSE; 1689 1709 if (fp_out == NULL) 1690 1710 { 1691 if ( curbuf->b_ffname != NULL)1711 if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL) 1692 1712 { 1693 1713 if (*name_buf == NUL) /* only need to do this once */ 1694 1714 home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE); -
src/mbyte.c
diff -Naur vim72.orig/src/mbyte.c vim72/src/mbyte.c
old new 717 717 * where mblen() returns 0 for invalid character. 718 718 * Therefore, following condition includes 0. 719 719 */ 720 (void)mblen(NULL, 0); /* First reset the state. */720 ignored = mblen(NULL, 0); /* First reset the state. */ 721 721 if (mblen(buf, (size_t)1) <= 0) 722 722 n = 2; 723 723 else … … 2540 2540 return (int)(p - q); 2541 2541 } 2542 2542 2543 #if defined(FEAT_EVAL) || defined(PROTO)2544 2543 /* 2545 2544 * Copy a character from "*fp" to "*tp" and advance the pointers. 2546 2545 */ … … 2555 2554 *tp += l; 2556 2555 *fp += l; 2557 2556 } 2558 #endif2559 2557 2560 2558 /* 2561 2559 * Return the offset from "p" to the first byte of a character. When "p" is … … 3133 3131 else 3134 3132 s = p + 1; 3135 3133 } 3136 for (i = 0; s[i] != NUL && s + i < buf +sizeof(buf) - 1; ++i)3134 for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i) 3137 3135 { 3138 3136 if (s[i] == '_' || s[i] == '-') 3139 3137 buf[i] = '-'; … … 5280 5278 5281 5279 /*ARGSUSED*/ 5282 5280 static void 5283 preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)5281 preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data) 5284 5282 { 5285 5283 #ifdef XIM_DEBUG 5286 5284 xim_log("xim_decide_input_style()\n"); … … 5314 5312 5315 5313 /*ARGSUSED*/ 5316 5314 static void 5317 preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)5315 preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data) 5318 5316 { 5319 5317 XIMPreeditDrawCallbackStruct *draw_data; 5320 5318 XIMText *text; … … 5386 5384 draw_feedback = (char *)alloc(draw_data->chg_first 5387 5385 + text->length); 5388 5386 else 5389 draw_feedback = realloc(draw_feedback,5387 draw_feedback = vim_realloc(draw_feedback, 5390 5388 draw_data->chg_first + text->length); 5391 5389 if (draw_feedback != NULL) 5392 5390 { … … 5455 5453 5456 5454 /*ARGSUSED*/ 5457 5455 static void 5458 preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)5456 preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data) 5459 5457 { 5460 5458 #ifdef XIM_DEBUG 5461 5459 xim_log("preedit_caret_cbproc()\n"); … … 5464 5462 5465 5463 /*ARGSUSED*/ 5466 5464 static void 5467 preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)5465 preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data) 5468 5466 { 5469 5467 #ifdef XIM_DEBUG 5470 5468 xim_log("preedit_done_cbproc()\n"); -
src/menu.c
diff -Naur vim72.orig/src/menu.c vim72/src/menu.c
old new 1120 1120 parent = menu; 1121 1121 menu = menu->children; 1122 1122 } 1123 vim_free(path_name); 1123 1124 1124 1125 /* Now we have found the matching menu, and we list the mappings */ 1125 1126 /* Highlight title */ -
src/message.c
diff -Naur vim72.orig/src/message.c vim72/src/message.c
old new 4585 4585 if (remove_trailing_zeroes) 4586 4586 { 4587 4587 int i; 4588 char * p;4588 char *tp; 4589 4589 4590 4590 /* Using %g or %G: remove superfluous zeroes. */ 4591 4591 if (fmt_spec == 'f') 4592 p = tmp + str_arg_l - 1;4592 tp = tmp + str_arg_l - 1; 4593 4593 else 4594 4594 { 4595 p = (char *)vim_strchr((char_u *)tmp,4595 tp = (char *)vim_strchr((char_u *)tmp, 4596 4596 fmt_spec == 'e' ? 'e' : 'E'); 4597 if ( p != NULL)4597 if (tp != NULL) 4598 4598 { 4599 4599 /* Remove superfluous '+' and leading 4600 4600 * zeroes from the exponent. */ 4601 if ( p[1] == '+')4601 if (tp[1] == '+') 4602 4602 { 4603 4603 /* Change "1.0e+07" to "1.0e07" */ 4604 STRMOVE( p + 1,p + 2);4604 STRMOVE(tp + 1, tp + 2); 4605 4605 --str_arg_l; 4606 4606 } 4607 i = ( p[1] == '-') ? 2 : 1;4608 while ( p[i] == '0')4607 i = (tp[1] == '-') ? 2 : 1; 4608 while (tp[i] == '0') 4609 4609 { 4610 4610 /* Change "1.0e07" to "1.0e7" */ 4611 STRMOVE( p + i,p + i + 1);4611 STRMOVE(tp + i, tp + i + 1); 4612 4612 --str_arg_l; 4613 4613 } 4614 -- p;4614 --tp; 4615 4615 } 4616 4616 } 4617 4617 4618 if ( p != NULL && !precision_specified)4618 if (tp != NULL && !precision_specified) 4619 4619 /* Remove trailing zeroes, but keep the one 4620 4620 * just after a dot. */ 4621 while (p > tmp + 2 && *p == '0' && p[-1] != '.') 4621 while (tp > tmp + 2 && *tp == '0' 4622 && tp[-1] != '.') 4622 4623 { 4623 STRMOVE( p,p + 1);4624 -- p;4624 STRMOVE(tp, tp + 1); 4625 --tp; 4625 4626 --str_arg_l; 4626 4627 } 4627 4628 } 4628 4629 else 4629 4630 { 4630 char * p;4631 char *tp; 4631 4632 4632 4633 /* Be consistent: some printf("%e") use 1.0e+12 4633 4634 * and some 1.0e+012. Remove one zero in the last 4634 4635 * case. */ 4635 p = (char *)vim_strchr((char_u *)tmp,4636 tp = (char *)vim_strchr((char_u *)tmp, 4636 4637 fmt_spec == 'e' ? 'e' : 'E'); 4637 if ( p != NULL && (p[1] == '+' ||p[1] == '-')4638 && p[2] == '0'4639 && vim_isdigit( p[3])4640 && vim_isdigit( p[4]))4638 if (tp != NULL && (tp[1] == '+' || tp[1] == '-') 4639 && tp[2] == '0' 4640 && vim_isdigit(tp[3]) 4641 && vim_isdigit(tp[4])) 4641 4642 { 4642 STRMOVE( p + 2,p + 3);4643 STRMOVE(tp + 2, tp + 3); 4643 4644 --str_arg_l; 4644 4645 } 4645 4646 } -
src/misc1.c
diff -Naur vim72.orig/src/misc1.c vim72/src/misc1.c
old new 3245 3245 3246 3246 /* When using ":silent" assume that <CR> was entered. */ 3247 3247 if (mouse_used != NULL) 3248 MSG_PUTS(_("Type number or click with mouse (<Enter>cancels): "));3248 MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): ")); 3249 3249 else 3250 MSG_PUTS(_(" Choice number (<Enter>cancels): "));3250 MSG_PUTS(_("Type number and <Enter> (empty cancels): ")); 3251 3251 3252 3252 /* Set the state such that text can be selected/copied/pasted and we still 3253 3253 * get mouse events. */ -
src/misc2.c
diff -Naur vim72.orig/src/misc2.c vim72/src/misc2.c
old new 873 873 /* 3. check for available memory: call mch_avail_mem() */ 874 874 if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing) 875 875 { 876 vim_free((char *)p); /* System is low... no go! */876 free((char *)p); /* System is low... no go! */ 877 877 p = NULL; 878 878 } 879 879 else … … 1257 1257 return escaped_string; 1258 1258 } 1259 1259 1260 #if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)1261 1260 /* 1262 1261 * Return TRUE when 'shell' has "csh" in the tail. 1263 1262 */ … … 1266 1265 { 1267 1266 return (strstr((char *)gettail(p_sh), "csh") != NULL); 1268 1267 } 1269 #endif1270 1268 1271 #if defined(FEAT_EVAL) || defined(PROTO)1272 1269 /* 1273 1270 * Escape "string" for use as a shell argument with system(). 1274 1271 * This uses single quotes, except when we know we need to use double qoutes … … 1391 1388 1392 1389 return escaped_string; 1393 1390 } 1394 #endif1395 1391 1396 1392 /* 1397 1393 * Like vim_strsave(), but make all characters uppercase. … … 2565 2561 int key; 2566 2562 int dlen = 0; 2567 2563 2568 key = find_special_key(srcp, &modifiers, keycode );2564 key = find_special_key(srcp, &modifiers, keycode, FALSE); 2569 2565 if (key == 0) 2570 2566 return 0; 2571 2567 … … 2601 2597 * returns 0 if there is no match. 2602 2598 */ 2603 2599 int 2604 find_special_key(srcp, modp, keycode )2600 find_special_key(srcp, modp, keycode, keep_x_key) 2605 2601 char_u **srcp; 2606 2602 int *modp; 2607 int keycode; /* prefer key code, e.g. K_DEL instead of DEL */ 2603 int keycode; /* prefer key code, e.g. K_DEL instead of DEL */ 2604 int keep_x_key; /* don't translate xHome to Home key */ 2608 2605 { 2609 2606 char_u *last_dash; 2610 2607 char_u *end_of_name; … … 2672 2669 else 2673 2670 { 2674 2671 key = get_special_key_code(last_dash + 1); 2675 key = handle_x_keys(key); 2672 if (!keep_x_key) 2673 key = handle_x_keys(key); 2676 2674 } 2677 2675 2678 2676 /* -
src/move.c
diff -Naur vim72.orig/src/move.c vim72/src/move.c
old new 280 280 281 281 if (curwin->w_botline <= curbuf->b_ml.ml_line_count) 282 282 { 283 if (curwin->w_cursor.lnum < curwin->w_botline 284 && ((long)curwin->w_cursor.lnum 283 if (curwin->w_cursor.lnum < curwin->w_botline) 284 { 285 if (((long)curwin->w_cursor.lnum 285 286 >= (long)curwin->w_botline - p_so 286 287 #ifdef FEAT_FOLDING 287 288 || hasAnyFolding(curwin) 288 289 #endif 289 290 )) 290 {291 { 291 292 lineoff_T loff; 292 293 293 /* Cursor is above botline, check if there are 'scrolloff' 294 * window lines below the cursor. If not, need to scroll. */ 294 /* Cursor is (a few lines) above botline, check if there are 295 * 'scrolloff' window lines below the cursor. If not, need to 296 * scroll. */ 295 297 n = curwin->w_empty_rows; 296 298 loff.lnum = curwin->w_cursor.lnum; 297 299 #ifdef FEAT_FOLDING … … 317 319 if (n >= p_so) 318 320 /* sufficient context, no need to scroll */ 319 321 check_botline = FALSE; 322 } 323 else 324 /* sufficient context, no need to scroll */ 325 check_botline = FALSE; 320 326 } 321 327 if (check_botline) 322 328 { … … 509 515 /* Approximate the value of w_botline */ 510 516 wp->w_botline += lnum - wp->w_topline; 511 517 wp->w_topline = lnum; 518 #ifdef FEAT_AUTOCMD 519 wp->w_topline_was_set = TRUE; 520 #endif 512 521 #ifdef FEAT_DIFF 513 522 wp->w_topfill = 0; 514 523 #endif -
src/netbeans.c
diff -Naur vim72.orig/src/netbeans.c vim72/src/netbeans.c
old new 1043 1043 nbdebug(("EVT: %s", buf)); 1044 1044 /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */ 1045 1045 if (sd >= 0) 1046 sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */1046 ignored = sock_write(sd, buf, (int)STRLEN(buf)); 1047 1047 } 1048 1048 } 1049 1049 … … 2277 2277 int serNum; 2278 2278 int localTypeNum; 2279 2279 int typeNum; 2280 # ifdef NBDEBUG2281 int len;2282 # endif2283 2280 pos_T *pos; 2284 2281 2285 2282 if (buf == NULL || buf->bufp == NULL) … … 2303 2300 pos = get_off_or_lnum(buf->bufp, &args); 2304 2301 2305 2302 cp = (char *)args; 2306 # ifdef NBDEBUG 2307 len = 2308 # endif 2309 strtol(cp, &cp, 10); 2303 ignored = (int)strtol(cp, &cp, 10); 2310 2304 args = (char_u *)cp; 2311 2305 # ifdef NBDEBUG 2312 if ( len!= -1)2306 if (ignored != -1) 2313 2307 { 2314 2308 nbdebug((" partial line annotation -- Not Yet Implemented!\n")); 2315 2309 } -
src/normal.c
diff -Naur vim72.orig/src/normal.c vim72/src/normal.c
old new 183 183 static void nv_cursorhold __ARGS((cmdarg_T *cap)); 184 184 #endif 185 185 186 static char *e_noident = N_("E349: No identifier under cursor"); 187 186 188 /* 187 189 * Function to be called for a Normal or Visual mode command. 188 190 * The argument is a cmdarg_T. … … 578 580 static int old_mapped_len = 0; 579 581 #endif 580 582 int idx; 583 #ifdef FEAT_EVAL 584 int set_prevcount = FALSE; 585 #endif 581 586 582 587 vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */ 583 588 ca.oap = oap; … … 613 618 /* When not finishing an operator and no register name typed, reset the 614 619 * count. */ 615 620 if (!finish_op && !oap->regname) 621 { 616 622 ca.opcount = 0; 623 #ifdef FEAT_EVAL 624 set_prevcount = TRUE; 625 #endif 626 } 617 627 618 628 #ifdef FEAT_AUTOCMD 619 629 /* Restore counts from before receiving K_CURSORHOLD. This means after … … 717 727 * command, so that v:count can be used in an expression mapping 718 728 * right after the count. */ 719 729 if (toplevel && stuff_empty()) 720 set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0); 730 { 731 long count = ca.count0; 732 733 /* multiply with ca.opcount the same way as below */ 734 if (ca.opcount != 0) 735 count = ca.opcount * (count == 0 ? 1 : count); 736 set_vcount(count, count == 0 ? 1 : count, set_prevcount); 737 set_prevcount = FALSE; /* only set v:prevcount once */ 738 } 721 739 #endif 722 740 if (ctrl_w) 723 741 { … … 804 822 * Only set v:count when called from main() and not a stuffed command. 805 823 */ 806 824 if (toplevel && stuff_empty()) 807 set_vcount(ca.count0, ca.count1 );825 set_vcount(ca.count0, ca.count1, set_prevcount); 808 826 #endif 809 827 810 828 /* … … 1132 1150 out_flush(); 1133 1151 #endif 1134 1152 #ifdef FEAT_AUTOCMD 1135 did_cursorhold = FALSE; 1153 if (ca.cmdchar != K_IGNORE) 1154 did_cursorhold = FALSE; 1136 1155 #endif 1137 1156 1138 1157 State = NORMAL; … … 3509 3528 if (find_type & FIND_STRING) 3510 3529 EMSG(_("E348: No string under cursor")); 3511 3530 else 3512 EMSG(_( "E349: No identifier under cursor"));3531 EMSG(_(e_noident)); 3513 3532 return 0; 3514 3533 } 3515 3534 ptr += col; … … 5469 5488 STRCPY(buf, "he! "); 5470 5489 else 5471 5490 { 5491 /* An external command will probably use an argument starting 5492 * with "-" as an option. To avoid trouble we skip the "-". */ 5493 while (*ptr == '-' && n > 0) 5494 { 5495 ++ptr; 5496 --n; 5497 } 5498 if (n == 0) 5499 { 5500 EMSG(_(e_noident)); /* found dashes only */ 5501 vim_free(buf); 5502 return; 5503 } 5504 5472 5505 /* When a count is given, turn it into a range. Is this 5473 5506 * really what we want? */ 5474 5507 isman = (STRCMP(kp, "man") == 0); … … 5511 5544 /* 5512 5545 * Now grab the chars in the identifier 5513 5546 */ 5514 if (cmdchar == '*') 5515 aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\"); 5516 else if (cmdchar == '#') 5517 aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\"); 5518 else if (cmdchar == 'K' && !kp_help) 5519 aux_ptr = (char_u *)" \t\\\"|!"; 5520 else 5521 /* Don't escape spaces and Tabs in a tag with a backslash */ 5522 aux_ptr = (char_u *)"\\|\""; 5523 5524 p = buf + STRLEN(buf); 5525 while (n-- > 0) 5526 { 5527 /* put a backslash before \ and some others */ 5528 if (vim_strchr(aux_ptr, *ptr) != NULL) 5529 *p++ = '\\'; 5530 #ifdef FEAT_MBYTE 5531 /* When current byte is a part of multibyte character, copy all bytes 5532 * of that character. */ 5533 if (has_mbyte) 5547 if (cmdchar == 'K' && !kp_help) 5548 { 5549 /* Escape the argument properly for a shell command */ 5550 ptr = vim_strnsave(ptr, n); 5551 p = vim_strsave_shellescape(ptr, TRUE); 5552 vim_free(ptr); 5553 if (p == NULL) 5534 5554 { 5535 int i; 5536 int len = (*mb_ptr2len)(ptr) - 1; 5537 5538 for (i = 0; i < len && n >= 1; ++i, --n) 5539 *p++ = *ptr++; 5555 vim_free(buf); 5556 return; 5540 5557 } 5558 buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1); 5559 if (buf == NULL) 5560 { 5561 vim_free(buf); 5562 vim_free(p); 5563 return; 5564 } 5565 STRCAT(buf, p); 5566 vim_free(p); 5567 } 5568 else 5569 { 5570 if (cmdchar == '*') 5571 aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\"); 5572 else if (cmdchar == '#') 5573 aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\"); 5574 else 5575 /* Don't escape spaces and Tabs in a tag with a backslash */ 5576 aux_ptr = (char_u *)"\\|\"\n*?["; 5577 5578 p = buf + STRLEN(buf); 5579 while (n-- > 0) 5580 { 5581 /* put a backslash before \ and some others */ 5582 if (vim_strchr(aux_ptr, *ptr) != NULL) 5583 *p++ = '\\'; 5584 #ifdef FEAT_MBYTE 5585 /* When current byte is a part of multibyte character, copy all 5586 * bytes of that character. */ 5587 if (has_mbyte) 5588 { 5589 int i; 5590 int len = (*mb_ptr2len)(ptr) - 1; 5591 5592 for (i = 0; i < len && n >= 1; ++i, --n) 5593 *p++ = *ptr++; 5594 } 5541 5595 #endif 5542 *p++ = *ptr++; 5596 *p++ = *ptr++; 5597 } 5598 *p = NUL; 5543 5599 } 5544 *p = NUL;5545 5600 5546 5601 /* 5547 5602 * Execute the command. -
src/ops.c
diff -Naur vim72.orig/src/ops.c vim72/src/ops.c
old new 2209 2209 { 2210 2210 for (; pos.lnum <= oap->end.lnum; ++pos.lnum) 2211 2211 { 2212 int one_change; 2213 2212 2214 block_prep(oap, &bd, pos.lnum, FALSE); 2213 2215 pos.col = bd.textcol; 2214 did_change = swapchars(oap->op_type, &pos, bd.textlen); 2216 one_change = swapchars(oap->op_type, &pos, bd.textlen); 2217 did_change |= one_change; 2215 2218 2216 2219 # ifdef FEAT_NETBEANS_INTG 2217 if (usingNetbeans && did_change)2220 if (usingNetbeans && one_change) 2218 2221 { 2219 2222 char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE); 2220 2223 -
src/option.c
diff -Naur vim72.orig/src/option.c vim72/src/option.c
old new 2593 2593 #ifdef FEAT_VIMINFO 2594 2594 (char_u *)&p_viminfo, PV_NONE, 2595 2595 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) 2596 {(char_u *)"", (char_u *)"' 20,<50,s10,h,rA:,rB:"}2596 {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"} 2597 2597 #else 2598 2598 # ifdef AMIGA 2599 2599 {(char_u *)"", 2600 (char_u *)"' 20,<50,s10,h,rdf0:,rdf1:,rdf2:"}2600 (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"} 2601 2601 # else 2602 {(char_u *)"", (char_u *)"' 20,<50,s10,h"}2602 {(char_u *)"", (char_u *)"'100,<50,s10,h"} 2603 2603 # endif 2604 2604 #endif 2605 2605 #else … … 7974 7974 else /* curwin->w_p_scr > curwin->w_height */ 7975 7975 curwin->w_p_scr = curwin->w_height; 7976 7976 } 7977 if (p_hi < 0) 7978 { 7979 errmsg = e_positive; 7980 p_hi = 0; 7981 } 7977 7982 if (p_report < 0) 7978 7983 { 7979 7984 errmsg = e_positive; … … 8227 8232 { 8228 8233 if (number == 0 && string != NULL) 8229 8234 { 8230 int i ndex;8235 int idx; 8231 8236 8232 8237 /* Either we are given a string or we are setting option 8233 8238 * to zero. */ 8234 for (i ndex = 0; string[index] == '0'; ++index)8239 for (idx = 0; string[idx] == '0'; ++idx) 8235 8240 ; 8236 if (string[i ndex] != NUL || index == 0)8241 if (string[idx] != NUL || idx == 0) 8237 8242 { 8238 8243 /* There's another character after zeros or the string 8239 8244 * is empty. In both cases, we are trying to set a … … 8323 8328 { 8324 8329 --arg; /* put arg at the '<' */ 8325 8330 modifiers = 0; 8326 key = find_special_key(&arg, &modifiers, TRUE );8331 key = find_special_key(&arg, &modifiers, TRUE, TRUE); 8327 8332 if (modifiers) /* can't handle modifiers here */ 8328 8333 key = 0; 8329 8334 } -
src/os_unix.c
diff -Naur vim72.orig/src/os_unix.c vim72/src/os_unix.c
old new 315 315 {-1, "Unknown!", FALSE} 316 316 }; 317 317 318 /* 319 * Write s[len] to the screen. 320 */ 318 321 void 319 322 mch_write(s, len) 320 323 char_u *s; 321 324 int len; 322 325 { 323 write(1, (char *)s, len);326 ignored = (int)write(1, (char *)s, len); 324 327 if (p_wd) /* Unix is too fast, slow down a bit more */ 325 328 RealWaitForChar(read_cmd_fd, p_wd, NULL); 326 329 } … … 2905 2908 * Ignore any errors. 2906 2909 */ 2907 2910 #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK) 2908 signal_stack = malloc(SIGSTKSZ);2911 signal_stack = (char *)alloc(SIGSTKSZ); 2909 2912 init_signal_stack(); 2910 2913 #endif 2911 2914 } … … 2936 2939 } 2937 2940 # endif 2938 2941 # endif 2939 # ifdef FEAT_X11 2942 /* Don't close the display for GTK 1, it is done in exit(). */ 2943 # if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2)) 2940 2944 if (x11_display != NULL 2941 2945 # ifdef FEAT_XCLIPBOARD 2942 2946 && x11_display != xterm_dpy … … 3926 3930 */ 3927 3931 if (fd >= 0) 3928 3932 { 3929 dup(fd); /* To replace stdin (file descriptor0) */3930 dup(fd); /* To replace stdout (file descriptor1) */3931 dup(fd); /* To replace stderr (file descriptor2) */3933 ignored = dup(fd); /* To replace stdin (fd 0) */ 3934 ignored = dup(fd); /* To replace stdout (fd 1) */ 3935 ignored = dup(fd); /* To replace stderr (fd 2) */ 3932 3936 3933 3937 /* Don't need this now that we've duplicated it */ 3934 3938 close(fd); … … 3996 4000 3997 4001 /* set up stdin/stdout/stderr for the child */ 3998 4002 close(0); 3999 dup(pty_slave_fd);4003 ignored = dup(pty_slave_fd); 4000 4004 close(1); 4001 dup(pty_slave_fd);4005 ignored = dup(pty_slave_fd); 4002 4006 if (gui.in_use) 4003 4007 { 4004 4008 close(2); 4005 dup(pty_slave_fd);4009 ignored = dup(pty_slave_fd); 4006 4010 } 4007 4011 4008 4012 close(pty_slave_fd); /* has been dupped, close it now */ … … 4013 4017 /* set up stdin for the child */ 4014 4018 close(fd_toshell[1]); 4015 4019 close(0); 4016 dup(fd_toshell[0]);4020 ignored = dup(fd_toshell[0]); 4017 4021 close(fd_toshell[0]); 4018 4022 4019 4023 /* set up stdout for the child */ 4020 4024 close(fd_fromshell[0]); 4021 4025 close(1); 4022 dup(fd_fromshell[1]);4026 ignored = dup(fd_fromshell[1]); 4023 4027 close(fd_fromshell[1]); 4024 4028 4025 4029 # ifdef FEAT_GUI … … 4027 4031 { 4028 4032 /* set up stderr for the child */ 4029 4033 close(2); 4030 dup(1);4034 ignored = dup(1); 4031 4035 } 4032 4036 # endif 4033 4037 } … … 4158 4162 && (lnum != 4159 4163 curbuf->b_ml.ml_line_count 4160 4164 || curbuf->b_p_eol))) 4161 write(toshell_fd, "\n", (size_t)1); 4165 ignored = write(toshell_fd, "\n", 4166 (size_t)1); 4162 4167 ++lnum; 4163 4168 if (lnum > curbuf->b_op_end.lnum) 4164 4169 { … … 6814 6819 if (xsmp_icefd != -1) 6815 6820 { 6816 6821 SmcCloseConnection(xsmp.smcconn, 0, NULL); 6817 vim_free(xsmp.clientid); 6822 if (xsmp.clientid != NULL) 6823 free(xsmp.clientid); 6818 6824 xsmp.clientid = NULL; 6819 6825 xsmp_icefd = -1; 6820 6826 } -
src/proto/eval.pro
diff -Naur vim72.orig/src/proto/eval.pro vim72/src/proto/eval.pro
old new 17 17 int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip)); 18 18 char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip)); 19 19 int skip_expr __ARGS((char_u **pp)); 20 char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));20 char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert)); 21 21 char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox)); 22 22 int eval_to_number __ARGS((char_u *expr)); 23 23 list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr)); … … 46 46 void list_unref __ARGS((list_T *l)); 47 47 void list_free __ARGS((list_T *l, int recurse)); 48 48 dictitem_T *dict_lookup __ARGS((hashitem_T *hi)); 49 char_u *list_find_str __ARGS((list_T *l, long idx)); 49 50 int list_append_dict __ARGS((list_T *list, dict_T *dict)); 51 int list_append_string __ARGS((list_T *l, char_u *str, int len)); 50 52 int garbage_collect __ARGS((void)); 51 53 dict_T *dict_alloc __ARGS((void)); 52 54 int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str)); … … 58 60 void set_vim_var_nr __ARGS((int idx, long val)); 59 61 long get_vim_var_nr __ARGS((int idx)); 60 62 char_u *get_vim_var_str __ARGS((int idx)); 61 void set_vcount __ARGS((long count, long count1)); 63 list_T *get_vim_var_list __ARGS((int idx)); 64 void set_vcount __ARGS((long count, long count1, int set_prevcount)); 62 65 void set_vim_var_string __ARGS((int idx, char_u *val, int len)); 66 void set_vim_var_list __ARGS((int idx, list_T *val)); 63 67 void set_reg_var __ARGS((int c)); 64 68 char_u *v_exception __ARGS((char_u *oldval)); 65 69 char_u *v_throwpoint __ARGS((char_u *oldval)); … … 94 98 void write_viminfo_varlist __ARGS((FILE *fp)); 95 99 int store_session_globals __ARGS((FILE *fd)); 96 100 void last_set_msg __ARGS((scid_T scriptID)); 101 void ex_oldfiles __ARGS((exarg_T *eap)); 97 102 int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen)); 98 103 char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags)); 99 104 /* vim: set ft=c : */ -
src/proto/ex_cmds.pro
diff -Naur vim72.orig/src/proto/ex_cmds.pro vim72/src/proto/ex_cmds.pro
old new 11 11 char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp)); 12 12 void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname)); 13 13 int viminfo_error __ARGS((char *errnum, char *message, char_u *line)); 14 int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));14 int read_viminfo __ARGS((char_u *file, int flags)); 15 15 void write_viminfo __ARGS((char_u *file, int forceit)); 16 16 int viminfo_readline __ARGS((vir_T *virp)); 17 17 char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert)); -
src/proto/ex_getln.pro
diff -Naur vim72.orig/src/proto/ex_getln.pro vim72/src/proto/ex_getln.pro
old new 31 31 void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col)); 32 32 int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches)); 33 33 int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int)))); 34 char_u *globpath __ARGS((char_u *path, char_u *file ));34 char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options)); 35 35 void init_history __ARGS((void)); 36 36 int get_histtype __ARGS((char_u *name)); 37 37 void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep)); -
src/proto/mark.pro
diff -Naur vim72.orig/src/proto/mark.pro vim72/src/proto/mark.pro
old new 26 26 void write_viminfo_filemarks __ARGS((FILE *fp)); 27 27 int removable __ARGS((char_u *name)); 28 28 int write_viminfo_marks __ARGS((FILE *fp_out)); 29 void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof ));29 void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags)); 30 30 /* vim: set ft=c : */ -
src/proto/misc2.pro
diff -Naur vim72.orig/src/proto/misc2.pro vim72/src/proto/misc2.pro
old new 59 59 int handle_x_keys __ARGS((int key)); 60 60 char_u *get_special_key_name __ARGS((int c, int modifiers)); 61 61 int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode)); 62 int find_special_key __ARGS((char_u **srcp, int *modp, int keycode ));62 int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key)); 63 63 int extract_modifiers __ARGS((int key, int *modp)); 64 64 int find_special_key_in_table __ARGS((int c)); 65 65 int get_special_key_code __ARGS((char_u *name)); -
src/pty.c
diff -Naur vim72.orig/src/pty.c vim72/src/pty.c
old new 270 270 } 271 271 #endif 272 272 273 #if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) 273 #if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X) 274 274 275 /* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */ 275 /* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! 276 * Same for Mac OS X Leopard. */ 276 277 #define PTY_DONE 277 278 int 278 279 OpenPTY(ttyn) -
src/screen.c
diff -Naur vim72.orig/src/screen.c vim72/src/screen.c
old new 2439 2439 2440 2440 #ifdef FEAT_SYN_HL 2441 2441 /* Show 'cursorcolumn' in the fold line. */ 2442 if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp)) 2443 ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr( 2444 ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC)); 2442 if (wp->w_p_cuc) 2443 { 2444 txtcol += wp->w_virtcol; 2445 if (wp->w_p_wrap) 2446 txtcol -= wp->w_skipcol; 2447 else 2448 txtcol -= wp->w_leftcol; 2449 if (txtcol >= 0 && txtcol < W_WIDTH(wp)) 2450 ScreenAttrs[off + txtcol] = hl_combine_attr( 2451 ScreenAttrs[off + txtcol], hl_attr(HLF_CUC)); 2452 } 2445 2453 #endif 2446 2454 2447 2455 SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp), -
src/spell.c
diff -Naur vim72.orig/src/spell.c vim72/src/spell.c
old new 77 77 78 78 /* 79 79 * Do the opposite: based on a maximum end score and a known sound score, 80 * compute the themaximum word score that can be used.80 * compute the maximum word score that can be used. 81 81 */ 82 82 #define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3) 83 83 … … 469 469 garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */ 470 470 regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm 471 471 * (NULL when no compounding) */ 472 char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */ 472 473 char_u *sl_compstartflags; /* flags for first compound word */ 473 474 char_u *sl_compallflags; /* all flags for compound words */ 474 475 char_u sl_nobreak; /* When TRUE: no spaces between words */ … … 625 626 /* TRUE if a word appears in the list of banned words. */ 626 627 #define WAS_BANNED(su, word) (!HASHITEM_EMPTY(hash_find(&su->su_banned, word))) 627 628 628 /* Number of suggestions kept when cleaning up. we need to keep more than629 /* Number of suggestions kept when cleaning up. We need to keep more than 629 630 * what is displayed, because when rescore_suggestions() is called the score 630 631 * may change and wrong suggestions may be removed later. */ 631 632 #define SUG_CLEAN_COUNT(su) ((su)->su_maxcount < 130 ? 150 : (su)->su_maxcount + 20) … … 839 840 static void slang_clear __ARGS((slang_T *lp)); 840 841 static void slang_clear_sug __ARGS((slang_T *lp)); 841 842 static void find_word __ARGS((matchinf_T *mip, int mode)); 843 static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap)); 842 844 static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags)); 845 static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag)); 846 static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags)); 843 847 static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req)); 844 848 static void find_prefix __ARGS((matchinf_T *mip, int mode)); 845 849 static int fold_more __ARGS((matchinf_T *mip)); … … 1519 1523 ((unsigned)flags >> 24))) 1520 1524 continue; 1521 1525 1526 /* If there is a match with a CHECKCOMPOUNDPATTERN rule 1527 * discard the compound word. */ 1528 if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat)) 1529 continue; 1530 1522 1531 if (mode == FIND_COMPOUND) 1523 1532 { 1524 1533 int capflags; … … 1577 1586 if (!can_compound(slang, fword, mip->mi_compflags)) 1578 1587 continue; 1579 1588 } 1589 else if (slang->sl_comprules != NULL 1590 && !match_compoundrule(slang, mip->mi_compflags)) 1591 /* The compound flags collected so far do not match any 1592 * COMPOUNDRULE, discard the compounded word. */ 1593 continue; 1580 1594 } 1581 1595 1582 1596 /* Check NEEDCOMPOUND: can't use word without compounding. */ … … 1727 1741 } 1728 1742 1729 1743 /* 1744 * Return TRUE if there is a match between the word ptr[wlen] and 1745 * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another 1746 * word. 1747 * A match means that the first part of CHECKCOMPOUNDPATTERN matches at the 1748 * end of ptr[wlen] and the second part matches after it. 1749 */ 1750 static int 1751 match_checkcompoundpattern(ptr, wlen, gap) 1752 char_u *ptr; 1753 int wlen; 1754 garray_T *gap; /* &sl_comppat */ 1755 { 1756 int i; 1757 char_u *p; 1758 int len; 1759 1760 for (i = 0; i + 1 < gap->ga_len; i += 2) 1761 { 1762 p = ((char_u **)gap->ga_data)[i + 1]; 1763 if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0) 1764 { 1765 /* Second part matches at start of following compound word, now 1766 * check if first part matches at end of previous word. */ 1767 p = ((char_u **)gap->ga_data)[i]; 1768 len = (int)STRLEN(p); 1769 if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0) 1770 return TRUE; 1771 } 1772 } 1773 return FALSE; 1774 } 1775 1776 /* 1730 1777 * Return TRUE if "flags" is a valid sequence of compound flags and "word" 1731 1778 * does not have too many syllables. 1732 1779 */ … … 1773 1820 } 1774 1821 1775 1822 /* 1823 * Return TRUE when the sequence of flags in "compflags" plus "flag" can 1824 * possibly form a valid compounded word. This also checks the COMPOUNDRULE 1825 * lines if they don't contain wildcards. 1826 */ 1827 static int 1828 can_be_compound(sp, slang, compflags, flag) 1829 trystate_T *sp; 1830 slang_T *slang; 1831 char_u *compflags; 1832 int flag; 1833 { 1834 /* If the flag doesn't appear in sl_compstartflags or sl_compallflags 1835 * then it can't possibly compound. */ 1836 if (!byte_in_str(sp->ts_complen == sp->ts_compsplit 1837 ? slang->sl_compstartflags : slang->sl_compallflags, flag)) 1838 return FALSE; 1839 1840 /* If there are no wildcards, we can check if the flags collected so far 1841 * possibly can form a match with COMPOUNDRULE patterns. This only 1842 * makes sense when we have two or more words. */ 1843 if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit) 1844 { 1845 int v; 1846 1847 compflags[sp->ts_complen] = flag; 1848 compflags[sp->ts_complen + 1] = NUL; 1849 v = match_compoundrule(slang, compflags + sp->ts_compsplit); 1850 compflags[sp->ts_complen] = NUL; 1851 return v; 1852 } 1853 1854 return TRUE; 1855 } 1856 1857 1858 /* 1859 * Return TRUE if the compound flags in compflags[] match the start of any 1860 * compound rule. This is used to stop trying a compound if the flags 1861 * collected so far can't possibly match any compound rule. 1862 * Caller must check that slang->sl_comprules is not NULL. 1863 */ 1864 static int 1865 match_compoundrule(slang, compflags) 1866 slang_T *slang; 1867 char_u *compflags; 1868 { 1869 char_u *p; 1870 int i; 1871 int c; 1872 1873 /* loop over all the COMPOUNDRULE entries */ 1874 for (p = slang->sl_comprules; *p != NUL; ++p) 1875 { 1876 /* loop over the flags in the compound word we have made, match 1877 * them against the current rule entry */ 1878 for (i = 0; ; ++i) 1879 { 1880 c = compflags[i]; 1881 if (c == NUL) 1882 /* found a rule that matches for the flags we have so far */ 1883 return TRUE; 1884 if (*p == '/' || *p == NUL) 1885 break; /* end of rule, it's too short */ 1886 if (*p == '[') 1887 { 1888 int match = FALSE; 1889 1890 /* compare against all the flags in [] */ 1891 ++p; 1892 while (*p != ']' && *p != NUL) 1893 if (*p++ == c) 1894 match = TRUE; 1895 if (!match) 1896 break; /* none matches */ 1897 } 1898 else if (*p != c) 1899 break; /* flag of word doesn't match flag in pattern */ 1900 ++p; 1901 } 1902 1903 /* Skip to the next "/", where the next pattern starts. */ 1904 p = vim_strchr(p, '/'); 1905 if (p == NULL) 1906 break; 1907 } 1908 1909 /* Checked all the rules and none of them match the flags, so there 1910 * can't possibly be a compound starting with these flags. */ 1911 return FALSE; 1912 } 1913 1914 /* 1776 1915 * Return non-zero if the prefix indicated by "arridx" matches with the prefix 1777 1916 * ID in "flags" for the word "word". 1778 1917 * The WF_RAREPFX flag is included in the return value for a rare prefix. … … 2513 2652 lp->sl_midword = NULL; 2514 2653 2515 2654 vim_free(lp->sl_compprog); 2655 vim_free(lp->sl_comprules); 2516 2656 vim_free(lp->sl_compstartflags); 2517 2657 vim_free(lp->sl_compallflags); 2518 2658 lp->sl_compprog = NULL; 2659 lp->sl_comprules = NULL; 2519 2660 lp->sl_compstartflags = NULL; 2520 2661 lp->sl_compallflags = NULL; 2521 2662 … … 3460 3601 char_u *pp; 3461 3602 char_u *cp; 3462 3603 char_u *ap; 3604 char_u *crp; 3463 3605 int cnt; 3464 3606 garray_T *gap; 3465 3607 … … 3545 3687 slang->sl_compallflags = ap; 3546 3688 *ap = NUL; 3547 3689 3690 /* And a list of all patterns in their original form, for checking whether 3691 * compounding may work in match_compoundrule(). This is freed when we 3692 * encounter a wildcard, the check doesn't work then. */ 3693 crp = alloc(todo + 1); 3694 slang->sl_comprules = crp; 3695 3548 3696 pp = pat; 3549 3697 *pp++ = '^'; 3550 3698 *pp++ = '\\'; … … 3587 3735 atstart = 0; 3588 3736 } 3589 3737 } 3738 3739 /* Copy flag to "sl_comprules", unless we run into a wildcard. */ 3740 if (crp != NULL) 3741 { 3742 if (c == '+' || c == '*') 3743 { 3744 vim_free(slang->sl_comprules); 3745 slang->sl_comprules = NULL; 3746 crp = NULL; 3747 } 3748 else 3749 *crp++ = c; 3750 } 3751 3590 3752 if (c == '/') /* slash separates two items */ 3591 3753 { 3592 3754 *pp++ = '\\'; … … 3611 3773 *pp++ = '$'; 3612 3774 *pp = NUL; 3613 3775 3776 if (crp != NULL) 3777 *crp = NUL; 3778 3614 3779 slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT); 3615 3780 vim_free(pat); 3616 3781 if (slang->sl_compprog == NULL) … … 4915 5080 } spellinfo_T; 4916 5081 4917 5082 static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname)); 5083 static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount)); 4918 5084 static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry)); 4919 5085 static int spell_info_item __ARGS((char_u *s)); 4920 5086 static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum)); … … 4950 5116 static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd)); 4951 5117 static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname)); 4952 5118 static void clear_node __ARGS((wordnode_T *node)); 4953 static int put_node __ARGS((FILE *fd, wordnode_T *node, int i ndex, int regionmask, int prefixtree));5119 static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree)); 4954 5120 static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname)); 4955 5121 static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang)); 4956 5122 static int sug_maketable __ARGS((spellinfo_T *spin)); … … 5223 5389 /* Handle non-empty lines. */ 5224 5390 if (itemcnt > 0) 5225 5391 { 5226 if (STRCMP(items[0], "SET") == 0 && itemcnt == 2 5227 && aff->af_enc == NULL) 5392 if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL) 5228 5393 { 5229 5394 #ifdef FEAT_MBYTE 5230 5395 /* Setup for conversion from "ENC" to 'encoding'. */ … … 5239 5404 smsg((char_u *)_("Conversion in %s not supported"), fname); 5240 5405 #endif 5241 5406 } 5242 else if ( STRCMP(items[0], "FLAG") == 0 && itemcnt == 25407 else if (is_aff_rule(items, itemcnt, "FLAG", 2) 5243 5408 && aff->af_flagtype == AFT_CHAR) 5244 5409 { 5245 5410 if (STRCMP(items[1], "long") == 0) … … 5284 5449 spin->si_info = p; 5285 5450 } 5286 5451 } 5287 else if ( STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 25452 else if (is_aff_rule(items, itemcnt, "MIDWORD", 2) 5288 5453 && midword == NULL) 5289 5454 { 5290 5455 midword = getroom_save(spin, items[1]); 5291 5456 } 5292 else if ( STRCMP(items[0], "TRY") == 0 && itemcnt == 2)5457 else if (is_aff_rule(items, itemcnt, "TRY", 2)) 5293 5458 { 5294 5459 /* ignored, we look in the tree for what chars may appear */ 5295 5460 } 5296 5461 /* TODO: remove "RAR" later */ 5297 else if (( STRCMP(items[0], "RAR") == 05298 || STRCMP(items[0], "RARE") == 0) && itemcnt == 25299 5462 else if ((is_aff_rule(items, itemcnt, "RAR", 2) 5463 || is_aff_rule(items, itemcnt, "RARE", 2)) 5464 && aff->af_rare == 0) 5300 5465 { 5301 5466 aff->af_rare = affitem2flag(aff->af_flagtype, items[1], 5302 5467 fname, lnum); 5303 5468 } 5304 5469 /* TODO: remove "KEP" later */ 5305 else if (( STRCMP(items[0], "KEP") == 05306 || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 25470 else if ((is_aff_rule(items, itemcnt, "KEP", 2) 5471 || is_aff_rule(items, itemcnt, "KEEPCASE", 2)) 5307 5472 && aff->af_keepcase == 0) 5308 5473 { 5309 5474 aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1], 5310 5475 fname, lnum); 5311 5476 } 5312 else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2 5313 && aff->af_bad == 0) 5477 else if ((is_aff_rule(items, itemcnt, "BAD", 2) 5478 || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2)) 5479 && aff->af_bad == 0) 5314 5480 { 5315 5481 aff->af_bad = affitem2flag(aff->af_flagtype, items[1], 5316 5482 fname, lnum); 5317 5483 } 5318 else if ( STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 25484 else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2) 5319 5485 && aff->af_needaffix == 0) 5320 5486 { 5321 5487 aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1], 5322 5488 fname, lnum); 5323 5489 } 5324 else if ( STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 25490 else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2) 5325 5491 && aff->af_circumfix == 0) 5326 5492 { 5327 5493 aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1], 5328 5494 fname, lnum); 5329 5495 } 5330 else if ( STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 25496 else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2) 5331 5497 && aff->af_nosuggest == 0) 5332 5498 { 5333 5499 aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1], 5334 5500 fname, lnum); 5335 5501 } 5336 else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2 5502 else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2) 5503 || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2)) 5337 5504 && aff->af_needcomp == 0) 5338 5505 { 5339 5506 aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1], 5340 5507 fname, lnum); 5341 5508 } 5342 else if ( STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 25509 else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2) 5343 5510 && aff->af_comproot == 0) 5344 5511 { 5345 5512 aff->af_comproot = affitem2flag(aff->af_flagtype, items[1], 5346 5513 fname, lnum); 5347 5514 } 5348 else if ( STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 05349 && itemcnt == 2&& aff->af_compforbid == 0)5515 else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2) 5516 && aff->af_compforbid == 0) 5350 5517 { 5351 5518 aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1], 5352 5519 fname, lnum); … … 5354 5521 smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), 5355 5522 fname, lnum); 5356 5523 } 5357 else if ( STRCMP(items[0], "COMPOUNDPERMITFLAG") == 05358 && itemcnt == 2&& aff->af_comppermit == 0)5524 else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2) 5525 && aff->af_comppermit == 0) 5359 5526 { 5360 5527 aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1], 5361 5528 fname, lnum); … … 5363 5530 smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), 5364 5531 fname, lnum); 5365 5532 } 5366 else if ( STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 25533 else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2) 5367 5534 && compflags == NULL) 5368 5535 { 5369 5536 /* Turn flag "c" into COMPOUNDRULE compatible string "c+", … … 5376 5543 compflags = p; 5377 5544 } 5378 5545 } 5379 else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2) 5546 else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2)) 5547 { 5548 /* We don't use the count, but do check that it's a number and 5549 * not COMPOUNDRULE mistyped. */ 5550 if (atoi((char *)items[1]) == 0) 5551 smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"), 5552 fname, lnum, items[1]); 5553 } 5554 else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) 5380 5555 { 5381 5556 /* Concatenate this string to previously defined ones, using a 5382 5557 * slash to separate them. */ … … 5395 5570 compflags = p; 5396 5571 } 5397 5572 } 5398 else if ( STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 25573 else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2) 5399 5574 && compmax == 0) 5400 5575 { 5401 5576 compmax = atoi((char *)items[1]); … … 5403 5578 smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), 5404 5579 fname, lnum, items[1]); 5405 5580 } 5406 else if ( STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 25581 else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2) 5407 5582 && compminlen == 0) 5408 5583 { 5409 5584 compminlen = atoi((char *)items[1]); … … 5411 5586 smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"), 5412 5587 fname, lnum, items[1]); 5413 5588 } 5414 else if ( STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 25589 else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2) 5415 5590 && compsylmax == 0) 5416 5591 { 5417 5592 compsylmax = atoi((char *)items[1]); … … 5419 5594 smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), 5420 5595 fname, lnum, items[1]); 5421 5596 } 5422 else if ( STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)5597 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1)) 5423 5598 { 5424 5599 compoptions |= COMP_CHECKDUP; 5425 5600 } 5426 else if ( STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)5601 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1)) 5427 5602 { 5428 5603 compoptions |= COMP_CHECKREP; 5429 5604 } 5430 else if ( STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)5605 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1)) 5431 5606 { 5432 5607 compoptions |= COMP_CHECKCASE; 5433 5608 } 5434 else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0 5435 && itemcnt == 1) 5609 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1)) 5436 5610 { 5437 5611 compoptions |= COMP_CHECKTRIPLE; 5438 5612 } 5439 else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0 5440 && itemcnt == 2) 5613 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2)) 5441 5614 { 5442 5615 if (atoi((char *)items[1]) == 0) 5443 5616 smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), 5444 5617 fname, lnum, items[1]); 5445 5618 } 5446 else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0 5447 && itemcnt == 3) 5619 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3)) 5448 5620 { 5449 5621 garray_T *gap = &spin->si_comppat; 5450 5622 int i; … … 5463 5635 = getroom_save(spin, items[2]); 5464 5636 } 5465 5637 } 5466 else if ( STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 25638 else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2) 5467 5639 && syllable == NULL) 5468 5640 { 5469 5641 syllable = getroom_save(spin, items[1]); 5470 5642 } 5471 else if ( STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)5643 else if (is_aff_rule(items, itemcnt, "NOBREAK", 1)) 5472 5644 { 5473 5645 spin->si_nobreak = TRUE; 5474 5646 } 5475 else if ( STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)5647 else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1)) 5476 5648 { 5477 5649 spin->si_nosplitsugs = TRUE; 5478 5650 } 5479 else if ( STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)5651 else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1)) 5480 5652 { 5481 5653 spin->si_nosugfile = TRUE; 5482 5654 } 5483 else if ( STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)5655 else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1)) 5484 5656 { 5485 5657 aff->af_pfxpostpone = TRUE; 5486 5658 } … … 5771 5943 } 5772 5944 } 5773 5945 } 5774 else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2 5775 && fol == NULL) 5946 else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL) 5776 5947 { 5777 5948 fol = vim_strsave(items[1]); 5778 5949 } 5779 else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2 5780 && low == NULL) 5950 else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL) 5781 5951 { 5782 5952 low = vim_strsave(items[1]); 5783 5953 } 5784 else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2 5785 && upp == NULL) 5954 else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL) 5786 5955 { 5787 5956 upp = vim_strsave(items[1]); 5788 5957 } 5789 else if ((STRCMP(items[0], "REP") == 0 5790 || STRCMP(items[0], "REPSAL") == 0) 5791 && itemcnt == 2) 5958 else if (is_aff_rule(items, itemcnt, "REP", 2) 5959 || is_aff_rule(items, itemcnt, "REPSAL", 2)) 5792 5960 { 5793 5961 /* Ignore REP/REPSAL count */; 5794 5962 if (!isdigit(*items[1])) … … 5819 5987 : &spin->si_rep, items[1], items[2]); 5820 5988 } 5821 5989 } 5822 else if ( STRCMP(items[0], "MAP") == 0 && itemcnt == 2)5990 else if (is_aff_rule(items, itemcnt, "MAP", 2)) 5823 5991 { 5824 5992 /* MAP item or count */ 5825 5993 if (!found_map) … … 5856 6024 ga_append(&spin->si_map, '/'); 5857 6025 } 5858 6026 } 5859 /* Accept "SAL from to" and "SAL from to # comment". */ 5860 else if (STRCMP(items[0], "SAL") == 0 5861 && (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#'))) 6027 /* Accept "SAL from to" and "SAL from to #comment". */ 6028 else if (is_aff_rule(items, itemcnt, "SAL", 3)) 5862 6029 { 5863 6030 if (do_sal) 5864 6031 { … … 5877 6044 : items[2]); 5878 6045 } 5879 6046 } 5880 else if ( STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 26047 else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2) 5881 6048 && sofofrom == NULL) 5882 6049 { 5883 6050 sofofrom = getroom_save(spin, items[1]); 5884 6051 } 5885 else if ( STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 26052 else if (is_aff_rule(items, itemcnt, "SOFOTO", 2) 5886 6053 && sofoto == NULL) 5887 6054 { 5888 6055 sofoto = getroom_save(spin, items[1]); … … 5980 6147 else if (spin->si_newprefID == 0 || spin->si_newprefID == 127) 5981 6148 MSG(_("Too many compound flags")); 5982 6149 else 5983 MSG(_("Too many pos poned prefixes and/or compound flags"));6150 MSG(_("Too many postponed prefixes and/or compound flags")); 5984 6151 } 5985 6152 5986 6153 if (syllable != NULL) … … 6017 6184 } 6018 6185 6019 6186 /* 6187 * Return TRUE when items[0] equals "rulename", there are "mincount" items or 6188 * a comment is following after item "mincount". 6189 */ 6190 static int 6191 is_aff_rule(items, itemcnt, rulename, mincount) 6192 char_u **items; 6193 int itemcnt; 6194 char *rulename; 6195 int mincount; 6196 { 6197 return (STRCMP(items[0], rulename) == 0 6198 && (itemcnt == mincount 6199 || (itemcnt > mincount && items[mincount][0] == '#'))); 6200 } 6201 6202 /* 6020 6203 * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from 6021 6204 * ae_flags to ae_comppermit and ae_compforbid. 6022 6205 */ … … 7926 8109 char_u *p; 7927 8110 int rr; 7928 8111 int retval = OK; 8112 size_t fwv = 1; /* collect return value of fwrite() to avoid 8113 warnings from picky compiler */ 7929 8114 7930 8115 fd = mch_fopen((char *)fname, "w"); 7931 8116 if (fd == NULL) … … 7936 8121 7937 8122 /* <HEADER>: <fileID> <versionnr> */ 7938 8123 /* <fileID> */ 7939 if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)7940 {7941 EMSG(_(e_write));7942 retval = FAIL;7943 } 8124 fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd); 8125 if (fwv != (size_t)1) 8126 /* Catch first write error, don't try writing more. */ 8127 goto theend; 8128 7944 8129 putc(VIMSPELLVERSION, fd); /* <versionnr> */ 7945 8130 7946 8131 /* … … 7955 8140 7956 8141 i = (int)STRLEN(spin->si_info); 7957 8142 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ 7958 fw rite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */8143 fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */ 7959 8144 } 7960 8145 7961 8146 /* SN_REGION: <regionname> ... … … 7966 8151 putc(SNF_REQUIRED, fd); /* <sectionflags> */ 7967 8152 l = spin->si_region_count * 2; 7968 8153 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ 7969 fw rite(spin->si_region_name, (size_t)l, (size_t)1, fd);8154 fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd); 7970 8155 /* <regionname> ... */ 7971 8156 regionmask = (1 << spin->si_region_count) - 1; 7972 8157 } … … 8016 8201 } 8017 8202 8018 8203 put_bytes(fd, (long_u)l, 2); /* <folcharslen> */ 8019 fw rite(folchars, (size_t)l, (size_t)1, fd);/* <folchars> */8204 fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */ 8020 8205 } 8021 8206 8022 8207 /* SN_MIDWORD: <midword> */ … … 8027 8212 8028 8213 i = (int)STRLEN(spin->si_midword); 8029 8214 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ 8030 fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */ 8215 fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); 8216 /* <midword> */ 8031 8217 } 8032 8218 8033 8219 /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */ … … 8113 8299 p = rr == 1 ? ftp->ft_from : ftp->ft_to; 8114 8300 l = (int)STRLEN(p); 8115 8301 putc(l, fd); 8116 fwrite(p, l, (size_t)1, fd); 8302 if (l > 0) 8303 fwv &= fwrite(p, l, (size_t)1, fd); 8117 8304 } 8118 8305 } 8119 8306 … … 8131 8318 /* <sectionlen> */ 8132 8319 8133 8320 put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */ 8134 fw rite(spin->si_sofofr, l, (size_t)1, fd);/* <sofofrom> */8321 fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */ 8135 8322 8136 8323 l = (int)STRLEN(spin->si_sofoto); 8137 8324 put_bytes(fd, (long_u)l, 2); /* <sofotolen> */ 8138 fw rite(spin->si_sofoto, l, (size_t)1, fd);/* <sofoto> */8325 fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */ 8139 8326 } 8140 8327 8141 8328 /* SN_WORDS: <word> ... … … 8160 8347 l = (int)STRLEN(hi->hi_key) + 1; 8161 8348 len += l; 8162 8349 if (round == 2) /* <word> */ 8163 fw rite(hi->hi_key, (size_t)l, (size_t)1, fd);8350 fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd); 8164 8351 --todo; 8165 8352 } 8166 8353 if (round == 1) … … 8176 8363 putc(0, fd); /* <sectionflags> */ 8177 8364 l = spin->si_map.ga_len; 8178 8365 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ 8179 fw rite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);8366 fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd); 8180 8367 /* <mapstr> */ 8181 8368 } 8182 8369 … … 8232 8419 { 8233 8420 p = ((char_u **)(spin->si_comppat.ga_data))[i]; 8234 8421 putc((int)STRLEN(p), fd); /* <comppatlen> */ 8235 fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */ 8422 fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd); 8423 /* <comppattext> */ 8236 8424 } 8237 8425 /* <compflags> */ 8238 fw rite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),8426 fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags), 8239 8427 (size_t)1, fd); 8240 8428 } 8241 8429 … … 8259 8447 8260 8448 l = (int)STRLEN(spin->si_syllable); 8261 8449 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ 8262 fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */ 8450 fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); 8451 /* <syllable> */ 8263 8452 } 8264 8453 8265 8454 /* end of <SECTIONS> */ … … 8295 8484 (void)put_node(fd, tree, 0, regionmask, round == 3); 8296 8485 } 8297 8486 8298 /* Write another byte to check for errors . */8487 /* Write another byte to check for errors (file system full). */ 8299 8488 if (putc(0, fd) == EOF) 8300 8489 retval = FAIL; 8301 8490 theend: 8302 8491 if (fclose(fd) == EOF) 8303 8492 retval = FAIL; 8304 8493 8494 if (fwv != (size_t)1) 8495 retval = FAIL; 8496 if (retval == FAIL) 8497 EMSG(_(e_write)); 8498 8305 8499 return retval; 8306 8500 } 8307 8501 … … 9890 10084 char_u *p; 9891 10085 int len; 9892 10086 int totlen; 10087 size_t x = 1; /* collect return value of fwrite() */ 9893 10088 9894 10089 if (fd != NULL) 9895 10090 put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */ … … 9906 10101 if (fd != NULL) 9907 10102 { 9908 10103 fputc(len, fd); 9909 fwrite(p, (size_t)len, (size_t)1, fd);10104 x &= fwrite(p, (size_t)len, (size_t)1, fd); 9910 10105 } 9911 10106 totlen += len; 9912 10107 } … … 11480 11675 vim_strncpy(preword + sp->ts_prewordlen, 11481 11676 tword + sp->ts_splitoff, 11482 11677 sp->ts_twordlen - sp->ts_splitoff); 11483 p = preword; 11484 while (*skiptowhite(p) != NUL) 11485 p = skipwhite(skiptowhite(p)); 11486 if (fword_ends && !can_compound(slang, p, 11487 compflags + sp->ts_compsplit)) 11488 /* Compound is not allowed. But it may still be 11489 * possible if we add another (short) word. */ 11678 11679 /* Verify CHECKCOMPOUNDPATTERN rules. */ 11680 if (match_checkcompoundpattern(preword, sp->ts_prewordlen, 11681 &slang->sl_comppat)) 11490 11682 compound_ok = FALSE; 11491 11683 11684 if (compound_ok) 11685 { 11686 p = preword; 11687 while (*skiptowhite(p) != NUL) 11688 p = skipwhite(skiptowhite(p)); 11689 if (fword_ends && !can_compound(slang, p, 11690 compflags + sp->ts_compsplit)) 11691 /* Compound is not allowed. But it may still be 11692 * possible if we add another (short) word. */ 11693 compound_ok = FALSE; 11694 } 11695 11492 11696 /* Get pointer to last char of previous word. */ 11493 11697 p = preword + sp->ts_prewordlen; 11494 11698 mb_ptr_back(preword, p); … … 11685 11889 && (slang->sl_compsylmax < MAXWLEN 11686 11890 || sp->ts_complen + 1 - sp->ts_compsplit 11687 11891 < slang->sl_compmax) 11688 && (byte_in_str(sp->ts_complen == sp->ts_compsplit 11689 ? slang->sl_compstartflags 11690 : slang->sl_compallflags, 11691 ((unsigned)flags >> 24)))) 11892 && (can_be_compound(sp, slang, 11893 compflags, ((unsigned)flags >> 24)))) 11894 11692 11895 { 11693 11896 try_compound = TRUE; 11694 11897 compflags[sp->ts_complen] = ((unsigned)flags >> 24); -
src/structs.h
diff -Naur vim72.orig/src/structs.h vim72/src/structs.h
old new 459 459 typedef struct 460 460 { 461 461 int hide; /* TRUE when ":hide" was used */ 462 # ifdef FEAT_BROWSE 462 # ifdef FEAT_BROWSE_CMD 463 463 int browse; /* TRUE to invoke file dialog */ 464 464 # endif 465 465 # ifdef FEAT_WINDOWS … … 1784 1784 #endif 1785 1785 1786 1786 /* 1787 * The next three specify the offsets for displaying the buffer: 1787 * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for 1788 * displaying the buffer. 1788 1789 */ 1789 1790 linenr_T w_topline; /* buffer line number of the line at the 1790 1791 top of the window */ 1792 #ifdef FEAT_AUTOCMD 1793 char w_topline_was_set; /* flag set to TRUE when topline is set, 1794 e.g. by winrestview() */ 1795 #endif 1791 1796 #ifdef FEAT_DIFF 1792 1797 int w_topfill; /* number of filler lines above w_topline */ 1793 1798 int w_old_topfill; /* w_topfill at last redraw */ -
src/tag.c
diff -Naur vim72.orig/src/tag.c vim72/src/tag.c
old new 2725 2725 */ 2726 2726 p_7f = vim_strchr(lbuf, 0x7f); 2727 2727 if (p_7f == NULL) 2728 { 2729 etag_fail: 2730 if (vim_strchr(lbuf, '\n') == NULL) 2731 { 2732 /* Truncated line. Ignore it. */ 2733 if (p_verbose >= 5) 2734 { 2735 verbose_enter(); 2736 MSG(_("Ignoring long line in tags file")); 2737 verbose_leave(); 2738 } 2739 tagp->command = lbuf; 2740 tagp->tagname = lbuf; 2741 tagp->tagname_end = lbuf; 2742 return OK; 2743 } 2728 2744 return FAIL; 2745 } 2729 2746 2730 2747 /* Find ^A. If not found the line number is after the 0x7f */ 2731 2748 p = vim_strchr(p_7f, Ctrl_A); … … 2735 2752 ++p; 2736 2753 2737 2754 if (!VIM_ISDIGIT(*p)) /* check for start of line number */ 2738 return FAIL;2755 goto etag_fail; 2739 2756 tagp->command = p; 2740 2757 2741 2758 … … 2749 2766 /* find end of tagname */ 2750 2767 for (p = p_7f - 1; !vim_iswordc(*p); --p) 2751 2768 if (p == lbuf) 2752 return FAIL;2769 goto etag_fail; 2753 2770 tagp->tagname_end = p + 1; 2754 2771 while (p >= lbuf && vim_iswordc(*p)) 2755 2772 --p; -
src/testdir/Make_ming.mak
diff -Naur vim72.orig/src/testdir/Make_ming.mak vim72/src/testdir/Make_ming.mak
old new 1 # Makefile to run tests for Vim, on Dos-like machines 2 # with sh.exe or zsh.exe in the path or not. 3 # 4 # Author: Bill McCarthy 5 # 6 # Note that test54 has been removed until it is fixed. 7 # 8 # Requires a set of Unix tools: echo, diff, etc. 9 10 ifneq (sh.exe, $(SHELL)) 11 DEL = rm -f 12 MV = mv 13 CP = cp 14 DIRSLASH = / 15 else 16 DEL = del 17 MV = rename 18 CP = copy 19 DIRSLASH = \\ 20 endif 21 22 VIMPROG = ..$(DIRSLASH)vim 23 24 # Omitted: 25 # test2 "\\tmp" doesn't work. 26 # test10 'errorformat' is different 27 # test12 can't unlink a swap file 28 # test25 uses symbolic link 29 # test27 can't edit file with "*" in file name 30 # test31 16 bit version runs out of memory... 31 32 SCRIPTS16 = test1.out test19.out test20.out test22.out \ 33 test23.out test24.out test28.out test29.out \ 34 test35.out test36.out test43.out \ 35 test44.out test45.out test46.out test47.out \ 36 test48.out test51.out test53.out \ 37 test55.out test56.out test57.out test58.out test59.out \ 38 test60.out test61.out test62.out test63.out test64.out 39 40 # Had to remove test54 which doesn't work yet. 41 # test54.out 42 43 SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ 44 test8.out test9.out test11.out test13.out test14.out \ 45 test15.out test17.out test18.out test21.out test26.out \ 46 test30.out test31.out test32.out test33.out test34.out \ 47 test37.out test38.out test39.out test40.out test41.out \ 48 test42.out test52.out test65.out 49 50 SCRIPTS32 = test50.out 51 52 SCRIPTS_GUI = test16.out 53 54 .SUFFIXES: .in .out 55 56 vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32) 57 echo ALL DONE 58 59 nongui: fixff $(SCRIPTS16) $(SCRIPTS) 60 echo ALL DONE 61 62 small: 63 echo ALL DONE 64 65 gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) 66 echo ALL DONE 67 68 win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) 69 echo ALL DONE 70 71 fixff: 72 -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok 73 74 clean: 75 -$(DEL) *.out 76 -$(DEL) test.ok 77 -$(DEL) small.vim 78 -$(DEL) tiny.vim 79 -$(DEL) mbyte.vim 80 -$(DEL) X* 81 -$(DEL) viminfo 82 83 .in.out: 84 $(CP) $*.ok test.ok 85 $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in 86 diff test.out $*.ok 87 -$(DEL) $*.out 88 $(MV) test.out $*.out 89 -$(DEL) X* 90 -$(DEL) test.ok 91 -$(DEL) viminfo -
src/testdir/Makefile
diff -Naur vim72.orig/src/testdir/Makefile vim72/src/testdir/Makefile
old new 26 26 27 27 .SUFFIXES: .in .out 28 28 29 nongui: nolog $(SCRIPTS) 30 @echo 31 @cat test.log 32 @echo ALL DONE 29 nongui: nolog $(SCRIPTS) report 30 31 gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report 33 32 34 gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) 33 report: 35 34 @echo 36 @cat test.log 37 @echo ALL DONE 35 @echo 'Test results:' 36 @/bin/sh -c "if test -f test.log; \ 37 then cat test.log; echo TEST FAILURE; exit 1; \ 38 else echo ALL DONE; \ 39 fi" 38 40 39 41 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG) 40 42 … … 71 73 test60.out: test60.vim 72 74 73 75 nolog: 74 - echo Test results: >test.log76 -rm -f test.log -
src/testdir/test42.ok
diff -Naur vim72.orig/src/testdir/test42.ok vim72/src/testdir/test42.ok
old new 20 20 ucs-2 21 21 22 22 23 fileencoding=u cs-2le23 fileencoding=utf-16le 24 24 bomb 25 25 ucs-2le 26 26 -
src/ui.c
diff -Naur vim72.orig/src/ui.c vim72/src/ui.c
old new 1820 1820 #ifdef HAVE_DUP 1821 1821 /* Use stderr for stdin, also works for shell commands. */ 1822 1822 close(0); 1823 dup(2);1823 ignored = dup(2); 1824 1824 #else 1825 1825 read_cmd_fd = 2; /* read from stderr instead of stdin */ 1826 1826 #endif … … 2020 2020 2021 2021 if (value == NULL || *length == 0) 2022 2022 { 2023 clip_free_selection(cbd); /* ??? [what's the query?]*/2023 clip_free_selection(cbd); /* nothing received, clear register */ 2024 2024 *(int *)success = FALSE; 2025 2025 return; 2026 2026 } … … 2076 2076 text_prop.value = (unsigned char *)value; 2077 2077 text_prop.encoding = *type; 2078 2078 text_prop.format = *format; 2079 text_prop.nitems = STRLEN(value);2079 text_prop.nitems = len; 2080 2080 status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop, 2081 2081 &text_list, &n_text); 2082 2082 if (status != Success || n_text < 1) … … 2110 2110 int i; 2111 2111 int nbytes = 0; 2112 2112 char_u *buffer; 2113 time_t start_time; 2114 int timed_out = FALSE; 2113 2115 2114 2116 for (i = 2115 2117 #ifdef FEAT_MBYTE … … 2129 2131 case 3: type = text_atom; break; 2130 2132 default: type = XA_STRING; 2131 2133 } 2134 success = MAYBE; 2132 2135 XtGetSelectionValue(myShell, cbd->sel_atom, type, 2133 2136 clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime); 2134 2137 … … 2141 2144 * characters, then they will appear before the one that requested the 2142 2145 * paste! Don't worry, we will catch up with any other events later. 2143 2146 */ 2144 for (;;) 2147 start_time = time(NULL); 2148 while (success == MAYBE) 2145 2149 { 2146 if (XCheckTypedEvent(dpy, SelectionNotify, &event)) 2147 break; 2148 if (XCheckTypedEvent(dpy, SelectionRequest, &event)) 2149 /* We may get a SelectionRequest here and if we don't handle 2150 * it we hang. KDE klipper does this, for example. */ 2150 if (XCheckTypedEvent(dpy, SelectionNotify, &event) 2151 || XCheckTypedEvent(dpy, SelectionRequest, &event) 2152 || XCheckTypedEvent(dpy, PropertyNotify, &event)) 2153 { 2154 /* This is where clip_x11_request_selection_cb() should be 2155 * called. It may actually happen a bit later, so we loop 2156 * until "success" changes. 2157 * We may get a SelectionRequest here and if we don't handle 2158 * it we hang. KDE klipper does this, for example. 2159 * We need to handle a PropertyNotify for large selections. */ 2151 2160 XtDispatchEvent(&event); 2161 continue; 2162 } 2163 2164 /* Time out after 2 to 3 seconds to avoid that we hang when the 2165 * other process doesn't respond. Note that the SelectionNotify 2166 * event may still come later when the selection owner comes back 2167 * to life and the text gets inserted unexpectedly. Don't know 2168 * why that happens or how to avoid that :-(. */ 2169 if (time(NULL) > start_time + 2) 2170 { 2171 timed_out = TRUE; 2172 break; 2173 } 2152 2174 2153 2175 /* Do we need this? Probably not. */ 2154 2176 XSync(dpy, False); 2155 2177 2156 /* Bernhard Walle solved a slow paste response in an X terminal by2157 * adding: usleep(10000); here. */2178 /* Wait for 1 msec to avoid that we eat up all CPU time. */ 2179 ui_delay(1L, TRUE); 2158 2180 } 2159 2181 2160 /* this is where clip_x11_request_selection_cb() is actually called */ 2161 XtDispatchEvent(&event); 2162 2163 if (success) 2182 if (success == TRUE) 2164 2183 return; 2184 2185 /* don't do a retry with another type after timing out, otherwise we 2186 * hang for 15 seconds. */ 2187 if (timed_out) 2188 break; 2165 2189 } 2166 2190 2167 2191 /* Final fallback position - use the X CUT_BUFFER0 store */ -
src/version.c
diff -Naur vim72.orig/src/version.c vim72/src/version.c
old new 677 677 static int included_patches[] = 678 678 { /* Add new patch number below this line */ 679 679 /**/ 680 76, 681 /**/ 682 75, 683 /**/ 684 73, 685 /**/ 686 70, 687 /**/ 688 69, 689 /**/ 690 68, 691 /**/ 692 67, 693 /**/ 694 66, 695 /**/ 696 65, 697 /**/ 698 64, 699 /**/ 700 63, 701 /**/ 702 62, 703 /**/ 704 61, 705 /**/ 706 60, 707 /**/ 708 59, 709 /**/ 710 58, 711 /**/ 712 57, 713 /**/ 714 56, 715 /**/ 716 55, 717 /**/ 718 54, 719 /**/ 720 53, 721 /**/ 722 52, 723 /**/ 724 51, 725 /**/ 726 50, 727 /**/ 728 48, 729 /**/ 730 47, 731 /**/ 732 46, 733 /**/ 734 45, 735 /**/ 736 44, 737 /**/ 738 43, 739 /**/ 740 42, 741 /**/ 742 40, 743 /**/ 744 39, 745 /**/ 746 38, 747 /**/ 748 37, 749 /**/ 750 35, 751 /**/ 752 34, 753 /**/ 754 33, 755 /**/ 756 32, 757 /**/ 758 31, 759 /**/ 760 30, 761 /**/ 762 29, 763 /**/ 764 28, 765 /**/ 766 27, 767 /**/ 768 26, 769 /**/ 770 25, 771 /**/ 772 24, 773 /**/ 774 23, 775 /**/ 776 22, 777 /**/ 778 21, 779 /**/ 780 20, 781 /**/ 782 19, 783 /**/ 784 18, 785 /**/ 786 17, 787 /**/ 788 16, 789 /**/ 790 15, 791 /**/ 792 14, 793 /**/ 794 13, 795 /**/ 796 12, 797 /**/ 798 11, 799 /**/ 800 10, 801 /**/ 802 9, 803 /**/ 804 8, 805 /**/ 806 6, 807 /**/ 808 5, 809 /**/ 810 4, 811 /**/ 812 3, 813 /**/ 814 2, 815 /**/ 816 1, 817 /**/ 680 818 0 681 819 }; 682 820 821 /* 822 * Place to put a short description when adding a feature with a patch. 823 * Keep it short, e.g.,: "relative numbers", "persistent undo". 824 * Also add a comment marker to separate the lines. 825 * See the official Vim patches for the diff format: It must use a context of 826 * one line only. Create it by hand or use "diff -C2" and edit the patch. 827 */ 828 static char *(extra_patches[]) = 829 { /* Add your patch description below this line */ 830 /**/ 831 NULL 832 }; 833 683 834 int 684 835 highest_patch() 685 836 { … … 786 937 MSG_PUTS(_("\nRISC OS version")); 787 938 #endif 788 939 #ifdef VMS 789 MSG_PUTS( "\nOpenVMS version");940 MSG_PUTS(_("\nOpenVMS version")); 790 941 # ifdef HAVE_PATHDEF 791 942 if (*compiled_arch != NUL) 792 943 { … … 825 976 } 826 977 } 827 978 979 /* Print the list of extra patch descriptions if there is at least one. */ 980 if (extra_patches[0] != NULL) 981 { 982 MSG_PUTS(_("\nExtra patches: ")); 983 s = ""; 984 for (i = 0; extra_patches[i] != NULL; ++i) 985 { 986 MSG_PUTS(s); 987 s = ", "; 988 MSG_PUTS(extra_patches[i]); 989 } 990 } 991 828 992 #ifdef MODIFIED_BY 829 993 MSG_PUTS("\n"); 830 994 MSG_PUTS(_("Modified by ")); -
src/vim.h
diff -Naur vim72.orig/src/vim.h vim72/src/vim.h
old new 341 341 #ifdef BACKSLASH_IN_FILENAME 342 342 # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<") 343 343 #else 344 # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<") 345 # define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&") 344 # ifdef VMS 345 /* VMS allows a lot of characters in the file name */ 346 # define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!") 347 # define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&") 348 # else 349 # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<") 350 # define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&") 351 # endif 346 352 #endif 347 353 348 354 #define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */ … … 370 376 * Define __w64 as an empty token for everything but MSVC 7.x or later. 371 377 */ 372 378 # if !defined(_MSC_VER) || (_MSC_VER < 1300) 373 # define __w64 379 # define __w64 374 380 # endif 375 381 typedef unsigned long __w64 long_u; 376 382 typedef long __w64 long_i; … … 1728 1734 #define VV_MOUSE_COL 51 1729 1735 #define VV_OP 52 1730 1736 #define VV_SEARCHFORWARD 53 1731 #define VV_LEN 54 /* number of v: vars */ 1737 #define VV_OLDFILES 54 1738 #define VV_LEN 55 /* number of v: vars */ 1732 1739 1733 1740 #ifdef FEAT_CLIPBOARD 1734 1741 … … 1979 1986 # endif 1980 1987 #endif 1981 1988 1989 #ifndef FEAT_NETBEANS_INTG 1990 # undef NBDEBUG 1991 #endif 1982 1992 #ifdef NBDEBUG /* Netbeans debugging. */ 1983 1993 # include "nbdebug.h" 1984 1994 #else … … 2054 2064 #define DOSO_VIMRC 1 /* loading vimrc file */ 2055 2065 #define DOSO_GVIMRC 2 /* loading gvimrc file */ 2056 2066 2067 /* flags for read_viminfo() and children */ 2068 #define VIF_WANT_INFO 1 /* load non-mark info */ 2069 #define VIF_WANT_MARKS 2 /* load file marks */ 2070 #define VIF_FORCEIT 4 /* overwrite info already read */ 2071 #define VIF_GET_OLDFILES 8 /* load v:oldfiles */ 2072 2057 2073 #endif /* VIM__H */ -
src/window.c
diff -Naur vim72.orig/src/window.c vim72/src/window.c
old new 4028 4028 if (mch_dirname(cwd, MAXPATHL) == OK) 4029 4029 globaldir = vim_strsave(cwd); 4030 4030 } 4031 mch_chdir((char *)curwin->w_localdir);4032 shorten_fnames(TRUE);4031 if (mch_chdir((char *)curwin->w_localdir) == 0) 4032 shorten_fnames(TRUE); 4033 4033 } 4034 4034 else if (globaldir != NULL) 4035 4035 { 4036 4036 /* Window doesn't have a local directory and we are not in the global 4037 4037 * directory: Change to the global directory. */ 4038 mch_chdir((char *)globaldir);4038 ignored = mch_chdir((char *)globaldir); 4039 4039 vim_free(globaldir); 4040 4040 globaldir = NULL; 4041 4041 shorten_fnames(TRUE); -
src/workshop.c
diff -Naur vim72.orig/src/workshop.c vim72/src/workshop.c
old new 1121 1121 ? (char *)curbuf->b_sfname : "<None>"); 1122 1122 #endif 1123 1123 1124 strcpy(ffname, (char *) curbuf->b_ffname); 1125 *filename = ffname; /* copy so nobody can change b_ffname */ 1124 if (curbuf->b_ffname == NULL) 1125 ffname[0] = NUL; 1126 else 1127 /* copy so nobody can change b_ffname */ 1128 strcpy(ffname, (char *) curbuf->b_ffname); 1129 *filename = ffname; 1126 1130 *curLine = curwin->w_cursor.lnum; 1127 1131 *curCol = curwin->w_cursor.col; 1128 1132
Note:
See TracBrowser
for help on using the repository browser.