source:
clfs-sysroot/patches/vim-7.2-branch_update-11.patch@
64d2ffa
Last change on this file since 64d2ffa was 2893698, checked in by , 16 years ago | |
---|---|
|
|
File size: 253.5 KB |
-
Filelist
Submitted By: Jim Gifford (jim at cross-lfs dot org) Date: 03-12-2009 Initial Package Version: 7.2 Origin: Upstream Upstream Status: Applied Description: Contains all upstream patches up to 7.2.141 The following patches were skipped 007 036 041 049 071 072 074 088 089 093 101 138 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/netbeans.txt
diff -Naur vim72.orig/runtime/doc/netbeans.txt vim72/runtime/doc/netbeans.txt
old new 1 *netbeans.txt* For Vim version 7.2. Last change: 200 8 Jun 281 *netbeans.txt* For Vim version 7.2. Last change: 2009 Jan 06 2 2 3 3 4 4 VIM REFERENCE MANUAL by Gordon Prieur et al. … … 722 722 of the cursor. 723 723 New in version 2.1. 724 724 725 killed A file was closed by the user. Only for files that have been 726 assigned a number by the IDE. 725 killed A file was deleted or wiped out by the user and the buffer 726 annotations have been removed. The bufID number for this 727 buffer has become invalid. Only for files that have been 728 assigned a bufID number by the IDE. 727 729 728 730 newDotAndMark off off 729 731 Reports the position of the cursor being at "off" bytes into -
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 … … 4175 4175 be able to execute Normal mode commands. 4176 4176 This is the opposite of the 'keymap' option, where characters are 4177 4177 mapped in Insert mode. 4178 This only works for 8-bit characters. The value of 'langmap' may be4179 specified with multi-byte characters (e.g., UTF-8), but only the lower4180 8 bits of each character will be used.4181 4178 4182 4179 Example (for Greek, in UTF-8): *greek* > 4183 4180 :set langmap=ÎA,ÎB,ΚC,ÎD,ÎE,ΊF,ÎG,ÎH,ÎI,ÎJ,ÎK,ÎL,ÎM,ÎN,ÎO,Î P,QQ,ΡR,ΣS,΀T,ÎU,ΩV,WW,ΧX,Î¥Y,ÎZ,αa,βb,Ïc,ÎŽd,εe,Ïf,γg,ηh,ιi,Οj,κk,λl,ÎŒm,Îœn,οo,Ïp,qq,Ïr,Ïs,Ït,Ξu,Ïv,Ïw,Ïx,Ï -
runtime/doc/spell.txt
y,ζz @@ -7472,7 +7469,9 @@ {not available when compiled without the |+wildignore| feature} A list of file patterns. A file that matches with one of these - patterns is ignored when completing file or directory names. + patterns is ignored when completing file or directory names, and + influences the result of |expand()|, |glob()| and |globpath()| unless + a flag is passed to disable this. The pattern is used like with |:autocmd|, see |autocmd-patterns|. Also see 'suffixes'. Example: > 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 11565 11565 11566 11566 fi 11567 11567 11568 { $as_echo "$as_me:$LINENO: checking for working volatile" >&5 11569 $as_echo_n "checking for working volatile... " >&6; } 11570 if test "${ac_cv_c_volatile+set}" = set; then 11571 $as_echo_n "(cached) " >&6 11572 else 11573 cat >conftest.$ac_ext <<_ACEOF 11574 /* confdefs.h. */ 11575 _ACEOF 11576 cat confdefs.h >>conftest.$ac_ext 11577 cat >>conftest.$ac_ext <<_ACEOF 11578 /* end confdefs.h. */ 11579 11580 int 11581 main () 11582 { 11583 11584 volatile int x; 11585 int * volatile y = (int *) 0; 11586 return !x && !y; 11587 ; 11588 return 0; 11589 } 11590 _ACEOF 11591 rm -f conftest.$ac_objext 11592 if { (ac_try="$ac_compile" 11593 case "(($ac_try" in 11594 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 11595 *) ac_try_echo=$ac_try;; 11596 esac 11597 eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" 11598 $as_echo "$ac_try_echo") >&5 11599 (eval "$ac_compile") 2>conftest.er1 11600 ac_status=$? 11601 grep -v '^ *+' conftest.er1 >conftest.err 11602 rm -f conftest.er1 11603 cat conftest.err >&5 11604 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 11605 (exit $ac_status); } && { 11606 test -z "$ac_c_werror_flag" || 11607 test ! -s conftest.err 11608 } && test -s conftest.$ac_objext; then 11609 ac_cv_c_volatile=yes 11610 else 11611 $as_echo "$as_me: failed program was:" >&5 11612 sed 's/^/| /' conftest.$ac_ext >&5 11613 11614 ac_cv_c_volatile=no 11615 fi 11616 11617 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 11618 fi 11619 { $as_echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5 11620 $as_echo "$ac_cv_c_volatile" >&6; } 11621 if test $ac_cv_c_volatile = no; then 11622 11623 cat >>confdefs.h <<\_ACEOF 11624 #define volatile /**/ 11625 _ACEOF 11626 11627 fi 11628 11568 11629 { $as_echo "$as_me:$LINENO: checking for mode_t" >&5 11569 11630 $as_echo_n "checking for mode_t... " >&6; } 11570 11631 if test "${ac_cv_type_mode_t+set}" = set; then … … 16819 16880 LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" 16820 16881 fi 16821 16882 16822 { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&516823 $as_echo_n "checking for GCC 3 or later... " >&6; }16824 16883 DEPEND_CFLAGS_FILTER= 16825 16884 if test "$GCC" = yes; then 16885 { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5 16886 $as_echo_n "checking for GCC 3 or later... " >&6; } 16826 16887 gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'` 16827 16888 if test "$gccmajor" -gt "2"; then 16828 16889 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" >&516890 { $as_echo "$as_me:$LINENO: result: yes" >&5 16891 $as_echo "yes" >&6; } 16892 else 16893 { $as_echo "$as_me:$LINENO: result: no" >&5 16833 16894 $as_echo "no" >&6; } 16834 else 16835 { $as_echo "$as_me:$LINENO: result: yes" >&5 16895 fi 16896 { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5 16897 $as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; } 16898 if test "$gccmajor" -gt "3"; then 16899 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1" 16900 { $as_echo "$as_me:$LINENO: result: yes" >&5 16836 16901 $as_echo "yes" >&6; } 16902 else 16903 { $as_echo "$as_me:$LINENO: result: no" >&5 16904 $as_echo "no" >&6; } 16905 fi 16837 16906 fi 16838 16907 16839 16908 -
src/buffer.c
diff -Naur vim72.orig/src/buffer.c vim72/src/buffer.c
old new 437 437 return; 438 438 #endif 439 439 440 #ifdef FEAT_NETBEANS_INTG441 if (usingNetbeans)442 netbeans_file_closed(buf);443 #endif444 440 /* Change directories when the 'acd' option is set. */ 445 441 DO_AUTOCHDIR 446 442 … … 639 635 #ifdef FEAT_SIGNS 640 636 buf_delete_signs(buf); /* delete any signs */ 641 637 #endif 638 #ifdef FEAT_NETBEANS_INTG 639 if (usingNetbeans) 640 netbeans_file_killed(buf); 641 #endif 642 642 #ifdef FEAT_LOCALMAP 643 643 map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */ 644 644 map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */ … … 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 /* … … 812 815 int bnr; /* buffer number */ 813 816 char_u *p; 814 817 815 #ifdef FEAT_NETBEANS_INTG816 netbeansCloseFile = 1;817 #endif818 818 if (addr_count == 0) 819 819 { 820 820 (void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit); … … 909 909 } 910 910 } 911 911 912 #ifdef FEAT_NETBEANS_INTG913 netbeansCloseFile = 0;914 #endif915 912 916 913 return errormsg; 917 914 } … … 1237 1234 * "buf" if one exists */ 1238 1235 if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf)) 1239 1236 return OK; 1240 /* If 'switchbuf' cont ians "usetab": jump to first window in any tab1237 /* If 'switchbuf' contains "usetab": jump to first window in any tab 1241 1238 * page containing "buf" if one exists */ 1242 1239 if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf)) 1243 1240 return OK; … … 1351 1348 } 1352 1349 } 1353 1350 #ifdef FEAT_AUTOCMD 1351 /* An autocommand may have deleted "buf", already entered it (e.g., when 1352 * it did ":bunload") or aborted the script processing! */ 1354 1353 # ifdef FEAT_EVAL 1355 /* An autocommand may have deleted buf or aborted the script processing! */ 1356 if (buf_valid(buf) && !aborting()) 1354 if (buf_valid(buf) && buf != curbuf && !aborting()) 1357 1355 # else 1358 if (buf_valid(buf) ) /* an autocommand may have deleted buf! */1356 if (buf_valid(buf) && buf != curbuf) 1359 1357 # endif 1360 1358 #endif 1361 1359 enter_buffer(buf); … … 1397 1395 curwin->w_cursor.coladd = 0; 1398 1396 #endif 1399 1397 curwin->w_set_curswant = TRUE; 1398 #ifdef FEAT_AUTOCMD 1399 curwin->w_topline_was_set = FALSE; 1400 #endif 1400 1401 1401 1402 /* Make sure the buffer is loaded. */ 1402 1403 if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */ … … 1436 1437 maketitle(); 1437 1438 #endif 1438 1439 #ifdef FEAT_AUTOCMD 1439 if (curwin->w_topline == 1) /* when autocmds didn't change it */ 1440 /* when autocmds didn't change it */ 1441 if (curwin->w_topline == 1 && !curwin->w_topline_was_set) 1440 1442 #endif 1441 1443 scroll_cursor_halfway(FALSE); /* redisplay at correct position */ 1442 1444 … … 3963 3965 width = vim_strsize(out); 3964 3966 if (maxwidth > 0 && width > maxwidth) 3965 3967 { 3966 /* Result is too long, must trunc tate somewhere. */3968 /* Result is too long, must truncate somewhere. */ 3967 3969 l = 0; 3968 3970 if (itemcnt == 0) 3969 3971 s = out; … … 5048 5050 */ 5049 5051 FOR_ALL_TAB_WINDOWS(tp, win) 5050 5052 if (win->w_buffer == buf) 5051 break; 5053 goto win_found; 5054 win_found: 5052 5055 if (win != NULL && win->w_llist_ref != NULL) 5053 5056 return _("[Location List]"); 5054 5057 else … … 5062 5065 { 5063 5066 if (buf->b_sfname != NULL) 5064 5067 return (char *)buf->b_sfname; 5065 return "[Scratch]";5068 return _("[Scratch]"); 5066 5069 } 5067 5070 #endif 5068 5071 if (buf->b_fname == NULL) -
src/config.h.in
diff -Naur vim72.orig/src/config.h.in vim72/src/config.h.in
old new 50 50 /* Define to empty if the keyword does not work. */ 51 51 #undef const 52 52 53 /* Define to empty if the keyword does not work. */ 54 #undef volatile 55 53 56 /* Define to `int' if <sys/types.h> doesn't define. */ 54 57 #undef mode_t 55 58 -
src/configure.in
diff -Naur vim72.orig/src/configure.in vim72/src/configure.in
old new 2148 2148 dnl Checks for typedefs, structures, and compiler characteristics. 2149 2149 AC_PROG_GCC_TRADITIONAL 2150 2150 AC_C_CONST 2151 AC_C_VOLATILE 2151 2152 AC_TYPE_MODE_T 2152 2153 AC_TYPE_OFF_T 2153 2154 AC_TYPE_PID_T … … 3152 3153 dnl But only when making dependencies, cproto and lint don't take "-isystem". 3153 3154 dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow 3154 3155 dnl the number before the version number. 3155 AC_MSG_CHECKING(for GCC 3 or later)3156 3156 DEPEND_CFLAGS_FILTER= 3157 3157 if test "$GCC" = yes; then 3158 AC_MSG_CHECKING(for GCC 3 or later) 3158 3159 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'` 3159 3160 if test "$gccmajor" -gt "2"; then 3160 3161 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'" 3162 AC_MSG_RESULT(yes) 3163 else 3164 AC_MSG_RESULT(no) 3165 fi 3166 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is 3167 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0. 3168 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1) 3169 if test "$gccmajor" -gt "3"; then 3170 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1" 3171 AC_MSG_RESULT(yes) 3172 else 3173 AC_MSG_RESULT(no) 3161 3174 fi 3162 fi3163 if test "$DEPEND_CFLAGS_FILTER" = ""; then3164 AC_MSG_RESULT(no)3165 else3166 AC_MSG_RESULT(yes)3167 3175 fi 3168 3176 AC_SUBST(DEPEND_CFLAGS_FILTER) 3169 3177 -
src/diff.c
diff -Naur vim72.orig/src/diff.c vim72/src/diff.c
old new 8 8 */ 9 9 10 10 /* 11 * diff.c: code for diff'ing two or threebuffers.11 * diff.c: code for diff'ing two, three or four buffers. 12 12 */ 13 13 14 14 #include "vim.h" … … 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 } … … 113 116 * Add a buffer to make diffs for. 114 117 * Call this when a new buffer is being edited in the current window where 115 118 * 'diff' is set. 116 * Marks the current buffer as being part of the diff and requir eing updating.119 * Marks the current buffer as being part of the diff and requiring updating. 117 120 * This must be done before any autocmd, because a command may use info 118 121 * about the screen contents. 119 122 */ … … 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) … … 914 929 goto theend; 915 930 916 931 #ifdef UNIX 917 /* Temporar aly chdir to /tmp, to avoid patching files in the current932 /* Temporarily chdir to /tmp, to avoid patching files in the current 918 933 * directory when the patch file contains more than one patch. When we 919 934 * have our own temp dir use that instead, it will be cleaned up when we 920 935 * exit (any .rej files created). Don't change directory if we can't … … 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 … … 1138 1153 1139 1154 for (wp = firstwin; wp != NULL; wp = wp->w_next) 1140 1155 { 1141 if (wp == curwin || eap->forceit)1156 if (wp == curwin || (eap->forceit && wp->w_p_diff)) 1142 1157 { 1143 1158 /* Set 'diff', 'scrollbind' off and 'wrap' on. */ 1144 1159 wp->w_p_diff = FALSE; … … 2114 2129 EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg); 2115 2130 return; 2116 2131 } 2132 if (buf == curbuf) 2133 return; /* nothing to do */ 2117 2134 idx_other = diff_buf_idx(buf); 2118 2135 if (idx_other == DB_COUNT) 2119 2136 { -
src/edit.c
diff -Naur vim72.orig/src/edit.c vim72/src/edit.c
old new 147 147 static int ins_compl_bs __ARGS((void)); 148 148 static void ins_compl_new_leader __ARGS((void)); 149 149 static void ins_compl_addleader __ARGS((int c)); 150 static int ins_compl_len __ARGS((void)); 150 151 static void ins_compl_restart __ARGS((void)); 151 152 static void ins_compl_set_original_text __ARGS((char_u *str)); 152 153 static void ins_compl_addfrommatch __ARGS((void)); … … 197 198 static void mb_replace_pop_ins __ARGS((int cc)); 198 199 #endif 199 200 static void replace_flush __ARGS((void)); 200 static void replace_do_bs __ARGS((void)); 201 static void replace_do_bs __ARGS((int limit_col)); 202 static int del_char_after_col __ARGS((int limit_col)); 201 203 #ifdef FEAT_CINDENT 202 204 static int cindent_on __ARGS((void)); 203 205 #endif … … 1933 1935 /* 1934 1936 * Backspace the cursor until the given column. Handles REPLACE and VREPLACE 1935 1937 * modes correctly. May also be used when not in insert mode at all. 1938 * Will attempt not to go before "col" even when there is a composing 1939 * character. 1936 1940 */ 1937 1941 void 1938 1942 backspace_until_column(col) … … 1942 1946 { 1943 1947 curwin->w_cursor.col--; 1944 1948 if (State & REPLACE_FLAG) 1945 replace_do_bs( );1946 else 1947 (void)del_char(FALSE);1949 replace_do_bs(col); 1950 else if (!del_char_after_col(col)) 1951 break; 1948 1952 } 1949 1953 } 1950 1954 #endif 1951 1955 1956 /* 1957 * Like del_char(), but make sure not to go before column "limit_col". 1958 * Only matters when there are composing characters. 1959 * Return TRUE when something was deleted. 1960 */ 1961 /*ARGSUSED*/ 1962 static int 1963 del_char_after_col(limit_col) 1964 int limit_col; 1965 { 1966 #ifdef FEAT_MBYTE 1967 if (enc_utf8 && limit_col >= 0) 1968 { 1969 int ecol = curwin->w_cursor.col + 1; 1970 1971 /* Make sure the cursor is at the start of a character, but 1972 * skip forward again when going too far back because of a 1973 * composing character. */ 1974 mb_adjust_cursor(); 1975 while (curwin->w_cursor.col < (colnr_T)limit_col) 1976 { 1977 int l = utf_ptr2len(ml_get_cursor()); 1978 1979 if (l == 0) /* end of line */ 1980 break; 1981 curwin->w_cursor.col += l; 1982 } 1983 if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol) 1984 return FALSE; 1985 del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE); 1986 } 1987 else 1988 #endif 1989 (void)del_char(FALSE); 1990 return TRUE; 1991 } 1992 1952 1993 #if defined(FEAT_INS_EXPAND) || defined(PROTO) 1953 1994 /* 1954 1995 * CTRL-X pressed in Insert mode. … … 2418 2459 { 2419 2460 had_match = (curwin->w_cursor.col > compl_col); 2420 2461 ins_compl_delete(); 2421 ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);2462 ins_bytes(compl_leader + ins_compl_len()); 2422 2463 ins_redraw(FALSE); 2423 2464 2424 2465 /* When the match isn't there (to avoid matching itself) remove it … … 2470 2511 *p = NUL; 2471 2512 had_match = (curwin->w_cursor.col > compl_col); 2472 2513 ins_compl_delete(); 2473 ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);2514 ins_bytes(compl_leader + ins_compl_len()); 2474 2515 ins_redraw(FALSE); 2475 2516 2476 2517 /* When the match isn't there (to avoid matching itself) remove it … … 3209 3250 { 3210 3251 ins_compl_del_pum(); 3211 3252 ins_compl_delete(); 3212 ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);3253 ins_bytes(compl_leader + ins_compl_len()); 3213 3254 compl_used_match = FALSE; 3214 3255 3215 3256 if (compl_started) … … 3264 3305 } 3265 3306 3266 3307 /* 3308 * Return the length of the completion, from the completion start column to 3309 * the cursor column. Making sure it never goes below zero. 3310 */ 3311 static int 3312 ins_compl_len() 3313 { 3314 int off = curwin->w_cursor.col - compl_col; 3315 3316 if (off < 0) 3317 return 0; 3318 return off; 3319 } 3320 3321 /* 3267 3322 * Append one character to the match leader. May reduce the number of 3268 3323 * matches. 3269 3324 */ … … 3621 3676 { 3622 3677 ins_compl_delete(); 3623 3678 if (compl_leader != NULL) 3624 ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);3679 ins_bytes(compl_leader + ins_compl_len()); 3625 3680 else if (compl_first_match != NULL) 3626 ins_bytes(compl_orig_text 3627 + curwin->w_cursor.col - compl_col); 3681 ins_bytes(compl_orig_text + ins_compl_len()); 3628 3682 retval = TRUE; 3629 3683 } 3630 3684 … … 4187 4241 } 4188 4242 4189 4243 /* check if compl_curr_match has changed, (e.g. other type of 4190 * expansion added some nthing) */4244 * expansion added something) */ 4191 4245 if (type != 0 && compl_curr_match != old_match) 4192 4246 found_new_match = OK; 4193 4247 … … 4256 4310 static void 4257 4311 ins_compl_insert() 4258 4312 { 4259 ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col);4313 ins_bytes(compl_shown_match->cp_str + ins_compl_len()); 4260 4314 if (compl_shown_match->cp_flags & ORIGINAL_TEXT) 4261 4315 compl_used_match = FALSE; 4262 4316 else … … 4425 4479 if (!compl_get_longest || compl_used_match) 4426 4480 ins_compl_insert(); 4427 4481 else 4428 ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);4482 ins_bytes(compl_leader + ins_compl_len()); 4429 4483 } 4430 4484 else 4431 4485 compl_used_match = FALSE; … … 4688 4742 } 4689 4743 compl_length = curwin->w_cursor.col - (int)compl_col; 4690 4744 /* IObuff is used to add a "word from the next line" would we 4691 * have enough space? just being paranoi c*/4745 * have enough space? just being paranoid */ 4692 4746 #define MIN_SPACE 75 4693 4747 if (compl_length > (IOSIZE - MIN_SPACE)) 4694 4748 { … … 7123 7177 * cc == 0: character was inserted, delete it 7124 7178 * cc > 0: character was replaced, put cc (first byte of original char) back 7125 7179 * and check for more characters to be put back 7180 * When "limit_col" is >= 0, don't delete before this column. Matters when 7181 * using composing characters, use del_char_after_col() instead of del_char(). 7126 7182 */ 7127 7183 static void 7128 replace_do_bs() 7184 replace_do_bs(limit_col) 7185 int limit_col; 7129 7186 { 7130 7187 int cc; 7131 7188 #ifdef FEAT_VREPLACE … … 7153 7210 #ifdef FEAT_MBYTE 7154 7211 if (has_mbyte) 7155 7212 { 7156 del_char(FALSE);7213 (void)del_char_after_col(limit_col); 7157 7214 # ifdef FEAT_VREPLACE 7158 7215 if (State & VREPLACE_FLAG) 7159 7216 orig_len = (int)STRLEN(ml_get_cursor()); … … 7203 7260 changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col); 7204 7261 } 7205 7262 else if (cc == 0) 7206 (void)del_char (FALSE);7263 (void)del_char_after_col(limit_col); 7207 7264 } 7208 7265 7209 7266 #ifdef FEAT_CINDENT … … 7646 7703 */ 7647 7704 ++no_mapping; 7648 7705 regname = plain_vgetc(); 7649 #ifdef FEAT_LANGMAP7650 7706 LANGMAP_ADJUST(regname, TRUE); 7651 #endif7652 7707 if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P) 7653 7708 { 7654 7709 /* Get a third key for literal register insertion */ … … 7657 7712 add_to_showcmd_c(literally); 7658 7713 #endif 7659 7714 regname = plain_vgetc(); 7660 #ifdef FEAT_LANGMAP7661 7715 LANGMAP_ADJUST(regname, TRUE); 7662 #endif7663 7716 } 7664 7717 --no_mapping; 7665 7718 … … 8150 8203 /* 8151 8204 * If the cursor is on an indent, ^T/^D insert/delete one 8152 8205 * shiftwidth. Otherwise ^T/^D behave like a "<<" or ">>". 8153 * Always round the indent to 'shiftwi th', this is compatible8206 * Always round the indent to 'shiftwidth', this is compatible 8154 8207 * with vi. But vi only supports ^T and ^D after an 8155 8208 * autoindent, we support it everywhere. 8156 8209 */ … … 8239 8292 * Replace mode */ 8240 8293 if (curwin->w_cursor.lnum != Insstart.lnum 8241 8294 || curwin->w_cursor.col >= Insstart.col) 8242 replace_do_bs( );8295 replace_do_bs(-1); 8243 8296 } 8244 8297 else 8245 8298 (void)del_char(FALSE); … … 8556 8609 break; 8557 8610 } 8558 8611 if (State & REPLACE_FLAG) 8559 replace_do_bs( );8612 replace_do_bs(-1); 8560 8613 else 8561 8614 { 8562 8615 #ifdef FEAT_MBYTE -
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) … … 3902 3928 3903 3929 /* 3904 3930 * Handle top level expression: 3905 * expr 1 ? expr0 : expr03931 * expr2 ? expr1 : expr1 3906 3932 * 3907 3933 * "arg" must point to the first non-white of the expression. 3908 3934 * "arg" is advanced to the next non-white after the recognized expression. … … 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}, … … 7856 7918 else if (!aborting()) 7857 7919 { 7858 7920 if (argcount == MAX_FUNC_ARGS) 7859 emsg_funcname( "E740: Too many arguments for function %s", name);7921 emsg_funcname(N_("E740: Too many arguments for function %s"), name); 7860 7922 else 7861 emsg_funcname( "E116: Invalid arguments for function %s", name);7923 emsg_funcname(N_("E116: Invalid arguments for function %s"), name); 7862 7924 } 7863 7925 7864 7926 while (--argcount >= 0) … … 8091 8153 8092 8154 /* 8093 8155 * Give an error message with a function name. Handle <SNR> things. 8156 * "ermsg" is to be passed without translation, use N_() instead of _(). 8094 8157 */ 8095 8158 static void 8096 8159 emsg_funcname(ermsg, name) … … 9518 9581 else 9519 9582 { 9520 9583 /* When the optional second argument is non-zero, don't remove matches 9521 * for ' suffixes' and 'wildignore'*/9584 * for 'wildignore' and don't put matches for 'suffixes' at the end. */ 9522 9585 if (argvars[1].v_type != VAR_UNKNOWN 9523 9586 && get_tv_number_chk(&argvars[1], &error)) 9524 9587 flags |= WILD_KEEP_ALL; … … 10300 10363 s = get_tv_string(&argvars[0]); 10301 10364 if (s == NULL || *s == NUL || VIM_ISDIGIT(*s)) 10302 10365 EMSG2(_(e_invarg2), s); 10303 else if (!function_exists(s)) 10366 /* Don't check an autoload name for existence here. */ 10367 else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s)) 10304 10368 EMSG2(_("E700: Unknown function: %s"), s); 10305 10369 else 10306 10370 { … … 10602 10666 # ifdef FEAT_WINDOWS 10603 10667 win_T *wp; 10604 10668 # endif 10605 int n= 1;10669 int winnr = 1; 10606 10670 10607 10671 if (row >= 0 && col >= 0) 10608 10672 { … … 10612 10676 (void)mouse_comp_pos(win, &row, &col, &lnum); 10613 10677 # ifdef FEAT_WINDOWS 10614 10678 for (wp = firstwin; wp != win; wp = wp->w_next) 10615 ++ n;10679 ++winnr; 10616 10680 # endif 10617 vimvars[VV_MOUSE_WIN].vv_nr = n;10681 vimvars[VV_MOUSE_WIN].vv_nr = winnr; 10618 10682 vimvars[VV_MOUSE_LNUM].vv_nr = lnum; 10619 10683 vimvars[VV_MOUSE_COL].vv_nr = col + 1; 10620 10684 } … … 11284 11348 typval_T *argvars; 11285 11349 typval_T *rettv; 11286 11350 { 11351 int flags = WILD_SILENT|WILD_USE_NL; 11287 11352 expand_T xpc; 11353 int error = FALSE; 11288 11354 11289 ExpandInit(&xpc); 11290 xpc.xp_context = EXPAND_FILES; 11355 /* When the optional second argument is non-zero, don't remove matches 11356 * for 'wildignore' and don't put matches for 'suffixes' at the end. */ 11357 if (argvars[1].v_type != VAR_UNKNOWN 11358 && get_tv_number_chk(&argvars[1], &error)) 11359 flags |= WILD_KEEP_ALL; 11291 11360 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); 11361 if (!error) 11362 { 11363 ExpandInit(&xpc); 11364 xpc.xp_context = EXPAND_FILES; 11365 rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]), 11366 NULL, flags, WILD_ALL); 11367 } 11368 else 11369 rettv->vval.v_string = NULL; 11294 11370 } 11295 11371 11296 11372 /* … … 11301 11377 typval_T *argvars; 11302 11378 typval_T *rettv; 11303 11379 { 11380 int flags = 0; 11304 11381 char_u buf1[NUMBUFLEN]; 11305 11382 char_u *file = get_tv_string_buf_chk(&argvars[1], buf1); 11383 int error = FALSE; 11306 11384 11385 /* When the optional second argument is non-zero, don't remove matches 11386 * for 'wildignore' and don't put matches for 'suffixes' at the end. */ 11387 if (argvars[2].v_type != VAR_UNKNOWN 11388 && get_tv_number_chk(&argvars[2], &error)) 11389 flags |= WILD_KEEP_ALL; 11307 11390 rettv->v_type = VAR_STRING; 11308 if (file == NULL )11391 if (file == NULL || error) 11309 11392 rettv->vval.v_string = NULL; 11310 11393 else 11311 rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file); 11394 rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file, 11395 flags); 11312 11396 } 11313 11397 11314 11398 /* … … 11782 11866 n = has_patch(atoi((char *)name + 5)); 11783 11867 else if (STRICMP(name, "vim_starting") == 0) 11784 11868 n = (starting != 0); 11869 #ifdef FEAT_MBYTE 11870 else if (STRICMP(name, "multi_byte_encoding") == 0) 11871 n = has_mbyte; 11872 #endif 11785 11873 #if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32) 11786 11874 else if (STRICMP(name, "balloon_multiline") == 0) 11787 11875 n = multiline_balloon_available(); … … 15838 15926 if (res == FAIL) 15839 15927 res = ITEM_COMPARE_FAIL; 15840 15928 else 15841 /* return value has wrong type */15842 15929 res = get_tv_number_chk(&rettv, &item_compare_func_err); 15843 15930 if (item_compare_func_err) 15844 res = ITEM_COMPARE_FAIL; 15931 res = ITEM_COMPARE_FAIL; /* return value has wrong type */ 15845 15932 clear_tv(&rettv); 15846 15933 return res; 15847 15934 } … … 16590 16677 p = highlight_has_attr(id, HL_INVERSE, modec); 16591 16678 break; 16592 16679 16593 case 's': /* standout */ 16594 p = highlight_has_attr(id, HL_STANDOUT, modec); 16680 case 's': 16681 if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */ 16682 p = highlight_color(id, what, modec); 16683 else /* standout */ 16684 p = highlight_has_attr(id, HL_STANDOUT, modec); 16595 16685 break; 16596 16686 16597 16687 case 'u': … … 16658 16748 col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */ 16659 16749 16660 16750 if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count 16661 && col >= 0 && col < (long)STRLEN(ml_get(lnum))16751 && col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum))) 16662 16752 && rettv_list_alloc(rettv) != FAIL) 16663 16753 { 16664 16754 (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE); … … 18097 18187 } 18098 18188 18099 18189 /* 18100 * Set v:count, v:count1 and v:prevcount. 18190 * Get List v: variable value. Caller must take care of reference count when 18191 * needed. 18192 */ 18193 list_T * 18194 get_vim_var_list(idx) 18195 int idx; 18196 { 18197 return vimvars[idx].vv_list; 18198 } 18199 18200 /* 18201 * Set v:count to "count" and v:count1 to "count1". 18202 * When "set_prevcount" is TRUE first set v:prevcount from v:count. 18101 18203 */ 18102 18204 void 18103 set_vcount(count, count1 )18205 set_vcount(count, count1, set_prevcount) 18104 18206 long count; 18105 18207 long count1; 18208 int set_prevcount; 18106 18209 { 18107 vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr; 18210 if (set_prevcount) 18211 vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr; 18108 18212 vimvars[VV_COUNT].vv_nr = count; 18109 18213 vimvars[VV_COUNT1].vv_nr = count1; 18110 18214 } … … 18132 18236 } 18133 18237 18134 18238 /* 18239 * Set List v: variable to "val". 18240 */ 18241 void 18242 set_vim_var_list(idx, val) 18243 int idx; 18244 list_T *val; 18245 { 18246 list_unref(vimvars[idx].vv_list); 18247 vimvars[idx].vv_list = val; 18248 if (val != NULL) 18249 ++val->lv_refcount; 18250 } 18251 18252 /* 18135 18253 * Set v:register if needed. 18136 18254 */ 18137 18255 void … … 18868 18986 dictitem_T *dict_var; 18869 18987 { 18870 18988 hash_init(&dict->dv_hashtab); 18871 dict->dv_refcount = 99999;18989 dict->dv_refcount = DO_NOT_FREE_CNT; 18872 18990 dict_var->di_tv.vval.v_dict = dict; 18873 18991 dict_var->di_tv.v_type = VAR_DICT; 18874 18992 dict_var->di_tv.v_lock = VAR_FIXED; … … 19205 19323 * Copy the values from typval_T "from" to typval_T "to". 19206 19324 * When needed allocates string or increases reference count. 19207 19325 * Does not make a copy of a list or dict but copies the reference! 19326 * It is OK for "from" and "to" to point to the same item. This is used to 19327 * make a copy later. 19208 19328 */ 19209 19329 static void 19210 19330 copy_tv(from, to) … … 19748 19868 } 19749 19869 } 19750 19870 else 19751 emsg_funcname( "E123: Undefined function: %s", name);19871 emsg_funcname(N_("E123: Undefined function: %s"), name); 19752 19872 } 19753 19873 goto ret_free; 19754 19874 } … … 19792 19912 : eval_isnamec(arg[j]))) 19793 19913 ++j; 19794 19914 if (arg[j] != NUL) 19795 emsg_funcname( _(e_invarg2), arg);19915 emsg_funcname((char *)e_invarg2, arg); 19796 19916 } 19797 19917 } 19798 19918 … … 20064 20184 v = find_var(name, &ht); 20065 20185 if (v != NULL && v->di_tv.v_type == VAR_FUNC) 20066 20186 { 20067 emsg_funcname( "E707: Function name conflicts with variable: %s",20187 emsg_funcname(N_("E707: Function name conflicts with variable: %s"), 20068 20188 name); 20069 20189 goto erret; 20070 20190 } … … 20079 20199 } 20080 20200 if (fp->uf_calls > 0) 20081 20201 { 20082 emsg_funcname( "E127: Cannot redefine function %s: It is in use",20202 emsg_funcname(N_("E127: Cannot redefine function %s: It is in use"), 20083 20203 name); 20084 20204 goto erret; 20085 20205 } … … 20590 20710 int st_len = 0; 20591 20711 20592 20712 todo = (int)func_hashtab.ht_used; 20713 if (todo == 0) 20714 return; /* nothing to dump */ 20715 20593 20716 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo)); 20594 20717 20595 20718 for (hi = func_hashtab.ht_array; todo > 0; ++hi) … … 20638 20761 prof_self_cmp); 20639 20762 prof_sort_list(fd, sorttab, st_len, "SELF", TRUE); 20640 20763 } 20764 20765 vim_free(sorttab); 20641 20766 } 20642 20767 20643 20768 static void … … 21012 21137 char_u *save_sourcing_name; 21013 21138 linenr_T save_sourcing_lnum; 21014 21139 scid_T save_current_SID; 21015 funccall_T fc;21140 funccall_T *fc; 21016 21141 int save_did_emsg; 21017 21142 static int depth = 0; 21018 21143 dictitem_T *v; … … 21038 21163 21039 21164 line_breakcheck(); /* check for CTRL-C hit */ 21040 21165 21041 fc.caller = current_funccal; 21042 current_funccal = &fc; 21043 fc.func = fp; 21044 fc.rettv = rettv; 21166 fc = (funccall_T *)alloc(sizeof(funccall_T)); 21167 fc->caller = current_funccal; 21168 current_funccal = fc; 21169 fc->func = fp; 21170 fc->rettv = rettv; 21045 21171 rettv->vval.v_number = 0; 21046 fc .linenr = 0;21047 fc .returned = FALSE;21048 fc .level = ex_nesting_level;21172 fc->linenr = 0; 21173 fc->returned = FALSE; 21174 fc->level = ex_nesting_level; 21049 21175 /* 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;21176 fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0); 21177 fc->dbg_tick = debug_tick; 21052 21178 21053 21179 /* 21054 * Note about using fc .fixvar[]: This is an array of FIXVAR_CNT variables21180 * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables 21055 21181 * with names up to VAR_SHORT_LEN long. This avoids having to alloc/free 21056 21182 * each argument variable and saves a lot of time. 21057 21183 */ 21058 21184 /* 21059 21185 * Init l: variables. 21060 21186 */ 21061 init_var_dict(&fc .l_vars, &fc.l_vars_var);21187 init_var_dict(&fc->l_vars, &fc->l_vars_var); 21062 21188 if (selfdict != NULL) 21063 21189 { 21064 21190 /* Set l:self to "selfdict". Use "name" to avoid a warning from 21065 21191 * some compiler that checks the destination size. */ 21066 v = &fc .fixvar[fixvar_idx++].var;21192 v = &fc->fixvar[fixvar_idx++].var; 21067 21193 name = v->di_key; 21068 21194 STRCPY(name, "self"); 21069 21195 v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX; 21070 hash_add(&fc .l_vars.dv_hashtab, DI2HIKEY(v));21196 hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v)); 21071 21197 v->di_tv.v_type = VAR_DICT; 21072 21198 v->di_tv.v_lock = 0; 21073 21199 v->di_tv.vval.v_dict = selfdict; … … 21079 21205 * Set a:0 to "argcount". 21080 21206 * Set a:000 to a list with room for the "..." arguments. 21081 21207 */ 21082 init_var_dict(&fc .l_avars, &fc.l_avars_var);21083 add_nr_var(&fc .l_avars, &fc.fixvar[fixvar_idx++].var, "0",21208 init_var_dict(&fc->l_avars, &fc->l_avars_var); 21209 add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0", 21084 21210 (varnumber_T)(argcount - fp->uf_args.ga_len)); 21085 v = &fc.fixvar[fixvar_idx++].var; 21086 STRCPY(v->di_key, "000"); 21211 /* Use "name" to avoid a warning from some compiler that checks the 21212 * destination size. */ 21213 v = &fc->fixvar[fixvar_idx++].var; 21214 name = v->di_key; 21215 STRCPY(name, "000"); 21087 21216 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; 21088 hash_add(&fc .l_avars.dv_hashtab, DI2HIKEY(v));21217 hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); 21089 21218 v->di_tv.v_type = VAR_LIST; 21090 21219 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;21220 v->di_tv.vval.v_list = &fc->l_varlist; 21221 vim_memset(&fc->l_varlist, 0, sizeof(list_T)); 21222 fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT; 21223 fc->l_varlist.lv_lock = VAR_FIXED; 21095 21224 21096 21225 /* 21097 21226 * Set a:firstline to "firstline" and a:lastline to "lastline". 21098 21227 * Set a:name to named arguments. 21099 21228 * Set a:N to the "..." arguments. 21100 21229 */ 21101 add_nr_var(&fc .l_avars, &fc.fixvar[fixvar_idx++].var, "firstline",21230 add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline", 21102 21231 (varnumber_T)firstline); 21103 add_nr_var(&fc .l_avars, &fc.fixvar[fixvar_idx++].var, "lastline",21232 add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline", 21104 21233 (varnumber_T)lastline); 21105 21234 for (i = 0; i < argcount; ++i) 21106 21235 { … … 21116 21245 } 21117 21246 if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN) 21118 21247 { 21119 v = &fc .fixvar[fixvar_idx++].var;21248 v = &fc->fixvar[fixvar_idx++].var; 21120 21249 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; 21121 21250 } 21122 21251 else … … 21128 21257 v->di_flags = DI_FLAGS_RO; 21129 21258 } 21130 21259 STRCPY(v->di_key, name); 21131 hash_add(&fc .l_avars.dv_hashtab, DI2HIKEY(v));21260 hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); 21132 21261 21133 21262 /* Note: the values are copied directly to avoid alloc/free. 21134 21263 * "argvars" must have VAR_FIXED for v_lock. */ … … 21137 21266 21138 21267 if (ai >= 0 && ai < MAX_FUNC_ARGS) 21139 21268 { 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;21269 list_append(&fc->l_varlist, &fc->l_listitems[ai]); 21270 fc->l_listitems[ai].li_tv = argvars[i]; 21271 fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED; 21143 21272 } 21144 21273 } 21145 21274 … … 21204 21333 if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL)) 21205 21334 func_do_profile(fp); 21206 21335 if (fp->uf_profiling 21207 || (fc.caller != NULL && &fc.caller->func->uf_profiling))21336 || (fc->caller != NULL && fc->caller->func->uf_profiling)) 21208 21337 { 21209 21338 ++fp->uf_tm_count; 21210 21339 profile_start(&call_start); … … 21220 21349 did_emsg = FALSE; 21221 21350 21222 21351 /* call do_cmdline() to execute the lines */ 21223 do_cmdline(NULL, get_func_line, (void *) &fc,21352 do_cmdline(NULL, get_func_line, (void *)fc, 21224 21353 DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); 21225 21354 21226 21355 --RedrawingDisabled; … … 21235 21364 21236 21365 #ifdef FEAT_PROFILE 21237 21366 if (do_profiling == PROF_YES && (fp->uf_profiling 21238 || (fc .caller != NULL && &fc.caller->func->uf_profiling)))21367 || (fc->caller != NULL && fc->caller->func->uf_profiling))) 21239 21368 { 21240 21369 profile_end(&call_start); 21241 21370 profile_sub_wait(&wait_start, &call_start); 21242 21371 profile_add(&fp->uf_tm_total, &call_start); 21243 21372 profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children); 21244 if (fc .caller != NULL && &fc.caller->func->uf_profiling)21373 if (fc->caller != NULL && fc->caller->func->uf_profiling) 21245 21374 { 21246 profile_add(&fc .caller->func->uf_tm_children, &call_start);21247 profile_add(&fc .caller->func->uf_tml_children, &call_start);21375 profile_add(&fc->caller->func->uf_tm_children, &call_start); 21376 profile_add(&fc->caller->func->uf_tml_children, &call_start); 21248 21377 } 21249 21378 } 21250 21379 #endif … … 21257 21386 21258 21387 if (aborting()) 21259 21388 smsg((char_u *)_("%s aborted"), sourcing_name); 21260 else if (fc .rettv->v_type == VAR_NUMBER)21389 else if (fc->rettv->v_type == VAR_NUMBER) 21261 21390 smsg((char_u *)_("%s returning #%ld"), sourcing_name, 21262 (long)fc .rettv->vval.v_number);21391 (long)fc->rettv->vval.v_number); 21263 21392 else 21264 21393 { 21265 21394 char_u buf[MSG_BUF_LEN]; … … 21270 21399 /* The value may be very long. Skip the middle part, so that we 21271 21400 * have some idea how it starts and ends. smsg() would always 21272 21401 * truncate it at the end. */ 21273 s = tv2string(fc .rettv, &tofree, numbuf2, 0);21402 s = tv2string(fc->rettv, &tofree, numbuf2, 0); 21274 21403 if (s != NULL) 21275 21404 { 21276 21405 trunc_string(s, buf, MSG_BUF_CLEN); … … 21306 21435 } 21307 21436 21308 21437 did_emsg |= save_did_emsg; 21309 current_funccal = fc.caller; 21438 current_funccal = fc->caller; 21439 --depth; 21310 21440 21311 /* The a: variables typevals were not allocated, only free the allocated 21312 * variables. */ 21313 vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE); 21441 /* if the a:000 list and the a: dict are not referenced we can free the 21442 * funccall_T and what's in it. */ 21443 if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT 21444 && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT 21445 && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT) 21446 { 21447 free_funccal(fc, FALSE); 21448 } 21449 else 21450 { 21451 hashitem_T *hi; 21452 listitem_T *li; 21453 int todo; 21314 21454 21315 vars_clear(&fc.l_vars.dv_hashtab); /* free all l: variables */ 21316 --depth; 21455 /* "fc" is still in use. This can happen when returning "a:000" or 21456 * assigning "l:" to a global variable. 21457 * Link "fc" in the list for garbage collection later. */ 21458 fc->caller = previous_funccal; 21459 previous_funccal = fc; 21460 21461 /* Make a copy of the a: variables, since we didn't do that above. */ 21462 todo = (int)fc->l_avars.dv_hashtab.ht_used; 21463 for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi) 21464 { 21465 if (!HASHITEM_EMPTY(hi)) 21466 { 21467 --todo; 21468 v = HI2DI(hi); 21469 copy_tv(&v->di_tv, &v->di_tv); 21470 } 21471 } 21472 21473 /* Make a copy of the a:000 items, since we didn't do that above. */ 21474 for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next) 21475 copy_tv(&li->li_tv, &li->li_tv); 21476 } 21477 } 21478 21479 /* 21480 * Return TRUE if items in "fc" do not have "copyID". That means they are not 21481 * referenced from anywhere. 21482 */ 21483 static int 21484 can_free_funccal(fc, copyID) 21485 funccall_T *fc; 21486 int copyID; 21487 { 21488 return (fc->l_varlist.lv_copyID != copyID 21489 && fc->l_vars.dv_copyID != copyID 21490 && fc->l_avars.dv_copyID != copyID); 21491 } 21492 21493 /* 21494 * Free "fc" and what it contains. 21495 */ 21496 static void 21497 free_funccal(fc, free_val) 21498 funccall_T *fc; 21499 int free_val; /* a: vars were allocated */ 21500 { 21501 listitem_T *li; 21502 21503 /* The a: variables typevals may not have been allocated, only free the 21504 * allocated variables. */ 21505 vars_clear_ext(&fc->l_avars.dv_hashtab, free_val); 21506 21507 /* free all l: variables */ 21508 vars_clear(&fc->l_vars.dv_hashtab); 21509 21510 /* Free the a:000 variables if they were allocated. */ 21511 if (free_val) 21512 for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next) 21513 clear_tv(&li->li_tv); 21514 21515 vim_free(fc); 21317 21516 } 21318 21517 21319 21518 /* … … 21886 22085 } 21887 22086 } 21888 22087 22088 /* 22089 * List v:oldfiles in a nice way. 22090 */ 22091 /*ARGSUSED*/ 22092 void 22093 ex_oldfiles(eap) 22094 exarg_T *eap; 22095 { 22096 list_T *l = vimvars[VV_OLDFILES].vv_list; 22097 listitem_T *li; 22098 int nr = 0; 22099 22100 if (l == NULL) 22101 msg((char_u *)_("No old files")); 22102 else 22103 { 22104 msg_start(); 22105 msg_scroll = TRUE; 22106 for (li = l->lv_first; li != NULL && !got_int; li = li->li_next) 22107 { 22108 msg_outnum((long)++nr); 22109 MSG_PUTS(": "); 22110 msg_outtrans(get_tv_string(&li->li_tv)); 22111 msg_putchar('\n'); 22112 out_flush(); /* output one line at a time */ 22113 ui_breakcheck(); 22114 } 22115 /* Assume "got_int" was set to truncate the listing. */ 22116 got_int = FALSE; 22117 22118 #ifdef FEAT_BROWSE_CMD 22119 if (cmdmod.browse) 22120 { 22121 quit_more = FALSE; 22122 nr = prompt_for_number(FALSE); 22123 msg_starthere(); 22124 if (nr > 0) 22125 { 22126 char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES), 22127 (long)nr); 22128 22129 if (p != NULL) 22130 { 22131 p = expand_env_save(p); 22132 eap->arg = p; 22133 eap->cmdidx = CMD_edit; 22134 cmdmod.browse = FALSE; 22135 do_exedit(eap, NULL); 22136 vim_free(p); 22137 } 22138 } 22139 } 22140 #endif 22141 } 22142 } 22143 21889 22144 #endif /* FEAT_EVAL */ 21890 22145 21891 22146 -
src/ex_cmds2.c
diff -Naur vim72.orig/src/ex_cmds2.c vim72/src/ex_cmds2.c
old new 2842 2842 linenr_T save_sourcing_lnum; 2843 2843 char_u *p; 2844 2844 char_u *fname_exp; 2845 char_u *firstline = NULL; 2845 2846 int retval = FAIL; 2846 2847 #ifdef FEAT_EVAL 2847 2848 scid_T save_current_SID; … … 2992 2993 2993 2994 cookie.level = ex_nesting_level; 2994 2995 #endif 2995 #ifdef FEAT_MBYTE2996 cookie.conv.vc_type = CONV_NONE; /* no conversion */2997 2998 /* Try reading the first few bytes to check for a UTF-8 BOM. */2999 {3000 char_u buf[3];3001 3002 if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)3003 == (size_t)33004 && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)3005 /* Found BOM, setup conversion and skip over it. */3006 convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);3007 else3008 /* No BOM found, rewind. */3009 fseek(cookie.fp, 0L, SEEK_SET);3010 }3011 #endif3012 2996 3013 2997 /* 3014 2998 * Keep the sourcing name/lnum, for recursive calls. … … 3018 3002 save_sourcing_lnum = sourcing_lnum; 3019 3003 sourcing_lnum = 0; 3020 3004 3005 #ifdef FEAT_MBYTE 3006 cookie.conv.vc_type = CONV_NONE; /* no conversion */ 3007 3008 /* Read the first line so we can check for a UTF-8 BOM. */ 3009 firstline = getsourceline(0, (void *)&cookie, 0); 3010 if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef 3011 && firstline[1] == 0xbb && firstline[2] == 0xbf) 3012 { 3013 /* Found BOM; setup conversion, skip over BOM and recode the line. */ 3014 convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc); 3015 p = string_convert(&cookie.conv, firstline + 3, NULL); 3016 if (p == NULL) 3017 p = vim_strsave(firstline + 3); 3018 if (p != NULL) 3019 { 3020 vim_free(firstline); 3021 firstline = p; 3022 } 3023 } 3024 #endif 3025 3021 3026 #ifdef STARTUPTIME 3022 3027 time_push(&tv_rel, &tv_start); 3023 3028 #endif … … 3111 3116 /* 3112 3117 * Call do_cmdline, which will call getsourceline() to get the lines. 3113 3118 */ 3114 do_cmdline( NULL, getsourceline, (void *)&cookie,3119 do_cmdline(firstline, getsourceline, (void *)&cookie, 3115 3120 DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT); 3116 3117 3121 retval = OK; 3118 3122 3119 3123 #ifdef FEAT_PROFILE … … 3145 3149 verbose_leave(); 3146 3150 } 3147 3151 #ifdef STARTUPTIME 3148 vim_snprintf( IObuff, IOSIZE, "sourcing %s", fname);3149 time_msg( IObuff, &tv_start);3152 vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname); 3153 time_msg((char *)IObuff, &tv_start); 3150 3154 time_pop(&tv_rel); 3151 3155 #endif 3152 3156 … … 3171 3175 #endif 3172 3176 fclose(cookie.fp); 3173 3177 vim_free(cookie.nextline); 3178 vim_free(firstline); 3174 3179 #ifdef FEAT_MBYTE 3175 3180 convert_setup(&cookie.conv, NULL, NULL); 3176 3181 #endif -
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 … … 49 49 exarg_T *eap; 50 50 { 51 51 int c; 52 int cval; 52 53 char buf1[20]; 53 54 char buf2[20]; 54 55 char_u buf3[7]; … … 75 76 { 76 77 if (c == NL) /* NUL is stored as NL */ 77 78 c = NUL; 79 if (c == CAR && get_fileformat(curbuf) == EOL_MAC) 80 cval = NL; /* NL is stored as CR */ 81 else 82 cval = c; 78 83 if (vim_isprintc_strict(c) && (c < ' ' 79 84 #ifndef EBCDIC 80 85 || c > '~' … … 94 99 buf2[0] = NUL; 95 100 vim_snprintf((char *)IObuff, IOSIZE, 96 101 _("<%s>%s%s %d, Hex %02x, Octal %03o"), 97 transchar(c), buf1, buf2, c, c, c);102 transchar(c), buf1, buf2, cval, cval, cval); 98 103 #ifdef FEAT_MBYTE 99 104 if (enc_utf8) 100 105 c = cc[ci++]; … … 1676 1681 1677 1682 /* 1678 1683 * read_viminfo() -- Read the viminfo file. Registers etc. which are already 1679 * set are not over-written unless force is TRUE. -- webb1684 * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb 1680 1685 */ 1681 1686 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; 1687 read_viminfo(file, flags) 1688 char_u *file; /* file name or NULL to use default name */ 1689 int flags; /* VIF_WANT_INFO et al. */ 1687 1690 { 1688 1691 FILE *fp; 1689 1692 char_u *fname; … … 1691 1694 if (no_viminfo()) 1692 1695 return FAIL; 1693 1696 1694 fname = viminfo_filename(file); /* may set to default if NULL*/1697 fname = viminfo_filename(file); /* get file name in allocated buffer */ 1695 1698 if (fname == NULL) 1696 1699 return FAIL; 1697 1700 fp = mch_fopen((char *)fname, READBIN); … … 1701 1704 verbose_enter(); 1702 1705 smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"), 1703 1706 fname, 1704 want_info ? _(" info") : "", 1705 want_marks ? _(" marks") : "", 1707 (flags & VIF_WANT_INFO) ? _(" info") : "", 1708 (flags & VIF_WANT_MARKS) ? _(" marks") : "", 1709 (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "", 1706 1710 fp == NULL ? _(" FAILED") : ""); 1707 1711 verbose_leave(); 1708 1712 } … … 1712 1716 return FAIL; 1713 1717 1714 1718 viminfo_errcnt = 0; 1715 do_viminfo(fp, NULL, want_info, want_marks, forceit);1719 do_viminfo(fp, NULL, flags); 1716 1720 1717 1721 fclose(fp); 1718 1719 1722 return OK; 1720 1723 } 1721 1724 … … 1943 1946 * root. 1944 1947 */ 1945 1948 if (fp_out != NULL) 1946 (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);1949 ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid); 1947 1950 #endif 1948 1951 } 1949 1952 } … … 1968 1971 } 1969 1972 1970 1973 viminfo_errcnt = 0; 1971 do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);1974 do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS)); 1972 1975 1973 1976 fclose(fp_out); /* errors are ignored !? */ 1974 1977 if (fp_in != NULL) … … 2041 2044 * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo(). 2042 2045 */ 2043 2046 static void 2044 do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)2047 do_viminfo(fp_in, fp_out, flags) 2045 2048 FILE *fp_in; 2046 2049 FILE *fp_out; 2047 int want_info; 2048 int want_marks; 2049 int force_read; 2050 int flags; 2050 2051 { 2051 2052 int count = 0; 2052 2053 int eof = FALSE; … … 2061 2062 2062 2063 if (fp_in != NULL) 2063 2064 { 2064 if (want_info) 2065 eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL); 2065 if (flags & VIF_WANT_INFO) 2066 eof = read_viminfo_up_to_marks(&vir, 2067 flags & VIF_FORCEIT, fp_out != NULL); 2066 2068 else 2067 2069 /* Skip info, find start of marks */ 2068 2070 while (!(eof = viminfo_readline(&vir)) … … 2092 2094 write_viminfo_bufferlist(fp_out); 2093 2095 count = write_viminfo_marks(fp_out); 2094 2096 } 2095 if (fp_in != NULL && want_marks) 2096 copy_viminfo_marks(&vir, fp_out, count, eof); 2097 if (fp_in != NULL 2098 && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT))) 2099 copy_viminfo_marks(&vir, fp_out, count, eof, flags); 2097 2100 2098 2101 vim_free(vir.vir_line); 2099 2102 #ifdef FEAT_MBYTE … … 2414 2417 cursor_on(); /* msg_start() switches it off */ 2415 2418 out_flush(); 2416 2419 silent_mode = save_silent; 2417 info_message = FALSE;2418 2420 } 2421 info_message = FALSE; 2419 2422 } 2420 2423 2421 2424 /* … … 2704 2707 if (eap->cmdidx == CMD_saveas) 2705 2708 { 2706 2709 if (retval == OK) 2710 { 2707 2711 curbuf->b_p_ro = FALSE; 2712 #ifdef FEAT_WINDOWS 2713 redraw_tabline = TRUE; 2714 #endif 2715 } 2708 2716 /* Change directories when the 'acd' option is set. */ 2709 2717 DO_AUTOCHDIR 2710 2718 } … … 5059 5067 5060 5068 if (did_sub) 5061 5069 ++sub_nlines; 5070 vim_free(new_start); /* for when substitute was cancelled */ 5062 5071 vim_free(sub_firstline); /* free the copy of the original line */ 5063 5072 sub_firstline = NULL; 5064 5073 } … … 6520 6529 static int last_sign_typenr = MAX_TYPENR; /* is decremented */ 6521 6530 6522 6531 static void sign_list_defined __ARGS((sign_T *sp)); 6532 static void sign_undefine __ARGS((sign_T *sp, sign_T *sp_prev)); 6523 6533 6524 6534 /* 6525 6535 * ":sign" command … … 6728 6738 /* ":sign list {name}" */ 6729 6739 sign_list_defined(sp); 6730 6740 else 6731 {6732 6741 /* ":sign undefine {name}" */ 6733 vim_free(sp->sn_name); 6734 vim_free(sp->sn_icon); 6735 #ifdef FEAT_SIGN_ICONS 6736 if (sp->sn_image != NULL) 6737 { 6738 out_flush(); 6739 gui_mch_destroy_sign(sp->sn_image); 6740 } 6741 #endif 6742 vim_free(sp->sn_text); 6743 if (sp_prev == NULL) 6744 first_sign = sp->sn_next; 6745 else 6746 sp_prev->sn_next = sp->sn_next; 6747 vim_free(sp); 6748 } 6742 sign_undefine(sp, sp_prev); 6749 6743 } 6750 6744 } 6751 6745 else … … 6994 6988 } 6995 6989 6996 6990 /* 6991 * Undefine a sign and free its memory. 6992 */ 6993 static void 6994 sign_undefine(sp, sp_prev) 6995 sign_T *sp; 6996 sign_T *sp_prev; 6997 { 6998 vim_free(sp->sn_name); 6999 vim_free(sp->sn_icon); 7000 #ifdef FEAT_SIGN_ICONS 7001 if (sp->sn_image != NULL) 7002 { 7003 out_flush(); 7004 gui_mch_destroy_sign(sp->sn_image); 7005 } 7006 #endif 7007 vim_free(sp->sn_text); 7008 if (sp_prev == NULL) 7009 first_sign = sp->sn_next; 7010 else 7011 sp_prev->sn_next = sp->sn_next; 7012 vim_free(sp); 7013 } 7014 7015 /* 6997 7016 * Get highlighting attribute for sign "typenr". 6998 7017 * If "line" is TRUE: line highl, if FALSE: text highl. 6999 7018 */ … … 7067 7086 return (char_u *)_("[Deleted]"); 7068 7087 } 7069 7088 7089 #if defined(EXITFREE) || defined(PROTO) 7090 /* 7091 * Undefine/free all signs. 7092 */ 7093 void 7094 free_signs() 7095 { 7096 while (first_sign != NULL) 7097 sign_undefine(first_sign, NULL); 7098 } 7099 #endif 7100 7070 7101 #endif 7071 7102 7072 7103 #if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO) -
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_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: … … 5121 5124 } 5122 5125 5123 5126 vim_free(cmd->uc_rep); 5124 cmd->uc_rep = 0; 5127 cmd->uc_rep = NULL; 5128 #if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) 5129 vim_free(cmd->uc_compl_arg); 5130 cmd->uc_compl_arg = NULL; 5131 #endif 5125 5132 break; 5126 5133 } 5127 5134 … … 5479 5486 return OK; 5480 5487 } 5481 5488 5489 /* 5490 * ":command ..." 5491 */ 5482 5492 static void 5483 5493 ex_command(eap) 5484 5494 exarg_T *eap; … … 5910 5920 char_u *q; 5911 5921 5912 5922 char_u *start; 5913 char_u *end; 5923 char_u *end = NULL; 5924 char_u *ksp; 5914 5925 size_t len, totlen; 5915 5926 5916 5927 size_t split_len = 0; … … 5927 5938 5928 5939 /* 5929 5940 * Replace <> in the command by the arguments. 5941 * First round: "buf" is NULL, compute length, allocate "buf". 5942 * Second round: copy result into "buf". 5930 5943 */ 5931 5944 buf = NULL; 5932 5945 for (;;) 5933 5946 { 5934 p = cmd->uc_rep; 5935 q = buf; 5947 p = cmd->uc_rep; /* source */ 5948 q = buf; /* destination */ 5936 5949 totlen = 0; 5937 while ((start = vim_strchr(p, '<')) != NULL 5938 && (end = vim_strchr(start + 1, '>')) != NULL)5950 5951 for (;;) 5939 5952 { 5953 start = vim_strchr(p, '<'); 5954 if (start != NULL) 5955 end = vim_strchr(start + 1, '>'); 5956 if (buf != NULL) 5957 { 5958 ksp = vim_strchr(p, K_SPECIAL); 5959 if (ksp != NULL && (start == NULL || ksp < start || end == NULL) 5960 && ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER) 5961 # ifdef FEAT_GUI 5962 || (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI) 5963 # endif 5964 )) 5965 { 5966 /* K_SPECIAL han been put in the buffer as K_SPECIAL 5967 * KS_SPECIAL KE_FILLER, like for mappings, but 5968 * do_cmdline() doesn't handle that, so convert it back. 5969 * Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */ 5970 len = ksp - p; 5971 if (len > 0) 5972 { 5973 mch_memmove(q, p, len); 5974 q += len; 5975 } 5976 *q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI; 5977 p = ksp + 3; 5978 continue; 5979 } 5980 } 5981 5982 /* break if there no <item> is found */ 5983 if (start == NULL || end == NULL) 5984 break; 5985 5940 5986 /* Include the '>' */ 5941 5987 ++end; 5942 5988 … … 7803 7849 { 7804 7850 vim_free(prev_dir); 7805 7851 prev_dir = NULL; 7852 7853 vim_free(globaldir); 7854 globaldir = NULL; 7806 7855 } 7807 7856 #endif 7808 7857 … … 7825 7874 else 7826 7875 #endif 7827 7876 { 7877 #ifdef FEAT_AUTOCMD 7878 if (allbuf_locked()) 7879 return; 7880 #endif 7828 7881 if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() 7829 7882 && !eap->forceit) 7830 7883 { … … 8749 8802 else if (*dirnow != NUL 8750 8803 && (ssop_flags & SSOP_CURDIR) && globaldir != NULL) 8751 8804 { 8752 (void)mch_chdir((char *)globaldir);8753 8805 if (mch_chdir((char *)globaldir) == 0) 8806 shorten_fnames(TRUE); 8754 8807 } 8755 8808 8756 8809 failed |= (makeopens(fd, dirnow) == FAIL); … … 9506 9559 break; 9507 9560 } 9508 9561 s = src + 1; 9562 if (*s == '<') /* "#<99" uses v:oldfiles */ 9563 ++s; 9509 9564 i = (int)getdigits(&s); 9510 9565 *usedlen = (int)(s - src); /* length of what we expand */ 9511 9566 9512 buf = buflist_findnr(i); 9513 if (buf == NULL) 9567 if (src[1] == '<') 9514 9568 { 9515 *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'"); 9569 if (*usedlen < 2) 9570 { 9571 /* Should we give an error message for #<text? */ 9572 *usedlen = 1; 9573 return NULL; 9574 } 9575 #ifdef FEAT_EVAL 9576 result = list_find_str(get_vim_var_list(VV_OLDFILES), 9577 (long)i); 9578 if (result == NULL) 9579 { 9580 *errormsg = (char_u *)""; 9581 return NULL; 9582 } 9583 #else 9584 *errormsg = (char_u *)_("E809: #< is not available without the +eval feature"); 9516 9585 return NULL; 9586 #endif 9517 9587 } 9518 if (lnump != NULL) 9519 *lnump = ECMD_LAST; 9520 if (buf->b_fname == NULL) 9588 else 9521 9589 { 9522 result = (char_u *)""; 9523 valid = 0; /* Must have ":p:h" to be valid */ 9590 buf = buflist_findnr(i); 9591 if (buf == NULL) 9592 { 9593 *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'"); 9594 return NULL; 9595 } 9596 if (lnump != NULL) 9597 *lnump = ECMD_LAST; 9598 if (buf->b_fname == NULL) 9599 { 9600 result = (char_u *)""; 9601 valid = 0; /* Must have ":p:h" to be valid */ 9602 } 9603 else 9604 result = buf->b_fname; 9524 9605 } 9525 else9526 result = buf->b_fname;9527 9606 break; 9528 9607 9529 9608 #ifdef FEAT_SEARCHPATH … … 9541 9620 #ifdef FEAT_AUTOCMD 9542 9621 case SPEC_AFILE: /* file name for autocommand */ 9543 9622 result = autocmd_fname; 9623 if (result != NULL && !autocmd_fname_full) 9624 { 9625 /* Still need to turn the fname into a full path. It is 9626 * postponed to avoid a delay when <afile> is not used. */ 9627 autocmd_fname_full = TRUE; 9628 result = FullName_save(autocmd_fname, FALSE); 9629 vim_free(autocmd_fname); 9630 autocmd_fname = result; 9631 } 9544 9632 if (result == NULL) 9545 9633 { 9546 9634 *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\""); … … 10067 10155 */ 10068 10156 if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL 10069 10157 || put_line(fd, "if file_readable(s:sx)") == FAIL 10070 || put_line(fd, " exe \"source \" . s:sx") == FAIL10158 || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL 10071 10159 || put_line(fd, "endif") == FAIL) 10072 10160 return FAIL; 10073 10161 … … 10689 10777 p_viminfo = (char_u *)"'100"; 10690 10778 if (eap->cmdidx == CMD_rviminfo) 10691 10779 { 10692 if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL) 10780 if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS 10781 | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL) 10693 10782 EMSG(_("E195: Cannot open viminfo file for reading")); 10694 10783 } 10695 10784 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) … … 1990 2000 1991 2001 #if defined(FEAT_AUTOCMD) || defined(PROTO) 1992 2002 /* 1993 * Check if "curbuf_lock" is set and return TRUE when it is and give an error1994 * message.2003 * Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is 2004 * and give an error message. 1995 2005 */ 1996 2006 int 1997 2007 curbuf_locked() … … 2001 2011 EMSG(_("E788: Not allowed to edit another buffer now")); 2002 2012 return TRUE; 2003 2013 } 2014 return allbuf_locked(); 2015 } 2016 2017 /* 2018 * Check if "allbuf_lock" is set and return TRUE when it is and give an error 2019 * message. 2020 */ 2021 int 2022 allbuf_locked() 2023 { 2024 if (allbuf_lock > 0) 2025 { 2026 EMSG(_("E811: Not allowed to change buffer information now")); 2027 return TRUE; 2028 } 2004 2029 return FALSE; 2005 2030 } 2006 2031 #endif … … 2508 2533 } 2509 2534 mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1); 2510 2535 vim_free(p); 2536 2537 if (ccline.xpc != NULL 2538 && ccline.xpc->xp_pattern != NULL 2539 && ccline.xpc->xp_context != EXPAND_NOTHING 2540 && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) 2541 { 2542 int i = (int)(ccline.xpc->xp_pattern - p); 2543 2544 /* If xp_pattern points inside the old cmdbuff it needs to be adjusted 2545 * to point into the newly allocated memory. */ 2546 if (i >= 0 && i <= ccline.cmdlen) 2547 ccline.xpc->xp_pattern = ccline.cmdbuff + i; 2548 } 2549 2511 2550 return OK; 2512 2551 } 2513 2552 … … 2875 2914 prev_ccline = ccline; 2876 2915 ccline.cmdbuff = NULL; 2877 2916 ccline.cmdprompt = NULL; 2917 ccline.xpc = NULL; 2878 2918 } 2879 2919 2880 2920 /* … … 3582 3622 ExpandInit(xp) 3583 3623 expand_T *xp; 3584 3624 { 3625 xp->xp_pattern = NULL; 3585 3626 xp->xp_backslash = XP_BS_NONE; 3586 3627 #ifndef BACKSLASH_IN_FILENAME 3587 3628 xp->xp_shell = FALSE; … … 4871 4912 if (s == NULL) 4872 4913 return FAIL; 4873 4914 sprintf((char *)s, "%s/%s*.vim", dirname, pat); 4874 all = globpath(p_rtp, s );4915 all = globpath(p_rtp, s, 0); 4875 4916 vim_free(s); 4876 4917 if (all == NULL) 4877 4918 return FAIL; … … 4912 4953 * newlines. Returns NULL for an error or no matches. 4913 4954 */ 4914 4955 char_u * 4915 globpath(path, file )4956 globpath(path, file, expand_options) 4916 4957 char_u *path; 4917 4958 char_u *file; 4959 int expand_options; 4918 4960 { 4919 4961 expand_T xpc; 4920 4962 char_u *buf; … … 4943 4985 { 4944 4986 add_pathsep(buf); 4945 4987 STRCAT(buf, file); 4946 if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL4947 4988 if (ExpandFromContext(&xpc, buf, &num_p, &p, 4989 WILD_SILENT|expand_options) != FAIL && num_p > 0) 4948 4990 { 4949 ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT );4991 ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options); 4950 4992 for (len = 0, i = 0; i < num_p; ++i) 4951 4993 len += (int)STRLEN(p[i]) + 1; 4952 4994 … … 6020 6062 # endif 6021 6063 return K_IGNORE; 6022 6064 } 6023 cmdwin_type = ccline.cmdfirstc; 6024 if (cmdwin_type == NUL) 6025 cmdwin_type = '-'; 6065 cmdwin_type = get_cmdline_type(); 6026 6066 6027 6067 /* Create the command-line buffer empty. */ 6028 6068 (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE); … … 6046 6086 /* Showing the prompt may have set need_wait_return, reset it. */ 6047 6087 need_wait_return = FALSE; 6048 6088 6049 histtype = hist_char2type(c cline.cmdfirstc);6089 histtype = hist_char2type(cmdwin_type); 6050 6090 if (histtype == HIST_CMD || histtype == HIST_DEBUG) 6051 6091 { 6052 6092 if (p_wc == TAB) -
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 69 69 static int au_find_group __ARGS((char_u *name)); 70 70 71 71 # define AUGROUP_DEFAULT -1 /* default autocmd group */ 72 # define AUGROUP_ERROR -2 /* erro rnouseautocmd group */72 # define AUGROUP_ERROR -2 /* erroneous autocmd group */ 73 73 # define AUGROUP_ALL -3 /* all autocmd groups */ 74 74 #endif 75 75 … … 144 144 # endif 145 145 #endif 146 146 static int move_lines __ARGS((buf_T *frombuf, buf_T *tobuf)); 147 147 #ifdef FEAT_AUTOCMD 148 static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name"); 149 #endif 148 150 149 151 void 150 152 filemess(buf, name, s, attr) … … 295 297 int conv_restlen = 0; /* nr of bytes in conv_rest[] */ 296 298 #endif 297 299 300 #ifdef FEAT_AUTOCMD 301 /* Remember the initial values of curbuf, curbuf->b_ffname and 302 * curbuf->b_fname to detect whether they are altered as a result of 303 * executing nasty autocommands. Also check if "fname" and "sfname" 304 * point to one of these values. */ 305 buf_T *old_curbuf = curbuf; 306 char_u *old_b_ffname = curbuf->b_ffname; 307 char_u *old_b_fname = curbuf->b_fname; 308 int using_b_ffname = (fname == curbuf->b_ffname) 309 || (sfname == curbuf->b_ffname); 310 int using_b_fname = (fname == curbuf->b_fname) 311 || (sfname == curbuf->b_fname); 312 #endif 298 313 write_no_eol_lnum = 0; /* in case it was set by the previous read */ 299 314 300 315 /* … … 589 604 #ifdef FEAT_QUICKFIX 590 605 if (!bt_dontwrite(curbuf)) 591 606 #endif 607 { 592 608 check_need_swap(newfile); 609 #ifdef FEAT_AUTOCMD 610 /* SwapExists autocommand may mess things up */ 611 if (curbuf != old_curbuf 612 || (using_b_ffname 613 && (old_b_ffname != curbuf->b_ffname)) 614 || (using_b_fname 615 && (old_b_fname != curbuf->b_fname))) 616 { 617 EMSG(_(e_auchangedbuf)); 618 return FAIL; 619 } 620 #endif 621 } 593 622 if (dir_of_file_exists(fname)) 594 623 filemess(curbuf, sfname, (char_u *)_("[New File]"), 0); 595 624 else … … 668 697 #endif 669 698 { 670 699 check_need_swap(newfile); 700 #ifdef FEAT_AUTOCMD 701 if (!read_stdin && (curbuf != old_curbuf 702 || (using_b_ffname && (old_b_ffname != curbuf->b_ffname)) 703 || (using_b_fname && (old_b_fname != curbuf->b_fname)))) 704 { 705 EMSG(_(e_auchangedbuf)); 706 if (!read_buffer) 707 close(fd); 708 return FAIL; 709 } 710 #endif 671 711 #ifdef UNIX 672 712 /* Set swap file protection bits after creating it. */ 673 713 if (swap_mode > 0 && curbuf->b_ml.ml_mfp->mf_fname != NULL) … … 698 738 { 699 739 int m = msg_scroll; 700 740 int n = msg_scrolled; 701 buf_T *old_curbuf = curbuf;702 741 703 742 /* 704 743 * The file must be closed again, the autocommands may want to change … … 740 779 /* 741 780 * Don't allow the autocommands to change the current buffer. 742 781 * Try to re-open the file. 782 * 783 * Don't allow the autocommands to change the buffer name either 784 * (cd for example) if it invalidates fname or sfname. 743 785 */ 744 786 if (!read_stdin && (curbuf != old_curbuf 787 || (using_b_ffname && (old_b_ffname != curbuf->b_ffname)) 788 || (using_b_fname && (old_b_fname != curbuf->b_fname)) 745 789 || (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) < 0)) 746 790 { 747 791 --no_wait_return; … … 932 976 else 933 977 { 934 978 if (eap != NULL && eap->force_ff != 0) 979 { 935 980 fileformat = get_fileformat_force(curbuf, eap); 981 try_unix = try_dos = try_mac = FALSE; 982 } 936 983 else if (curbuf->b_p_bin) 937 984 fileformat = EOL_UNIX; /* binary: use Unix format */ 938 985 else if (*p_ffs == NUL) … … 2211 2258 { 2212 2259 /* Use stderr for stdin, makes shell commands work. */ 2213 2260 close(0); 2214 dup(2);2261 ignored = dup(2); 2215 2262 } 2216 2263 #endif 2217 2264 … … 2341 2388 STRCAT(IObuff, _("[CR missing]")); 2342 2389 c = TRUE; 2343 2390 } 2344 if (ff_error == EOL_MAC)2345 {2346 STRCAT(IObuff, _("[NL found]"));2347 c = TRUE;2348 }2349 2391 if (split) 2350 2392 { 2351 2393 STRCAT(IObuff, _("[long lines split]")); … … 2711 2753 { 2712 2754 if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0 2713 2755 && curbuf->b_ffname != NULL) 2714 read_viminfo(NULL, FALSE, TRUE, FALSE);2756 read_viminfo(NULL, VIF_WANT_MARKS); 2715 2757 2716 2758 /* Always set b_marks_read; needed when 'viminfo' is changed to include 2717 2759 * the ' parameter after opening a buffer. */ … … 3451 3493 { 3452 3494 # ifdef UNIX 3453 3495 # ifdef HAVE_FCHOWN 3454 fchown(fd, st_old.st_uid, st_old.st_gid);3496 ignored = fchown(fd, st_old.st_uid, st_old.st_gid); 3455 3497 # endif 3456 3498 if (mch_stat((char *)IObuff, &st) < 0 3457 3499 || st.st_uid != st_old.st_uid … … 4367 4409 || st.st_uid != st_old.st_uid 4368 4410 || st.st_gid != st_old.st_gid) 4369 4411 { 4370 fchown(fd, st_old.st_uid, st_old.st_gid);4412 ignored = fchown(fd, st_old.st_uid, st_old.st_gid); 4371 4413 if (perm >= 0) /* set permission again, may have changed */ 4372 4414 (void)mch_setperm(wfname, perm); 4373 4415 } … … 5246 5288 /* Convert with iconv(). */ 5247 5289 if (ip->bw_restlen > 0) 5248 5290 { 5291 char *fp; 5292 5249 5293 /* Need to concatenate the remainder of the previous call and 5250 5294 * the bytes of the current call. Use the end of the 5251 5295 * conversion buffer for this. */ 5252 5296 fromlen = len + ip->bw_restlen; 5253 from = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen; 5254 mch_memmove((void *)from, ip->bw_rest, (size_t)ip->bw_restlen); 5255 mch_memmove((void *)(from + ip->bw_restlen), buf, (size_t)len); 5297 fp = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen; 5298 mch_memmove(fp, ip->bw_rest, (size_t)ip->bw_restlen); 5299 mch_memmove(fp + ip->bw_restlen, buf, (size_t)len); 5300 from = fp; 5256 5301 tolen = ip->bw_conv_buflen - fromlen; 5257 5302 } 5258 5303 else … … 5550 5595 name = "ucs-4le"; /* FF FE 00 00 */ 5551 5596 len = 4; 5552 5597 } 5553 else if (flags == FIO_ALL || flags ==(FIO_UCS2 | FIO_ENDIAN_L))5598 else if (flags == (FIO_UCS2 | FIO_ENDIAN_L)) 5554 5599 name = "ucs-2le"; /* FF FE */ 5555 else if (flags == (FIO_UTF16 | FIO_ENDIAN_L)) 5600 else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L)) 5601 /* utf-16le is preferred, it also works for ucs-2le text */ 5556 5602 name = "utf-16le"; /* FF FE */ 5557 5603 } 5558 5604 else if (p[0] == 0xfe && p[1] == 0xff … … 6031 6077 { 6032 6078 tbuf[FGETS_SIZE - 2] = NUL; 6033 6079 #ifdef USE_CR 6034 fgets_cr((char *)tbuf, FGETS_SIZE, fp);6080 ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp); 6035 6081 #else 6036 fgets((char *)tbuf, FGETS_SIZE, fp);6082 ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp); 6037 6083 #endif 6038 6084 } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n'); 6039 6085 } … … 6107 6153 #ifdef HAVE_ACL 6108 6154 vim_acl_T acl; /* ACL from original file */ 6109 6155 #endif 6156 #if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME) 6157 int use_tmp_file = FALSE; 6158 #endif 6110 6159 6111 6160 /* 6112 * When the names are identical, there is nothing to do. 6161 * When the names are identical, there is nothing to do. When they refer 6162 * to the same file (ignoring case and slash/backslash differences) but 6163 * the file name differs we need to go through a temp file. 6113 6164 */ 6114 6165 if (fnamecmp(from, to) == 0) 6115 return 0; 6166 { 6167 #ifdef CASE_INSENSITIVE_FILENAME 6168 if (STRCMP(gettail(from), gettail(to)) != 0) 6169 use_tmp_file = TRUE; 6170 else 6171 #endif 6172 return 0; 6173 } 6116 6174 6117 6175 /* 6118 6176 * Fail if the "from" file doesn't exist. Avoids that "to" is deleted. … … 6120 6178 if (mch_stat((char *)from, &st) < 0) 6121 6179 return -1; 6122 6180 6181 #ifdef UNIX 6182 { 6183 struct stat st_to; 6184 6185 /* It's possible for the source and destination to be the same file. 6186 * This happens when "from" and "to" differ in case and are on a FAT32 6187 * filesystem. In that case go through a temp file name. */ 6188 if (mch_stat((char *)to, &st_to) >= 0 6189 && st.st_dev == st_to.st_dev 6190 && st.st_ino == st_to.st_ino) 6191 use_tmp_file = TRUE; 6192 } 6193 #endif 6194 6195 #if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME) 6196 if (use_tmp_file) 6197 { 6198 char tempname[MAXPATHL + 1]; 6199 6200 /* 6201 * Find a name that doesn't exist and is in the same directory. 6202 * Rename "from" to "tempname" and then rename "tempname" to "to". 6203 */ 6204 if (STRLEN(from) >= MAXPATHL - 5) 6205 return -1; 6206 STRCPY(tempname, from); 6207 for (n = 123; n < 99999; ++n) 6208 { 6209 sprintf((char *)gettail((char_u *)tempname), "%d", n); 6210 if (mch_stat(tempname, &st) < 0) 6211 { 6212 if (mch_rename((char *)from, tempname) == 0) 6213 { 6214 if (mch_rename(tempname, (char *)to) == 0) 6215 return 0; 6216 /* Strange, the second step failed. Try moving the 6217 * file back and return failure. */ 6218 mch_rename(tempname, (char *)from); 6219 return -1; 6220 } 6221 /* If it fails for one temp name it will most likely fail 6222 * for any temp name, give up. */ 6223 return -1; 6224 } 6225 } 6226 return -1; 6227 } 6228 #endif 6229 6123 6230 /* 6124 6231 * Delete the "to" file, this is required on some systems to make the 6125 6232 * mch_rename() work, on other systems it makes sure that we don't have … … 6260 6367 6261 6368 if (!stuff_empty() || global_busy || !typebuf_typed() 6262 6369 #ifdef FEAT_AUTOCMD 6263 || autocmd_busy || curbuf_lock > 0 6370 || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0 6264 6371 #endif 6265 6372 ) 6266 6373 need_check_timestamps = TRUE; /* check later */ … … 6462 6569 set_vim_var_string(VV_FCS_REASON, (char_u *)reason, -1); 6463 6570 set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", -1); 6464 6571 # endif 6572 ++allbuf_lock; 6465 6573 n = apply_autocmds(EVENT_FILECHANGEDSHELL, 6466 6574 buf->b_fname, buf->b_fname, FALSE, buf); 6575 --allbuf_lock; 6467 6576 busy = FALSE; 6468 6577 if (n) 6469 6578 { … … 8523 8632 char_u *save_sourcing_name; 8524 8633 linenr_T save_sourcing_lnum; 8525 8634 char_u *save_autocmd_fname; 8635 int save_autocmd_fname_full; 8526 8636 int save_autocmd_bufnr; 8527 8637 char_u *save_autocmd_match; 8528 8638 int save_autocmd_busy; … … 8601 8711 * Save the autocmd_* variables and info about the current buffer. 8602 8712 */ 8603 8713 save_autocmd_fname = autocmd_fname; 8714 save_autocmd_fname_full = autocmd_fname_full; 8604 8715 save_autocmd_bufnr = autocmd_bufnr; 8605 8716 save_autocmd_match = autocmd_match; 8606 8717 save_autocmd_busy = autocmd_busy; … … 8618 8729 if (fname != NULL && *fname != NUL) 8619 8730 autocmd_fname = fname; 8620 8731 else if (buf != NULL) 8621 autocmd_fname = buf->b_f name;8732 autocmd_fname = buf->b_ffname; 8622 8733 else 8623 8734 autocmd_fname = NULL; 8624 8735 } 8625 8736 else 8626 8737 autocmd_fname = fname_io; 8627 8738 if (autocmd_fname != NULL) 8628 autocmd_fname = FullName_save(autocmd_fname, FALSE); 8739 autocmd_fname = vim_strsave(autocmd_fname); 8740 autocmd_fname_full = FALSE; /* call FullName_save() later */ 8629 8741 8630 8742 /* 8631 8743 * Set the buffer number to be used for <abuf>. … … 8810 8922 sourcing_lnum = save_sourcing_lnum; 8811 8923 vim_free(autocmd_fname); 8812 8924 autocmd_fname = save_autocmd_fname; 8925 autocmd_fname_full = save_autocmd_fname_full; 8813 8926 autocmd_bufnr = save_autocmd_bufnr; 8814 8927 autocmd_match = save_autocmd_match; 8815 8928 #ifdef FEAT_EVAL … … 8918 9031 { 8919 9032 apc->curpat = NULL; 8920 9033 8921 /* only use a pattern when it has not been removed, has commands and9034 /* Only use a pattern when it has not been removed, has commands and 8922 9035 * the group matches. For buffer-local autocommands only check the 8923 9036 * buffer number. */ 8924 9037 if (ap->pat != NULL && ap->cmds != NULL … … 9104 9217 set_context_in_autocmd(xp, arg, doautocmd) 9105 9218 expand_T *xp; 9106 9219 char_u *arg; 9107 int doautocmd; /* TRUE for :doauto cmd, FALSE for :autocmd */9220 int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */ 9108 9221 { 9109 9222 char_u *p; 9110 9223 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)); … … 740 740 garray_T *found_ga; 741 741 fold_T *found_fp = NULL; 742 742 linenr_T found_off = 0; 743 int use_level = FALSE;743 int use_level; 744 744 int maybe_small = FALSE; 745 745 int level = 0; 746 746 linenr_T lnum = start; … … 757 757 gap = &curwin->w_folds; 758 758 found_ga = NULL; 759 759 lnum_off = 0; 760 use_level = FALSE; 760 761 for (;;) 761 762 { 762 763 if (!foldFind(gap, lnum - lnum_off, &fp)) … … 783 784 else 784 785 { 785 786 lnum = found_fp->fd_top + found_fp->fd_len + found_off; 786 did_one = TRUE;787 787 788 788 if (foldmethodIsManual(curwin)) 789 789 deleteFoldEntry(found_ga, 790 790 (int)(found_fp - (fold_T *)found_ga->ga_data), recursive); 791 791 else 792 792 { 793 if (f ound_fp->fd_top + found_off < first_lnum)794 first_lnum = found_fp->fd_top ;795 if (l num > last_lnum)793 if (first_lnum > found_fp->fd_top + found_off) 794 first_lnum = found_fp->fd_top + found_off; 795 if (last_lnum < lnum) 796 796 last_lnum = lnum; 797 parseMarker(curwin); 797 if (!did_one) 798 parseMarker(curwin); 798 799 deleteFoldMarkers(found_fp, recursive, found_off); 799 800 } 801 did_one = TRUE; 800 802 801 803 /* redraw window */ 802 804 changed_window_setting(); … … 811 813 redraw_curbuf_later(INVERTED); 812 814 #endif 813 815 } 816 else 817 /* Deleting markers may make cursor column invalid. */ 818 check_cursor_col(); 819 814 820 if (last_lnum > 0) 815 821 changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L); 816 822 } … … 1241 1247 * Repeat "count" times. 1242 1248 */ 1243 1249 static void 1244 setFoldRepeat(lnum, count, open)1250 setFoldRepeat(lnum, count, do_open) 1245 1251 linenr_T lnum; 1246 1252 long count; 1247 int open;1253 int do_open; 1248 1254 { 1249 1255 int done; 1250 1256 long n; … … 1252 1258 for (n = 0; n < count; ++n) 1253 1259 { 1254 1260 done = DONE_NOTHING; 1255 (void)setManualFold(lnum, open, FALSE, &done);1261 (void)setManualFold(lnum, do_open, FALSE, &done); 1256 1262 if (!(done & DONE_ACTION)) 1257 1263 { 1258 1264 /* 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 3816 3816 int len = 1; 3817 3817 3818 3818 if (msg_didout || msg_silent != 0) 3819 { 3819 3820 msg_putchar('\n'); 3821 if (got_int) /* 'q' typed at MORE prompt */ 3822 return; 3823 } 3820 3824 if ((mp->m_mode & (INSERT + CMDLINE)) == INSERT + CMDLINE) 3821 3825 msg_putchar('!'); /* :map! */ 3822 3826 else if (mp->m_mode & INSERT) … … 4702 4706 return FAIL; 4703 4707 if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0) 4704 4708 return FAIL; 4705 if (fp rintf(fd, cmd) < 0)4709 if (fputs(cmd, fd) < 0) 4706 4710 return FAIL; 4707 4711 if (buf != NULL && fputs(" <buffer>", fd) < 0) 4708 4712 return FAIL; … … 4801 4805 } 4802 4806 if (IS_SPECIAL(c) || modifiers) /* special key */ 4803 4807 { 4804 if (fp rintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)4808 if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0) 4805 4809 return FAIL; 4806 4810 continue; 4807 4811 } -
src/globals.h
diff -Naur vim72.orig/src/globals.h vim72/src/globals.h
old new 482 482 /* 483 483 * While executing external commands or in Ex mode, should not insert GUI 484 484 * events in the input buffer: Set hold_gui_events to non-zero. 485 * 486 * volatile because it is used in signal handler sig_sysmouse(). 485 487 */ 486 EXTERN inthold_gui_events INIT(= 0);488 EXTERN volatile int hold_gui_events INIT(= 0); 487 489 488 490 /* 489 491 * When resizing the shell is postponed, remember the new size, and call … … 597 599 EXTERN int really_exiting INIT(= FALSE); 598 600 /* TRUE when we are sure to exit, e.g., after 599 601 * a deadly signal */ 600 EXTERN int full_screen INIT(= FALSE); 602 /* volatile because it is used in signal handler deathtrap(). */ 603 EXTERN volatile int full_screen INIT(= FALSE); 601 604 /* TRUE when doing full-screen output 602 605 * otherwise only writing some messages */ 603 606 … … 616 619 EXTERN int curbuf_lock INIT(= 0); 617 620 /* non-zero when the current buffer can't be 618 621 * changed. Used for FileChangedRO. */ 622 EXTERN int allbuf_lock INIT(= 0); 623 /* non-zero when no buffer name can be 624 * changed, no buffer can be deleted and 625 * current directory can't be changed. 626 * Used for SwapExists et al. */ 619 627 #endif 620 628 #ifdef FEAT_EVAL 621 629 # define HAVE_SANDBOX … … 739 747 */ 740 748 EXTERN JMP_BUF lc_jump_env; /* argument to SETJMP() */ 741 749 # ifdef SIGHASARG 742 EXTERN int lc_signal; /* catched signal number, 0 when no was signal 743 catched; used for mch_libcall() */ 750 /* volatile because it is used in signal handlers. */ 751 EXTERN volatile int lc_signal; /* caught signal number, 0 when no was signal 752 caught; used for mch_libcall() */ 744 753 # endif 745 EXTERN int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */ 754 /* volatile because it is used in signal handler deathtrap(). */ 755 EXTERN volatile int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */ 746 756 #endif 747 757 748 758 #if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT) … … 986 996 EXTERN FILE *scriptout INIT(= NULL); /* stream to write script to */ 987 997 EXTERN int read_cmd_fd INIT(= 0); /* fd to read commands from */ 988 998 989 EXTERN int got_int INIT(= FALSE); /* set to TRUE when interrupt 999 /* volatile because it is used in signal handler catch_sigint(). */ 1000 EXTERN volatile int got_int INIT(= FALSE); /* set to TRUE when interrupt 990 1001 signal occurred */ 991 1002 #ifdef USE_TERM_CONSOLE 992 1003 EXTERN int term_console INIT(= FALSE); /* set to TRUE when console used */ … … 1022 1033 #endif 1023 1034 #ifdef FEAT_AUTOCMD 1024 1035 EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */ 1036 EXTERN int autocmd_fname_full; /* autocmd_fname is full path */ 1025 1037 EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */ 1026 1038 EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */ 1027 1039 EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */ … … 1339 1351 1340 1352 #ifdef FEAT_NETBEANS_INTG 1341 1353 EXTERN char *netbeansArg INIT(= NULL); /* the -nb[:host:port:passwd] arg */ 1342 EXTERN int netbeansCloseFile INIT(= 0); /* send killed if != 0 */1343 1354 EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */ 1344 1355 EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */ 1345 1356 EXTERN int netbeansReadFile INIT(= 1); /* OK to read from disk if != 0 */ … … 1548 1559 EXTERN time_t starttime; 1549 1560 1550 1561 /* 1562 * Some compilers warn for not using a return value, but in some situations we 1563 * can't do anything useful with the value. Assign to this variable to avoid 1564 * the warning. 1565 */ 1566 EXTERN int ignored; 1567 EXTERN char *ignoredp; 1568 1569 /* 1551 1570 * Optional Farsi support. Include it here, so EXTERN and INIT are defined. 1552 1571 */ 1553 1572 #ifdef FEAT_FKMAP -
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.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_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 1587 1587 XtCloseDisplay(gui.dpy); 1588 1588 gui.dpy = NULL; 1589 1589 vimShell = (Widget)0; 1590 vim_free(gui_argv); 1591 gui_argv = NULL; 1590 1592 } 1591 1593 1592 1594 /* … … 1761 1763 * says that this isn't needed when exiting, so just skip it. */ 1762 1764 XtCloseDisplay(gui.dpy); 1763 1765 #endif 1766 vim_free(gui_argv); 1767 gui_argv = NULL; 1764 1768 } 1765 1769 1766 1770 /* … … 2450 2454 *colorPtr = colortable[closest]; 2451 2455 } 2452 2456 2453 free(colortable);2457 vim_free(colortable); 2454 2458 return OK; 2455 2459 } 2456 2460 … … 3439 3443 char_u *signfile; 3440 3444 { 3441 3445 XpmAttributes attrs; 3442 XImage *sign ;3446 XImage *sign = NULL; 3443 3447 int status; 3444 3448 3445 3449 /* 3446 3450 * Setup the color substitution table. 3447 3451 */ 3448 sign = NULL;3449 3452 if (signfile[0] != NUL && signfile[0] != '-') 3450 3453 { 3451 sign = (XImage *)alloc(sizeof(XImage)); 3452 if (sign != NULL) 3454 XpmColorSymbol color[5] = 3453 3455 { 3454 XpmColorSymbol color[5] = 3455 { 3456 {"none", NULL, 0}, 3457 {"iconColor1", NULL, 0}, 3458 {"bottomShadowColor", NULL, 0}, 3459 {"topShadowColor", NULL, 0}, 3460 {"selectColor", NULL, 0} 3461 }; 3462 attrs.valuemask = XpmColorSymbols; 3463 attrs.numsymbols = 2; 3464 attrs.colorsymbols = color; 3465 attrs.colorsymbols[0].pixel = gui.back_pixel; 3466 attrs.colorsymbols[1].pixel = gui.norm_pixel; 3467 status = XpmReadFileToImage(gui.dpy, (char *)signfile, 3456 {"none", NULL, 0}, 3457 {"iconColor1", NULL, 0}, 3458 {"bottomShadowColor", NULL, 0}, 3459 {"topShadowColor", NULL, 0}, 3460 {"selectColor", NULL, 0} 3461 }; 3462 attrs.valuemask = XpmColorSymbols; 3463 attrs.numsymbols = 2; 3464 attrs.colorsymbols = color; 3465 attrs.colorsymbols[0].pixel = gui.back_pixel; 3466 attrs.colorsymbols[1].pixel = gui.norm_pixel; 3467 status = XpmReadFileToImage(gui.dpy, (char *)signfile, 3468 3468 &sign, NULL, &attrs); 3469 3470 if (status == 0) 3471 { 3472 /* Sign width is fixed at two columns now. 3473 if (sign->width > gui.sign_width) 3474 gui.sign_width = sign->width + 8; */ 3475 } 3476 else 3477 { 3478 vim_free(sign); 3479 sign = NULL; 3480 EMSG(_(e_signdata)); 3481 } 3469 if (status == 0) 3470 { 3471 /* Sign width is fixed at two columns now. 3472 if (sign->width > gui.sign_width) 3473 gui.sign_width = sign->width + 8; */ 3482 3474 } 3475 else 3476 EMSG(_(e_signdata)); 3483 3477 } 3484 3478 3485 3479 return (void *)sign; … … 3489 3483 gui_mch_destroy_sign(sign) 3490 3484 void *sign; 3491 3485 { 3492 XFree(((XImage *)sign)->data); 3493 vim_free(sign); 3486 XDestroyImage((XImage*)sign); 3494 3487 } 3495 3488 #endif 3496 3489 -
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, … … 1177 1177 (void)MSG_PUTS(_("cscope commands:\n")); 1178 1178 while (cmdp->name != NULL) 1179 1179 { 1180 (void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"), 1181 cmdp->name, _(cmdp->help), cmdp->usage); 1180 char *help = _(cmdp->help); 1181 int space_cnt = 30 - vim_strsize((char_u *)help); 1182 1183 /* Use %*s rather than %30s to ensure proper alignment in utf-8 */ 1184 if (space_cnt < 0) 1185 space_cnt = 0; 1186 (void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"), 1187 cmdp->name, 1188 help, space_cnt, " ", 1189 cmdp->usage); 1182 1190 if (strcmp(cmdp->name, "find") == 0) 1183 MSG_PUTS(FIND_HELP); 1191 MSG_PUTS(_("\n" 1192 " c: Find functions calling this function\n" 1193 " d: Find functions called by this function\n" 1194 " e: Find this egrep pattern\n" 1195 " f: Find this file\n" 1196 " g: Find this definition\n" 1197 " i: Find files #including this file\n" 1198 " s: Find this C symbol\n" 1199 " t: Find assignments to\n")); 1200 1184 1201 cmdp++; 1185 1202 } 1186 1203 -
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 … … 1145 1151 1146 1152 /* Check if we run into a recursive loop. The item must be in lookupDict 1147 1153 * then and we can use it again. */ 1148 sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv); 1149 result = PyDict_GetItemString(lookupDict, ptrBuf); 1150 if (result != NULL) 1151 Py_INCREF(result); 1152 else if (our_tv->v_type == VAR_STRING) 1154 if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL) 1155 || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL)) 1156 { 1157 sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, 1158 our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list 1159 : (long_u)our_tv->vval.v_dict); 1160 result = PyDict_GetItemString(lookupDict, ptrBuf); 1161 if (result != NULL) 1162 { 1163 Py_INCREF(result); 1164 return result; 1165 } 1166 } 1167 1168 if (our_tv->v_type == VAR_STRING) 1153 1169 { 1154 1170 result = Py_BuildValue("s", our_tv->vval.v_string); 1155 PyDict_SetItemString(lookupDict, ptrBuf, result);1156 1171 } 1157 1172 else if (our_tv->v_type == VAR_NUMBER) 1158 1173 { … … 1161 1176 /* For backwards compatibility numbers are stored as strings. */ 1162 1177 sprintf(buf, "%ld", (long)our_tv->vval.v_number); 1163 1178 result = Py_BuildValue("s", buf); 1164 PyDict_SetItemString(lookupDict, ptrBuf, result);1165 1179 } 1166 1180 # ifdef FEAT_FLOAT 1167 1181 else if (our_tv->v_type == VAR_FLOAT) … … 1170 1184 1171 1185 sprintf(buf, "%f", our_tv->vval.v_float); 1172 1186 result = Py_BuildValue("s", buf); 1173 PyDict_SetItemString(lookupDict, ptrBuf, result);1174 1187 } 1175 1188 # endif 1176 1189 else if (our_tv->v_type == VAR_LIST) … … 1179 1192 listitem_T *curr; 1180 1193 1181 1194 result = PyList_New(0); 1182 PyDict_SetItemString(lookupDict, ptrBuf, result);1183 1195 1184 1196 if (list != NULL) 1185 1197 { 1198 PyDict_SetItemString(lookupDict, ptrBuf, result); 1199 1186 1200 for (curr = list->lv_first; curr != NULL; curr = curr->li_next) 1187 1201 { 1188 1202 newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict); … … 1194 1208 else if (our_tv->v_type == VAR_DICT) 1195 1209 { 1196 1210 result = PyDict_New(); 1197 PyDict_SetItemString(lookupDict, ptrBuf, result);1198 1211 1199 1212 if (our_tv->vval.v_dict != NULL) 1200 1213 { … … 1203 1216 hashitem_T *hi; 1204 1217 dictitem_T *di; 1205 1218 1219 PyDict_SetItemString(lookupDict, ptrBuf, result); 1220 1206 1221 for (hi = ht->ht_array; todo > 0; ++hi) 1207 1222 { 1208 1223 if (!HASHITEM_EMPTY(hi)) … … 2345 2360 { 2346 2361 PyObject *mod; 2347 2362 PyObject *dict; 2348 static char *(argv[2]) = {"", NULL}; 2363 /* The special value is removed from sys.path in Python_Init(). */ 2364 static char *(argv[2]) = {"/must>not&exist/foo", NULL}; 2349 2365 2350 2366 /* Fixups... */ 2351 2367 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/macros.h
diff -Naur vim72.orig/src/macros.h vim72/src/macros.h
old new 127 127 #ifdef FEAT_LANGMAP 128 128 /* 129 129 * Adjust chars in a language according to 'langmap' option. 130 * NOTE that there is NO overhead if 'langmap' is not set; but even131 * when set we only have to do 2 ifs and an array lookup.130 * NOTE that there is no noticeable overhead if 'langmap' is not set. 131 * When set the overhead for characters < 256 is small. 132 132 * Don't apply 'langmap' if the character comes from the Stuff buffer. 133 133 * The do-while is just to ignore a ';' after the macro. 134 134 */ 135 # define LANGMAP_ADJUST(c, condition) do { \ 136 if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \ 137 c = langmap_mapchar[c]; \ 135 # ifdef FEAT_MBYTE 136 # define LANGMAP_ADJUST(c, condition) \ 137 do { \ 138 if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \ 139 { \ 140 if ((c) < 256) \ 141 c = langmap_mapchar[c]; \ 142 else \ 143 c = langmap_adjust_mb(c); \ 144 } \ 138 145 } while (0) 146 # else 147 # define LANGMAP_ADJUST(c, condition) \ 148 do { \ 149 if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \ 150 c = langmap_mapchar[c]; \ 151 } while (0) 152 # endif 153 #else 154 # define LANGMAP_ADJUST(c, condition) /* nop */ 139 155 #endif 140 156 141 157 /* -
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 976 976 } 977 977 } 978 978 else if (msg_scrolled > Rows - 2 979 && (c == 'j' || c == K_DOWN || c == 'd'))979 && (c == 'j' || c == K_DOWN || c == 'd' || c == 'f')) 980 980 c = K_IGNORE; 981 981 } 982 982 } while ((had_got_int && c == Ctrl_C) … … 2504 2504 break; 2505 2505 2506 2506 case 'u': /* Up half a page */ 2507 case K_PAGEUP:2508 2507 scroll = -(Rows / 2); 2509 2508 break; 2510 2509 … … 2513 2512 break; 2514 2513 2515 2514 case 'b': /* one page back */ 2515 case K_PAGEUP: 2516 2516 scroll = -(Rows - 1); 2517 2517 break; 2518 2518 2519 2519 case ' ': /* one extra page */ 2520 case 'f': 2520 2521 case K_PAGEDOWN: 2521 2522 case K_LEFTMOUSE: 2522 2523 scroll = Rows - 1; … … 2552 2553 { 2553 2554 /* Jump to the choices of the dialog. */ 2554 2555 retval = TRUE; 2555 lines_left = Rows - 1;2556 2556 } 2557 2557 else 2558 2558 #endif … … 2560 2560 got_int = TRUE; 2561 2561 quit_more = TRUE; 2562 2562 } 2563 /* When there is some more output (wrapping line) display that 2564 * without another prompt. */ 2565 lines_left = Rows - 1; 2563 2566 break; 2564 2567 2565 2568 #ifdef FEAT_CLIPBOARD … … 3309 3312 { 3310 3313 c = gui_mch_dialog(type, title, message, buttons, dfltbutton, 3311 3314 textfield); 3312 msg_end_prompt(); 3315 /* avoid a hit-enter prompt without clearing the cmdline */ 3316 need_wait_return = FALSE; 3317 emsg_on_display = FALSE; 3318 cmdline_row = msg_row; 3313 3319 3314 3320 /* Flush output to avoid that further messages and redrawing is done 3315 3321 * in the wrong order. */ … … 4556 4562 remove_trailing_zeroes = TRUE; 4557 4563 } 4558 4564 4559 if (fmt_spec == 'f' && abs_f > 1.0e307) 4565 if (fmt_spec == 'f' && 4566 #ifdef VAX 4567 abs_f > 1.0e38 4568 #else 4569 abs_f > 1.0e307 4570 #endif 4571 ) 4560 4572 { 4561 4573 /* Avoid a buffer overflow */ 4562 4574 strcpy(tmp, "inf"); … … 4585 4597 if (remove_trailing_zeroes) 4586 4598 { 4587 4599 int i; 4588 char * p;4600 char *tp; 4589 4601 4590 4602 /* Using %g or %G: remove superfluous zeroes. */ 4591 4603 if (fmt_spec == 'f') 4592 p = tmp + str_arg_l - 1;4604 tp = tmp + str_arg_l - 1; 4593 4605 else 4594 4606 { 4595 p = (char *)vim_strchr((char_u *)tmp,4607 tp = (char *)vim_strchr((char_u *)tmp, 4596 4608 fmt_spec == 'e' ? 'e' : 'E'); 4597 if ( p != NULL)4609 if (tp != NULL) 4598 4610 { 4599 4611 /* Remove superfluous '+' and leading 4600 4612 * zeroes from the exponent. */ 4601 if ( p[1] == '+')4613 if (tp[1] == '+') 4602 4614 { 4603 4615 /* Change "1.0e+07" to "1.0e07" */ 4604 STRMOVE( p + 1,p + 2);4616 STRMOVE(tp + 1, tp + 2); 4605 4617 --str_arg_l; 4606 4618 } 4607 i = ( p[1] == '-') ? 2 : 1;4608 while ( p[i] == '0')4619 i = (tp[1] == '-') ? 2 : 1; 4620 while (tp[i] == '0') 4609 4621 { 4610 4622 /* Change "1.0e07" to "1.0e7" */ 4611 STRMOVE( p + i,p + i + 1);4623 STRMOVE(tp + i, tp + i + 1); 4612 4624 --str_arg_l; 4613 4625 } 4614 -- p;4626 --tp; 4615 4627 } 4616 4628 } 4617 4629 4618 if ( p != NULL && !precision_specified)4630 if (tp != NULL && !precision_specified) 4619 4631 /* Remove trailing zeroes, but keep the one 4620 4632 * just after a dot. */ 4621 while (p > tmp + 2 && *p == '0' && p[-1] != '.') 4633 while (tp > tmp + 2 && *tp == '0' 4634 && tp[-1] != '.') 4622 4635 { 4623 STRMOVE( p,p + 1);4624 -- p;4636 STRMOVE(tp, tp + 1); 4637 --tp; 4625 4638 --str_arg_l; 4626 4639 } 4627 4640 } 4628 4641 else 4629 4642 { 4630 char * p;4643 char *tp; 4631 4644 4632 4645 /* Be consistent: some printf("%e") use 1.0e+12 4633 4646 * and some 1.0e+012. Remove one zero in the last 4634 4647 * case. */ 4635 p = (char *)vim_strchr((char_u *)tmp,4648 tp = (char *)vim_strchr((char_u *)tmp, 4636 4649 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]))4650 if (tp != NULL && (tp[1] == '+' || tp[1] == '-') 4651 && tp[2] == '0' 4652 && vim_isdigit(tp[3]) 4653 && vim_isdigit(tp[4])) 4641 4654 { 4642 STRMOVE( p + 2,p + 3);4655 STRMOVE(tp + 2, tp + 3); 4643 4656 --str_arg_l; 4644 4657 } 4645 4658 } -
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 496 496 { 497 497 colnr_T len; 498 498 #ifdef FEAT_VIRTUALEDIT 499 colnr_T oldcol = curwin->w_cursor.col + curwin->w_cursor.coladd; 499 colnr_T oldcol = curwin->w_cursor.col; 500 colnr_T oldcoladd = curwin->w_cursor.col + curwin->w_cursor.coladd; 500 501 #endif 501 502 502 503 len = (colnr_T)STRLEN(ml_get_curline()); … … 535 536 if (oldcol == MAXCOL) 536 537 curwin->w_cursor.coladd = 0; 537 538 else if (ve_flags == VE_ALL) 538 curwin->w_cursor.coladd = oldcol - curwin->w_cursor.col; 539 { 540 if (oldcoladd > curwin->w_cursor.col) 541 curwin->w_cursor.coladd = oldcoladd - curwin->w_cursor.col; 542 else 543 /* avoid weird number when there is a miscalculation or overflow */ 544 curwin->w_cursor.coladd = 0; 545 } 539 546 #endif 540 547 } 541 548 … … 873 880 /* 3. check for available memory: call mch_avail_mem() */ 874 881 if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing) 875 882 { 876 vim_free((char *)p); /* System is low... no go! */883 free((char *)p); /* System is low... no go! */ 877 884 p = NULL; 878 885 } 879 886 else … … 1010 1017 # if defined(FEAT_PROFILE) 1011 1018 do_cmdline_cmd((char_u *)"profdel *"); 1012 1019 # endif 1020 # if defined(FEAT_KEYMAP) 1021 do_cmdline_cmd((char_u *)"set keymap="); 1022 #endif 1013 1023 1014 1024 # ifdef FEAT_TITLE 1015 1025 free_titles(); … … 1034 1044 free_regexp_stuff(); 1035 1045 free_tag_stuff(); 1036 1046 free_cd_dir(); 1047 # ifdef FEAT_SIGNS 1048 free_signs(); 1049 # endif 1037 1050 # ifdef FEAT_EVAL 1038 1051 set_expr_line(NULL); 1039 1052 # endif … … 1257 1270 return escaped_string; 1258 1271 } 1259 1272 1260 #if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)1261 1273 /* 1262 1274 * Return TRUE when 'shell' has "csh" in the tail. 1263 1275 */ … … 1266 1278 { 1267 1279 return (strstr((char *)gettail(p_sh), "csh") != NULL); 1268 1280 } 1269 #endif1270 1281 1271 #if defined(FEAT_EVAL) || defined(PROTO)1272 1282 /* 1273 1283 * Escape "string" for use as a shell argument with system(). 1274 1284 * This uses single quotes, except when we know we need to use double qoutes … … 1391 1401 1392 1402 return escaped_string; 1393 1403 } 1394 #endif1395 1404 1396 1405 /* 1397 1406 * Like vim_strsave(), but make all characters uppercase. … … 2565 2574 int key; 2566 2575 int dlen = 0; 2567 2576 2568 key = find_special_key(srcp, &modifiers, keycode );2577 key = find_special_key(srcp, &modifiers, keycode, FALSE); 2569 2578 if (key == 0) 2570 2579 return 0; 2571 2580 … … 2601 2610 * returns 0 if there is no match. 2602 2611 */ 2603 2612 int 2604 find_special_key(srcp, modp, keycode )2613 find_special_key(srcp, modp, keycode, keep_x_key) 2605 2614 char_u **srcp; 2606 2615 int *modp; 2607 int keycode; /* prefer key code, e.g. K_DEL instead of DEL */ 2616 int keycode; /* prefer key code, e.g. K_DEL instead of DEL */ 2617 int keep_x_key; /* don't translate xHome to Home key */ 2608 2618 { 2609 2619 char_u *last_dash; 2610 2620 char_u *end_of_name; … … 2672 2682 else 2673 2683 { 2674 2684 key = get_special_key_code(last_dash + 1); 2675 key = handle_x_keys(key); 2685 if (!keep_x_key) 2686 key = handle_x_keys(key); 2676 2687 } 2677 2688 2678 2689 /* … … 4698 4709 stackp->ffs_filearray_cur = i + 1; 4699 4710 ff_push(search_ctx, stackp); 4700 4711 4701 simplify_filename(file_path); 4712 if (!path_with_url(file_path)) 4713 simplify_filename(file_path); 4702 4714 if (mch_dirname(ff_expand_buffer, MAXPATHL) 4703 4715 == OK) 4704 4716 { -
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/nbdebug.c
diff -Naur vim72.orig/src/nbdebug.c vim72/src/nbdebug.c
old new 33 33 u_int nb_dlevel = 0; /* nb_debug verbosity level */ 34 34 35 35 void nbdb(char *, ...); 36 void nbtrace(char *, ...);37 36 38 37 static int lookup(char *); 39 38 #ifdef USE_NB_ERRORHANDLER … … 100 99 } /* end nbdebug_log_init */ 101 100 102 101 103 104 105 void106 nbtrace(107 char *fmt,108 ...)109 {110 va_list ap;111 112 if (nb_debug!= NULL && (nb_dlevel & (NB_TRACE | NB_TRACE_VERBOSE))) {113 va_start(ap, fmt);114 vfprintf(nb_debug, fmt, ap);115 va_end(ap);116 fflush(nb_debug);117 }118 119 } /* end nbtrace */120 121 122 102 void 123 103 nbdbg( 124 104 char *fmt, … … 136 116 } /* end nbdbg */ 137 117 138 118 139 void140 nbprt(141 char *fmt,142 ...)143 {144 va_list ap;145 146 if (nb_debug != NULL && nb_dlevel & NB_PRINT) {147 va_start(ap, fmt);148 vfprintf(nb_debug, fmt, ap);149 va_end(ap);150 fflush(nb_debug);151 }152 153 } /* end nbprt */154 155 156 119 static int 157 120 lookup( 158 121 char *file) -
src/nbdebug.h
diff -Naur vim72.orig/src/nbdebug.h vim72/src/nbdebug.h
old new 43 43 44 44 45 45 void nbdbg(char *, ...); 46 void nbprt(char *, ...);47 void nbtrace(char *, ...);48 46 49 47 void nbdebug_wait __ARGS((u_int wait_flags, char *wait_var, u_int wait_secs)); 50 48 void nbdebug_log_init __ARGS((char *log_var, char *level_var)); … … 70 68 { 71 69 } 72 70 73 void74 nbprt(75 char *fmt,76 ...)77 {78 }79 80 void81 nbtrace(82 char *fmt,83 ...)84 {85 }86 87 71 #endif /* NBDEBUG */ 88 72 #endif /* NBDEBUG_H */ -
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 … … 1921 1921 vim_free(path); 1922 1922 if (bufp == NULL) 1923 1923 { 1924 1924 nbdebug((" File %s not found in setBufferNumber\n", args)); 1925 1925 EMSG2("E642: File %s not found in setBufferNumber", args); 1926 1926 return FAIL; 1927 1927 } … … 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 } … … 2321 2315 } 2322 2316 if (pos) 2323 2317 { 2324 coloncmd(":sign place %d line=% d name=%d buffer=%d",2318 coloncmd(":sign place %d line=%ld name=%d buffer=%d", 2325 2319 serNum, pos->lnum, typeNum, buf->bufp->b_fnum); 2326 2320 if (typeNum == curPCtype) 2327 2321 coloncmd(":sign jump %d buffer=%d", serNum, … … 2425 2419 GUARDED) == 0) 2426 2420 { 2427 2421 coloncmd( 2428 ":sign place %d line=% d name=%d buffer=%d",2422 ":sign place %d line=%ld name=%d buffer=%d", 2429 2423 guardId++, lnum, GUARDED, 2430 2424 buf->bufp->b_fnum); 2431 2425 } … … 2924 2918 } 2925 2919 2926 2920 /* 2927 * Tell netbeans a file was closed.2921 * Tell netbeans that a file was deleted or wiped out. 2928 2922 */ 2929 2923 void 2930 netbeans_file_ closed(buf_T *bufp)2924 netbeans_file_killed(buf_T *bufp) 2931 2925 { 2932 2926 int bufno = nb_getbufno(bufp); 2933 2927 nbbuf_T *nbbuf = nb_get_buf(bufno); 2934 2928 char buffer[2*MAXPATHL]; 2935 2929 2936 if (!haveConnection || bufno < 0) 2937 return; 2938 2939 if (!netbeansCloseFile) 2940 { 2941 nbdebug(("Ignoring file_closed for %s. File was closed from IDE\n", 2942 bufp->b_ffname)); 2930 if (!haveConnection || bufno == -1) 2943 2931 return; 2944 }2945 2946 nbdebug(("netbeans_file_closed:\n"));2947 nbdebug((" Closing bufno: %d", bufno));2948 if (curbuf != NULL && curbuf != bufp)2949 {2950 nbdebug((" Curbuf bufno: %d\n", nb_getbufno(curbuf)));2951 }2952 else if (curbuf == bufp)2953 {2954 nbdebug((" curbuf == bufp\n"));2955 }2956 2932 2957 if (bufno <= 0)2958 return;2933 nbdebug(("netbeans_file_killed:\n")); 2934 nbdebug((" Killing bufno: %d", bufno)); 2959 2935 2960 2936 sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno); 2961 2937 2962 2938 nbdebug(("EVT: %s", buffer)); 2963 2939 2964 nb_send(buffer, "netbeans_file_ closed");2940 nb_send(buffer, "netbeans_file_killed"); 2965 2941 2966 2942 if (nbbuf != NULL) 2967 2943 nbbuf->bufp = NULL; -
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 … … 641 651 * Get the command character from the user. 642 652 */ 643 653 c = safe_vgetc(); 644 645 #ifdef FEAT_LANGMAP646 654 LANGMAP_ADJUST(c, TRUE); 647 #endif648 655 649 656 #ifdef FEAT_VISUAL 650 657 /* … … 717 724 * command, so that v:count can be used in an expression mapping 718 725 * right after the count. */ 719 726 if (toplevel && stuff_empty()) 720 set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0); 727 { 728 long count = ca.count0; 729 730 /* multiply with ca.opcount the same way as below */ 731 if (ca.opcount != 0) 732 count = ca.opcount * (count == 0 ? 1 : count); 733 set_vcount(count, count == 0 ? 1 : count, set_prevcount); 734 set_prevcount = FALSE; /* only set v:prevcount once */ 735 } 721 736 #endif 722 737 if (ctrl_w) 723 738 { … … 726 741 } 727 742 ++no_zero_mapping; /* don't map zero here */ 728 743 c = plain_vgetc(); 729 #ifdef FEAT_LANGMAP730 744 LANGMAP_ADJUST(c, TRUE); 731 #endif732 745 --no_zero_mapping; 733 746 if (ctrl_w) 734 747 { … … 751 764 ++no_mapping; 752 765 ++allow_keys; /* no mapping for nchar, but keys */ 753 766 c = plain_vgetc(); /* get next character */ 754 #ifdef FEAT_LANGMAP755 767 LANGMAP_ADJUST(c, TRUE); 756 #endif757 768 --no_mapping; 758 769 --allow_keys; 759 770 #ifdef FEAT_CMDL_INFO … … 804 815 * Only set v:count when called from main() and not a stuffed command. 805 816 */ 806 817 if (toplevel && stuff_empty()) 807 set_vcount(ca.count0, ca.count1 );818 set_vcount(ca.count0, ca.count1, set_prevcount); 808 819 #endif 809 820 810 821 /* … … 941 952 * "gr", "g'" and "g`". 942 953 */ 943 954 ca.nchar = plain_vgetc(); 944 #ifdef FEAT_LANGMAP945 955 LANGMAP_ADJUST(ca.nchar, TRUE); 946 #endif947 956 #ifdef FEAT_CMDL_INFO 948 957 need_flushbuf |= add_to_showcmd(ca.nchar); 949 958 #endif … … 1044 1053 } 1045 1054 #endif 1046 1055 1047 #ifdef FEAT_LANGMAP1048 1056 /* adjust chars > 127, except after "tTfFr" commands */ 1049 1057 LANGMAP_ADJUST(*cp, !lang); 1050 #endif1051 1058 #ifdef FEAT_RIGHTLEFT 1052 1059 /* adjust Hebrew mapped char */ 1053 1060 if (p_hkmap && lang && KeyTyped) … … 1132 1139 out_flush(); 1133 1140 #endif 1134 1141 #ifdef FEAT_AUTOCMD 1135 did_cursorhold = FALSE; 1142 if (ca.cmdchar != K_IGNORE) 1143 did_cursorhold = FALSE; 1136 1144 #endif 1137 1145 1138 1146 State = NORMAL; … … 3509 3517 if (find_type & FIND_STRING) 3510 3518 EMSG(_("E348: No string under cursor")); 3511 3519 else 3512 EMSG(_( "E349: No identifier under cursor"));3520 EMSG(_(e_noident)); 3513 3521 return 0; 3514 3522 } 3515 3523 ptr += col; … … 4611 4619 ++no_mapping; 4612 4620 ++allow_keys; /* no mapping for nchar, but allow key codes */ 4613 4621 nchar = plain_vgetc(); 4614 #ifdef FEAT_LANGMAP4615 4622 LANGMAP_ADJUST(nchar, TRUE); 4616 #endif4617 4623 --no_mapping; 4618 4624 --allow_keys; 4619 4625 #ifdef FEAT_CMDL_INFO … … 4969 4975 ++no_mapping; 4970 4976 ++allow_keys; /* no mapping for nchar, but allow key codes */ 4971 4977 nchar = plain_vgetc(); 4972 #ifdef FEAT_LANGMAP4973 4978 LANGMAP_ADJUST(nchar, TRUE); 4974 #endif4975 4979 --no_mapping; 4976 4980 --allow_keys; 4977 4981 #ifdef FEAT_CMDL_INFO … … 5469 5473 STRCPY(buf, "he! "); 5470 5474 else 5471 5475 { 5476 /* An external command will probably use an argument starting 5477 * with "-" as an option. To avoid trouble we skip the "-". */ 5478 while (*ptr == '-' && n > 0) 5479 { 5480 ++ptr; 5481 --n; 5482 } 5483 if (n == 0) 5484 { 5485 EMSG(_(e_noident)); /* found dashes only */ 5486 vim_free(buf); 5487 return; 5488 } 5489 5472 5490 /* When a count is given, turn it into a range. Is this 5473 5491 * really what we want? */ 5474 5492 isman = (STRCMP(kp, "man") == 0); … … 5511 5529 /* 5512 5530 * Now grab the chars in the identifier 5513 5531 */ 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) 5532 if (cmdchar == 'K' && !kp_help) 5533 { 5534 /* Escape the argument properly for a shell command */ 5535 ptr = vim_strnsave(ptr, n); 5536 p = vim_strsave_shellescape(ptr, TRUE); 5537 vim_free(ptr); 5538 if (p == NULL) 5534 5539 { 5535 int i; 5536 int len = (*mb_ptr2len)(ptr) - 1; 5537 5538 for (i = 0; i < len && n >= 1; ++i, --n) 5539 *p++ = *ptr++; 5540 vim_free(buf); 5541 return; 5542 } 5543 buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1); 5544 if (buf == NULL) 5545 { 5546 vim_free(buf); 5547 vim_free(p); 5548 return; 5540 5549 } 5550 STRCAT(buf, p); 5551 vim_free(p); 5552 } 5553 else 5554 { 5555 if (cmdchar == '*') 5556 aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\"); 5557 else if (cmdchar == '#') 5558 aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\"); 5559 else 5560 /* Don't escape spaces and Tabs in a tag with a backslash */ 5561 aux_ptr = (char_u *)"\\|\"\n*?["; 5562 5563 p = buf + STRLEN(buf); 5564 while (n-- > 0) 5565 { 5566 /* put a backslash before \ and some others */ 5567 if (vim_strchr(aux_ptr, *ptr) != NULL) 5568 *p++ = '\\'; 5569 #ifdef FEAT_MBYTE 5570 /* When current byte is a part of multibyte character, copy all 5571 * bytes of that character. */ 5572 if (has_mbyte) 5573 { 5574 int i; 5575 int len = (*mb_ptr2len)(ptr) - 1; 5576 5577 for (i = 0; i < len && n >= 1; ++i, --n) 5578 *p++ = *ptr++; 5579 } 5541 5580 #endif 5542 *p++ = *ptr++; 5581 *p++ = *ptr++; 5582 } 5583 *p = NUL; 5543 5584 } 5544 *p = NUL;5545 5585 5546 5586 /* 5547 5587 * Execute the command. … … 6728 6768 /* Visual mode "r" */ 6729 6769 if (VIsual_active) 6730 6770 { 6771 if (got_int) 6772 reset_VIsual(); 6731 6773 nv_operator(cap); 6732 6774 return; 6733 6775 } … … 7784 7826 else 7785 7827 i = curwin->w_leftcol; 7786 7828 /* Go to the middle of the screen line. When 'number' is on and lines 7787 * are wrapping the middle can be more to the left. */7829 * are wrapping the middle can be more to the left. */ 7788 7830 if (cap->nchar == 'm') 7789 7831 i += (W_WIDTH(curwin) - curwin_col_off() 7790 7832 + ((curwin->w_p_wrap && i > 0) -
src/ops.c
diff -Naur vim72.orig/src/ops.c vim72/src/ops.c
old new 72 72 */ 73 73 struct block_def 74 74 { 75 int startspaces; /* 'extra' cols offirst char */76 int endspaces; /* 'extra' cols of first char */75 int startspaces; /* 'extra' cols before first char */ 76 int endspaces; /* 'extra' cols after last char */ 77 77 int textlen; /* chars in block */ 78 char_u *textstart; /* pointer to 1st char in block */79 colnr_T textcol; /* cols of chars (at least part.) in block */78 char_u *textstart; /* pointer to 1st char (partially) in block */ 79 colnr_T textcol; /* index of chars (partially) in block */ 80 80 colnr_T start_vcol; /* start col of 1st char wholly inside block */ 81 81 colnr_T end_vcol; /* start col of 1st char wholly after block */ 82 82 #ifdef FEAT_VISUALEXTRA … … 382 382 { 383 383 int left = (oap->op_type == OP_LSHIFT); 384 384 int oldstate = State; 385 int total , split;386 char_u *newp, *oldp , *midp, *ptr;385 int total; 386 char_u *newp, *oldp; 387 387 int oldcol = curwin->w_cursor.col; 388 388 int p_sw = (int)curbuf->b_p_sw; 389 389 int p_ts = (int)curbuf->b_p_ts; 390 390 struct block_def bd; 391 int internal = 0;392 391 int incr; 393 colnr_T vcol, col = 0,ws_vcol;392 colnr_T ws_vcol; 394 393 int i = 0, j = 0; 395 394 int len; 396 395 … … 456 455 } 457 456 else /* left */ 458 457 { 459 vcol = oap->start_vcol; 460 /* walk vcol past ws to be removed */ 461 for (midp = oldp + bd.textcol; 462 vcol < (oap->start_vcol + total) && vim_iswhite(*midp); ) 463 { 464 incr = lbr_chartabsize_adv(&midp, (colnr_T)vcol); 465 vcol += incr; 466 } 467 /* internal is the block-internal ws replacing a split TAB */ 468 if (vcol > (oap->start_vcol + total)) 469 { 470 /* we have to split the TAB *(midp-1) */ 471 internal = vcol - (oap->start_vcol + total); 472 } 473 /* if 'expandtab' is not set, use TABs */ 458 colnr_T destination_col; /* column to which text in block will 459 be shifted */ 460 char_u *verbatim_copy_end; /* end of the part of the line which is 461 copied verbatim */ 462 colnr_T verbatim_copy_width;/* the (displayed) width of this part 463 of line */ 464 unsigned fill; /* nr of spaces that replace a TAB */ 465 unsigned new_line_len; /* the length of the line after the 466 block shift */ 467 size_t block_space_width; 468 size_t shift_amount; 469 char_u *non_white = bd.textstart; 470 colnr_T non_white_col; 474 471 475 split = bd.startspaces + internal;476 if (split > 0)477 {478 if (!curbuf->b_p_et)479 {480 for (ptr = oldp, col = 0; ptr < oldp+bd.textcol; )481 col += lbr_chartabsize_adv(&ptr, (colnr_T)col);472 /* 473 * Firstly, let's find the first non-whitespace character that is 474 * displayed after the block's start column and the character's column 475 * number. Also, let's calculate the width of all the whitespace 476 * characters that are displayed in the block and precede the searched 477 * non-whitespace character. 478 */ 482 479 483 /* col+1 now equals the start col of the first char of the 484 * block (may be < oap.start_vcol if we're splitting a TAB) */ 485 i = ((col % p_ts) + split) / p_ts; /* number of tabs */ 486 } 487 if (i) 488 j = ((col % p_ts) + split) % p_ts; /* number of spp */ 489 else 490 j = split; 491 } 480 /* If "bd.startspaces" is set, "bd.textstart" points to the character, 481 * the part of which is displayed at the block's beginning. Let's start 482 * searching from the next character. */ 483 if (bd.startspaces) 484 mb_ptr_adv(non_white); 492 485 493 newp = alloc_check(bd.textcol + i + j + (unsigned)STRLEN(midp) + 1); 494 if (newp == NULL) 495 return; 496 vim_memset(newp, NUL, (size_t)(bd.textcol + i + j + STRLEN(midp) + 1)); 486 /* The character's column is in "bd.start_vcol". */ 487 non_white_col = bd.start_vcol; 497 488 498 /* copy first part we want to keep */ 499 mch_memmove(newp, oldp, (size_t)bd.textcol); 500 /* Now copy any TABS and spp to ensure correct alignment! */ 501 while (vim_iswhite(*midp)) 489 while (vim_iswhite(*non_white)) 502 490 { 503 if (*midp == TAB) 504 i++; 505 else /*space */ 506 j++; 507 midp++; 491 incr = lbr_chartabsize_adv(&non_white, non_white_col); 492 non_white_col += incr; 508 493 } 509 /* We might have an extra TAB worth of spp now! */ 510 if (j / p_ts && !curbuf->b_p_et) 494 495 block_space_width = non_white_col - oap->start_vcol; 496 /* We will shift by "total" or "block_space_width", whichever is less. 497 */ 498 shift_amount = (block_space_width < total? block_space_width: total); 499 500 /* The column to which we will shift the text. */ 501 destination_col = non_white_col - shift_amount; 502 503 /* Now let's find out how much of the beginning of the line we can 504 * reuse without modification. */ 505 verbatim_copy_end = bd.textstart; 506 verbatim_copy_width = bd.start_vcol; 507 508 /* If "bd.startspaces" is set, "bd.textstart" points to the character 509 * preceding the block. We have to subtract its width to obtain its 510 * column number. */ 511 if (bd.startspaces) 512 verbatim_copy_width -= bd.start_char_vcols; 513 while (verbatim_copy_width < destination_col) 511 514 { 512 i++; 513 j -= p_ts; 515 incr = lbr_chartabsize(verbatim_copy_end, verbatim_copy_width); 516 if (verbatim_copy_width + incr > destination_col) 517 break; 518 verbatim_copy_width += incr; 519 mb_ptr_adv(verbatim_copy_end); 514 520 } 515 copy_chars(newp + bd.textcol, (size_t)i, TAB);516 copy_spaces(newp + bd.textcol + i, (size_t)j);517 521 518 /* the end */ 519 STRMOVE(newp + STRLEN(newp), midp); 522 /* If "destination_col" is different from the width of the initial 523 * part of the line that will be copied, it means we encountered a tab 524 * character, which we will have to partly replace with spaces. */ 525 fill = destination_col - verbatim_copy_width; 526 527 /* The replacement line will consist of: 528 * - the beginning of the original line up to "verbatim_copy_end", 529 * - "fill" number of spaces, 530 * - the rest of the line, pointed to by non_white. */ 531 new_line_len = (unsigned)(verbatim_copy_end - oldp) 532 + fill 533 + (unsigned)STRLEN(non_white) + 1; 534 535 newp = alloc_check(new_line_len); 536 if (newp == NULL) 537 return; 538 mch_memmove(newp, oldp, (size_t)(verbatim_copy_end - oldp)); 539 copy_spaces(newp + (verbatim_copy_end - oldp), (size_t)fill); 540 STRMOVE(newp + (verbatim_copy_end - oldp) + fill, non_white); 520 541 } 521 542 /* replace the line */ 522 543 ml_replace(curwin->w_cursor.lnum, newp, FALSE); … … 2209 2230 { 2210 2231 for (; pos.lnum <= oap->end.lnum; ++pos.lnum) 2211 2232 { 2233 int one_change; 2234 2212 2235 block_prep(oap, &bd, pos.lnum, FALSE); 2213 2236 pos.col = bd.textcol; 2214 did_change = swapchars(oap->op_type, &pos, bd.textlen); 2237 one_change = swapchars(oap->op_type, &pos, bd.textlen); 2238 did_change |= one_change; 2215 2239 2216 2240 # ifdef FEAT_NETBEANS_INTG 2217 if (usingNetbeans && did_change)2241 if (usingNetbeans && one_change) 2218 2242 { 2219 2243 char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE); 2220 2244 … … 4848 4872 * - textlen includes the first/last char to be (partly) deleted 4849 4873 * - start/endspaces is the number of columns that are taken by the 4850 4874 * first/last deleted char minus the number of columns that have to be 4851 * deleted. for yank and tilde: 4875 * deleted. 4876 * for yank and tilde: 4852 4877 * - textlen includes the first/last char to be wholly yanked 4853 4878 * - start/endspaces is the number of columns of the first/last yanked char 4854 4879 * that are to be yanked. -
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 … … 4119 4119 && options[opt_idx].var == VAR_WIN) 4120 4120 goto skip; 4121 4121 4122 /* Disallow changing some options from modelines */4123 if ( (opt_flags & OPT_MODELINE) && (flags & P_SECURE))4122 /* Disallow changing some options from modelines. */ 4123 if (opt_flags & OPT_MODELINE) 4124 4124 { 4125 errmsg = (char_u *)_("E520: Not allowed in a modeline"); 4126 goto skip; 4125 if (flags & P_SECURE) 4126 { 4127 errmsg = (char_u *)_("E520: Not allowed in a modeline"); 4128 goto skip; 4129 } 4130 #ifdef FEAT_DIFF 4131 /* In diff mode some options are overruled. This avoids that 4132 * 'foldmethod' becomes "marker" instead of "diff" and that 4133 * "wrap" gets set. */ 4134 if (curwin->w_p_diff 4135 && (options[opt_idx].indir == PV_FDM 4136 || options[opt_idx].indir == PV_WRAP)) 4137 goto skip; 4138 #endif 4127 4139 } 4128 4140 4129 4141 #ifdef HAVE_SANDBOX … … 5268 5280 } 5269 5281 #endif 5270 5282 5283 #ifdef FEAT_TITLE 5284 static void redraw_titles __ARGS((void)); 5285 5286 /* 5287 * Redraw the window title and/or tab page text later. 5288 */ 5289 static void redraw_titles() 5290 { 5291 need_maketitle = TRUE; 5292 # ifdef FEAT_WINDOWS 5293 redraw_tabline = TRUE; 5294 # endif 5295 } 5296 #endif 5297 5271 5298 /* 5272 5299 * Set a string option to a new value (without checking the effect). 5273 5300 * The string is copied into allocated memory. … … 5407 5434 int did_chartab = FALSE; 5408 5435 char_u **gvarp; 5409 5436 long_u free_oldval = (options[opt_idx].flags & P_ALLOCED); 5437 #ifdef FEAT_GUI 5438 /* set when changing an option that only requires a redraw in the GUI */ 5439 int redraw_gui_only = FALSE; 5440 #endif 5410 5441 5411 5442 /* Get the global option to compare with, otherwise we would have to check 5412 5443 * two values for all local options. */ … … 5668 5699 { 5669 5700 # ifdef FEAT_TITLE 5670 5701 /* May show a "+" in the title now. */ 5671 need_maketitle = TRUE;5702 redraw_titles(); 5672 5703 # endif 5673 5704 /* Add 'fileencoding' to the swap file. */ 5674 5705 ml_setflags(curbuf); … … 5687 5718 { 5688 5719 errmsg = mb_init(); 5689 5720 # ifdef FEAT_TITLE 5690 need_maketitle = TRUE;5721 redraw_titles(); 5691 5722 # endif 5692 5723 } 5693 5724 } … … 5766 5797 /* load or unload key mapping tables */ 5767 5798 errmsg = keymap_init(); 5768 5799 5769 /* When successfully installed a new keymap switch on using it. */ 5770 if (*curbuf->b_p_keymap != NUL && errmsg == NULL) 5800 if (errmsg == NULL) 5771 5801 { 5772 curbuf->b_p_iminsert = B_IMODE_LMAP; 5773 if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT) 5774 curbuf->b_p_imsearch = B_IMODE_LMAP; 5775 set_iminsert_global(); 5776 set_imsearch_global(); 5802 if (*curbuf->b_p_keymap != NUL) 5803 { 5804 /* Installed a new keymap, switch on using it. */ 5805 curbuf->b_p_iminsert = B_IMODE_LMAP; 5806 if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT) 5807 curbuf->b_p_imsearch = B_IMODE_LMAP; 5808 } 5809 else 5810 { 5811 /* Cleared the keymap, may reset 'iminsert' and 'imsearch'. */ 5812 if (curbuf->b_p_iminsert == B_IMODE_LMAP) 5813 curbuf->b_p_iminsert = B_IMODE_NONE; 5814 if (curbuf->b_p_imsearch == B_IMODE_LMAP) 5815 curbuf->b_p_imsearch = B_IMODE_USE_INSERT; 5816 } 5817 if ((opt_flags & OPT_LOCAL) == 0) 5818 { 5819 set_iminsert_global(); 5820 set_imsearch_global(); 5821 } 5777 5822 # ifdef FEAT_WINDOWS 5778 5823 status_redraw_curbuf(); 5779 5824 # endif … … 5796 5841 else 5797 5842 curbuf->b_p_tx = FALSE; 5798 5843 #ifdef FEAT_TITLE 5799 need_maketitle = TRUE;5844 redraw_titles(); 5800 5845 #endif 5801 5846 /* update flag in swap file */ 5802 5847 ml_setflags(curbuf); … … 6055 6100 errmsg = (char_u *)N_("E596: Invalid font(s)"); 6056 6101 } 6057 6102 } 6103 redraw_gui_only = TRUE; 6058 6104 } 6059 6105 # ifdef FEAT_XFONTSET 6060 6106 else if (varp == &p_guifontset) … … 6063 6109 errmsg = (char_u *)N_("E597: can't select fontset"); 6064 6110 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK) 6065 6111 errmsg = (char_u *)N_("E598: Invalid fontset"); 6112 redraw_gui_only = TRUE; 6066 6113 } 6067 6114 # endif 6068 6115 # ifdef FEAT_MBYTE … … 6072 6119 errmsg = (char_u *)N_("E533: can't select wide font"); 6073 6120 else if (gui_get_wide_font() == FAIL) 6074 6121 errmsg = (char_u *)N_("E534: Invalid wide font"); 6122 redraw_gui_only = TRUE; 6075 6123 } 6076 6124 # endif 6077 6125 #endif … … 6133 6181 #ifdef FEAT_GUI 6134 6182 /* 'guioptions' */ 6135 6183 else if (varp == &p_go) 6184 { 6136 6185 gui_init_which_components(oldval); 6186 redraw_gui_only = TRUE; 6187 } 6137 6188 #endif 6138 6189 6139 6190 #if defined(FEAT_GUI_TABLINE) 6140 6191 /* 'guitablabel' */ 6141 6192 else if (varp == &p_gtl) 6193 { 6142 6194 redraw_tabline = TRUE; 6195 redraw_gui_only = TRUE; 6196 } 6197 /* 'guitabtooltip' */ 6198 else if (varp == &p_gtt) 6199 { 6200 redraw_gui_only = TRUE; 6201 } 6143 6202 #endif 6144 6203 6145 6204 #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS)) … … 6717 6776 6718 6777 if (curwin->w_curswant != MAXCOL) 6719 6778 curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */ 6720 check_redraw(options[opt_idx].flags); 6779 #ifdef FEAT_GUI 6780 /* check redraw when it's not a GUI option or the GUI is active. */ 6781 if (!redraw_gui_only || gui.in_use) 6782 #endif 6783 check_redraw(options[opt_idx].flags); 6721 6784 6722 6785 return errmsg; 6723 6786 } … … 7105 7168 curbuf->b_did_warn = FALSE; 7106 7169 7107 7170 #ifdef FEAT_TITLE 7108 need_maketitle = TRUE;7171 redraw_titles(); 7109 7172 #endif 7110 7173 } 7111 7174 7112 7175 #ifdef FEAT_TITLE 7113 7176 /* when 'modifiable' is changed, redraw the window title */ 7114 7177 else if ((int *)varp == &curbuf->b_p_ma) 7115 need_maketitle = TRUE; 7178 { 7179 redraw_titles(); 7180 } 7116 7181 /* when 'endofline' is changed, redraw the window title */ 7117 7182 else if ((int *)varp == &curbuf->b_p_eol) 7118 need_maketitle = TRUE; 7119 #ifdef FEAT_MBYTE 7120 /* when 'bomb' is changed, redraw the window title */ 7183 { 7184 redraw_titles(); 7185 } 7186 # ifdef FEAT_MBYTE 7187 /* when 'bomb' is changed, redraw the window title and tab page text */ 7121 7188 else if ((int *)varp == &curbuf->b_p_bomb) 7122 need_maketitle = TRUE; 7123 #endif 7189 { 7190 redraw_titles(); 7191 } 7192 # endif 7124 7193 #endif 7125 7194 7126 7195 /* when 'bin' is set also set some other options */ … … 7128 7197 { 7129 7198 set_options_bin(old_value, curbuf->b_p_bin, opt_flags); 7130 7199 #ifdef FEAT_TITLE 7131 need_maketitle = TRUE;7200 redraw_titles(); 7132 7201 #endif 7133 7202 } 7134 7203 … … 7279 7348 if (!value) 7280 7349 save_file_ff(curbuf); /* Buffer is unchanged */ 7281 7350 #ifdef FEAT_TITLE 7282 need_maketitle = TRUE;7351 redraw_titles(); 7283 7352 #endif 7284 7353 #ifdef FEAT_AUTOCMD 7285 7354 modified_was_set = value; … … 7714 7783 newFoldLevel(); 7715 7784 } 7716 7785 7717 /* 'foldminl evel' */7786 /* 'foldminlines' */ 7718 7787 else if (pp == &curwin->w_p_fml) 7719 7788 { 7720 7789 foldUpdateAll(curwin); … … 7974 8043 else /* curwin->w_p_scr > curwin->w_height */ 7975 8044 curwin->w_p_scr = curwin->w_height; 7976 8045 } 8046 if (p_hi < 0) 8047 { 8048 errmsg = e_positive; 8049 p_hi = 0; 8050 } 7977 8051 if (p_report < 0) 7978 8052 { 7979 8053 errmsg = e_positive; … … 8227 8301 { 8228 8302 if (number == 0 && string != NULL) 8229 8303 { 8230 int i ndex;8304 int idx; 8231 8305 8232 8306 /* Either we are given a string or we are setting option 8233 8307 * to zero. */ 8234 for (i ndex = 0; string[index] == '0'; ++index)8308 for (idx = 0; string[idx] == '0'; ++idx) 8235 8309 ; 8236 if (string[i ndex] != NUL || index == 0)8310 if (string[idx] != NUL || idx == 0) 8237 8311 { 8238 8312 /* There's another character after zeros or the string 8239 8313 * is empty. In both cases, we are trying to set a … … 8323 8397 { 8324 8398 --arg; /* put arg at the '<' */ 8325 8399 modifiers = 0; 8326 key = find_special_key(&arg, &modifiers, TRUE );8400 key = find_special_key(&arg, &modifiers, TRUE, TRUE); 8327 8401 if (modifiers) /* can't handle modifiers here */ 8328 8402 key = 0; 8329 8403 } … … 10093 10167 10094 10168 #ifdef FEAT_LANGMAP 10095 10169 /* 10096 * Any character has an equivalent character. This is used for keyboards that 10097 * have a special language mode that sends characters above 128 (although 10098 * other characters can be translated too). 10170 * Any character has an equivalent 'langmap' character. This is used for 10171 * keyboards that have a special language mode that sends characters above 10172 * 128 (although other characters can be translated too). The "to" field is a 10173 * Vim command character. This avoids having to switch the keyboard back to 10174 * ASCII mode when leaving Insert mode. 10175 * 10176 * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim 10177 * commands. 10178 * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of 10179 * langmap_entry_T. This does the same as langmap_mapchar[] for characters >= 10180 * 256. 10099 10181 */ 10182 # ifdef FEAT_MBYTE 10183 /* 10184 * With multi-byte support use growarray for 'langmap' chars >= 256 10185 */ 10186 typedef struct 10187 { 10188 int from; 10189 int to; 10190 } langmap_entry_T; 10191 10192 static garray_T langmap_mapga; 10193 static void langmap_set_entry __ARGS((int from, int to)); 10100 10194 10101 10195 /* 10102 * char_u langmap_mapchar[256]; 10103 * Normally maps each of the 128 upper chars to an <128 ascii char; used to 10104 * "translate" native lang chars in normal mode or some cases of 10105 * insert mode without having to tediously switch lang mode back&forth. 10196 * Search for an entry in "langmap_mapga" for "from". If found set the "to" 10197 * field. If not found insert a new entry at the appropriate location. 10106 10198 */ 10199 static void 10200 langmap_set_entry(from, to) 10201 int from; 10202 int to; 10203 { 10204 langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data); 10205 int a = 0; 10206 int b = langmap_mapga.ga_len; 10207 10208 /* Do a binary search for an existing entry. */ 10209 while (a != b) 10210 { 10211 int i = (a + b) / 2; 10212 int d = entries[i].from - from; 10213 10214 if (d == 0) 10215 { 10216 entries[i].to = to; 10217 return; 10218 } 10219 if (d < 0) 10220 a = i + 1; 10221 else 10222 b = i; 10223 } 10224 10225 if (ga_grow(&langmap_mapga, 1) != OK) 10226 return; /* out of memory */ 10227 10228 /* insert new entry at position "a" */ 10229 entries = (langmap_entry_T *)(langmap_mapga.ga_data) + a; 10230 mch_memmove(entries + 1, entries, 10231 (langmap_mapga.ga_len - a) * sizeof(langmap_entry_T)); 10232 ++langmap_mapga.ga_len; 10233 entries[0].from = from; 10234 entries[0].to = to; 10235 } 10236 10237 /* 10238 * Apply 'langmap' to multi-byte character "c" and return the result. 10239 */ 10240 int 10241 langmap_adjust_mb(c) 10242 int c; 10243 { 10244 langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data); 10245 int a = 0; 10246 int b = langmap_mapga.ga_len; 10247 10248 while (a != b) 10249 { 10250 int i = (a + b) / 2; 10251 int d = entries[i].from - c; 10252 10253 if (d == 0) 10254 return entries[i].to; /* found matching entry */ 10255 if (d < 0) 10256 a = i + 1; 10257 else 10258 b = i; 10259 } 10260 return c; /* no entry found, return "c" unmodified */ 10261 } 10262 # endif 10107 10263 10108 10264 static void 10109 10265 langmap_init() 10110 10266 { 10111 10267 int i; 10112 10268 10113 for (i = 0; i < 256; i++) /* we init with a-one-to one map */ 10114 langmap_mapchar[i] = i; 10269 for (i = 0; i < 256; i++) 10270 langmap_mapchar[i] = i; /* we init with a one-to-one map */ 10271 # ifdef FEAT_MBYTE 10272 ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8); 10273 # endif 10115 10274 } 10116 10275 10117 10276 /* … … 10125 10284 char_u *p2; 10126 10285 int from, to; 10127 10286 10128 langmap_init(); /* back to one-to-one map first */ 10287 #ifdef FEAT_MBYTE 10288 ga_clear(&langmap_mapga); /* clear the previous map first */ 10289 #endif 10290 langmap_init(); /* back to one-to-one map */ 10129 10291 10130 10292 for (p = p_langmap; p[0] != NUL; ) 10131 10293 { … … 10175 10337 transchar(from)); 10176 10338 return; 10177 10339 } 10178 langmap_mapchar[from & 255] = to; 10340 10341 #ifdef FEAT_MBYTE 10342 if (from >= 256) 10343 langmap_set_entry(from, to); 10344 else 10345 #endif 10346 langmap_mapchar[from & 255] = to; 10179 10347 10180 10348 /* Advance to next pair */ 10181 10349 mb_ptr_adv(p); -
src/os_unix.c
diff -Naur vim72.orig/src/os_unix.c vim72/src/os_unix.c
old new 181 181 && defined(FEAT_TITLE) && !defined(FEAT_GUI_GTK) 182 182 # define SET_SIG_ALARM 183 183 static RETSIGTYPE sig_alarm __ARGS(SIGPROTOARG); 184 static int sig_alarm_called; 184 /* volatile because it is used in signal handler sig_alarm(). */ 185 static volatile int sig_alarm_called; 185 186 #endif 186 187 static RETSIGTYPE deathtrap __ARGS(SIGPROTOARG); 187 188 … … 201 202 # define SIG_ERR ((RETSIGTYPE (*)())-1) 202 203 #endif 203 204 204 static int do_resize = FALSE; 205 /* volatile because it is used in signal handler sig_winch(). */ 206 static volatile int do_resize = FALSE; 205 207 #ifndef __EMX__ 206 208 static char_u *extra_shell_arg = NULL; 207 209 static int show_shell_mess = TRUE; 208 210 #endif 209 static int deadly_signal = 0; /* The signal we caught */ 210 static int in_mch_delay = FALSE; /* sleeping in mch_delay() */ 211 /* volatile because it is used in signal handler deathtrap(). */ 212 static volatile int deadly_signal = 0; /* The signal we caught */ 213 /* volatile because it is used in signal handler deathtrap(). */ 214 static volatile int in_mch_delay = FALSE; /* sleeping in mch_delay() */ 211 215 212 216 static int curr_tmode = TMODE_COOK; /* contains current terminal mode */ 213 217 … … 315 319 {-1, "Unknown!", FALSE} 316 320 }; 317 321 322 /* 323 * Write s[len] to the screen. 324 */ 318 325 void 319 326 mch_write(s, len) 320 327 char_u *s; 321 328 int len; 322 329 { 323 write(1, (char *)s, len);330 ignored = (int)write(1, (char *)s, len); 324 331 if (p_wd) /* Unix is too fast, slow down a bit more */ 325 332 RealWaitForChar(read_cmd_fd, p_wd, NULL); 326 333 } … … 799 806 #endif 800 807 801 808 /* 802 * We need correct p otatotypes for a signal function, otherwise mean compilers809 * We need correct prototypes for a signal function, otherwise mean compilers 803 810 * will barf when the second argument to signal() is ``wrong''. 804 811 * Let me try it with a few tricky defines from my own osdef.h (jw). 805 812 */ … … 1065 1072 SIGRETURN; 1066 1073 } 1067 1074 1068 #if def _REENTRANT1075 #if defined(_REENTRANT) && defined(SIGCONT) 1069 1076 /* 1070 1077 * On Solaris with multi-threading, suspending might not work immediately. 1071 1078 * Catch the SIGCONT signal, which will be used as an indication whether the 1072 1079 * suspending has been done or not. 1080 * 1081 * On Linux, signal is not always handled immediately either. 1082 * See https://bugs.launchpad.net/bugs/291373 1083 * 1084 * volatile because it is used in in signal handler sigcont_handler(). 1073 1085 */ 1074 static int sigcont_received;1086 static volatile int sigcont_received; 1075 1087 static RETSIGTYPE sigcont_handler __ARGS(SIGPROTOARG); 1076 1088 1077 1089 /* … … 1115 1127 } 1116 1128 # endif 1117 1129 1118 # if def _REENTRANT1130 # if defined(_REENTRANT) && defined(SIGCONT) 1119 1131 sigcont_received = FALSE; 1120 1132 # endif 1121 1133 kill(0, SIGTSTP); /* send ourselves a STOP signal */ 1122 # ifdef _REENTRANT 1123 /* When we didn't suspend immediately in the kill(), do it now. Happens 1124 * on multi-threaded Solaris. */ 1125 if (!sigcont_received) 1126 pause(); 1134 # if defined(_REENTRANT) && defined(SIGCONT) 1135 /* 1136 * Wait for the SIGCONT signal to be handled. It generally happens 1137 * immediately, but somehow not all the time. Do not call pause() 1138 * because there would be race condition which would hang Vim if 1139 * signal happened in between the test of sigcont_received and the 1140 * call to pause(). If signal is not yet received, call sleep(0) 1141 * to just yield CPU. Signal should then be received. If somehow 1142 * it's still not received, sleep 1, 2, 3 ms. Don't bother waiting 1143 * further if signal is not received after 1+2+3+4 ms (not expected 1144 * to happen). 1145 */ 1146 { 1147 long wait; 1148 for (wait = 0; !sigcont_received && wait <= 3L; wait++) 1149 /* Loop is not entered most of the time */ 1150 mch_delay(wait, FALSE); 1151 } 1127 1152 # endif 1128 1153 1129 1154 # ifdef FEAT_TITLE … … 1172 1197 #ifdef SIGTSTP 1173 1198 signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL); 1174 1199 #endif 1175 #if def _REENTRANT1200 #if defined(_REENTRANT) && defined(SIGCONT) 1176 1201 signal(SIGCONT, sigcont_handler); 1177 1202 #endif 1178 1203 … … 1231 1256 reset_signals() 1232 1257 { 1233 1258 catch_signals(SIG_DFL, SIG_DFL); 1234 #if def _REENTRANT1259 #if defined(_REENTRANT) && defined(SIGCONT) 1235 1260 /* SIGCONT isn't in the list, because its default action is ignore */ 1236 1261 signal(SIGCONT, SIG_DFL); 1237 1262 #endif … … 2905 2930 * Ignore any errors. 2906 2931 */ 2907 2932 #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK) 2908 signal_stack = malloc(SIGSTKSZ);2933 signal_stack = (char *)alloc(SIGSTKSZ); 2909 2934 init_signal_stack(); 2910 2935 #endif 2911 2936 } … … 2936 2961 } 2937 2962 # endif 2938 2963 # endif 2939 # ifdef FEAT_X11 2964 /* Don't close the display for GTK 1, it is done in exit(). */ 2965 # if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2)) 2940 2966 if (x11_display != NULL 2941 2967 # ifdef FEAT_XCLIPBOARD 2942 2968 && x11_display != xterm_dpy … … 3926 3952 */ 3927 3953 if (fd >= 0) 3928 3954 { 3929 dup(fd); /* To replace stdin (file descriptor0) */3930 dup(fd); /* To replace stdout (file descriptor1) */3931 dup(fd); /* To replace stderr (file descriptor2) */3955 ignored = dup(fd); /* To replace stdin (fd 0) */ 3956 ignored = dup(fd); /* To replace stdout (fd 1) */ 3957 ignored = dup(fd); /* To replace stderr (fd 2) */ 3932 3958 3933 3959 /* Don't need this now that we've duplicated it */ 3934 3960 close(fd); … … 3946 3972 * children can be kill()ed. Don't do this when using pipes, 3947 3973 * because stdin is not a tty, we would lose /dev/tty. */ 3948 3974 if (p_stmp) 3975 { 3949 3976 (void)setsid(); 3977 # if defined(SIGHUP) 3978 /* When doing "!xterm&" and 'shell' is bash: the shell 3979 * will exit and send SIGHUP to all processes in its 3980 * group, killing the just started process. Ignore SIGHUP 3981 * to avoid that. (suggested by Simon Schubert) 3982 */ 3983 signal(SIGHUP, SIG_IGN); 3984 # endif 3985 } 3950 3986 # endif 3951 3987 # ifdef FEAT_GUI 3952 3988 if (pty_slave_fd >= 0) … … 3996 4032 3997 4033 /* set up stdin/stdout/stderr for the child */ 3998 4034 close(0); 3999 dup(pty_slave_fd);4035 ignored = dup(pty_slave_fd); 4000 4036 close(1); 4001 dup(pty_slave_fd);4037 ignored = dup(pty_slave_fd); 4002 4038 if (gui.in_use) 4003 4039 { 4004 4040 close(2); 4005 dup(pty_slave_fd);4041 ignored = dup(pty_slave_fd); 4006 4042 } 4007 4043 4008 4044 close(pty_slave_fd); /* has been dupped, close it now */ … … 4013 4049 /* set up stdin for the child */ 4014 4050 close(fd_toshell[1]); 4015 4051 close(0); 4016 dup(fd_toshell[0]);4052 ignored = dup(fd_toshell[0]); 4017 4053 close(fd_toshell[0]); 4018 4054 4019 4055 /* set up stdout for the child */ 4020 4056 close(fd_fromshell[0]); 4021 4057 close(1); 4022 dup(fd_fromshell[1]);4058 ignored = dup(fd_fromshell[1]); 4023 4059 close(fd_fromshell[1]); 4024 4060 4025 4061 # ifdef FEAT_GUI … … 4027 4063 { 4028 4064 /* set up stderr for the child */ 4029 4065 close(2); 4030 dup(1);4066 ignored = dup(1); 4031 4067 } 4032 4068 # endif 4033 4069 } … … 4078 4114 int fromshell_fd; 4079 4115 garray_T ga; 4080 4116 int noread_cnt; 4117 # if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) 4118 struct timeval start_tv; 4119 # endif 4081 4120 4082 4121 # ifdef FEAT_GUI 4083 4122 if (pty_master_fd >= 0) … … 4158 4197 && (lnum != 4159 4198 curbuf->b_ml.ml_line_count 4160 4199 || curbuf->b_p_eol))) 4161 write(toshell_fd, "\n", (size_t)1); 4200 ignored = write(toshell_fd, "\n", 4201 (size_t)1); 4162 4202 ++lnum; 4163 4203 if (lnum > curbuf->b_op_end.lnum) 4164 4204 { … … 4186 4226 ga_init2(&ga, 1, BUFLEN); 4187 4227 4188 4228 noread_cnt = 0; 4189 4229 # if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) 4230 gettimeofday(&start_tv, NULL); 4231 # endif 4190 4232 for (;;) 4191 4233 { 4192 4234 /* … … 4199 4241 * that a typed password is echoed for ssh or gpg command. 4200 4242 * Don't get characters when the child has already 4201 4243 * finished (wait_pid == 0). 4202 * Don't get extra characters when we already have one.4203 4244 * Don't read characters unless we didn't get output for a 4204 * while, avoids that ":r !ls" eats typeahead. 4245 * while (noread_cnt > 4), avoids that ":r !ls" eats 4246 * typeahead. 4205 4247 */ 4206 4248 len = 0; 4207 4249 if (!(options & SHELL_EXPAND) 4208 4250 && ((options & 4209 4251 (SHELL_READ|SHELL_WRITE|SHELL_COOKED)) 4210 4252 != (SHELL_READ|SHELL_WRITE|SHELL_COOKED) 4211 # ifdef FEAT_GUI4253 # ifdef FEAT_GUI 4212 4254 || gui.in_use 4213 # endif4255 # endif 4214 4256 ) 4215 4257 && wait_pid == 0 4216 && (ta_len > 0 4217 || (noread_cnt > 4 4218 && (len = ui_inchar(ta_buf, 4219 BUFLEN, 10L, 0)) > 0))) 4258 && (ta_len > 0 || noread_cnt > 4)) 4220 4259 { 4260 if (ta_len == 0) 4261 { 4262 /* Get extra characters when we don't have any. 4263 * Reset the counter and timer. */ 4264 noread_cnt = 0; 4265 # if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) 4266 gettimeofday(&start_tv, NULL); 4267 # endif 4268 len = ui_inchar(ta_buf, BUFLEN, 10L, 0); 4269 } 4270 if (ta_len > 0 || len > 0) 4271 { 4221 4272 /* 4222 4273 * For pipes: 4223 4274 * Check for CTRL-C: send interrupt signal to child. … … 4319 4370 { 4320 4371 ta_len -= len; 4321 4372 mch_memmove(ta_buf, ta_buf + len, ta_len); 4322 noread_cnt = 0;4323 4373 } 4324 4374 } 4375 } 4325 4376 } 4326 4377 4327 4378 if (got_int) … … 4429 4480 out_flush(); 4430 4481 if (got_int) 4431 4482 break; 4483 4484 # if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) 4485 { 4486 struct timeval now_tv; 4487 long msec; 4488 4489 /* Avoid that we keep looping here without 4490 * checking for a CTRL-C for a long time. Don't 4491 * break out too often to avoid losing typeahead. */ 4492 gettimeofday(&now_tv, NULL); 4493 msec = (now_tv.tv_sec - start_tv.tv_sec) * 1000L 4494 + (now_tv.tv_usec - start_tv.tv_usec) / 1000L; 4495 if (msec > 2000) 4496 { 4497 noread_cnt = 5; 4498 break; 4499 } 4500 } 4501 # endif 4432 4502 } 4433 4503 4434 4504 /* If we already detected the child has finished break the … … 5851 5921 * we are going to suspend or starting an external process 5852 5922 * so we shouldn't have problem with this 5853 5923 */ 5924 # ifdef SIGTSTP 5854 5925 signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL); 5926 # endif 5855 5927 return 1; /* succeed */ 5856 5928 } 5857 5929 if (gpm_fd == -2) … … 6814 6886 if (xsmp_icefd != -1) 6815 6887 { 6816 6888 SmcCloseConnection(xsmp.smcconn, 0, NULL); 6817 vim_free(xsmp.clientid); 6889 if (xsmp.clientid != NULL) 6890 free(xsmp.clientid); 6818 6891 xsmp.clientid = NULL; 6819 6892 xsmp_icefd = -1; 6820 6893 } -
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)); … … 40 40 int read_viminfo_sub_string __ARGS((vir_T *virp, int force)); 41 41 void write_viminfo_sub_string __ARGS((FILE *fp)); 42 42 void free_old_sub __ARGS((void)); 43 void free_signs __ARGS((void)); 43 44 int prepare_tagpreview __ARGS((int undo_sync)); 44 45 void ex_help __ARGS((exarg_T *eap)); 45 46 char_u *check_help_lang __ARGS((char_u *arg)); -
src/proto/ex_getln.pro
diff -Naur vim72.orig/src/proto/ex_getln.pro vim72/src/proto/ex_getln.pro
old new 4 4 int text_locked __ARGS((void)); 5 5 void text_locked_msg __ARGS((void)); 6 6 int curbuf_locked __ARGS((void)); 7 int allbuf_locked __ARGS((void)); 7 8 char_u *getexline __ARGS((int c, void *dummy, int indent)); 8 9 char_u *getexmodeline __ARGS((int promptc, void *dummy, int indent)); 9 10 int cmdline_overstrike __ARGS((void)); … … 31 32 void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col)); 32 33 int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches)); 33 34 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 ));35 char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options)); 35 36 void init_history __ARGS((void)); 36 37 int get_histtype __ARGS((char_u *name)); 37 38 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/proto/netbeans.pro
diff -Naur vim72.orig/src/proto/netbeans.pro vim72/src/proto/netbeans.pro
old new 11 11 void netbeans_frame_moved __ARGS((int new_x, int new_y)); 12 12 void netbeans_file_activated __ARGS((buf_T *bufp)); 13 13 void netbeans_file_opened __ARGS((buf_T *bufp)); 14 void netbeans_file_ closed __ARGS((buf_T *bufp));14 void netbeans_file_killed __ARGS((buf_T *bufp)); 15 15 void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen)); 16 16 void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len)); 17 17 void netbeans_unmodified __ARGS((buf_T *bufp)); -
src/proto/option.pro
diff -Naur vim72.orig/src/proto/option.pro vim72/src/proto/option.pro
old new 44 44 void set_context_in_set_cmd __ARGS((expand_T *xp, char_u *arg, int opt_flags)); 45 45 int ExpandSettings __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file)); 46 46 int ExpandOldSetting __ARGS((int *num_file, char_u ***file)); 47 int langmap_adjust_mb __ARGS((int c)); 47 48 int has_format_option __ARGS((int x)); 48 49 int shortmess __ARGS((int x)); 49 50 void vimrc_found __ARGS((char_u *fname, char_u *envname)); -
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/quickfix.c
diff -Naur vim72.orig/src/quickfix.c vim72/src/quickfix.c
old new 1419 1419 int opened_window = FALSE; 1420 1420 win_T *win; 1421 1421 win_T *altwin; 1422 int flags; 1422 1423 #endif 1423 1424 int print_message = TRUE; 1424 1425 int len; … … 1530 1531 if (qf_ptr->qf_type == 1 && (!curwin->w_buffer->b_help || cmdmod.tab != 0)) 1531 1532 { 1532 1533 win_T *wp; 1533 int n;1534 1534 1535 1535 if (cmdmod.tab != 0) 1536 1536 wp = NULL; … … 1546 1546 * Split off help window; put it at far top if no position 1547 1547 * specified, the current window is vertically split and narrow. 1548 1548 */ 1549 n= WSP_HELP;1549 flags = WSP_HELP; 1550 1550 # ifdef FEAT_VERTSPLIT 1551 1551 if (cmdmod.split == 0 && curwin->w_width != Columns 1552 1552 && curwin->w_width < 80) 1553 n|= WSP_TOP;1553 flags |= WSP_TOP; 1554 1554 # endif 1555 if (win_split(0, n) == FAIL) 1555 if (qi != &ql_info) 1556 flags |= WSP_NEWLOC; /* don't copy the location list */ 1557 1558 if (win_split(0, flags) == FAIL) 1556 1559 goto theend; 1557 1560 opened_window = TRUE; /* close it when fail */ 1558 1561 … … 1562 1565 if (qi != &ql_info) /* not a quickfix list */ 1563 1566 { 1564 1567 /* The new window should use the supplied location list */ 1565 qf_free_all(curwin);1566 1568 curwin->w_llist = qi; 1567 1569 qi->qf_refcount++; 1568 1570 } … … 1609 1611 { 1610 1612 goto_tabpage_win(tp, wp); 1611 1613 usable_win = 1; 1612 break;1614 goto win_found; 1613 1615 } 1614 1616 } 1615 1617 } 1618 win_found: 1616 1619 1617 1620 /* 1618 1621 * If there is only one window and it is the quickfix window, create a … … 1622 1625 { 1623 1626 ll_ref = curwin->w_llist_ref; 1624 1627 1625 if (win_split(0, WSP_ABOVE) == FAIL) 1628 flags = WSP_ABOVE; 1629 if (ll_ref != NULL) 1630 flags |= WSP_NEWLOC; 1631 if (win_split(0, flags) == FAIL) 1626 1632 goto failed; /* not enough room for window */ 1627 1633 opened_window = TRUE; /* close it when fail */ 1628 1634 p_swb = empty_option; /* don't split again */ … … 1634 1640 { 1635 1641 /* The new window should use the location list from the 1636 1642 * location list window */ 1637 qf_free_all(curwin);1638 1643 curwin->w_llist = ll_ref; 1639 1644 ll_ref->qf_refcount++; 1640 1645 } … … 2307 2312 if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow) 2308 2313 /* Create the new window at the very bottom. */ 2309 2314 win_goto(lastwin); 2310 if (win_split(height, WSP_BELOW ) == FAIL)2315 if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL) 2311 2316 return; /* not enough room for window */ 2312 2317 #ifdef FEAT_SCROLLBIND 2313 2318 curwin->w_p_scb = FALSE; 2314 2319 #endif 2315 2320 2316 /* Remove the location list for the quickfix window */2317 qf_free_all(curwin);2318 2319 2321 if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow) 2320 2322 { 2321 2323 /* -
src/regexp.c
diff -Naur vim72.orig/src/regexp.c vim72/src/regexp.c
old new 4532 4532 cleanup_subexpr(); 4533 4533 if (!REG_MULTI) /* Single-line regexp */ 4534 4534 { 4535 if (reg_ endp[no] == NULL)4535 if (reg_startp[no] == NULL || reg_endp[no] == NULL) 4536 4536 { 4537 4537 /* Backref was not set: Match an empty string. */ 4538 4538 len = 0; … … 4548 4548 } 4549 4549 else /* Multi-line regexp */ 4550 4550 { 4551 if (reg_ endpos[no].lnum < 0)4551 if (reg_startpos[no].lnum < 0 || reg_endpos[no].lnum < 0) 4552 4552 { 4553 4553 /* Backref was not set: Match an empty string. */ 4554 4554 len = 0; … … 7279 7279 } 7280 7280 else 7281 7281 { 7282 if (submatch_match->endp[no] == NULL) 7282 s = submatch_match->startp[no]; 7283 if (s == NULL || submatch_match->endp[no] == NULL) 7283 7284 retval = NULL; 7284 7285 else 7285 {7286 s = submatch_match->startp[no];7287 7286 retval = vim_strnsave(s, (int)(submatch_match->endp[no] - s)); 7288 }7289 7287 } 7290 7288 7291 7289 return retval; -
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), … … 2588 2596 int noinvcur = FALSE; /* don't invert the cursor */ 2589 2597 #ifdef FEAT_VISUAL 2590 2598 pos_T *top, *bot; 2599 int lnum_in_visual_area = FALSE; 2591 2600 #endif 2592 2601 pos_T pos; 2593 2602 long v; … … 2784 2793 top = &VIsual; 2785 2794 bot = &curwin->w_cursor; 2786 2795 } 2796 lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum); 2787 2797 if (VIsual_mode == Ctrl_V) /* block mode */ 2788 2798 { 2789 if (lnum >= top->lnum && lnum <= bot->lnum)2799 if (lnum_in_visual_area) 2790 2800 { 2791 2801 fromcol = wp->w_old_cursor_fcol; 2792 2802 tocol = wp->w_old_cursor_lcol; … … 3412 3422 && (*mb_ptr2cells)(ptr) > 1) 3413 3423 #endif 3414 3424 || ((int)vcol_prev == fromcol_prev 3425 && vcol_prev < vcol /* not at margin */ 3415 3426 && vcol < tocol)) 3416 3427 area_attr = attr; /* start highlighting */ 3417 3428 else if (area_attr != 0 … … 3544 3555 /* Use line_attr when not in the Visual or 'incsearch' area 3545 3556 * (area_attr may be 0 when "noinvcur" is set). */ 3546 3557 else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL) 3547 || (vcol < fromcol || vcol >= tocol))) 3558 || vcol < fromcol || vcol_prev < fromcol_prev 3559 || vcol >= tocol)) 3548 3560 char_attr = line_attr; 3549 3561 #endif 3550 3562 else … … 4549 4561 * highlight the cursor position itself. */ 4550 4562 if (wp->w_p_cuc && vcol == (long)wp->w_virtcol 4551 4563 && lnum != wp->w_cursor.lnum 4552 && draw_state == WL_LINE) 4564 && draw_state == WL_LINE 4565 && !lnum_in_visual_area) 4553 4566 { 4554 4567 vcol_save_attr = char_attr; 4555 4568 char_attr = hl_combine_attr(char_attr, hl_attr(HLF_CUC)); … … 5119 5132 #endif 5120 5133 5121 5134 #if defined(FEAT_GUI) || defined(UNIX) 5122 /* The bold trick makes a single row of pixels appear in the next5123 * character. When a bold character is removed, the next5135 /* The bold trick makes a single column of pixels appear in the 5136 * next character. When a bold character is removed, the next 5124 5137 * character should be redrawn too. This happens for our own GUI 5125 5138 * and for some xterms. */ 5126 5139 if ( … … 6263 6276 int pcc[MAX_MCO]; 6264 6277 # endif 6265 6278 #endif 6279 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) 6280 int force_redraw_this; 6281 int force_redraw_next = FALSE; 6282 #endif 6283 int need_redraw; 6266 6284 6267 6285 if (ScreenLines == NULL || row >= screen_Rows) /* safety check */ 6268 6286 return; 6287 off = LineOffset[row] + col; 6269 6288 6270 6289 #ifdef FEAT_MBYTE 6271 6290 /* When drawing over the right halve of a double-wide char clear out the … … 6275 6294 && !gui.in_use 6276 6295 # endif 6277 6296 && mb_fix_col(col, row) != col) 6278 screen_puts_len((char_u *)" ", 1, row, col - 1, 0); 6297 { 6298 ScreenLines[off - 1] = ' '; 6299 ScreenAttrs[off - 1] = 0; 6300 if (enc_utf8) 6301 { 6302 ScreenLinesUC[off - 1] = 0; 6303 ScreenLinesC[0][off - 1] = 0; 6304 } 6305 /* redraw the previous cell, make it empty */ 6306 screen_char(off - 1, row, col - 1); 6307 /* force the cell at "col" to be redrawn */ 6308 force_redraw_next = TRUE; 6309 } 6279 6310 #endif 6280 6311 6281 off = LineOffset[row] + col;6282 6312 #ifdef FEAT_MBYTE 6283 6313 max_off = LineOffset[row] + screen_Columns; 6284 6314 #endif … … 6342 6372 } 6343 6373 #endif 6344 6374 6345 if (ScreenLines[off] != c 6375 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) 6376 force_redraw_this = force_redraw_next; 6377 force_redraw_next = FALSE; 6378 #endif 6379 6380 need_redraw = ScreenLines[off] != c 6346 6381 #ifdef FEAT_MBYTE 6347 6382 || (mbyte_cells == 2 6348 6383 && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0)) … … 6350 6385 && c == 0x8e 6351 6386 && ScreenLines2[off] != ptr[1]) 6352 6387 || (enc_utf8 6353 && (ScreenLinesUC[off] != (u8char_T) u8c6388 && (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0) 6354 6389 || screen_comp_differs(off, u8cc))) 6355 6390 #endif 6356 6391 || ScreenAttrs[off] != attr 6357 || exmode_active 6392 || exmode_active; 6393 6394 if (need_redraw 6395 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) 6396 || force_redraw_this 6397 #endif 6358 6398 ) 6359 6399 { 6360 6400 #if defined(FEAT_GUI) || defined(UNIX) 6361 6401 /* The bold trick makes a single row of pixels appear in the next 6362 6402 * character. When a bold character is removed, the next 6363 6403 * character should be redrawn too. This happens for our own GUI 6364 * and for some xterms. 6365 * Force the redraw by setting the attribute to a different value 6366 * than "attr", the contents of ScreenLines[] may be needed by 6367 * mb_off2cells() further on. 6368 * Don't do this for the last drawn character, because the next 6369 * character may not be redrawn. */ 6370 if ( 6404 * and for some xterms. */ 6405 if (need_redraw && ScreenLines[off] != ' ' && ( 6371 6406 # ifdef FEAT_GUI 6372 6407 gui.in_use 6373 6408 # endif … … 6377 6412 # ifdef UNIX 6378 6413 term_is_xterm 6379 6414 # endif 6380 6415 )) 6381 6416 { 6382 int n;6417 int n = ScreenAttrs[off]; 6383 6418 6384 n = ScreenAttrs[off]; 6385 # ifdef FEAT_MBYTE 6386 if (col + mbyte_cells < screen_Columns 6387 && (n > HL_ALL || (n & HL_BOLD)) 6388 && (len < 0 ? ptr[mbyte_blen] != NUL 6389 : ptr + mbyte_blen < text + len)) 6390 ScreenAttrs[off + mbyte_cells] = attr + 1; 6391 # else 6392 if (col + 1 < screen_Columns 6393 && (n > HL_ALL || (n & HL_BOLD)) 6394 && (len < 0 ? ptr[1] != NUL : ptr + 1 < text + len)) 6395 ScreenLines[off + 1] = 0; 6396 # endif 6419 if (n > HL_ALL) 6420 n = syn_attr2attr(n); 6421 if (n & HL_BOLD) 6422 force_redraw_next = TRUE; 6397 6423 } 6398 6424 #endif 6399 6425 #ifdef FEAT_MBYTE … … 6480 6506 ++ptr; 6481 6507 } 6482 6508 } 6509 6510 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) 6511 /* If we detected the next character needs to be redrawn, but the text 6512 * doesn't extend up to there, update the character here. */ 6513 if (force_redraw_next && col < screen_Columns) 6514 { 6515 # ifdef FEAT_MBYTE 6516 if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1) 6517 screen_char_2(off, row, col); 6518 else 6519 # endif 6520 screen_char(off, row, col); 6521 } 6522 #endif 6483 6523 } 6484 6524 6485 6525 #ifdef FEAT_SEARCH_EXTRA … … 7356 7396 #endif 7357 7397 static int entered = FALSE; /* avoid recursiveness */ 7358 7398 static int done_outofmem_msg = FALSE; /* did outofmem message */ 7399 #ifdef FEAT_AUTOCMD 7400 int retry_count = 0; 7359 7401 7402 retry: 7403 #endif 7360 7404 /* 7361 7405 * Allocation of the screen buffers is done only when the size changes and 7362 7406 * when Rows and Columns have been set and we have started doing full … … 7440 7484 { 7441 7485 outofmem = TRUE; 7442 7486 #ifdef FEAT_WINDOWS 7443 break;7487 goto give_up; 7444 7488 #endif 7445 7489 } 7446 7490 } 7491 #ifdef FEAT_WINDOWS 7492 give_up: 7493 #endif 7447 7494 7448 7495 #ifdef FEAT_MBYTE 7449 7496 for (i = 0; i < p_mco; ++i) … … 7628 7675 --RedrawingDisabled; 7629 7676 7630 7677 #ifdef FEAT_AUTOCMD 7631 if (starting == 0) 7678 /* 7679 * Do not apply autocommands more than 3 times to avoid an endless loop 7680 * in case applying autocommands always changes Rows or Columns. 7681 */ 7682 if (starting == 0 && ++retry_count <= 3) 7683 { 7632 7684 apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf); 7685 /* In rare cases, autocommands may have altered Rows or Columns, 7686 * jump back to check if we need to allocate the screen again. */ 7687 goto retry; 7688 } 7633 7689 #endif 7634 7690 } 7635 7691 -
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. … … 2237 2376 2238 2377 /* If we are back at the starting line and there is no match then 2239 2378 * give up. */ 2240 if (lnum == wp->w_cursor.lnum && !found_one)2379 if (lnum == wp->w_cursor.lnum && (!found_one || wrapped)) 2241 2380 break; 2242 2381 2243 2382 /* Skip the characters at the start of the next line that were … … 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) … … 4791 4956 * Structure that is used to store the items in the word tree. This avoids 4792 4957 * the need to keep track of each allocated thing, everything is freed all at 4793 4958 * once after ":mkspell" is done. 4959 * Note: "sb_next" must be just before "sb_data" to make sure the alignment of 4960 * "sb_data" is correct for systems where pointers must be aligned on 4961 * pointer-size boundaries and sizeof(pointer) > sizeof(int) (e.g., Sparc). 4794 4962 */ 4795 4963 #define SBLOCKSIZE 16000 /* size of sb_data */ 4796 4964 typedef struct sblock_S sblock_T; 4797 4965 struct sblock_S 4798 4966 { 4799 sblock_T *sb_next; /* next block in list */4800 4967 int sb_used; /* nr of bytes already in use */ 4968 sblock_T *sb_next; /* next block in list */ 4801 4969 char_u sb_data[1]; /* data, actually longer */ 4802 4970 }; 4803 4971 … … 4915 5083 } spellinfo_T; 4916 5084 4917 5085 static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname)); 5086 static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount)); 4918 5087 static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry)); 4919 5088 static int spell_info_item __ARGS((char_u *s)); 4920 5089 static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum)); … … 4950 5119 static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd)); 4951 5120 static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname)); 4952 5121 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));5122 static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree)); 4954 5123 static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname)); 4955 5124 static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang)); 4956 5125 static int sug_maketable __ARGS((spellinfo_T *spin)); … … 5223 5392 /* Handle non-empty lines. */ 5224 5393 if (itemcnt > 0) 5225 5394 { 5226 if (STRCMP(items[0], "SET") == 0 && itemcnt == 2 5227 && aff->af_enc == NULL) 5395 if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL) 5228 5396 { 5229 5397 #ifdef FEAT_MBYTE 5230 5398 /* Setup for conversion from "ENC" to 'encoding'. */ … … 5239 5407 smsg((char_u *)_("Conversion in %s not supported"), fname); 5240 5408 #endif 5241 5409 } 5242 else if ( STRCMP(items[0], "FLAG") == 0 && itemcnt == 25410 else if (is_aff_rule(items, itemcnt, "FLAG", 2) 5243 5411 && aff->af_flagtype == AFT_CHAR) 5244 5412 { 5245 5413 if (STRCMP(items[1], "long") == 0) … … 5284 5452 spin->si_info = p; 5285 5453 } 5286 5454 } 5287 else if ( STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 25455 else if (is_aff_rule(items, itemcnt, "MIDWORD", 2) 5288 5456 && midword == NULL) 5289 5457 { 5290 5458 midword = getroom_save(spin, items[1]); 5291 5459 } 5292 else if ( STRCMP(items[0], "TRY") == 0 && itemcnt == 2)5460 else if (is_aff_rule(items, itemcnt, "TRY", 2)) 5293 5461 { 5294 5462 /* ignored, we look in the tree for what chars may appear */ 5295 5463 } 5296 5464 /* TODO: remove "RAR" later */ 5297 else if (( STRCMP(items[0], "RAR") == 05298 || STRCMP(items[0], "RARE") == 0) && itemcnt == 25299 5465 else if ((is_aff_rule(items, itemcnt, "RAR", 2) 5466 || is_aff_rule(items, itemcnt, "RARE", 2)) 5467 && aff->af_rare == 0) 5300 5468 { 5301 5469 aff->af_rare = affitem2flag(aff->af_flagtype, items[1], 5302 5470 fname, lnum); 5303 5471 } 5304 5472 /* TODO: remove "KEP" later */ 5305 else if (( STRCMP(items[0], "KEP") == 05306 || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 25473 else if ((is_aff_rule(items, itemcnt, "KEP", 2) 5474 || is_aff_rule(items, itemcnt, "KEEPCASE", 2)) 5307 5475 && aff->af_keepcase == 0) 5308 5476 { 5309 5477 aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1], 5310 5478 fname, lnum); 5311 5479 } 5312 else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2 5313 && aff->af_bad == 0) 5480 else if ((is_aff_rule(items, itemcnt, "BAD", 2) 5481 || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2)) 5482 && aff->af_bad == 0) 5314 5483 { 5315 5484 aff->af_bad = affitem2flag(aff->af_flagtype, items[1], 5316 5485 fname, lnum); 5317 5486 } 5318 else if ( STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 25487 else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2) 5319 5488 && aff->af_needaffix == 0) 5320 5489 { 5321 5490 aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1], 5322 5491 fname, lnum); 5323 5492 } 5324 else if ( STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 25493 else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2) 5325 5494 && aff->af_circumfix == 0) 5326 5495 { 5327 5496 aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1], 5328 5497 fname, lnum); 5329 5498 } 5330 else if ( STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 25499 else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2) 5331 5500 && aff->af_nosuggest == 0) 5332 5501 { 5333 5502 aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1], 5334 5503 fname, lnum); 5335 5504 } 5336 else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2 5505 else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2) 5506 || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2)) 5337 5507 && aff->af_needcomp == 0) 5338 5508 { 5339 5509 aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1], 5340 5510 fname, lnum); 5341 5511 } 5342 else if ( STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 25512 else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2) 5343 5513 && aff->af_comproot == 0) 5344 5514 { 5345 5515 aff->af_comproot = affitem2flag(aff->af_flagtype, items[1], 5346 5516 fname, lnum); 5347 5517 } 5348 else if ( STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 05349 && itemcnt == 2&& aff->af_compforbid == 0)5518 else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2) 5519 && aff->af_compforbid == 0) 5350 5520 { 5351 5521 aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1], 5352 5522 fname, lnum); … … 5354 5524 smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), 5355 5525 fname, lnum); 5356 5526 } 5357 else if ( STRCMP(items[0], "COMPOUNDPERMITFLAG") == 05358 && itemcnt == 2&& aff->af_comppermit == 0)5527 else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2) 5528 && aff->af_comppermit == 0) 5359 5529 { 5360 5530 aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1], 5361 5531 fname, lnum); … … 5363 5533 smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), 5364 5534 fname, lnum); 5365 5535 } 5366 else if ( STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 25536 else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2) 5367 5537 && compflags == NULL) 5368 5538 { 5369 5539 /* Turn flag "c" into COMPOUNDRULE compatible string "c+", … … 5376 5546 compflags = p; 5377 5547 } 5378 5548 } 5379 else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2) 5549 else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2)) 5550 { 5551 /* We don't use the count, but do check that it's a number and 5552 * not COMPOUNDRULE mistyped. */ 5553 if (atoi((char *)items[1]) == 0) 5554 smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"), 5555 fname, lnum, items[1]); 5556 } 5557 else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) 5380 5558 { 5381 5559 /* Concatenate this string to previously defined ones, using a 5382 5560 * slash to separate them. */ … … 5395 5573 compflags = p; 5396 5574 } 5397 5575 } 5398 else if ( STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 25576 else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2) 5399 5577 && compmax == 0) 5400 5578 { 5401 5579 compmax = atoi((char *)items[1]); … … 5403 5581 smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), 5404 5582 fname, lnum, items[1]); 5405 5583 } 5406 else if ( STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 25584 else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2) 5407 5585 && compminlen == 0) 5408 5586 { 5409 5587 compminlen = atoi((char *)items[1]); … … 5411 5589 smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"), 5412 5590 fname, lnum, items[1]); 5413 5591 } 5414 else if ( STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 25592 else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2) 5415 5593 && compsylmax == 0) 5416 5594 { 5417 5595 compsylmax = atoi((char *)items[1]); … … 5419 5597 smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), 5420 5598 fname, lnum, items[1]); 5421 5599 } 5422 else if ( STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)5600 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1)) 5423 5601 { 5424 5602 compoptions |= COMP_CHECKDUP; 5425 5603 } 5426 else if ( STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)5604 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1)) 5427 5605 { 5428 5606 compoptions |= COMP_CHECKREP; 5429 5607 } 5430 else if ( STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)5608 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1)) 5431 5609 { 5432 5610 compoptions |= COMP_CHECKCASE; 5433 5611 } 5434 else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0 5435 && itemcnt == 1) 5612 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1)) 5436 5613 { 5437 5614 compoptions |= COMP_CHECKTRIPLE; 5438 5615 } 5439 else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0 5440 && itemcnt == 2) 5616 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2)) 5441 5617 { 5442 5618 if (atoi((char *)items[1]) == 0) 5443 5619 smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), 5444 5620 fname, lnum, items[1]); 5445 5621 } 5446 else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0 5447 && itemcnt == 3) 5622 else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3)) 5448 5623 { 5449 5624 garray_T *gap = &spin->si_comppat; 5450 5625 int i; … … 5463 5638 = getroom_save(spin, items[2]); 5464 5639 } 5465 5640 } 5466 else if ( STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 25641 else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2) 5467 5642 && syllable == NULL) 5468 5643 { 5469 5644 syllable = getroom_save(spin, items[1]); 5470 5645 } 5471 else if ( STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)5646 else if (is_aff_rule(items, itemcnt, "NOBREAK", 1)) 5472 5647 { 5473 5648 spin->si_nobreak = TRUE; 5474 5649 } 5475 else if ( STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)5650 else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1)) 5476 5651 { 5477 5652 spin->si_nosplitsugs = TRUE; 5478 5653 } 5479 else if ( STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)5654 else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1)) 5480 5655 { 5481 5656 spin->si_nosugfile = TRUE; 5482 5657 } 5483 else if ( STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)5658 else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1)) 5484 5659 { 5485 5660 aff->af_pfxpostpone = TRUE; 5486 5661 } … … 5771 5946 } 5772 5947 } 5773 5948 } 5774 else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2 5775 && fol == NULL) 5949 else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL) 5776 5950 { 5777 5951 fol = vim_strsave(items[1]); 5778 5952 } 5779 else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2 5780 && low == NULL) 5953 else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL) 5781 5954 { 5782 5955 low = vim_strsave(items[1]); 5783 5956 } 5784 else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2 5785 && upp == NULL) 5957 else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL) 5786 5958 { 5787 5959 upp = vim_strsave(items[1]); 5788 5960 } 5789 else if ((STRCMP(items[0], "REP") == 0 5790 || STRCMP(items[0], "REPSAL") == 0) 5791 && itemcnt == 2) 5961 else if (is_aff_rule(items, itemcnt, "REP", 2) 5962 || is_aff_rule(items, itemcnt, "REPSAL", 2)) 5792 5963 { 5793 5964 /* Ignore REP/REPSAL count */; 5794 5965 if (!isdigit(*items[1])) … … 5819 5990 : &spin->si_rep, items[1], items[2]); 5820 5991 } 5821 5992 } 5822 else if ( STRCMP(items[0], "MAP") == 0 && itemcnt == 2)5993 else if (is_aff_rule(items, itemcnt, "MAP", 2)) 5823 5994 { 5824 5995 /* MAP item or count */ 5825 5996 if (!found_map) … … 5856 6027 ga_append(&spin->si_map, '/'); 5857 6028 } 5858 6029 } 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] == '#'))) 6030 /* Accept "SAL from to" and "SAL from to #comment". */ 6031 else if (is_aff_rule(items, itemcnt, "SAL", 3)) 5862 6032 { 5863 6033 if (do_sal) 5864 6034 { … … 5877 6047 : items[2]); 5878 6048 } 5879 6049 } 5880 else if ( STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 26050 else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2) 5881 6051 && sofofrom == NULL) 5882 6052 { 5883 6053 sofofrom = getroom_save(spin, items[1]); 5884 6054 } 5885 else if ( STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 26055 else if (is_aff_rule(items, itemcnt, "SOFOTO", 2) 5886 6056 && sofoto == NULL) 5887 6057 { 5888 6058 sofoto = getroom_save(spin, items[1]); … … 5980 6150 else if (spin->si_newprefID == 0 || spin->si_newprefID == 127) 5981 6151 MSG(_("Too many compound flags")); 5982 6152 else 5983 MSG(_("Too many pos poned prefixes and/or compound flags"));6153 MSG(_("Too many postponed prefixes and/or compound flags")); 5984 6154 } 5985 6155 5986 6156 if (syllable != NULL) … … 6017 6187 } 6018 6188 6019 6189 /* 6190 * Return TRUE when items[0] equals "rulename", there are "mincount" items or 6191 * a comment is following after item "mincount". 6192 */ 6193 static int 6194 is_aff_rule(items, itemcnt, rulename, mincount) 6195 char_u **items; 6196 int itemcnt; 6197 char *rulename; 6198 int mincount; 6199 { 6200 return (STRCMP(items[0], rulename) == 0 6201 && (itemcnt == mincount 6202 || (itemcnt > mincount && items[mincount][0] == '#'))); 6203 } 6204 6205 /* 6020 6206 * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from 6021 6207 * ae_flags to ae_comppermit and ae_compforbid. 6022 6208 */ … … 7926 8112 char_u *p; 7927 8113 int rr; 7928 8114 int retval = OK; 8115 size_t fwv = 1; /* collect return value of fwrite() to avoid 8116 warnings from picky compiler */ 7929 8117 7930 8118 fd = mch_fopen((char *)fname, "w"); 7931 8119 if (fd == NULL) … … 7936 8124 7937 8125 /* <HEADER>: <fileID> <versionnr> */ 7938 8126 /* <fileID> */ 7939 if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)7940 {7941 EMSG(_(e_write));7942 retval = FAIL;7943 } 8127 fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd); 8128 if (fwv != (size_t)1) 8129 /* Catch first write error, don't try writing more. */ 8130 goto theend; 8131 7944 8132 putc(VIMSPELLVERSION, fd); /* <versionnr> */ 7945 8133 7946 8134 /* … … 7955 8143 7956 8144 i = (int)STRLEN(spin->si_info); 7957 8145 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ 7958 fw rite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */8146 fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */ 7959 8147 } 7960 8148 7961 8149 /* SN_REGION: <regionname> ... … … 7966 8154 putc(SNF_REQUIRED, fd); /* <sectionflags> */ 7967 8155 l = spin->si_region_count * 2; 7968 8156 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ 7969 fw rite(spin->si_region_name, (size_t)l, (size_t)1, fd);8157 fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd); 7970 8158 /* <regionname> ... */ 7971 8159 regionmask = (1 << spin->si_region_count) - 1; 7972 8160 } … … 8016 8204 } 8017 8205 8018 8206 put_bytes(fd, (long_u)l, 2); /* <folcharslen> */ 8019 fw rite(folchars, (size_t)l, (size_t)1, fd);/* <folchars> */8207 fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */ 8020 8208 } 8021 8209 8022 8210 /* SN_MIDWORD: <midword> */ … … 8027 8215 8028 8216 i = (int)STRLEN(spin->si_midword); 8029 8217 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ 8030 fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */ 8218 fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); 8219 /* <midword> */ 8031 8220 } 8032 8221 8033 8222 /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */ … … 8113 8302 p = rr == 1 ? ftp->ft_from : ftp->ft_to; 8114 8303 l = (int)STRLEN(p); 8115 8304 putc(l, fd); 8116 fwrite(p, l, (size_t)1, fd); 8305 if (l > 0) 8306 fwv &= fwrite(p, l, (size_t)1, fd); 8117 8307 } 8118 8308 } 8119 8309 … … 8131 8321 /* <sectionlen> */ 8132 8322 8133 8323 put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */ 8134 fw rite(spin->si_sofofr, l, (size_t)1, fd);/* <sofofrom> */8324 fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */ 8135 8325 8136 8326 l = (int)STRLEN(spin->si_sofoto); 8137 8327 put_bytes(fd, (long_u)l, 2); /* <sofotolen> */ 8138 fw rite(spin->si_sofoto, l, (size_t)1, fd);/* <sofoto> */8328 fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */ 8139 8329 } 8140 8330 8141 8331 /* SN_WORDS: <word> ... … … 8160 8350 l = (int)STRLEN(hi->hi_key) + 1; 8161 8351 len += l; 8162 8352 if (round == 2) /* <word> */ 8163 fw rite(hi->hi_key, (size_t)l, (size_t)1, fd);8353 fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd); 8164 8354 --todo; 8165 8355 } 8166 8356 if (round == 1) … … 8176 8366 putc(0, fd); /* <sectionflags> */ 8177 8367 l = spin->si_map.ga_len; 8178 8368 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ 8179 fw rite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);8369 fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd); 8180 8370 /* <mapstr> */ 8181 8371 } 8182 8372 … … 8232 8422 { 8233 8423 p = ((char_u **)(spin->si_comppat.ga_data))[i]; 8234 8424 putc((int)STRLEN(p), fd); /* <comppatlen> */ 8235 fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */ 8425 fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd); 8426 /* <comppattext> */ 8236 8427 } 8237 8428 /* <compflags> */ 8238 fw rite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),8429 fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags), 8239 8430 (size_t)1, fd); 8240 8431 } 8241 8432 … … 8259 8450 8260 8451 l = (int)STRLEN(spin->si_syllable); 8261 8452 put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ 8262 fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */ 8453 fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); 8454 /* <syllable> */ 8263 8455 } 8264 8456 8265 8457 /* end of <SECTIONS> */ … … 8295 8487 (void)put_node(fd, tree, 0, regionmask, round == 3); 8296 8488 } 8297 8489 8298 /* Write another byte to check for errors . */8490 /* Write another byte to check for errors (file system full). */ 8299 8491 if (putc(0, fd) == EOF) 8300 8492 retval = FAIL; 8301 8493 theend: 8302 8494 if (fclose(fd) == EOF) 8303 8495 retval = FAIL; 8304 8496 8497 if (fwv != (size_t)1) 8498 retval = FAIL; 8499 if (retval == FAIL) 8500 EMSG(_(e_write)); 8501 8305 8502 return retval; 8306 8503 } 8307 8504 … … 9890 10087 char_u *p; 9891 10088 int len; 9892 10089 int totlen; 10090 size_t x = 1; /* collect return value of fwrite() */ 9893 10091 9894 10092 if (fd != NULL) 9895 10093 put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */ … … 9906 10104 if (fd != NULL) 9907 10105 { 9908 10106 fputc(len, fd); 9909 fwrite(p, (size_t)len, (size_t)1, fd);10107 x &= fwrite(p, (size_t)len, (size_t)1, fd); 9910 10108 } 9911 10109 totlen += len; 9912 10110 } … … 11480 11678 vim_strncpy(preword + sp->ts_prewordlen, 11481 11679 tword + sp->ts_splitoff, 11482 11680 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. */ 11681 11682 /* Verify CHECKCOMPOUNDPATTERN rules. */ 11683 if (match_checkcompoundpattern(preword, sp->ts_prewordlen, 11684 &slang->sl_comppat)) 11490 11685 compound_ok = FALSE; 11491 11686 11687 if (compound_ok) 11688 { 11689 p = preword; 11690 while (*skiptowhite(p) != NUL) 11691 p = skipwhite(skiptowhite(p)); 11692 if (fword_ends && !can_compound(slang, p, 11693 compflags + sp->ts_compsplit)) 11694 /* Compound is not allowed. But it may still be 11695 * possible if we add another (short) word. */ 11696 compound_ok = FALSE; 11697 } 11698 11492 11699 /* Get pointer to last char of previous word. */ 11493 11700 p = preword + sp->ts_prewordlen; 11494 11701 mb_ptr_back(preword, p); … … 11685 11892 && (slang->sl_compsylmax < MAXWLEN 11686 11893 || sp->ts_complen + 1 - sp->ts_compsplit 11687 11894 < 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)))) 11895 && (can_be_compound(sp, slang, 11896 compflags, ((unsigned)flags >> 24)))) 11897 11692 11898 { 11693 11899 try_compound = TRUE; 11694 11900 compflags[sp->ts_complen] = ((unsigned)flags >> 24); … … 14808 15014 14809 15015 case 0: 14810 15016 /* 14811 * Leng hts are equal, thus changes must result in same length: An15017 * Lengths are equal, thus changes must result in same length: An 14812 15018 * insert is only possible in combination with a delete. 14813 15019 * 1: check if for identical strings 14814 15020 */ -
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 515 515 * If a count is supplied to the ":tag <name>" command, then 516 516 * jump to count'th matching tag. 517 517 */ 518 if (type == DT_TAG && count > 0)518 if (type == DT_TAG && *tag != NUL && count > 0) 519 519 cur_match = count - 1; 520 520 521 521 if (type == DT_SELECT || type == DT_JUMP … … 618 618 taglen_advance(taglen); 619 619 MSG_PUTS_ATTR(_("file\n"), hl_attr(HLF_T)); 620 620 621 for (i = 0; i < num_matches ; ++i)621 for (i = 0; i < num_matches && !got_int; ++i) 622 622 { 623 623 parse_match(matches[i], &tagp); 624 624 if (!new_tag && ( … … 655 655 } 656 656 if (msg_col > 0) 657 657 msg_putchar('\n'); 658 if (got_int) 659 break; 658 660 msg_advance(15); 659 661 660 662 /* print any extra fields */ … … 689 691 if (msg_col + ptr2cells(p) >= Columns) 690 692 { 691 693 msg_putchar('\n'); 694 if (got_int) 695 break; 692 696 msg_advance(15); 693 697 } 694 698 p = msg_outtrans_one(p, attr); … … 704 708 if (msg_col > 15) 705 709 { 706 710 msg_putchar('\n'); 711 if (got_int) 712 break; 707 713 msg_advance(15); 708 714 } 709 715 } … … 734 740 { 735 741 if (msg_col + (*p == TAB ? 1 : ptr2cells(p)) > Columns) 736 742 msg_putchar('\n'); 743 if (got_int) 744 break; 737 745 msg_advance(15); 738 746 739 747 /* skip backslash used for escaping command char */ … … 760 768 if (msg_col) 761 769 msg_putchar('\n'); 762 770 ui_breakcheck(); 763 if (got_int)764 {765 got_int = FALSE; /* only stop the listing */766 break;767 }768 771 } 772 if (got_int) 773 got_int = FALSE; /* only stop the listing */ 769 774 ask_for_selection = TRUE; 770 775 } 771 776 #if defined(FEAT_QUICKFIX) && defined(FEAT_EVAL) … … 2542 2547 { 2543 2548 ga_clear_strings(&tag_fnames); 2544 2549 do_tag(NULL, DT_FREE, 0, 0, 0); 2550 tag_freematch(); 2551 2552 # if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 2553 if (ptag_entry.tagname) 2554 { 2555 vim_free(ptag_entry.tagname); 2556 ptag_entry.tagname = NULL; 2557 } 2558 # endif 2545 2559 } 2546 2560 #endif 2547 2561 … … 2725 2739 */ 2726 2740 p_7f = vim_strchr(lbuf, 0x7f); 2727 2741 if (p_7f == NULL) 2742 { 2743 etag_fail: 2744 if (vim_strchr(lbuf, '\n') == NULL) 2745 { 2746 /* Truncated line. Ignore it. */ 2747 if (p_verbose >= 5) 2748 { 2749 verbose_enter(); 2750 MSG(_("Ignoring long line in tags file")); 2751 verbose_leave(); 2752 } 2753 tagp->command = lbuf; 2754 tagp->tagname = lbuf; 2755 tagp->tagname_end = lbuf; 2756 return OK; 2757 } 2728 2758 return FAIL; 2759 } 2729 2760 2730 2761 /* Find ^A. If not found the line number is after the 0x7f */ 2731 2762 p = vim_strchr(p_7f, Ctrl_A); … … 2735 2766 ++p; 2736 2767 2737 2768 if (!VIM_ISDIGIT(*p)) /* check for start of line number */ 2738 return FAIL;2769 goto etag_fail; 2739 2770 tagp->command = p; 2740 2771 2741 2772 … … 2749 2780 /* find end of tagname */ 2750 2781 for (p = p_7f - 1; !vim_iswordc(*p); --p) 2751 2782 if (p == lbuf) 2752 return FAIL;2783 goto etag_fail; 2753 2784 tagp->tagname_end = p + 1; 2754 2785 while (p >= lbuf && vim_iswordc(*p)) 2755 2786 --p; -
src/term.c
diff -Naur vim72.orig/src/term.c vim72/src/term.c
old new 4920 4920 key_name[0] = KEY2TERMCAP0(key); 4921 4921 key_name[1] = KEY2TERMCAP1(key); 4922 4922 if (key_name[0] == KS_KEY) 4923 string[new_slen++] = key_name[1]; /* from ":set <M-b>=xx" */ 4923 { 4924 /* from ":set <M-b>=xx" */ 4925 #ifdef FEAT_MBYTE 4926 if (has_mbyte) 4927 new_slen += (*mb_char2bytes)(key_name[1], string + new_slen); 4928 else 4929 #endif 4930 string[new_slen++] = key_name[1]; 4931 } 4924 4932 else 4925 4933 { 4926 4934 string[new_slen++] = K_SPECIAL; -
src/testdir/Makefile
diff -Naur vim72.orig/src/testdir/Makefile vim72/src/testdir/Makefile
old new 20 20 test48.out test49.out test51.out test52.out test53.out \ 21 21 test54.out test55.out test56.out test57.out test58.out \ 22 22 test59.out test60.out test61.out test62.out test63.out \ 23 test64.out test65.out 23 test64.out test65.out test66.out 24 24 25 25 SCRIPTS_GUI = test16.out 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/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/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/testdir/test66.in
diff -Naur vim72.orig/src/testdir/test66.in vim72/src/testdir/test66.in
old new 1 2 Test for visual block shift and tab characters. 3 4 STARTTEST 5 :so small.vim 6 /^abcdefgh 7 4jI j<<11|D 8 7|a 9 7|a 10 7|a 4k13|4j< 11 :$-4,$w! test.out 12 :$-4,$s/\s\+//g 13 4kI j<< 14 7|a 15 7|a 16 7|a 4k13|4j3< 17 :$-4,$w >> test.out 18 :qa! 19 ENDTEST 20 21 abcdefghijklmnopqrstuvwxyz 22 abcdefghijklmnopqrstuvwxyz 23 abcdefghijklmnopqrstuvwxyz 24 abcdefghijklmnopqrstuvwxyz 25 abcdefghijklmnopqrstuvwxyz -
src/testdir/test66.ok
diff -Naur vim72.orig/src/testdir/test66.ok vim72/src/testdir/test66.ok
old new 1 abcdefghijklmnopqrstuvwxyz 2 abcdefghij 3 abc defghijklmnopqrstuvwxyz 4 abc defghijklmnopqrstuvwxyz 5 abc defghijklmnopqrstuvwxyz 6 abcdefghijklmnopqrstuvwxyz 7 abcdefghij 8 abc defghijklmnopqrstuvwxyz 9 abc defghijklmnopqrstuvwxyz 10 abc defghijklmnopqrstuvwxyz -
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 141, 681 /**/ 682 140, 683 /**/ 684 139, 685 /**/ 686 137, 687 /**/ 688 136, 689 /**/ 690 135, 691 /**/ 692 134, 693 /**/ 694 133, 695 /**/ 696 132, 697 /**/ 698 131, 699 /**/ 700 130, 701 /**/ 702 129, 703 /**/ 704 128, 705 /**/ 706 127, 707 /**/ 708 126, 709 /**/ 710 125, 711 /**/ 712 124, 713 /**/ 714 123, 715 /**/ 716 122, 717 /**/ 718 121, 719 /**/ 720 120, 721 /**/ 722 119, 723 /**/ 724 118, 725 /**/ 726 117, 727 /**/ 728 116, 729 /**/ 730 115, 731 /**/ 732 114, 733 /**/ 734 113, 735 /**/ 736 112, 737 /**/ 738 111, 739 /**/ 740 110, 741 /**/ 742 109, 743 /**/ 744 108, 745 /**/ 746 107, 747 /**/ 748 106, 749 /**/ 750 105, 751 /**/ 752 104, 753 /**/ 754 103, 755 /**/ 756 102, 757 /**/ 758 100, 759 /**/ 760 99, 761 /**/ 762 98, 763 /**/ 764 97, 765 /**/ 766 96, 767 /**/ 768 95, 769 /**/ 770 94, 771 /**/ 772 92, 773 /**/ 774 91, 775 /**/ 776 90, 777 /**/ 778 87, 779 /**/ 780 86, 781 /**/ 782 85, 783 /**/ 784 84, 785 /**/ 786 83, 787 /**/ 788 82, 789 /**/ 790 81, 791 /**/ 792 80, 793 /**/ 794 79, 795 /**/ 796 78, 797 /**/ 798 77, 799 /**/ 800 76, 801 /**/ 802 75, 803 /**/ 804 73, 805 /**/ 806 70, 807 /**/ 808 69, 809 /**/ 810 68, 811 /**/ 812 67, 813 /**/ 814 66, 815 /**/ 816 65, 817 /**/ 818 64, 819 /**/ 820 63, 821 /**/ 822 62, 823 /**/ 824 61, 825 /**/ 826 60, 827 /**/ 828 59, 829 /**/ 830 58, 831 /**/ 832 57, 833 /**/ 834 56, 835 /**/ 836 55, 837 /**/ 838 54, 839 /**/ 840 53, 841 /**/ 842 52, 843 /**/ 844 51, 845 /**/ 846 50, 847 /**/ 848 48, 849 /**/ 850 47, 851 /**/ 852 46, 853 /**/ 854 45, 855 /**/ 856 44, 857 /**/ 858 43, 859 /**/ 860 42, 861 /**/ 862 40, 863 /**/ 864 39, 865 /**/ 866 38, 867 /**/ 868 37, 869 /**/ 870 35, 871 /**/ 872 34, 873 /**/ 874 33, 875 /**/ 876 32, 877 /**/ 878 31, 879 /**/ 880 30, 881 /**/ 882 29, 883 /**/ 884 28, 885 /**/ 886 27, 887 /**/ 888 26, 889 /**/ 890 25, 891 /**/ 892 24, 893 /**/ 894 23, 895 /**/ 896 22, 897 /**/ 898 21, 899 /**/ 900 20, 901 /**/ 902 19, 903 /**/ 904 18, 905 /**/ 906 17, 907 /**/ 908 16, 909 /**/ 910 15, 911 /**/ 912 14, 913 /**/ 914 13, 915 /**/ 916 12, 917 /**/ 918 11, 919 /**/ 920 10, 921 /**/ 922 9, 923 /**/ 924 8, 925 /**/ 926 6, 927 /**/ 928 5, 929 /**/ 930 4, 931 /**/ 932 3, 933 /**/ 934 2, 935 /**/ 936 1, 937 /**/ 680 938 0 681 939 }; 682 940 941 /* 942 * Place to put a short description when adding a feature with a patch. 943 * Keep it short, e.g.,: "relative numbers", "persistent undo". 944 * Also add a comment marker to separate the lines. 945 * See the official Vim patches for the diff format: It must use a context of 946 * one line only. Create it by hand or use "diff -C2" and edit the patch. 947 */ 948 static char *(extra_patches[]) = 949 { /* Add your patch description below this line */ 950 /**/ 951 NULL 952 }; 953 683 954 int 684 955 highest_patch() 685 956 { … … 786 1057 MSG_PUTS(_("\nRISC OS version")); 787 1058 #endif 788 1059 #ifdef VMS 789 MSG_PUTS( "\nOpenVMS version");1060 MSG_PUTS(_("\nOpenVMS version")); 790 1061 # ifdef HAVE_PATHDEF 791 1062 if (*compiled_arch != NUL) 792 1063 { … … 825 1096 } 826 1097 } 827 1098 1099 /* Print the list of extra patch descriptions if there is at least one. */ 1100 if (extra_patches[0] != NULL) 1101 { 1102 MSG_PUTS(_("\nExtra patches: ")); 1103 s = ""; 1104 for (i = 0; extra_patches[i] != NULL; ++i) 1105 { 1106 MSG_PUTS(s); 1107 s = ", "; 1108 MSG_PUTS(extra_patches[i]); 1109 } 1110 } 1111 828 1112 #ifdef MODIFIED_BY 829 1113 MSG_PUTS("\n"); 830 1114 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; … … 1051 1057 #define WSP_HELP 16 /* creating the help window */ 1052 1058 #define WSP_BELOW 32 /* put new window below/right */ 1053 1059 #define WSP_ABOVE 64 /* put new window above/left */ 1060 #define WSP_NEWLOC 128 /* don't copy location list */ 1054 1061 1055 1062 /* 1056 1063 * arguments for gui_set_shellsize() … … 1728 1735 #define VV_MOUSE_COL 51 1729 1736 #define VV_OP 52 1730 1737 #define VV_SEARCHFORWARD 53 1731 #define VV_LEN 54 /* number of v: vars */ 1738 #define VV_OLDFILES 54 1739 #define VV_LEN 55 /* number of v: vars */ 1732 1740 1733 1741 #ifdef FEAT_CLIPBOARD 1734 1742 … … 1979 1987 # endif 1980 1988 #endif 1981 1989 1990 #ifndef FEAT_NETBEANS_INTG 1991 # undef NBDEBUG 1992 #endif 1982 1993 #ifdef NBDEBUG /* Netbeans debugging. */ 1983 1994 # include "nbdebug.h" 1984 1995 #else … … 2054 2065 #define DOSO_VIMRC 1 /* loading vimrc file */ 2055 2066 #define DOSO_GVIMRC 2 /* loading gvimrc file */ 2056 2067 2068 /* flags for read_viminfo() and children */ 2069 #define VIF_WANT_INFO 1 /* load non-mark info */ 2070 #define VIF_WANT_MARKS 2 /* load file marks */ 2071 #define VIF_FORCEIT 4 /* overwrite info already read */ 2072 #define VIF_GET_OLDFILES 8 /* load v:oldfiles */ 2073 2057 2074 #endif /* VIM__H */ -
src/window.c
diff -Naur vim72.orig/src/window.c vim72/src/window.c
old new 12 12 static int path_is_url __ARGS((char_u *p)); 13 13 #if defined(FEAT_WINDOWS) || defined(PROTO) 14 14 static int win_split_ins __ARGS((int size, int flags, win_T *newwin, int dir)); 15 static void win_init __ARGS((win_T *newp, win_T *oldp ));15 static void win_init __ARGS((win_T *newp, win_T *oldp, int flags)); 16 16 static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col)); 17 17 static void frame_setheight __ARGS((frame_T *curfrp, int height)); 18 18 #ifdef FEAT_VERTSPLIT … … 593 593 ++allow_keys; /* no mapping for xchar, but allow key codes */ 594 594 if (xchar == NUL) 595 595 xchar = plain_vgetc(); 596 #ifdef FEAT_LANGMAP597 596 LANGMAP_ADJUST(xchar, TRUE); 598 #endif599 597 --no_mapping; 600 598 --allow_keys; 601 599 #ifdef FEAT_CMDL_INFO … … 912 910 return FAIL; 913 911 914 912 /* make the contents of the new window the same as the current one */ 915 win_init(wp, curwin );913 win_init(wp, curwin, flags); 916 914 } 917 915 918 916 /* … … 1161 1159 * Initialize window "newp" from window "oldp". 1162 1160 * Used when splitting a window and when creating a new tab page. 1163 1161 * The windows will both edit the same buffer. 1162 * WSP_NEWLOC may be specified in flags to prevent the location list from 1163 * being copied. 1164 1164 */ 1165 /*ARGSUSED*/ 1165 1166 static void 1166 win_init(newp, oldp )1167 win_init(newp, oldp, flags) 1167 1168 win_T *newp; 1168 1169 win_T *oldp; 1170 int flags; 1169 1171 { 1170 1172 int i; 1171 1173 … … 1190 1192 copy_jumplist(oldp, newp); 1191 1193 #endif 1192 1194 #ifdef FEAT_QUICKFIX 1193 copy_loclist(oldp, newp); 1195 if (flags & WSP_NEWLOC) 1196 { 1197 /* Don't copy the location list. */ 1198 newp->w_llist = NULL; 1199 newp->w_llist_ref = NULL; 1200 } 1201 else 1202 copy_loclist(oldp, newp); 1194 1203 #endif 1195 1204 if (oldp->w_localdir != NULL) 1196 1205 newp->w_localdir = vim_strsave(oldp->w_localdir); … … 3220 3229 else 3221 3230 { 3222 3231 /* First window in new tab page, initialize it from "oldwin". */ 3223 win_init(curwin, oldwin );3232 win_init(curwin, oldwin, 0); 3224 3233 3225 3234 # ifdef FEAT_SCROLLBIND 3226 3235 /* We don't want scroll-binding in the first window. */ … … 4028 4037 if (mch_dirname(cwd, MAXPATHL) == OK) 4029 4038 globaldir = vim_strsave(cwd); 4030 4039 } 4031 mch_chdir((char *)curwin->w_localdir);4032 shorten_fnames(TRUE);4040 if (mch_chdir((char *)curwin->w_localdir) == 0) 4041 shorten_fnames(TRUE); 4033 4042 } 4034 4043 else if (globaldir != NULL) 4035 4044 { 4036 4045 /* Window doesn't have a local directory and we are not in the global 4037 4046 * directory: Change to the global directory. */ 4038 mch_chdir((char *)globaldir);4047 ignored = mch_chdir((char *)globaldir); 4039 4048 vim_free(globaldir); 4040 4049 globaldir = NULL; 4041 4050 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.