Changeset c2aa910
- Timestamp:
- Oct 16, 2007, 9:17:12 PM (17 years ago)
- Branches:
- clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
- Children:
- 2978738
- Parents:
- 531a4c1
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
BOOK/patches.ent
r531a4c1 rc2aa910 77 77 <!ENTITY texinfo-mbstate_fix-patch-size "4 KB"> 78 78 79 <!ENTITY vim-fixes-patch "vim-&vim-version;-fixes- 3.patch">80 <!ENTITY vim-fixes-patch-md5 " 7d09a01fa76010bf7b33ea7f7772b5f4">81 <!ENTITY vim-fixes-patch-size " 180KB">79 <!ENTITY vim-fixes-patch "vim-&vim-version;-fixes-4.patch"> 80 <!ENTITY vim-fixes-patch-md5 "0a49b64726c44594c73483b8aa26e121"> 81 <!ENTITY vim-fixes-patch-size "248 KB"> 82 82 83 83 <!ENTITY zlib-fpic-patch "zlib-&zlib-version;-fPIC-1.patch"> -
patches/vim-7.1-fixes-4.patch
r531a4c1 rc2aa910 1 1 Submitted By: Jim Gifford (jim at linuxfromscratch dot org) 2 Date: 09-03-20072 Date: 10-16-2007 3 3 Initial Package Version: 7.1 4 4 Origin: Upstream 5 5 Upstream Status: Applied 6 Description: Contains all upstream patches up to 7.1. 0946 Description: Contains all upstream patches up to 7.1.140 7 7 The following patches were skipped 8 0 003 007 041 065 070 072 080 088 091 0928 003 007 041 065 070 072 080 088 091 092 124 126 128 129 134 9 9 10 10 diff -Naur vim71.orig/runtime/doc/change.txt vim71/runtime/doc/change.txt 11 11 --- vim71.orig/runtime/doc/change.txt 2007-05-12 03:18:46.000000000 -0700 12 +++ vim71/runtime/doc/change.txt 2007- 09-03 22:13:15.000000000 -070012 +++ vim71/runtime/doc/change.txt 2007-10-16 14:14:06.000000000 -0700 13 13 @@ -1571,6 +1571,10 @@ 14 14 in their original order, right before the sorted … … 24 24 diff -Naur vim71.orig/runtime/doc/eval.txt vim71/runtime/doc/eval.txt 25 25 --- vim71.orig/runtime/doc/eval.txt 2007-05-12 03:18:46.000000000 -0700 26 +++ vim71/runtime/doc/eval.txt 2007- 09-03 22:13:43.000000000 -070026 +++ vim71/runtime/doc/eval.txt 2007-10-16 14:14:28.000000000 -0700 27 27 @@ -1,4 +1,4 @@ 28 28 -*eval.txt* For Vim version 7.1. Last change: 2007 May 11 29 +*eval.txt* For Vim version 7.1. Last change: 2007 Jul2529 +*eval.txt* For Vim version 7.1. Last change: 2007 Sep 25 30 30 31 31 … … 39 39 complete({startcol}, {matches}) String set Insert mode completion 40 40 complete_add( {expr}) Number add completion match 41 @@ -1602,7 +1603,7 @@ 42 foldtextresult( {lnum}) String text for closed fold at {lnum} 43 foreground( ) Number bring the Vim window to the foreground 44 function( {name}) Funcref reference to function {name} 45 -garbagecollect() none free memory, breaking cyclic references 46 +garbagecollect( [at_exit]) none free memory, breaking cyclic references 47 get( {list}, {idx} [, {def}]) any get item {idx} from {list} or {def} 48 get( {dict}, {key} [, {def}]) any get item {key} from {dict} or {def} 49 getbufline( {expr}, {lnum} [, {end}]) 41 50 @@ -1622,6 +1623,7 @@ 42 51 getline( {lnum}) String line {lnum} of current buffer … … 88 97 |getpos()|. 89 98 For the screen column position use |virtcol()|. 90 @@ -2824,6 +2838,8 @@ 99 @@ -2659,7 +2673,7 @@ 100 {name} can be a user defined function or an internal function. 101 102 103 -garbagecollect() *garbagecollect()* 104 +garbagecollect([at_exit]) *garbagecollect()* 105 Cleanup unused |Lists| and |Dictionaries| that have circular 106 references. There is hardly ever a need to invoke this 107 function, as it is automatically done when Vim runs out of 108 @@ -2669,6 +2683,9 @@ 109 This is useful if you have deleted a very big |List| and/or 110 |Dictionary| with circular references in a script that runs 111 for a long time. 112 + When the optional "at_exit" argument is one, garbage 113 + collection will also be done when exiting Vim, if it wasn't 114 + done before. This is useful when checking for memory leaks. 115 116 get({list}, {idx} [, {default}]) *get()* 117 Get item {idx} from |List| {list}. When this item is not 118 @@ -2824,6 +2841,8 @@ 91 119 given file {fname}. 92 120 If {fname} is a directory, 0 is returned. … … 97 125 getfontname([{name}]) *getfontname()* 98 126 Without an argument returns the name of the normal font being 99 @@ -2912,6 +29 28,28 @@127 @@ -2912,6 +2931,28 @@ 100 128 returned. For an invalid window number {nr}, an empty list is 101 129 returned. Otherwise, same as getqflist(). … … 126 154 Returns a list with all the current quickfix errors. Each 127 155 list item is a dictionary with these entries: 128 @@ -3616,6 +365 4,44 @@156 @@ -3616,6 +3657,44 @@ 129 157 the pattern. 'smartcase' is NOT used. The matching is always 130 158 done like 'magic' is set and 'cpoptions' is empty. … … 171 199 matcharg({nr}) *matcharg()* 172 200 Selects the {nr} match item, as set with a |:match|, 173 @@ -3625,8 +370 1,15 @@201 @@ -3625,8 +3704,15 @@ 174 202 The pattern used. 175 203 When {nr} is not 1, 2 or 3 returns an empty |List|. … … 189 217 matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()* 190 218 Same as match(), but return the index of first character after 191 @@ -4379,7 +446 2,13 @@219 @@ -4379,7 +4465,13 @@ 192 220 When {nr} is zero the current window is used. For a location 193 221 list window, the displayed location list is modified. For an … … 204 232 *setpos()* 205 233 setpos({expr}, {list}) 206 @@ -5022,14 +511 1,12 @@234 @@ -5022,14 +5114,12 @@ 207 235 position, the returned Number will be the column at the end of 208 236 the <Tab>. For example, for a <Tab> in column 1, with 'ts' … … 224 252 diff -Naur vim71.orig/runtime/doc/options.txt vim71/runtime/doc/options.txt 225 253 --- vim71.orig/runtime/doc/options.txt 2007-05-12 03:18:47.000000000 -0700 226 +++ vim71/runtime/doc/options.txt 2007- 09-03 22:14:47.000000000 -0700254 +++ vim71/runtime/doc/options.txt 2007-10-16 14:14:12.000000000 -0700 227 255 @@ -1,4 +1,4 @@ 228 256 -*options.txt* For Vim version 7.1. Last change: 2007 May 11 … … 244 272 diff -Naur vim71.orig/runtime/doc/pattern.txt vim71/runtime/doc/pattern.txt 245 273 --- vim71.orig/runtime/doc/pattern.txt 2007-05-12 03:18:47.000000000 -0700 246 +++ vim71/runtime/doc/pattern.txt 2007- 09-03 22:13:43.000000000 -0700274 +++ vim71/runtime/doc/pattern.txt 2007-10-16 14:14:07.000000000 -0700 247 275 @@ -1212,7 +1212,10 @@ 248 276 {group} must exist at the moment this command is executed. … … 277 305 diff -Naur vim71.orig/runtime/doc/pi_paren.txt vim71/runtime/doc/pi_paren.txt 278 306 --- vim71.orig/runtime/doc/pi_paren.txt 2007-05-12 03:18:47.000000000 -0700 279 +++ vim71/runtime/doc/pi_paren.txt 2007- 09-03 22:15:20.000000000 -0700307 +++ vim71/runtime/doc/pi_paren.txt 2007-10-16 14:14:20.000000000 -0700 280 308 @@ -12,8 +12,8 @@ 281 309 You can avoid loading this plugin by setting the "loaded_matchparen" variable: > … … 291 319 diff -Naur vim71.orig/runtime/doc/usr_41.txt vim71/runtime/doc/usr_41.txt 292 320 --- vim71.orig/runtime/doc/usr_41.txt 2007-05-12 03:18:48.000000000 -0700 293 +++ vim71/runtime/doc/usr_41.txt 2007- 09-03 22:13:43.000000000 -0700321 +++ vim71/runtime/doc/usr_41.txt 2007-10-16 14:14:07.000000000 -0700 294 322 @@ -763,13 +763,22 @@ 295 323 foldtextresult() get the text displayed for a closed fold … … 317 345 diff -Naur vim71.orig/runtime/doc/windows.txt vim71/runtime/doc/windows.txt 318 346 --- vim71.orig/runtime/doc/windows.txt 2007-05-12 03:18:49.000000000 -0700 319 +++ vim71/runtime/doc/windows.txt 2007- 09-03 22:14:47.000000000 -0700347 +++ vim71/runtime/doc/windows.txt 2007-10-16 14:14:12.000000000 -0700 320 348 @@ -132,7 +132,8 @@ 321 349 the same file. Make new window N high (default is to use half … … 347 375 diff -Naur vim71.orig/runtime/filetype.vim vim71/runtime/filetype.vim 348 376 --- vim71.orig/runtime/filetype.vim 2007-05-10 08:14:37.000000000 -0700 349 +++ vim71/runtime/filetype.vim 2007- 09-03 22:12:17.000000000 -0700377 +++ vim71/runtime/filetype.vim 2007-10-16 14:14:01.000000000 -0700 350 378 @@ -1,7 +1,7 @@ 351 379 " Vim support file to detect file types … … 368 396 diff -Naur vim71.orig/runtime/plugin/matchparen.vim vim71/runtime/plugin/matchparen.vim 369 397 --- vim71.orig/runtime/plugin/matchparen.vim 2006-10-12 13:05:05.000000000 -0700 370 +++ vim71/runtime/plugin/matchparen.vim 2007- 09-03 22:15:20.000000000 -0700398 +++ vim71/runtime/plugin/matchparen.vim 2007-10-16 14:14:20.000000000 -0700 371 399 @@ -1,6 +1,6 @@ 372 400 " Vim plugin for showing matching parens … … 450 478 diff -Naur vim71.orig/src/auto/configure vim71/src/auto/configure 451 479 --- vim71.orig/src/auto/configure 2007-05-12 04:49:09.000000000 -0700 452 +++ vim71/src/auto/configure 2007- 09-03 22:12:46.000000000 -0700480 +++ vim71/src/auto/configure 2007-10-16 14:14:06.000000000 -0700 453 481 @@ -3843,7 +3843,9 @@ 454 482 fi … … 464 492 diff -Naur vim71.orig/src/buffer.c vim71/src/buffer.c 465 493 --- vim71.orig/src/buffer.c 2007-05-10 08:25:59.000000000 -0700 466 +++ vim71/src/buffer.c 2007- 09-03 22:14:43.000000000 -0700494 +++ vim71/src/buffer.c 2007-10-16 14:14:41.000000000 -0700 467 495 @@ -171,6 +171,13 @@ 468 496 /* Put the cursor on the first line. */ … … 507 535 buf->b_ml.ml_mfp = NULL; 508 536 buf->b_ml.ml_flags = ML_EMPTY; /* empty buffer */ 509 @@ -4853,7 +4861,7 @@ 537 @@ -4167,29 +4175,35 @@ 538 * mess up the full path name, even though it starts with a '/'. 539 * Also expand when there is ".." in the file name, try to remove it, 540 * because "c:/src/../README" is equal to "c:/README". 541 + * Similarly "c:/src//file" is equal to "c:/src/file". 542 * For MS-Windows also expand names like "longna~1" to "longname". 543 */ 544 #ifdef UNIX 545 return FullName_save(fname, TRUE); 546 #else 547 - if (!vim_isAbsName(fname) || strstr((char *)fname, "..") != NULL 548 -#if defined(MSWIN) || defined(DJGPP) 549 + if (!vim_isAbsName(fname) 550 + || strstr((char *)fname, "..") != NULL 551 + || strstr((char *)fname, "//") != NULL 552 +# ifdef BACKSLASH_IN_FILENAME 553 + || strstr((char *)fname, "\\\\") != NULL 554 +# endif 555 +# if defined(MSWIN) || defined(DJGPP) 556 || vim_strchr(fname, '~') != NULL 557 -#endif 558 +# endif 559 ) 560 return FullName_save(fname, FALSE); 561 562 fname = vim_strsave(fname); 563 564 -#ifdef USE_FNAME_CASE 565 -# ifdef USE_LONG_FNAME 566 +# ifdef USE_FNAME_CASE 567 +# ifdef USE_LONG_FNAME 568 if (USE_LONG_FNAME) 569 -# endif 570 +# endif 571 { 572 if (fname != NULL) 573 fname_case(fname, 0); /* set correct case for file name */ 574 } 575 -#endif 576 +# endif 577 578 return fname; 579 #endif 580 @@ -4853,7 +4867,7 @@ 510 581 */ 511 582 for (e = s; *e != ':' && *e != NUL; ++e) … … 516 587 end = TRUE; 517 588 589 @@ -5507,11 +5521,11 @@ 590 591 #ifdef FEAT_AUTOCMD 592 if (!aucmd) /* Don't trigger BufDelete autocommands here. */ 593 - ++autocmd_block; 594 + block_autocmds(); 595 #endif 596 close_buffer(NULL, buf, DOBUF_WIPE); 597 #ifdef FEAT_AUTOCMD 598 if (!aucmd) 599 - --autocmd_block; 600 + unblock_autocmds(); 601 #endif 602 } 518 603 diff -Naur vim71.orig/src/charset.c vim71/src/charset.c 519 604 --- vim71.orig/src/charset.c 2007-03-24 13:10:37.000000000 -0700 520 +++ vim71/src/charset.c 2007- 09-03 22:15:22.000000000 -0700605 +++ vim71/src/charset.c 2007-10-16 14:14:20.000000000 -0700 521 606 @@ -207,7 +207,10 @@ 522 607 } … … 566 651 diff -Naur vim71.orig/src/configure.in vim71/src/configure.in 567 652 --- vim71.orig/src/configure.in 2007-05-12 02:19:27.000000000 -0700 568 +++ vim71/src/configure.in 2007- 09-03 22:12:46.000000000 -0700653 +++ vim71/src/configure.in 2007-10-16 14:14:06.000000000 -0700 569 654 @@ -423,7 +423,9 @@ 570 655 fi … … 578 663 else 579 664 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc" 665 diff -Naur vim71.orig/src/diff.c vim71/src/diff.c 666 --- vim71.orig/src/diff.c 2007-02-15 16:18:41.000000000 -0800 667 +++ vim71/src/diff.c 2007-10-16 14:14:31.000000000 -0700 668 @@ -840,11 +840,11 @@ 669 tmp_orig, tmp_new); 670 append_redir(cmd, p_srr, tmp_diff); 671 #ifdef FEAT_AUTOCMD 672 - ++autocmd_block; /* Avoid ShellCmdPost stuff */ 673 + block_autocmds(); /* Avoid ShellCmdPost stuff */ 674 #endif 675 (void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT); 676 #ifdef FEAT_AUTOCMD 677 - --autocmd_block; 678 + unblock_autocmds(); 679 #endif 680 vim_free(cmd); 681 } 682 @@ -949,11 +949,11 @@ 683 # endif 684 eap->arg); 685 #ifdef FEAT_AUTOCMD 686 - ++autocmd_block; /* Avoid ShellCmdPost stuff */ 687 + block_autocmds(); /* Avoid ShellCmdPost stuff */ 688 #endif 689 (void)call_shell(buf, SHELL_FILTER | SHELL_COOKED); 690 #ifdef FEAT_AUTOCMD 691 - --autocmd_block; 692 + unblock_autocmds(); 693 #endif 694 } 695 580 696 diff -Naur vim71.orig/src/digraph.c vim71/src/digraph.c 581 697 --- vim71.orig/src/digraph.c 2006-05-02 11:24:04.000000000 -0700 582 +++ vim71/src/digraph.c 2007-09-03 22:13:01.000000000 -0700 698 +++ vim71/src/digraph.c 2007-10-16 14:14:28.000000000 -0700 699 @@ -2028,7 +2028,7 @@ 700 701 ++no_mapping; 702 ++allow_keys; 703 - c = safe_vgetc(); 704 + c = plain_vgetc(); 705 --no_mapping; 706 --allow_keys; 707 if (c != ESC) /* ESC cancels CTRL-K */ 708 @@ -2050,7 +2050,7 @@ 709 #endif 710 ++no_mapping; 711 ++allow_keys; 712 - cc = safe_vgetc(); 713 + cc = plain_vgetc(); 714 --no_mapping; 715 --allow_keys; 716 if (cc != ESC) /* ESC cancels CTRL-K */ 583 717 @@ -2349,8 +2349,10 @@ 584 718 … … 587 721 - /* Stop any active keymap and clear the table. */ 588 722 + /* Stop any active keymap and clear the table. Also remove 589 + * b:keymap_ unload, as no keymap is active now. */723 + * b:keymap_name, as no keymap is active now. */ 590 724 keymap_unload(); 591 725 + do_cmdline_cmd((char_u *)"unlet! b:keymap_name"); … … 603 737 diff -Naur vim71.orig/src/edit.c vim71/src/edit.c 604 738 --- vim71.orig/src/edit.c 2007-05-07 12:43:55.000000000 -0700 605 +++ vim71/src/edit.c 2007-09-03 22:14:45.000000000 -0700 739 +++ vim71/src/edit.c 2007-10-16 14:14:28.000000000 -0700 740 @@ -788,7 +788,7 @@ 741 ins_redraw(FALSE); 742 ++no_mapping; 743 ++allow_keys; 744 - c = safe_vgetc(); 745 + c = plain_vgetc(); 746 --no_mapping; 747 --allow_keys; 748 if (c != Ctrl_N && c != Ctrl_G && c != Ctrl_O) 749 @@ -981,7 +981,7 @@ 750 #ifdef FEAT_NETBEANS_INTG 751 case K_F21: /* NetBeans command */ 752 ++no_mapping; /* don't map the next key hits */ 753 - i = safe_vgetc(); 754 + i = plain_vgetc(); 755 --no_mapping; 756 netbeans_keycommand(i); 757 break; 606 758 @@ -2057,7 +2057,6 @@ 607 759 * case of the originally typed text is used, and the case of the completed … … 668 820 +#ifdef FEAT_MBYTE 669 821 + if (has_mbyte) 670 + { 822 { 823 - for (idx = 0; idx < compl_length; ++idx) 671 824 + p = compl_orig_text; 672 825 + actual_compl_length = 0; 673 826 + while (*p != NUL) 674 + { 827 { 828 - if (was_letter && isupper(compl_orig_text[idx]) 829 - && islower(IObuff[idx])) 675 830 + mb_ptr_adv(p); 676 831 + ++actual_compl_length; … … 684 839 + wca = (int *)alloc(actual_len * sizeof(int)); 685 840 + if (wca != NULL) 686 { 687 - for (idx = 0; idx < compl_length; ++idx) 841 + { 688 842 + p = str; 689 843 + for (i = 0; i < actual_len; ++i) … … 698 852 + p = compl_orig_text; 699 853 + for (i = 0; i < actual_compl_length; ++i) 700 { 701 - if (was_letter && isupper(compl_orig_text[idx]) 702 - && islower(IObuff[idx])) 854 + { 703 855 +#ifdef FEAT_MBYTE 704 856 + if (has_mbyte) … … 825 977 } 826 978 if (add_r == OK) 827 @@ -7215,6 +7311,8 @@ 979 @@ -5128,10 +5224,7 @@ 980 i = 0; 981 for (;;) 982 { 983 - do 984 - nc = safe_vgetc(); 985 - while (nc == K_IGNORE || nc == K_VER_SCROLLBAR 986 - || nc == K_HOR_SCROLLBAR); 987 + nc = plain_vgetc(); 988 #ifdef FEAT_CMDL_INFO 989 if (!(State & CMDLINE) 990 # ifdef FEAT_MBYTE 991 @@ -7215,6 +7308,8 @@ 828 992 p = ml_get_curline(); 829 993 if (cin_iscase(p) || cin_isscopedecl(p) || cin_islabel(30)) … … 834 998 && p[curwin->w_cursor.col - 1] == ':' 835 999 && p[curwin->w_cursor.col - 2] == ':') 836 @@ -7998,7 +8096,8 @@ 1000 @@ -7477,7 +7572,7 @@ 1001 * deleted when ESC is hit. 1002 */ 1003 ++no_mapping; 1004 - regname = safe_vgetc(); 1005 + regname = plain_vgetc(); 1006 #ifdef FEAT_LANGMAP 1007 LANGMAP_ADJUST(regname, TRUE); 1008 #endif 1009 @@ -7488,7 +7583,7 @@ 1010 #ifdef FEAT_CMDL_INFO 1011 add_to_showcmd_c(literally); 1012 #endif 1013 - regname = safe_vgetc(); 1014 + regname = plain_vgetc(); 1015 #ifdef FEAT_LANGMAP 1016 LANGMAP_ADJUST(regname, TRUE); 1017 #endif 1018 @@ -7579,7 +7674,7 @@ 1019 * deleted when ESC is hit. 1020 */ 1021 ++no_mapping; 1022 - c = safe_vgetc(); 1023 + c = plain_vgetc(); 1024 --no_mapping; 1025 switch (c) 1026 { 1027 @@ -7998,7 +8093,8 @@ 837 1028 /* 838 1029 * 0^D and ^^D: remove all indent. … … 844 1035 --curwin->w_cursor.col; 845 1036 (void)del_char(FALSE); /* delete the '^' or '0' */ 1037 @@ -9257,7 +9353,7 @@ 1038 * mode message to be deleted when ESC is hit */ 1039 ++no_mapping; 1040 ++allow_keys; 1041 - c = safe_vgetc(); 1042 + c = plain_vgetc(); 1043 --no_mapping; 1044 --allow_keys; 1045 if (IS_SPECIAL(c) || mod_mask) /* special key */ 1046 @@ -9289,7 +9385,7 @@ 1047 } 1048 ++no_mapping; 1049 ++allow_keys; 1050 - cc = safe_vgetc(); 1051 + cc = plain_vgetc(); 1052 --no_mapping; 1053 --allow_keys; 1054 if (cc != ESC) 846 1055 diff -Naur vim71.orig/src/eval.c vim71/src/eval.c 847 1056 --- vim71.orig/src/eval.c 2007-05-07 12:47:32.000000000 -0700 848 +++ vim71/src/eval.c 2007- 09-03 22:15:36.000000000 -07001057 +++ vim71/src/eval.c 2007-10-16 14:14:38.000000000 -0700 849 1058 @@ -369,17 +369,17 @@ 850 1059 static int ex_let_vars __ARGS((char_u *arg, typval_T *tv, int copy, int semicolon, int var_count, char_u *nextchars)); … … 954 1163 else 955 1164 var_redir_stop(); 956 @@ -1411,7 +1416,8 @@ 1165 @@ -1313,7 +1318,6 @@ 1166 { 1167 hashitem_T *hi; 1168 1169 - clear_tv(&vimvars[idx].vv_tv); 1170 vimvars[idx].vv_tv = *save_tv; 1171 if (vimvars[idx].vv_type == VAR_UNKNOWN) 1172 { 1173 @@ -1357,7 +1361,6 @@ 1174 1175 if (p_verbose == 0) 1176 --emsg_off; 1177 - vimvars[VV_VAL].vv_str = NULL; 1178 restore_vimvar(VV_VAL, &save_val); 1179 1180 return list; 1181 @@ -1411,7 +1414,8 @@ 957 1182 } 958 1183 … … 964 1189 * Call some vimL function and return the result in "*rettv". 965 1190 * Uses argv[argc] for the function arguments. 966 @@ -1484,6 +14 90,7 @@1191 @@ -1484,6 +1488,7 @@ 967 1192 return ret; 968 1193 } … … 972 1197 * Call vimL function "func" and return the result as a string. 973 1198 * Returns NULL when calling the function fails. 974 @@ -1506,8 +151 3,9 @@1199 @@ -1506,8 +1511,9 @@ 975 1200 clear_tv(&rettv); 976 1201 return retval; … … 983 1208 * Call vimL function "func" and return the result as a number. 984 1209 * Returns -1 when calling the function fails. 985 @@ -1530,7 +153 8,7 @@1210 @@ -1530,7 +1536,7 @@ 986 1211 clear_tv(&rettv); 987 1212 return retval; … … 992 1217 /* 993 1218 * Call vimL function "func" and return the result as a list 994 @@ -1556,9 +156 4,9 @@1219 @@ -1556,9 +1562,9 @@ 995 1220 996 1221 return rettv.vval.v_list; … … 1003 1228 * Save the current function call pointer, and set it to NULL. 1004 1229 * Used when executing autocommands and for ":source". 1005 @@ -1691,6 +169 9,7 @@1230 @@ -1691,6 +1697,7 @@ 1006 1231 int semicolon = 0; 1007 1232 char_u op[2]; … … 1011 1236 argend = skip_var_list(arg, &var_count, &semicolon); 1012 1237 if (argend == NULL) 1013 @@ -1707,19 +171 6,19 @@1238 @@ -1707,19 +1714,19 @@ 1014 1239 EMSG(_(e_invarg)); 1015 1240 else if (!ends_excmd(*arg)) … … 1039 1264 eap->nextcmd = check_nextcmd(arg); 1040 1265 } 1041 @@ -1924,10 +193 3,11 @@1266 @@ -1924,10 +1931,11 @@ 1042 1267 * If "empty" is TRUE also list NULL strings as empty strings. 1043 1268 */ … … 1052 1277 hashitem_T *hi; 1053 1278 dictitem_T *di; 1054 @@ -1942,7 +195 2,7 @@1279 @@ -1942,7 +1950,7 @@ 1055 1280 di = HI2DI(hi); 1056 1281 if (empty || di->di_tv.v_type != VAR_STRING … … 1061 1286 } 1062 1287 } 1063 @@ -1951,32 +19 61,38 @@1288 @@ -1951,32 +1959,38 @@ 1064 1289 * List global variables. 1065 1290 */ … … 1107 1332 1108 1333 #ifdef FEAT_WINDOWS 1109 @@ -1984,9 + 2000,11 @@1334 @@ -1984,9 +1998,11 @@ 1110 1335 * List tab page variables. 1111 1336 */ … … 1121 1346 #endif 1122 1347 1123 @@ -1994,39 +201 2,44 @@1348 @@ -1994,39 +2010,44 @@ 1124 1349 * List Vim variables. 1125 1350 */ … … 1173 1398 int error = FALSE; 1174 1399 int len; 1175 @@ -2083,15 +210 6,15 @@1400 @@ -2083,15 +2104,15 @@ 1176 1401 { 1177 1402 switch (*name) … … 1196 1421 EMSG2(_("E738: Can't list variables for %s"), name); 1197 1422 } 1198 @@ -2108,7 +21 31,9 @@1423 @@ -2108,7 +2129,9 @@ 1199 1424 *arg = NUL; 1200 1425 list_one_var_a((char_u *)"", … … 1207 1432 vim_free(tf); 1208 1433 } 1209 @@ -6794,7 +6819,7 @@ 1434 @@ -6105,6 +6128,7 @@ 1435 /* Only do this once. */ 1436 want_garbage_collect = FALSE; 1437 may_garbage_collect = FALSE; 1438 + garbage_collect_at_exit = FALSE; 1439 1440 /* 1441 * 1. Go through all accessible variables and mark all lists and dicts 1442 @@ -6681,7 +6705,7 @@ 1443 dict_T *d = NULL; 1444 typval_T tvkey; 1445 typval_T tv; 1446 - char_u *key; 1447 + char_u *key = NULL; 1448 dictitem_T *item; 1449 char_u *start = skipwhite(*arg + 1); 1450 char_u buf[NUMBUFLEN]; 1451 @@ -6721,20 +6745,24 @@ 1452 clear_tv(&tvkey); 1453 goto failret; 1454 } 1455 - key = get_tv_string_buf_chk(&tvkey, buf); 1456 - if (key == NULL || *key == NUL) 1457 + if (evaluate) 1458 { 1459 - /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ 1460 - if (key != NULL) 1461 - EMSG(_(e_emptykey)); 1462 - clear_tv(&tvkey); 1463 - goto failret; 1464 + key = get_tv_string_buf_chk(&tvkey, buf); 1465 + if (key == NULL || *key == NUL) 1466 + { 1467 + /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ 1468 + if (key != NULL) 1469 + EMSG(_(e_emptykey)); 1470 + clear_tv(&tvkey); 1471 + goto failret; 1472 + } 1473 } 1474 1475 *arg = skipwhite(*arg + 1); 1476 if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */ 1477 { 1478 - clear_tv(&tvkey); 1479 + if (evaluate) 1480 + clear_tv(&tvkey); 1481 goto failret; 1482 } 1483 if (evaluate) 1484 @@ -6794,7 +6822,7 @@ 1210 1485 * "numbuf" is used for a number. 1211 1486 * Does not put quotes around strings, as ":echo" displays values. … … 1216 1491 static char_u * 1217 1492 echo_string(tv, tofree, numbuf, copyID) 1218 @@ -6879,7 +690 4,7 @@1493 @@ -6879,7 +6907,7 @@ 1219 1494 * If the memory is allocated "tofree" is set to it, otherwise NULL. 1220 1495 * "numbuf" is used for a number. … … 1225 1500 static char_u * 1226 1501 tv2string(tv, tofree, numbuf, copyID) 1227 @@ -7043,6 +70 68,7 @@1502 @@ -7043,6 +7071,7 @@ 1228 1503 {"changenr", 0, 0, f_changenr}, 1229 1504 {"char2nr", 1, 1, f_char2nr}, … … 1233 1508 #if defined(FEAT_INS_EXPAND) 1234 1509 {"complete", 2, 2, f_complete}, 1235 @@ -7099,6 +7125,7 @@ 1510 @@ -7082,7 +7111,7 @@ 1511 {"foldtextresult", 1, 1, f_foldtextresult}, 1512 {"foreground", 0, 0, f_foreground}, 1513 {"function", 1, 1, f_function}, 1514 - {"garbagecollect", 0, 0, f_garbagecollect}, 1515 + {"garbagecollect", 0, 1, f_garbagecollect}, 1516 {"get", 2, 3, f_get}, 1517 {"getbufline", 2, 3, f_getbufline}, 1518 {"getbufvar", 2, 2, f_getbufvar}, 1519 @@ -7099,6 +7128,7 @@ 1236 1520 {"getftype", 1, 1, f_getftype}, 1237 1521 {"getline", 1, 2, f_getline}, … … 1241 1525 {"getqflist", 0, 0, f_getqflist}, 1242 1526 {"getreg", 0, 2, f_getreg}, 1243 @@ -7149,7 +717 6,9 @@1527 @@ -7149,7 +7179,9 @@ 1244 1528 {"maparg", 1, 3, f_maparg}, 1245 1529 {"mapcheck", 1, 3, f_mapcheck}, … … 1251 1535 {"matchlist", 2, 4, f_matchlist}, 1252 1536 {"matchstr", 2, 4, f_matchstr}, 1253 @@ -7190,6 +72 19,7 @@1537 @@ -7190,6 +7222,7 @@ 1254 1538 {"setcmdpos", 1, 1, f_setcmdpos}, 1255 1539 {"setline", 2, 2, f_setline}, … … 1259 1543 {"setqflist", 1, 2, f_setqflist}, 1260 1544 {"setreg", 2, 3, f_setreg}, 1261 @@ -8240,6 +827 0,20 @@1545 @@ -8240,6 +8273,20 @@ 1262 1546 } 1263 1547 … … 1280 1564 */ 1281 1565 static void 1282 @@ -10136,7 +10180,13 @@ 1566 @@ -9339,15 +9386,16 @@ 1567 { 1568 typval_T rettv; 1569 char_u *s; 1570 + int retval = FAIL; 1571 1572 copy_tv(tv, &vimvars[VV_VAL].vv_tv); 1573 s = expr; 1574 if (eval1(&s, &rettv, TRUE) == FAIL) 1575 - return FAIL; 1576 + goto theend; 1577 if (*s != NUL) /* check for trailing chars after expr */ 1578 { 1579 EMSG2(_(e_invexpr2), s); 1580 - return FAIL; 1581 + goto theend; 1582 } 1583 if (map) 1584 { 1585 @@ -9366,10 +9414,12 @@ 1586 /* On type error, nothing has been removed; return FAIL to stop the 1587 * loop. The error message was given by get_tv_number_chk(). */ 1588 if (error) 1589 - return FAIL; 1590 + goto theend; 1591 } 1592 + retval = OK; 1593 +theend: 1594 clear_tv(&vimvars[VV_VAL].vv_tv); 1595 - return OK; 1596 + return retval; 1597 } 1598 1599 /* 1600 @@ -9670,6 +9720,9 @@ 1601 /* This is postponed until we are back at the toplevel, because we may be 1602 * using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]". */ 1603 want_garbage_collect = TRUE; 1604 + 1605 + if (argvars[0].v_type != VAR_UNKNOWN && get_tv_number(&argvars[0]) == 1) 1606 + garbage_collect_at_exit = TRUE; 1607 } 1608 1609 /* 1610 @@ -9868,18 +9921,24 @@ 1611 1612 ++no_mapping; 1613 ++allow_keys; 1614 - if (argvars[0].v_type == VAR_UNKNOWN) 1615 - /* getchar(): blocking wait. */ 1616 - n = safe_vgetc(); 1617 - else if (get_tv_number_chk(&argvars[0], &error) == 1) 1618 - /* getchar(1): only check if char avail */ 1619 - n = vpeekc(); 1620 - else if (error || vpeekc() == NUL) 1621 - /* illegal argument or getchar(0) and no char avail: return zero */ 1622 - n = 0; 1623 - else 1624 - /* getchar(0) and char avail: return char */ 1625 - n = safe_vgetc(); 1626 + for (;;) 1627 + { 1628 + if (argvars[0].v_type == VAR_UNKNOWN) 1629 + /* getchar(): blocking wait. */ 1630 + n = safe_vgetc(); 1631 + else if (get_tv_number_chk(&argvars[0], &error) == 1) 1632 + /* getchar(1): only check if char avail */ 1633 + n = vpeekc(); 1634 + else if (error || vpeekc() == NUL) 1635 + /* illegal argument or getchar(0) and no char avail: return zero */ 1636 + n = 0; 1637 + else 1638 + /* getchar(0) and char avail: return char */ 1639 + n = safe_vgetc(); 1640 + if (n == K_IGNORE) 1641 + continue; 1642 + break; 1643 + } 1644 --no_mapping; 1645 --allow_keys; 1646 1647 @@ -10136,7 +10195,13 @@ 1283 1648 if (mch_isdir(fname)) 1284 1649 rettv->vval.v_number = 0; … … 1294 1659 else 1295 1660 rettv->vval.v_number = -1; 1296 @@ -10269,6 +103 19,40@@1661 @@ -10269,6 +10334,39 @@ 1297 1662 } 1298 1663 … … 1319 1684 + if (dict == NULL) 1320 1685 + return; 1321 + ++dict->dv_refcount;1322 1686 + dict_add_nr_str(dict, "group", 0L, syn_id2name(cur->hlg_id)); 1323 1687 + dict_add_nr_str(dict, "pattern", 0L, cur->pattern); … … 1335 1699 */ 1336 1700 static void 1337 @@ -12439,6 +12523,44 @@ 1701 @@ -10290,7 +10388,8 @@ 1702 list_append_number(l, (varnumber_T)0); 1703 list_append_number(l, (fp != NULL) ? (varnumber_T)fp->lnum 1704 : (varnumber_T)0); 1705 - list_append_number(l, (fp != NULL) ? (varnumber_T)fp->col + 1 1706 + list_append_number(l, (fp != NULL) 1707 + ? (varnumber_T)(fp->col == MAXCOL ? MAXCOL : fp->col + 1) 1708 : (varnumber_T)0); 1709 list_append_number(l, 1710 #ifdef FEAT_VIRTUALEDIT 1711 @@ -10785,6 +10884,9 @@ 1712 "gui_gtk2", 1713 # endif 1714 #endif 1715 +#ifdef FEAT_GUI_GNOME 1716 + "gui_gnome", 1717 +#endif 1718 #ifdef FEAT_GUI_MAC 1719 "gui_mac", 1720 #endif 1721 @@ -11471,14 +11573,12 @@ 1722 char_u *xp_arg = NULL; 1723 1724 rettv->v_type = VAR_STRING; 1725 + rettv->vval.v_string = NULL; 1726 1727 #ifdef NO_CONSOLE_INPUT 1728 /* While starting up, there is no place to enter text. */ 1729 if (no_console_input()) 1730 - { 1731 - rettv->vval.v_string = NULL; 1732 return; 1733 - } 1734 #endif 1735 1736 cmd_silent = FALSE; /* Want to see the prompt. */ 1737 @@ -12439,6 +12539,44 @@ 1338 1738 } 1339 1739 … … 1380 1780 */ 1381 1781 static void 1382 @@ -12449,20 +125 71,42 @@1782 @@ -12449,20 +12587,42 @@ 1383 1783 if (rettv_list_alloc(rettv) == OK) 1384 1784 { … … 1429 1829 */ 1430 1830 static void 1431 @@ -13680,7 +138 24,7 @@1831 @@ -13680,7 +13840,7 @@ 1432 1832 } 1433 1833 /* Shorten "remain". */ … … 1438 1838 { 1439 1839 vim_free(remain); 1440 @@ -13919,6 +140 63,8 @@1840 @@ -13919,6 +14079,8 @@ 1441 1841 /* If 'n' flag is used: restore cursor position. */ 1442 1842 if (flags & SP_NOMOVE) … … 1447 1847 p_ws = save_p_ws; 1448 1848 1449 @@ -14498,6 +146 44,66 @@1849 @@ -14498,6 +14660,66 @@ 1450 1850 } 1451 1851 … … 1514 1914 */ 1515 1915 /*ARGSUSED*/ 1516 @@ -14785,6 +1 4991,10 @@1916 @@ -14785,6 +15007,10 @@ 1517 1917 1518 1918 p1 = tv2string(&(*(listitem_T **)s1)->li_tv, &tofree1, numbuf1, 0); … … 1525 1925 res = STRICMP(p1, p2); 1526 1926 else 1527 @@ -15274,7 +15 484,8 @@1927 @@ -15274,7 +15500,8 @@ 1528 1928 1529 1929 rettv->v_type = VAR_STRING; … … 1535 1935 } 1536 1936 1537 @@ -16497,9 +167 08,9 @@1937 @@ -16497,9 +16724,9 @@ 1538 1938 * Returns NULL when there is an error. 1539 1939 */ … … 1547 1947 { 1548 1948 char_u *name; 1549 @@ -16512,6 +167 23,7 @@1949 @@ -16512,6 +16739,7 @@ 1550 1950 list_T *l; 1551 1951 int len; … … 1555 1955 l = varp->vval.v_list; 1556 1956 if (l == NULL) 1557 @@ -16527,6 +167 39,14 @@1957 @@ -16527,6 +16755,14 @@ 1558 1958 if (error) 1559 1959 return NULL; … … 1570 1970 if (pos.col == 0 || (int)pos.col > len + 1) 1571 1971 return NULL; /* invalid column number */ 1572 @@ -16559,7 +167 79,7 @@1972 @@ -16559,7 +16795,7 @@ 1573 1973 pos.coladd = 0; 1574 1974 #endif … … 1579 1979 pos.col = 0; 1580 1980 if (name[1] == '0') /* "w0": first visible line */ 1581 @@ -16577,7 +16 797,7 @@1981 @@ -16577,7 +16813,7 @@ 1582 1982 } 1583 1983 else if (name[0] == '$') /* last column or line */ … … 1588 1988 pos.lnum = curbuf->b_ml.ml_line_count; 1589 1989 pos.col = 0; 1590 @@ -17798,9 +180 18,10 @@1990 @@ -17798,9 +18034,10 @@ 1591 1991 * List the value of one internal variable. 1592 1992 */ … … 1600 2000 char_u *tofree; 1601 2001 char_u *s; 1602 @@ -17808,18 +180 29,21 @@2002 @@ -17808,18 +18045,21 @@ 1603 2003 1604 2004 s = echo_string(&v->di_tv, &tofree, numbuf, ++current_copyID); … … 1625 2025 msg_puts(name); 1626 2026 msg_putchar(' '); 1627 @@ -17847,6 +180 71,11 @@2027 @@ -17847,6 +18087,11 @@ 1628 2028 1629 2029 if (type == VAR_FUNC) … … 1637 2037 1638 2038 /* 1639 @@ -19969,6 +20198,7 @@ 2039 @@ -19136,6 +19381,28 @@ 2040 goto theend; 2041 } 2042 2043 + /* Check if the name is a Funcref. If so, use the value. */ 2044 + if (lv.ll_exp_name != NULL) 2045 + { 2046 + len = (int)STRLEN(lv.ll_exp_name); 2047 + name = deref_func_name(lv.ll_exp_name, &len); 2048 + if (name == lv.ll_exp_name) 2049 + name = NULL; 2050 + } 2051 + else 2052 + { 2053 + len = (int)(end - *pp); 2054 + name = deref_func_name(*pp, &len); 2055 + if (name == *pp) 2056 + name = NULL; 2057 + } 2058 + if (name != NULL) 2059 + { 2060 + name = vim_strsave(name); 2061 + *pp = end; 2062 + goto theend; 2063 + } 2064 + 2065 if (lv.ll_exp_name != NULL) 2066 { 2067 len = (int)STRLEN(lv.ll_exp_name); 2068 @@ -19969,6 +20236,7 @@ 1640 2069 char_u buf[MSG_BUF_LEN]; 1641 2070 char_u numbuf2[NUMBUFLEN]; … … 1645 2074 msg_puts((char_u *)"("); 1646 2075 for (i = 0; i < argcount; ++i) 1647 @@ -19979,10 +202 09,13 @@2076 @@ -19979,10 +20247,13 @@ 1648 2077 msg_outnum((long)argvars[i].vval.v_number); 1649 2078 else … … 1663 2092 } 1664 2093 msg_puts((char_u *)")"); 1665 @@ -20060,14 +20 293,18 @@2094 @@ -20060,14 +20331,18 @@ 1666 2095 char_u buf[MSG_BUF_LEN]; 1667 2096 char_u numbuf2[NUMBUFLEN]; … … 1686 2115 msg_puts((char_u *)"\n"); /* don't overwrite this either */ 1687 2116 2117 @@ -21034,14 +21309,27 @@ 2118 *usedlen += 2; 2119 s = get_past_head(*fnamep); 2120 while (tail > s && after_pathsep(s, tail)) 2121 - --tail; 2122 + mb_ptr_back(*fnamep, tail); 2123 *fnamelen = (int)(tail - *fnamep); 2124 #ifdef VMS 2125 if (*fnamelen > 0) 2126 *fnamelen += 1; /* the path separator is part of the path */ 2127 #endif 2128 - while (tail > s && !after_pathsep(s, tail)) 2129 - mb_ptr_back(*fnamep, tail); 2130 + if (*fnamelen == 0) 2131 + { 2132 + /* Result is empty. Turn it into "." to make ":cd %:h" work. */ 2133 + p = vim_strsave((char_u *)"."); 2134 + if (p == NULL) 2135 + return -1; 2136 + vim_free(*bufp); 2137 + *bufp = *fnamep = tail = p; 2138 + *fnamelen = 1; 2139 + } 2140 + else 2141 + { 2142 + while (tail > s && !after_pathsep(s, tail)) 2143 + mb_ptr_back(*fnamep, tail); 2144 + } 2145 } 2146 2147 /* ":8" - shortname */ 1688 2148 diff -Naur vim71.orig/src/ex_cmds.c vim71/src/ex_cmds.c 1689 2149 --- vim71.orig/src/ex_cmds.c 2007-05-07 12:41:01.000000000 -0700 1690 +++ vim71/src/ex_cmds.c 2007- 09-03 22:15:26.000000000 -07002150 +++ vim71/src/ex_cmds.c 2007-10-16 14:14:28.000000000 -0700 1691 2151 @@ -408,7 +408,11 @@ 1692 2152 goto sortend; … … 1826 2286 } 1827 2287 while (*cmd) 2288 @@ -4464,7 +4498,7 @@ 2289 * 2290 * The new text is built up in new_start[]. It has some extra 2291 * room to avoid using alloc()/free() too often. new_start_len is 2292 - * the lenght of the allocated memory at new_start. 2293 + * the length of the allocated memory at new_start. 2294 * 2295 * Make a copy of the old line, so it won't be taken away when 2296 * updating the screen or handling a multi-line match. The "old_" 2297 @@ -4635,7 +4669,7 @@ 2298 #endif 2299 ++no_mapping; /* don't map this key */ 2300 ++allow_keys; /* allow special keys */ 2301 - i = safe_vgetc(); 2302 + i = plain_vgetc(); 2303 --allow_keys; 2304 --no_mapping; 2305 1828 2306 @@ -6351,9 +6385,9 @@ 1829 2307 for (i = 0; i < ga.ga_len; ++i) … … 1840 2318 diff -Naur vim71.orig/src/ex_docmd.c vim71/src/ex_docmd.c 1841 2319 --- vim71.orig/src/ex_docmd.c 2007-05-07 12:49:38.000000000 -0700 1842 +++ vim71/src/ex_docmd.c 2007- 09-03 22:15:22.000000000 -07002320 +++ vim71/src/ex_docmd.c 2007-10-16 14:14:28.000000000 -0700 1843 2321 @@ -133,6 +133,7 @@ 1844 2322 static void get_flags __ARGS((exarg_T *eap)); … … 1995 2473 * Function called for script command which is Not Implemented. NI! 1996 2474 * Skips over ":perl <<EOF" constructs. 2475 @@ -4376,7 +4403,7 @@ 2476 || vim_strchr(eap->arg, '~') != NULL) 2477 { 2478 expand_env_esc(eap->arg, NameBuff, MAXPATHL, 2479 - TRUE, NULL); 2480 + TRUE, TRUE, NULL); 2481 has_wildcards = mch_has_wildcard(NameBuff); 2482 p = NameBuff; 2483 } 1997 2484 @@ -4492,7 +4519,8 @@ 1998 2485 if (eap->argt & (USECTRLV | XFILE)) … … 2072 2559 diff -Naur vim71.orig/src/ex_eval.c vim71/src/ex_eval.c 2073 2560 --- vim71.orig/src/ex_eval.c 2007-05-07 12:47:50.000000000 -0700 2074 +++ vim71/src/ex_eval.c 2007- 09-03 22:13:59.000000000 -07002561 +++ vim71/src/ex_eval.c 2007-10-16 14:14:09.000000000 -0700 2075 2562 @@ -1551,7 +1551,7 @@ 2076 2563 } … … 2084 2571 diff -Naur vim71.orig/src/ex_getln.c vim71/src/ex_getln.c 2085 2572 --- vim71.orig/src/ex_getln.c 2007-05-07 12:47:23.000000000 -0700 2086 +++ vim71/src/ex_getln.c 2007- 09-03 22:14:17.000000000 -07002573 +++ vim71/src/ex_getln.c 2007-10-16 14:14:34.000000000 -0700 2087 2574 @@ -268,7 +268,9 @@ 2088 2575 { … … 2120 2607 { 2121 2608 /* go down a directory */ 2609 @@ -636,7 +641,7 @@ 2610 { 2611 ++no_mapping; 2612 ++allow_keys; 2613 - c = safe_vgetc(); 2614 + c = plain_vgetc(); 2615 --no_mapping; 2616 --allow_keys; 2617 /* CTRL-\ e doesn't work when obtaining an expression. */ 2122 2618 @@ -730,8 +735,8 @@ 2123 2619 /* In Ex mode a backslash escapes a newline. */ … … 2130 2626 { 2131 2627 if (c == K_KENTER) 2628 @@ -1086,11 +1091,11 @@ 2629 #endif 2630 putcmdline('"', TRUE); 2631 ++no_mapping; 2632 - i = c = safe_vgetc(); /* CTRL-R <char> */ 2633 + i = c = plain_vgetc(); /* CTRL-R <char> */ 2634 if (i == Ctrl_O) 2635 i = Ctrl_R; /* CTRL-R CTRL-O == CTRL-R CTRL-R */ 2636 if (i == Ctrl_R) 2637 - c = safe_vgetc(); /* CTRL-R CTRL-R <char> */ 2638 + c = plain_vgetc(); /* CTRL-R CTRL-R <char> */ 2639 --no_mapping; 2640 #ifdef FEAT_EVAL 2641 /* 2132 2642 @@ -2090,11 +2095,11 @@ 2133 2643 garray_T line_ga; … … 2176 2686 msg_putchar('\n'); 2177 2687 else if (c1 == TAB) 2178 @@ -4148,13 +4153,19 @@ 2688 @@ -3311,6 +3316,10 @@ 2689 * Return a pointer to alloced memory containing the new string. 2690 * Return NULL for failure. 2691 * 2692 + * "orig" is the originally expanded string, copied to allocated memory. It 2693 + * should either be kept in orig_save or freed. When "mode" is WILD_NEXT or 2694 + * WILD_PREV "orig" should be NULL. 2695 + * 2696 * Results are cached in xp->xp_files and xp->xp_numfiles, except when "mode" 2697 * is WILD_EXPAND_FREE or WILD_ALL. 2698 * 2699 @@ -3395,7 +3404,7 @@ 2700 return NULL; 2701 } 2702 2703 -/* free old names */ 2704 + /* free old names */ 2705 if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) 2706 { 2707 FreeWild(xp->xp_numfiles, xp->xp_files); 2708 @@ -3536,6 +3545,10 @@ 2709 if (mode == WILD_EXPAND_FREE || mode == WILD_ALL) 2710 ExpandCleanup(xp); 2711 2712 + /* Free "orig" if it wasn't stored in "orig_save". */ 2713 + if (orig != orig_save) 2714 + vim_free(orig); 2715 + 2716 return ss; 2717 } 2718 2719 @@ -4148,13 +4161,19 @@ 2179 2720 2180 2721 #ifdef FEAT_EVAL … … 2196 2737 else 2197 2738 #endif 2198 @@ -4295,10 +43 06,11 @@2739 @@ -4295,10 +4314,11 @@ 2199 2740 && pat[i + 1] == '\\' 2200 2741 && pat[i + 2] == '\\' … … 2210 2751 } 2211 2752 2212 @@ -4502,6 +45 14,12 @@2753 @@ -4502,6 +4522,12 @@ 2213 2754 if (xp->xp_context != EXPAND_MENUNAMES && xp->xp_context != EXPAND_MENUS) 2214 2755 sort_strings(*file, *num_file); … … 2223 2764 } 2224 2765 2225 @@ -4535,7 +45 53,7 @@2766 @@ -4535,7 +4561,7 @@ 2226 2767 pat = vim_strsave(filepat); 2227 2768 for (i = 0; pat[i]; ++i) … … 2232 2773 flags |= EW_FILE | EW_EXEC; 2233 2774 2775 @@ -5907,7 +5933,7 @@ 2776 2777 # ifdef FEAT_AUTOCMD 2778 /* Don't execute autocommands while creating the window. */ 2779 - ++autocmd_block; 2780 + block_autocmds(); 2781 # endif 2782 /* don't use a new tab page */ 2783 cmdmod.tab = 0; 2784 @@ -5916,6 +5942,9 @@ 2785 if (win_split((int)p_cwh, WSP_BOT) == FAIL) 2786 { 2787 beep_flush(); 2788 +# ifdef FEAT_AUTOCMD 2789 + unblock_autocmds(); 2790 +# endif 2791 return K_IGNORE; 2792 } 2793 cmdwin_type = ccline.cmdfirstc; 2794 @@ -5938,7 +5967,7 @@ 2795 2796 # ifdef FEAT_AUTOCMD 2797 /* Do execute autocommands for setting the filetype (load syntax). */ 2798 - --autocmd_block; 2799 + unblock_autocmds(); 2800 # endif 2801 2802 /* Showing the prompt may have set need_wait_return, reset it. */ 2803 @@ -6092,7 +6121,7 @@ 2804 2805 # ifdef FEAT_AUTOCMD 2806 /* Don't execute autocommands while deleting the window. */ 2807 - ++autocmd_block; 2808 + block_autocmds(); 2809 # endif 2810 wp = curwin; 2811 bp = curbuf; 2812 @@ -6104,7 +6133,7 @@ 2813 win_size_restore(&winsizes); 2814 2815 # ifdef FEAT_AUTOCMD 2816 - --autocmd_block; 2817 + unblock_autocmds(); 2818 # endif 2819 } 2820 2234 2821 diff -Naur vim71.orig/src/feature.h vim71/src/feature.h 2235 2822 --- vim71.orig/src/feature.h 2007-05-07 12:33:19.000000000 -0700 2236 +++ vim71/src/feature.h 2007- 09-03 22:14:03.000000000 -07002823 +++ vim71/src/feature.h 2007-10-16 14:14:09.000000000 -0700 2237 2824 @@ -673,7 +673,7 @@ 2238 2825 # define ESC_CHG_TO_ENG_MODE /* if defined, when ESC pressed, … … 2246 2833 diff -Naur vim71.orig/src/fileio.c vim71/src/fileio.c 2247 2834 --- vim71.orig/src/fileio.c 2007-05-10 04:29:44.000000000 -0700 2248 +++ vim71/src/fileio.c 2007- 09-03 22:14:43.000000000 -07002835 +++ vim71/src/fileio.c 2007-10-16 14:14:38.000000000 -0700 2249 2836 @@ -44,6 +44,10 @@ 2250 2837 /* Is there any system that doesn't have access()? */ … … 2401 2988 { 2402 2989 if (vim_strchr(p_cpo, CPO_FWRITE) != NULL) 2990 @@ -5495,6 +5553,8 @@ 2991 } 2992 #endif 2993 2994 +#if defined(FEAT_VIMINFO) || defined(FEAT_BROWSE) || \ 2995 + defined(FEAT_QUICKFIX) || defined(PROTO) 2996 /* 2997 * Try to find a shortname by comparing the fullname with the current 2998 * directory. 2999 @@ -5548,6 +5608,7 @@ 3000 p = NULL; 3001 return p; 3002 } 3003 +#endif 3004 3005 /* 3006 * Shorten filenames for all buffers. 3007 @@ -7107,6 +7168,7 @@ 3008 3009 static event_T last_event; 3010 static int last_group; 3011 +static int autocmd_blocked = 0; /* block all autocmds */ 3012 3013 /* 3014 * Show the autocommands for one AutoPat. 3015 @@ -8396,7 +8458,7 @@ 3016 * Quickly return if there are no autocommands for this event or 3017 * autocommands are blocked. 3018 */ 3019 - if (first_autopat[(int)event] == NULL || autocmd_block > 0) 3020 + if (first_autopat[(int)event] == NULL || autocmd_blocked > 0) 3021 goto BYPASS_AU; 3022 3023 /* 3024 @@ -8710,6 +8772,40 @@ 3025 return retval; 3026 } 3027 3028 +# ifdef FEAT_EVAL 3029 +static char_u *old_termresponse = NULL; 3030 +# endif 3031 + 3032 +/* 3033 + * Block triggering autocommands until unblock_autocmd() is called. 3034 + * Can be used recursively, so long as it's symmetric. 3035 + */ 3036 + void 3037 +block_autocmds() 3038 +{ 3039 +# ifdef FEAT_EVAL 3040 + /* Remember the value of v:termresponse. */ 3041 + if (autocmd_blocked == 0) 3042 + old_termresponse = get_vim_var_str(VV_TERMRESPONSE); 3043 +# endif 3044 + ++autocmd_blocked; 3045 +} 3046 + 3047 + void 3048 +unblock_autocmds() 3049 +{ 3050 + --autocmd_blocked; 3051 + 3052 +# ifdef FEAT_EVAL 3053 + /* When v:termresponse was set while autocommands were blocked, trigger 3054 + * the autocommands now. Esp. useful when executing a shell command 3055 + * during startup (vimdiff). */ 3056 + if (autocmd_blocked == 0 3057 + && get_vim_var_str(VV_TERMRESPONSE) != old_termresponse) 3058 + apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, FALSE, curbuf); 3059 +# endif 3060 +} 3061 + 3062 /* 3063 * Find next autocommand pattern that matches. 3064 */ 3065 diff -Naur vim71.orig/src/fold.c vim71/src/fold.c 3066 --- vim71.orig/src/fold.c 2007-05-07 12:46:32.000000000 -0700 3067 +++ vim71/src/fold.c 2007-10-16 14:14:41.000000000 -0700 3068 @@ -858,7 +858,14 @@ 3069 || foldmethodIsDiff(wp) 3070 #endif 3071 || foldmethodIsSyntax(wp)) 3072 + { 3073 + int save_got_int = got_int; 3074 + 3075 + /* reset got_int here, otherwise it won't work */ 3076 + got_int = FALSE; 3077 foldUpdateIEMS(wp, top, bot); 3078 + got_int |= save_got_int; 3079 + } 3080 } 3081 3082 /* foldUpdateAll() {{{2 */ 3083 diff -Naur vim71.orig/src/getchar.c vim71/src/getchar.c 3084 --- vim71.orig/src/getchar.c 2007-05-07 12:18:20.000000000 -0700 3085 +++ vim71/src/getchar.c 2007-10-16 14:14:28.000000000 -0700 3086 @@ -1596,8 +1596,16 @@ 3087 continue; 3088 } 3089 #endif 3090 - 3091 #ifdef FEAT_GUI 3092 + /* Handle focus event here, so that the caller doesn't need to 3093 + * know about it. Return K_IGNORE so that we loop once (needed if 3094 + * 'lazyredraw' is set). */ 3095 + if (c == K_FOCUSGAINED || c == K_FOCUSLOST) 3096 + { 3097 + ui_focus_change(c == K_FOCUSGAINED); 3098 + c = K_IGNORE; 3099 + } 3100 + 3101 /* Translate K_CSI to CSI. The special key is only used to avoid 3102 * it being recognized as the start of a special key. */ 3103 if (c == K_CSI) 3104 @@ -1741,6 +1749,22 @@ 3105 } 3106 3107 /* 3108 + * Like safe_vgetc(), but loop to handle K_IGNORE. 3109 + * Also ignore scrollbar events. 3110 + */ 3111 + int 3112 +plain_vgetc() 3113 +{ 3114 + int c; 3115 + 3116 + do 3117 + { 3118 + c = safe_vgetc(); 3119 + } while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR); 3120 + return c; 3121 +} 3122 + 3123 +/* 3124 * Check if a character is available, such that vgetc() will not block. 3125 * If the next character is a special character or multi-byte, the returned 3126 * character is not valid!. 2403 3127 diff -Naur vim71.orig/src/globals.h vim71/src/globals.h 2404 3128 --- vim71.orig/src/globals.h 2007-05-07 12:44:26.000000000 -0700 2405 +++ vim71/src/globals.h 2007-09-03 22:15:45.000000000 -0700 2406 @@ -801,7 +801,7 @@ 3129 +++ vim71/src/globals.h 2007-10-16 14:14:31.000000000 -0700 3130 @@ -301,13 +301,17 @@ 3131 #endif 3132 3133 #ifdef FEAT_EVAL 3134 -/* Garbage collection can only take place when we are sure there are no Lists 3135 +/* 3136 + * Garbage collection can only take place when we are sure there are no Lists 3137 * or Dictionaries being used internally. This is flagged with 3138 * "may_garbage_collect" when we are at the toplevel. 3139 * "want_garbage_collect" is set by the garbagecollect() function, which means 3140 - * we do garbage collection before waiting for a char at the toplevel. */ 3141 + * we do garbage collection before waiting for a char at the toplevel. 3142 + * "garbage_collect_at_exit" indicates garbagecollect(1) was called. 3143 + */ 3144 EXTERN int may_garbage_collect INIT(= FALSE); 3145 EXTERN int want_garbage_collect INIT(= FALSE); 3146 +EXTERN int garbage_collect_at_exit INIT(= FALSE); 3147 3148 /* ID of script being sourced or was sourced to define the current function. */ 3149 EXTERN scid_T current_SID INIT(= 0); 3150 @@ -362,7 +366,6 @@ 3151 EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */ 3152 EXTERN int autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */ 3153 EXTERN int autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */ 3154 -EXTERN int autocmd_block INIT(= 0); /* block all autocmds */ 3155 EXTERN int modified_was_set; /* did ":set modified" */ 3156 EXTERN int did_filetype INIT(= FALSE); /* FileType event found */ 3157 EXTERN int keep_filetype INIT(= FALSE); /* value for did_filetype when 3158 @@ -801,7 +804,7 @@ 2407 3159 EXTERN int (*mb_char2bytes) __ARGS((int c, char_u *buf)) INIT(= latin_char2bytes); 2408 3160 EXTERN int (*mb_ptr2cells) __ARGS((char_u *p)) INIT(= latin_ptr2cells); … … 2415 3167 diff -Naur vim71.orig/src/gui.c vim71/src/gui.c 2416 3168 --- vim71.orig/src/gui.c 2007-05-07 12:50:55.000000000 -0700 2417 +++ vim71/src/gui.c 2007- 09-03 22:15:45.000000000 -07003169 +++ vim71/src/gui.c 2007-10-16 14:14:28.000000000 -0700 2418 3170 @@ -1080,7 +1080,8 @@ 2419 3171 cur_width = gui.char_width; … … 2435 3187 text_area_y += gui.tabline_height; 2436 3188 #endif 2437 @@ -5117,7 +5118,7 @@ 3189 @@ -4518,7 +4519,18 @@ 3190 xim_set_focus(in_focus); 3191 # endif 3192 3193 - ui_focus_change(in_focus); 3194 + /* Put events in the input queue only when allowed. 3195 + * ui_focus_change() isn't called directly, because it invokes 3196 + * autocommands and that must not happen asynchronously. */ 3197 + if (!hold_gui_events) 3198 + { 3199 + char_u bytes[3]; 3200 + 3201 + bytes[0] = CSI; 3202 + bytes[1] = KS_EXTRA; 3203 + bytes[2] = in_focus ? (int)KE_FOCUSGAINED : (int)KE_FOCUSLOST; 3204 + add_to_input_buf(bytes, 3); 3205 + } 3206 #endif 3207 } 3208 3209 @@ -5117,7 +5129,7 @@ 2438 3210 p = vim_strsave_escaped(fnames[i], (char_u *)"\\ \t\"|"); 2439 3211 # endif … … 2446 3218 diff -Naur vim71.orig/src/gui_gtk.c vim71/src/gui_gtk.c 2447 3219 --- vim71.orig/src/gui_gtk.c 2007-05-10 01:37:37.000000000 -0700 2448 +++ vim71/src/gui_gtk.c 2007- 09-03 22:14:50.000000000 -07003220 +++ vim71/src/gui_gtk.c 2007-10-16 14:14:12.000000000 -0700 2449 3221 @@ -53,8 +53,8 @@ 2450 3222 # ifdef bindtextdomain … … 2492 3264 diff -Naur vim71.orig/src/gui_gtk_x11.c vim71/src/gui_gtk_x11.c 2493 3265 --- vim71.orig/src/gui_gtk_x11.c 2007-05-10 01:37:49.000000000 -0700 2494 +++ vim71/src/gui_gtk_x11.c 2007- 09-03 22:12:35.000000000 -07003266 +++ vim71/src/gui_gtk_x11.c 2007-10-16 14:14:28.000000000 -0700 2495 3267 @@ -36,8 +36,8 @@ 2496 3268 # ifdef bindtextdomain … … 2504 3276 # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS) 2505 3277 # define ENABLE_NLS /* so the texts in the dialog boxes are translated */ 2506 @@ -2188,8 +2188,10 @@ 3278 @@ -813,10 +813,15 @@ 3279 if (blink_state == BLINK_NONE) 3280 gui_mch_start_blink(); 3281 3282 - /* make sure keyboard input goes to the draw area (if this is focus for a window) */ 3283 + /* make sure keyboard input goes to the draw area (if this is focus for a 3284 + * window) */ 3285 if (widget != gui.drawarea) 3286 gtk_widget_grab_focus(gui.drawarea); 3287 3288 + /* make sure the input buffer is read */ 3289 + if (gtk_main_level() > 0) 3290 + gtk_main_quit(); 3291 + 3292 return TRUE; 3293 } 3294 3295 @@ -829,6 +834,10 @@ 3296 if (blink_state != BLINK_NONE) 3297 gui_mch_stop_blink(); 3298 3299 + /* make sure the input buffer is read */ 3300 + if (gtk_main_level() > 0) 3301 + gtk_main_quit(); 3302 + 3303 return TRUE; 3304 } 3305 3306 @@ -2188,8 +2197,10 @@ 2507 3307 escaped_filename = vim_strsave_escaped(filename, escape_chars); 2508 3308 if (escaped_filename == NULL) … … 2516 3316 * Use a reasonable hardcoded set of 'sessionoptions' flags to avoid 2517 3317 * unpredictable effects when the session is saved automatically. Also, 2518 @@ -2199,7 +22 01,7 @@3318 @@ -2199,7 +2210,7 @@ 2519 3319 */ 2520 3320 save_ssop_flags = ssop_flags; … … 2525 3325 do_cmdline_cmd((char_u *)"let Save_VV_this_session = v:this_session"); 2526 3326 failed = (do_cmdline_cmd((char_u *)mksession_cmdline) == FAIL); 3327 @@ -3212,8 +3223,9 @@ 3328 { 3329 if (clicked_page == 0) 3330 { 3331 - /* Click after all tabs moves to next tab page. */ 3332 - if (send_tabline_event(0) && gtk_main_level() > 0) 3333 + /* Click after all tabs moves to next tab page. When "x" is 3334 + * small guess it's the left button. */ 3335 + if (send_tabline_event(x < 50 ? -1 : 0) && gtk_main_level() > 0) 3336 gtk_main_quit(); 3337 } 3338 #ifndef HAVE_GTK2 2527 3339 diff -Naur vim71.orig/src/if_cscope.c vim71/src/if_cscope.c 2528 3340 --- vim71.orig/src/if_cscope.c 2007-03-11 07:29:57.000000000 -0700 2529 +++ vim71/src/if_cscope.c 2007-09-03 22:15:31.000000000 -0700 2530 @@ -73,6 +73,8 @@ 3341 +++ vim71/src/if_cscope.c 2007-10-16 14:14:28.000000000 -0700 3342 @@ -24,11 +24,6 @@ 3343 /* not UNIX, must be WIN32 */ 3344 # include "vimio.h" 3345 # include <fcntl.h> 3346 -# include <process.h> 3347 -# define STDIN_FILENO 0 3348 -# define STDOUT_FILENO 1 3349 -# define STDERR_FILENO 2 3350 -# define pipe(fds) _pipe(fds, 256, O_TEXT|O_NOINHERIT) 3351 #endif 3352 #include "if_cscope.h" 3353 3354 @@ -65,7 +60,7 @@ 3355 static char * cs_parse_results __ARGS((int cnumber, char *buf, int bufsize, char **context, char **linenumber, char **search)); 3356 static char * cs_pathcomponents __ARGS((char *path)); 3357 static void cs_print_tags_priv __ARGS((char **, char **, int)); 3358 -static int cs_read_prompt __ARGS((int )); 3359 +static int cs_read_prompt __ARGS((int)); 3360 static void cs_release_csp __ARGS((int, int freefnpp)); 3361 static int cs_reset __ARGS((exarg_T *eap)); 3362 static char * cs_resolve_file __ARGS((int, char *)); 3363 @@ -73,6 +68,8 @@ 2531 3364 2532 3365 … … 2537 3370 { 2538 3371 { "add", cs_add, 2539 @@ -260,14 +2 62,7 @@3372 @@ -260,14 +257,7 @@ 2540 3373 2541 3374 if ((p = cs_manage_matches(NULL, NULL, -1, Get)) == NULL) … … 2553 3386 return FALSE; 2554 3387 } /* cs_fgets */ 2555 @@ -386,7 +3 81,7 @@3388 @@ -386,7 +376,7 @@ 2556 3389 * PRIVATE: cs_add 2557 3390 * … … 2562 3395 * MAXPATHL 256 2563 3396 */ 2564 @@ -966,7 +961,7 @@ 3397 @@ -509,7 +499,7 @@ 3398 #if defined(UNIX) 3399 else if (S_ISREG(statbuf.st_mode) || S_ISLNK(statbuf.st_mode)) 3400 #else 3401 - /* substitute define S_ISREG from os_unix.h */ 3402 + /* WIN32 - substitute define S_ISREG from os_unix.h */ 3403 else if (((statbuf.st_mode) & S_IFMT) == S_IFREG) 3404 #endif 3405 { 3406 @@ -722,17 +712,32 @@ 3407 cs_create_connection(i) 3408 int i; 3409 { 3410 - int to_cs[2], from_cs[2], len; 3411 - char *prog, *cmd, *ppath = NULL; 3412 -#ifndef UNIX 3413 - int in_save, out_save, err_save; 3414 - long_i ph; 3415 -# ifdef FEAT_GUI 3416 - HWND activewnd = NULL; 3417 - HWND consolewnd = NULL; 3418 +#ifdef UNIX 3419 + int to_cs[2], from_cs[2]; 3420 +#endif 3421 + int len; 3422 + char *prog, *cmd, *ppath = NULL; 3423 +#ifdef WIN32 3424 + int fd; 3425 + SECURITY_ATTRIBUTES sa; 3426 + PROCESS_INFORMATION pi; 3427 + STARTUPINFO si; 3428 + BOOL pipe_stdin = FALSE, pipe_stdout = FALSE; 3429 + HANDLE stdin_rd, stdout_rd; 3430 + HANDLE stdout_wr, stdin_wr; 3431 + BOOL created; 3432 +# ifdef __BORLANDC__ 3433 +# define OPEN_OH_ARGTYPE long 3434 +# else 3435 +# if (_MSC_VER >= 1300) 3436 +# define OPEN_OH_ARGTYPE intptr_t 3437 +# else 3438 +# define OPEN_OH_ARGTYPE long 3439 +# endif 3440 # endif 3441 #endif 3442 3443 +#if defined(UNIX) 3444 /* 3445 * Cscope reads from to_cs[0] and writes to from_cs[1]; vi reads from 3446 * from_cs[0] and writes to to_cs[1]. 3447 @@ -753,18 +758,12 @@ 3448 return CSCOPE_FAILURE; 3449 } 3450 3451 -#if defined(UNIX) 3452 switch (csinfo[i].pid = fork()) 3453 { 3454 case -1: 3455 (void)EMSG(_("E622: Could not fork for cscope")); 3456 goto err_closing; 3457 case 0: /* child: run cscope. */ 3458 -#else 3459 - in_save = dup(STDIN_FILENO); 3460 - out_save = dup(STDOUT_FILENO); 3461 - err_save = dup(STDERR_FILENO); 3462 -#endif 3463 if (dup2(to_cs[0], STDIN_FILENO) == -1) 3464 PERROR("cs_create_connection 1"); 3465 if (dup2(from_cs[1], STDOUT_FILENO) == -1) 3466 @@ -773,15 +772,32 @@ 3467 PERROR("cs_create_connection 3"); 3468 3469 /* close unused */ 3470 -#if defined(UNIX) 3471 (void)close(to_cs[1]); 3472 (void)close(from_cs[0]); 3473 #else 3474 - /* On win32 we must close opposite ends because we are the parent */ 3475 - (void)close(to_cs[0]); 3476 - to_cs[0] = -1; 3477 - (void)close(from_cs[1]); 3478 - from_cs[1] = -1; 3479 + /* WIN32 */ 3480 + /* Create pipes to communicate with cscope */ 3481 + sa.nLength = sizeof(SECURITY_ATTRIBUTES); 3482 + sa.bInheritHandle = TRUE; 3483 + sa.lpSecurityDescriptor = NULL; 3484 + 3485 + if (!(pipe_stdin = CreatePipe(&stdin_rd, &stdin_wr, &sa, 0)) 3486 + || !(pipe_stdout = CreatePipe(&stdout_rd, &stdout_wr, &sa, 0))) 3487 + { 3488 + (void)EMSG(_("E566: Could not create cscope pipes")); 3489 +err_closing: 3490 + if (pipe_stdin) 3491 + { 3492 + CloseHandle(stdin_rd); 3493 + CloseHandle(stdin_wr); 3494 + } 3495 + if (pipe_stdout) 3496 + { 3497 + CloseHandle(stdout_rd); 3498 + CloseHandle(stdout_wr); 3499 + } 3500 + return CSCOPE_FAILURE; 3501 + } 3502 #endif 3503 /* expand the cscope exec for env var's */ 3504 if ((prog = (char *)alloc(MAXPATHL + 1)) == NULL) 3505 @@ -789,6 +805,7 @@ 3506 #ifdef UNIX 3507 return CSCOPE_FAILURE; 3508 #else 3509 + /* WIN32 */ 3510 goto err_closing; 3511 #endif 3512 } 3513 @@ -805,6 +822,7 @@ 3514 #ifdef UNIX 3515 return CSCOPE_FAILURE; 3516 #else 3517 + /* WIN32 */ 3518 goto err_closing; 3519 #endif 3520 } 3521 @@ -823,6 +841,7 @@ 3522 #ifdef UNIX 3523 return CSCOPE_FAILURE; 3524 #else 3525 + /* WIN32 */ 3526 goto err_closing; 3527 #endif 3528 } 3529 @@ -831,6 +850,7 @@ 3530 #if defined(UNIX) 3531 (void)sprintf(cmd, "exec %s -dl -f %s", prog, csinfo[i].fname); 3532 #else 3533 + /* WIN32 */ 3534 (void)sprintf(cmd, "%s -dl -f %s", prog, csinfo[i].fname); 3535 #endif 3536 if (csinfo[i].ppath != NULL) 3537 @@ -856,60 +876,6 @@ 3538 exit(127); 3539 /* NOTREACHED */ 3540 default: /* parent. */ 3541 -#else 3542 -# ifdef FEAT_GUI 3543 - activewnd = GetForegroundWindow(); /* on win9x cscope steals focus */ 3544 - /* Dirty hack to hide annoying console window */ 3545 - if (AllocConsole()) 3546 - { 3547 - char *title; 3548 - title = (char *)alloc(1024); 3549 - if (title == NULL) 3550 - FreeConsole(); 3551 - else 3552 - { 3553 - GetConsoleTitle(title, 1024); /* save for future restore */ 3554 - SetConsoleTitle( 3555 - "GVIMCS{5499421B-CBEF-45b0-85EF-38167FDEA5C5}GVIMCS"); 3556 - Sleep(40); /* as stated in MS KB we must wait 40 ms */ 3557 - consolewnd = FindWindow(NULL, 3558 - "GVIMCS{5499421B-CBEF-45b0-85EF-38167FDEA5C5}GVIMCS"); 3559 - if (consolewnd != NULL) 3560 - ShowWindow(consolewnd, SW_HIDE); 3561 - SetConsoleTitle(title); 3562 - vim_free(title); 3563 - } 3564 - } 3565 -# endif 3566 - /* May be use &shell, &shellquote etc */ 3567 -# ifdef __BORLANDC__ 3568 - /* BCC 5.5 uses a different function name for spawnlp */ 3569 - ph = (long_i)spawnlp(P_NOWAIT, prog, cmd, NULL); 3570 -# else 3571 - ph = (long_i)_spawnlp(_P_NOWAIT, prog, cmd, NULL); 3572 -# endif 3573 - vim_free(prog); 3574 - vim_free(cmd); 3575 -# ifdef FEAT_GUI 3576 - /* Dirty hack part two */ 3577 - if (activewnd != NULL) 3578 - /* restoring focus */ 3579 - SetForegroundWindow(activewnd); 3580 - if (consolewnd != NULL) 3581 - FreeConsole(); 3582 - 3583 -# endif 3584 - if (ph == -1) 3585 - { 3586 - PERROR(_("cs_create_connection exec failed")); 3587 - (void)EMSG(_("E623: Could not spawn cscope process")); 3588 - goto err_closing; 3589 - } 3590 - /* else */ 3591 - csinfo[i].pid = 0; 3592 - csinfo[i].hProc = (HANDLE)ph; 3593 - 3594 -#endif /* !UNIX */ 3595 /* 3596 * Save the file descriptors for later duplication, and 3597 * reopen as streams. 3598 @@ -919,22 +885,54 @@ 3599 if ((csinfo[i].fr_fp = fdopen(from_cs[0], "r")) == NULL) 3600 PERROR(_("cs_create_connection: fdopen for fr_fp failed")); 3601 3602 -#if defined(UNIX) 3603 /* close unused */ 3604 (void)close(to_cs[0]); 3605 (void)close(from_cs[1]); 3606 3607 break; 3608 } 3609 + 3610 #else 3611 - /* restore stdhandles */ 3612 - dup2(in_save, STDIN_FILENO); 3613 - dup2(out_save, STDOUT_FILENO); 3614 - dup2(err_save, STDERR_FILENO); 3615 - close(in_save); 3616 - close(out_save); 3617 - close(err_save); 3618 -#endif 3619 + /* WIN32 */ 3620 + /* Create a new process to run cscope and use pipes to talk with it */ 3621 + GetStartupInfo(&si); 3622 + si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; 3623 + si.wShowWindow = SW_HIDE; /* Hide child application window */ 3624 + si.hStdOutput = stdout_wr; 3625 + si.hStdError = stdout_wr; 3626 + si.hStdInput = stdin_rd; 3627 + created = CreateProcess(NULL, cmd, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, 3628 + NULL, NULL, &si, &pi); 3629 + vim_free(prog); 3630 + vim_free(cmd); 3631 + 3632 + if (!created) 3633 + { 3634 + PERROR(_("cs_create_connection exec failed")); 3635 + (void)EMSG(_("E623: Could not spawn cscope process")); 3636 + goto err_closing; 3637 + } 3638 + /* else */ 3639 + csinfo[i].pid = pi.dwProcessId; 3640 + csinfo[i].hProc = pi.hProcess; 3641 + CloseHandle(pi.hThread); 3642 + 3643 + /* TODO - tidy up after failure to create files on pipe handles. */ 3644 + if (((fd = _open_osfhandle((OPEN_OH_ARGTYPE)stdin_wr, 3645 + _O_TEXT|_O_APPEND)) < 0) 3646 + || ((csinfo[i].to_fp = _fdopen(fd, "w")) == NULL)) 3647 + PERROR(_("cs_create_connection: fdopen for to_fp failed")); 3648 + if (((fd = _open_osfhandle((OPEN_OH_ARGTYPE)stdout_rd, 3649 + _O_TEXT|_O_RDONLY)) < 0) 3650 + || ((csinfo[i].fr_fp = _fdopen(fd, "r")) == NULL)) 3651 + PERROR(_("cs_create_connection: fdopen for fr_fp failed")); 3652 + 3653 + /* Close handles for file descriptors inherited by the cscope process */ 3654 + CloseHandle(stdin_rd); 3655 + CloseHandle(stdout_wr); 3656 + 3657 +#endif /* !UNIX */ 3658 + 3659 return CSCOPE_SUCCESS; 3660 } /* cs_create_connection */ 3661 3662 @@ -966,7 +964,7 @@ 2565 3663 } 2566 3664 … … 2571 3669 cs_usage_msg(Find); 2572 3670 return FALSE; 2573 @@ -1317,7 +131 2,7 @@3671 @@ -1317,7 +1315,7 @@ 2574 3672 #else 2575 3673 /* compare pathnames first */ … … 2580 3678 && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber 2581 3679 && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh 2582 @@ -1401,6 +139 6,9 @@3680 @@ -1401,6 +1399,9 @@ 2583 3681 if (eap->arg == NULL) 2584 3682 return NULL; … … 2590 3688 return NULL; 2591 3689 2592 @@ -2195,7 +2193,7 @@ 3690 @@ -2099,8 +2100,8 @@ 3691 /* 3692 * PRIVATE: cs_release_csp 3693 * 3694 - * does the actual free'ing for the cs ptr with an optional flag of whether 3695 - * or not to free the filename. called by cs_kill and cs_reset. 3696 + * Does the actual free'ing for the cs ptr with an optional flag of whether 3697 + * or not to free the filename. Called by cs_kill and cs_reset. 3698 */ 3699 static void 3700 cs_release_csp(i, freefnpp) 3701 @@ -2118,10 +2119,13 @@ 3702 (void)fputs("q\n", csinfo[i].to_fp); 3703 (void)fflush(csinfo[i].to_fp); 3704 } 3705 - /* give cscope chance to exit normally */ 3706 - if (csinfo[i].hProc != NULL 3707 - && WaitForSingleObject(csinfo[i].hProc, 1000) == WAIT_TIMEOUT) 3708 - TerminateProcess(csinfo[i].hProc, 0); 3709 + if (csinfo[i].hProc != NULL) 3710 + { 3711 + /* Give cscope a chance to exit normally */ 3712 + if (WaitForSingleObject(csinfo[i].hProc, 1000) == WAIT_TIMEOUT) 3713 + TerminateProcess(csinfo[i].hProc, 0); 3714 + CloseHandle(csinfo[i].hProc); 3715 + } 3716 #endif 3717 3718 if (csinfo[i].fr_fp != NULL) 3719 @@ -2195,7 +2199,7 @@ 2593 3720 cs_add_common(dblist[i], pplist[i], fllist[i]); 2594 3721 if (p_csverbose) … … 2599 3726 * "Added cscope database..." 2600 3727 */ 3728 @@ -2304,6 +2308,21 @@ 3729 return CSCOPE_SUCCESS; 3730 } /* cs_show */ 3731 3732 + 3733 +/* 3734 + * PUBLIC: cs_end 3735 + * 3736 + * Only called when VIM exits to quit any cscope sessions. 3737 + */ 3738 + void 3739 +cs_end() 3740 +{ 3741 + int i; 3742 + 3743 + for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) 3744 + cs_release_csp(i, TRUE); 3745 +} 3746 + 3747 #endif /* FEAT_CSCOPE */ 3748 3749 /* the end */ 3750 diff -Naur vim71.orig/src/if_cscope.h vim71/src/if_cscope.h 3751 --- vim71.orig/src/if_cscope.h 2005-06-30 10:14:22.000000000 -0700 3752 +++ vim71/src/if_cscope.h 2007-10-16 14:14:28.000000000 -0700 3753 @@ -72,7 +72,7 @@ 3754 ino_t st_ino; /* inode number of cscope db */ 3755 #else 3756 # if defined(WIN32) 3757 - int pid; /* Can't get pid so set it to 0 ;) */ 3758 + DWORD pid; /* PID of the connected cscope process. */ 3759 HANDLE hProc; /* cscope process handle */ 3760 DWORD nVolume; /* Volume serial number, instead of st_dev */ 3761 DWORD nIndexHigh; /* st_ino has no meaning in the Windows */ 2601 3762 diff -Naur vim71.orig/src/if_mzsch.c vim71/src/if_mzsch.c 2602 3763 --- vim71.orig/src/if_mzsch.c 2007-05-12 04:13:47.000000000 -0700 2603 +++ vim71/src/if_mzsch.c 2007- 09-03 22:12:59.000000000 -07003764 +++ vim71/src/if_mzsch.c 2007-10-16 14:14:06.000000000 -0700 2604 3765 @@ -308,6 +308,8 @@ 2605 3766 static Scheme_Config *(*dll_scheme_current_config)(void); … … 2645 3806 #endif 2646 3807 #ifdef HAVE_SANDBOX 3808 diff -Naur vim71.orig/src/if_perl.xs vim71/src/if_perl.xs 3809 --- vim71.orig/src/if_perl.xs 2006-08-16 05:45:15.000000000 -0700 3810 +++ vim71/src/if_perl.xs 2007-10-16 14:14:41.000000000 -0700 3811 @@ -40,6 +40,28 @@ 3812 # define PERL_SUBVERSION SUBVERSION 3813 #endif 3814 3815 +/* 3816 + * Quoting Jan Dubois of Active State: 3817 + * ActivePerl build 822 still identifies itself as 5.8.8 but already 3818 + * contains many of the changes from the upcoming Perl 5.8.9 release. 3819 + * 3820 + * The changes include addition of two symbols (Perl_sv_2iv_flags, 3821 + * Perl_newXS_flags) not present in earlier releases. 3822 + * 3823 + * Jan Dubois suggested the following guarding scheme. 3824 + * 3825 + * Active State defined ACTIVEPERL_VERSION as a string in versions before 3826 + * 5.8.8; and so the comparison to 822 below needs to be guarded. 3827 + */ 3828 +#if (PERL_REVISION == 5) && (PERL_VERSION == 8) && (PERL_SUBVERSION >= 8) 3829 +# if (ACTIVEPERL_VERSION >= 822) || (PERL_SUBVERSION >= 9) 3830 +# define PERL589_OR_LATER 3831 +# endif 3832 +#endif 3833 +#if (PERL_REVISION == 5) && (PERL_VERSION >= 9) 3834 +# define PERL589_OR_LATER 3835 +#endif 3836 + 3837 #ifndef pTHX 3838 # define pTHX void 3839 # define pTHX_ 3840 @@ -109,6 +131,10 @@ 3841 # else 3842 # define Perl_sv_catpvn dll_Perl_sv_catpvn 3843 # endif 3844 +#ifdef PERL589_OR_LATER 3845 +# define Perl_sv_2iv_flags dll_Perl_sv_2iv_flags 3846 +# define Perl_newXS_flags dll_Perl_newXS_flags 3847 +#endif 3848 # define Perl_sv_free dll_Perl_sv_free 3849 # define Perl_sv_isa dll_Perl_sv_isa 3850 # define Perl_sv_magic dll_Perl_sv_magic 3851 @@ -192,6 +218,10 @@ 3852 #else 3853 static void (*Perl_sv_catpvn)(pTHX_ SV*, const char*, STRLEN); 3854 #endif 3855 +#ifdef PERL589_OR_LATER 3856 +static IV (*Perl_sv_2iv_flags)(pTHX_ SV* sv, I32 flags); 3857 +static CV * (*Perl_newXS_flags)(pTHX_ const char *name, XSUBADDR_t subaddr, const char *const filename, const char *const proto, U32 flags); 3858 +#endif 3859 static void (*Perl_sv_free)(pTHX_ SV*); 3860 static int (*Perl_sv_isa)(pTHX_ SV*, const char*); 3861 static void (*Perl_sv_magic)(pTHX_ SV*, SV*, int, const char*, I32); 3862 @@ -267,6 +297,10 @@ 3863 #else 3864 {"Perl_sv_2pv", (PERL_PROC*)&Perl_sv_2pv}, 3865 #endif 3866 +#ifdef PERL589_OR_LATER 3867 + {"Perl_sv_2iv_flags", (PERL_PROC*)&Perl_sv_2iv_flags}, 3868 + {"Perl_newXS_flags", (PERL_PROC*)&Perl_newXS_flags}, 3869 +#endif 3870 {"Perl_sv_bless", (PERL_PROC*)&Perl_sv_bless}, 3871 #if (PERL_REVISION == 5) && (PERL_VERSION >= 8) 3872 {"Perl_sv_catpvn_flags", (PERL_PROC*)&Perl_sv_catpvn_flags}, 3873 @@ -411,13 +445,13 @@ 3874 char *next; 3875 char *token = (char *)s; 3876 3877 - while ((next = strchr(token, '\n'))) 3878 + while ((next = strchr(token, '\n')) && !got_int) 3879 { 3880 *next++ = '\0'; /* replace \n with \0 */ 3881 msg_attr((char_u *)token, attr); 3882 token = next; 3883 } 3884 - if (*token) 3885 + if (*token && !got_int) 3886 msg_attr((char_u *)token, attr); 3887 } 3888 3889 diff -Naur vim71.orig/src/if_ruby.c vim71/src/if_ruby.c 3890 --- vim71.orig/src/if_ruby.c 2007-05-12 02:54:12.000000000 -0700 3891 +++ vim71/src/if_ruby.c 2007-10-16 14:14:28.000000000 -0700 3892 @@ -789,7 +789,7 @@ 3893 return get_buffer_line(curbuf, curwin->w_cursor.lnum); 3894 } 3895 3896 -static VALUE set_current_line(VALUE str) 3897 +static VALUE set_current_line(VALUE self, VALUE str) 3898 { 3899 return set_buffer_line(curbuf, curwin->w_cursor.lnum, str); 3900 } 3901 diff -Naur vim71.orig/src/keymap.h vim71/src/keymap.h 3902 --- vim71.orig/src/keymap.h 2006-08-22 04:38:38.000000000 -0700 3903 +++ vim71/src/keymap.h 2007-10-16 14:14:28.000000000 -0700 3904 @@ -254,6 +254,8 @@ 3905 , KE_DROP /* DnD data is available */ 3906 , KE_CURSORHOLD /* CursorHold event */ 3907 , KE_NOP /* doesn't do something */ 3908 + , KE_FOCUSGAINED /* focus gained */ 3909 + , KE_FOCUSLOST /* focus lost */ 3910 }; 3911 3912 /* 3913 @@ -445,6 +447,8 @@ 3914 #define K_CMDWIN TERMCAP2KEY(KS_EXTRA, KE_CMDWIN) 3915 3916 #define K_DROP TERMCAP2KEY(KS_EXTRA, KE_DROP) 3917 +#define K_FOCUSGAINED TERMCAP2KEY(KS_EXTRA, KE_FOCUSGAINED) 3918 +#define K_FOCUSLOST TERMCAP2KEY(KS_EXTRA, KE_FOCUSLOST) 3919 3920 #define K_CURSORHOLD TERMCAP2KEY(KS_EXTRA, KE_CURSORHOLD) 3921 2647 3922 diff -Naur vim71.orig/src/macros.h vim71/src/macros.h 2648 3923 --- vim71.orig/src/macros.h 2007-05-07 12:38:22.000000000 -0700 2649 +++ vim71/src/macros.h 2007- 09-03 22:15:12.000000000 -07003924 +++ vim71/src/macros.h 2007-10-16 14:14:17.000000000 -0700 2650 3925 @@ -54,10 +54,12 @@ 2651 3926 … … 2663 3938 #ifdef MSWIN 2664 3939 # define TOUPPER_LOC(c) toupper_tab[(c) & 255] 3940 diff -Naur vim71.orig/src/main.aap vim71/src/main.aap 3941 --- vim71.orig/src/main.aap 2007-05-07 12:46:43.000000000 -0700 3942 +++ vim71/src/main.aap 2007-10-16 14:14:28.000000000 -0700 3943 @@ -56,9 +56,16 @@ 3944 config {virtual} auto/config.h auto/config.aap : 3945 auto/configure.aap configure.aap 3946 config.arg config.h.in config.aap.in 3947 + # Use "uname -a" to detect the architecture of the system. 3948 + @ok, uname = redir_system('uname -a', 0) 3949 + @if string.find(uname, "i386") >= 0: 3950 + @ arch = "i386" 3951 + @else: 3952 + @ arch = "ppc" 3953 + :print Building for $arch system 3954 :sys CONFIG_STATUS=auto/config.status 3955 ./configure.aap `file2string("config.arg")` 3956 - --with-mac-arch=ppc 3957 + --with-mac-arch=$arch 3958 --cache-file=auto/config.cache 3959 3960 # Configure arguments: create an empty "config.arg" file when its missing 3961 @@ -1167,7 +1174,7 @@ 3962 :symlink `os.getcwd()`/../runtime $RESDIR/vim/runtime 3963 # TODO: Create the vimtutor application. 3964 3965 -gui_bundle {virtual}: $(RESDIR) bundle-dir bundle-executable bundle-info 3966 +gui_bundle {virtual}: $(RESDIR) bundle-dir bundle-executable bundle-info \ 3967 bundle-resource bundle-language 3968 3969 bundle-dir {virtual}: $(APPDIR)/Contents $(VIMTARGET) 3970 @@ -1187,7 +1194,7 @@ 3971 :sys m4 $(M4FLAGSX) infplist.xml > $(APPDIR)/Contents/Info.plist 3972 3973 bundle-resource {virtual}: bundle-dir bundle-rsrc 3974 - :copy {force} $(RSRC_DIR)/*.icns $(RESDIR) 3975 + :copy {force} $(RSRC_DIR)/*.icns $(RESDIR) 3976 3977 ### Classic resources 3978 # Resource fork (in the form of a .rsrc file) for Classic Vim (Mac OS 9) 2665 3979 diff -Naur vim71.orig/src/main.c vim71/src/main.c 2666 3980 --- vim71.orig/src/main.c 2007-05-07 12:38:44.000000000 -0700 2667 +++ vim71/src/main.c 2007- 09-03 22:14:26.000000000 -07003981 +++ vim71/src/main.c 2007-10-16 14:14:28.000000000 -0700 2668 3982 @@ -954,7 +954,8 @@ 2669 3983 int cmdwin; /* TRUE when working in the command-line window */ … … 2713 4027 msg_scroll = FALSE; 2714 4028 quit_more = FALSE; 2715 @@ -1360,8 +1381,7 @@ 4029 @@ -1309,6 +1330,13 @@ 4030 #ifdef FEAT_NETBEANS_INTG 4031 netbeans_end(); 4032 #endif 4033 +#ifdef FEAT_CSCOPE 4034 + cs_end(); 4035 +#endif 4036 +#ifdef FEAT_EVAL 4037 + if (garbage_collect_at_exit) 4038 + garbage_collect(); 4039 +#endif 4040 4041 mch_exit(exitval); 4042 } 4043 @@ -1360,8 +1388,7 @@ 2716 4044 p = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); 2717 4045 if (p != NULL && *p != NUL) … … 2723 4051 } 2724 4052 if (mustfree) 4053 @@ -3632,7 +3659,13 @@ 4054 mainerr_arg_missing((char_u *)filev[-1]); 4055 if (mch_dirname(cwd, MAXPATHL) != OK) 4056 return NULL; 4057 - if ((p = vim_strsave_escaped_ext(cwd, PATH_ESC_CHARS, '\\', TRUE)) == NULL) 4058 + if ((p = vim_strsave_escaped_ext(cwd, 4059 +#ifdef BACKSLASH_IN_FILENAME 4060 + "", /* rem_backslash() will tell what chars to escape */ 4061 +#else 4062 + PATH_ESC_CHARS, 4063 +#endif 4064 + '\\', TRUE)) == NULL) 4065 return NULL; 4066 ga_init2(&ga, 1, 100); 4067 ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd "); 2725 4068 diff -Naur vim71.orig/src/mbyte.c vim71/src/mbyte.c 2726 4069 --- vim71.orig/src/mbyte.c 2007-05-07 12:47:09.000000000 -0700 2727 +++ vim71/src/mbyte.c 2007- 09-03 22:15:45.000000000 -07004070 +++ vim71/src/mbyte.c 2007-10-16 14:14:28.000000000 -0700 2728 4071 @@ -1310,20 +1310,26 @@ 2729 4072 /* … … 2796 4139 diff -Naur vim71.orig/src/message.c vim71/src/message.c 2797 4140 --- vim71.orig/src/message.c 2007-05-07 12:31:59.000000000 -0700 2798 +++ vim71/src/message.c 2007-09-03 22:14:19.000000000 -0700 2799 @@ -1842,7 +1842,7 @@ 4141 +++ vim71/src/message.c 2007-10-16 14:14:28.000000000 -0700 4142 @@ -828,7 +828,7 @@ 4143 _("Messages maintainer: Bram Moolenaar <Bram@vim.org>"), 4144 hl_attr(HLF_T)); 4145 4146 - for (p = first_msg_hist; p != NULL; p = p->next) 4147 + for (p = first_msg_hist; p != NULL && !got_int; p = p->next) 4148 if (p->msg != NULL) 4149 msg_attr(p->msg, p->attr); 4150 4151 @@ -944,6 +944,7 @@ 4152 c = K_IGNORE; 4153 } 4154 #endif 4155 + 4156 /* 4157 * Allow scrolling back in the messages. 4158 * Also accept scroll-down commands when messages fill the screen, 4159 @@ -1840,9 +1841,10 @@ 4160 char_u *sb_str = str; 4161 int sb_col = msg_col; 2800 4162 int wrap; 4163 + int did_last_char; 2801 4164 2802 4165 did_wait_return = FALSE; … … 2806 4169 /* 2807 4170 * We are at the end of the screen line when: 2808 @@ -1878,7 +18 78,7 @@4171 @@ -1878,7 +1880,7 @@ 2809 4172 /* output postponed text */ 2810 4173 t_puts(&t_col, t_s, s, attr); … … 2815 4178 break; 2816 4179 2817 @@ -1927,7 +1927,8 @@ 4180 @@ -1909,7 +1911,10 @@ 4181 else 4182 #endif 4183 msg_screen_putchar(*s++, attr); 4184 + did_last_char = TRUE; 4185 } 4186 + else 4187 + did_last_char = FALSE; 4188 4189 if (p_more) 4190 /* store text for scrolling back */ 4191 @@ -1927,7 +1932,8 @@ 2818 4192 * If screen is completely filled and 'more' is set then wait 2819 4193 * for a character. … … 2825 4199 && !msg_no_more && !exmode_active) 2826 4200 { 2827 @@ -2234,7 +2235,7 @@ 4201 @@ -1943,11 +1949,7 @@ 4202 4203 /* When we displayed a char in last column need to check if there 4204 * is still more. */ 4205 - if (*s >= ' ' 4206 -#ifdef FEAT_RIGHTLEFT 4207 - && !cmdmsg_rl 4208 -#endif 4209 - ) 4210 + if (did_last_char) 4211 continue; 4212 } 4213 4214 @@ -2234,7 +2236,7 @@ 2828 4215 { 2829 4216 msgchunk_T *mp; … … 2834 4221 mp = msg_sb_start(last_msgchunk); 2835 4222 if (mp == NULL || mp->sb_prev == NULL) 2836 @@ -2622,7 +262 3,7 @@4223 @@ -2622,7 +2624,7 @@ 2837 4224 } 2838 4225 } … … 2843 4230 /* displayed the requested text, more prompt again */ 2844 4231 screen_fill((int)Rows - 1, (int)Rows, 0, 2845 @@ -3456,11 +345 7,11 @@4232 @@ -3456,11 +3458,11 @@ 2846 4233 /* advance to next hotkey and set default hotkey */ 2847 4234 #ifdef FEAT_MBYTE … … 2857 4244 --dfltbutton; 2858 4245 2859 @@ -3493,7 +349 4,7 @@4246 @@ -3493,7 +3495,7 @@ 2860 4247 *msgp++ = (dfltbutton == 1) ? ']' : ')'; 2861 4248 … … 2866 4253 } 2867 4254 else 2868 @@ -3519,8 +352 0,6 @@4255 @@ -3519,8 +3521,6 @@ 2869 4256 *msgp++ = ':'; 2870 4257 *msgp++ = ' '; … … 2875 4262 else 2876 4263 { 2877 @@ -3555,8 +355 4,9 @@4264 @@ -3555,8 +3555,9 @@ 2878 4265 msgp = confirm_msg + 1 + STRLEN(message); 2879 4266 hotkp = hotk; … … 2889 4276 diff -Naur vim71.orig/src/misc1.c vim71/src/misc1.c 2890 4277 --- vim71.orig/src/misc1.c 2007-05-07 12:49:03.000000000 -0700 2891 +++ vim71/src/misc1.c 2007- 09-03 22:14:59.000000000 -07004278 +++ vim71/src/misc1.c 2007-10-16 14:14:28.000000000 -0700 2892 4279 @@ -90,7 +90,7 @@ 2893 4280 */ … … 3004 4391 (void)copy_indent(newindent, saved_line); 3005 4392 3006 @@ -4786,7 +4824,7 @@ 4393 @@ -3468,9 +3506,38 @@ 4394 #endif 4395 4396 /* 4397 + * Call expand_env() and store the result in an allocated string. 4398 + * This is not very memory efficient, this expects the result to be freed 4399 + * again soon. 4400 + */ 4401 + char_u * 4402 +expand_env_save(src) 4403 + char_u *src; 4404 +{ 4405 + return expand_env_save_opt(src, FALSE); 4406 +} 4407 + 4408 +/* 4409 + * Idem, but when "one" is TRUE handle the string as one file name, only 4410 + * expand "~" at the start. 4411 + */ 4412 + char_u * 4413 +expand_env_save_opt(src, one) 4414 + char_u *src; 4415 + int one; 4416 +{ 4417 + char_u *p; 4418 + 4419 + p = alloc(MAXPATHL); 4420 + if (p != NULL) 4421 + expand_env_esc(src, p, MAXPATHL, FALSE, one, NULL); 4422 + return p; 4423 +} 4424 + 4425 +/* 4426 * Expand environment variable with path name. 4427 * "~/" is also expanded, using $HOME. For Unix "~user/" is expanded. 4428 - * Skips over "\ ", "\~" and "\$". 4429 + * Skips over "\ ", "\~" and "\$" (not for Win32 though). 4430 * If anything fails no expansion is done and dst equals src. 4431 */ 4432 void 4433 @@ -3479,15 +3546,16 @@ 4434 char_u *dst; /* where to put the result */ 4435 int dstlen; /* maximum length of the result */ 4436 { 4437 - expand_env_esc(src, dst, dstlen, FALSE, NULL); 4438 + expand_env_esc(src, dst, dstlen, FALSE, FALSE, NULL); 4439 } 4440 4441 void 4442 -expand_env_esc(srcp, dst, dstlen, esc, startstr) 4443 +expand_env_esc(srcp, dst, dstlen, esc, one, startstr) 4444 char_u *srcp; /* input string e.g. "$HOME/vim.hlp" */ 4445 char_u *dst; /* where to put the result */ 4446 int dstlen; /* maximum length of the result */ 4447 int esc; /* escape spaces in expanded variables */ 4448 + int one; /* "srcp" is one file name */ 4449 char_u *startstr; /* start again after this (can be NULL) */ 4450 { 4451 char_u *src; 4452 @@ -3728,6 +3796,8 @@ 4453 { 4454 /* 4455 * Recognize the start of a new name, for '~'. 4456 + * Don't do this when "one" is TRUE, to avoid expanding "~" in 4457 + * ":edit foo ~ foo". 4458 */ 4459 at_start = FALSE; 4460 if (src[0] == '\\' && src[1] != NUL) 4461 @@ -3735,7 +3805,7 @@ 4462 *dst++ = *src++; 4463 --dstlen; 4464 } 4465 - else if (src[0] == ' ' || src[0] == ',') 4466 + else if ((src[0] == ' ' || src[0] == ',') && !one) 4467 at_start = TRUE; 4468 *dst++ = *src++; 4469 --dstlen; 4470 @@ -4032,23 +4102,6 @@ 4471 } 4472 4473 /* 4474 - * Call expand_env() and store the result in an allocated string. 4475 - * This is not very memory efficient, this expects the result to be freed 4476 - * again soon. 4477 - */ 4478 - char_u * 4479 -expand_env_save(src) 4480 - char_u *src; 4481 -{ 4482 - char_u *p; 4483 - 4484 - p = alloc(MAXPATHL); 4485 - if (p != NULL) 4486 - expand_env(src, p, MAXPATHL); 4487 - return p; 4488 -} 4489 - 4490 -/* 4491 * Our portable version of setenv. 4492 */ 4493 void 4494 @@ -4786,7 +4839,7 @@ 3007 4495 static int cin_iswhileofdo __ARGS((char_u *, linenr_T, int)); 3008 4496 static int cin_iswhileofdo_end __ARGS((int terminated, int ind_maxparen, int ind_maxcomment)); … … 3013 4501 static int cin_ends_in __ARGS((char_u *, char_u *, char_u *)); 3014 4502 static int cin_skip2pos __ARGS((pos_T *trypos)); 3015 @@ -5551,13 +5 589,13 @@4503 @@ -5551,13 +5604,13 @@ 3016 4504 * This is a lot of guessing. Watch out for "cond ? func() : foo". 3017 4505 */ … … 3029 4517 *col = 0; 3030 4518 3031 @@ -5585,7 +56 23,8 @@4519 @@ -5585,7 +5638,8 @@ 3032 4520 */ 3033 4521 while (lnum > 1) … … 3039 4527 break; 3040 4528 while (*s != NUL) 3041 @@ -5602,7 +56 41,8 @@4529 @@ -5602,7 +5656,8 @@ 3042 4530 --lnum; 3043 4531 } … … 3049 4537 { 3050 4538 if (*s == NUL) 3051 @@ -5610,7 +56 50,10 @@4539 @@ -5610,7 +5665,10 @@ 3052 4540 if (lnum == curwin->w_cursor.lnum) 3053 4541 break; … … 3061 4549 3062 4550 if (s[0] == ':') 3063 @@ -7079,7 +71 22,7 @@4551 @@ -7079,7 +7137,7 @@ 3064 4552 n = FALSE; 3065 4553 if (lookfor != LOOKFOR_TERM && ind_cpp_baseclass > 0) … … 3070 4558 } 3071 4559 if (n) 3072 @@ -7670,7 +77 13,7 @@4560 @@ -7670,7 +7728,7 @@ 3073 4561 n = FALSE; 3074 4562 if (ind_cpp_baseclass != 0 && theline[0] != '{') … … 3079 4567 } 3080 4568 if (n) 3081 @@ -8596,7 +86 39,7 @@4569 @@ -8596,7 +8654,7 @@ 3082 4570 for (p = buf + wildoff; p < s; ++p) 3083 4571 if (rem_backslash(p)) … … 3088 4576 --s; 3089 4577 } 3090 @@ -8897,7 +89 40,7 @@4578 @@ -8897,7 +8955,7 @@ 3091 4579 for (p = buf + wildoff; p < s; ++p) 3092 4580 if (rem_backslash(p)) … … 3097 4585 --s; 3098 4586 } 4587 @@ -9096,7 +9154,7 @@ 4588 */ 4589 if (vim_strpbrk(p, (char_u *)"$~") != NULL) 4590 { 4591 - p = expand_env_save(p); 4592 + p = expand_env_save_opt(p, TRUE); 4593 if (p == NULL) 4594 p = pat[i]; 4595 #ifdef UNIX 4596 diff -Naur vim71.orig/src/misc2.c vim71/src/misc2.c 4597 --- vim71.orig/src/misc2.c 2007-05-07 12:49:26.000000000 -0700 4598 +++ vim71/src/misc2.c 2007-10-16 14:14:41.000000000 -0700 4599 @@ -972,7 +972,7 @@ 4600 return; 4601 entered = TRUE; 4602 4603 - ++autocmd_block; /* don't want to trigger autocommands here */ 4604 + block_autocmds(); /* don't want to trigger autocommands here */ 4605 4606 #ifdef FEAT_WINDOWS 4607 /* close all tabs and windows */ 4608 @@ -1037,7 +1037,9 @@ 4609 4610 /* Free some global vars. */ 4611 vim_free(username); 4612 +# ifdef FEAT_CLIPBOARD 4613 vim_free(clip_exclude_prog); 4614 +# endif 4615 vim_free(last_cmdline); 4616 vim_free(new_last_cmdline); 4617 set_keep_msg(NULL, 0); 3099 4618 diff -Naur vim71.orig/src/normal.c vim71/src/normal.c 3100 4619 --- vim71.orig/src/normal.c 2007-05-07 12:34:39.000000000 -0700 3101 +++ vim71/src/normal.c 2007-09-03 22:15:06.000000000 -0700 3102 @@ -889,6 +889,11 @@ 4620 +++ vim71/src/normal.c 2007-10-16 14:14:41.000000000 -0700 4621 @@ -690,13 +690,20 @@ 4622 ca.count0 = ca.count0 * 10 + (c - '0'); 4623 if (ca.count0 < 0) /* got too large! */ 4624 ca.count0 = 999999999L; 4625 +#ifdef FEAT_EVAL 4626 + /* Set v:count here, when called from main() and not a stuffed 4627 + * command, so that v:count can be used in an expression mapping 4628 + * right after the count. */ 4629 + if (toplevel && stuff_empty()) 4630 + set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0); 4631 +#endif 4632 if (ctrl_w) 4633 { 4634 ++no_mapping; 4635 ++allow_keys; /* no mapping for nchar, but keys */ 4636 } 4637 ++no_zero_mapping; /* don't map zero here */ 4638 - c = safe_vgetc(); 4639 + c = plain_vgetc(); 4640 #ifdef FEAT_LANGMAP 4641 LANGMAP_ADJUST(c, TRUE); 4642 #endif 4643 @@ -721,7 +728,7 @@ 4644 ca.count0 = 0; 4645 ++no_mapping; 4646 ++allow_keys; /* no mapping for nchar, but keys */ 4647 - c = safe_vgetc(); /* get next character */ 4648 + c = plain_vgetc(); /* get next character */ 4649 #ifdef FEAT_LANGMAP 4650 LANGMAP_ADJUST(c, TRUE); 4651 #endif 4652 @@ -889,13 +896,18 @@ 3103 4653 3104 4654 ++no_mapping; … … 3112 4662 { 3113 4663 /* 3114 @@ -3755,7 +3760,8 @@ 4664 * For 'g' get the next character now, so that we can check for 4665 * "gr", "g'" and "g`". 4666 */ 4667 - ca.nchar = safe_vgetc(); 4668 + ca.nchar = plain_vgetc(); 4669 #ifdef FEAT_LANGMAP 4670 LANGMAP_ADJUST(ca.nchar, TRUE); 4671 #endif 4672 @@ -952,7 +964,7 @@ 4673 im_set_active(TRUE); 4674 #endif 4675 4676 - *cp = safe_vgetc(); 4677 + *cp = plain_vgetc(); 4678 4679 if (langmap_active) 4680 { 4681 @@ -1040,7 +1052,7 @@ 4682 } 4683 if (c > 0) 4684 { 4685 - c = safe_vgetc(); 4686 + c = plain_vgetc(); 4687 if (c != Ctrl_N && c != Ctrl_G) 4688 vungetc(c); 4689 else 4690 @@ -1059,7 +1071,7 @@ 4691 while (enc_utf8 && lang && (c = vpeekc()) > 0 4692 && (c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1)) 4693 { 4694 - c = safe_vgetc(); 4695 + c = plain_vgetc(); 4696 if (!utf_iscomposing(c)) 4697 { 4698 vungetc(c); /* it wasn't, put it back */ 4699 @@ -3755,7 +3767,8 @@ 3115 4700 extra_len = (int)STRLEN(p); 3116 4701 overflow = old_len + extra_len - SHOWCMD_COLS; … … 3122 4707 3123 4708 if (char_avail()) 3124 @@ -6379,7 +6385,7 @@ 4709 @@ -4558,7 +4571,7 @@ 4710 #endif 4711 ++no_mapping; 4712 ++allow_keys; /* no mapping for nchar, but allow key codes */ 4713 - nchar = safe_vgetc(); 4714 + nchar = plain_vgetc(); 4715 #ifdef FEAT_LANGMAP 4716 LANGMAP_ADJUST(nchar, TRUE); 4717 #endif 4718 @@ -4916,7 +4929,7 @@ 4719 case 'u': /* "zug" and "zuw": undo "zg" and "zw" */ 4720 ++no_mapping; 4721 ++allow_keys; /* no mapping for nchar, but allow key codes */ 4722 - nchar = safe_vgetc(); 4723 + nchar = plain_vgetc(); 4724 #ifdef FEAT_LANGMAP 4725 LANGMAP_ADJUST(nchar, TRUE); 4726 #endif 4727 @@ -6379,7 +6392,7 @@ 3125 4728 */ 3126 4729 else if (cap->nchar == 'p' || cap->nchar == 'P') … … 3131 4734 prep_redo_cmd(cap); 3132 4735 do_put(cap->oap->regname, 3133 @@ -6662,6 +66 68,13 @@4736 @@ -6662,6 +6675,13 @@ 3134 4737 else 3135 4738 had_ctrl_v = NUL; … … 3145 4748 /* Visual mode "r" */ 3146 4749 if (VIsual_active) 3147 @@ -6688,11 +670 1,9 @@4750 @@ -6688,11 +6708,9 @@ 3148 4751 } 3149 4752 #endif … … 3159 4762 || (has_mbyte && mb_charlen(ptr) < cap->count1) 3160 4763 #endif 4764 @@ -8353,7 +8371,7 @@ 4765 n = fwd_word(cap->count1, cap->arg, cap->oap->op_type != OP_NOP); 4766 4767 /* Don't leave the cursor on the NUL past a line */ 4768 - if (curwin->w_cursor.col && gchar_cursor() == NUL) 4769 + if (n != FAIL && curwin->w_cursor.col > 0 && gchar_cursor() == NUL) 4770 { 4771 --curwin->w_cursor.col; 4772 cap->oap->inclusive = TRUE; 3161 4773 diff -Naur vim71.orig/src/ops.c vim71/src/ops.c 3162 4774 --- vim71.orig/src/ops.c 2007-05-07 12:33:47.000000000 -0700 3163 +++ vim71/src/ops.c 2007-09-03 22:12:53.000000000 -0700 3164 @@ -3404,7 +3404,9 @@ 4775 +++ vim71/src/ops.c 2007-10-16 14:14:28.000000000 -0700 4776 @@ -2477,7 +2477,7 @@ 4777 4778 /* 4779 * Spaces and tabs in the indent may have changed to other spaces and 4780 - * tabs. Get the starting column again and correct the lenght. 4781 + * tabs. Get the starting column again and correct the length. 4782 * Don't do this when "$" used, end-of-line will have changed. 4783 */ 4784 block_prep(oap, &bd2, oap->start.lnum, TRUE); 4785 @@ -2534,7 +2534,9 @@ 4786 #ifdef FEAT_VISUALEXTRA 4787 long offset; 4788 linenr_T linenr; 4789 - long ins_len, pre_textlen = 0; 4790 + long ins_len; 4791 + long pre_textlen = 0; 4792 + long pre_indent = 0; 4793 char_u *firstline; 4794 char_u *ins_text, *newp, *oldp; 4795 struct block_def bd; 4796 @@ -2579,7 +2581,9 @@ 4797 || gchar_cursor() == NUL)) 4798 coladvance_force(getviscol()); 4799 # endif 4800 - pre_textlen = (long)STRLEN(ml_get(oap->start.lnum)); 4801 + firstline = ml_get(oap->start.lnum); 4802 + pre_textlen = (long)STRLEN(firstline); 4803 + pre_indent = (long)(skipwhite(firstline) - firstline); 4804 bd.textcol = curwin->w_cursor.col; 4805 } 4806 #endif 4807 @@ -2598,13 +2602,22 @@ 4808 */ 4809 if (oap->block_mode && oap->start.lnum != oap->end.lnum) 4810 { 4811 + /* Auto-indenting may have changed the indent. If the cursor was past 4812 + * the indent, exclude that indent change from the inserted text. */ 4813 firstline = ml_get(oap->start.lnum); 4814 - /* 4815 - * Subsequent calls to ml_get() flush the firstline data - take a 4816 - * copy of the required bit. 4817 - */ 4818 - if ((ins_len = (long)STRLEN(firstline) - pre_textlen) > 0) 4819 + if (bd.textcol > (colnr_T)pre_indent) 4820 + { 4821 + long new_indent = (long)(skipwhite(firstline) - firstline); 4822 + 4823 + pre_textlen += new_indent - pre_indent; 4824 + bd.textcol += new_indent - pre_indent; 4825 + } 4826 + 4827 + ins_len = (long)STRLEN(firstline) - pre_textlen; 4828 + if (ins_len > 0) 4829 { 4830 + /* Subsequent calls to ml_get() flush the firstline data - take a 4831 + * copy of the inserted text. */ 4832 if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != NULL) 4833 { 4834 vim_strncpy(ins_text, firstline + bd.textcol, (size_t)ins_len); 4835 @@ -3404,7 +3417,9 @@ 3165 4836 3166 4837 #ifdef FEAT_VIRTUALEDIT … … 3175 4846 diff -Naur vim71.orig/src/option.c vim71/src/option.c 3176 4847 --- vim71.orig/src/option.c 2007-05-01 04:26:10.000000000 -0700 3177 +++ vim71/src/option.c 2007-09-03 22:14:43.000000000 -0700 3178 @@ -4628,7 +4628,7 @@ 4848 +++ vim71/src/option.c 2007-10-16 14:14:38.000000000 -0700 4849 @@ -427,6 +427,8 @@ 4850 #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */ 4851 #define P_NFNAME 0x200000L/* only normal file name chars allowed */ 4852 #define P_INSECURE 0x400000L/* option was set from a modeline */ 4853 +#define P_PRI_MKRC 0x800000L/* priority for :mkvimrc (setting option has 4854 + side effects) */ 4855 4856 #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255" 4857 4858 @@ -773,6 +775,8 @@ 4859 {(char_u *)0L, (char_u *)0L} 4860 #endif 4861 }, 4862 + /* P_PRI_MKRC isn't needed here, optval_default() 4863 + * always returns TRUE for 'compatible' */ 4864 {"compatible", "cp", P_BOOL|P_RALL, 4865 (char_u *)&p_cp, PV_NONE, 4866 {(char_u *)TRUE, (char_u *)FALSE}}, 4867 @@ -1515,7 +1519,7 @@ 4868 {(char_u *)0L, (char_u *)0L} 4869 #endif 4870 }, 4871 - {"keymap", "kmp", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME, 4872 + {"keymap", "kmp", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME|P_PRI_MKRC, 4873 #ifdef FEAT_KEYMAP 4874 (char_u *)&p_keymap, PV_KMAP, 4875 {(char_u *)"", (char_u *)0L} 4876 @@ -1836,7 +1840,7 @@ 4877 {"paragraphs", "para", P_STRING|P_VI_DEF, 4878 (char_u *)&p_para, PV_NONE, 4879 {(char_u *)"IPLPPPQPP LIpplpipbp", (char_u *)0L}}, 4880 - {"paste", NULL, P_BOOL|P_VI_DEF, 4881 + {"paste", NULL, P_BOOL|P_VI_DEF|P_PRI_MKRC, 4882 (char_u *)&p_paste, PV_NONE, 4883 {(char_u *)FALSE, (char_u *)0L}}, 4884 {"pastetoggle", "pt", P_STRING|P_VI_DEF, 4885 @@ -4628,7 +4632,7 @@ 3179 4886 if ((!(flags & P_COMMA) || *s != ',') 3180 4887 && vim_strchr(s + 1, *s) != NULL) … … 3185 4892 } 3186 4893 } 3187 @@ -7118,6 +7118,11 @@ 4894 @@ -4992,7 +4996,7 @@ 4895 * For 'spellsuggest' expand after "file:". 4896 */ 4897 expand_env_esc(val, NameBuff, MAXPATHL, 4898 - (char_u **)options[opt_idx].var == &p_tags, 4899 + (char_u **)options[opt_idx].var == &p_tags, FALSE, 4900 #ifdef FEAT_SPELL 4901 (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" : 4902 #endif 4903 @@ -6348,7 +6352,7 @@ 4904 errmsg = check_stl_option(p_ruf); 4905 } 4906 /* check 'statusline' only if it doesn't start with "%!" */ 4907 - else if (varp != &p_stl || s[0] != '%' || s[1] != '!') 4908 + else if (varp == &p_ruf || s[0] != '%' || s[1] != '!') 4909 errmsg = check_stl_option(s); 4910 if (varp == &p_ruf && errmsg == NULL) 4911 comp_col(); 4912 @@ -7118,6 +7122,11 @@ 3188 4913 /* when 'endofline' is changed, redraw the window title */ 3189 4914 else if ((int *)varp == &curbuf->b_p_eol) … … 3197 4922 3198 4923 /* when 'bin' is set also set some other options */ 3199 @@ -8219,6 +8224,25 @@ 4924 @@ -7815,6 +7824,8 @@ 4925 errmsg = e_positive; 4926 p_ch = 1; 4927 } 4928 + if (p_ch > Rows - min_rows() + 1) 4929 + p_ch = Rows - min_rows() + 1; 4930 4931 /* Only compute the new window layout when startup has been 4932 * completed. Otherwise the frame sizes may be wrong. */ 4933 @@ -8219,6 +8230,25 @@ 3200 4934 varp = get_varp(&options[opt_idx]); 3201 4935 if (varp != NULL) /* hidden option is not changed */ … … 3223 4957 (void)set_num_option(opt_idx, varp, number, 3224 4958 NULL, 0, opt_flags); 3225 @@ -10585,6 +10609,8 @@ 4959 @@ -8511,13 +8541,20 @@ 4960 char_u *varp_local = NULL; /* fresh value */ 4961 char *cmd; 4962 int round; 4963 + int pri; 4964 4965 /* 4966 * The options that don't have a default (terminal name, columns, lines) 4967 * are never written. Terminal options are also not written. 4968 + * Do the loop over "options[]" twice: once for options with the 4969 + * P_PRI_MKRC flag and once without. 4970 */ 4971 - for (p = &options[0]; !istermoption(p); p++) 4972 - if (!(p->flags & P_NO_MKRC) && !istermoption(p)) 4973 + for (pri = 1; pri >= 0; --pri) 4974 + { 4975 + for (p = &options[0]; !istermoption(p); p++) 4976 + if (!(p->flags & P_NO_MKRC) 4977 + && !istermoption(p) 4978 + && ((pri == 1) == ((p->flags & P_PRI_MKRC) != 0))) 4979 { 4980 /* skip global option when only doing locals */ 4981 if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL)) 4982 @@ -8613,6 +8650,7 @@ 4983 } 4984 } 4985 } 4986 + } 4987 return OK; 4988 } 4989 4990 @@ -8715,6 +8753,8 @@ 4991 char *name; 4992 int value; 4993 { 4994 + if (value < 0) /* global/local option using global value */ 4995 + return OK; 4996 if (fprintf(fd, "%s %s%s", cmd, value ? "" : "no", name) < 0 4997 || put_eol(fd) < 0) 4998 return FAIL; 4999 @@ -10585,6 +10625,8 @@ 3226 5000 buf->b_start_ffc = *buf->b_p_ff; 3227 5001 buf->b_start_eol = buf->b_p_eol; … … 3232 5006 if (buf->b_start_fenc == NULL 3233 5007 || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) 3234 @@ -10598,13 +106 24,17 @@5008 @@ -10598,13 +10640,17 @@ 3235 5009 /* 3236 5010 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value … … 3251 5025 && buf->b_ml.ml_line_count == 1 3252 5026 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL) 3253 @@ -10614,6 +106 44,8 @@5027 @@ -10614,6 +10660,8 @@ 3254 5028 if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol) 3255 5029 return TRUE; … … 3262 5036 diff -Naur vim71.orig/src/os_unix.c vim71/src/os_unix.c 3263 5037 --- vim71.orig/src/os_unix.c 2007-05-09 12:41:58.000000000 -0700 3264 +++ vim71/src/os_unix.c 2007- 09-03 22:15:38.000000000 -07005038 +++ vim71/src/os_unix.c 2007-10-16 14:14:22.000000000 -0700 3265 5039 @@ -753,7 +753,8 @@ 3266 5040 if (signal_stack != NULL) … … 3298 5072 diff -Naur vim71.orig/src/os_unix.h vim71/src/os_unix.h 3299 5073 --- vim71.orig/src/os_unix.h 2007-05-07 12:35:05.000000000 -0700 3300 +++ vim71/src/os_unix.h 2007- 09-03 22:13:13.000000000 -07005074 +++ vim71/src/os_unix.h 2007-10-16 14:14:06.000000000 -0700 3301 5075 @@ -508,6 +508,9 @@ 3302 5076 #if !defined(S_ISFIFO) && defined(S_IFIFO) … … 3311 5085 diff -Naur vim71.orig/src/popupmnu.c vim71/src/popupmnu.c 3312 5086 --- vim71.orig/src/popupmnu.c 2007-03-24 13:07:39.000000000 -0700 3313 +++ vim71/src/popupmnu.c 2007- 09-03 22:14:24.000000000 -07005087 +++ vim71/src/popupmnu.c 2007-10-16 14:14:09.000000000 -0700 3314 5088 @@ -75,7 +75,6 @@ 3315 5089 … … 3545 5319 diff -Naur vim71.orig/src/proto/charset.pro vim71/src/proto/charset.pro 3546 5320 --- vim71.orig/src/proto/charset.pro 2007-05-12 03:39:01.000000000 -0700 3547 +++ vim71/src/proto/charset.pro 2007- 09-03 22:15:22.000000000 -07005321 +++ vim71/src/proto/charset.pro 2007-10-16 14:14:20.000000000 -0700 3548 5322 @@ -21,6 +21,7 @@ 3549 5323 int vim_iswordp __ARGS((char_u *p)); … … 3556 5330 diff -Naur vim71.orig/src/proto/fileio.pro vim71/src/proto/fileio.pro 3557 5331 --- vim71.orig/src/proto/fileio.pro 2007-05-12 03:39:14.000000000 -0700 3558 +++ vim71/src/proto/fileio.pro 2007- 09-03 22:12:50.000000000 -07005332 +++ vim71/src/proto/fileio.pro 2007-10-16 14:14:31.000000000 -0700 3559 5333 @@ -2,6 +2,7 @@ 3560 5334 void filemess __ARGS((buf_T *buf, char_u *name, char_u *s, int attr)); … … 3565 5339 void msg_add_fname __ARGS((buf_T *buf, char_u *fname)); 3566 5340 void msg_add_lines __ARGS((int insert_space, long lnum, long nchars)); 5341 @@ -39,6 +40,8 @@ 5342 int trigger_cursorhold __ARGS((void)); 5343 int has_cursormoved __ARGS((void)); 5344 int has_cursormovedI __ARGS((void)); 5345 +void block_autocmds __ARGS((void)); 5346 +void unblock_autocmds __ARGS((void)); 5347 int has_autocmd __ARGS((event_T event, char_u *sfname, buf_T *buf)); 5348 char_u *get_augroup_name __ARGS((expand_T *xp, int idx)); 5349 char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd)); 5350 diff -Naur vim71.orig/src/proto/getchar.pro vim71/src/proto/getchar.pro 5351 --- vim71.orig/src/proto/getchar.pro 2007-05-12 03:39:16.000000000 -0700 5352 +++ vim71/src/proto/getchar.pro 2007-10-16 14:14:28.000000000 -0700 5353 @@ -38,6 +38,7 @@ 5354 void updatescript __ARGS((int c)); 5355 int vgetc __ARGS((void)); 5356 int safe_vgetc __ARGS((void)); 5357 +int plain_vgetc __ARGS((void)); 5358 int vpeekc __ARGS((void)); 5359 int vpeekc_nomap __ARGS((void)); 5360 int vpeekc_any __ARGS((void)); 5361 diff -Naur vim71.orig/src/proto/if_cscope.pro vim71/src/proto/if_cscope.pro 5362 --- vim71.orig/src/proto/if_cscope.pro 2007-05-12 03:39:21.000000000 -0700 5363 +++ vim71/src/proto/if_cscope.pro 2007-10-16 14:14:28.000000000 -0700 5364 @@ -6,4 +6,5 @@ 5365 void cs_free_tags __ARGS((void)); 5366 void cs_print_tags __ARGS((void)); 5367 int cs_connection __ARGS((int num, char_u *dbpath, char_u *ppath)); 5368 +void cs_end __ARGS((void)); 5369 /* vim: set ft=c : */ 3567 5370 diff -Naur vim71.orig/src/proto/mbyte.pro vim71/src/proto/mbyte.pro 3568 5371 --- vim71.orig/src/proto/mbyte.pro 2007-05-12 03:39:38.000000000 -0700 3569 +++ vim71/src/proto/mbyte.pro 2007- 09-03 22:15:45.000000000 -07005372 +++ vim71/src/proto/mbyte.pro 2007-10-16 14:14:28.000000000 -0700 3570 5373 @@ -12,9 +12,9 @@ 3571 5374 int utf_ptr2cells __ARGS((char_u *p)); … … 3581 5384 int utf_ptr2char __ARGS((char_u *p)); 3582 5385 int mb_ptr2char_adv __ARGS((char_u **pp)); 5386 diff -Naur vim71.orig/src/proto/misc1.pro vim71/src/proto/misc1.pro 5387 --- vim71.orig/src/proto/misc1.pro 2007-05-12 03:39:34.000000000 -0700 5388 +++ vim71/src/proto/misc1.pro 2007-10-16 14:14:28.000000000 -0700 5389 @@ -48,10 +48,11 @@ 5390 void vim_beep __ARGS((void)); 5391 void init_homedir __ARGS((void)); 5392 void free_homedir __ARGS((void)); 5393 +char_u *expand_env_save __ARGS((char_u *src)); 5394 +char_u *expand_env_save_opt __ARGS((char_u *src, int one)); 5395 void expand_env __ARGS((char_u *src, char_u *dst, int dstlen)); 5396 -void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, char_u *startstr)); 5397 +void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, int one, char_u *startstr)); 5398 char_u *vim_getenv __ARGS((char_u *name, int *mustfree)); 5399 -char_u *expand_env_save __ARGS((char_u *src)); 5400 void vim_setenv __ARGS((char_u *name, char_u *val)); 5401 char_u *get_env_name __ARGS((expand_T *xp, int idx)); 5402 void home_replace __ARGS((buf_T *buf, char_u *src, char_u *dst, int dstlen, int one)); 3583 5403 diff -Naur vim71.orig/src/proto/search.pro vim71/src/proto/search.pro 3584 5404 --- vim71.orig/src/proto/search.pro 2007-05-12 03:39:50.000000000 -0700 3585 +++ vim71/src/proto/search.pro 2007- 09-03 22:14:24.000000000 -07005405 +++ vim71/src/proto/search.pro 2007-10-16 14:14:09.000000000 -0700 3586 5406 @@ -1,6 +1,7 @@ 3587 5407 /* search.c */ … … 3594 5414 diff -Naur vim71.orig/src/proto/syntax.pro vim71/src/proto/syntax.pro 3595 5415 --- vim71.orig/src/proto/syntax.pro 2007-05-12 03:39:52.000000000 -0700 3596 +++ vim71/src/proto/syntax.pro 2007- 09-03 22:13:33.000000000 -07005416 +++ vim71/src/proto/syntax.pro 2007-10-16 14:14:07.000000000 -0700 3597 5417 @@ -8,6 +8,8 @@ 3598 5418 void syntax_clear __ARGS((buf_T *buf)); … … 3606 5426 diff -Naur vim71.orig/src/proto/window.pro vim71/src/proto/window.pro 3607 5427 --- vim71.orig/src/proto/window.pro 2007-05-12 03:40:00.000000000 -0700 3608 +++ vim71/src/proto/window.pro 2007- 09-03 22:13:43.000000000 -07005428 +++ vim71/src/proto/window.pro 2007-10-16 14:14:07.000000000 -0700 3609 5429 @@ -59,4 +59,8 @@ 3610 5430 int only_one_window __ARGS((void)); … … 3618 5438 diff -Naur vim71.orig/src/quickfix.c vim71/src/quickfix.c 3619 5439 --- vim71.orig/src/quickfix.c 2007-02-03 16:50:17.000000000 -0800 3620 +++ vim71/src/quickfix.c 2007-09-03 22:12:48.000000000 -0700 5440 +++ vim71/src/quickfix.c 2007-10-16 14:14:28.000000000 -0700 5441 @@ -1612,8 +1612,8 @@ 5442 } 5443 5444 /* 5445 - * If there is only one window and is the quickfix window, create a new 5446 - * one above the quickfix window. 5447 + * If there is only one window and it is the quickfix window, create a 5448 + * new one above the quickfix window. 5449 */ 5450 if (((firstwin == lastwin) && bt_quickfix(curbuf)) || !usable_win) 5451 { 3621 5452 @@ -2331,7 +2331,7 @@ 3622 5453 set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix", … … 3628 5459 3629 5460 /* Only set the height when still in the same tab page and there is no 5461 @@ -2981,6 +2981,7 @@ 5462 buf_T *buf; 5463 int duplicate_name = FALSE; 5464 int using_dummy; 5465 + int redraw_for_dummy = FALSE; 5466 int found_match; 5467 buf_T *first_match_buf = NULL; 5468 time_t seconds = 0; 5469 @@ -3097,6 +3098,7 @@ 5470 /* Remember that a buffer with this name already exists. */ 5471 duplicate_name = (buf != NULL); 5472 using_dummy = TRUE; 5473 + redraw_for_dummy = TRUE; 5474 5475 #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) 5476 /* Don't do Filetype autocommands to avoid loading syntax and 5477 @@ -3243,11 +3245,29 @@ 5478 if (qi->qf_lists[qi->qf_curlist].qf_count > 0) 5479 { 5480 if ((flags & VGR_NOJUMP) == 0) 5481 + { 5482 + buf = curbuf; 5483 qf_jump(qi, 0, 0, eap->forceit); 5484 + if (buf != curbuf) 5485 + /* If we jumped to another buffer redrawing will already be 5486 + * taken care of. */ 5487 + redraw_for_dummy = FALSE; 5488 + } 5489 } 5490 else 5491 EMSG2(_(e_nomatch2), s); 5492 5493 + /* If we loaded a dummy buffer into the current window, the autocommands 5494 + * may have messed up things, need to redraw and recompute folds. */ 5495 + if (redraw_for_dummy) 5496 + { 5497 +#ifdef FEAT_FOLDING 5498 + foldUpdateAll(curwin); 5499 +#else 5500 + redraw_later(NOT_VALID); 5501 +#endif 5502 + } 5503 + 5504 theend: 5505 vim_free(regmatch.regprog); 5506 } 3630 5507 diff -Naur vim71.orig/src/regexp.c vim71/src/regexp.c 3631 5508 --- vim71.orig/src/regexp.c 2007-05-07 12:50:03.000000000 -0700 3632 +++ vim71/src/regexp.c 2007- 09-03 22:14:31.000000000 -07005509 +++ vim71/src/regexp.c 2007-10-16 14:14:09.000000000 -0700 3633 5510 @@ -2220,7 +2220,7 @@ 3634 5511 break; … … 3742 5619 diff -Naur vim71.orig/src/screen.c vim71/src/screen.c 3743 5620 --- vim71.orig/src/screen.c 2007-05-07 12:27:53.000000000 -0700 3744 +++ vim71/src/screen.c 2007- 09-03 22:15:45.000000000 -07005621 +++ vim71/src/screen.c 2007-10-16 14:14:28.000000000 -0700 3745 5622 @@ -100,27 +100,7 @@ 3746 5623 static int screen_cur_row, screen_cur_col; /* last known cursor position */ … … 3901 5778 else 3902 5779 { 3903 @@ -2542,7 +2555,7 @@ 5780 @@ -2292,9 +2305,11 @@ 5781 prev_c = u8c; 5782 #endif 5783 /* Non-BMP character: display as ? or fullwidth ?. */ 5784 +#ifdef UNICODE16 5785 if (u8c >= 0x10000) 5786 ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?'; 5787 else 5788 +#endif 5789 ScreenLinesUC[idx] = u8c; 5790 for (i = 0; i < Screen_mco; ++i) 5791 { 5792 @@ -2542,7 +2557,7 @@ 3904 5793 3905 5794 char_u extra[18]; /* "%ld" and 'fdc' must fit in here */ … … 3910 5799 int extra_attr = 0; /* attributes when n_extra != 0 */ 3911 5800 static char_u *at_end_str = (char_u *)""; /* used for p_extra when 3912 @@ -2626,10 +26 39,13 @@5801 @@ -2626,10 +2641,13 @@ 3913 5802 int line_attr = 0; /* atrribute for the whole line */ 3914 5803 #endif … … 3928 5817 #ifdef FEAT_ARABIC 3929 5818 int prev_c = 0; /* previous Arabic character */ 3930 @@ -3074,12 +309 0,20 @@5819 @@ -3074,12 +3092,20 @@ 3931 5820 3932 5821 #ifdef FEAT_SEARCH_EXTRA … … 3953 5842 shl->endcol = MAXCOL; 3954 5843 shl->attr_cur = 0; 3955 @@ -3122,6 +314 6,8 @@5844 @@ -3122,6 +3148,8 @@ 3956 5845 area_highlighting = TRUE; 3957 5846 } … … 3962 5851 #endif 3963 5852 3964 @@ -3163,10 +31 89,8 @@5853 @@ -3163,10 +3191,8 @@ 3965 5854 if (cmdwin_type != 0 && wp == curwin) 3966 5855 { … … 3974 5863 } 3975 5864 } 3976 @@ -3182,6 +320 6,7 @@5865 @@ -3182,6 +3208,7 @@ 3977 5866 fill_foldcolumn(extra, wp, FALSE, lnum); 3978 5867 n_extra = wp->w_p_fdc; … … 3982 5871 char_attr = hl_attr(HLF_FC); 3983 5872 } 3984 @@ -3388,13 +341 3,24 @@5873 @@ -3388,13 +3415,24 @@ 3985 5874 * After end, check for start/end of next match. 3986 5875 * When another match, have to check for start again. … … 4012 5901 { 4013 5902 if (shl->startcol != MAXCOL 4014 @@ -3442,26 +34 78,43 @@5903 @@ -3442,26 +3480,43 @@ 4015 5904 } 4016 5905 break; … … 4065 5954 line_attr = hl_attr(diff_hlf); 4066 5955 } 4067 @@ -3496,9 +35 49,11 @@5956 @@ -3496,9 +3551,11 @@ 4068 5957 * Get the next character to put on the screen. 4069 5958 */ … … 4080 5969 */ 4081 5970 if (n_extra > 0) 4082 @@ -3611,6 +366 6,8 @@5971 @@ -3611,6 +3668,8 @@ 4083 5972 * Draw it as a space with a composing char. */ 4084 5973 if (utf_iscomposing(mb_c)) … … 4089 5978 u8cc[i] = u8cc[i - 1]; 4090 5979 u8cc[0] = mb_c; 4091 @@ -3752,10 +3809,8 @@ 5980 @@ -3621,13 +3680,18 @@ 5981 if ((mb_l == 1 && c >= 0x80) 5982 || (mb_l >= 1 && mb_c == 0) 5983 || (mb_l > 1 && (!vim_isprintc(mb_c) 5984 - || mb_c >= 0x10000))) 5985 +# ifdef UNICODE16 5986 + || mb_c >= 0x10000 5987 +# endif 5988 + ))) 5989 { 5990 /* 5991 * Illegal UTF-8 byte: display as <xx>. 5992 * Non-BMP character : display as ? or fullwidth ?. 5993 */ 5994 +# ifdef UNICODE16 5995 if (mb_c < 0x10000) 5996 +# endif 5997 { 5998 transchar_hex(extra, mb_c); 5999 # ifdef FEAT_RIGHTLEFT 6000 @@ -3635,11 +3699,13 @@ 6001 rl_mirror(extra); 6002 # endif 6003 } 6004 +# ifdef UNICODE16 6005 else if (utf_char2cells(mb_c) != 2) 6006 STRCPY(extra, "?"); 6007 else 6008 /* 0xff1f in UTF-8: full-width '?' */ 6009 STRCPY(extra, "\357\274\237"); 6010 +# endif 6011 6012 p_extra = extra; 6013 c = *p_extra; 6014 @@ -3752,10 +3818,8 @@ 4092 6015 * a '<' in the first column. */ 4093 6016 if (n_skip > 0 && mb_l > 1) … … 4101 6024 if (area_attr == 0 && search_attr == 0) 4102 6025 { 4103 @@ -4254,14 +43 09,29 @@6026 @@ -4254,14 +4318,29 @@ 4104 6027 * highlight match at end of line. If it's beyond the last 4105 6028 * char on the screen, just overwrite that one (tricky!) Not … … 4135 6058 && did_line_attr <= 1 4136 6059 # endif 4137 @@ -4302,15 +43 72,27 @@6060 @@ -4302,15 +4381,27 @@ 4138 6061 #ifdef FEAT_SEARCH_EXTRA 4139 6062 if (area_attr == 0) … … 4170 6093 } 4171 6094 #endif 4172 @@ -4460,6 +45 42,8 @@6095 @@ -4460,6 +4551,8 @@ 4173 6096 { 4174 6097 if (mb_utf8) … … 4179 6102 if ((c & 0xff) == 0) 4180 6103 ScreenLines[off] = 0x80; /* avoid storing zero */ 4181 @@ -4548,7 +46 32,7 @@6104 @@ -4548,7 +4641,7 @@ 4182 6105 4183 6106 /* … … 4188 6111 if (( 4189 6112 #ifdef FEAT_RIGHTLEFT 4190 @@ -4625,9 +47 09,13 @@6113 @@ -4625,9 +4718,13 @@ 4191 6114 #endif 4192 6115 #ifdef FEAT_MBYTE … … 4204 6127 ) 4205 6128 { 4206 @@ -4787,6 +48 75,10 @@6129 @@ -4787,6 +4884,10 @@ 4207 6130 { 4208 6131 unsigned off_from; … … 4215 6138 #if defined(FEAT_GUI) || defined(UNIX) || defined(FEAT_VERTSPLIT) 4216 6139 int hl; 4217 @@ -4813,6 +49 05,10 @@6140 @@ -4813,6 +4914,10 @@ 4218 6141 4219 6142 off_from = (unsigned)(current_ScreenLine - ScreenLines); … … 4226 6149 #ifdef FEAT_RIGHTLEFT 4227 6150 if (rlflag) 4228 @@ -4847,7 +49 43,7 @@6151 @@ -4847,7 +4952,7 @@ 4229 6152 { 4230 6153 #ifdef FEAT_MBYTE … … 4235 6158 char_cells = 1; 4236 6159 #endif 4237 @@ -4924,7 +502 0,7 @@6160 @@ -4924,7 +5029,7 @@ 4238 6161 * ScreenLinesUC[] is sufficient. */ 4239 6162 if (char_cells == 1 … … 4244 6167 /* Writing a single-cell character over a double-cell 4245 6168 * character: need to redraw the next cell. */ 4246 @@ -4933,8 +50 29,8 @@6169 @@ -4933,8 +5038,8 @@ 4247 6170 } 4248 6171 else if (char_cells == 2 … … 4255 6178 /* Writing the second half of a double-cell character over 4256 6179 * a double-cell character: need to redraw the second 4257 @@ -4953,10 +50 49,10 @@6180 @@ -4953,10 +5058,10 @@ 4258 6181 * char over the left halve of an existing one. */ 4259 6182 if (has_mbyte && col + char_cells == endcol … … 4269 6192 #endif 4270 6193 4271 @@ -5096,10 +5 192,11 @@6194 @@ -5096,10 +5201,11 @@ 4272 6195 /* find previous character by counting from first 4273 6196 * column and get its width. */ … … 4282 6205 } 4283 6206 } 4284 @@ -5285,7 +53 82,7 @@6207 @@ -5285,7 +5391,7 @@ 4285 6208 static int skip_status_match_char __ARGS((expand_T *xp, char_u *s)); 4286 6209 … … 4291 6214 static int 4292 6215 status_match_len(xp, s) 4293 @@ -5351,7 +54 48,7 @@6216 @@ -5351,7 +5457,7 @@ 4294 6217 int row; 4295 6218 char_u *buf; … … 4300 6223 int attr; 4301 6224 int i; 4302 @@ -6103,6 +620 0,7 @@6225 @@ -6103,6 +6209,7 @@ 4303 6226 char_u *ptr = text; 4304 6227 int c; … … 4308 6231 int mbyte_cells = 1; 4309 6232 int u8c = 0; 4310 @@ -6119,8 +62 17,12 @@6233 @@ -6119,8 +6226,12 @@ 4311 6234 return; 4312 6235 … … 4323 6246 c = *ptr; 4324 6247 #ifdef FEAT_MBYTE 4325 @@ -6241,19 +6343,19 @@ 6248 @@ -6143,6 +6254,7 @@ 6249 else 6250 u8c = utfc_ptr2char(ptr, u8cc); 6251 mbyte_cells = utf_char2cells(u8c); 6252 +# ifdef UNICODE16 6253 /* Non-BMP character: display as ? or fullwidth ?. */ 6254 if (u8c >= 0x10000) 6255 { 6256 @@ -6150,6 +6262,7 @@ 6257 if (attr == 0) 6258 attr = hl_attr(HLF_8); 6259 } 6260 +# endif 6261 # ifdef FEAT_ARABIC 6262 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) 6263 { 6264 @@ -6241,19 +6354,19 @@ 4326 6265 else if (has_mbyte 4327 6266 && (len < 0 ? ptr[mbyte_blen] == NUL … … 4349 6288 #endif 4350 6289 ScreenLines[off] = c; 4351 @@ -6318,7 +64 20,7 @@6290 @@ -6318,7 +6431,7 @@ 4352 6291 4353 6292 #ifdef FEAT_SEARCH_EXTRA … … 4358 6297 static void 4359 6298 start_search_hl() 4360 @@ -6331,7 +64 33,7 @@6299 @@ -6331,7 +6444,7 @@ 4361 6300 } 4362 6301 … … 4367 6306 static void 4368 6307 end_search_hl() 4369 @@ -6351,18 +64 53,28 @@6308 @@ -6351,18 +6464,28 @@ 4370 6309 win_T *wp; 4371 6310 linenr_T lnum; … … 4401 6340 && shl->lnum == 0 4402 6341 && re_multiline(shl->rm.regprog)) 4403 @@ -6397,11 +65 09,13 @@6342 @@ -6397,11 +6520,13 @@ 4404 6343 } 4405 6344 } … … 4416 6355 * Sets shl->lnum and shl->rm contents. 4417 6356 * Note: Assumes a previous match is always before "lnum", unless 4418 @@ -6411,7 +65 25,7 @@6357 @@ -6411,7 +6536,7 @@ 4419 6358 static void 4420 6359 next_search_hl(win, shl, lnum, mincol) … … 4425 6364 colnr_T mincol; /* minimal column for a match */ 4426 6365 { 4427 @@ -6479,7 +6 593,7 @@6366 @@ -6479,7 +6604,7 @@ 4428 6367 /* Error while handling regexp: stop using this regexp. */ 4429 6368 if (shl == &search_hl) … … 4434 6373 no_hlsearch = TRUE; 4435 6374 } 4436 @@ -6827,6 +69 41,9 @@6375 @@ -6827,6 +6952,9 @@ 4437 6376 { 4438 6377 int r, c; … … 4444 6383 /* Can't use ScreenLines unless initialized */ 4445 6384 if (ScreenLines == NULL) 4446 @@ -6837,10 +69 54,13 @@6385 @@ -6837,10 +6965,13 @@ 4447 6386 for (r = row; r < row + height; ++r) 4448 6387 { … … 4459 6398 screen_char_2(off + c, r, c); 4460 6399 ++c; 4461 @@ -6850,7 +69 70,7 @@6400 @@ -6850,7 +6981,7 @@ 4462 6401 { 4463 6402 screen_char(off + c, r, c); … … 4470 6409 diff -Naur vim71.orig/src/search.c vim71/src/search.c 4471 6410 --- vim71.orig/src/search.c 2007-05-07 12:42:02.000000000 -0700 4472 +++ vim71/src/search.c 2007- 09-03 22:14:24.000000000 -07006411 +++ vim71/src/search.c 2007-10-16 14:14:09.000000000 -0700 4473 6412 @@ -101,7 +101,6 @@ 4474 6413 static char_u *mr_pattern = NULL; /* pattern used by search_regcomp() */ … … 4607 6546 diff -Naur vim71.orig/src/spell.c vim71/src/spell.c 4608 6547 --- vim71.orig/src/spell.c 2007-05-07 12:48:38.000000000 -0700 4609 +++ vim71/src/spell.c 2007- 09-03 22:14:08.000000000 -07006548 +++ vim71/src/spell.c 2007-10-16 14:14:09.000000000 -0700 4610 6549 @@ -7829,7 +7829,7 @@ 4611 6550 # if (_MSC_VER <= 1200) … … 4662 6601 diff -Naur vim71.orig/src/structs.h vim71/src/structs.h 4663 6602 --- vim71.orig/src/structs.h 2007-05-07 12:50:49.000000000 -0700 4664 +++ vim71/src/structs.h 2007-09-03 22:14:43.000000000 -0700 4665 @@ -1453,6 +1453,7 @@ 6603 +++ vim71/src/structs.h 2007-10-16 14:14:38.000000000 -0700 6604 @@ -278,6 +278,9 @@ 6605 linenr_T ue_lcount; /* linecount when u_save called */ 6606 char_u **ue_array; /* array of lines in undo block */ 6607 long ue_size; /* number of lines in ue_array */ 6608 +#ifdef U_DEBUG 6609 + int ue_magic; /* magic number to check allocation */ 6610 +#endif 6611 }; 6612 6613 struct u_header 6614 @@ -300,6 +303,9 @@ 6615 visualinfo_T uh_visual; /* Visual areas before undo/after redo */ 6616 #endif 6617 time_t uh_time; /* timestamp when the change was made */ 6618 +#ifdef U_DEBUG 6619 + int uh_magic; /* magic number to check allocation */ 6620 +#endif 6621 }; 6622 6623 /* values for uh_flags */ 6624 @@ -1453,6 +1459,7 @@ 4666 6625 #ifdef FEAT_MBYTE 4667 6626 char_u *b_start_fenc; /* 'fileencoding' when edit started or NULL */ … … 4671 6630 4672 6631 #ifdef FEAT_EVAL 4673 @@ -1694,6 +1 695,41 @@6632 @@ -1694,6 +1701,41 @@ 4674 6633 #define FR_COL 2 /* frame with a column of windows */ 4675 6634 … … 4713 6672 * 4714 6673 * All row numbers are relative to the start of the window, except w_winrow. 4715 @@ -1934,9 +197 0,8 @@6674 @@ -1934,9 +1976,8 @@ 4716 6675 #endif 4717 6676 … … 4727 6686 diff -Naur vim71.orig/src/syntax.c vim71/src/syntax.c 4728 6687 --- vim71.orig/src/syntax.c 2007-05-07 12:42:55.000000000 -0700 4729 +++ vim71/src/syntax.c 2007- 09-03 22:15:47.000000000 -07006688 +++ vim71/src/syntax.c 2007-10-16 14:14:41.000000000 -0700 4730 6689 @@ -66,8 +66,10 @@ 4731 6690 #define HL_TABLE() ((struct hl_group *)((highlight_ga.ga_data))) … … 4820 6779 * Check for being called with a START pattern. 4821 6780 * Can happen with a match that continues to the next line, because it 4822 @@ -4460,8 +4491,8 @@ 6781 @@ -3323,6 +3354,7 @@ 6782 { 6783 vim_free(SYN_ITEMS(buf)[i].sp_cont_list); 6784 vim_free(SYN_ITEMS(buf)[i].sp_next_list); 6785 + vim_free(SYN_ITEMS(buf)[i].sp_syn.cont_in_list); 6786 } 6787 } 6788 6789 @@ -4460,8 +4492,8 @@ 4823 6790 current_syn_inc_tag = ++running_syn_inc_tag; 4824 6791 prev_toplvl_grp = curbuf->b_syn_topgrp; … … 4831 6798 curbuf->b_syn_topgrp = prev_toplvl_grp; 4832 6799 current_syn_inc_tag = prev_syn_inc_tag; 4833 @@ -5956,8 +598 7,8 @@6800 @@ -5956,8 +5988,8 @@ 4834 6801 { 4835 6802 return (buf->b_syn_patterns.ga_len != 0 … … 4842 6809 4843 6810 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) 4844 @@ -5968,6 + 5999,29 @@6811 @@ -5968,6 +6000,29 @@ 4845 6812 EXP_CASE /* expand ":syn case" arguments */ 4846 6813 } expand_what; … … 4872 6839 /* 4873 6840 * Handle command line completion for :syntax command. 4874 @@ -5983,8 +603 7,8 @@6841 @@ -5983,8 +6038,8 @@ 4875 6842 xp->xp_context = EXPAND_SYNTAX; 4876 6843 expand_what = EXP_SUBCMD; … … 4883 6850 /* (part of) subcommand already typed */ 4884 6851 if (*arg != NUL) 4885 @@ -8479,7 +853 3,7 @@6852 @@ -8479,7 +8534,7 @@ 4886 6853 syn_id2name(id) 4887 6854 int id; … … 4892 6859 return HL_TABLE()[id - 1].sg_name; 4893 6860 } 4894 @@ -8949,7 +900 3,7 @@6861 @@ -8949,7 +9004,7 @@ 4895 6862 return OK; 4896 6863 } … … 4901 6868 static void highlight_list __ARGS((void)); 4902 6869 static void highlight_list_two __ARGS((int cnt, int attr)); 4903 @@ -8967,8 +902 1,8 @@6870 @@ -8967,8 +9022,8 @@ 4904 6871 /* Default: expand group names */ 4905 6872 xp->xp_context = EXPAND_HIGHLIGHT; … … 4912 6879 /* (part of) subcommand already typed */ 4913 6880 if (*arg != NUL) 4914 @@ -8976,7 +903 0,7 @@6881 @@ -8976,7 +9031,7 @@ 4915 6882 p = skiptowhite(arg); 4916 6883 if (*p != NUL) /* past "default" or group name */ … … 4921 6888 { 4922 6889 arg = skipwhite(p); 4923 @@ -8985,7 +90 39,7 @@6890 @@ -8985,7 +9040,7 @@ 4924 6891 } 4925 6892 if (*p != NUL) /* past group name */ … … 4930 6897 highlight_list(); 4931 6898 if (STRNCMP("link", arg, p - arg) == 0 4932 @@ -9045,31 +9 099,25 @@6899 @@ -9045,31 +9100,25 @@ 4933 6900 expand_T *xp; 4934 6901 int idx; … … 4971 6938 * Free all the highlight group fonts. 4972 6939 * Used when quitting for systems which need it. 6940 diff -Naur vim71.orig/src/term.c vim71/src/term.c 6941 --- vim71.orig/src/term.c 2007-05-07 12:39:11.000000000 -0700 6942 +++ vim71/src/term.c 2007-10-16 14:14:28.000000000 -0700 6943 @@ -4809,6 +4809,8 @@ 6944 if (num_bytes == -1) 6945 return -1; 6946 current_tab = (int)bytes[0]; 6947 + if (current_tab == 255) /* -1 in a byte gives 255 */ 6948 + current_tab = -1; 6949 slen += num_bytes; 6950 } 6951 else if (key_name[0] == (int)KS_TABMENU) 4973 6952 diff -Naur vim71.orig/src/termlib.c vim71/src/termlib.c 4974 6953 --- vim71.orig/src/termlib.c 2007-05-07 12:39:49.000000000 -0700 4975 +++ vim71/src/termlib.c 2007- 09-03 22:14:17.000000000 -07006954 +++ vim71/src/termlib.c 2007-10-16 14:14:09.000000000 -0700 4976 6955 @@ -191,7 +191,7 @@ 4977 6956 lbuf[0] == '\t' && … … 4985 6964 diff -Naur vim71.orig/src/testdir/Makefile vim71/src/testdir/Makefile 4986 6965 --- vim71.orig/src/testdir/Makefile 2006-04-30 04:08:01.000000000 -0700 4987 +++ vim71/src/testdir/Makefile 2007- 09-03 22:14:54.000000000 -07006966 +++ vim71/src/testdir/Makefile 2007-10-16 14:14:28.000000000 -0700 4988 6967 @@ -1,9 +1,13 @@ 4989 6968 # … … 4996 6975 +# Uncomment this line for using valgrind. 4997 6976 +# The output goes into a file "valgrind.$PID" (sorry, no test number). 4998 +# VALGRIND = valgrind --tool=memcheck -- num-callers=15 --logfile=valgrind6977 +# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --logfile=valgrind 4999 6978 + 5000 6979 SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ … … 5011 6990 SCRIPTS_GUI = test16.out 5012 6991 5013 @@ -38,7 +43,7 @@ 6992 @@ -34,11 +39,11 @@ 6993 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG) 6994 6995 clean: 6996 - -rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim test.ok X* viminfo 6997 + -rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim test.ok X* valgrind.pid* viminfo 5014 6998 5015 6999 test1.out: test1.in … … 5029 7013 if diff test.out $*.ok; \ 5030 7014 then mv -f test.out $*.out; \ 7015 @@ -61,5 +66,9 @@ 7016 fi" 7017 -rm -rf X* test.ok viminfo 7018 7019 +test49.out: test49.vim 7020 + 7021 +test60.out: test60.vim 7022 + 7023 nolog: 7024 -echo Test results: >test.log 7025 diff -Naur vim71.orig/src/testdir/test14.in vim71/src/testdir/test14.in 7026 --- vim71.orig/src/testdir/test14.in 2004-06-07 07:32:05.000000000 -0700 7027 +++ vim71/src/testdir/test14.in 2007-10-16 14:14:28.000000000 -0700 7028 @@ -18,6 +18,7 @@ 7029 : let tt = "o\<C-V>65\<C-V>x42\<C-V>o103 \<C-V>33a\<C-V>xfg\<C-V>o78\<Esc>" 7030 :endif 7031 :exe "normal " . tt 7032 +:unlet tt 7033 :.w >>test.out 7034 :set vb 7035 /^Piece 7036 diff -Naur vim71.orig/src/testdir/test26.in vim71/src/testdir/test26.in 7037 --- vim71.orig/src/testdir/test26.in 2004-06-07 07:32:05.000000000 -0700 7038 +++ vim71/src/testdir/test26.in 2007-10-16 14:14:28.000000000 -0700 7039 @@ -37,6 +37,7 @@ 7040 : endif 7041 : endif 7042 :endwhile 7043 +:unlet i j 7044 :'t,$w! test.out 7045 :qa! 7046 ENDTEST 7047 diff -Naur vim71.orig/src/testdir/test34.in vim71/src/testdir/test34.in 7048 --- vim71.orig/src/testdir/test34.in 2006-04-30 06:33:24.000000000 -0700 7049 +++ vim71/src/testdir/test34.in 2007-10-16 14:14:28.000000000 -0700 7050 @@ -52,7 +52,15 @@ 7051 ---*--- 7052 (one 7053 (two 7054 -[(one again:$-5,$wq! test.out 7055 +[(one again:$-5,$w! test.out 7056 +:delfunc Table 7057 +:delfunc Compute 7058 +:delfunc Expr1 7059 +:delfunc Expr2 7060 +:delfunc ListItem 7061 +:delfunc ListReset 7062 +:unlet retval counter 7063 +:q! 7064 ENDTEST 7065 7066 here 7067 diff -Naur vim71.orig/src/testdir/test45.in vim71/src/testdir/test45.in 7068 --- vim71.orig/src/testdir/test45.in 2004-06-07 07:32:05.000000000 -0700 7069 +++ vim71/src/testdir/test45.in 2007-10-16 14:14:28.000000000 -0700 7070 @@ -55,6 +55,7 @@ 7071 /kk$ 7072 :call append("$", foldlevel(".")) 7073 :/^last/+1,$w! test.out 7074 +:delfun Flvl 7075 :qa! 7076 ENDTEST 7077 7078 diff -Naur vim71.orig/src/testdir/test47.in vim71/src/testdir/test47.in 7079 --- vim71.orig/src/testdir/test47.in 2004-06-07 07:32:05.000000000 -0700 7080 +++ vim71/src/testdir/test47.in 2007-10-16 14:14:28.000000000 -0700 7081 @@ -34,6 +34,7 @@ 7082 :call append("$", two) 7083 :call append("$", three) 7084 :$-2,$w! test.out 7085 +:unlet one two three 7086 :qa! 7087 ENDTEST 7088 7089 diff -Naur vim71.orig/src/testdir/test49.in vim71/src/testdir/test49.in 7090 --- vim71.orig/src/testdir/test49.in 2006-04-28 02:29:54.000000000 -0700 7091 +++ vim71/src/testdir/test49.in 2007-10-16 14:14:28.000000000 -0700 7092 @@ -1,13 +1,29 @@ 7093 This is a test of the script language. 7094 7095 If after adding a new test, the test output doesn't appear properly in 7096 -test49.failed, try to add one ore more "G"s at the line before ENDTEST. 7097 +test49.failed, try to add one ore more "G"s at the line ending in "test.out" 7098 7099 STARTTEST 7100 :so small.vim 7101 :se nocp nomore viminfo+=nviminfo 7102 :so test49.vim 7103 -GGGGGGGGGG"rp:.-,$wq! test.out 7104 +GGGGGGGGGGGGGG"rp:.-,$w! test.out 7105 +:" 7106 +:" make valgrind happy 7107 +:redir => funclist 7108 +:silent func 7109 +:redir END 7110 +:for line in split(funclist, "\n") 7111 +: let name = matchstr(line, 'function \zs[A-Z]\w*\ze(') 7112 +: if name != '' 7113 +: exe "delfunc " . name 7114 +: endif 7115 +:endfor 7116 +:for v in keys(g:) 7117 +: silent! exe "unlet " . v 7118 +:endfor 7119 +:unlet v 7120 +:qa! 7121 ENDTEST 7122 7123 Results of test49.vim: 7124 diff -Naur vim71.orig/src/testdir/test55.in vim71/src/testdir/test55.in 7125 --- vim71.orig/src/testdir/test55.in 2006-10-15 07:07:05.000000000 -0700 7126 +++ vim71/src/testdir/test55.in 2007-10-16 14:14:28.000000000 -0700 7127 @@ -345,6 +345,10 @@ 7128 :endfun 7129 :call Test(1, 2, [3, 4], {5: 6}) " This may take a while 7130 :" 7131 +:delfunc Test 7132 +:unlet dict 7133 +:call garbagecollect(1) 7134 +:" 7135 :/^start:/,$wq! test.out 7136 ENDTEST 7137 7138 diff -Naur vim71.orig/src/testdir/test56.in vim71/src/testdir/test56.in 7139 --- vim71.orig/src/testdir/test56.in 2006-09-03 07:28:41.000000000 -0700 7140 +++ vim71/src/testdir/test56.in 2007-10-16 14:14:28.000000000 -0700 7141 @@ -17,5 +17,5 @@ 7142 fun s:DoNothing() 7143 call append(line('$'), "nothing line") 7144 endfun 7145 -nnoremap <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()<cr> 7146 +nnoremap <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()<bar>delfunc <SID>DoNothing<bar>delfunc <SID>DoLast<cr> 7147 end: 7148 diff -Naur vim71.orig/src/testdir/test58.in vim71/src/testdir/test58.in 7149 --- vim71.orig/src/testdir/test58.in 2006-04-03 11:24:04.000000000 -0700 7150 +++ vim71/src/testdir/test58.in 2007-10-16 14:14:28.000000000 -0700 7151 @@ -86,6 +86,7 @@ 7152 :$put =str 7153 `m]s:let [str, a] = spellbadword() 7154 :$put =str 7155 +:unlet str a 7156 :" 7157 :" Postponed prefixes 7158 :call TestOne('2', '1') 7159 @@ -100,6 +101,10 @@ 7160 :" NOSLITSUGS 7161 :call TestOne('8', '8') 7162 :" 7163 +:" clean up for valgrind 7164 +:delfunc TestOne 7165 +:set spl= enc=latin1 7166 +:" 7167 gg:/^test output:/,$wq! test.out 7168 ENDTEST 7169 7170 diff -Naur vim71.orig/src/testdir/test59.in vim71/src/testdir/test59.in 7171 --- vim71.orig/src/testdir/test59.in 2006-04-03 11:29:24.000000000 -0700 7172 +++ vim71/src/testdir/test59.in 2007-10-16 14:14:28.000000000 -0700 7173 @@ -90,6 +90,7 @@ 7174 :$put =str 7175 `m]s:let [str, a] = spellbadword() 7176 :$put =str 7177 +:unlet str a 7178 :" 7179 :" Postponed prefixes 7180 :call TestOne('2', '1') 7181 @@ -101,6 +102,10 @@ 7182 :call TestOne('6', '6') 7183 :call TestOne('7', '7') 7184 :" 7185 +:" clean up for valgrind 7186 +:delfunc TestOne 7187 +:set spl= enc=latin1 7188 +:" 7189 gg:/^test output:/,$wq! test.out 7190 ENDTEST 7191 7192 diff -Naur vim71.orig/src/testdir/test60.in vim71/src/testdir/test60.in 7193 --- vim71.orig/src/testdir/test60.in 2006-05-05 11:41:18.000000000 -0700 7194 +++ vim71/src/testdir/test60.in 2007-10-16 14:14:28.000000000 -0700 7195 @@ -569,6 +569,9 @@ 7196 redir END 7197 endfunction 7198 :call TestExists() 7199 +:delfunc TestExists 7200 +:delfunc RunTest 7201 +:delfunc TestFuncArg 7202 :edit! test.out 7203 :set ff=unix 7204 :w 7205 diff -Naur vim71.orig/src/testdir/test60.vim vim71/src/testdir/test60.vim 7206 --- vim71.orig/src/testdir/test60.vim 2006-01-12 11:45:59.000000000 -0800 7207 +++ vim71/src/testdir/test60.vim 2007-10-16 14:14:28.000000000 -0700 7208 @@ -94,4 +94,5 @@ 7209 else 7210 echo "FAILED" 7211 endif 7212 +unlet str 7213 7214 diff -Naur vim71.orig/src/testdir/test62.in vim71/src/testdir/test62.in 7215 --- vim71.orig/src/testdir/test62.in 2006-04-30 04:29:15.000000000 -0700 7216 +++ vim71/src/testdir/test62.in 2007-10-16 14:14:28.000000000 -0700 7217 @@ -7,6 +7,7 @@ 7218 :let nr = tabpagenr() 7219 :q 7220 :call append(line('$'), 'tab page ' . nr) 7221 +:unlet nr 7222 :" 7223 :" Open three tab pages and use ":tabdo" 7224 :0tabnew 7225 @@ -23,6 +24,7 @@ 7226 :q! 7227 :call append(line('$'), line1) 7228 :call append(line('$'), line2) 7229 +:unlet line1 line2 7230 :" 7231 :" 7232 :/^Results/,$w! test.out 5031 7233 diff -Naur vim71.orig/src/testdir/test63.in vim71/src/testdir/test63.in 5032 7234 --- vim71.orig/src/testdir/test63.in 1969-12-31 16:00:00.000000000 -0800 5033 +++ vim71/src/testdir/test63.in 2007- 09-03 22:13:43.000000000 -07007235 +++ vim71/src/testdir/test63.in 2007-10-16 14:14:28.000000000 -0700 5034 7236 @@ -0,0 +1,157 @@ 5035 7237 +Test for ":match", ":2match", ":3match", "clearmatches()", "getmatches()", … … 5095 7297 +: let @r .= "FAILED\n" 5096 7298 +:endif 5097 +:" --- Check that "matchdelete()" returns 0 if succes full and otherwise -1.7299 +:" --- Check that "matchdelete()" returns 0 if successful and otherwise -1. 5098 7300 +:let @r .= "*** Test 6: " 5099 7301 +:let m = matchadd("MyGroup1", "TODO") … … 5152 7354 +:" --- expected behaviour (for now) is to add the first match but not the 5153 7355 +:" --- second and to return 0 (even though it is a matter of debate whether 5154 +:" --- this can be considered succes full behaviour).7356 +:" --- this can be considered successful behaviour). 5155 7357 +:let @r .= "*** Test 9: " 5156 7358 +:let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}]) … … 5162 7364 +:call clearmatches() 5163 7365 +:unlet r1 5164 +:" --- Check that "setmatches()" returns 0 if succes full and otherwise -1.7366 +:" --- Check that "setmatches()" returns 0 if successful and otherwise -1. 5165 7367 +:" --- (A range of valid and invalid input values are tried out to generate the 5166 7368 +:" --- return values.) … … 5192 7394 diff -Naur vim71.orig/src/testdir/test63.ok vim71/src/testdir/test63.ok 5193 7395 --- vim71.orig/src/testdir/test63.ok 1969-12-31 16:00:00.000000000 -0800 5194 +++ vim71/src/testdir/test63.ok 2007- 09-03 22:13:43.000000000 -07007396 +++ vim71/src/testdir/test63.ok 2007-10-16 14:14:07.000000000 -0700 5195 7397 @@ -0,0 +1,11 @@ 5196 7398 +Results of test63: … … 5207 7409 diff -Naur vim71.orig/src/testdir/test64.in vim71/src/testdir/test64.in 5208 7410 --- vim71.orig/src/testdir/test64.in 1969-12-31 16:00:00.000000000 -0800 5209 +++ vim71/src/testdir/test64.in 2007- 09-03 22:14:54.000000000 -07005210 @@ -0,0 +1,5 2@@7411 +++ vim71/src/testdir/test64.in 2007-10-16 14:14:28.000000000 -0700 7412 @@ -0,0 +1,54 @@ 5211 7413 +Test for regexp patterns. 5212 7414 + … … 5255 7457 +: endif 5256 7458 +: endfor 7459 +: unlet i 5257 7460 +: endif 5258 7461 +:endfor 7462 +:unlet t tl e l 5259 7463 +:/^Results/,$wq! test.out 5260 7464 +ENDTEST … … 5263 7467 diff -Naur vim71.orig/src/testdir/test64.ok vim71/src/testdir/test64.ok 5264 7468 --- vim71.orig/src/testdir/test64.ok 1969-12-31 16:00:00.000000000 -0800 5265 +++ vim71/src/testdir/test64.ok 2007- 09-03 22:14:54.000000000 -07007469 +++ vim71/src/testdir/test64.ok 2007-10-16 14:14:14.000000000 -0700 5266 7470 @@ -0,0 +1,6 @@ 5267 7471 +Results of test64: … … 5273 7477 diff -Naur vim71.orig/src/ui.c vim71/src/ui.c 5274 7478 --- vim71.orig/src/ui.c 2007-05-07 12:49:09.000000000 -0700 5275 +++ vim71/src/ui.c 2007- 09-03 22:15:10.000000000 -07007479 +++ vim71/src/ui.c 2007-10-16 14:14:17.000000000 -0700 5276 7480 @@ -1603,8 +1603,6 @@ 5277 7481 #if defined(FEAT_GUI) || defined(FEAT_MOUSE_GPM) \ … … 5294 7498 || (defined(FEAT_GUI) && (!defined(USE_ON_FLY_SCROLL) \ 5295 7499 || defined(FEAT_MENU))) \ 7500 diff -Naur vim71.orig/src/undo.c vim71/src/undo.c 7501 --- vim71.orig/src/undo.c 2007-05-07 12:21:14.000000000 -0700 7502 +++ vim71/src/undo.c 2007-10-16 14:14:38.000000000 -0700 7503 @@ -76,6 +76,12 @@ 7504 * buffer is unloaded. 7505 */ 7506 7507 +/* Uncomment the next line for including the u_check() function. This warns 7508 + * for errors in the debug information. */ 7509 +/* #define U_DEBUG 1 */ 7510 +#define UH_MAGIC 0x18dade /* value for uh_magic when in use */ 7511 +#define UE_MAGIC 0xabc123 /* value for ue_magic when in use */ 7512 + 7513 #include "vim.h" 7514 7515 /* See below: use malloc()/free() for memory management. */ 7516 @@ -113,6 +119,95 @@ 7517 */ 7518 static int undo_undoes = FALSE; 7519 7520 +#ifdef U_DEBUG 7521 +/* 7522 + * Check the undo structures for being valid. Print a warning when something 7523 + * looks wrong. 7524 + */ 7525 +static int seen_b_u_curhead; 7526 +static int seen_b_u_newhead; 7527 +static int header_count; 7528 + 7529 + static void 7530 +u_check_tree(u_header_T *uhp, 7531 + u_header_T *exp_uh_next, 7532 + u_header_T *exp_uh_alt_prev) 7533 +{ 7534 + u_entry_T *uep; 7535 + 7536 + if (uhp == NULL) 7537 + return; 7538 + ++header_count; 7539 + if (uhp == curbuf->b_u_curhead && ++seen_b_u_curhead > 1) 7540 + { 7541 + EMSG("b_u_curhead found twice (looping?)"); 7542 + return; 7543 + } 7544 + if (uhp == curbuf->b_u_newhead && ++seen_b_u_newhead > 1) 7545 + { 7546 + EMSG("b_u_newhead found twice (looping?)"); 7547 + return; 7548 + } 7549 + 7550 + if (uhp->uh_magic != UH_MAGIC) 7551 + EMSG("uh_magic wrong (may be using freed memory)"); 7552 + else 7553 + { 7554 + /* Check pointers back are correct. */ 7555 + if (uhp->uh_next != exp_uh_next) 7556 + { 7557 + EMSG("uh_next wrong"); 7558 + smsg((char_u *)"expected: 0x%x, actual: 0x%x", 7559 + exp_uh_next, uhp->uh_next); 7560 + } 7561 + if (uhp->uh_alt_prev != exp_uh_alt_prev) 7562 + { 7563 + EMSG("uh_alt_prev wrong"); 7564 + smsg((char_u *)"expected: 0x%x, actual: 0x%x", 7565 + exp_uh_alt_prev, uhp->uh_alt_prev); 7566 + } 7567 + 7568 + /* Check the undo tree at this header. */ 7569 + for (uep = uhp->uh_entry; uep != NULL; uep = uep->ue_next) 7570 + { 7571 + if (uep->ue_magic != UE_MAGIC) 7572 + { 7573 + EMSG("ue_magic wrong (may be using freed memory)"); 7574 + break; 7575 + } 7576 + } 7577 + 7578 + /* Check the next alt tree. */ 7579 + u_check_tree(uhp->uh_alt_next, uhp->uh_next, uhp); 7580 + 7581 + /* Check the next header in this branch. */ 7582 + u_check_tree(uhp->uh_prev, uhp, NULL); 7583 + } 7584 +} 7585 + 7586 + void 7587 +u_check(int newhead_may_be_NULL) 7588 +{ 7589 + seen_b_u_newhead = 0; 7590 + seen_b_u_curhead = 0; 7591 + header_count = 0; 7592 + 7593 + u_check_tree(curbuf->b_u_oldhead, NULL, NULL); 7594 + 7595 + if (seen_b_u_newhead == 0 && curbuf->b_u_oldhead != NULL 7596 + && !(newhead_may_be_NULL && curbuf->b_u_newhead == NULL)) 7597 + EMSGN("b_u_newhead invalid: 0x%x", curbuf->b_u_newhead); 7598 + if (curbuf->b_u_curhead != NULL && seen_b_u_curhead == 0) 7599 + EMSGN("b_u_curhead invalid: 0x%x", curbuf->b_u_curhead); 7600 + if (header_count != curbuf->b_u_numhead) 7601 + { 7602 + EMSG("b_u_numhead invalid"); 7603 + smsg((char_u *)"expected: %ld, actual: %ld", 7604 + (long)header_count, (long)curbuf->b_u_numhead); 7605 + } 7606 +} 7607 +#endif 7608 + 7609 /* 7610 * Save the current line for both the "u" and "U" command. 7611 * Returns OK or FAIL. 7612 @@ -243,6 +338,9 @@ 7613 if (!undo_allowed()) 7614 return FAIL; 7615 7616 +#ifdef U_DEBUG 7617 + u_check(FALSE); 7618 +#endif 7619 #ifdef FEAT_NETBEANS_INTG 7620 /* 7621 * Netbeans defines areas that cannot be modified. Bail out here when 7622 @@ -294,6 +392,9 @@ 7623 uhp = (u_header_T *)U_ALLOC_LINE((unsigned)sizeof(u_header_T)); 7624 if (uhp == NULL) 7625 goto nomem; 7626 +#ifdef U_DEBUG 7627 + uhp->uh_magic = UH_MAGIC; 7628 +#endif 7629 } 7630 else 7631 uhp = NULL; 7632 @@ -316,8 +417,11 @@ 7633 { 7634 u_header_T *uhfree = curbuf->b_u_oldhead; 7635 7636 - /* If there is no branch only free one header. */ 7637 - if (uhfree->uh_alt_next == NULL) 7638 + if (uhfree == old_curhead) 7639 + /* Can't reconnect the branch, delete all of it. */ 7640 + u_freebranch(curbuf, uhfree, &old_curhead); 7641 + else if (uhfree->uh_alt_next == NULL) 7642 + /* There is no branch, only free one header. */ 7643 u_freeheader(curbuf, uhfree, &old_curhead); 7644 else 7645 { 7646 @@ -326,6 +430,9 @@ 7647 uhfree = uhfree->uh_alt_next; 7648 u_freebranch(curbuf, uhfree, &old_curhead); 7649 } 7650 +#ifdef U_DEBUG 7651 + u_check(TRUE); 7652 +#endif 7653 } 7654 7655 if (uhp == NULL) /* no undo at all */ 7656 @@ -478,6 +585,9 @@ 7657 uep = (u_entry_T *)U_ALLOC_LINE((unsigned)sizeof(u_entry_T)); 7658 if (uep == NULL) 7659 goto nomem; 7660 +#ifdef U_DEBUG 7661 + uep->ue_magic = UE_MAGIC; 7662 +#endif 7663 7664 uep->ue_size = size; 7665 uep->ue_top = top; 7666 @@ -525,6 +635,9 @@ 7667 curbuf->b_u_synced = FALSE; 7668 undo_undoes = FALSE; 7669 7670 +#ifdef U_DEBUG 7671 + u_check(FALSE); 7672 +#endif 7673 return OK; 7674 7675 nomem: 7676 @@ -955,6 +1068,9 @@ 7677 int empty_buffer; /* buffer became empty */ 7678 u_header_T *curhead = curbuf->b_u_curhead; 7679 7680 +#ifdef U_DEBUG 7681 + u_check(FALSE); 7682 +#endif 7683 old_flags = curhead->uh_flags; 7684 new_flags = (curbuf->b_changed ? UH_CHANGED : 0) + 7685 ((curbuf->b_ml.ml_flags & ML_EMPTY) ? UH_EMPTYBUF : 0); 7686 @@ -1186,6 +1302,9 @@ 7687 /* The timestamp can be the same for multiple changes, just use the one of 7688 * the undone/redone change. */ 7689 curbuf->b_u_seq_time = curhead->uh_time; 7690 +#ifdef U_DEBUG 7691 + u_check(FALSE); 7692 +#endif 7693 } 7694 7695 /* 7696 @@ -1515,7 +1634,7 @@ 7697 } 7698 7699 /* 7700 - * Free one header and its entry list and adjust the pointers. 7701 + * Free one header "uhp" and its entry list and adjust the pointers. 7702 */ 7703 static void 7704 u_freeheader(buf, uhp, uhpp) 7705 @@ -1523,6 +1642,8 @@ 7706 u_header_T *uhp; 7707 u_header_T **uhpp; /* if not NULL reset when freeing this header */ 7708 { 7709 + u_header_T *uhap; 7710 + 7711 /* When there is an alternate redo list free that branch completely, 7712 * because we can never go there. */ 7713 if (uhp->uh_alt_next != NULL) 7714 @@ -1540,7 +1661,8 @@ 7715 if (uhp->uh_prev == NULL) 7716 buf->b_u_newhead = uhp->uh_next; 7717 else 7718 - uhp->uh_prev->uh_next = uhp->uh_next; 7719 + for (uhap = uhp->uh_prev; uhap != NULL; uhap = uhap->uh_alt_next) 7720 + uhap->uh_next = uhp->uh_next; 7721 7722 u_freeentries(buf, uhp, uhpp); 7723 } 7724 @@ -1585,6 +1707,8 @@ 7725 /* Check for pointers to the header that become invalid now. */ 7726 if (buf->b_u_curhead == uhp) 7727 buf->b_u_curhead = NULL; 7728 + if (buf->b_u_newhead == uhp) 7729 + buf->b_u_newhead = NULL; /* freeing the newest entry */ 7730 if (uhpp != NULL && uhp == *uhpp) 7731 *uhpp = NULL; 7732 7733 @@ -1594,6 +1718,9 @@ 7734 u_freeentry(uep, uep->ue_size); 7735 } 7736 7737 +#ifdef U_DEBUG 7738 + uhp->uh_magic = 0; 7739 +#endif 7740 U_FREE_LINE((char_u *)uhp); 7741 --buf->b_u_numhead; 7742 } 7743 @@ -1609,6 +1736,9 @@ 7744 while (n > 0) 7745 U_FREE_LINE(uep->ue_array[--n]); 7746 U_FREE_LINE((char_u *)uep->ue_array); 7747 +#ifdef U_DEBUG 7748 + uep->ue_magic = 0; 7749 +#endif 7750 U_FREE_LINE((char_u *)uep); 7751 } 7752 5296 7753 diff -Naur vim71.orig/src/version.c vim71/src/version.c 5297 7754 --- vim71.orig/src/version.c 2007-05-12 03:23:44.000000000 -0700 5298 +++ vim71/src/version.c 2007- 09-03 22:15:47.000000000 -07005299 @@ -667,6 +667, 174@@7755 +++ vim71/src/version.c 2007-10-16 14:14:41.000000000 -0700 7756 @@ -667,6 +667,256 @@ 5300 7757 static int included_patches[] = 5301 7758 { /* Add new patch number below this line */ 5302 7759 /**/ 7760 + 140, 7761 +/**/ 7762 + 139, 7763 +/**/ 7764 + 138, 7765 +/**/ 7766 + 137, 7767 +/**/ 7768 + 136, 7769 +/**/ 7770 + 135, 7771 +/**/ 7772 + 133, 7773 +/**/ 7774 + 132, 7775 +/**/ 7776 + 131, 7777 +/**/ 7778 + 130, 7779 +/**/ 7780 + 127, 7781 +/**/ 7782 + 125, 7783 +/**/ 7784 + 123, 7785 +/**/ 7786 + 122, 7787 +/**/ 7788 + 121, 7789 +/**/ 7790 + 120, 7791 +/**/ 7792 + 119, 7793 +/**/ 7794 + 118, 7795 +/**/ 7796 + 117, 7797 +/**/ 7798 + 116, 7799 +/**/ 7800 + 115, 7801 +/**/ 7802 + 114, 7803 +/**/ 7804 + 113, 7805 +/**/ 7806 + 112, 7807 +/**/ 7808 + 111, 7809 +/**/ 7810 + 110, 7811 +/**/ 7812 + 109, 7813 +/**/ 7814 + 108, 7815 +/**/ 7816 + 107, 7817 +/**/ 7818 + 106, 7819 +/**/ 7820 + 105, 7821 +/**/ 7822 + 104, 7823 +/**/ 7824 + 103, 7825 +/**/ 7826 + 102, 7827 +/**/ 7828 + 101, 7829 +/**/ 7830 + 100, 7831 +/**/ 7832 + 99, 7833 +/**/ 7834 + 98, 7835 +/**/ 7836 + 97, 7837 +/**/ 7838 + 96, 7839 +/**/ 7840 + 95, 7841 +/**/ 5303 7842 + 94, 5304 7843 +/**/ … … 5474 8013 diff -Naur vim71.orig/src/vim.h vim71/src/vim.h 5475 8014 --- vim71.orig/src/vim.h 2007-05-12 02:53:29.000000000 -0700 5476 +++ vim71/src/vim.h 2007- 09-03 22:14:31.000000000 -07008015 +++ vim71/src/vim.h 2007-10-16 14:14:09.000000000 -0700 5477 8016 @@ -1380,8 +1380,14 @@ 5478 8017 #endif … … 5494 8033 diff -Naur vim71.orig/src/vimtutor vim71/src/vimtutor 5495 8034 --- vim71.orig/src/vimtutor 2004-06-07 07:32:27.000000000 -0700 5496 +++ vim71/src/vimtutor 2007- 09-03 22:13:19.000000000 -07008035 +++ vim71/src/vimtutor 2007-10-16 14:14:06.000000000 -0700 5497 8036 @@ -39,18 +39,22 @@ 5498 8037 # remove the copy of the tutor on exit … … 5530 8069 diff -Naur vim71.orig/src/window.c vim71/src/window.c 5531 8070 --- vim71.orig/src/window.c 2007-05-07 12:25:30.000000000 -0700 5532 +++ vim71/src/window.c 2007- 09-03 22:14:47.000000000 -07008071 +++ vim71/src/window.c 2007-10-16 14:14:31.000000000 -0700 5533 8072 @@ -75,6 +75,7 @@ 5534 8073 static win_T *restore_snapshot_rec __ARGS((frame_T *sn, frame_T *fr)); … … 5539 8078 static void win_new_height __ARGS((win_T *, int)); 5540 8079 8080 @@ -583,7 +584,7 @@ 8081 ++no_mapping; 8082 ++allow_keys; /* no mapping for xchar, but allow key codes */ 8083 if (xchar == NUL) 8084 - xchar = safe_vgetc(); 8085 + xchar = plain_vgetc(); 8086 #ifdef FEAT_LANGMAP 8087 LANGMAP_ADJUST(xchar, TRUE); 8088 #endif 5541 8089 @@ -732,7 +733,6 @@ 5542 8090 if (flags & WSP_VERT) … … 5614 8162 5615 8163 /* 8164 @@ -1253,7 +1291,7 @@ 8165 * Don't execute autocommands while creating the windows. Must do that 8166 * when putting the buffers in the windows. 8167 */ 8168 - ++autocmd_block; 8169 + block_autocmds(); 8170 #endif 8171 8172 /* todo is number of windows left to create */ 8173 @@ -1275,7 +1313,7 @@ 8174 } 8175 8176 #ifdef FEAT_AUTOCMD 8177 - --autocmd_block; 8178 + unblock_autocmds(); 8179 #endif 8180 8181 /* return actual number of windows */ 5616 8182 @@ -2120,7 +2158,7 @@ 5617 8183 if (wp->w_p_pvw || bt_quickfix(wp->w_buffer)) … … 5727 8293 } 5728 8294 #endif 5729 @@ -4128,6 +4209,10 @@ 8295 @@ -3334,7 +3415,7 @@ 8296 * Don't execute autocommands while creating the tab pages. Must do that 8297 * when putting the buffers in the windows. 8298 */ 8299 - ++autocmd_block; 8300 + block_autocmds(); 8301 #endif 8302 8303 for (todo = count - 1; todo > 0; --todo) 8304 @@ -3342,7 +3423,7 @@ 8305 break; 8306 5730 8307 #ifdef FEAT_AUTOCMD 5731 --autocmd_block; 5732 #endif 8308 - --autocmd_block; 8309 + unblock_autocmds(); 8310 #endif 8311 8312 /* return actual number of tab pages */ 8313 @@ -4081,7 +4162,7 @@ 8314 /* Don't execute autocommands while the window is not properly 8315 * initialized yet. gui_create_scrollbar() may trigger a FocusGained 8316 * event. */ 8317 - ++autocmd_block; 8318 + block_autocmds(); 8319 #endif 8320 /* 8321 * link the window in the window list 8322 @@ -4126,7 +4207,11 @@ 8323 foldInitWin(newwin); 8324 #endif 8325 #ifdef FEAT_AUTOCMD 8326 - --autocmd_block; 8327 + unblock_autocmds(); 8328 +#endif 5733 8329 +#ifdef FEAT_SEARCH_EXTRA 5734 8330 + newwin->w_match_head = NULL; 5735 8331 + newwin->w_next_match_id = 4; 5736 +#endif8332 #endif 5737 8333 } 5738 8334 return newwin; 5739 } 8335 @@ -4147,7 +4232,7 @@ 8336 #ifdef FEAT_AUTOCMD 8337 /* Don't execute autocommands while the window is halfway being deleted. 8338 * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */ 8339 - ++autocmd_block; 8340 + block_autocmds(); 8341 #endif 8342 8343 #ifdef FEAT_MZSCHEME 5740 8344 @@ -4185,11 +4270,11 @@ 5741 8345 vim_free(wp->w_tagstack[i].tagname); … … 5753 8357 free_jumplist(wp); 5754 8358 #endif 5755 @@ -6174,3 +6259,175 @@ 8359 @@ -4210,7 +4295,7 @@ 8360 vim_free(wp); 8361 8362 #ifdef FEAT_AUTOCMD 8363 - --autocmd_block; 8364 + unblock_autocmds(); 8365 #endif 8366 } 8367 8368 @@ -5438,6 +5523,7 @@ 8369 { 8370 EMSG(_(e_noroom)); 8371 p_ch = old_p_ch; 8372 + curtab->tp_ch_used = p_ch; 8373 cmdline_row = Rows - p_ch; 8374 break; 8375 } 8376 @@ -6174,3 +6260,175 @@ 5756 8377 return FALSE; 5757 8378 }
Note:
See TracChangeset
for help on using the changeset viewer.