source:
patches/vim-7.1-fixes-4.patch@
6b5cc685
Last change on this file since 6b5cc685 was c2aa910, checked in by , 17 years ago | |
---|---|
|
|
File size: 243.7 KB |
-
runtime/doc/change.txt
Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 10-16-2007 Initial Package Version: 7.1 Origin: Upstream Upstream Status: Applied Description: Contains all upstream patches up to 7.1.140 The following patches were skipped 003 007 041 065 070 072 080 088 091 092 124 126 128 129 134 diff -Naur vim71.orig/runtime/doc/change.txt vim71/runtime/doc/change.txt
old new 1571 1571 in their original order, right before the sorted 1572 1572 lines. 1573 1573 1574 If {pattern} is empty (e.g. // is specified), the 1575 last search pattern is used. This allows trying out 1576 a pattern first. 1577 1574 1578 Note that using ":sort" with ":global" doesn't sort the matching lines, it's 1575 1579 quite useless. 1576 1580 -
runtime/doc/eval.txt
diff -Naur vim71.orig/runtime/doc/eval.txt vim71/runtime/doc/eval.txt
old new 1 *eval.txt* For Vim version 7.1. Last change: 2007 May 111 *eval.txt* For Vim version 7.1. Last change: 2007 Sep 25 2 2 3 3 4 4 VIM REFERENCE MANUAL by Bram Moolenaar … … 1557 1557 changenr() Number current change number 1558 1558 char2nr( {expr}) Number ASCII value of first char in {expr} 1559 1559 cindent( {lnum}) Number C indent for line {lnum} 1560 clearmatches() None clear all matches 1560 1561 col( {expr}) Number column nr of cursor or mark 1561 1562 complete({startcol}, {matches}) String set Insert mode completion 1562 1563 complete_add( {expr}) Number add completion match … … 1602 1603 foldtextresult( {lnum}) String text for closed fold at {lnum} 1603 1604 foreground( ) Number bring the Vim window to the foreground 1604 1605 function( {name}) Funcref reference to function {name} 1605 garbagecollect( )none free memory, breaking cyclic references1606 garbagecollect( [at_exit]) none free memory, breaking cyclic references 1606 1607 get( {list}, {idx} [, {def}]) any get item {idx} from {list} or {def} 1607 1608 get( {dict}, {key} [, {def}]) any get item {key} from {dict} or {def} 1608 1609 getbufline( {expr}, {lnum} [, {end}]) … … 1622 1623 getline( {lnum}) String line {lnum} of current buffer 1623 1624 getline( {lnum}, {end}) List lines {lnum} to {end} of current buffer 1624 1625 getloclist({nr}) List list of location list items 1626 getmatches() List list of current matches 1625 1627 getpos( {expr}) List position of cursor, mark, etc. 1626 1628 getqflist() List list of quickfix items 1627 1629 getreg( [{regname} [, 1]]) String contents of register … … 1676 1678 String check for mappings matching {name} 1677 1679 match( {expr}, {pat}[, {start}[, {count}]]) 1678 1680 Number position where {pat} matches in {expr} 1681 matchadd( {group}, {pattern}[, {priority}[, {id}]]) 1682 Number highlight {pattern} with {group} 1679 1683 matcharg( {nr}) List arguments of |:match| 1684 matchdelete( {id}) Number delete match identified by {id} 1680 1685 matchend( {expr}, {pat}[, {start}[, {count}]]) 1681 1686 Number position where {pat} ends in {expr} 1682 1687 matchlist( {expr}, {pat}[, {start}[, {count}]]) … … 1731 1736 setline( {lnum}, {line}) Number set line {lnum} to {line} 1732 1737 setloclist( {nr}, {list}[, {action}]) 1733 1738 Number modify location list using {list} 1739 setmatches( {list}) Number restore a list of matches 1734 1740 setpos( {expr}, {list}) none set the {expr} position to {list} 1735 1741 setqflist( {list}[, {action}]) Number modify quickfix list using {list} 1736 1742 setreg( {n}, {v}[, {opt}]) Number set register to value and type … … 2012 2018 feature, -1 is returned. 2013 2019 See |C-indenting|. 2014 2020 2021 clearmatches() *clearmatches()* 2022 Clears all matches previously defined by |matchadd()| and the 2023 |:match| commands. 2024 2015 2025 *col()* 2016 2026 col({expr}) The result is a Number, which is the byte index of the column 2017 2027 position given with {expr}. The accepted positions are: … … 2020 2030 number of characters in the cursor line plus one) 2021 2031 'x position of mark x (if the mark is not set, 0 is 2022 2032 returned) 2033 Additionally {expr} can be [lnum, col]: a |List| with the line 2034 and column number. Most useful when the column is "$", to get 2035 the las column of a specific line. When "lnum" or "col" is 2036 out of range then col() returns zero. 2023 2037 To get the line number use |line()|. To get both use 2024 2038 |getpos()|. 2025 2039 For the screen column position use |virtcol()|. … … 2659 2673 {name} can be a user defined function or an internal function. 2660 2674 2661 2675 2662 garbagecollect( )*garbagecollect()*2676 garbagecollect([at_exit]) *garbagecollect()* 2663 2677 Cleanup unused |Lists| and |Dictionaries| that have circular 2664 2678 references. There is hardly ever a need to invoke this 2665 2679 function, as it is automatically done when Vim runs out of … … 2669 2683 This is useful if you have deleted a very big |List| and/or 2670 2684 |Dictionary| with circular references in a script that runs 2671 2685 for a long time. 2686 When the optional "at_exit" argument is one, garbage 2687 collection will also be done when exiting Vim, if it wasn't 2688 done before. This is useful when checking for memory leaks. 2672 2689 2673 2690 get({list}, {idx} [, {default}]) *get()* 2674 2691 Get item {idx} from |List| {list}. When this item is not … … 2824 2841 given file {fname}. 2825 2842 If {fname} is a directory, 0 is returned. 2826 2843 If the file {fname} can't be found, -1 is returned. 2844 If the size of {fname} is too big to fit in a Number then -2 2845 is returned. 2827 2846 2828 2847 getfontname([{name}]) *getfontname()* 2829 2848 Without an argument returns the name of the normal font being … … 2912 2931 returned. For an invalid window number {nr}, an empty list is 2913 2932 returned. Otherwise, same as getqflist(). 2914 2933 2934 getmatches() *getmatches()* 2935 Returns a |List| with all matches previously defined by 2936 |matchadd()| and the |:match| commands. |getmatches()| is 2937 useful in combination with |setmatches()|, as |setmatches()| 2938 can restore a list of matches saved by |getmatches()|. 2939 Example: > 2940 :echo getmatches() 2941 < [{'group': 'MyGroup1', 'pattern': 'TODO', 2942 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 2943 'pattern': 'FIXME', 'priority': 10, 'id': 2}] > 2944 :let m = getmatches() 2945 :call clearmatches() 2946 :echo getmatches() 2947 < [] > 2948 :call setmatches(m) 2949 :echo getmatches() 2950 < [{'group': 'MyGroup1', 'pattern': 'TODO', 2951 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 2952 'pattern': 'FIXME', 'priority': 10, 'id': 2}] > 2953 :unlet m 2954 < 2955 2915 2956 getqflist() *getqflist()* 2916 2957 Returns a list with all the current quickfix errors. Each 2917 2958 list item is a dictionary with these entries: … … 3616 3657 the pattern. 'smartcase' is NOT used. The matching is always 3617 3658 done like 'magic' is set and 'cpoptions' is empty. 3618 3659 3660 *matchadd()* *E798* *E799* *E801* 3661 matchadd({group}, {pattern}[, {priority}[, {id}]]) 3662 Defines a pattern to be highlighted in the current window (a 3663 "match"). It will be highlighted with {group}. Returns an 3664 identification number (ID), which can be used to delete the 3665 match using |matchdelete()|. 3666 3667 The optional {priority} argument assigns a priority to the 3668 match. A match with a high priority will have its 3669 highlighting overrule that of a match with a lower priority. 3670 A priority is specified as an integer (negative numbers are no 3671 exception). If the {priority} argument is not specified, the 3672 default priority is 10. The priority of 'hlsearch' is zero, 3673 hence all matches with a priority greater than zero will 3674 overrule it. Syntax highlighting (see 'syntax') is a separate 3675 mechanism, and regardless of the chosen priority a match will 3676 always overrule syntax highlighting. 3677 3678 The optional {id} argument allows the request for a specific 3679 match ID. If a specified ID is already taken, an error 3680 message will appear and the match will not be added. An ID 3681 is specified as a positive integer (zero excluded). IDs 1, 2 3682 and 3 are reserved for |:match|, |:2match| and |:3match|, 3683 respectively. If the {id} argument is not specified, 3684 |matchadd()| automatically chooses a free ID. 3685 3686 The number of matches is not limited, as it is the case with 3687 the |:match| commands. 3688 3689 Example: > 3690 :highlight MyGroup ctermbg=green guibg=green 3691 :let m = matchadd("MyGroup", "TODO") 3692 < Deletion of the pattern: > 3693 :call matchdelete(m) 3694 3695 < A list of matches defined by |matchadd()| and |:match| are 3696 available from |getmatches()|. All matches can be deleted in 3697 one operation by |clearmatches()|. 3619 3698 3620 3699 matcharg({nr}) *matcharg()* 3621 3700 Selects the {nr} match item, as set with a |:match|, … … 3625 3704 The pattern used. 3626 3705 When {nr} is not 1, 2 or 3 returns an empty |List|. 3627 3706 When there is no match item set returns ['', '']. 3628 This is usef to save and restore a |:match|. 3629 3707 This is useful to save and restore a |:match|. 3708 Highlighting matches using the |:match| commands are limited 3709 to three matches. |matchadd()| does not have this limitation. 3710 3711 matchdelete({id}) *matchdelete()* *E802* *E803* 3712 Deletes a match with ID {id} previously defined by |matchadd()| 3713 or one of the |:match| commands. Returns 0 if succesfull, 3714 otherwise -1. See example for |matchadd()|. All matches can 3715 be deleted in one operation by |clearmatches()|. 3630 3716 3631 3717 matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()* 3632 3718 Same as match(), but return the index of first character after … … 4379 4465 When {nr} is zero the current window is used. For a location 4380 4466 list window, the displayed location list is modified. For an 4381 4467 invalid window number {nr}, -1 is returned. 4382 Otherwise, same as setqflist(). 4468 Otherwise, same as |setqflist()|. 4469 Also see |location-list|. 4470 4471 setmatches({list}) *setmatches()* 4472 Restores a list of matches saved by |getmatches()|. Returns 0 4473 if succesfull, otherwise -1. All current matches are cleared 4474 before the list is restored. See example for |getmatches()|. 4383 4475 4384 4476 *setpos()* 4385 4477 setpos({expr}, {list}) … … 5022 5114 position, the returned Number will be the column at the end of 5023 5115 the <Tab>. For example, for a <Tab> in column 1, with 'ts' 5024 5116 set to 8, it returns 8. 5025 For the use of {expr} see |col()|. Additionally you can use 5026 [lnum, col]: a |List| with the line and column number. When 5027 "lnum" or "col" is out of range then virtcol() returns zero. 5028 When 'virtualedit' is used it can be [lnum, col, off], where 5117 For the byte position use |col()|. 5118 For the use of {expr} see |col()|. 5119 When 'virtualedit' is used {expr} can be [lnum, col, off], where 5029 5120 "off" is the offset in screen columns from the start of the 5030 5121 character. E.g., a position within a <Tab> or after the last 5031 5122 character. 5032 For the byte position use |col()|.5033 5123 When Virtual editing is active in the current mode, a position 5034 5124 beyond the end of the line can be returned. |'virtualedit'| 5035 5125 The accepted positions are: -
runtime/doc/options.txt
diff -Naur vim71.orig/runtime/doc/options.txt vim71/runtime/doc/options.txt
old new 1 *options.txt* For Vim version 7.1. Last change: 2007 May 111 *options.txt* For Vim version 7.1. Last change: 2007 Aug 10 2 2 3 3 4 4 VIM REFERENCE MANUAL by Bram Moolenaar … … 2415 2415 When mixing vertically and horizontally split windows, a minimal size 2416 2416 is computed and some windows may be larger if there is room. The 2417 2417 'eadirection' option tells in which direction the size is affected. 2418 Changing the height of a window can be avoided by setting2419 'winfixheight' .2418 Changing the height and width of a window can be avoided by setting 2419 'winfixheight' and 'winfixwidth', respectively. 2420 2420 2421 2421 *'equalprg'* *'ep'* 2422 2422 'equalprg' 'ep' string (default "") -
runtime/doc/pattern.txt
diff -Naur vim71.orig/runtime/doc/pattern.txt vim71/runtime/doc/pattern.txt
old new 1212 1212 {group} must exist at the moment this command is executed. 1213 1213 1214 1214 The {group} highlighting still applies when a character is 1215 to be highlighted for 'hlsearch'. 1215 to be highlighted for 'hlsearch', as the highlighting for 1216 matches is given higher priority than that of 'hlsearch'. 1217 Syntax highlighting (see 'syntax') is also overruled by 1218 matches. 1216 1219 1217 1220 Note that highlighting the last used search pattern with 1218 1221 'hlsearch' is used in all windows, while the pattern defined … … 1226 1229 display you may get unexpected results. That is because Vim 1227 1230 looks for a match in the line where redrawing starts. 1228 1231 1229 Also see |matcharg()|, it returns the highlight group and 1230 pattern of a previous :match command. 1232 Also see |matcharg()|and |getmatches()|. The former returns 1233 the highlight group and pattern of a previous |:match| 1234 command. The latter returns a list with highlight groups and 1235 patterns defined by both |matchadd()| and |:match|. 1236 1237 Highlighting matches using |:match| are limited to three 1238 matches (aside from |:match|, |:2match| and |:3match|are 1239 available). |matchadd()| does not have this limitation and in 1240 addition makes it possible to prioritize matches. 1231 1241 1232 1242 Another example, which highlights all characters in virtual 1233 1243 column 72 and more: > -
runtime/doc/pi_paren.txt
diff -Naur vim71.orig/runtime/doc/pi_paren.txt vim71/runtime/doc/pi_paren.txt
old new 12 12 You can avoid loading this plugin by setting the "loaded_matchparen" variable: > 13 13 :let loaded_matchparen = 1 14 14 15 The plugin installs CursorMoved autocommands to redefine the match16 highlighting.15 The plugin installs CursorMoved, CursorMovedI and WinEnter autocommands to 16 redefine the match highlighting. 17 17 18 18 To disable the plugin after it was loaded use this command: > 19 19 -
runtime/doc/usr_41.txt
diff -Naur vim71.orig/runtime/doc/usr_41.txt vim71/runtime/doc/usr_41.txt
old new 763 763 foldtextresult() get the text displayed for a closed fold 764 764 765 765 Syntax and highlighting: 766 clearmatches() clear all matches defined by |matchadd()| and 767 the |:match| commands 768 getmatches() get all matches defined by |matchadd()| and 769 the |:match| commands 766 770 hlexists() check if a highlight group exists 767 771 hlID() get ID of a highlight group 768 772 synID() get syntax ID at a specific position 769 773 synIDattr() get a specific attribute of a syntax ID 770 774 synIDtrans() get translated syntax ID 771 775 diff_hlID() get highlight ID for diff mode at a position 776 matchadd() define a pattern to highlight (a "match") 772 777 matcharg() get info about |:match| arguments 778 matchdelete() delete a match defined by |matchadd()| or a 779 |:match| command 780 setmatches() restore a list of matches saved by 781 |getmatches()| 773 782 774 783 Spelling: 775 784 spellbadword() locate badly spelled word at or after cursor -
runtime/doc/windows.txt
diff -Naur vim71.orig/runtime/doc/windows.txt vim71/runtime/doc/windows.txt
old new 132 132 the same file. Make new window N high (default is to use half 133 133 the height of the current window). Reduces the current window 134 134 height to create room (and others, if the 'equalalways' option 135 is set and 'eadirection' isn't "hor"). 135 is set, 'eadirection' isn't "hor", and one of them is higher 136 than the current or the new window). 136 137 Note: CTRL-S does not work on all terminals and might block 137 138 further input, use CTRL-Q to get going again. 138 139 Also see |++opt| and |+cmd|. … … 140 141 CTRL-W CTRL-V *CTRL-W_CTRL-V* 141 142 CTRL-W v *CTRL-W_v* 142 143 :[N]vs[plit] [++opt] [+cmd] [file] *:vs* *:vsplit* 143 Like |:split|, but split vertically. If 'equalalways' is set 144 and 'eadirection' isn't "ver" the windows will be spread out 145 horizontally, unless a width was specified. 144 Like |:split|, but split vertically. The windows will be 145 spread out horizontally if 146 1. a width was not specified, 147 2. 'equalalways' is set, 148 3. 'eadirection' isn't "ver", and 149 4. one of the other windows are wider than the current or new 150 window. 146 151 Note: In other places CTRL-Q does the same as CTRL-V, but here 147 152 it doesn't! 148 153 -
runtime/filetype.vim
diff -Naur vim71.orig/runtime/filetype.vim vim71/runtime/filetype.vim
old new 1 1 " Vim support file to detect file types 2 2 " 3 3 " Maintainer: Bram Moolenaar <Bram@vim.org> 4 " Last Change: 2007 May 1 04 " Last Change: 2007 May 15 5 5 6 6 " Listen very carefully, I will say this only once 7 7 if exists("did_load_filetypes") … … 1286 1286 au BufNewFile,BufRead *.it,*.ih setf ppwiz 1287 1287 1288 1288 " Oracle Pro*C/C++ 1289 au BufNewFile,BufRead .pc setf proc1289 au BufNewFile,BufRead *.pc setf proc 1290 1290 1291 1291 " Privoxy actions file 1292 1292 au BufNewFile,BufRead *.action setf privoxy -
runtime/plugin/matchparen.vim
diff -Naur vim71.orig/runtime/plugin/matchparen.vim vim71/runtime/plugin/matchparen.vim
old new 1 1 " Vim plugin for showing matching parens 2 2 " Maintainer: Bram Moolenaar <Bram@vim.org> 3 " Last Change: 200 6 Oct 123 " Last Change: 2007 Aug 8 4 4 5 5 " Exit quickly when: 6 6 " - this plugin was already loaded (or disabled) … … 13 13 14 14 augroup matchparen 15 15 " Replace all matchparen autocommands 16 autocmd! CursorMoved,CursorMovedI * call s:Highlight_Matching_Pair()16 autocmd! CursorMoved,CursorMovedI,WinEnter * call s:Highlight_Matching_Pair() 17 17 augroup END 18 18 19 19 " Skip the rest if it was already done. … … 62 62 " Figure out the arguments for searchpairpos(). 63 63 " Restrict the search to visible lines with "stopline". 64 64 " And avoid searching very far (e.g., for closed folds and long lines) 65 " The "viewable" variables give a range in which we can scroll while keeping 66 " the cursor at the same position 67 " adjustedScrolloff accounts for very large numbers of scrolloff 68 let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2]) 69 let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2]) 70 let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2]) 71 " one of these stoplines will be adjusted below, but the current values are 72 " minimal boundaries within the current window 73 let stoplinebottom = line('w$') 74 let stoplinetop = line('w0') 65 75 if i % 2 == 0 66 76 let s_flags = 'nW' 67 77 let c2 = plist[i + 1] 68 78 if has("byte_offset") && has("syntax_items") && &smc > 0 69 79 let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2]) 70 let stopline = min([ line('w$'), byte2line(stopbyte)])80 let stopline = min([bottom_viewable, byte2line(stopbyte)]) 71 81 else 72 let stopline = min([ line('w$'), c_lnum + 100])82 let stopline = min([bottom_viewable, c_lnum + 100]) 73 83 endif 84 let stoplinebottom = stopline 74 85 else 75 86 let s_flags = 'nbW' 76 87 let c2 = c 77 88 let c = plist[i - 1] 78 89 if has("byte_offset") && has("syntax_items") && &smc > 0 79 90 let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2]) 80 let stopline = max([ line('w0'), byte2line(stopbyte)])91 let stopline = max([top_viewable, byte2line(stopbyte)]) 81 92 else 82 let stopline = max([ line('w0'), c_lnum - 100])93 let stopline = max([top_viewable, c_lnum - 100]) 83 94 endif 95 let stoplinetop = stopline 84 96 endif 85 97 if c == '[' 86 98 let c = '\[' … … 106 118 endif 107 119 108 120 " If a match is found setup match highlighting. 109 if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$')121 if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom 110 122 exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . 111 123 \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' 112 124 let w:paren_hl_on = 1 … … 114 126 endfunction 115 127 116 128 " Define commands that will disable and enable the plugin. 117 command! NoMatchParen 3match none | unlet! g:loaded_matchparen | au! matchparen 118 command! DoMatchParen runtime plugin/matchparen.vim | doau CursorMoved 129 command! NoMatchParen windo 3match none | unlet! g:loaded_matchparen | 130 \ au! matchparen 131 command! DoMatchParen runtime plugin/matchparen.vim | windo doau CursorMoved 119 132 120 133 let &cpo = cpo_save -
src/auto/configure
diff -Naur vim71.orig/src/auto/configure vim71/src/auto/configure
old new 3843 3843 fi 3844 3844 3845 3845 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then 3846 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then 3846 if test "x$MACOSX" = "xyes"; then 3847 MZSCHEME_LIBS="-framework PLT_MzScheme" 3848 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then 3847 3849 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a" 3848 3850 else 3849 3851 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc" -
src/buffer.c
diff -Naur vim71.orig/src/buffer.c vim71/src/buffer.c
old new 171 171 /* Put the cursor on the first line. */ 172 172 curwin->w_cursor.lnum = 1; 173 173 curwin->w_cursor.col = 0; 174 175 /* Set or reset 'modified' before executing autocommands, so that 176 * it can be changed there. */ 177 if (!readonlymode && !bufempty()) 178 changed(); 179 else if (retval != FAIL) 180 unchanged(curbuf, FALSE); 174 181 #ifdef FEAT_AUTOCMD 175 182 # ifdef FEAT_EVAL 176 183 apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE, … … 194 201 /* When reading stdin, the buffer contents always needs writing, so set 195 202 * the changed flag. Unless in readonly mode: "ls | gview -". 196 203 * When interrupted and 'cpoptions' contains 'i' set changed flag. */ 197 if (( read_stdin && !readonlymode && !bufempty())204 if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) 198 205 #ifdef FEAT_AUTOCMD 199 206 || modified_was_set /* ":set modified" used in autocmd */ 200 207 # ifdef FEAT_EVAL 201 208 || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL) 202 209 # endif 203 210 #endif 204 || (got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL))211 ) 205 212 changed(); 206 else if (retval != FAIL )213 else if (retval != FAIL && !read_stdin) 207 214 unchanged(curbuf, FALSE); 208 215 save_file_ff(curbuf); /* keep this fileformat */ 209 216 … … 495 502 buf->b_start_eol = TRUE; 496 503 #ifdef FEAT_MBYTE 497 504 buf->b_p_bomb = FALSE; 505 buf->b_start_bomb = FALSE; 498 506 #endif 499 507 buf->b_ml.ml_mfp = NULL; 500 508 buf->b_ml.ml_flags = ML_EMPTY; /* empty buffer */ … … 4167 4175 * mess up the full path name, even though it starts with a '/'. 4168 4176 * Also expand when there is ".." in the file name, try to remove it, 4169 4177 * because "c:/src/../README" is equal to "c:/README". 4178 * Similarly "c:/src//file" is equal to "c:/src/file". 4170 4179 * For MS-Windows also expand names like "longna~1" to "longname". 4171 4180 */ 4172 4181 #ifdef UNIX 4173 4182 return FullName_save(fname, TRUE); 4174 4183 #else 4175 if (!vim_isAbsName(fname) || strstr((char *)fname, "..") != NULL 4176 #if defined(MSWIN) || defined(DJGPP) 4184 if (!vim_isAbsName(fname) 4185 || strstr((char *)fname, "..") != NULL 4186 || strstr((char *)fname, "//") != NULL 4187 # ifdef BACKSLASH_IN_FILENAME 4188 || strstr((char *)fname, "\\\\") != NULL 4189 # endif 4190 # if defined(MSWIN) || defined(DJGPP) 4177 4191 || vim_strchr(fname, '~') != NULL 4178 # endif4192 # endif 4179 4193 ) 4180 4194 return FullName_save(fname, FALSE); 4181 4195 4182 4196 fname = vim_strsave(fname); 4183 4197 4184 # ifdef USE_FNAME_CASE4185 # ifdef USE_LONG_FNAME4198 # ifdef USE_FNAME_CASE 4199 # ifdef USE_LONG_FNAME 4186 4200 if (USE_LONG_FNAME) 4187 # endif4201 # endif 4188 4202 { 4189 4203 if (fname != NULL) 4190 4204 fname_case(fname, 0); /* set correct case for file name */ 4191 4205 } 4192 # endif4206 # endif 4193 4207 4194 4208 return fname; 4195 4209 #endif … … 4853 4867 */ 4854 4868 for (e = s; *e != ':' && *e != NUL; ++e) 4855 4869 if (e[0] == '\\' && e[1] == ':') 4856 STRCPY(e, e + 1);4870 mch_memmove(e, e + 1, STRLEN(e)); 4857 4871 if (*e == NUL) 4858 4872 end = TRUE; 4859 4873 … … 5507 5521 5508 5522 #ifdef FEAT_AUTOCMD 5509 5523 if (!aucmd) /* Don't trigger BufDelete autocommands here. */ 5510 ++autocmd_block;5524 block_autocmds(); 5511 5525 #endif 5512 5526 close_buffer(NULL, buf, DOBUF_WIPE); 5513 5527 #ifdef FEAT_AUTOCMD 5514 5528 if (!aucmd) 5515 --autocmd_block;5529 unblock_autocmds(); 5516 5530 #endif 5517 5531 } -
src/charset.c
diff -Naur vim71.orig/src/charset.c vim71/src/charset.c
old new 207 207 } 208 208 while (c <= c2) 209 209 { 210 if (!do_isalpha || isalpha(c) 210 /* Use the MB_ functions here, because isalpha() doesn't 211 * work properly when 'encoding' is "latin1" and the locale is 212 * "C". */ 213 if (!do_isalpha || MB_ISLOWER(c) || MB_ISUPPER(c) 211 214 #ifdef FEAT_FKMAP 212 215 || (p_altkeymap && (F_isalpha(c) || F_isdigit(c))) 213 216 #endif … … 929 932 } 930 933 931 934 /* 935 * return TRUE if 'c' is a valid file-name character or a wildcard character 936 * Assume characters above 0x100 are valid (multi-byte). 937 * Explicitly interpret ']' as a wildcard character as mch_has_wildcard("]") 938 * returns false. 939 */ 940 int 941 vim_isfilec_or_wc(c) 942 int c; 943 { 944 char_u buf[2]; 945 946 buf[0] = (char_u)c; 947 buf[1] = NUL; 948 return vim_isfilec(c) || c == ']' || mch_has_wildcard(buf); 949 } 950 951 /* 932 952 * return TRUE if 'c' is a printable character 933 953 * Assume characters above 0x100 are printable (multi-byte), except for 934 954 * Unicode. … … 1898 1918 { 1899 1919 for ( ; *p; ++p) 1900 1920 if (rem_backslash(p)) 1901 STRCPY(p, p + 1);1921 mch_memmove(p, p + 1, STRLEN(p)); 1902 1922 } 1903 1923 1904 1924 /* -
src/configure.in
diff -Naur vim71.orig/src/configure.in vim71/src/configure.in
old new 423 423 fi 424 424 425 425 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then 426 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then 426 if test "x$MACOSX" = "xyes"; then 427 MZSCHEME_LIBS="-framework PLT_MzScheme" 428 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then 427 429 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a" 428 430 else 429 431 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc" -
src/diff.c
diff -Naur vim71.orig/src/diff.c vim71/src/diff.c
old new 840 840 tmp_orig, tmp_new); 841 841 append_redir(cmd, p_srr, tmp_diff); 842 842 #ifdef FEAT_AUTOCMD 843 ++autocmd_block; /* Avoid ShellCmdPost stuff */843 block_autocmds(); /* Avoid ShellCmdPost stuff */ 844 844 #endif 845 845 (void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT); 846 846 #ifdef FEAT_AUTOCMD 847 --autocmd_block;847 unblock_autocmds(); 848 848 #endif 849 849 vim_free(cmd); 850 850 } … … 949 949 # endif 950 950 eap->arg); 951 951 #ifdef FEAT_AUTOCMD 952 ++autocmd_block; /* Avoid ShellCmdPost stuff */952 block_autocmds(); /* Avoid ShellCmdPost stuff */ 953 953 #endif 954 954 (void)call_shell(buf, SHELL_FILTER | SHELL_COOKED); 955 955 #ifdef FEAT_AUTOCMD 956 --autocmd_block;956 unblock_autocmds(); 957 957 #endif 958 958 } 959 959 -
src/digraph.c
diff -Naur vim71.orig/src/digraph.c vim71/src/digraph.c
old new 2028 2028 2029 2029 ++no_mapping; 2030 2030 ++allow_keys; 2031 c = safe_vgetc();2031 c = plain_vgetc(); 2032 2032 --no_mapping; 2033 2033 --allow_keys; 2034 2034 if (c != ESC) /* ESC cancels CTRL-K */ … … 2050 2050 #endif 2051 2051 ++no_mapping; 2052 2052 ++allow_keys; 2053 cc = safe_vgetc();2053 cc = plain_vgetc(); 2054 2054 --no_mapping; 2055 2055 --allow_keys; 2056 2056 if (cc != ESC) /* ESC cancels CTRL-K */ … … 2349 2349 2350 2350 if (*curbuf->b_p_keymap == NUL) 2351 2351 { 2352 /* Stop any active keymap and clear the table. */ 2352 /* Stop any active keymap and clear the table. Also remove 2353 * b:keymap_name, as no keymap is active now. */ 2353 2354 keymap_unload(); 2355 do_cmdline_cmd((char_u *)"unlet! b:keymap_name"); 2354 2356 } 2355 2357 else 2356 2358 { … … 2500 2502 2501 2503 ga_clear(&curbuf->b_kmap_ga); 2502 2504 curbuf->b_kmap_state &= ~KEYMAP_LOADED; 2503 do_cmdline_cmd((char_u *)"unlet! b:keymap_name");2504 2505 #ifdef FEAT_WINDOWS 2505 2506 status_redraw_curbuf(); 2506 2507 #endif -
src/edit.c
diff -Naur vim71.orig/src/edit.c vim71/src/edit.c
old new 788 788 ins_redraw(FALSE); 789 789 ++no_mapping; 790 790 ++allow_keys; 791 c = safe_vgetc();791 c = plain_vgetc(); 792 792 --no_mapping; 793 793 --allow_keys; 794 794 if (c != Ctrl_N && c != Ctrl_G && c != Ctrl_O) … … 981 981 #ifdef FEAT_NETBEANS_INTG 982 982 case K_F21: /* NetBeans command */ 983 983 ++no_mapping; /* don't map the next key hits */ 984 i = safe_vgetc();984 i = plain_vgetc(); 985 985 --no_mapping; 986 986 netbeans_keycommand(i); 987 987 break; … … 2057 2057 * case of the originally typed text is used, and the case of the completed 2058 2058 * text is inferred, ie this tries to work out what case you probably wanted 2059 2059 * the rest of the word to be in -- webb 2060 * TODO: make this work for multi-byte characters.2061 2060 */ 2062 2061 int 2063 2062 ins_compl_add_infercase(str, len, icase, fname, dir, flags) … … 2068 2067 int dir; 2069 2068 int flags; 2070 2069 { 2070 char_u *p; 2071 int i, c; 2072 int actual_len; /* Take multi-byte characters */ 2073 int actual_compl_length; /* into account. */ 2074 int *wca; /* Wide character array. */ 2071 2075 int has_lower = FALSE; 2072 2076 int was_letter = FALSE; 2073 int idx;2074 2077 2075 if (p_ic && curbuf->b_p_inf && len < IOSIZE)2078 if (p_ic && curbuf->b_p_inf) 2076 2079 { 2077 /* Infer case of completed part -- webb */ 2078 /* Use IObuff, str would change text in buffer! */ 2079 vim_strncpy(IObuff, str, len); 2080 /* Infer case of completed part. */ 2080 2081 2081 /* Rule 1: Were any chars converted to lower? */ 2082 for (idx = 0; idx < compl_length; ++idx) 2082 /* Find actual length of completion. */ 2083 #ifdef FEAT_MBYTE 2084 if (has_mbyte) 2083 2085 { 2084 if (islower(compl_orig_text[idx])) 2086 p = str; 2087 actual_len = 0; 2088 while (*p != NUL) 2085 2089 { 2086 has_lower = TRUE; 2087 if (isupper(IObuff[idx])) 2088 { 2089 /* Rule 1 is satisfied */ 2090 for (idx = compl_length; idx < len; ++idx) 2091 IObuff[idx] = TOLOWER_LOC(IObuff[idx]); 2092 break; 2093 } 2090 mb_ptr_adv(p); 2091 ++actual_len; 2094 2092 } 2095 2093 } 2094 else 2095 #endif 2096 actual_len = len; 2096 2097 2097 /* 2098 * Rule 2: No lower case, 2nd consecutive letter converted to 2099 * upper case. 2100 */ 2101 if (!has_lower) 2098 /* Find actual length of original text. */ 2099 #ifdef FEAT_MBYTE 2100 if (has_mbyte) 2102 2101 { 2103 for (idx = 0; idx < compl_length; ++idx) 2102 p = compl_orig_text; 2103 actual_compl_length = 0; 2104 while (*p != NUL) 2104 2105 { 2105 if (was_letter && isupper(compl_orig_text[idx]) 2106 && islower(IObuff[idx])) 2106 mb_ptr_adv(p); 2107 ++actual_compl_length; 2108 } 2109 } 2110 else 2111 #endif 2112 actual_compl_length = compl_length; 2113 2114 /* Allocate wide character array for the completion and fill it. */ 2115 wca = (int *)alloc(actual_len * sizeof(int)); 2116 if (wca != NULL) 2117 { 2118 p = str; 2119 for (i = 0; i < actual_len; ++i) 2120 #ifdef FEAT_MBYTE 2121 if (has_mbyte) 2122 wca[i] = mb_ptr2char_adv(&p); 2123 else 2124 #endif 2125 wca[i] = *(p++); 2126 2127 /* Rule 1: Were any chars converted to lower? */ 2128 p = compl_orig_text; 2129 for (i = 0; i < actual_compl_length; ++i) 2130 { 2131 #ifdef FEAT_MBYTE 2132 if (has_mbyte) 2133 c = mb_ptr2char_adv(&p); 2134 else 2135 #endif 2136 c = *(p++); 2137 if (MB_ISLOWER(c)) 2107 2138 { 2108 /* Rule 2 is satisfied */ 2109 for (idx = compl_length; idx < len; ++idx) 2110 IObuff[idx] = TOUPPER_LOC(IObuff[idx]); 2111 break; 2139 has_lower = TRUE; 2140 if (MB_ISUPPER(wca[i])) 2141 { 2142 /* Rule 1 is satisfied. */ 2143 for (i = actual_compl_length; i < actual_len; ++i) 2144 wca[i] = MB_TOLOWER(wca[i]); 2145 break; 2146 } 2112 2147 } 2113 was_letter = isalpha(compl_orig_text[idx]);2114 2148 } 2115 }2116 2149 2117 /* Copy the original case of the part we typed */ 2118 STRNCPY(IObuff, compl_orig_text, compl_length); 2150 /* 2151 * Rule 2: No lower case, 2nd consecutive letter converted to 2152 * upper case. 2153 */ 2154 if (!has_lower) 2155 { 2156 p = compl_orig_text; 2157 for (i = 0; i < actual_compl_length; ++i) 2158 { 2159 #ifdef FEAT_MBYTE 2160 if (has_mbyte) 2161 c = mb_ptr2char_adv(&p); 2162 else 2163 #endif 2164 c = *(p++); 2165 if (was_letter && MB_ISUPPER(c) && MB_ISLOWER(wca[i])) 2166 { 2167 /* Rule 2 is satisfied. */ 2168 for (i = actual_compl_length; i < actual_len; ++i) 2169 wca[i] = MB_TOUPPER(wca[i]); 2170 break; 2171 } 2172 was_letter = MB_ISLOWER(c) || MB_ISUPPER(c); 2173 } 2174 } 2175 2176 /* Copy the original case of the part we typed. */ 2177 p = compl_orig_text; 2178 for (i = 0; i < actual_compl_length; ++i) 2179 { 2180 #ifdef FEAT_MBYTE 2181 if (has_mbyte) 2182 c = mb_ptr2char_adv(&p); 2183 else 2184 #endif 2185 c = *(p++); 2186 if (MB_ISLOWER(c)) 2187 wca[i] = MB_TOLOWER(wca[i]); 2188 else if (MB_ISUPPER(c)) 2189 wca[i] = MB_TOUPPER(wca[i]); 2190 } 2191 2192 /* 2193 * Generate encoding specific output from wide character array. 2194 * Multi-byte characters can occupy up to five bytes more than 2195 * ASCII characters, and we also need one byte for NUL, so stay 2196 * six bytes away from the edge of IObuff. 2197 */ 2198 p = IObuff; 2199 i = 0; 2200 while (i < actual_len && (p - IObuff + 6) < IOSIZE) 2201 #ifdef FEAT_MBYTE 2202 if (has_mbyte) 2203 p += mb_char2bytes(wca[i++], p); 2204 else 2205 #endif 2206 *(p++) = wca[i++]; 2207 *p = NUL; 2208 2209 vim_free(wca); 2210 } 2119 2211 2120 2212 return ins_compl_add(IObuff, len, icase, fname, NULL, dir, 2121 2213 flags, FALSE); … … 2842 2934 /* 2843 2935 * Add the other matches on the line 2844 2936 */ 2937 ptr = buf; 2845 2938 while (!got_int) 2846 2939 { 2847 2940 /* Find start of the next word. Skip white … … 2851 2944 break; 2852 2945 wstart = ptr; 2853 2946 2854 /* Find end of the word and add it. */2947 /* Find end of the word. */ 2855 2948 #ifdef FEAT_MBYTE 2856 2949 if (has_mbyte) 2857 2950 /* Japanese words may have characters in … … 2868 2961 else 2869 2962 #endif 2870 2963 ptr = find_word_end(ptr); 2871 add_r = ins_compl_add_infercase(wstart, 2872 (int)(ptr - wstart), 2873 p_ic, files[i], *dir, 0); 2964 2965 /* Add the word. Skip the regexp match. */ 2966 if (wstart != regmatch->startp[0]) 2967 add_r = ins_compl_add_infercase(wstart, 2968 (int)(ptr - wstart), 2969 p_ic, files[i], *dir, 0); 2874 2970 } 2875 2971 } 2876 2972 if (add_r == OK) … … 5128 5224 i = 0; 5129 5225 for (;;) 5130 5226 { 5131 do 5132 nc = safe_vgetc(); 5133 while (nc == K_IGNORE || nc == K_VER_SCROLLBAR 5134 || nc == K_HOR_SCROLLBAR); 5227 nc = plain_vgetc(); 5135 5228 #ifdef FEAT_CMDL_INFO 5136 5229 if (!(State & CMDLINE) 5137 5230 # ifdef FEAT_MBYTE … … 7215 7308 p = ml_get_curline(); 7216 7309 if (cin_iscase(p) || cin_isscopedecl(p) || cin_islabel(30)) 7217 7310 return TRUE; 7311 /* Need to get the line again after cin_islabel(). */ 7312 p = ml_get_curline(); 7218 7313 if (curwin->w_cursor.col > 2 7219 7314 && p[curwin->w_cursor.col - 1] == ':' 7220 7315 && p[curwin->w_cursor.col - 2] == ':') … … 7477 7572 * deleted when ESC is hit. 7478 7573 */ 7479 7574 ++no_mapping; 7480 regname = safe_vgetc();7575 regname = plain_vgetc(); 7481 7576 #ifdef FEAT_LANGMAP 7482 7577 LANGMAP_ADJUST(regname, TRUE); 7483 7578 #endif … … 7488 7583 #ifdef FEAT_CMDL_INFO 7489 7584 add_to_showcmd_c(literally); 7490 7585 #endif 7491 regname = safe_vgetc();7586 regname = plain_vgetc(); 7492 7587 #ifdef FEAT_LANGMAP 7493 7588 LANGMAP_ADJUST(regname, TRUE); 7494 7589 #endif … … 7579 7674 * deleted when ESC is hit. 7580 7675 */ 7581 7676 ++no_mapping; 7582 c = safe_vgetc();7677 c = plain_vgetc(); 7583 7678 --no_mapping; 7584 7679 switch (c) 7585 7680 { … … 7998 8093 /* 7999 8094 * 0^D and ^^D: remove all indent. 8000 8095 */ 8001 if ((lastc == '0' || lastc == '^') && curwin->w_cursor.col) 8096 if (c == Ctrl_D && (lastc == '0' || lastc == '^') 8097 && curwin->w_cursor.col > 0) 8002 8098 { 8003 8099 --curwin->w_cursor.col; 8004 8100 (void)del_char(FALSE); /* delete the '^' or '0' */ … … 9257 9353 * mode message to be deleted when ESC is hit */ 9258 9354 ++no_mapping; 9259 9355 ++allow_keys; 9260 c = safe_vgetc();9356 c = plain_vgetc(); 9261 9357 --no_mapping; 9262 9358 --allow_keys; 9263 9359 if (IS_SPECIAL(c) || mod_mask) /* special key */ … … 9289 9385 } 9290 9386 ++no_mapping; 9291 9387 ++allow_keys; 9292 cc = safe_vgetc();9388 cc = plain_vgetc(); 9293 9389 --no_mapping; 9294 9390 --allow_keys; 9295 9391 if (cc != ESC) -
src/eval.c
diff -Naur vim71.orig/src/eval.c vim71/src/eval.c
old new 369 369 static int ex_let_vars __ARGS((char_u *arg, typval_T *tv, int copy, int semicolon, int var_count, char_u *nextchars)); 370 370 static char_u *skip_var_list __ARGS((char_u *arg, int *var_count, int *semicolon)); 371 371 static char_u *skip_var_one __ARGS((char_u *arg)); 372 static void list_hashtable_vars __ARGS((hashtab_T *ht, char_u *prefix, int empty ));373 static void list_glob_vars __ARGS(( void));374 static void list_buf_vars __ARGS(( void));375 static void list_win_vars __ARGS(( void));372 static void list_hashtable_vars __ARGS((hashtab_T *ht, char_u *prefix, int empty, int *first)); 373 static void list_glob_vars __ARGS((int *first)); 374 static void list_buf_vars __ARGS((int *first)); 375 static void list_win_vars __ARGS((int *first)); 376 376 #ifdef FEAT_WINDOWS 377 static void list_tab_vars __ARGS(( void));377 static void list_tab_vars __ARGS((int *first)); 378 378 #endif 379 static void list_vim_vars __ARGS(( void));380 static void list_script_vars __ARGS(( void));381 static void list_func_vars __ARGS(( void));382 static char_u *list_arg_vars __ARGS((exarg_T *eap, char_u *arg ));379 static void list_vim_vars __ARGS((int *first)); 380 static void list_script_vars __ARGS((int *first)); 381 static void list_func_vars __ARGS((int *first)); 382 static char_u *list_arg_vars __ARGS((exarg_T *eap, char_u *arg, int *first)); 383 383 static char_u *ex_let_one __ARGS((char_u *arg, typval_T *tv, int copy, char_u *endchars, char_u *op)); 384 384 static int check_changedtick __ARGS((char_u *arg)); 385 385 static char_u *get_lval __ARGS((char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int quiet, int fne_flags)); … … 475 475 static void f_changenr __ARGS((typval_T *argvars, typval_T *rettv)); 476 476 static void f_char2nr __ARGS((typval_T *argvars, typval_T *rettv)); 477 477 static void f_cindent __ARGS((typval_T *argvars, typval_T *rettv)); 478 static void f_clearmatches __ARGS((typval_T *argvars, typval_T *rettv)); 478 479 static void f_col __ARGS((typval_T *argvars, typval_T *rettv)); 479 480 #if defined(FEAT_INS_EXPAND) 480 481 static void f_complete __ARGS((typval_T *argvars, typval_T *rettv)); … … 529 530 static void f_getftime __ARGS((typval_T *argvars, typval_T *rettv)); 530 531 static void f_getftype __ARGS((typval_T *argvars, typval_T *rettv)); 531 532 static void f_getline __ARGS((typval_T *argvars, typval_T *rettv)); 533 static void f_getmatches __ARGS((typval_T *argvars, typval_T *rettv)); 532 534 static void f_getpos __ARGS((typval_T *argvars, typval_T *rettv)); 533 535 static void f_getqflist __ARGS((typval_T *argvars, typval_T *rettv)); 534 536 static void f_getreg __ARGS((typval_T *argvars, typval_T *rettv)); … … 577 579 static void f_maparg __ARGS((typval_T *argvars, typval_T *rettv)); 578 580 static void f_mapcheck __ARGS((typval_T *argvars, typval_T *rettv)); 579 581 static void f_match __ARGS((typval_T *argvars, typval_T *rettv)); 582 static void f_matchadd __ARGS((typval_T *argvars, typval_T *rettv)); 580 583 static void f_matcharg __ARGS((typval_T *argvars, typval_T *rettv)); 584 static void f_matchdelete __ARGS((typval_T *argvars, typval_T *rettv)); 581 585 static void f_matchend __ARGS((typval_T *argvars, typval_T *rettv)); 582 586 static void f_matchlist __ARGS((typval_T *argvars, typval_T *rettv)); 583 587 static void f_matchstr __ARGS((typval_T *argvars, typval_T *rettv)); … … 618 622 static void f_setcmdpos __ARGS((typval_T *argvars, typval_T *rettv)); 619 623 static void f_setline __ARGS((typval_T *argvars, typval_T *rettv)); 620 624 static void f_setloclist __ARGS((typval_T *argvars, typval_T *rettv)); 625 static void f_setmatches __ARGS((typval_T *argvars, typval_T *rettv)); 621 626 static void f_setpos __ARGS((typval_T *argvars, typval_T *rettv)); 622 627 static void f_setqflist __ARGS((typval_T *argvars, typval_T *rettv)); 623 628 static void f_setreg __ARGS((typval_T *argvars, typval_T *rettv)); … … 672 677 static void f_writefile __ARGS((typval_T *argvars, typval_T *rettv)); 673 678 674 679 static int list2fpos __ARGS((typval_T *arg, pos_T *posp, int *fnump)); 675 static pos_T *var2fpos __ARGS((typval_T *varp, int lnum, int *fnum));680 static pos_T *var2fpos __ARGS((typval_T *varp, int dollar_lnum, int *fnum)); 676 681 static int get_env_len __ARGS((char_u **arg)); 677 682 static int get_id_len __ARGS((char_u **arg)); 678 683 static int get_name_len __ARGS((char_u **arg, char_u **alias, int evaluate, int verbose)); … … 699 704 static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname)); 700 705 static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val)); 701 706 static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi)); 702 static void list_one_var __ARGS((dictitem_T *v, char_u *prefix ));703 static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, char_u *string ));707 static void list_one_var __ARGS((dictitem_T *v, char_u *prefix, int *first)); 708 static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, char_u *string, int *first)); 704 709 static void set_var __ARGS((char_u *name, typval_T *varp, int copy)); 705 710 static int var_check_ro __ARGS((int flags, char_u *name)); 706 711 static int var_check_fixed __ARGS((int flags, char_u *name)); … … 992 997 char_u *value; 993 998 int value_len; 994 999 { 995 size_tlen;1000 int len; 996 1001 997 1002 if (redir_lval == NULL) 998 1003 return; 999 1004 1000 1005 if (value_len == -1) 1001 len = STRLEN(value); /* Append the entire string */1006 len = (int)STRLEN(value); /* Append the entire string */ 1002 1007 else 1003 len = value_len; /* Append only "value_len" characters */1008 len = value_len; /* Append only "value_len" characters */ 1004 1009 1005 if (ga_grow(&redir_ga, (int)len) == OK)1010 if (ga_grow(&redir_ga, len) == OK) 1006 1011 { 1007 1012 mch_memmove((char *)redir_ga.ga_data + redir_ga.ga_len, value, len); 1008 redir_ga.ga_len += (int)len;1013 redir_ga.ga_len += len; 1009 1014 } 1010 1015 else 1011 1016 var_redir_stop(); … … 1313 1318 { 1314 1319 hashitem_T *hi; 1315 1320 1316 clear_tv(&vimvars[idx].vv_tv);1317 1321 vimvars[idx].vv_tv = *save_tv; 1318 1322 if (vimvars[idx].vv_type == VAR_UNKNOWN) 1319 1323 { … … 1357 1361 1358 1362 if (p_verbose == 0) 1359 1363 --emsg_off; 1360 vimvars[VV_VAL].vv_str = NULL;1361 1364 restore_vimvar(VV_VAL, &save_val); 1362 1365 1363 1366 return list; … … 1411 1414 } 1412 1415 1413 1416 1414 #if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO) 1417 #if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) \ 1418 || defined(FEAT_COMPL_FUNC) || defined(PROTO) 1415 1419 /* 1416 1420 * Call some vimL function and return the result in "*rettv". 1417 1421 * Uses argv[argc] for the function arguments. … … 1484 1488 return ret; 1485 1489 } 1486 1490 1491 # if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO) 1487 1492 /* 1488 1493 * Call vimL function "func" and return the result as a string. 1489 1494 * Returns NULL when calling the function fails. … … 1506 1511 clear_tv(&rettv); 1507 1512 return retval; 1508 1513 } 1514 # endif 1509 1515 1510 # if defined(FEAT_COMPL_FUNC) || defined(PROTO)1516 # if defined(FEAT_COMPL_FUNC) || defined(PROTO) 1511 1517 /* 1512 1518 * Call vimL function "func" and return the result as a number. 1513 1519 * Returns -1 when calling the function fails. … … 1530 1536 clear_tv(&rettv); 1531 1537 return retval; 1532 1538 } 1533 # endif1539 # endif 1534 1540 1535 1541 /* 1536 1542 * Call vimL function "func" and return the result as a list … … 1556 1562 1557 1563 return rettv.vval.v_list; 1558 1564 } 1559 1560 1565 #endif 1561 1566 1567 1562 1568 /* 1563 1569 * Save the current function call pointer, and set it to NULL. 1564 1570 * Used when executing autocommands and for ":source". … … 1691 1697 int semicolon = 0; 1692 1698 char_u op[2]; 1693 1699 char_u *argend; 1700 int first = TRUE; 1694 1701 1695 1702 argend = skip_var_list(arg, &var_count, &semicolon); 1696 1703 if (argend == NULL) … … 1707 1714 EMSG(_(e_invarg)); 1708 1715 else if (!ends_excmd(*arg)) 1709 1716 /* ":let var1 var2" */ 1710 arg = list_arg_vars(eap, arg );1717 arg = list_arg_vars(eap, arg, &first); 1711 1718 else if (!eap->skip) 1712 1719 { 1713 1720 /* ":let" */ 1714 list_glob_vars( );1715 list_buf_vars( );1716 list_win_vars( );1721 list_glob_vars(&first); 1722 list_buf_vars(&first); 1723 list_win_vars(&first); 1717 1724 #ifdef FEAT_WINDOWS 1718 list_tab_vars( );1725 list_tab_vars(&first); 1719 1726 #endif 1720 list_script_vars( );1721 list_func_vars( );1722 list_vim_vars( );1727 list_script_vars(&first); 1728 list_func_vars(&first); 1729 list_vim_vars(&first); 1723 1730 } 1724 1731 eap->nextcmd = check_nextcmd(arg); 1725 1732 } … … 1924 1931 * If "empty" is TRUE also list NULL strings as empty strings. 1925 1932 */ 1926 1933 static void 1927 list_hashtable_vars(ht, prefix, empty )1934 list_hashtable_vars(ht, prefix, empty, first) 1928 1935 hashtab_T *ht; 1929 1936 char_u *prefix; 1930 1937 int empty; 1938 int *first; 1931 1939 { 1932 1940 hashitem_T *hi; 1933 1941 dictitem_T *di; … … 1942 1950 di = HI2DI(hi); 1943 1951 if (empty || di->di_tv.v_type != VAR_STRING 1944 1952 || di->di_tv.vval.v_string != NULL) 1945 list_one_var(di, prefix );1953 list_one_var(di, prefix, first); 1946 1954 } 1947 1955 } 1948 1956 } … … 1951 1959 * List global variables. 1952 1960 */ 1953 1961 static void 1954 list_glob_vars() 1962 list_glob_vars(first) 1963 int *first; 1955 1964 { 1956 list_hashtable_vars(&globvarht, (char_u *)"", TRUE );1965 list_hashtable_vars(&globvarht, (char_u *)"", TRUE, first); 1957 1966 } 1958 1967 1959 1968 /* 1960 1969 * List buffer variables. 1961 1970 */ 1962 1971 static void 1963 list_buf_vars() 1972 list_buf_vars(first) 1973 int *first; 1964 1974 { 1965 1975 char_u numbuf[NUMBUFLEN]; 1966 1976 1967 list_hashtable_vars(&curbuf->b_vars.dv_hashtab, (char_u *)"b:", TRUE); 1977 list_hashtable_vars(&curbuf->b_vars.dv_hashtab, (char_u *)"b:", 1978 TRUE, first); 1968 1979 1969 1980 sprintf((char *)numbuf, "%ld", (long)curbuf->b_changedtick); 1970 list_one_var_a((char_u *)"b:", (char_u *)"changedtick", VAR_NUMBER, numbuf); 1981 list_one_var_a((char_u *)"b:", (char_u *)"changedtick", VAR_NUMBER, 1982 numbuf, first); 1971 1983 } 1972 1984 1973 1985 /* 1974 1986 * List window variables. 1975 1987 */ 1976 1988 static void 1977 list_win_vars() 1989 list_win_vars(first) 1990 int *first; 1978 1991 { 1979 list_hashtable_vars(&curwin->w_vars.dv_hashtab, (char_u *)"w:", TRUE); 1992 list_hashtable_vars(&curwin->w_vars.dv_hashtab, 1993 (char_u *)"w:", TRUE, first); 1980 1994 } 1981 1995 1982 1996 #ifdef FEAT_WINDOWS … … 1984 1998 * List tab page variables. 1985 1999 */ 1986 2000 static void 1987 list_tab_vars() 2001 list_tab_vars(first) 2002 int *first; 1988 2003 { 1989 list_hashtable_vars(&curtab->tp_vars.dv_hashtab, (char_u *)"t:", TRUE); 2004 list_hashtable_vars(&curtab->tp_vars.dv_hashtab, 2005 (char_u *)"t:", TRUE, first); 1990 2006 } 1991 2007 #endif 1992 2008 … … 1994 2010 * List Vim variables. 1995 2011 */ 1996 2012 static void 1997 list_vim_vars() 2013 list_vim_vars(first) 2014 int *first; 1998 2015 { 1999 list_hashtable_vars(&vimvarht, (char_u *)"v:", FALSE );2016 list_hashtable_vars(&vimvarht, (char_u *)"v:", FALSE, first); 2000 2017 } 2001 2018 2002 2019 /* 2003 2020 * List script-local variables, if there is a script. 2004 2021 */ 2005 2022 static void 2006 list_script_vars() 2023 list_script_vars(first) 2024 int *first; 2007 2025 { 2008 2026 if (current_SID > 0 && current_SID <= ga_scripts.ga_len) 2009 list_hashtable_vars(&SCRIPT_VARS(current_SID), (char_u *)"s:", FALSE); 2027 list_hashtable_vars(&SCRIPT_VARS(current_SID), 2028 (char_u *)"s:", FALSE, first); 2010 2029 } 2011 2030 2012 2031 /* 2013 2032 * List function variables, if there is a function. 2014 2033 */ 2015 2034 static void 2016 list_func_vars() 2035 list_func_vars(first) 2036 int *first; 2017 2037 { 2018 2038 if (current_funccal != NULL) 2019 2039 list_hashtable_vars(¤t_funccal->l_vars.dv_hashtab, 2020 (char_u *)"l:", FALSE);2040 (char_u *)"l:", FALSE, first); 2021 2041 } 2022 2042 2023 2043 /* 2024 2044 * List variables in "arg". 2025 2045 */ 2026 2046 static char_u * 2027 list_arg_vars(eap, arg )2047 list_arg_vars(eap, arg, first) 2028 2048 exarg_T *eap; 2029 2049 char_u *arg; 2050 int *first; 2030 2051 { 2031 2052 int error = FALSE; 2032 2053 int len; … … 2083 2104 { 2084 2105 switch (*name) 2085 2106 { 2086 case 'g': list_glob_vars( ); break;2087 case 'b': list_buf_vars( ); break;2088 case 'w': list_win_vars( ); break;2107 case 'g': list_glob_vars(first); break; 2108 case 'b': list_buf_vars(first); break; 2109 case 'w': list_win_vars(first); break; 2089 2110 #ifdef FEAT_WINDOWS 2090 case 't': list_tab_vars( ); break;2111 case 't': list_tab_vars(first); break; 2091 2112 #endif 2092 case 'v': list_vim_vars( ); break;2093 case 's': list_script_vars( ); break;2094 case 'l': list_func_vars( ); break;2113 case 'v': list_vim_vars(first); break; 2114 case 's': list_script_vars(first); break; 2115 case 'l': list_func_vars(first); break; 2095 2116 default: 2096 2117 EMSG2(_("E738: Can't list variables for %s"), name); 2097 2118 } … … 2108 2129 *arg = NUL; 2109 2130 list_one_var_a((char_u *)"", 2110 2131 arg == arg_subsc ? name : name_start, 2111 tv.v_type, s == NULL ? (char_u *)"" : s); 2132 tv.v_type, 2133 s == NULL ? (char_u *)"" : s, 2134 first); 2112 2135 *arg = c; 2113 2136 vim_free(tf); 2114 2137 } … … 6105 6128 /* Only do this once. */ 6106 6129 want_garbage_collect = FALSE; 6107 6130 may_garbage_collect = FALSE; 6131 garbage_collect_at_exit = FALSE; 6108 6132 6109 6133 /* 6110 6134 * 1. Go through all accessible variables and mark all lists and dicts … … 6681 6705 dict_T *d = NULL; 6682 6706 typval_T tvkey; 6683 6707 typval_T tv; 6684 char_u *key ;6708 char_u *key = NULL; 6685 6709 dictitem_T *item; 6686 6710 char_u *start = skipwhite(*arg + 1); 6687 6711 char_u buf[NUMBUFLEN]; … … 6721 6745 clear_tv(&tvkey); 6722 6746 goto failret; 6723 6747 } 6724 key = get_tv_string_buf_chk(&tvkey, buf); 6725 if (key == NULL || *key == NUL) 6748 if (evaluate) 6726 6749 { 6727 /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ 6728 if (key != NULL) 6729 EMSG(_(e_emptykey)); 6730 clear_tv(&tvkey); 6731 goto failret; 6750 key = get_tv_string_buf_chk(&tvkey, buf); 6751 if (key == NULL || *key == NUL) 6752 { 6753 /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ 6754 if (key != NULL) 6755 EMSG(_(e_emptykey)); 6756 clear_tv(&tvkey); 6757 goto failret; 6758 } 6732 6759 } 6733 6760 6734 6761 *arg = skipwhite(*arg + 1); 6735 6762 if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */ 6736 6763 { 6737 clear_tv(&tvkey); 6764 if (evaluate) 6765 clear_tv(&tvkey); 6738 6766 goto failret; 6739 6767 } 6740 6768 if (evaluate) … … 6794 6822 * "numbuf" is used for a number. 6795 6823 * Does not put quotes around strings, as ":echo" displays values. 6796 6824 * When "copyID" is not NULL replace recursive lists and dicts with "...". 6797 * May return NULL ;6825 * May return NULL. 6798 6826 */ 6799 6827 static char_u * 6800 6828 echo_string(tv, tofree, numbuf, copyID) … … 6879 6907 * If the memory is allocated "tofree" is set to it, otherwise NULL. 6880 6908 * "numbuf" is used for a number. 6881 6909 * Puts quotes around strings, so that they can be parsed back by eval(). 6882 * May return NULL ;6910 * May return NULL. 6883 6911 */ 6884 6912 static char_u * 6885 6913 tv2string(tv, tofree, numbuf, copyID) … … 7043 7071 {"changenr", 0, 0, f_changenr}, 7044 7072 {"char2nr", 1, 1, f_char2nr}, 7045 7073 {"cindent", 1, 1, f_cindent}, 7074 {"clearmatches", 0, 0, f_clearmatches}, 7046 7075 {"col", 1, 1, f_col}, 7047 7076 #if defined(FEAT_INS_EXPAND) 7048 7077 {"complete", 2, 2, f_complete}, … … 7082 7111 {"foldtextresult", 1, 1, f_foldtextresult}, 7083 7112 {"foreground", 0, 0, f_foreground}, 7084 7113 {"function", 1, 1, f_function}, 7085 {"garbagecollect", 0, 0, f_garbagecollect},7114 {"garbagecollect", 0, 1, f_garbagecollect}, 7086 7115 {"get", 2, 3, f_get}, 7087 7116 {"getbufline", 2, 3, f_getbufline}, 7088 7117 {"getbufvar", 2, 2, f_getbufvar}, … … 7099 7128 {"getftype", 1, 1, f_getftype}, 7100 7129 {"getline", 1, 2, f_getline}, 7101 7130 {"getloclist", 1, 1, f_getqflist}, 7131 {"getmatches", 0, 0, f_getmatches}, 7102 7132 {"getpos", 1, 1, f_getpos}, 7103 7133 {"getqflist", 0, 0, f_getqflist}, 7104 7134 {"getreg", 0, 2, f_getreg}, … … 7149 7179 {"maparg", 1, 3, f_maparg}, 7150 7180 {"mapcheck", 1, 3, f_mapcheck}, 7151 7181 {"match", 2, 4, f_match}, 7182 {"matchadd", 2, 4, f_matchadd}, 7152 7183 {"matcharg", 1, 1, f_matcharg}, 7184 {"matchdelete", 1, 1, f_matchdelete}, 7153 7185 {"matchend", 2, 4, f_matchend}, 7154 7186 {"matchlist", 2, 4, f_matchlist}, 7155 7187 {"matchstr", 2, 4, f_matchstr}, … … 7190 7222 {"setcmdpos", 1, 1, f_setcmdpos}, 7191 7223 {"setline", 2, 2, f_setline}, 7192 7224 {"setloclist", 2, 3, f_setloclist}, 7225 {"setmatches", 1, 1, f_setmatches}, 7193 7226 {"setpos", 2, 2, f_setpos}, 7194 7227 {"setqflist", 1, 2, f_setqflist}, 7195 7228 {"setreg", 2, 3, f_setreg}, … … 8240 8273 } 8241 8274 8242 8275 /* 8276 * "clearmatches()" function 8277 */ 8278 /*ARGSUSED*/ 8279 static void 8280 f_clearmatches(argvars, rettv) 8281 typval_T *argvars; 8282 typval_T *rettv; 8283 { 8284 #ifdef FEAT_SEARCH_EXTRA 8285 clear_matches(curwin); 8286 #endif 8287 } 8288 8289 /* 8243 8290 * "col(string)" function 8244 8291 */ 8245 8292 static void … … 9339 9386 { 9340 9387 typval_T rettv; 9341 9388 char_u *s; 9389 int retval = FAIL; 9342 9390 9343 9391 copy_tv(tv, &vimvars[VV_VAL].vv_tv); 9344 9392 s = expr; 9345 9393 if (eval1(&s, &rettv, TRUE) == FAIL) 9346 return FAIL;9394 goto theend; 9347 9395 if (*s != NUL) /* check for trailing chars after expr */ 9348 9396 { 9349 9397 EMSG2(_(e_invexpr2), s); 9350 return FAIL;9398 goto theend; 9351 9399 } 9352 9400 if (map) 9353 9401 { … … 9366 9414 /* On type error, nothing has been removed; return FAIL to stop the 9367 9415 * loop. The error message was given by get_tv_number_chk(). */ 9368 9416 if (error) 9369 return FAIL;9417 goto theend; 9370 9418 } 9419 retval = OK; 9420 theend: 9371 9421 clear_tv(&vimvars[VV_VAL].vv_tv); 9372 return OK;9422 return retval; 9373 9423 } 9374 9424 9375 9425 /* … … 9670 9720 /* This is postponed until we are back at the toplevel, because we may be 9671 9721 * using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]". */ 9672 9722 want_garbage_collect = TRUE; 9723 9724 if (argvars[0].v_type != VAR_UNKNOWN && get_tv_number(&argvars[0]) == 1) 9725 garbage_collect_at_exit = TRUE; 9673 9726 } 9674 9727 9675 9728 /* … … 9868 9921 9869 9922 ++no_mapping; 9870 9923 ++allow_keys; 9871 if (argvars[0].v_type == VAR_UNKNOWN) 9872 /* getchar(): blocking wait. */ 9873 n = safe_vgetc(); 9874 else if (get_tv_number_chk(&argvars[0], &error) == 1) 9875 /* getchar(1): only check if char avail */ 9876 n = vpeekc(); 9877 else if (error || vpeekc() == NUL) 9878 /* illegal argument or getchar(0) and no char avail: return zero */ 9879 n = 0; 9880 else 9881 /* getchar(0) and char avail: return char */ 9882 n = safe_vgetc(); 9924 for (;;) 9925 { 9926 if (argvars[0].v_type == VAR_UNKNOWN) 9927 /* getchar(): blocking wait. */ 9928 n = safe_vgetc(); 9929 else if (get_tv_number_chk(&argvars[0], &error) == 1) 9930 /* getchar(1): only check if char avail */ 9931 n = vpeekc(); 9932 else if (error || vpeekc() == NUL) 9933 /* illegal argument or getchar(0) and no char avail: return zero */ 9934 n = 0; 9935 else 9936 /* getchar(0) and char avail: return char */ 9937 n = safe_vgetc(); 9938 if (n == K_IGNORE) 9939 continue; 9940 break; 9941 } 9883 9942 --no_mapping; 9884 9943 --allow_keys; 9885 9944 … … 10136 10195 if (mch_isdir(fname)) 10137 10196 rettv->vval.v_number = 0; 10138 10197 else 10198 { 10139 10199 rettv->vval.v_number = (varnumber_T)st.st_size; 10200 10201 /* non-perfect check for overflow */ 10202 if ((off_t)rettv->vval.v_number != (off_t)st.st_size) 10203 rettv->vval.v_number = -2; 10204 } 10140 10205 } 10141 10206 else 10142 10207 rettv->vval.v_number = -1; … … 10269 10334 } 10270 10335 10271 10336 /* 10337 * "getmatches()" function 10338 */ 10339 /*ARGSUSED*/ 10340 static void 10341 f_getmatches(argvars, rettv) 10342 typval_T *argvars; 10343 typval_T *rettv; 10344 { 10345 #ifdef FEAT_SEARCH_EXTRA 10346 dict_T *dict; 10347 matchitem_T *cur = curwin->w_match_head; 10348 10349 rettv->vval.v_number = 0; 10350 10351 if (rettv_list_alloc(rettv) == OK) 10352 { 10353 while (cur != NULL) 10354 { 10355 dict = dict_alloc(); 10356 if (dict == NULL) 10357 return; 10358 dict_add_nr_str(dict, "group", 0L, syn_id2name(cur->hlg_id)); 10359 dict_add_nr_str(dict, "pattern", 0L, cur->pattern); 10360 dict_add_nr_str(dict, "priority", (long)cur->priority, NULL); 10361 dict_add_nr_str(dict, "id", (long)cur->id, NULL); 10362 list_append_dict(rettv->vval.v_list, dict); 10363 cur = cur->next; 10364 } 10365 } 10366 #endif 10367 } 10368 10369 /* 10272 10370 * "getpos(string)" function 10273 10371 */ 10274 10372 static void … … 10290 10388 list_append_number(l, (varnumber_T)0); 10291 10389 list_append_number(l, (fp != NULL) ? (varnumber_T)fp->lnum 10292 10390 : (varnumber_T)0); 10293 list_append_number(l, (fp != NULL) ? (varnumber_T)fp->col + 1 10391 list_append_number(l, (fp != NULL) 10392 ? (varnumber_T)(fp->col == MAXCOL ? MAXCOL : fp->col + 1) 10294 10393 : (varnumber_T)0); 10295 10394 list_append_number(l, 10296 10395 #ifdef FEAT_VIRTUALEDIT … … 10785 10884 "gui_gtk2", 10786 10885 # endif 10787 10886 #endif 10887 #ifdef FEAT_GUI_GNOME 10888 "gui_gnome", 10889 #endif 10788 10890 #ifdef FEAT_GUI_MAC 10789 10891 "gui_mac", 10790 10892 #endif … … 11471 11573 char_u *xp_arg = NULL; 11472 11574 11473 11575 rettv->v_type = VAR_STRING; 11576 rettv->vval.v_string = NULL; 11474 11577 11475 11578 #ifdef NO_CONSOLE_INPUT 11476 11579 /* While starting up, there is no place to enter text. */ 11477 11580 if (no_console_input()) 11478 {11479 rettv->vval.v_string = NULL;11480 11581 return; 11481 }11482 11582 #endif 11483 11583 11484 11584 cmd_silent = FALSE; /* Want to see the prompt. */ … … 12439 12539 } 12440 12540 12441 12541 /* 12542 * "matchadd()" function 12543 */ 12544 static void 12545 f_matchadd(argvars, rettv) 12546 typval_T *argvars; 12547 typval_T *rettv; 12548 { 12549 #ifdef FEAT_SEARCH_EXTRA 12550 char_u buf[NUMBUFLEN]; 12551 char_u *grp = get_tv_string_buf_chk(&argvars[0], buf); /* group */ 12552 char_u *pat = get_tv_string_buf_chk(&argvars[1], buf); /* pattern */ 12553 int prio = 10; /* default priority */ 12554 int id = -1; 12555 int error = FALSE; 12556 12557 rettv->vval.v_number = -1; 12558 12559 if (grp == NULL || pat == NULL) 12560 return; 12561 if (argvars[2].v_type != VAR_UNKNOWN) 12562 { 12563 prio = get_tv_number_chk(&argvars[2], &error); 12564 if (argvars[3].v_type != VAR_UNKNOWN) 12565 id = get_tv_number_chk(&argvars[3], &error); 12566 } 12567 if (error == TRUE) 12568 return; 12569 if (id >= 1 && id <= 3) 12570 { 12571 EMSGN("E798: ID is reserved for \":match\": %ld", id); 12572 return; 12573 } 12574 12575 rettv->vval.v_number = match_add(curwin, grp, pat, prio, id); 12576 #endif 12577 } 12578 12579 /* 12442 12580 * "matcharg()" function 12443 12581 */ 12444 12582 static void … … 12449 12587 if (rettv_list_alloc(rettv) == OK) 12450 12588 { 12451 12589 #ifdef FEAT_SEARCH_EXTRA 12452 int mi = get_tv_number(&argvars[0]); 12590 int id = get_tv_number(&argvars[0]); 12591 matchitem_T *m; 12453 12592 12454 if ( mi >= 1 && mi<= 3)12593 if (id >= 1 && id <= 3) 12455 12594 { 12456 list_append_string(rettv->vval.v_list, 12457 syn_id2name(curwin->w_match_id[mi - 1]), -1); 12458 list_append_string(rettv->vval.v_list, 12459 curwin->w_match_pat[mi - 1], -1); 12595 if ((m = (matchitem_T *)get_match(curwin, id)) != NULL) 12596 { 12597 list_append_string(rettv->vval.v_list, 12598 syn_id2name(m->hlg_id), -1); 12599 list_append_string(rettv->vval.v_list, m->pattern, -1); 12600 } 12601 else 12602 { 12603 list_append_string(rettv->vval.v_list, NUL, -1); 12604 list_append_string(rettv->vval.v_list, NUL, -1); 12605 } 12460 12606 } 12461 12607 #endif 12462 12608 } 12463 12609 } 12464 12610 12465 12611 /* 12612 * "matchdelete()" function 12613 */ 12614 static void 12615 f_matchdelete(argvars, rettv) 12616 typval_T *argvars; 12617 typval_T *rettv; 12618 { 12619 #ifdef FEAT_SEARCH_EXTRA 12620 rettv->vval.v_number = match_delete(curwin, 12621 (int)get_tv_number(&argvars[0]), TRUE); 12622 #endif 12623 } 12624 12625 /* 12466 12626 * "matchend()" function 12467 12627 */ 12468 12628 static void … … 13680 13840 } 13681 13841 /* Shorten "remain". */ 13682 13842 if (*q != NUL) 13683 STRCPY(remain, q -1);13843 mch_memmove(remain, q - 1, STRLEN(q - 1) + 1); 13684 13844 else 13685 13845 { 13686 13846 vim_free(remain); … … 13919 14079 /* If 'n' flag is used: restore cursor position. */ 13920 14080 if (flags & SP_NOMOVE) 13921 14081 curwin->w_cursor = save_cursor; 14082 else 14083 curwin->w_set_curswant = TRUE; 13922 14084 theend: 13923 14085 p_ws = save_p_ws; 13924 14086 … … 14498 14660 } 14499 14661 14500 14662 /* 14663 * "setmatches()" function 14664 */ 14665 static void 14666 f_setmatches(argvars, rettv) 14667 typval_T *argvars; 14668 typval_T *rettv; 14669 { 14670 #ifdef FEAT_SEARCH_EXTRA 14671 list_T *l; 14672 listitem_T *li; 14673 dict_T *d; 14674 14675 rettv->vval.v_number = -1; 14676 if (argvars[0].v_type != VAR_LIST) 14677 { 14678 EMSG(_(e_listreq)); 14679 return; 14680 } 14681 if ((l = argvars[0].vval.v_list) != NULL) 14682 { 14683 14684 /* To some extent make sure that we are dealing with a list from 14685 * "getmatches()". */ 14686 li = l->lv_first; 14687 while (li != NULL) 14688 { 14689 if (li->li_tv.v_type != VAR_DICT 14690 || (d = li->li_tv.vval.v_dict) == NULL) 14691 { 14692 EMSG(_(e_invarg)); 14693 return; 14694 } 14695 if (!(dict_find(d, (char_u *)"group", -1) != NULL 14696 && dict_find(d, (char_u *)"pattern", -1) != NULL 14697 && dict_find(d, (char_u *)"priority", -1) != NULL 14698 && dict_find(d, (char_u *)"id", -1) != NULL)) 14699 { 14700 EMSG(_(e_invarg)); 14701 return; 14702 } 14703 li = li->li_next; 14704 } 14705 14706 clear_matches(curwin); 14707 li = l->lv_first; 14708 while (li != NULL) 14709 { 14710 d = li->li_tv.vval.v_dict; 14711 match_add(curwin, get_dict_string(d, (char_u *)"group", FALSE), 14712 get_dict_string(d, (char_u *)"pattern", FALSE), 14713 (int)get_dict_number(d, (char_u *)"priority"), 14714 (int)get_dict_number(d, (char_u *)"id")); 14715 li = li->li_next; 14716 } 14717 rettv->vval.v_number = 0; 14718 } 14719 #endif 14720 } 14721 14722 /* 14501 14723 * "setpos()" function 14502 14724 */ 14503 14725 /*ARGSUSED*/ … … 14785 15007 14786 15008 p1 = tv2string(&(*(listitem_T **)s1)->li_tv, &tofree1, numbuf1, 0); 14787 15009 p2 = tv2string(&(*(listitem_T **)s2)->li_tv, &tofree2, numbuf2, 0); 15010 if (p1 == NULL) 15011 p1 = (char_u *)""; 15012 if (p2 == NULL) 15013 p2 = (char_u *)""; 14788 15014 if (item_compare_ic) 14789 15015 res = STRICMP(p1, p2); 14790 15016 else … … 15274 15500 15275 15501 rettv->v_type = VAR_STRING; 15276 15502 rettv->vval.v_string = tv2string(&argvars[0], &tofree, numbuf, 0); 15277 if (tofree == NULL) 15503 /* Make a copy if we have a value but it's not in allocate memory. */ 15504 if (rettv->vval.v_string != NULL && tofree == NULL) 15278 15505 rettv->vval.v_string = vim_strsave(rettv->vval.v_string); 15279 15506 } 15280 15507 … … 16497 16724 * Returns NULL when there is an error. 16498 16725 */ 16499 16726 static pos_T * 16500 var2fpos(varp, lnum, fnum)16727 var2fpos(varp, dollar_lnum, fnum) 16501 16728 typval_T *varp; 16502 int lnum;/* TRUE when $ is last line */16729 int dollar_lnum; /* TRUE when $ is last line */ 16503 16730 int *fnum; /* set to fnum for '0, 'A, etc. */ 16504 16731 { 16505 16732 char_u *name; … … 16512 16739 list_T *l; 16513 16740 int len; 16514 16741 int error = FALSE; 16742 listitem_T *li; 16515 16743 16516 16744 l = varp->vval.v_list; 16517 16745 if (l == NULL) … … 16527 16755 if (error) 16528 16756 return NULL; 16529 16757 len = (long)STRLEN(ml_get(pos.lnum)); 16758 16759 /* We accept "$" for the column number: last column. */ 16760 li = list_find(l, 1L); 16761 if (li != NULL && li->li_tv.v_type == VAR_STRING 16762 && li->li_tv.vval.v_string != NULL 16763 && STRCMP(li->li_tv.vval.v_string, "$") == 0) 16764 pos.col = len + 1; 16765 16530 16766 /* Accept a position up to the NUL after the line. */ 16531 16767 if (pos.col == 0 || (int)pos.col > len + 1) 16532 16768 return NULL; /* invalid column number */ … … 16559 16795 pos.coladd = 0; 16560 16796 #endif 16561 16797 16562 if (name[0] == 'w' && lnum)16798 if (name[0] == 'w' && dollar_lnum) 16563 16799 { 16564 16800 pos.col = 0; 16565 16801 if (name[1] == '0') /* "w0": first visible line */ … … 16577 16813 } 16578 16814 else if (name[0] == '$') /* last column or line */ 16579 16815 { 16580 if ( lnum)16816 if (dollar_lnum) 16581 16817 { 16582 16818 pos.lnum = curbuf->b_ml.ml_line_count; 16583 16819 pos.col = 0; … … 17798 18034 * List the value of one internal variable. 17799 18035 */ 17800 18036 static void 17801 list_one_var(v, prefix )18037 list_one_var(v, prefix, first) 17802 18038 dictitem_T *v; 17803 18039 char_u *prefix; 18040 int *first; 17804 18041 { 17805 18042 char_u *tofree; 17806 18043 char_u *s; … … 17808 18045 17809 18046 s = echo_string(&v->di_tv, &tofree, numbuf, ++current_copyID); 17810 18047 list_one_var_a(prefix, v->di_key, v->di_tv.v_type, 17811 s == NULL ? (char_u *)"" : s);18048 s == NULL ? (char_u *)"" : s, first); 17812 18049 vim_free(tofree); 17813 18050 } 17814 18051 17815 18052 static void 17816 list_one_var_a(prefix, name, type, string )18053 list_one_var_a(prefix, name, type, string, first) 17817 18054 char_u *prefix; 17818 18055 char_u *name; 17819 18056 int type; 17820 18057 char_u *string; 18058 int *first; /* when TRUE clear rest of screen and set to FALSE */ 17821 18059 { 17822 msg_attr(prefix, 0); /* don't use msg(), it overwrites "v:statusmsg" */ 18060 /* don't use msg() or msg_attr() to avoid overwriting "v:statusmsg" */ 18061 msg_start(); 18062 msg_puts(prefix); 17823 18063 if (name != NULL) /* "a:" vars don't have a name stored */ 17824 18064 msg_puts(name); 17825 18065 msg_putchar(' '); … … 17847 18087 17848 18088 if (type == VAR_FUNC) 17849 18089 msg_puts((char_u *)"()"); 18090 if (*first) 18091 { 18092 msg_clr_eos(); 18093 *first = FALSE; 18094 } 17850 18095 } 17851 18096 17852 18097 /* … … 19136 19381 goto theend; 19137 19382 } 19138 19383 19384 /* Check if the name is a Funcref. If so, use the value. */ 19385 if (lv.ll_exp_name != NULL) 19386 { 19387 len = (int)STRLEN(lv.ll_exp_name); 19388 name = deref_func_name(lv.ll_exp_name, &len); 19389 if (name == lv.ll_exp_name) 19390 name = NULL; 19391 } 19392 else 19393 { 19394 len = (int)(end - *pp); 19395 name = deref_func_name(*pp, &len); 19396 if (name == *pp) 19397 name = NULL; 19398 } 19399 if (name != NULL) 19400 { 19401 name = vim_strsave(name); 19402 *pp = end; 19403 goto theend; 19404 } 19405 19139 19406 if (lv.ll_exp_name != NULL) 19140 19407 { 19141 19408 len = (int)STRLEN(lv.ll_exp_name); … … 19969 20236 char_u buf[MSG_BUF_LEN]; 19970 20237 char_u numbuf2[NUMBUFLEN]; 19971 20238 char_u *tofree; 20239 char_u *s; 19972 20240 19973 20241 msg_puts((char_u *)"("); 19974 20242 for (i = 0; i < argcount; ++i) … … 19979 20247 msg_outnum((long)argvars[i].vval.v_number); 19980 20248 else 19981 20249 { 19982 trunc_string(tv2string(&argvars[i], &tofree, 19983 numbuf2, 0), buf, MSG_BUF_CLEN); 19984 msg_puts(buf); 19985 vim_free(tofree); 20250 s = tv2string(&argvars[i], &tofree, numbuf2, 0); 20251 if (s != NULL) 20252 { 20253 trunc_string(s, buf, MSG_BUF_CLEN); 20254 msg_puts(buf); 20255 vim_free(tofree); 20256 } 19986 20257 } 19987 20258 } 19988 20259 msg_puts((char_u *)")"); … … 20060 20331 char_u buf[MSG_BUF_LEN]; 20061 20332 char_u numbuf2[NUMBUFLEN]; 20062 20333 char_u *tofree; 20334 char_u *s; 20063 20335 20064 20336 /* The value may be very long. Skip the middle part, so that we 20065 20337 * have some idea how it starts and ends. smsg() would always 20066 20338 * truncate it at the end. */ 20067 trunc_string(tv2string(fc.rettv, &tofree, numbuf2, 0), 20068 buf, MSG_BUF_CLEN); 20069 smsg((char_u *)_("%s returning %s"), sourcing_name, buf); 20070 vim_free(tofree); 20339 s = tv2string(fc.rettv, &tofree, numbuf2, 0); 20340 if (s != NULL) 20341 { 20342 trunc_string(s, buf, MSG_BUF_CLEN); 20343 smsg((char_u *)_("%s returning %s"), sourcing_name, buf); 20344 vim_free(tofree); 20345 } 20071 20346 } 20072 20347 msg_puts((char_u *)"\n"); /* don't overwrite this either */ 20073 20348 … … 21034 21309 *usedlen += 2; 21035 21310 s = get_past_head(*fnamep); 21036 21311 while (tail > s && after_pathsep(s, tail)) 21037 --tail;21312 mb_ptr_back(*fnamep, tail); 21038 21313 *fnamelen = (int)(tail - *fnamep); 21039 21314 #ifdef VMS 21040 21315 if (*fnamelen > 0) 21041 21316 *fnamelen += 1; /* the path separator is part of the path */ 21042 21317 #endif 21043 while (tail > s && !after_pathsep(s, tail)) 21044 mb_ptr_back(*fnamep, tail); 21318 if (*fnamelen == 0) 21319 { 21320 /* Result is empty. Turn it into "." to make ":cd %:h" work. */ 21321 p = vim_strsave((char_u *)"."); 21322 if (p == NULL) 21323 return -1; 21324 vim_free(*bufp); 21325 *bufp = *fnamep = tail = p; 21326 *fnamelen = 1; 21327 } 21328 else 21329 { 21330 while (tail > s && !after_pathsep(s, tail)) 21331 mb_ptr_back(*fnamep, tail); 21332 } 21045 21333 } 21046 21334 21047 21335 /* ":8" - shortname */ -
src/ex_cmds.c
diff -Naur vim71.orig/src/ex_cmds.c vim71/src/ex_cmds.c
old new 408 408 goto sortend; 409 409 } 410 410 *s = NUL; 411 regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC); 411 /* Use last search pattern if sort pattern is empty. */ 412 if (s == p + 1 && last_search_pat() != NULL) 413 regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC); 414 else 415 regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC); 412 416 if (regmatch.regprog == NULL) 413 417 goto sortend; 414 418 p = s; /* continue after the regexp */ … … 2912 2916 } 2913 2917 2914 2918 /* 2915 * Check if a buffer is read-only. Ask for overruling in a dialog. 2916 * Return TRUE and give an error message when the buffer is readonly. 2919 * Check if a buffer is read-only (either 'readonly' option is set or file is 2920 * read-only). Ask for overruling in a dialog. Return TRUE and give an error 2921 * message when the buffer is readonly. 2917 2922 */ 2918 2923 static int 2919 2924 check_readonly(forceit, buf) 2920 2925 int *forceit; 2921 2926 buf_T *buf; 2922 2927 { 2923 if (!*forceit && buf->b_p_ro) 2928 struct stat st; 2929 2930 /* Handle a file being readonly when the 'readonly' option is set or when 2931 * the file exists and permissions are read-only. 2932 * We will send 0777 to check_file_readonly(), as the "perm" variable is 2933 * important for device checks but not here. */ 2934 if (!*forceit && (buf->b_p_ro 2935 || (mch_stat((char *)buf->b_ffname, &st) >= 0 2936 && check_file_readonly(buf->b_ffname, 0777)))) 2924 2937 { 2925 2938 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) 2926 2939 if ((p_confirm || cmdmod.confirm) && buf->b_fname != NULL) 2927 2940 { 2928 2941 char_u buff[IOSIZE]; 2929 2942 2930 dialog_msg(buff, _("'readonly' option is set for \"%s\".\nDo you wish to write anyway?"), 2943 if (buf->b_p_ro) 2944 dialog_msg(buff, _("'readonly' option is set for \"%s\".\nDo you wish to write anyway?"), 2945 buf->b_fname); 2946 else 2947 dialog_msg(buff, _("File permissions of \"%s\" are read-only.\nIt may still be possible to write it.\nDo you wish to try?"), 2931 2948 buf->b_fname); 2932 2949 2933 2950 if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) == VIM_YES) … … 2941 2958 } 2942 2959 else 2943 2960 #endif 2961 if (buf->b_p_ro) 2944 2962 EMSG(_(e_readonly)); 2963 else 2964 EMSG2(_("E505: \"%s\" is read-only (add ! to override)"), 2965 buf->b_fname); 2945 2966 return TRUE; 2946 2967 } 2968 2947 2969 return FALSE; 2948 2970 } 2949 2971 … … 2952 2974 * 'fnum' is the number of the file, if zero use ffname/sfname. 2953 2975 * 2954 2976 * Return 1 for "normal" error, 2 for "not written" error, 0 for success 2955 * -1 for succes fully opening another file.2977 * -1 for successfully opening another file. 2956 2978 * 'lnum' is the line number for the cursor in the new file (if non-zero). 2957 2979 */ 2958 2980 int … … 3367 3389 * was in this window (or another window). If not used 3368 3390 * before, reset the local window options to the global 3369 3391 * values. Also restores old folding stuff. */ 3370 get_winopts( buf);3392 get_winopts(curbuf); 3371 3393 #ifdef FEAT_SPELL 3372 3394 did_get_winopts = TRUE; 3373 3395 #endif … … 3562 3584 curwin_init(); 3563 3585 3564 3586 #ifdef FEAT_FOLDING 3565 /* It's like all lines in the buffer changed. Need to update 3566 * automatic folding. */ 3587 /* It's possible that all lines in the buffer changed. Need to update 3588 * automatic folding for all windows where it's used. */ 3589 # ifdef FEAT_WINDOWS 3590 { 3591 win_T *win; 3592 tabpage_T *tp; 3593 3594 FOR_ALL_TAB_WINDOWS(tp, win) 3595 if (win->w_buffer == curbuf) 3596 foldUpdateAll(win); 3597 } 3598 # else 3567 3599 foldUpdateAll(curwin); 3600 # endif 3568 3601 #endif 3569 3602 3570 3603 /* Change directories when the 'acd' option is set. */ … … 3649 3682 #ifdef FEAT_SPELL 3650 3683 /* If the window options were changed may need to set the spell language. 3651 3684 * Can only do this after the buffer has been properly setup. */ 3652 if (did_get_winopts && curwin->w_p_spell && * buf->b_p_spl != NUL)3653 did_set_spelllang( buf);3685 if (did_get_winopts && curwin->w_p_spell && *curbuf->b_p_spl != NUL) 3686 did_set_spelllang(curbuf); 3654 3687 #endif 3655 3688 3656 3689 if (command == NULL) … … 3754 3787 workshop_file_opened((char *)curbuf->b_ffname, curbuf->b_p_ro); 3755 3788 # endif 3756 3789 # ifdef FEAT_NETBEANS_INTG 3757 if (usingNetbeans & ((flags & ECMD_SET_HELP) != ECMD_SET_HELP))3790 if (usingNetbeans && ((flags & ECMD_SET_HELP) != ECMD_SET_HELP)) 3758 3791 netbeans_file_opened(curbuf); 3759 3792 # endif 3760 3793 } … … 4294 4327 do_error = TRUE; 4295 4328 do_print = FALSE; 4296 4329 do_count = FALSE; 4330 do_number = FALSE; 4297 4331 do_ic = 0; 4298 4332 } 4299 4333 while (*cmd) … … 4464 4498 * 4465 4499 * The new text is built up in new_start[]. It has some extra 4466 4500 * room to avoid using alloc()/free() too often. new_start_len is 4467 * the leng htof the allocated memory at new_start.4501 * the length of the allocated memory at new_start. 4468 4502 * 4469 4503 * Make a copy of the old line, so it won't be taken away when 4470 4504 * updating the screen or handling a multi-line match. The "old_" … … 4635 4669 #endif 4636 4670 ++no_mapping; /* don't map this key */ 4637 4671 ++allow_keys; /* allow special keys */ 4638 i = safe_vgetc();4672 i = plain_vgetc(); 4639 4673 --allow_keys; 4640 4674 --no_mapping; 4641 4675 … … 6351 6385 for (i = 0; i < ga.ga_len; ++i) 6352 6386 { 6353 6387 s = ((char_u **)ga.ga_data)[i]; 6354 if (STRNCMP(s, "help-tags ", 9) == 0)6388 if (STRNCMP(s, "help-tags\t", 10) == 0) 6355 6389 /* help-tags entry was added in formatted form */ 6356 fp rintf(fd_tags, (char *)s);6390 fputs((char *)s, fd_tags); 6357 6391 else 6358 6392 { 6359 6393 fprintf(fd_tags, "%s\t/*", s); -
src/ex_docmd.c
diff -Naur vim71.orig/src/ex_docmd.c vim71/src/ex_docmd.c
old new 133 133 static void get_flags __ARGS((exarg_T *eap)); 134 134 #if !defined(FEAT_PERL) || !defined(FEAT_PYTHON) || !defined(FEAT_TCL) \ 135 135 || !defined(FEAT_RUBY) || !defined(FEAT_MZSCHEME) 136 # define HAVE_EX_SCRIPT_NI 136 137 static void ex_script_ni __ARGS((exarg_T *eap)); 137 138 #endif 138 139 static char_u *invalid_range __ARGS((exarg_T *eap)); … … 2118 2119 #ifdef FEAT_USR_CMDS 2119 2120 !USER_CMDIDX(ea.cmdidx) && 2120 2121 #endif 2121 cmdnames[ea.cmdidx].cmd_func == ex_ni); 2122 (cmdnames[ea.cmdidx].cmd_func == ex_ni 2123 #ifdef HAVE_EX_SCRIPT_NI 2124 || cmdnames[ea.cmdidx].cmd_func == ex_script_ni 2125 #endif 2126 )); 2122 2127 2123 2128 #ifndef FEAT_EVAL 2124 2129 /* … … 3276 3281 3277 3282 if (ea.argt & XFILE) 3278 3283 { 3279 int in_quote = FALSE; 3280 char_u *bow = NULL; /* Beginning of word */ 3284 int c; 3285 int in_quote = FALSE; 3286 char_u *bow = NULL; /* Beginning of word */ 3281 3287 3282 3288 /* 3283 3289 * Allow spaces within back-quotes to count as part of the argument 3284 3290 * being expanded. 3285 3291 */ 3286 3292 xp->xp_pattern = skipwhite(arg); 3287 for (p = xp->xp_pattern; *p; ) 3293 p = xp->xp_pattern; 3294 while (*p != NUL) 3288 3295 { 3289 if (*p == '\\' && p[1] != NUL) 3296 #ifdef FEAT_MBYTE 3297 if (has_mbyte) 3298 c = mb_ptr2char(p); 3299 else 3300 #endif 3301 c = *p; 3302 if (c == '\\' && p[1] != NUL) 3290 3303 ++p; 3304 else if (c == '`') 3305 { 3306 if (!in_quote) 3307 { 3308 xp->xp_pattern = p; 3309 bow = p + 1; 3310 } 3311 in_quote = !in_quote; 3312 } 3291 3313 #ifdef SPACE_IN_FILENAME 3292 else if (vim_iswhite(*p) && (!(ea.argt & NOSPC) || usefilter)) 3314 else if (!vim_isfilec_or_wc(c) 3315 && (!(ea.argt & NOSPC) || usefilter)) 3293 3316 #else 3294 else if ( vim_iswhite(*p))3317 else if (!vim_isfilec_or_wc(c)) 3295 3318 #endif 3296 3319 { 3297 p = skipwhite(p); 3320 while (*p != NUL) 3321 { 3322 #ifdef FEAT_MBYTE 3323 if (has_mbyte) 3324 c = mb_ptr2char(p); 3325 else 3326 #endif 3327 c = *p; 3328 if (c == '`' || vim_isfilec_or_wc(c)) 3329 break; 3330 #ifdef FEAT_MBYTE 3331 if (has_mbyte) 3332 len = (*mb_ptr2len)(p); 3333 else 3334 #endif 3335 len = 1; 3336 mb_ptr_adv(p); 3337 } 3298 3338 if (in_quote) 3299 3339 bow = p; 3300 3340 else 3301 3341 xp->xp_pattern = p; 3302 --p; 3303 } 3304 else if (*p == '`') 3305 { 3306 if (!in_quote) 3307 { 3308 xp->xp_pattern = p; 3309 bow = p + 1; 3310 } 3311 in_quote = !in_quote; 3342 p -= len; 3312 3343 } 3313 3344 mb_ptr_adv(p); 3314 3345 } … … 3401 3432 case CMD_windo: 3402 3433 return arg; 3403 3434 3404 #ifdef FEAT_SEARCH_EXTRA 3435 #ifdef FEAT_CMDL_COMPL 3436 # ifdef FEAT_SEARCH_EXTRA 3405 3437 case CMD_match: 3406 3438 if (*arg == NUL || !ends_excmd(*arg)) 3407 3439 { 3408 /* Dummy call to clear variables. */ 3409 set_context_in_highlight_cmd(xp, (char_u *)"link n"); 3410 xp->xp_context = EXPAND_HIGHLIGHT; 3411 xp->xp_pattern = arg; 3440 /* also complete "None" */ 3441 set_context_in_echohl_cmd(xp, arg); 3412 3442 arg = skipwhite(skiptowhite(arg)); 3413 3443 if (*arg != NUL) 3414 3444 { … … 3417 3447 } 3418 3448 } 3419 3449 return find_nextcmd(arg); 3420 # endif3450 # endif 3421 3451 3422 #ifdef FEAT_CMDL_COMPL3423 3452 /* 3424 3453 * All completion for the +cmdline_compl feature goes here. 3425 3454 */ … … 3617 3646 break; 3618 3647 3619 3648 case CMD_echohl: 3620 xp->xp_context = EXPAND_HIGHLIGHT; 3621 xp->xp_pattern = arg; 3649 set_context_in_echohl_cmd(xp, arg); 3622 3650 break; 3623 3651 #endif 3624 3652 case CMD_highlight: … … 3997 4025 eap->errmsg = (char_u *)N_("E319: Sorry, the command is not available in this version"); 3998 4026 } 3999 4027 4000 #if !defined(FEAT_PERL) || !defined(FEAT_PYTHON) || !defined(FEAT_TCL) \ 4001 || !defined(FEAT_RUBY) || !defined(FEAT_MZSCHEME) 4028 #ifdef HAVE_EX_SCRIPT_NI 4002 4029 /* 4003 4030 * Function called for script command which is Not Implemented. NI! 4004 4031 * Skips over ":perl <<EOF" constructs. … … 4376 4403 || vim_strchr(eap->arg, '~') != NULL) 4377 4404 { 4378 4405 expand_env_esc(eap->arg, NameBuff, MAXPATHL, 4379 4406 TRUE, TRUE, NULL); 4380 4407 has_wildcards = mch_has_wildcard(NameBuff); 4381 4408 p = NameBuff; 4382 4409 } … … 4492 4519 if (eap->argt & (USECTRLV | XFILE)) 4493 4520 ++p; /* skip CTRL-V and next char */ 4494 4521 else 4495 STRCPY(p, p + 1); /* remove CTRL-V and skip next char */ 4522 /* remove CTRL-V and skip next char */ 4523 mch_memmove(p, p + 1, STRLEN(p)); 4496 4524 if (*p == NUL) /* stop at NUL after CTRL-V */ 4497 4525 break; 4498 4526 } … … 10816 10844 exarg_T *eap; 10817 10845 { 10818 10846 char_u *p; 10847 char_u *g = NULL; 10819 10848 char_u *end; 10820 10849 int c; 10821 int mi;10850 int id; 10822 10851 10823 10852 if (eap->line2 <= 3) 10824 mi = eap->line2 - 1;10853 id = eap->line2; 10825 10854 else 10826 10855 { 10827 10856 EMSG(e_invcmd); … … 10830 10859 10831 10860 /* First clear any old pattern. */ 10832 10861 if (!eap->skip) 10833 { 10834 vim_free(curwin->w_match[mi].regprog); 10835 curwin->w_match[mi].regprog = NULL; 10836 vim_free(curwin->w_match_pat[mi]); 10837 curwin->w_match_pat[mi] = NULL; 10838 redraw_later(SOME_VALID); /* always need a redraw */ 10839 } 10862 match_delete(curwin, id, FALSE); 10840 10863 10841 10864 if (ends_excmd(*eap->arg)) 10842 10865 end = eap->arg; … … 10847 10870 { 10848 10871 p = skiptowhite(eap->arg); 10849 10872 if (!eap->skip) 10850 { 10851 curwin->w_match_id[mi] = syn_namen2id(eap->arg, 10852 (int)(p - eap->arg)); 10853 if (curwin->w_match_id[mi] == 0) 10854 { 10855 EMSG2(_(e_nogroup), eap->arg); 10856 return; 10857 } 10858 } 10873 g = vim_strnsave(eap->arg, (int)(p - eap->arg)); 10859 10874 p = skipwhite(p); 10860 10875 if (*p == NUL) 10861 10876 { … … 10879 10894 10880 10895 c = *end; 10881 10896 *end = NUL; 10882 curwin->w_match[mi].regprog = vim_regcomp(p + 1, RE_MAGIC); 10883 if (curwin->w_match[mi].regprog == NULL) 10884 { 10885 EMSG2(_(e_invarg2), p); 10886 *end = c; 10887 return; 10888 } 10889 curwin->w_match_pat[mi] = vim_strsave(p + 1); 10897 match_add(curwin, g, p + 1, 10, id); 10898 vim_free(g); 10890 10899 *end = c; 10891 10900 } 10892 10901 } -
src/ex_eval.c
diff -Naur vim71.orig/src/ex_eval.c vim71/src/ex_eval.c
old new 1551 1551 } 1552 1552 save_cpo = p_cpo; 1553 1553 p_cpo = (char_u *)""; 1554 regmatch.regprog = vim_regcomp(pat, TRUE);1554 regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); 1555 1555 regmatch.rm_ic = FALSE; 1556 1556 if (end != NULL) 1557 1557 *end = save_char; -
src/ex_getln.c
diff -Naur vim71.orig/src/ex_getln.c vim71/src/ex_getln.c
old new 268 268 { 269 269 xpc.xp_context = ccline.xp_context; 270 270 xpc.xp_pattern = ccline.cmdbuff; 271 # if defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL) 271 272 xpc.xp_arg = ccline.xp_arg; 273 # endif 272 274 } 273 275 #endif 274 276 … … 484 486 if (xpc.xp_context == EXPAND_MENUNAMES && p_wmnu) 485 487 { 486 488 /* Hitting <Down> after "emenu Name.": complete submenu */ 487 if (ccline.cmdbuff[ccline.cmdpos - 1] == '.' && c == K_DOWN) 489 if (c == K_DOWN && ccline.cmdpos > 0 490 && ccline.cmdbuff[ccline.cmdpos - 1] == '.') 488 491 c = p_wc; 489 492 else if (c == K_UP) 490 493 { … … 533 536 upseg[3] = PATHSEP; 534 537 upseg[4] = NUL; 535 538 536 if (ccline.cmdbuff[ccline.cmdpos - 1] == PATHSEP 537 && c == K_DOWN 538 && (ccline.cmdbuff[ccline.cmdpos - 2] != '.' 539 if (c == K_DOWN 540 && ccline.cmdpos > 0 541 && ccline.cmdbuff[ccline.cmdpos - 1] == PATHSEP 542 && (ccline.cmdpos < 3 543 || ccline.cmdbuff[ccline.cmdpos - 2] != '.' 539 544 || ccline.cmdbuff[ccline.cmdpos - 3] != '.')) 540 545 { 541 546 /* go down a directory */ … … 636 641 { 637 642 ++no_mapping; 638 643 ++allow_keys; 639 c = safe_vgetc();644 c = plain_vgetc(); 640 645 --no_mapping; 641 646 --allow_keys; 642 647 /* CTRL-\ e doesn't work when obtaining an expression. */ … … 730 735 /* In Ex mode a backslash escapes a newline. */ 731 736 if (exmode_active 732 737 && c != ESC 733 && ccline.cmdpos > 0734 738 && ccline.cmdpos == ccline.cmdlen 739 && ccline.cmdpos > 0 735 740 && ccline.cmdbuff[ccline.cmdpos - 1] == '\\') 736 741 { 737 742 if (c == K_KENTER) … … 1086 1091 #endif 1087 1092 putcmdline('"', TRUE); 1088 1093 ++no_mapping; 1089 i = c = safe_vgetc(); /* CTRL-R <char> */1094 i = c = plain_vgetc(); /* CTRL-R <char> */ 1090 1095 if (i == Ctrl_O) 1091 1096 i = Ctrl_R; /* CTRL-R CTRL-O == CTRL-R CTRL-R */ 1092 1097 if (i == Ctrl_R) 1093 c = safe_vgetc(); /* CTRL-R CTRL-R <char> */1098 c = plain_vgetc(); /* CTRL-R CTRL-R <char> */ 1094 1099 --no_mapping; 1095 1100 #ifdef FEAT_EVAL 1096 1101 /* … … 2090 2095 garray_T line_ga; 2091 2096 char_u *pend; 2092 2097 int startcol = 0; 2093 int c1 ;2098 int c1 = 0; 2094 2099 int escaped = FALSE; /* CTRL-V typed */ 2095 2100 int vcol = 0; 2096 2101 char_u *p; 2097 int prev_char = 0;2102 int prev_char; 2098 2103 2099 2104 /* Switch cursor on now. This avoids that it happens after the "\n", which 2100 2105 * confuses the system function that computes tabstops. */ … … 2147 2152 2148 2153 /* Get one character at a time. Don't use inchar(), it can't handle 2149 2154 * special characters. */ 2155 prev_char = c1; 2150 2156 c1 = vgetc(); 2151 2157 2152 2158 /* … … 2204 2210 redraw: 2205 2211 /* redraw the line */ 2206 2212 msg_col = startcol; 2207 windgoto(msg_row, msg_col);2208 2213 vcol = 0; 2209 2214 for (p = (char_u *)line_ga.ga_data; 2210 2215 p < (char_u *)line_ga.ga_data + line_ga.ga_len; ++p) … … 2223 2228 } 2224 2229 } 2225 2230 msg_clr_eos(); 2231 windgoto(msg_row, msg_col); 2226 2232 continue; 2227 2233 } 2228 2234 … … 2268 2274 if (IS_SPECIAL(c1)) 2269 2275 c1 = '?'; 2270 2276 ((char_u *)line_ga.ga_data)[line_ga.ga_len] = c1; 2271 prev_char = c1;2272 2277 if (c1 == '\n') 2273 2278 msg_putchar('\n'); 2274 2279 else if (c1 == TAB) … … 3311 3316 * Return a pointer to alloced memory containing the new string. 3312 3317 * Return NULL for failure. 3313 3318 * 3319 * "orig" is the originally expanded string, copied to allocated memory. It 3320 * should either be kept in orig_save or freed. When "mode" is WILD_NEXT or 3321 * WILD_PREV "orig" should be NULL. 3322 * 3314 3323 * Results are cached in xp->xp_files and xp->xp_numfiles, except when "mode" 3315 3324 * is WILD_EXPAND_FREE or WILD_ALL. 3316 3325 * … … 3395 3404 return NULL; 3396 3405 } 3397 3406 3398 /* free old names */3407 /* free old names */ 3399 3408 if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) 3400 3409 { 3401 3410 FreeWild(xp->xp_numfiles, xp->xp_files); … … 3536 3545 if (mode == WILD_EXPAND_FREE || mode == WILD_ALL) 3537 3546 ExpandCleanup(xp); 3538 3547 3548 /* Free "orig" if it wasn't stored in "orig_save". */ 3549 if (orig != orig_save) 3550 vim_free(orig); 3551 3539 3552 return ss; 3540 3553 } 3541 3554 … … 4148 4161 4149 4162 #ifdef FEAT_EVAL 4150 4163 if (ccline.cmdfirstc == '=') 4164 { 4165 # ifdef FEAT_CMDL_COMPL 4151 4166 /* pass CMD_SIZE because there is no real command */ 4152 4167 set_context_for_expression(xp, str, CMD_SIZE); 4168 # endif 4169 } 4153 4170 else if (ccline.input_fn) 4154 4171 { 4155 4172 xp->xp_context = ccline.xp_context; 4156 4173 xp->xp_pattern = ccline.cmdbuff; 4174 # if defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL) 4157 4175 xp->xp_arg = ccline.xp_arg; 4176 # endif 4158 4177 } 4159 4178 else 4160 4179 #endif … … 4295 4314 && pat[i + 1] == '\\' 4296 4315 && pat[i + 2] == '\\' 4297 4316 && pat[i + 3] == ' ') 4298 STRCPY(pat + i, pat + i + 3); 4317 mch_memmove(pat + i, pat + i + 3, 4318 STRLEN(pat + i + 3) + 1); 4299 4319 if (xp->xp_backslash == XP_BS_ONE 4300 4320 && pat[i + 1] == ' ') 4301 STRCPY(pat + i, pat + i + 1);4321 mch_memmove(pat + i, pat + i + 1, STRLEN(pat + i)); 4302 4322 } 4303 4323 } 4304 4324 … … 4502 4522 if (xp->xp_context != EXPAND_MENUNAMES && xp->xp_context != EXPAND_MENUS) 4503 4523 sort_strings(*file, *num_file); 4504 4524 4525 #ifdef FEAT_CMDL_COMPL 4526 /* Reset the variables used for special highlight names expansion, so that 4527 * they don't show up when getting normal highlight names by ID. */ 4528 reset_expand_highlight(); 4529 #endif 4530 4505 4531 return OK; 4506 4532 } 4507 4533 … … 4535 4561 pat = vim_strsave(filepat); 4536 4562 for (i = 0; pat[i]; ++i) 4537 4563 if (pat[i] == '\\' && pat[i + 1] == ' ') 4538 STRCPY(pat + i, pat + i + 1);4564 mch_memmove(pat + i, pat + i + 1, STRLEN(pat + i)); 4539 4565 4540 4566 flags |= EW_FILE | EW_EXEC; 4541 4567 … … 5907 5933 5908 5934 # ifdef FEAT_AUTOCMD 5909 5935 /* Don't execute autocommands while creating the window. */ 5910 ++autocmd_block;5936 block_autocmds(); 5911 5937 # endif 5912 5938 /* don't use a new tab page */ 5913 5939 cmdmod.tab = 0; … … 5916 5942 if (win_split((int)p_cwh, WSP_BOT) == FAIL) 5917 5943 { 5918 5944 beep_flush(); 5945 # ifdef FEAT_AUTOCMD 5946 unblock_autocmds(); 5947 # endif 5919 5948 return K_IGNORE; 5920 5949 } 5921 5950 cmdwin_type = ccline.cmdfirstc; … … 5938 5967 5939 5968 # ifdef FEAT_AUTOCMD 5940 5969 /* Do execute autocommands for setting the filetype (load syntax). */ 5941 --autocmd_block;5970 unblock_autocmds(); 5942 5971 # endif 5943 5972 5944 5973 /* Showing the prompt may have set need_wait_return, reset it. */ … … 6092 6121 6093 6122 # ifdef FEAT_AUTOCMD 6094 6123 /* Don't execute autocommands while deleting the window. */ 6095 ++autocmd_block;6124 block_autocmds(); 6096 6125 # endif 6097 6126 wp = curwin; 6098 6127 bp = curbuf; … … 6104 6133 win_size_restore(&winsizes); 6105 6134 6106 6135 # ifdef FEAT_AUTOCMD 6107 --autocmd_block;6136 unblock_autocmds(); 6108 6137 # endif 6109 6138 } 6110 6139 -
src/feature.h
diff -Naur vim71.orig/src/feature.h vim71/src/feature.h
old new 673 673 # define ESC_CHG_TO_ENG_MODE /* if defined, when ESC pressed, 674 674 * turn to english mode 675 675 */ 676 # if !defined(FEAT_XFONTSET) && defined(HAVE_X11) 676 # if !defined(FEAT_XFONTSET) && defined(HAVE_X11) && !defined(HAVE_GTK2) 677 677 # define FEAT_XFONTSET /* Hangul input requires xfontset */ 678 678 # endif 679 679 # if defined(FEAT_XIM) && !defined(LINT) -
src/fileio.c
diff -Naur vim71.orig/src/fileio.c vim71/src/fileio.c
old new 44 44 /* Is there any system that doesn't have access()? */ 45 45 #define USE_MCH_ACCESS 46 46 47 #if defined(sun) && defined(S_ISCHR) 48 # define OPEN_CHR_FILES 49 static int is_dev_fd_file(char_u *fname); 50 #endif 47 51 #ifdef FEAT_MBYTE 48 52 static char_u *next_fenc __ARGS((char_u **pp)); 49 53 # ifdef FEAT_EVAL … … 406 410 # ifdef S_ISSOCK 407 411 && !S_ISSOCK(perm) /* ... or socket */ 408 412 # endif 413 # ifdef OPEN_CHR_FILES 414 && !(S_ISCHR(perm) && is_dev_fd_file(fname)) 415 /* ... or a character special file named /dev/fd/<n> */ 416 # endif 409 417 ) 410 418 { 411 419 if (S_ISDIR(perm)) … … 424 432 */ 425 433 if (!p_odev && mch_nodetype(fname) == NODE_WRITABLE) 426 434 { 427 filemess(curbuf, fname, (char_u *)_("is a device (disabled with 'opendevice' option "), 0);435 filemess(curbuf, fname, (char_u *)_("is a device (disabled with 'opendevice' option)"), 0); 428 436 msg_end(); 429 437 msg_scroll = msg_save; 430 438 return FAIL; … … 646 654 curbuf->b_start_eol = TRUE; 647 655 #ifdef FEAT_MBYTE 648 656 curbuf->b_p_bomb = FALSE; 657 curbuf->b_start_bomb = FALSE; 649 658 #endif 650 659 } 651 660 … … 904 913 file_rewind = FALSE; 905 914 #ifdef FEAT_MBYTE 906 915 if (set_options) 916 { 907 917 curbuf->b_p_bomb = FALSE; 918 curbuf->b_start_bomb = FALSE; 919 } 908 920 conv_error = 0; 909 921 #endif 910 922 } … … 1353 1365 size -= blen; 1354 1366 mch_memmove(ptr, ptr + blen, (size_t)size); 1355 1367 if (set_options) 1368 { 1356 1369 curbuf->b_p_bomb = TRUE; 1370 curbuf->b_start_bomb = TRUE; 1371 } 1357 1372 } 1358 1373 1359 1374 if (fio_flags == FIO_UCSBOM) … … 2265 2280 } 2266 2281 # endif 2267 2282 # endif 2283 # ifdef OPEN_CHR_FILES 2284 if (S_ISCHR(perm)) /* or character special */ 2285 { 2286 STRCAT(IObuff, _("[character special]")); 2287 c = TRUE; 2288 } 2289 # endif 2268 2290 #endif 2269 2291 if (curbuf->b_p_ro) 2270 2292 { … … 2464 2486 return OK; 2465 2487 } 2466 2488 2489 #ifdef OPEN_CHR_FILES 2490 /* 2491 * Returns TRUE if the file name argument is of the form "/dev/fd/\d\+", 2492 * which is the name of files used for process substitution output by 2493 * some shells on some operating systems, e.g., bash on SunOS. 2494 * Do not accept "/dev/fd/[012]", opening these may hang Vim. 2495 */ 2496 static int 2497 is_dev_fd_file(fname) 2498 char_u *fname; 2499 { 2500 return (STRNCMP(fname, "/dev/fd/", 8) == 0 2501 && VIM_ISDIGIT(fname[8]) 2502 && *skipdigits(fname + 9) == NUL 2503 && (fname[9] != NUL 2504 || (fname[8] != '0' && fname[8] != '1' && fname[8] != '2'))); 2505 } 2506 #endif 2507 2467 2508 #ifdef FEAT_MBYTE 2468 2509 2469 2510 /* … … 2734 2775 #endif 2735 2776 2736 2777 /* 2778 * Return TRUE if a file appears to be read-only from the file permissions. 2779 */ 2780 int 2781 check_file_readonly(fname, perm) 2782 char_u *fname; /* full path to file */ 2783 int perm; /* known permissions on file */ 2784 { 2785 #ifndef USE_MCH_ACCESS 2786 int fd = 0; 2787 #endif 2788 2789 return ( 2790 #ifdef USE_MCH_ACCESS 2791 # ifdef UNIX 2792 (perm & 0222) == 0 || 2793 # endif 2794 mch_access((char *)fname, W_OK) 2795 #else 2796 (fd = mch_open((char *)fname, O_RDWR | O_EXTRA, 0)) < 0 2797 ? TRUE : (close(fd), FALSE) 2798 #endif 2799 ); 2800 } 2801 2802 2803 /* 2737 2804 * buf_write() - write to file "fname" lines "start" through "end" 2738 2805 * 2739 2806 * We do our own buffering here because fwrite() is so slow. … … 3219 3286 * Check if the file is really writable (when renaming the file to 3220 3287 * make a backup we won't discover it later). 3221 3288 */ 3222 file_readonly = ( 3223 # ifdef USE_MCH_ACCESS 3224 # ifdef UNIX 3225 (perm & 0222) == 0 || 3226 # endif 3227 mch_access((char *)fname, W_OK) 3228 # else 3229 (fd = mch_open((char *)fname, O_RDWR | O_EXTRA, 0)) < 0 3230 ? TRUE : (close(fd), FALSE) 3231 # endif 3232 ); 3289 file_readonly = check_file_readonly(fname, (int)perm); 3290 3233 3291 if (!forceit && file_readonly) 3234 3292 { 3235 3293 if (vim_strchr(p_cpo, CPO_FWRITE) != NULL) … … 5495 5553 } 5496 5554 #endif 5497 5555 5556 #if defined(FEAT_VIMINFO) || defined(FEAT_BROWSE) || \ 5557 defined(FEAT_QUICKFIX) || defined(PROTO) 5498 5558 /* 5499 5559 * Try to find a shortname by comparing the fullname with the current 5500 5560 * directory. … … 5548 5608 p = NULL; 5549 5609 return p; 5550 5610 } 5611 #endif 5551 5612 5552 5613 /* 5553 5614 * Shorten filenames for all buffers. … … 7107 7168 7108 7169 static event_T last_event; 7109 7170 static int last_group; 7171 static int autocmd_blocked = 0; /* block all autocmds */ 7110 7172 7111 7173 /* 7112 7174 * Show the autocommands for one AutoPat. … … 8396 8458 * Quickly return if there are no autocommands for this event or 8397 8459 * autocommands are blocked. 8398 8460 */ 8399 if (first_autopat[(int)event] == NULL || autocmd_block > 0)8461 if (first_autopat[(int)event] == NULL || autocmd_blocked > 0) 8400 8462 goto BYPASS_AU; 8401 8463 8402 8464 /* … … 8710 8772 return retval; 8711 8773 } 8712 8774 8775 # ifdef FEAT_EVAL 8776 static char_u *old_termresponse = NULL; 8777 # endif 8778 8779 /* 8780 * Block triggering autocommands until unblock_autocmd() is called. 8781 * Can be used recursively, so long as it's symmetric. 8782 */ 8783 void 8784 block_autocmds() 8785 { 8786 # ifdef FEAT_EVAL 8787 /* Remember the value of v:termresponse. */ 8788 if (autocmd_blocked == 0) 8789 old_termresponse = get_vim_var_str(VV_TERMRESPONSE); 8790 # endif 8791 ++autocmd_blocked; 8792 } 8793 8794 void 8795 unblock_autocmds() 8796 { 8797 --autocmd_blocked; 8798 8799 # ifdef FEAT_EVAL 8800 /* When v:termresponse was set while autocommands were blocked, trigger 8801 * the autocommands now. Esp. useful when executing a shell command 8802 * during startup (vimdiff). */ 8803 if (autocmd_blocked == 0 8804 && get_vim_var_str(VV_TERMRESPONSE) != old_termresponse) 8805 apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, FALSE, curbuf); 8806 # endif 8807 } 8808 8713 8809 /* 8714 8810 * Find next autocommand pattern that matches. 8715 8811 */ -
src/fold.c
diff -Naur vim71.orig/src/fold.c vim71/src/fold.c
old new 858 858 || foldmethodIsDiff(wp) 859 859 #endif 860 860 || foldmethodIsSyntax(wp)) 861 { 862 int save_got_int = got_int; 863 864 /* reset got_int here, otherwise it won't work */ 865 got_int = FALSE; 861 866 foldUpdateIEMS(wp, top, bot); 867 got_int |= save_got_int; 868 } 862 869 } 863 870 864 871 /* foldUpdateAll() {{{2 */ -
src/getchar.c
diff -Naur vim71.orig/src/getchar.c vim71/src/getchar.c
old new 1596 1596 continue; 1597 1597 } 1598 1598 #endif 1599 1600 1599 #ifdef FEAT_GUI 1600 /* Handle focus event here, so that the caller doesn't need to 1601 * know about it. Return K_IGNORE so that we loop once (needed if 1602 * 'lazyredraw' is set). */ 1603 if (c == K_FOCUSGAINED || c == K_FOCUSLOST) 1604 { 1605 ui_focus_change(c == K_FOCUSGAINED); 1606 c = K_IGNORE; 1607 } 1608 1601 1609 /* Translate K_CSI to CSI. The special key is only used to avoid 1602 1610 * it being recognized as the start of a special key. */ 1603 1611 if (c == K_CSI) … … 1741 1749 } 1742 1750 1743 1751 /* 1752 * Like safe_vgetc(), but loop to handle K_IGNORE. 1753 * Also ignore scrollbar events. 1754 */ 1755 int 1756 plain_vgetc() 1757 { 1758 int c; 1759 1760 do 1761 { 1762 c = safe_vgetc(); 1763 } while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR); 1764 return c; 1765 } 1766 1767 /* 1744 1768 * Check if a character is available, such that vgetc() will not block. 1745 1769 * If the next character is a special character or multi-byte, the returned 1746 1770 * character is not valid!. -
src/globals.h
diff -Naur vim71.orig/src/globals.h vim71/src/globals.h
old new 301 301 #endif 302 302 303 303 #ifdef FEAT_EVAL 304 /* Garbage collection can only take place when we are sure there are no Lists 304 /* 305 * Garbage collection can only take place when we are sure there are no Lists 305 306 * or Dictionaries being used internally. This is flagged with 306 307 * "may_garbage_collect" when we are at the toplevel. 307 308 * "want_garbage_collect" is set by the garbagecollect() function, which means 308 * we do garbage collection before waiting for a char at the toplevel. */ 309 * we do garbage collection before waiting for a char at the toplevel. 310 * "garbage_collect_at_exit" indicates garbagecollect(1) was called. 311 */ 309 312 EXTERN int may_garbage_collect INIT(= FALSE); 310 313 EXTERN int want_garbage_collect INIT(= FALSE); 314 EXTERN int garbage_collect_at_exit INIT(= FALSE); 311 315 312 316 /* ID of script being sourced or was sourced to define the current function. */ 313 317 EXTERN scid_T current_SID INIT(= 0); … … 362 366 EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */ 363 367 EXTERN int autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */ 364 368 EXTERN int autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */ 365 EXTERN int autocmd_block INIT(= 0); /* block all autocmds */366 369 EXTERN int modified_was_set; /* did ":set modified" */ 367 370 EXTERN int did_filetype INIT(= FALSE); /* FileType event found */ 368 371 EXTERN int keep_filetype INIT(= FALSE); /* value for did_filetype when … … 801 804 EXTERN int (*mb_char2bytes) __ARGS((int c, char_u *buf)) INIT(= latin_char2bytes); 802 805 EXTERN int (*mb_ptr2cells) __ARGS((char_u *p)) INIT(= latin_ptr2cells); 803 806 EXTERN int (*mb_char2cells) __ARGS((int c)) INIT(= latin_char2cells); 804 EXTERN int (*mb_off2cells) __ARGS((unsigned off )) INIT(= latin_off2cells);807 EXTERN int (*mb_off2cells) __ARGS((unsigned off, unsigned max_off)) INIT(= latin_off2cells); 805 808 EXTERN int (*mb_ptr2char) __ARGS((char_u *p)) INIT(= latin_ptr2char); 806 809 EXTERN int (*mb_head_off) __ARGS((char_u *base, char_u *p)) INIT(= latin_head_off); 807 810 -
src/gui.c
diff -Naur vim71.orig/src/gui.c vim71/src/gui.c
old new 1080 1080 cur_width = gui.char_width; 1081 1081 } 1082 1082 #ifdef FEAT_MBYTE 1083 if (has_mbyte && (*mb_off2cells)(LineOffset[gui.row] + gui.col) > 1) 1083 if (has_mbyte && (*mb_off2cells)(LineOffset[gui.row] + gui.col, 1084 LineOffset[gui.row] + screen_Columns) > 1) 1084 1085 { 1085 1086 /* Double wide character. */ 1086 1087 if (shape_table[idx].shape != SHAPE_VER) … … 1159 1160 #endif 1160 1161 1161 1162 # if defined(FEAT_GUI_TABLINE) && (defined(FEAT_GUI_MSWIN) \ 1162 1163 || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_MAC)) 1163 1164 if (gui_has_tabline()) 1164 1165 text_area_y += gui.tabline_height; 1165 1166 #endif … … 4518 4519 xim_set_focus(in_focus); 4519 4520 # endif 4520 4521 4521 ui_focus_change(in_focus); 4522 /* Put events in the input queue only when allowed. 4523 * ui_focus_change() isn't called directly, because it invokes 4524 * autocommands and that must not happen asynchronously. */ 4525 if (!hold_gui_events) 4526 { 4527 char_u bytes[3]; 4528 4529 bytes[0] = CSI; 4530 bytes[1] = KS_EXTRA; 4531 bytes[2] = in_focus ? (int)KE_FOCUSGAINED : (int)KE_FOCUSLOST; 4532 add_to_input_buf(bytes, 3); 4533 } 4522 4534 #endif 4523 4535 } 4524 4536 … … 5117 5129 p = vim_strsave_escaped(fnames[i], (char_u *)"\\ \t\"|"); 5118 5130 # endif 5119 5131 if (p != NULL) 5120 add_to_input_buf (p, (int)STRLEN(p));5132 add_to_input_buf_csi(p, (int)STRLEN(p)); 5121 5133 vim_free(p); 5122 5134 vim_free(fnames[i]); 5123 5135 } -
src/gui_gtk.c
diff -Naur vim71.orig/src/gui_gtk.c vim71/src/gui_gtk.c
old new 53 53 # ifdef bindtextdomain 54 54 # undef bindtextdomain 55 55 # endif 56 # ifdef bind textdomain_codeset57 # undef bind textdomain_codeset56 # ifdef bind_textdomain_codeset 57 # undef bind_textdomain_codeset 58 58 # endif 59 59 # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS) 60 60 # define ENABLE_NLS /* so the texts in the dialog boxes are translated */ … … 1630 1630 */ 1631 1631 /*ARGSUSED*/ 1632 1632 static int 1633 dlg_key_press_event(GtkWidget * widget, GdkEventKey *event, CancelData *data)1633 dlg_key_press_event(GtkWidget *widget, GdkEventKey *event, CancelData *data) 1634 1634 { 1635 /* Ignore hitting Enter when there is no default button. */ 1636 if (data->ignore_enter && event->keyval == GDK_Return) 1635 /* Ignore hitting Enter (or Space) when there is no default button. */ 1636 if (data->ignore_enter && (event->keyval == GDK_Return 1637 || event->keyval == ' ')) 1637 1638 return TRUE; 1639 else /* A different key was pressed, return to normal behavior */ 1640 data->ignore_enter = FALSE; 1638 1641 1639 1642 if (event->keyval != GDK_Escape && event->keyval != GDK_Return) 1640 1643 return FALSE; … … 2224 2227 { 2225 2228 DialogInfo *di = (DialogInfo *)data; 2226 2229 2230 /* Ignore hitting Enter (or Space) when there is no default button. */ 2231 if (di->ignore_enter && (event->keyval == GDK_Return 2232 || event->keyval == ' ')) 2233 return TRUE; 2234 else /* A different key was pressed, return to normal behavior */ 2235 di->ignore_enter = FALSE; 2236 2227 2237 /* Close the dialog when hitting "Esc". */ 2228 2238 if (event->keyval == GDK_Escape) 2229 2239 { -
src/gui_gtk_x11.c
diff -Naur vim71.orig/src/gui_gtk_x11.c vim71/src/gui_gtk_x11.c
old new 36 36 # ifdef bindtextdomain 37 37 # undef bindtextdomain 38 38 # endif 39 # ifdef bind textdomain_codeset40 # undef bind textdomain_codeset39 # ifdef bind_textdomain_codeset 40 # undef bind_textdomain_codeset 41 41 # endif 42 42 # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS) 43 43 # define ENABLE_NLS /* so the texts in the dialog boxes are translated */ … … 813 813 if (blink_state == BLINK_NONE) 814 814 gui_mch_start_blink(); 815 815 816 /* make sure keyboard input goes to the draw area (if this is focus for a window) */ 816 /* make sure keyboard input goes to the draw area (if this is focus for a 817 * window) */ 817 818 if (widget != gui.drawarea) 818 819 gtk_widget_grab_focus(gui.drawarea); 819 820 821 /* make sure the input buffer is read */ 822 if (gtk_main_level() > 0) 823 gtk_main_quit(); 824 820 825 return TRUE; 821 826 } 822 827 … … 829 834 if (blink_state != BLINK_NONE) 830 835 gui_mch_stop_blink(); 831 836 837 /* make sure the input buffer is read */ 838 if (gtk_main_level() > 0) 839 gtk_main_quit(); 840 832 841 return TRUE; 833 842 } 834 843 … … 2188 2197 escaped_filename = vim_strsave_escaped(filename, escape_chars); 2189 2198 if (escaped_filename == NULL) 2190 2199 return FALSE; 2191 mksession_cmdline = g_strconcat("mksession ", (char *)escaped_filename, NULL); 2200 mksession_cmdline = g_strconcat("mksession ", (char *)escaped_filename, 2201 NULL); 2192 2202 vim_free(escaped_filename); 2203 2193 2204 /* 2194 2205 * Use a reasonable hardcoded set of 'sessionoptions' flags to avoid 2195 2206 * unpredictable effects when the session is saved automatically. Also, … … 2199 2210 */ 2200 2211 save_ssop_flags = ssop_flags; 2201 2212 ssop_flags = (SSOP_BLANK|SSOP_CURDIR|SSOP_FOLDS|SSOP_GLOBALS 2202 |SSOP_HELP|SSOP_OPTIONS|SSOP_WINSIZE );2213 |SSOP_HELP|SSOP_OPTIONS|SSOP_WINSIZE|SSOP_TABPAGES); 2203 2214 2204 2215 do_cmdline_cmd((char_u *)"let Save_VV_this_session = v:this_session"); 2205 2216 failed = (do_cmdline_cmd((char_u *)mksession_cmdline) == FAIL); … … 3212 3223 { 3213 3224 if (clicked_page == 0) 3214 3225 { 3215 /* Click after all tabs moves to next tab page. */ 3216 if (send_tabline_event(0) && gtk_main_level() > 0) 3226 /* Click after all tabs moves to next tab page. When "x" is 3227 * small guess it's the left button. */ 3228 if (send_tabline_event(x < 50 ? -1 : 0) && gtk_main_level() > 0) 3217 3229 gtk_main_quit(); 3218 3230 } 3219 3231 #ifndef HAVE_GTK2 -
src/if_cscope.c
diff -Naur vim71.orig/src/if_cscope.c vim71/src/if_cscope.c
old new 24 24 /* not UNIX, must be WIN32 */ 25 25 # include "vimio.h" 26 26 # include <fcntl.h> 27 # include <process.h>28 # define STDIN_FILENO 029 # define STDOUT_FILENO 130 # define STDERR_FILENO 231 # define pipe(fds) _pipe(fds, 256, O_TEXT|O_NOINHERIT)32 27 #endif 33 28 #include "if_cscope.h" 34 29 … … 65 60 static char * cs_parse_results __ARGS((int cnumber, char *buf, int bufsize, char **context, char **linenumber, char **search)); 66 61 static char * cs_pathcomponents __ARGS((char *path)); 67 62 static void cs_print_tags_priv __ARGS((char **, char **, int)); 68 static int cs_read_prompt __ARGS((int 63 static int cs_read_prompt __ARGS((int)); 69 64 static void cs_release_csp __ARGS((int, int freefnpp)); 70 65 static int cs_reset __ARGS((exarg_T *eap)); 71 66 static char * cs_resolve_file __ARGS((int, char *)); … … 73 68 74 69 75 70 static csinfo_T csinfo[CSCOPE_MAX_CONNECTIONS]; 71 static int eap_arg_len; /* length of eap->arg, set in 72 cs_lookup_cmd() */ 76 73 static cscmd_T cs_cmds[] = 77 74 { 78 75 { "add", cs_add, … … 260 257 261 258 if ((p = cs_manage_matches(NULL, NULL, -1, Get)) == NULL) 262 259 return TRUE; 263 264 if ((int)strlen(p) > size) 265 { 266 strncpy((char *)buf, p, size - 1); 267 buf[size] = '\0'; 268 } 269 else 270 (void)strcpy((char *)buf, p); 260 vim_strncpy(buf, (char_u *)p, size - 1); 271 261 272 262 return FALSE; 273 263 } /* cs_fgets */ … … 386 376 * PRIVATE: cs_add 387 377 * 388 378 * add cscope database or a directory name (to look for cscope.out) 389 * t hethe cscope connection list379 * to the cscope connection list 390 380 * 391 381 * MAXPATHL 256 392 382 */ … … 509 499 #if defined(UNIX) 510 500 else if (S_ISREG(statbuf.st_mode) || S_ISLNK(statbuf.st_mode)) 511 501 #else 512 /* substitute define S_ISREG from os_unix.h */502 /* WIN32 - substitute define S_ISREG from os_unix.h */ 513 503 else if (((statbuf.st_mode) & S_IFMT) == S_IFREG) 514 504 #endif 515 505 { … … 722 712 cs_create_connection(i) 723 713 int i; 724 714 { 725 int to_cs[2], from_cs[2], len; 726 char *prog, *cmd, *ppath = NULL; 727 #ifndef UNIX 728 int in_save, out_save, err_save; 729 long_i ph; 730 # ifdef FEAT_GUI 731 HWND activewnd = NULL; 732 HWND consolewnd = NULL; 715 #ifdef UNIX 716 int to_cs[2], from_cs[2]; 717 #endif 718 int len; 719 char *prog, *cmd, *ppath = NULL; 720 #ifdef WIN32 721 int fd; 722 SECURITY_ATTRIBUTES sa; 723 PROCESS_INFORMATION pi; 724 STARTUPINFO si; 725 BOOL pipe_stdin = FALSE, pipe_stdout = FALSE; 726 HANDLE stdin_rd, stdout_rd; 727 HANDLE stdout_wr, stdin_wr; 728 BOOL created; 729 # ifdef __BORLANDC__ 730 # define OPEN_OH_ARGTYPE long 731 # else 732 # if (_MSC_VER >= 1300) 733 # define OPEN_OH_ARGTYPE intptr_t 734 # else 735 # define OPEN_OH_ARGTYPE long 736 # endif 733 737 # endif 734 738 #endif 735 739 740 #if defined(UNIX) 736 741 /* 737 742 * Cscope reads from to_cs[0] and writes to from_cs[1]; vi reads from 738 743 * from_cs[0] and writes to to_cs[1]. … … 753 758 return CSCOPE_FAILURE; 754 759 } 755 760 756 #if defined(UNIX)757 761 switch (csinfo[i].pid = fork()) 758 762 { 759 763 case -1: 760 764 (void)EMSG(_("E622: Could not fork for cscope")); 761 765 goto err_closing; 762 766 case 0: /* child: run cscope. */ 763 #else764 in_save = dup(STDIN_FILENO);765 out_save = dup(STDOUT_FILENO);766 err_save = dup(STDERR_FILENO);767 #endif768 767 if (dup2(to_cs[0], STDIN_FILENO) == -1) 769 768 PERROR("cs_create_connection 1"); 770 769 if (dup2(from_cs[1], STDOUT_FILENO) == -1) … … 773 772 PERROR("cs_create_connection 3"); 774 773 775 774 /* close unused */ 776 #if defined(UNIX)777 775 (void)close(to_cs[1]); 778 776 (void)close(from_cs[0]); 779 777 #else 780 /* On win32 we must close opposite ends because we are the parent */ 781 (void)close(to_cs[0]); 782 to_cs[0] = -1; 783 (void)close(from_cs[1]); 784 from_cs[1] = -1; 778 /* WIN32 */ 779 /* Create pipes to communicate with cscope */ 780 sa.nLength = sizeof(SECURITY_ATTRIBUTES); 781 sa.bInheritHandle = TRUE; 782 sa.lpSecurityDescriptor = NULL; 783 784 if (!(pipe_stdin = CreatePipe(&stdin_rd, &stdin_wr, &sa, 0)) 785 || !(pipe_stdout = CreatePipe(&stdout_rd, &stdout_wr, &sa, 0))) 786 { 787 (void)EMSG(_("E566: Could not create cscope pipes")); 788 err_closing: 789 if (pipe_stdin) 790 { 791 CloseHandle(stdin_rd); 792 CloseHandle(stdin_wr); 793 } 794 if (pipe_stdout) 795 { 796 CloseHandle(stdout_rd); 797 CloseHandle(stdout_wr); 798 } 799 return CSCOPE_FAILURE; 800 } 785 801 #endif 786 802 /* expand the cscope exec for env var's */ 787 803 if ((prog = (char *)alloc(MAXPATHL + 1)) == NULL) … … 789 805 #ifdef UNIX 790 806 return CSCOPE_FAILURE; 791 807 #else 808 /* WIN32 */ 792 809 goto err_closing; 793 810 #endif 794 811 } … … 805 822 #ifdef UNIX 806 823 return CSCOPE_FAILURE; 807 824 #else 825 /* WIN32 */ 808 826 goto err_closing; 809 827 #endif 810 828 } … … 823 841 #ifdef UNIX 824 842 return CSCOPE_FAILURE; 825 843 #else 844 /* WIN32 */ 826 845 goto err_closing; 827 846 #endif 828 847 } … … 831 850 #if defined(UNIX) 832 851 (void)sprintf(cmd, "exec %s -dl -f %s", prog, csinfo[i].fname); 833 852 #else 853 /* WIN32 */ 834 854 (void)sprintf(cmd, "%s -dl -f %s", prog, csinfo[i].fname); 835 855 #endif 836 856 if (csinfo[i].ppath != NULL) … … 856 876 exit(127); 857 877 /* NOTREACHED */ 858 878 default: /* parent. */ 859 #else860 # ifdef FEAT_GUI861 activewnd = GetForegroundWindow(); /* on win9x cscope steals focus */862 /* Dirty hack to hide annoying console window */863 if (AllocConsole())864 {865 char *title;866 title = (char *)alloc(1024);867 if (title == NULL)868 FreeConsole();869 else870 {871 GetConsoleTitle(title, 1024); /* save for future restore */872 SetConsoleTitle(873 "GVIMCS{5499421B-CBEF-45b0-85EF-38167FDEA5C5}GVIMCS");874 Sleep(40); /* as stated in MS KB we must wait 40 ms */875 consolewnd = FindWindow(NULL,876 "GVIMCS{5499421B-CBEF-45b0-85EF-38167FDEA5C5}GVIMCS");877 if (consolewnd != NULL)878 ShowWindow(consolewnd, SW_HIDE);879 SetConsoleTitle(title);880 vim_free(title);881 }882 }883 # endif884 /* May be use &shell, &shellquote etc */885 # ifdef __BORLANDC__886 /* BCC 5.5 uses a different function name for spawnlp */887 ph = (long_i)spawnlp(P_NOWAIT, prog, cmd, NULL);888 # else889 ph = (long_i)_spawnlp(_P_NOWAIT, prog, cmd, NULL);890 # endif891 vim_free(prog);892 vim_free(cmd);893 # ifdef FEAT_GUI894 /* Dirty hack part two */895 if (activewnd != NULL)896 /* restoring focus */897 SetForegroundWindow(activewnd);898 if (consolewnd != NULL)899 FreeConsole();900 901 # endif902 if (ph == -1)903 {904 PERROR(_("cs_create_connection exec failed"));905 (void)EMSG(_("E623: Could not spawn cscope process"));906 goto err_closing;907 }908 /* else */909 csinfo[i].pid = 0;910 csinfo[i].hProc = (HANDLE)ph;911 912 #endif /* !UNIX */913 879 /* 914 880 * Save the file descriptors for later duplication, and 915 881 * reopen as streams. … … 919 885 if ((csinfo[i].fr_fp = fdopen(from_cs[0], "r")) == NULL) 920 886 PERROR(_("cs_create_connection: fdopen for fr_fp failed")); 921 887 922 #if defined(UNIX)923 888 /* close unused */ 924 889 (void)close(to_cs[0]); 925 890 (void)close(from_cs[1]); 926 891 927 892 break; 928 893 } 894 929 895 #else 930 /* restore stdhandles */ 931 dup2(in_save, STDIN_FILENO); 932 dup2(out_save, STDOUT_FILENO); 933 dup2(err_save, STDERR_FILENO); 934 close(in_save); 935 close(out_save); 936 close(err_save); 937 #endif 896 /* WIN32 */ 897 /* Create a new process to run cscope and use pipes to talk with it */ 898 GetStartupInfo(&si); 899 si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; 900 si.wShowWindow = SW_HIDE; /* Hide child application window */ 901 si.hStdOutput = stdout_wr; 902 si.hStdError = stdout_wr; 903 si.hStdInput = stdin_rd; 904 created = CreateProcess(NULL, cmd, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, 905 NULL, NULL, &si, &pi); 906 vim_free(prog); 907 vim_free(cmd); 908 909 if (!created) 910 { 911 PERROR(_("cs_create_connection exec failed")); 912 (void)EMSG(_("E623: Could not spawn cscope process")); 913 goto err_closing; 914 } 915 /* else */ 916 csinfo[i].pid = pi.dwProcessId; 917 csinfo[i].hProc = pi.hProcess; 918 CloseHandle(pi.hThread); 919 920 /* TODO - tidy up after failure to create files on pipe handles. */ 921 if (((fd = _open_osfhandle((OPEN_OH_ARGTYPE)stdin_wr, 922 _O_TEXT|_O_APPEND)) < 0) 923 || ((csinfo[i].to_fp = _fdopen(fd, "w")) == NULL)) 924 PERROR(_("cs_create_connection: fdopen for to_fp failed")); 925 if (((fd = _open_osfhandle((OPEN_OH_ARGTYPE)stdout_rd, 926 _O_TEXT|_O_RDONLY)) < 0) 927 || ((csinfo[i].fr_fp = _fdopen(fd, "r")) == NULL)) 928 PERROR(_("cs_create_connection: fdopen for fr_fp failed")); 929 930 /* Close handles for file descriptors inherited by the cscope process */ 931 CloseHandle(stdin_rd); 932 CloseHandle(stdout_wr); 933 934 #endif /* !UNIX */ 935 938 936 return CSCOPE_SUCCESS; 939 937 } /* cs_create_connection */ 940 938 … … 966 964 } 967 965 968 966 pat = opt + strlen(opt) + 1; 969 if (pat == NULL || (pat != NULL && pat[0] == '\0'))967 if (pat >= (char *)eap->arg + eap_arg_len) 970 968 { 971 969 cs_usage_msg(Find); 972 970 return FALSE; … … 1317 1315 #else 1318 1316 /* compare pathnames first */ 1319 1317 && ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME) 1320 /* if not Windows 9x, test index file at ributes too */1318 /* if not Windows 9x, test index file attributes too */ 1321 1319 || (!mch_windows95() 1322 1320 && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber 1323 1321 && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh … … 1401 1399 if (eap->arg == NULL) 1402 1400 return NULL; 1403 1401 1402 /* Store length of eap->arg before it gets modified by strtok(). */ 1403 eap_arg_len = STRLEN(eap->arg); 1404 1404 1405 if ((stok = strtok((char *)(eap->arg), (const char *)" ")) == NULL) 1405 1406 return NULL; 1406 1407 … … 2099 2100 /* 2100 2101 * PRIVATE: cs_release_csp 2101 2102 * 2102 * does the actual free'ing for the cs ptr with an optional flag of whether2103 * or not to free the filename. called by cs_kill and cs_reset.2103 * Does the actual free'ing for the cs ptr with an optional flag of whether 2104 * or not to free the filename. Called by cs_kill and cs_reset. 2104 2105 */ 2105 2106 static void 2106 2107 cs_release_csp(i, freefnpp) … … 2118 2119 (void)fputs("q\n", csinfo[i].to_fp); 2119 2120 (void)fflush(csinfo[i].to_fp); 2120 2121 } 2121 /* give cscope chance to exit normally */ 2122 if (csinfo[i].hProc != NULL 2123 && WaitForSingleObject(csinfo[i].hProc, 1000) == WAIT_TIMEOUT) 2124 TerminateProcess(csinfo[i].hProc, 0); 2122 if (csinfo[i].hProc != NULL) 2123 { 2124 /* Give cscope a chance to exit normally */ 2125 if (WaitForSingleObject(csinfo[i].hProc, 1000) == WAIT_TIMEOUT) 2126 TerminateProcess(csinfo[i].hProc, 0); 2127 CloseHandle(csinfo[i].hProc); 2128 } 2125 2129 #endif 2126 2130 2127 2131 if (csinfo[i].fr_fp != NULL) … … 2195 2199 cs_add_common(dblist[i], pplist[i], fllist[i]); 2196 2200 if (p_csverbose) 2197 2201 { 2198 /* don t' use smsg_attr because want to display2202 /* don't use smsg_attr() because we want to display the 2199 2203 * connection number in the same line as 2200 2204 * "Added cscope database..." 2201 2205 */ … … 2304 2308 return CSCOPE_SUCCESS; 2305 2309 } /* cs_show */ 2306 2310 2311 2312 /* 2313 * PUBLIC: cs_end 2314 * 2315 * Only called when VIM exits to quit any cscope sessions. 2316 */ 2317 void 2318 cs_end() 2319 { 2320 int i; 2321 2322 for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) 2323 cs_release_csp(i, TRUE); 2324 } 2325 2307 2326 #endif /* FEAT_CSCOPE */ 2308 2327 2309 2328 /* the end */ -
src/if_cscope.h
diff -Naur vim71.orig/src/if_cscope.h vim71/src/if_cscope.h
old new 72 72 ino_t st_ino; /* inode number of cscope db */ 73 73 #else 74 74 # if defined(WIN32) 75 int pid; /* Can't get pid so set it to 0 ;)*/75 DWORD pid; /* PID of the connected cscope process. */ 76 76 HANDLE hProc; /* cscope process handle */ 77 77 DWORD nVolume; /* Volume serial number, instead of st_dev */ 78 78 DWORD nIndexHigh; /* st_ino has no meaning in the Windows */ -
src/if_mzsch.c
diff -Naur vim71.orig/src/if_mzsch.c vim71/src/if_mzsch.c
old new 308 308 static Scheme_Config *(*dll_scheme_current_config)(void); 309 309 static Scheme_Object *(*dll_scheme_char_string_to_byte_string) 310 310 (Scheme_Object *s); 311 static Scheme_Object *(*dll_scheme_char_string_to_path) 312 (Scheme_Object *s); 311 313 # endif 312 314 313 315 /* arrays are imported directly */ … … 398 400 # define scheme_current_config dll_scheme_current_config 399 401 # define scheme_char_string_to_byte_string \ 400 402 dll_scheme_char_string_to_byte_string 403 # define scheme_char_string_to_path \ 404 dll_scheme_char_string_to_path 401 405 # endif 402 406 403 407 typedef struct … … 498 502 {"scheme_current_config", (void **)&dll_scheme_current_config}, 499 503 {"scheme_char_string_to_byte_string", 500 504 (void **)&dll_scheme_char_string_to_byte_string}, 505 {"scheme_char_string_to_path", 506 (void **)&dll_scheme_char_string_to_path}, 501 507 # endif 502 508 {NULL, NULL}}; 503 509 … … 773 779 #ifdef MZSCHEME_COLLECTS 774 780 /* setup 'current-library-collection-paths' parameter */ 775 781 scheme_set_param(scheme_config, MZCONFIG_COLLECTION_PATHS, 776 scheme_make_pair(scheme_make_string(MZSCHEME_COLLECTS), 782 scheme_make_pair( 783 # if MZSCHEME_VERSION_MAJOR >= 299 784 scheme_char_string_to_path( 785 scheme_byte_string_to_char_string( 786 scheme_make_byte_string(MZSCHEME_COLLECTS))), 787 # else 788 scheme_make_string(MZSCHEME_COLLECTS), 789 # endif 777 790 scheme_null)); 778 791 #endif 779 792 #ifdef HAVE_SANDBOX -
src/if_perl.xs
diff -Naur vim71.orig/src/if_perl.xs vim71/src/if_perl.xs
old new 40 40 # define PERL_SUBVERSION SUBVERSION 41 41 #endif 42 42 43 /* 44 * Quoting Jan Dubois of Active State: 45 * ActivePerl build 822 still identifies itself as 5.8.8 but already 46 * contains many of the changes from the upcoming Perl 5.8.9 release. 47 * 48 * The changes include addition of two symbols (Perl_sv_2iv_flags, 49 * Perl_newXS_flags) not present in earlier releases. 50 * 51 * Jan Dubois suggested the following guarding scheme. 52 * 53 * Active State defined ACTIVEPERL_VERSION as a string in versions before 54 * 5.8.8; and so the comparison to 822 below needs to be guarded. 55 */ 56 #if (PERL_REVISION == 5) && (PERL_VERSION == 8) && (PERL_SUBVERSION >= 8) 57 # if (ACTIVEPERL_VERSION >= 822) || (PERL_SUBVERSION >= 9) 58 # define PERL589_OR_LATER 59 # endif 60 #endif 61 #if (PERL_REVISION == 5) && (PERL_VERSION >= 9) 62 # define PERL589_OR_LATER 63 #endif 64 43 65 #ifndef pTHX 44 66 # define pTHX void 45 67 # define pTHX_ … … 109 131 # else 110 132 # define Perl_sv_catpvn dll_Perl_sv_catpvn 111 133 # endif 134 #ifdef PERL589_OR_LATER 135 # define Perl_sv_2iv_flags dll_Perl_sv_2iv_flags 136 # define Perl_newXS_flags dll_Perl_newXS_flags 137 #endif 112 138 # define Perl_sv_free dll_Perl_sv_free 113 139 # define Perl_sv_isa dll_Perl_sv_isa 114 140 # define Perl_sv_magic dll_Perl_sv_magic … … 192 218 #else 193 219 static void (*Perl_sv_catpvn)(pTHX_ SV*, const char*, STRLEN); 194 220 #endif 221 #ifdef PERL589_OR_LATER 222 static IV (*Perl_sv_2iv_flags)(pTHX_ SV* sv, I32 flags); 223 static CV * (*Perl_newXS_flags)(pTHX_ const char *name, XSUBADDR_t subaddr, const char *const filename, const char *const proto, U32 flags); 224 #endif 195 225 static void (*Perl_sv_free)(pTHX_ SV*); 196 226 static int (*Perl_sv_isa)(pTHX_ SV*, const char*); 197 227 static void (*Perl_sv_magic)(pTHX_ SV*, SV*, int, const char*, I32); … … 267 297 #else 268 298 {"Perl_sv_2pv", (PERL_PROC*)&Perl_sv_2pv}, 269 299 #endif 300 #ifdef PERL589_OR_LATER 301 {"Perl_sv_2iv_flags", (PERL_PROC*)&Perl_sv_2iv_flags}, 302 {"Perl_newXS_flags", (PERL_PROC*)&Perl_newXS_flags}, 303 #endif 270 304 {"Perl_sv_bless", (PERL_PROC*)&Perl_sv_bless}, 271 305 #if (PERL_REVISION == 5) && (PERL_VERSION >= 8) 272 306 {"Perl_sv_catpvn_flags", (PERL_PROC*)&Perl_sv_catpvn_flags}, … … 411 445 char *next; 412 446 char *token = (char *)s; 413 447 414 while ((next = strchr(token, '\n')) )448 while ((next = strchr(token, '\n')) && !got_int) 415 449 { 416 450 *next++ = '\0'; /* replace \n with \0 */ 417 451 msg_attr((char_u *)token, attr); 418 452 token = next; 419 453 } 420 if (*token )454 if (*token && !got_int) 421 455 msg_attr((char_u *)token, attr); 422 456 } 423 457 -
src/if_ruby.c
diff -Naur vim71.orig/src/if_ruby.c vim71/src/if_ruby.c
old new 789 789 return get_buffer_line(curbuf, curwin->w_cursor.lnum); 790 790 } 791 791 792 static VALUE set_current_line(VALUE s tr)792 static VALUE set_current_line(VALUE self, VALUE str) 793 793 { 794 794 return set_buffer_line(curbuf, curwin->w_cursor.lnum, str); 795 795 } -
src/keymap.h
diff -Naur vim71.orig/src/keymap.h vim71/src/keymap.h
old new 254 254 , KE_DROP /* DnD data is available */ 255 255 , KE_CURSORHOLD /* CursorHold event */ 256 256 , KE_NOP /* doesn't do something */ 257 , KE_FOCUSGAINED /* focus gained */ 258 , KE_FOCUSLOST /* focus lost */ 257 259 }; 258 260 259 261 /* … … 445 447 #define K_CMDWIN TERMCAP2KEY(KS_EXTRA, KE_CMDWIN) 446 448 447 449 #define K_DROP TERMCAP2KEY(KS_EXTRA, KE_DROP) 450 #define K_FOCUSGAINED TERMCAP2KEY(KS_EXTRA, KE_FOCUSGAINED) 451 #define K_FOCUSLOST TERMCAP2KEY(KS_EXTRA, KE_FOCUSLOST) 448 452 449 453 #define K_CURSORHOLD TERMCAP2KEY(KS_EXTRA, KE_CURSORHOLD) 450 454 -
src/macros.h
diff -Naur vim71.orig/src/macros.h vim71/src/macros.h
old new 54 54 55 55 /* 56 56 * toupper() and tolower() that use the current locale. 57 * On some systems toupper()/tolower() only work on lower/uppercase characters 57 * On some systems toupper()/tolower() only work on lower/uppercase 58 * characters, first use islower() or isupper() then. 58 59 * Careful: Only call TOUPPER_LOC() and TOLOWER_LOC() with a character in the 59 60 * range 0 - 255. toupper()/tolower() on some systems can't handle others. 60 * Note: for UTF-8 use utf_toupper() and utf_tolower(). 61 * Note: It is often better to use MB_TOLOWER() and MB_TOUPPER(), because many 62 * toupper() and tolower() implementations only work for ASCII. 61 63 */ 62 64 #ifdef MSWIN 63 65 # define TOUPPER_LOC(c) toupper_tab[(c) & 255] -
src/main.aap
diff -Naur vim71.orig/src/main.aap vim71/src/main.aap
old new 56 56 config {virtual} auto/config.h auto/config.aap : 57 57 auto/configure.aap configure.aap 58 58 config.arg config.h.in config.aap.in 59 # Use "uname -a" to detect the architecture of the system. 60 @ok, uname = redir_system('uname -a', 0) 61 @if string.find(uname, "i386") >= 0: 62 @ arch = "i386" 63 @else: 64 @ arch = "ppc" 65 :print Building for $arch system 59 66 :sys CONFIG_STATUS=auto/config.status 60 67 ./configure.aap `file2string("config.arg")` 61 --with-mac-arch= ppc68 --with-mac-arch=$arch 62 69 --cache-file=auto/config.cache 63 70 64 71 # Configure arguments: create an empty "config.arg" file when its missing … … 1167 1174 :symlink `os.getcwd()`/../runtime $RESDIR/vim/runtime 1168 1175 # TODO: Create the vimtutor application. 1169 1176 1170 gui_bundle {virtual}: $(RESDIR) bundle-dir bundle-executable bundle-info 1177 gui_bundle {virtual}: $(RESDIR) bundle-dir bundle-executable bundle-info \ 1171 1178 bundle-resource bundle-language 1172 1179 1173 1180 bundle-dir {virtual}: $(APPDIR)/Contents $(VIMTARGET) … … 1187 1194 :sys m4 $(M4FLAGSX) infplist.xml > $(APPDIR)/Contents/Info.plist 1188 1195 1189 1196 bundle-resource {virtual}: bundle-dir bundle-rsrc 1190 :copy {force} $(RSRC_DIR)/*.icns $(RESDIR)1197 :copy {force} $(RSRC_DIR)/*.icns $(RESDIR) 1191 1198 1192 1199 ### Classic resources 1193 1200 # Resource fork (in the form of a .rsrc file) for Classic Vim (Mac OS 9) -
src/main.c
diff -Naur vim71.orig/src/main.c vim71/src/main.c
old new 954 954 int cmdwin; /* TRUE when working in the command-line window */ 955 955 int noexmode; /* TRUE when return on entering Ex mode */ 956 956 { 957 oparg_T oa; /* operator arguments */ 957 oparg_T oa; /* operator arguments */ 958 int previous_got_int = FALSE; /* "got_int" was TRUE */ 958 959 959 960 #if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) 960 961 /* Setup to catch a terminating error from the X server. Just ignore … … 1015 1016 need_fileinfo = FALSE; 1016 1017 } 1017 1018 } 1018 if (got_int && !global_busy) 1019 1020 /* Reset "got_int" now that we got back to the main loop. Except when 1021 * inside a ":g/pat/cmd" command, then the "got_int" needs to abort 1022 * the ":g" command. 1023 * For ":g/pat/vi" we reset "got_int" when used once. When used 1024 * a second time we go back to Ex mode and abort the ":g" command. */ 1025 if (got_int) 1019 1026 { 1020 if (!quit_more) 1021 (void)vgetc(); /* flush all buffers */ 1022 got_int = FALSE; 1027 if (noexmode && global_busy && !exmode_active && previous_got_int) 1028 { 1029 /* Typed two CTRL-C in a row: go back to ex mode as if "Q" was 1030 * used and keep "got_int" set, so that it aborts ":g". */ 1031 exmode_active = EXMODE_NORMAL; 1032 State = NORMAL; 1033 } 1034 else if (!global_busy || !exmode_active) 1035 { 1036 if (!quit_more) 1037 (void)vgetc(); /* flush all buffers */ 1038 got_int = FALSE; 1039 } 1040 previous_got_int = TRUE; 1023 1041 } 1042 else 1043 previous_got_int = FALSE; 1044 1024 1045 if (!exmode_active) 1025 1046 msg_scroll = FALSE; 1026 1047 quit_more = FALSE; … … 1309 1330 #ifdef FEAT_NETBEANS_INTG 1310 1331 netbeans_end(); 1311 1332 #endif 1333 #ifdef FEAT_CSCOPE 1334 cs_end(); 1335 #endif 1336 #ifdef FEAT_EVAL 1337 if (garbage_collect_at_exit) 1338 garbage_collect(); 1339 #endif 1312 1340 1313 1341 mch_exit(exitval); 1314 1342 } … … 1360 1388 p = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); 1361 1389 if (p != NULL && *p != NUL) 1362 1390 { 1363 STRCPY(NameBuff, p); 1364 STRCAT(NameBuff, "/lang"); 1391 vim_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p); 1365 1392 bindtextdomain(VIMPACKAGE, (char *)NameBuff); 1366 1393 } 1367 1394 if (mustfree) … … 3632 3659 mainerr_arg_missing((char_u *)filev[-1]); 3633 3660 if (mch_dirname(cwd, MAXPATHL) != OK) 3634 3661 return NULL; 3635 if ((p = vim_strsave_escaped_ext(cwd, PATH_ESC_CHARS, '\\', TRUE)) == NULL) 3662 if ((p = vim_strsave_escaped_ext(cwd, 3663 #ifdef BACKSLASH_IN_FILENAME 3664 "", /* rem_backslash() will tell what chars to escape */ 3665 #else 3666 PATH_ESC_CHARS, 3667 #endif 3668 '\\', TRUE)) == NULL) 3636 3669 return NULL; 3637 3670 ga_init2(&ga, 1, 100); 3638 3671 ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd "); -
src/mbyte.c
diff -Naur vim71.orig/src/mbyte.c vim71/src/mbyte.c
old new 1310 1310 /* 1311 1311 * mb_off2cells() function pointer. 1312 1312 * Return number of display cells for char at ScreenLines[off]. 1313 * Caller must make sure "off" and "off + 1" are valid!1313 * We make sure that the offset used is less than "max_off". 1314 1314 */ 1315 1315 /*ARGSUSED*/ 1316 1316 int 1317 latin_off2cells(off )1317 latin_off2cells(off, max_off) 1318 1318 unsigned off; 1319 unsigned max_off; 1319 1320 { 1320 1321 return 1; 1321 1322 } 1322 1323 1323 1324 int 1324 dbcs_off2cells(off )1325 dbcs_off2cells(off, max_off) 1325 1326 unsigned off; 1327 unsigned max_off; 1326 1328 { 1329 /* never check beyond end of the line */ 1330 if (off >= max_off) 1331 return 1; 1332 1327 1333 /* Number of cells is equal to number of bytes, except for euc-jp when 1328 1334 * the first byte is 0x8e. */ 1329 1335 if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e) … … 1332 1338 } 1333 1339 1334 1340 int 1335 utf_off2cells(off )1341 utf_off2cells(off, max_off) 1336 1342 unsigned off; 1343 unsigned max_off; 1337 1344 { 1338 return ScreenLines[off + 1] == 0? 2 : 1;1345 return (off + 1 < max_off && ScreenLines[off + 1] == 0) ? 2 : 1; 1339 1346 } 1340 1347 1341 1348 /* … … 2320 2327 /* Single byte: first check normally, then with ignore case. */ 2321 2328 if (s1[i] != s2[i]) 2322 2329 { 2323 cdiff = TOLOWER_LOC(s1[i]) - TOLOWER_LOC(s2[i]);2330 cdiff = MB_TOLOWER(s1[i]) - MB_TOLOWER(s2[i]); 2324 2331 if (cdiff != 0) 2325 2332 return cdiff; 2326 2333 } … … 2899 2906 if (composing_hangul) 2900 2907 return TRUE; 2901 2908 #endif 2902 if (enc_dbcs != 0) 2903 return dbcs_off2cells(LineOffset[row] + col) > 1; 2904 if (enc_utf8) 2905 return (col + 1 < Columns 2906 && ScreenLines[LineOffset[row] + col + 1] == 0); 2907 return FALSE; 2909 return (*mb_off2cells)(LineOffset[row] + col, 2910 LineOffset[row] + screen_Columns) > 1; 2908 2911 } 2909 2912 2910 2913 # if defined(FEAT_CLIPBOARD) || defined(FEAT_GUI) || defined(FEAT_RIGHTLEFT) \ -
src/message.c
diff -Naur vim71.orig/src/message.c vim71/src/message.c
old new 828 828 _("Messages maintainer: Bram Moolenaar <Bram@vim.org>"), 829 829 hl_attr(HLF_T)); 830 830 831 for (p = first_msg_hist; p != NULL ; p = p->next)831 for (p = first_msg_hist; p != NULL && !got_int; p = p->next) 832 832 if (p->msg != NULL) 833 833 msg_attr(p->msg, p->attr); 834 834 … … 944 944 c = K_IGNORE; 945 945 } 946 946 #endif 947 947 948 /* 948 949 * Allow scrolling back in the messages. 949 950 * Also accept scroll-down commands when messages fill the screen, … … 1840 1841 char_u *sb_str = str; 1841 1842 int sb_col = msg_col; 1842 1843 int wrap; 1844 int did_last_char; 1843 1845 1844 1846 did_wait_return = FALSE; 1845 while ( *s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))1847 while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL) 1846 1848 { 1847 1849 /* 1848 1850 * We are at the end of the screen line when: … … 1878 1880 /* output postponed text */ 1879 1881 t_puts(&t_col, t_s, s, attr); 1880 1882 1881 /* When no more prompt an no more room, truncate here */1883 /* When no more prompt and no more room, truncate here */ 1882 1884 if (msg_no_more && lines_left == 0) 1883 1885 break; 1884 1886 … … 1909 1911 else 1910 1912 #endif 1911 1913 msg_screen_putchar(*s++, attr); 1914 did_last_char = TRUE; 1912 1915 } 1916 else 1917 did_last_char = FALSE; 1913 1918 1914 1919 if (p_more) 1915 1920 /* store text for scrolling back */ … … 1927 1932 * If screen is completely filled and 'more' is set then wait 1928 1933 * for a character. 1929 1934 */ 1930 --lines_left; 1935 if (lines_left > 0) 1936 --lines_left; 1931 1937 if (p_more && lines_left == 0 && State != HITRETURN 1932 1938 && !msg_no_more && !exmode_active) 1933 1939 { … … 1943 1949 1944 1950 /* When we displayed a char in last column need to check if there 1945 1951 * is still more. */ 1946 if (*s >= ' ' 1947 #ifdef FEAT_RIGHTLEFT 1948 && !cmdmsg_rl 1949 #endif 1950 ) 1952 if (did_last_char) 1951 1953 continue; 1952 1954 } 1953 1955 … … 2234 2236 { 2235 2237 msgchunk_T *mp; 2236 2238 2237 /* Only show somethi gnif there is more than one line, otherwise it looks2239 /* Only show something if there is more than one line, otherwise it looks 2238 2240 * weird, typing a command without output results in one line. */ 2239 2241 mp = msg_sb_start(last_msgchunk); 2240 2242 if (mp == NULL || mp->sb_prev == NULL) … … 2622 2624 } 2623 2625 } 2624 2626 2625 if (scroll < 0 || (scroll == 0 && mp_last != NULL))2627 if (scroll <= 0) 2626 2628 { 2627 2629 /* displayed the requested text, more prompt again */ 2628 2630 screen_fill((int)Rows - 1, (int)Rows, 0, … … 3456 3458 /* advance to next hotkey and set default hotkey */ 3457 3459 #ifdef FEAT_MBYTE 3458 3460 if (has_mbyte) 3459 hotkp += (*mb_ptr2len)(hotkp);3461 hotkp += STRLEN(hotkp); 3460 3462 else 3461 3463 #endif 3462 3464 ++hotkp; 3463 (void)copy_char(r + 1, hotkp, TRUE);3465 hotkp[copy_char(r + 1, hotkp, TRUE)] = NUL; 3464 3466 if (dfltbutton) 3465 3467 --dfltbutton; 3466 3468 … … 3493 3495 *msgp++ = (dfltbutton == 1) ? ']' : ')'; 3494 3496 3495 3497 /* redefine hotkey */ 3496 (void)copy_char(r, hotkp, TRUE);3498 hotkp[copy_char(r, hotkp, TRUE)] = NUL; 3497 3499 } 3498 3500 } 3499 3501 else … … 3519 3521 *msgp++ = ':'; 3520 3522 *msgp++ = ' '; 3521 3523 *msgp = NUL; 3522 mb_ptr_adv(hotkp);3523 *hotkp = NUL;3524 3524 } 3525 3525 else 3526 3526 { … … 3555 3555 msgp = confirm_msg + 1 + STRLEN(message); 3556 3556 hotkp = hotk; 3557 3557 3558 /* define first default hotkey */ 3559 (void)copy_char(buttons, hotkp, TRUE); 3558 /* Define first default hotkey. Keep the hotkey string NUL 3559 * terminated to avoid reading past the end. */ 3560 hotkp[copy_char(buttons, hotkp, TRUE)] = NUL; 3560 3561 3561 3562 /* Remember where the choices start, displaying starts here when 3562 3563 * "hotkp" typed at the more prompt. */ -
src/misc1.c
diff -Naur vim71.orig/src/misc1.c vim71/src/misc1.c
old new 90 90 */ 91 91 int 92 92 set_indent(size, flags) 93 int size; 93 int size; /* measured in spaces */ 94 94 int flags; 95 95 { 96 96 char_u *p; … … 98 98 char_u *oldline; 99 99 char_u *s; 100 100 int todo; 101 int ind_len; 101 int ind_len; /* measured in characters */ 102 102 int line_len; 103 103 int doit = FALSE; 104 int ind_done ;104 int ind_done = 0; /* measured in spaces */ 105 105 int tab_pad; 106 106 int retval = FALSE; 107 int orig_char_len = -1; /* number of initial whitespace chars when 108 'et' and 'pi' are both set */ 107 109 108 110 /* 109 111 * First check if there is anything to do and compute the number of … … 116 118 /* Calculate the buffer size for the new indent, and check to see if it 117 119 * isn't already set */ 118 120 119 /* if 'expandtab' isn't set: use TABs */ 120 if (!curbuf->b_p_et) 121 /* if 'expandtab' isn't set: use TABs; if both 'expandtab' and 122 * 'preserveindent' are set count the number of characters at the 123 * beginning of the line to be copied */ 124 if (!curbuf->b_p_et || (!(flags & SIN_INSERT) && curbuf->b_p_pi)) 121 125 { 122 126 /* If 'preserveindent' is set then reuse as much as possible of 123 127 * the existing indent structure for the new indent */ … … 148 152 ++p; 149 153 } 150 154 155 /* Set initial number of whitespace chars to copy if we are 156 * preserving indent but expandtab is set */ 157 if (curbuf->b_p_et) 158 orig_char_len = ind_len; 159 151 160 /* Fill to next tabstop with a tab, if possible */ 152 161 tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts); 153 if (todo >= tab_pad )162 if (todo >= tab_pad && orig_char_len == -1) 154 163 { 155 164 doit = TRUE; 156 165 todo -= tab_pad; … … 193 202 else 194 203 p = skipwhite(p); 195 204 line_len = (int)STRLEN(p) + 1; 196 newline = alloc(ind_len + line_len); 197 if (newline == NULL) 198 return FALSE; 205 206 /* If 'preserveindent' and 'expandtab' are both set keep the original 207 * characters and allocate accordingly. We will fill the rest with spaces 208 * after the if (!curbuf->b_p_et) below. */ 209 if (orig_char_len != -1) 210 { 211 newline = alloc(orig_char_len + size - ind_done + line_len); 212 if (newline == NULL) 213 return FALSE; 214 todo = size - ind_done; 215 ind_len = orig_char_len + todo; /* Set total length of indent in 216 * characters, which may have been 217 * undercounted until now */ 218 p = oldline; 219 s = newline; 220 while (orig_char_len > 0) 221 { 222 *s++ = *p++; 223 orig_char_len--; 224 } 225 /* Skip over any additional white space (useful when newindent is less 226 * than old) */ 227 while (vim_iswhite(*p)) 228 (void)*p++; 229 230 } 231 else 232 { 233 todo = size; 234 newline = alloc(ind_len + line_len); 235 if (newline == NULL) 236 return FALSE; 237 s = newline; 238 } 199 239 200 240 /* Put the characters in the new line. */ 201 s = newline;202 todo = size;203 241 /* if 'expandtab' isn't set: use TABs */ 204 242 if (!curbuf->b_p_et) 205 243 { … … 1320 1358 newindent += (int)curbuf->b_p_sw; 1321 1359 } 1322 1360 #endif 1323 /* Copy the indent only if expand tab is disabled*/1324 if (curbuf->b_p_ci && !curbuf->b_p_et)1361 /* Copy the indent */ 1362 if (curbuf->b_p_ci) 1325 1363 { 1326 1364 (void)copy_indent(newindent, saved_line); 1327 1365 … … 3468 3506 #endif 3469 3507 3470 3508 /* 3509 * Call expand_env() and store the result in an allocated string. 3510 * This is not very memory efficient, this expects the result to be freed 3511 * again soon. 3512 */ 3513 char_u * 3514 expand_env_save(src) 3515 char_u *src; 3516 { 3517 return expand_env_save_opt(src, FALSE); 3518 } 3519 3520 /* 3521 * Idem, but when "one" is TRUE handle the string as one file name, only 3522 * expand "~" at the start. 3523 */ 3524 char_u * 3525 expand_env_save_opt(src, one) 3526 char_u *src; 3527 int one; 3528 { 3529 char_u *p; 3530 3531 p = alloc(MAXPATHL); 3532 if (p != NULL) 3533 expand_env_esc(src, p, MAXPATHL, FALSE, one, NULL); 3534 return p; 3535 } 3536 3537 /* 3471 3538 * Expand environment variable with path name. 3472 3539 * "~/" is also expanded, using $HOME. For Unix "~user/" is expanded. 3473 * Skips over "\ ", "\~" and "\$" .3540 * Skips over "\ ", "\~" and "\$" (not for Win32 though). 3474 3541 * If anything fails no expansion is done and dst equals src. 3475 3542 */ 3476 3543 void … … 3479 3546 char_u *dst; /* where to put the result */ 3480 3547 int dstlen; /* maximum length of the result */ 3481 3548 { 3482 expand_env_esc(src, dst, dstlen, FALSE, NULL);3549 expand_env_esc(src, dst, dstlen, FALSE, FALSE, NULL); 3483 3550 } 3484 3551 3485 3552 void 3486 expand_env_esc(srcp, dst, dstlen, esc, startstr)3553 expand_env_esc(srcp, dst, dstlen, esc, one, startstr) 3487 3554 char_u *srcp; /* input string e.g. "$HOME/vim.hlp" */ 3488 3555 char_u *dst; /* where to put the result */ 3489 3556 int dstlen; /* maximum length of the result */ 3490 3557 int esc; /* escape spaces in expanded variables */ 3558 int one; /* "srcp" is one file name */ 3491 3559 char_u *startstr; /* start again after this (can be NULL) */ 3492 3560 { 3493 3561 char_u *src; … … 3728 3796 { 3729 3797 /* 3730 3798 * Recognize the start of a new name, for '~'. 3799 * Don't do this when "one" is TRUE, to avoid expanding "~" in 3800 * ":edit foo ~ foo". 3731 3801 */ 3732 3802 at_start = FALSE; 3733 3803 if (src[0] == '\\' && src[1] != NUL) … … 3735 3805 *dst++ = *src++; 3736 3806 --dstlen; 3737 3807 } 3738 else if ( src[0] == ' ' || src[0] == ',')3808 else if ((src[0] == ' ' || src[0] == ',') && !one) 3739 3809 at_start = TRUE; 3740 3810 *dst++ = *src++; 3741 3811 --dstlen; … … 4032 4102 } 4033 4103 4034 4104 /* 4035 * Call expand_env() and store the result in an allocated string.4036 * This is not very memory efficient, this expects the result to be freed4037 * again soon.4038 */4039 char_u *4040 expand_env_save(src)4041 char_u *src;4042 {4043 char_u *p;4044 4045 p = alloc(MAXPATHL);4046 if (p != NULL)4047 expand_env(src, p, MAXPATHL);4048 return p;4049 }4050 4051 /*4052 4105 * Our portable version of setenv. 4053 4106 */ 4054 4107 void … … 4786 4839 static int cin_iswhileofdo __ARGS((char_u *, linenr_T, int)); 4787 4840 static int cin_iswhileofdo_end __ARGS((int terminated, int ind_maxparen, int ind_maxcomment)); 4788 4841 static int cin_isbreak __ARGS((char_u *)); 4789 static int cin_is_cpp_baseclass __ARGS((c har_u *line, colnr_T *col));4842 static int cin_is_cpp_baseclass __ARGS((colnr_T *col)); 4790 4843 static int get_baseclass_amount __ARGS((int col, int ind_maxparen, int ind_maxcomment, int ind_cpp_baseclass)); 4791 4844 static int cin_ends_in __ARGS((char_u *, char_u *, char_u *)); 4792 4845 static int cin_skip2pos __ARGS((pos_T *trypos)); … … 5551 5604 * This is a lot of guessing. Watch out for "cond ? func() : foo". 5552 5605 */ 5553 5606 static int 5554 cin_is_cpp_baseclass(line, col) 5555 char_u *line; 5607 cin_is_cpp_baseclass(col) 5556 5608 colnr_T *col; /* return: column to align with */ 5557 5609 { 5558 5610 char_u *s; 5559 5611 int class_or_struct, lookfor_ctor_init, cpp_base_class; 5560 5612 linenr_T lnum = curwin->w_cursor.lnum; 5613 char_u *line = ml_get_curline(); 5561 5614 5562 5615 *col = 0; 5563 5616 … … 5585 5638 */ 5586 5639 while (lnum > 1) 5587 5640 { 5588 s = skipwhite(ml_get(lnum - 1)); 5641 line = ml_get(lnum - 1); 5642 s = skipwhite(line); 5589 5643 if (*s == '#' || *s == NUL) 5590 5644 break; 5591 5645 while (*s != NUL) … … 5602 5656 --lnum; 5603 5657 } 5604 5658 5605 s = cin_skipcomment(ml_get(lnum)); 5659 line = ml_get(lnum); 5660 s = cin_skipcomment(line); 5606 5661 for (;;) 5607 5662 { 5608 5663 if (*s == NUL) … … 5610 5665 if (lnum == curwin->w_cursor.lnum) 5611 5666 break; 5612 5667 /* Continue in the cursor line. */ 5613 s = cin_skipcomment(ml_get(++lnum)); 5668 line = ml_get(++lnum); 5669 s = cin_skipcomment(line); 5670 if (*s == NUL) 5671 continue; 5614 5672 } 5615 5673 5616 5674 if (s[0] == ':') … … 7079 7137 n = FALSE; 7080 7138 if (lookfor != LOOKFOR_TERM && ind_cpp_baseclass > 0) 7081 7139 { 7082 n = cin_is_cpp_baseclass( l,&col);7140 n = cin_is_cpp_baseclass(&col); 7083 7141 l = ml_get_curline(); 7084 7142 } 7085 7143 if (n) … … 7670 7728 n = FALSE; 7671 7729 if (ind_cpp_baseclass != 0 && theline[0] != '{') 7672 7730 { 7673 n = cin_is_cpp_baseclass( l,&col);7731 n = cin_is_cpp_baseclass(&col); 7674 7732 l = ml_get_curline(); 7675 7733 } 7676 7734 if (n) … … 8596 8654 for (p = buf + wildoff; p < s; ++p) 8597 8655 if (rem_backslash(p)) 8598 8656 { 8599 STRCPY(p, p + 1);8657 mch_memmove(p, p + 1, STRLEN(p)); 8600 8658 --e; 8601 8659 --s; 8602 8660 } … … 8897 8955 for (p = buf + wildoff; p < s; ++p) 8898 8956 if (rem_backslash(p)) 8899 8957 { 8900 STRCPY(p, p + 1);8958 mch_memmove(p, p + 1, STRLEN(p)); 8901 8959 --e; 8902 8960 --s; 8903 8961 } … … 9096 9154 */ 9097 9155 if (vim_strpbrk(p, (char_u *)"$~") != NULL) 9098 9156 { 9099 p = expand_env_save (p);9157 p = expand_env_save_opt(p, TRUE); 9100 9158 if (p == NULL) 9101 9159 p = pat[i]; 9102 9160 #ifdef UNIX -
src/misc2.c
diff -Naur vim71.orig/src/misc2.c vim71/src/misc2.c
old new 972 972 return; 973 973 entered = TRUE; 974 974 975 ++autocmd_block; /* don't want to trigger autocommands here */975 block_autocmds(); /* don't want to trigger autocommands here */ 976 976 977 977 #ifdef FEAT_WINDOWS 978 978 /* close all tabs and windows */ … … 1037 1037 1038 1038 /* Free some global vars. */ 1039 1039 vim_free(username); 1040 # ifdef FEAT_CLIPBOARD 1040 1041 vim_free(clip_exclude_prog); 1042 # endif 1041 1043 vim_free(last_cmdline); 1042 1044 vim_free(new_last_cmdline); 1043 1045 set_keep_msg(NULL, 0); -
src/normal.c
diff -Naur vim71.orig/src/normal.c vim71/src/normal.c
old new 690 690 ca.count0 = ca.count0 * 10 + (c - '0'); 691 691 if (ca.count0 < 0) /* got too large! */ 692 692 ca.count0 = 999999999L; 693 #ifdef FEAT_EVAL 694 /* Set v:count here, when called from main() and not a stuffed 695 * command, so that v:count can be used in an expression mapping 696 * right after the count. */ 697 if (toplevel && stuff_empty()) 698 set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0); 699 #endif 693 700 if (ctrl_w) 694 701 { 695 702 ++no_mapping; 696 703 ++allow_keys; /* no mapping for nchar, but keys */ 697 704 } 698 705 ++no_zero_mapping; /* don't map zero here */ 699 c = safe_vgetc();706 c = plain_vgetc(); 700 707 #ifdef FEAT_LANGMAP 701 708 LANGMAP_ADJUST(c, TRUE); 702 709 #endif … … 721 728 ca.count0 = 0; 722 729 ++no_mapping; 723 730 ++allow_keys; /* no mapping for nchar, but keys */ 724 c = safe_vgetc(); /* get next character */731 c = plain_vgetc(); /* get next character */ 725 732 #ifdef FEAT_LANGMAP 726 733 LANGMAP_ADJUST(c, TRUE); 727 734 #endif … … 889 896 890 897 ++no_mapping; 891 898 ++allow_keys; /* no mapping for nchar, but allow key codes */ 899 #ifdef FEAT_AUTOCMD 900 /* Don't generate a CursorHold event here, most commands can't handle 901 * it, e.g., nv_replace(), nv_csearch(). */ 902 did_cursorhold = TRUE; 903 #endif 892 904 if (ca.cmdchar == 'g') 893 905 { 894 906 /* 895 907 * For 'g' get the next character now, so that we can check for 896 908 * "gr", "g'" and "g`". 897 909 */ 898 ca.nchar = safe_vgetc();910 ca.nchar = plain_vgetc(); 899 911 #ifdef FEAT_LANGMAP 900 912 LANGMAP_ADJUST(ca.nchar, TRUE); 901 913 #endif … … 952 964 im_set_active(TRUE); 953 965 #endif 954 966 955 *cp = safe_vgetc();967 *cp = plain_vgetc(); 956 968 957 969 if (langmap_active) 958 970 { … … 1040 1052 } 1041 1053 if (c > 0) 1042 1054 { 1043 c = safe_vgetc();1055 c = plain_vgetc(); 1044 1056 if (c != Ctrl_N && c != Ctrl_G) 1045 1057 vungetc(c); 1046 1058 else … … 1059 1071 while (enc_utf8 && lang && (c = vpeekc()) > 0 1060 1072 && (c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1)) 1061 1073 { 1062 c = safe_vgetc();1074 c = plain_vgetc(); 1063 1075 if (!utf_iscomposing(c)) 1064 1076 { 1065 1077 vungetc(c); /* it wasn't, put it back */ … … 3755 3767 extra_len = (int)STRLEN(p); 3756 3768 overflow = old_len + extra_len - SHOWCMD_COLS; 3757 3769 if (overflow > 0) 3758 STRCPY(showcmd_buf, showcmd_buf + overflow); 3770 mch_memmove(showcmd_buf, showcmd_buf + overflow, 3771 old_len - overflow + 1); 3759 3772 STRCAT(showcmd_buf, p); 3760 3773 3761 3774 if (char_avail()) … … 4558 4571 #endif 4559 4572 ++no_mapping; 4560 4573 ++allow_keys; /* no mapping for nchar, but allow key codes */ 4561 nchar = safe_vgetc();4574 nchar = plain_vgetc(); 4562 4575 #ifdef FEAT_LANGMAP 4563 4576 LANGMAP_ADJUST(nchar, TRUE); 4564 4577 #endif … … 4916 4929 case 'u': /* "zug" and "zuw": undo "zg" and "zw" */ 4917 4930 ++no_mapping; 4918 4931 ++allow_keys; /* no mapping for nchar, but allow key codes */ 4919 nchar = safe_vgetc();4932 nchar = plain_vgetc(); 4920 4933 #ifdef FEAT_LANGMAP 4921 4934 LANGMAP_ADJUST(nchar, TRUE); 4922 4935 #endif … … 6379 6392 */ 6380 6393 else if (cap->nchar == 'p' || cap->nchar == 'P') 6381 6394 { 6382 if (!checkclearop q(cap->oap))6395 if (!checkclearop(cap->oap)) 6383 6396 { 6384 6397 prep_redo_cmd(cap); 6385 6398 do_put(cap->oap->regname, … … 6662 6675 else 6663 6676 had_ctrl_v = NUL; 6664 6677 6678 /* Abort if the character is a special key. */ 6679 if (IS_SPECIAL(cap->nchar)) 6680 { 6681 clearopbeep(cap->oap); 6682 return; 6683 } 6684 6665 6685 #ifdef FEAT_VISUAL 6666 6686 /* Visual mode "r" */ 6667 6687 if (VIsual_active) … … 6688 6708 } 6689 6709 #endif 6690 6710 6691 /* 6692 * Check for a special key or not enough characters to replace. 6693 */ 6711 /* Abort if not enough characters to replace. */ 6694 6712 ptr = ml_get_cursor(); 6695 if ( IS_SPECIAL(cap->nchar) ||STRLEN(ptr) < (unsigned)cap->count16713 if (STRLEN(ptr) < (unsigned)cap->count1 6696 6714 #ifdef FEAT_MBYTE 6697 6715 || (has_mbyte && mb_charlen(ptr) < cap->count1) 6698 6716 #endif … … 8353 8371 n = fwd_word(cap->count1, cap->arg, cap->oap->op_type != OP_NOP); 8354 8372 8355 8373 /* Don't leave the cursor on the NUL past a line */ 8356 if ( curwin->w_cursor.col&& gchar_cursor() == NUL)8374 if (n != FAIL && curwin->w_cursor.col > 0 && gchar_cursor() == NUL) 8357 8375 { 8358 8376 --curwin->w_cursor.col; 8359 8377 cap->oap->inclusive = TRUE; -
src/ops.c
diff -Naur vim71.orig/src/ops.c vim71/src/ops.c
old new 2477 2477 2478 2478 /* 2479 2479 * Spaces and tabs in the indent may have changed to other spaces and 2480 * tabs. Get the starting column again and correct the leng ht.2480 * tabs. Get the starting column again and correct the length. 2481 2481 * Don't do this when "$" used, end-of-line will have changed. 2482 2482 */ 2483 2483 block_prep(oap, &bd2, oap->start.lnum, TRUE); … … 2534 2534 #ifdef FEAT_VISUALEXTRA 2535 2535 long offset; 2536 2536 linenr_T linenr; 2537 long ins_len, pre_textlen = 0; 2537 long ins_len; 2538 long pre_textlen = 0; 2539 long pre_indent = 0; 2538 2540 char_u *firstline; 2539 2541 char_u *ins_text, *newp, *oldp; 2540 2542 struct block_def bd; … … 2579 2581 || gchar_cursor() == NUL)) 2580 2582 coladvance_force(getviscol()); 2581 2583 # endif 2582 pre_textlen = (long)STRLEN(ml_get(oap->start.lnum)); 2584 firstline = ml_get(oap->start.lnum); 2585 pre_textlen = (long)STRLEN(firstline); 2586 pre_indent = (long)(skipwhite(firstline) - firstline); 2583 2587 bd.textcol = curwin->w_cursor.col; 2584 2588 } 2585 2589 #endif … … 2598 2602 */ 2599 2603 if (oap->block_mode && oap->start.lnum != oap->end.lnum) 2600 2604 { 2605 /* Auto-indenting may have changed the indent. If the cursor was past 2606 * the indent, exclude that indent change from the inserted text. */ 2601 2607 firstline = ml_get(oap->start.lnum); 2602 /* 2603 * Subsequent calls to ml_get() flush the firstline data - take a 2604 * copy of the required bit. 2605 */ 2606 if ((ins_len = (long)STRLEN(firstline) - pre_textlen) > 0) 2608 if (bd.textcol > (colnr_T)pre_indent) 2609 { 2610 long new_indent = (long)(skipwhite(firstline) - firstline); 2611 2612 pre_textlen += new_indent - pre_indent; 2613 bd.textcol += new_indent - pre_indent; 2614 } 2615 2616 ins_len = (long)STRLEN(firstline) - pre_textlen; 2617 if (ins_len > 0) 2607 2618 { 2619 /* Subsequent calls to ml_get() flush the firstline data - take a 2620 * copy of the inserted text. */ 2608 2621 if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != NULL) 2609 2622 { 2610 2623 vim_strncpy(ins_text, firstline + bd.textcol, (size_t)ins_len); … … 3404 3417 3405 3418 #ifdef FEAT_VIRTUALEDIT 3406 3419 col += curwin->w_cursor.coladd; 3407 if (ve_flags == VE_ALL && curwin->w_cursor.coladd > 0) 3420 if (ve_flags == VE_ALL 3421 && (curwin->w_cursor.coladd > 0 3422 || endcol2 == curwin->w_cursor.col)) 3408 3423 { 3409 3424 if (dir == FORWARD && c == NUL) 3410 3425 ++col; -
src/option.c
diff -Naur vim71.orig/src/option.c vim71/src/option.c
old new 427 427 #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */ 428 428 #define P_NFNAME 0x200000L/* only normal file name chars allowed */ 429 429 #define P_INSECURE 0x400000L/* option was set from a modeline */ 430 #define P_PRI_MKRC 0x800000L/* priority for :mkvimrc (setting option has 431 side effects) */ 430 432 431 433 #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255" 432 434 … … 773 775 {(char_u *)0L, (char_u *)0L} 774 776 #endif 775 777 }, 778 /* P_PRI_MKRC isn't needed here, optval_default() 779 * always returns TRUE for 'compatible' */ 776 780 {"compatible", "cp", P_BOOL|P_RALL, 777 781 (char_u *)&p_cp, PV_NONE, 778 782 {(char_u *)TRUE, (char_u *)FALSE}}, … … 1515 1519 {(char_u *)0L, (char_u *)0L} 1516 1520 #endif 1517 1521 }, 1518 {"keymap", "kmp", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME ,1522 {"keymap", "kmp", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME|P_PRI_MKRC, 1519 1523 #ifdef FEAT_KEYMAP 1520 1524 (char_u *)&p_keymap, PV_KMAP, 1521 1525 {(char_u *)"", (char_u *)0L} … … 1836 1840 {"paragraphs", "para", P_STRING|P_VI_DEF, 1837 1841 (char_u *)&p_para, PV_NONE, 1838 1842 {(char_u *)"IPLPPPQPP LIpplpipbp", (char_u *)0L}}, 1839 {"paste", NULL, P_BOOL|P_VI_DEF ,1843 {"paste", NULL, P_BOOL|P_VI_DEF|P_PRI_MKRC, 1840 1844 (char_u *)&p_paste, PV_NONE, 1841 1845 {(char_u *)FALSE, (char_u *)0L}}, 1842 1846 {"pastetoggle", "pt", P_STRING|P_VI_DEF, … … 4628 4632 if ((!(flags & P_COMMA) || *s != ',') 4629 4633 && vim_strchr(s + 1, *s) != NULL) 4630 4634 { 4631 STRCPY(s, s + 1);4635 mch_memmove(s, s + 1, STRLEN(s)); 4632 4636 --s; 4633 4637 } 4634 4638 } … … 4992 4996 * For 'spellsuggest' expand after "file:". 4993 4997 */ 4994 4998 expand_env_esc(val, NameBuff, MAXPATHL, 4995 (char_u **)options[opt_idx].var == &p_tags, 4999 (char_u **)options[opt_idx].var == &p_tags, FALSE, 4996 5000 #ifdef FEAT_SPELL 4997 5001 (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" : 4998 5002 #endif … … 6348 6352 errmsg = check_stl_option(p_ruf); 6349 6353 } 6350 6354 /* check 'statusline' only if it doesn't start with "%!" */ 6351 else if (varp != &p_stl|| s[0] != '%' || s[1] != '!')6355 else if (varp == &p_ruf || s[0] != '%' || s[1] != '!') 6352 6356 errmsg = check_stl_option(s); 6353 6357 if (varp == &p_ruf && errmsg == NULL) 6354 6358 comp_col(); … … 7118 7122 /* when 'endofline' is changed, redraw the window title */ 7119 7123 else if ((int *)varp == &curbuf->b_p_eol) 7120 7124 need_maketitle = TRUE; 7125 #ifdef FEAT_MBYTE 7126 /* when 'bomb' is changed, redraw the window title */ 7127 else if ((int *)varp == &curbuf->b_p_bomb) 7128 need_maketitle = TRUE; 7129 #endif 7121 7130 #endif 7122 7131 7123 7132 /* when 'bin' is set also set some other options */ … … 7815 7824 errmsg = e_positive; 7816 7825 p_ch = 1; 7817 7826 } 7827 if (p_ch > Rows - min_rows() + 1) 7828 p_ch = Rows - min_rows() + 1; 7818 7829 7819 7830 /* Only compute the new window layout when startup has been 7820 7831 * completed. Otherwise the frame sizes may be wrong. */ … … 8219 8230 varp = get_varp(&options[opt_idx]); 8220 8231 if (varp != NULL) /* hidden option is not changed */ 8221 8232 { 8233 if (number == 0 && string != NULL) 8234 { 8235 int index; 8236 8237 /* Either we are given a string or we are setting option 8238 * to zero. */ 8239 for (index = 0; string[index] == '0'; ++index) 8240 ; 8241 if (string[index] != NUL || index == 0) 8242 { 8243 /* There's another character after zeros or the string 8244 * is empty. In both cases, we are trying to set a 8245 * num option using a string. */ 8246 EMSG3(_("E521: Number required: &%s = '%s'"), 8247 name, string); 8248 return; /* do nothing as we hit an error */ 8249 8250 } 8251 } 8222 8252 if (flags & P_NUM) 8223 8253 (void)set_num_option(opt_idx, varp, number, 8224 8254 NULL, 0, opt_flags); … … 8511 8541 char_u *varp_local = NULL; /* fresh value */ 8512 8542 char *cmd; 8513 8543 int round; 8544 int pri; 8514 8545 8515 8546 /* 8516 8547 * The options that don't have a default (terminal name, columns, lines) 8517 8548 * are never written. Terminal options are also not written. 8549 * Do the loop over "options[]" twice: once for options with the 8550 * P_PRI_MKRC flag and once without. 8518 8551 */ 8519 for (p = &options[0]; !istermoption(p); p++) 8520 if (!(p->flags & P_NO_MKRC) && !istermoption(p)) 8552 for (pri = 1; pri >= 0; --pri) 8553 { 8554 for (p = &options[0]; !istermoption(p); p++) 8555 if (!(p->flags & P_NO_MKRC) 8556 && !istermoption(p) 8557 && ((pri == 1) == ((p->flags & P_PRI_MKRC) != 0))) 8521 8558 { 8522 8559 /* skip global option when only doing locals */ 8523 8560 if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL)) … … 8613 8650 } 8614 8651 } 8615 8652 } 8653 } 8616 8654 return OK; 8617 8655 } 8618 8656 … … 8715 8753 char *name; 8716 8754 int value; 8717 8755 { 8756 if (value < 0) /* global/local option using global value */ 8757 return OK; 8718 8758 if (fprintf(fd, "%s %s%s", cmd, value ? "" : "no", name) < 0 8719 8759 || put_eol(fd) < 0) 8720 8760 return FAIL; … … 10585 10625 buf->b_start_ffc = *buf->b_p_ff; 10586 10626 buf->b_start_eol = buf->b_p_eol; 10587 10627 #ifdef FEAT_MBYTE 10628 buf->b_start_bomb = buf->b_p_bomb; 10629 10588 10630 /* Only use free/alloc when necessary, they take time. */ 10589 10631 if (buf->b_start_fenc == NULL 10590 10632 || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) … … 10598 10640 /* 10599 10641 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value 10600 10642 * from when editing started (save_file_ff() called). 10601 * Also when 'endofline' was changed and 'binary' is set. 10643 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was 10644 * changed and 'binary' is not set. 10602 10645 * Don't consider a new, empty buffer to be changed. 10603 10646 */ 10604 10647 int 10605 10648 file_ff_differs(buf) 10606 10649 buf_T *buf; 10607 10650 { 10651 /* In a buffer that was never loaded the options are not valid. */ 10652 if (buf->b_flags & BF_NEVERLOADED) 10653 return FALSE; 10608 10654 if ((buf->b_flags & BF_NEW) 10609 10655 && buf->b_ml.ml_line_count == 1 10610 10656 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL) … … 10614 10660 if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol) 10615 10661 return TRUE; 10616 10662 #ifdef FEAT_MBYTE 10663 if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb) 10664 return TRUE; 10617 10665 if (buf->b_start_fenc == NULL) 10618 10666 return (*buf->b_p_fenc != NUL); 10619 10667 return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0); -
src/os_unix.c
diff -Naur vim71.orig/src/os_unix.c vim71/src/os_unix.c
old new 753 753 if (signal_stack != NULL) 754 754 { 755 755 # ifdef HAVE_SIGALTSTACK 756 # ifdef __APPLE__ 756 # if defined(__APPLE__) && (!defined(MAC_OS_X_VERSION_MAX_ALLOWED) \ 757 || MAC_OS_X_VERSION_MAX_ALLOWED <= 1040) 757 758 /* missing prototype. Adding it to osdef?.h.in doesn't work, because 758 759 * "struct sigaltstack" needs to be declared. */ 759 760 extern int sigaltstack __ARGS((const struct sigaltstack *ss, struct sigaltstack *oss)); … … 2499 2500 if (stat((char *)name, &statb)) 2500 2501 #endif 2501 2502 return -1; 2503 #ifdef __INTERIX 2504 /* The top bit makes the value negative, which means the file doesn't 2505 * exist. Remove the bit, we don't use it. */ 2506 return statb.st_mode & ~S_ADDACE; 2507 #else 2502 2508 return statb.st_mode; 2509 #endif 2503 2510 } 2504 2511 2505 2512 /* … … 5682 5689 5683 5690 /* 5684 5691 * Closes connection to gpm 5685 * returns non-zero if connection succes fully closed5692 * returns non-zero if connection successfully closed 5686 5693 */ 5687 5694 static void 5688 5695 gpm_close() -
src/os_unix.h
diff -Naur vim71.orig/src/os_unix.h vim71/src/os_unix.h
old new 508 508 #if !defined(S_ISFIFO) && defined(S_IFIFO) 509 509 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 510 510 #endif 511 #if !defined(S_ISCHR) && defined(S_IFCHR) 512 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 513 #endif 511 514 512 515 /* Note: Some systems need both string.h and strings.h (Savage). However, 513 516 * some systems can't handle both, only use string.h in that case. */ -
src/popupmnu.c
diff -Naur vim71.orig/src/popupmnu.c vim71/src/popupmnu.c
old new 75 75 76 76 row = curwin->w_cline_row + W_WINROW(curwin); 77 77 height = curwin->w_cline_height; 78 col = curwin->w_wcol + W_WINCOL(curwin) - curwin->w_leftcol;79 78 80 79 if (firstwin->w_p_pvw) 81 80 top_clear = firstwin->w_height; … … 167 166 pum_base_width = max_width; 168 167 pum_kind_width = kind_width; 169 168 169 /* Calculate column */ 170 #ifdef FEAT_RIGHTLEFT 171 if (curwin->w_p_rl) 172 col = W_WINCOL(curwin) + W_WIDTH(curwin) - curwin->w_wcol - 173 curwin->w_leftcol - 1; 174 else 175 #endif 176 col = W_WINCOL(curwin) + curwin->w_wcol - curwin->w_leftcol; 177 170 178 /* if there are more items than room we need a scrollbar */ 171 179 if (pum_height < size) 172 180 { … … 179 187 if (def_width < max_width) 180 188 def_width = max_width; 181 189 182 if (col < Columns - PUM_DEF_WIDTH || col < Columns - max_width) 190 if (((col < Columns - PUM_DEF_WIDTH || col < Columns - max_width) 191 #ifdef FEAT_RIGHTLEFT 192 && !curwin->w_p_rl) 193 || (curwin->w_p_rl && (col > PUM_DEF_WIDTH || col > max_width) 194 #endif 195 )) 183 196 { 184 197 /* align pum column with "col" */ 185 198 pum_col = col; 186 pum_width = Columns - pum_col - pum_scrollbar; 199 200 #ifdef FEAT_RIGHTLEFT 201 if (curwin->w_p_rl) 202 pum_width = pum_col - pum_scrollbar + 1; 203 else 204 #endif 205 pum_width = Columns - pum_col - pum_scrollbar; 206 187 207 if (pum_width > max_width + kind_width + extra_width + 1 188 208 && pum_width > PUM_DEF_WIDTH) 189 209 { … … 195 215 else if (Columns < def_width) 196 216 { 197 217 /* not enough room, will use what we have */ 198 pum_col = 0; 218 #ifdef FEAT_RIGHTLEFT 219 if (curwin->w_p_rl) 220 pum_col = Columns - 1; 221 else 222 #endif 223 pum_col = 0; 199 224 pum_width = Columns - 1; 200 225 } 201 226 else 202 227 { 203 228 if (max_width > PUM_DEF_WIDTH) 204 229 max_width = PUM_DEF_WIDTH; /* truncate */ 205 pum_col = Columns - max_width; 230 #ifdef FEAT_RIGHTLEFT 231 if (curwin->w_p_rl) 232 pum_col = max_width - 1; 233 else 234 #endif 235 pum_col = Columns - max_width; 206 236 pum_width = max_width - pum_scrollbar; 207 237 } 208 238 … … 255 285 attr = (idx == pum_selected) ? attr_select : attr_norm; 256 286 257 287 /* prepend a space if there is room */ 258 if (pum_col > 0) 259 screen_putchar(' ', row, pum_col - 1, attr); 288 #ifdef FEAT_RIGHTLEFT 289 if (curwin->w_p_rl) 290 { 291 if (pum_col < W_WINCOL(curwin) + W_WIDTH(curwin) - 1) 292 screen_putchar(' ', row, pum_col + 1, attr); 293 } 294 else 295 #endif 296 if (pum_col > 0) 297 screen_putchar(' ', row, pum_col - 1, attr); 260 298 261 299 /* Display each entry, use two spaces for a Tab. 262 300 * Do this 3 times: For the main text, kind and extra info */ … … 282 320 { 283 321 /* Display the text that fits or comes before a Tab. 284 322 * First convert it to printable characters. */ 285 char_u 286 int 323 char_u *st; 324 int saved = *p; 287 325 288 326 *p = NUL; 289 327 st = transstr(s); 290 328 *p = saved; 291 if (st != NULL) 329 #ifdef FEAT_RIGHTLEFT 330 if (curwin->w_p_rl) 292 331 { 293 screen_puts_len(st, (int)STRLEN(st), row, col, 332 if (st != NULL) 333 { 334 char_u *rt = reverse_text(st); 335 char_u *rt_saved = rt; 336 int len, j; 337 338 if (rt != NULL) 339 { 340 len = STRLEN(rt); 341 if (len > pum_width) 342 { 343 for (j = pum_width; j < len; ++j) 344 mb_ptr_adv(rt); 345 len = pum_width; 346 } 347 screen_puts_len(rt, len, row, 348 col - len + 1, attr); 349 vim_free(rt_saved); 350 } 351 vim_free(st); 352 } 353 col -= width; 354 } 355 else 356 #endif 357 { 358 if (st != NULL) 359 { 360 screen_puts_len(st, (int)STRLEN(st), row, col, 294 361 attr); 295 vim_free(st); 362 vim_free(st); 363 } 364 col += width; 296 365 } 297 col += width;298 366 299 367 if (*p != TAB) 300 368 break; 301 369 302 370 /* Display two spaces for a Tab. */ 303 screen_puts_len((char_u *)" ", 2, row, col, attr); 304 col += 2; 371 #ifdef FEAT_RIGHTLEFT 372 if (curwin->w_p_rl) 373 { 374 screen_puts_len((char_u *)" ", 2, row, col - 1, 375 attr); 376 col -= 2; 377 } 378 else 379 #endif 380 { 381 screen_puts_len((char_u *)" ", 2, row, col, attr); 382 col += 2; 383 } 305 384 totwidth += 2; 306 385 s = NULL; /* start text at next char */ 307 386 width = 0; … … 322 401 && pum_array[idx].pum_extra == NULL) 323 402 || pum_base_width + n >= pum_width) 324 403 break; 325 screen_fill(row, row + 1, col, pum_col + pum_base_width + n, 404 #ifdef FEAT_RIGHTLEFT 405 if (curwin->w_p_rl) 406 { 407 screen_fill(row, row + 1, pum_col - pum_base_width - n + 1, 408 col + 1, ' ', ' ', attr); 409 col = pum_col - pum_base_width - n + 1; 410 } 411 else 412 #endif 413 { 414 screen_fill(row, row + 1, col, pum_col + pum_base_width + n, 326 415 ' ', ' ', attr); 327 col = pum_col + pum_base_width + n; 416 col = pum_col + pum_base_width + n; 417 } 328 418 totwidth = pum_base_width + n; 329 419 } 330 420 331 screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ', attr); 421 #ifdef FEAT_RIGHTLEFT 422 if (curwin->w_p_rl) 423 screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1, ' ', 424 ' ', attr); 425 else 426 #endif 427 screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ', 428 attr); 332 429 if (pum_scrollbar > 0) 333 screen_putchar(' ', row, pum_col + pum_width, 334 i >= thumb_pos && i < thumb_pos + thumb_heigth 430 { 431 #ifdef FEAT_RIGHTLEFT 432 if (curwin->w_p_rl) 433 screen_putchar(' ', row, pum_col - pum_width, 434 i >= thumb_pos && i < thumb_pos + thumb_heigth 335 435 ? attr_thumb : attr_scroll); 436 else 437 #endif 438 screen_putchar(' ', row, pum_col + pum_width, 439 i >= thumb_pos && i < thumb_pos + thumb_heigth 440 ? attr_thumb : attr_scroll); 441 } 336 442 337 443 ++row; 338 444 } … … 466 572 set_option_value((char_u *)"bh", 0L, 467 573 (char_u *)"wipe", OPT_LOCAL); 468 574 set_option_value((char_u *)"diff", 0L, 469 (char_u *)"", OPT_LOCAL);575 NULL, OPT_LOCAL); 470 576 } 471 577 } 472 578 if (res == OK) -
src/proto/charset.pro
diff -Naur vim71.orig/src/proto/charset.pro vim71/src/proto/charset.pro
old new 21 21 int vim_iswordp __ARGS((char_u *p)); 22 22 int vim_iswordc_buf __ARGS((char_u *p, buf_T *buf)); 23 23 int vim_isfilec __ARGS((int c)); 24 int vim_isfilec_or_wc __ARGS((int c)); 24 25 int vim_isprintc __ARGS((int c)); 25 26 int vim_isprintc_strict __ARGS((int c)); 26 27 int lbr_chartabsize __ARGS((unsigned char *s, colnr_T col)); -
src/proto/fileio.pro
diff -Naur vim71.orig/src/proto/fileio.pro vim71/src/proto/fileio.pro
old new 2 2 void filemess __ARGS((buf_T *buf, char_u *name, char_u *s, int attr)); 3 3 int readfile __ARGS((char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_skip, linenr_T lines_to_read, exarg_T *eap, int flags)); 4 4 int prep_exarg __ARGS((exarg_T *eap, buf_T *buf)); 5 int check_file_readonly __ARGS((char_u *fname, int perm)); 5 6 int buf_write __ARGS((buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int filtering)); 6 7 void msg_add_fname __ARGS((buf_T *buf, char_u *fname)); 7 8 void msg_add_lines __ARGS((int insert_space, long lnum, long nchars)); … … 39 40 int trigger_cursorhold __ARGS((void)); 40 41 int has_cursormoved __ARGS((void)); 41 42 int has_cursormovedI __ARGS((void)); 43 void block_autocmds __ARGS((void)); 44 void unblock_autocmds __ARGS((void)); 42 45 int has_autocmd __ARGS((event_T event, char_u *sfname, buf_T *buf)); 43 46 char_u *get_augroup_name __ARGS((expand_T *xp, int idx)); 44 47 char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd)); -
src/proto/getchar.pro
diff -Naur vim71.orig/src/proto/getchar.pro vim71/src/proto/getchar.pro
old new 38 38 void updatescript __ARGS((int c)); 39 39 int vgetc __ARGS((void)); 40 40 int safe_vgetc __ARGS((void)); 41 int plain_vgetc __ARGS((void)); 41 42 int vpeekc __ARGS((void)); 42 43 int vpeekc_nomap __ARGS((void)); 43 44 int vpeekc_any __ARGS((void)); -
src/proto/if_cscope.pro
diff -Naur vim71.orig/src/proto/if_cscope.pro vim71/src/proto/if_cscope.pro
old new 6 6 void cs_free_tags __ARGS((void)); 7 7 void cs_print_tags __ARGS((void)); 8 8 int cs_connection __ARGS((int num, char_u *dbpath, char_u *ppath)); 9 void cs_end __ARGS((void)); 9 10 /* vim: set ft=c : */ -
src/proto/mbyte.pro
diff -Naur vim71.orig/src/proto/mbyte.pro vim71/src/proto/mbyte.pro
old new 12 12 int utf_ptr2cells __ARGS((char_u *p)); 13 13 int dbcs_ptr2cells __ARGS((char_u *p)); 14 14 int latin_char2cells __ARGS((int c)); 15 int latin_off2cells __ARGS((unsigned off ));16 int dbcs_off2cells __ARGS((unsigned off ));17 int utf_off2cells __ARGS((unsigned off ));15 int latin_off2cells __ARGS((unsigned off, unsigned max_off)); 16 int dbcs_off2cells __ARGS((unsigned off, unsigned max_off)); 17 int utf_off2cells __ARGS((unsigned off, unsigned max_off)); 18 18 int latin_ptr2char __ARGS((char_u *p)); 19 19 int utf_ptr2char __ARGS((char_u *p)); 20 20 int mb_ptr2char_adv __ARGS((char_u **pp)); -
src/proto/misc1.pro
diff -Naur vim71.orig/src/proto/misc1.pro vim71/src/proto/misc1.pro
old new 48 48 void vim_beep __ARGS((void)); 49 49 void init_homedir __ARGS((void)); 50 50 void free_homedir __ARGS((void)); 51 char_u *expand_env_save __ARGS((char_u *src)); 52 char_u *expand_env_save_opt __ARGS((char_u *src, int one)); 51 53 void expand_env __ARGS((char_u *src, char_u *dst, int dstlen)); 52 void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, char_u *startstr));54 void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, int one, char_u *startstr)); 53 55 char_u *vim_getenv __ARGS((char_u *name, int *mustfree)); 54 char_u *expand_env_save __ARGS((char_u *src));55 56 void vim_setenv __ARGS((char_u *name, char_u *val)); 56 57 char_u *get_env_name __ARGS((expand_T *xp, int idx)); 57 58 void home_replace __ARGS((buf_T *buf, char_u *src, char_u *dst, int dstlen, int one)); -
src/proto/search.pro
diff -Naur vim71.orig/src/proto/search.pro vim71/src/proto/search.pro
old new 1 1 /* search.c */ 2 2 int search_regcomp __ARGS((char_u *pat, int pat_save, int pat_use, int options, regmmatch_T *regmatch)); 3 3 char_u *get_search_pat __ARGS((void)); 4 char_u *reverse_text __ARGS((char_u *s)); 4 5 void save_search_patterns __ARGS((void)); 5 6 void restore_search_patterns __ARGS((void)); 6 7 void free_search_patterns __ARGS((void)); -
src/proto/syntax.pro
diff -Naur vim71.orig/src/proto/syntax.pro vim71/src/proto/syntax.pro
old new 8 8 void syntax_clear __ARGS((buf_T *buf)); 9 9 void ex_syntax __ARGS((exarg_T *eap)); 10 10 int syntax_present __ARGS((buf_T *buf)); 11 void reset_expand_highlight __ARGS((void)); 12 void set_context_in_echohl_cmd __ARGS((expand_T *xp, char_u *arg)); 11 13 void set_context_in_syntax_cmd __ARGS((expand_T *xp, char_u *arg)); 12 14 char_u *get_syntax_name __ARGS((expand_T *xp, int idx)); 13 15 int syn_get_id __ARGS((win_T *wp, long lnum, colnr_T col, int trans, int *spellp)); -
src/proto/window.pro
diff -Naur vim71.orig/src/proto/window.pro vim71/src/proto/window.pro
old new 59 59 int only_one_window __ARGS((void)); 60 60 void check_lnums __ARGS((int do_curwin)); 61 61 int win_hasvertsplit __ARGS((void)); 62 int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id)); 63 int match_delete __ARGS((win_T *wp, int id, int perr)); 64 void clear_matches __ARGS((win_T *wp)); 65 matchitem_T *get_match __ARGS((win_T *wp, int id)); 62 66 /* vim: set ft=c : */ -
src/quickfix.c
diff -Naur vim71.orig/src/quickfix.c vim71/src/quickfix.c
old new 1612 1612 } 1613 1613 1614 1614 /* 1615 * If there is only one window and i s the quickfix window, create a new1616 * one above the quickfix window.1615 * If there is only one window and it is the quickfix window, create a 1616 * new one above the quickfix window. 1617 1617 */ 1618 1618 if (((firstwin == lastwin) && bt_quickfix(curbuf)) || !usable_win) 1619 1619 { … … 2331 2331 set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix", 2332 2332 OPT_LOCAL); 2333 2333 set_option_value((char_u *)"bh", 0L, (char_u *)"wipe", OPT_LOCAL); 2334 set_option_value((char_u *)"diff", 0L, (char_u *)"", OPT_LOCAL);2334 set_option_value((char_u *)"diff", 0L, NULL, OPT_LOCAL); 2335 2335 } 2336 2336 2337 2337 /* Only set the height when still in the same tab page and there is no … … 2981 2981 buf_T *buf; 2982 2982 int duplicate_name = FALSE; 2983 2983 int using_dummy; 2984 int redraw_for_dummy = FALSE; 2984 2985 int found_match; 2985 2986 buf_T *first_match_buf = NULL; 2986 2987 time_t seconds = 0; … … 3097 3098 /* Remember that a buffer with this name already exists. */ 3098 3099 duplicate_name = (buf != NULL); 3099 3100 using_dummy = TRUE; 3101 redraw_for_dummy = TRUE; 3100 3102 3101 3103 #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) 3102 3104 /* Don't do Filetype autocommands to avoid loading syntax and … … 3243 3245 if (qi->qf_lists[qi->qf_curlist].qf_count > 0) 3244 3246 { 3245 3247 if ((flags & VGR_NOJUMP) == 0) 3248 { 3249 buf = curbuf; 3246 3250 qf_jump(qi, 0, 0, eap->forceit); 3251 if (buf != curbuf) 3252 /* If we jumped to another buffer redrawing will already be 3253 * taken care of. */ 3254 redraw_for_dummy = FALSE; 3255 } 3247 3256 } 3248 3257 else 3249 3258 EMSG2(_(e_nomatch2), s); 3250 3259 3260 /* If we loaded a dummy buffer into the current window, the autocommands 3261 * may have messed up things, need to redraw and recompute folds. */ 3262 if (redraw_for_dummy) 3263 { 3264 #ifdef FEAT_FOLDING 3265 foldUpdateAll(curwin); 3266 #else 3267 redraw_later(NOT_VALID); 3268 #endif 3269 } 3270 3251 3271 theend: 3252 3272 vim_free(regmatch.regprog); 3253 3273 } -
src/regexp.c
diff -Naur vim71.orig/src/regexp.c vim71/src/regexp.c
old new 2220 2220 break; 2221 2221 case CLASS_LOWER: 2222 2222 for (cu = 1; cu <= 255; cu++) 2223 if ( islower(cu))2223 if (MB_ISLOWER(cu)) 2224 2224 regc(cu); 2225 2225 break; 2226 2226 case CLASS_PRINT: … … 2240 2240 break; 2241 2241 case CLASS_UPPER: 2242 2242 for (cu = 1; cu <= 255; cu++) 2243 if ( isupper(cu))2243 if (MB_ISUPPER(cu)) 2244 2244 regc(cu); 2245 2245 break; 2246 2246 case CLASS_XDIGIT: … … 3465 3465 (enc_utf8 && utf_fold(prog->regstart) == utf_fold(c))) 3466 3466 || (c < 255 && prog->regstart < 255 && 3467 3467 #endif 3468 TOLOWER_LOC(prog->regstart) == TOLOWER_LOC(c)))))3468 MB_TOLOWER(prog->regstart) == MB_TOLOWER(c))))) 3469 3469 retval = regtry(prog, col); 3470 3470 else 3471 3471 retval = 0; … … 4200 4200 #ifdef FEAT_MBYTE 4201 4201 !enc_utf8 && 4202 4202 #endif 4203 TOLOWER_LOC(*opnd) != TOLOWER_LOC(*reginput))))4203 MB_TOLOWER(*opnd) != MB_TOLOWER(*reginput)))) 4204 4204 status = RA_NOMATCH; 4205 4205 else if (*opnd == NUL) 4206 4206 { … … 4733 4733 rst.nextb = *OPERAND(next); 4734 4734 if (ireg_ic) 4735 4735 { 4736 if ( isupper(rst.nextb))4737 rst.nextb_ic = TOLOWER_LOC(rst.nextb);4736 if (MB_ISUPPER(rst.nextb)) 4737 rst.nextb_ic = MB_TOLOWER(rst.nextb); 4738 4738 else 4739 rst.nextb_ic = TOUPPER_LOC(rst.nextb);4739 rst.nextb_ic = MB_TOUPPER(rst.nextb); 4740 4740 } 4741 4741 else 4742 4742 rst.nextb_ic = rst.nextb; … … 5558 5558 int cu, cl; 5559 5559 5560 5560 /* This doesn't do a multi-byte character, because a MULTIBYTECODE 5561 * would have been used for it. */ 5561 * would have been used for it. It does handle single-byte 5562 * characters, such as latin1. */ 5562 5563 if (ireg_ic) 5563 5564 { 5564 cu = TOUPPER_LOC(*opnd);5565 cl = TOLOWER_LOC(*opnd);5565 cu = MB_TOUPPER(*opnd); 5566 cl = MB_TOLOWER(*opnd); 5566 5567 while (count < maxcount && (*scan == cu || *scan == cl)) 5567 5568 { 5568 5569 count++; … … 6490 6491 cc = utf_fold(c); 6491 6492 else 6492 6493 #endif 6493 if ( isupper(c))6494 cc = TOLOWER_LOC(c);6495 else if ( islower(c))6496 cc = TOUPPER_LOC(c);6494 if (MB_ISUPPER(c)) 6495 cc = MB_TOLOWER(c); 6496 else if (MB_ISLOWER(c)) 6497 cc = MB_TOUPPER(c); 6497 6498 else 6498 6499 return vim_strchr(s, c); 6499 6500 … … 6637 6638 } 6638 6639 } 6639 6640 else if (magic) 6640 STRCPY(p, p + 1);/* remove '~' */6641 mch_memmove(p, p + 1, STRLEN(p)); /* remove '~' */ 6641 6642 else 6642 STRCPY(p, p + 2);/* remove '\~' */6643 mch_memmove(p, p + 2, STRLEN(p) - 1); /* remove '\~' */ 6643 6644 --p; 6644 6645 } 6645 6646 else … … 7014 7015 #ifdef FEAT_MBYTE 7015 7016 if (has_mbyte) 7016 7017 { 7017 int l = mb_ptr2len(s) - 1; 7018 int l; 7019 7020 /* Copy composing characters separately, one 7021 * at a time. */ 7022 if (enc_utf8) 7023 l = utf_ptr2len(s) - 1; 7024 else 7025 l = mb_ptr2len(s) - 1; 7018 7026 7019 7027 s += l; 7020 7028 len -= l; -
src/screen.c
diff -Naur vim71.orig/src/screen.c vim71/src/screen.c
old new 100 100 static int screen_cur_row, screen_cur_col; /* last known cursor position */ 101 101 102 102 #ifdef FEAT_SEARCH_EXTRA 103 /*104 * Struct used for highlighting 'hlsearch' matches for the last use search105 * pattern or a ":match" item.106 * For 'hlsearch' there is one pattern for all windows. For ":match" there is107 * a different pattern for each window.108 */109 typedef struct110 {111 regmmatch_T rm; /* points to the regexp program; contains last found112 match (may continue in next line) */113 buf_T *buf; /* the buffer to search for a match */114 linenr_T lnum; /* the line to search for a match */115 int attr; /* attributes to be used for a match */116 int attr_cur; /* attributes currently active in win_line() */117 linenr_T first_lnum; /* first lnum to search for multi-line pat */118 colnr_T startcol; /* in win_line() points to char where HL starts */119 colnr_T endcol; /* in win_line() points to char where HL ends */120 } match_T;121 122 103 static match_T search_hl; /* used for 'hlsearch' highlight matching */ 123 static match_T match_hl[3]; /* used for ":match" highlight matching */124 104 #endif 125 105 126 106 #ifdef FEAT_FOLDING … … 155 135 static void redraw_custum_statusline __ARGS((win_T *wp)); 156 136 #endif 157 137 #ifdef FEAT_SEARCH_EXTRA 138 #define SEARCH_HL_PRIORITY 0 158 139 static void start_search_hl __ARGS((void)); 159 140 static void end_search_hl __ARGS((void)); 160 141 static void prepare_search_hl __ARGS((win_T *wp, linenr_T lnum)); … … 350 331 { 351 332 if (type < must_redraw) /* use maximal type */ 352 333 type = must_redraw; 334 335 /* must_redraw is reset here, so that when we run into some weird 336 * reason to redraw while busy redrawing (e.g., asynchronous 337 * scrolling), or update_topline() in win_update() will cause a 338 * scroll, the screen will be redrawn later or in win_update(). */ 353 339 must_redraw = 0; 354 340 } 355 341 … … 787 773 w_topline got smaller a bit */ 788 774 #endif 789 775 #ifdef FEAT_SEARCH_EXTRA 776 matchitem_T *cur; /* points to the match list */ 790 777 int top_to_mod = FALSE; /* redraw above mod_top */ 791 778 #endif 792 779 … … 848 835 #endif 849 836 850 837 #ifdef FEAT_SEARCH_EXTRA 851 /* Setup for ":match"and 'hlsearch' highlighting. Disable any previous838 /* Setup for match and 'hlsearch' highlighting. Disable any previous 852 839 * match */ 853 for (i = 0; i < 3; ++i) 840 cur = wp->w_match_head; 841 while (cur != NULL) 854 842 { 855 match_hl[i].rm = wp->w_match[i]; 856 if (wp->w_match_id[i] == 0) 857 match_hl[i].attr = 0; 858 else 859 match_hl[i].attr = syn_id2attr(wp->w_match_id[i]); 860 match_hl[i].buf = buf; 861 match_hl[i].lnum = 0; 862 match_hl[i].first_lnum = 0; 843 cur->hl.rm = cur->match; 844 if (cur->hlg_id == 0) 845 cur->hl.attr = 0; 846 else 847 cur->hl.attr = syn_id2attr(cur->hlg_id); 848 cur->hl.buf = buf; 849 cur->hl.lnum = 0; 850 cur->hl.first_lnum = 0; 851 cur = cur->next; 863 852 } 864 853 search_hl.buf = buf; 865 854 search_hl.lnum = 0; … … 923 912 * change in one line may make the Search highlighting in a 924 913 * previous line invalid. Simple solution: redraw all visible 925 914 * lines above the change. 926 * Same for a ":match"pattern.915 * Same for a match pattern. 927 916 */ 928 917 if (search_hl.rm.regprog != NULL 929 918 && re_multiline(search_hl.rm.regprog)) 930 919 top_to_mod = TRUE; 931 920 else 932 for (i = 0; i < 3; ++i) 933 if (match_hl[i].rm.regprog != NULL 934 && re_multiline(match_hl[i].rm.regprog)) 921 { 922 cur = wp->w_match_head; 923 while (cur != NULL) 924 { 925 if (cur->match.regprog != NULL 926 && re_multiline(cur->match.regprog)) 935 927 { 936 928 top_to_mod = TRUE; 937 929 break; 938 930 } 931 cur = cur->next; 932 } 933 } 939 934 #endif 940 935 } 941 936 #ifdef FEAT_FOLDING … … 1029 1024 type = VALID; 1030 1025 } 1031 1026 1027 /* Trick: we want to avoid clearing the screen twice. screenclear() will 1028 * set "screen_cleared" to TRUE. The special value MAYBE (which is still 1029 * non-zero and thus not FALSE) will indicate that screenclear() was not 1030 * called. */ 1031 if (screen_cleared) 1032 screen_cleared = MAYBE; 1033 1032 1034 /* 1033 1035 * If there are no changes on the screen that require a complete redraw, 1034 1036 * handle three cases: … … 1230 1232 mid_end = wp->w_height; 1231 1233 if (lastwin == firstwin) 1232 1234 { 1233 screenclear(); 1235 /* Clear the screen when it was not done by win_del_lines() or 1236 * win_ins_lines() above, "screen_cleared" is FALSE or MAYBE 1237 * then. */ 1238 if (screen_cleared != TRUE) 1239 screenclear(); 1234 1240 #ifdef FEAT_WINDOWS 1235 1241 /* The screen was cleared, redraw the tab pages line. */ 1236 1242 if (redraw_tabline) … … 1238 1244 #endif 1239 1245 } 1240 1246 } 1247 1248 /* When win_del_lines() or win_ins_lines() caused the screen to be 1249 * cleared (only happens for the first window) or when screenclear() 1250 * was called directly above, "must_redraw" will have been set to 1251 * NOT_VALID, need to reset it here to avoid redrawing twice. */ 1252 if (screen_cleared == TRUE) 1253 must_redraw = 0; 1241 1254 } 1242 1255 else 1243 1256 { … … 2292 2305 prev_c = u8c; 2293 2306 #endif 2294 2307 /* Non-BMP character: display as ? or fullwidth ?. */ 2308 #ifdef UNICODE16 2295 2309 if (u8c >= 0x10000) 2296 2310 ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?'; 2297 2311 else 2312 #endif 2298 2313 ScreenLinesUC[idx] = u8c; 2299 2314 for (i = 0; i < Screen_mco; ++i) 2300 2315 { … … 2542 2557 2543 2558 char_u extra[18]; /* "%ld" and 'fdc' must fit in here */ 2544 2559 int n_extra = 0; /* number of extra chars */ 2545 char_u *p_extra = NULL; /* string of extra chars */2560 char_u *p_extra = NULL; /* string of extra chars, plus NUL */ 2546 2561 int c_extra = NUL; /* extra chars, all the same */ 2547 2562 int extra_attr = 0; /* attributes when n_extra != 0 */ 2548 2563 static char_u *at_end_str = (char_u *)""; /* used for p_extra when … … 2626 2641 int line_attr = 0; /* atrribute for the whole line */ 2627 2642 #endif 2628 2643 #ifdef FEAT_SEARCH_EXTRA 2629 match_T *shl; /* points to search_hl or match_hl */ 2630 #endif 2631 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_MBYTE) 2632 int i; 2644 matchitem_T *cur; /* points to the match list */ 2645 match_T *shl; /* points to search_hl or a match */ 2646 int shl_flag; /* flag to indicate whether search_hl 2647 has been processed or not */ 2648 int prevcol_hl_flag; /* flag to indicate whether prevcol 2649 equals startcol of search_hl or one 2650 of the matches */ 2633 2651 #endif 2634 2652 #ifdef FEAT_ARABIC 2635 2653 int prev_c = 0; /* previous Arabic character */ … … 3074 3092 3075 3093 #ifdef FEAT_SEARCH_EXTRA 3076 3094 /* 3077 * Handle highlighting the last used search pattern and ":match".3078 * Do this for both search_hl and match_hl[3].3095 * Handle highlighting the last used search pattern and matches. 3096 * Do this for both search_hl and the match list. 3079 3097 */ 3080 for (i = 3; i >= 0; --i) 3098 cur = wp->w_match_head; 3099 shl_flag = FALSE; 3100 while (cur != NULL || shl_flag == FALSE) 3081 3101 { 3082 shl = (i == 3) ? &search_hl : &match_hl[i]; 3102 if (shl_flag == FALSE) 3103 { 3104 shl = &search_hl; 3105 shl_flag = TRUE; 3106 } 3107 else 3108 shl = &cur->hl; 3083 3109 shl->startcol = MAXCOL; 3084 3110 shl->endcol = MAXCOL; 3085 3111 shl->attr_cur = 0; … … 3122 3148 area_highlighting = TRUE; 3123 3149 } 3124 3150 } 3151 if (shl != &search_hl && cur != NULL) 3152 cur = cur->next; 3125 3153 } 3126 3154 #endif 3127 3155 … … 3163 3191 if (cmdwin_type != 0 && wp == curwin) 3164 3192 { 3165 3193 /* Draw the cmdline character. */ 3166 *extra = cmdwin_type;3167 3194 n_extra = 1; 3168 p_extra = extra; 3169 c_extra = NUL; 3195 c_extra = cmdwin_type; 3170 3196 char_attr = hl_attr(HLF_AT); 3171 3197 } 3172 3198 } … … 3182 3208 fill_foldcolumn(extra, wp, FALSE, lnum); 3183 3209 n_extra = wp->w_p_fdc; 3184 3210 p_extra = extra; 3211 p_extra[n_extra] = NUL; 3185 3212 c_extra = NUL; 3186 3213 char_attr = hl_attr(HLF_FC); 3187 3214 } … … 3388 3415 * After end, check for start/end of next match. 3389 3416 * When another match, have to check for start again. 3390 3417 * Watch out for matching an empty string! 3391 * Do this f irst for search_hl, then for match_hl, so that3392 * ":match" overrules 'hlsearch'.3418 * Do this for 'search_hl' and the match list (ordered by 3419 * priority). 3393 3420 */ 3394 3421 v = (long)(ptr - line); 3395 for (i = 3; i >= 0; --i) 3396 { 3397 shl = (i == 3) ? &search_hl : &match_hl[i]; 3422 cur = wp->w_match_head; 3423 shl_flag = FALSE; 3424 while (cur != NULL || shl_flag == FALSE) 3425 { 3426 if (shl_flag == FALSE 3427 && ((cur != NULL 3428 && cur->priority > SEARCH_HL_PRIORITY) 3429 || cur == NULL)) 3430 { 3431 shl = &search_hl; 3432 shl_flag = TRUE; 3433 } 3434 else 3435 shl = &cur->hl; 3398 3436 while (shl->rm.regprog != NULL) 3399 3437 { 3400 3438 if (shl->startcol != MAXCOL … … 3442 3480 } 3443 3481 break; 3444 3482 } 3483 if (shl != &search_hl && cur != NULL) 3484 cur = cur->next; 3445 3485 } 3446 3486 3447 /* ":match" highlighting overrules 'hlsearch' */ 3448 for (i = 0; i <= 3; ++i) 3449 if (i == 3) 3450 search_attr = search_hl.attr_cur; 3451 else if (match_hl[i].attr_cur != 0) 3487 /* Use attributes from match with highest priority among 3488 * 'search_hl' and the match list. */ 3489 search_attr = search_hl.attr_cur; 3490 cur = wp->w_match_head; 3491 shl_flag = FALSE; 3492 while (cur != NULL || shl_flag == FALSE) 3493 { 3494 if (shl_flag == FALSE 3495 && ((cur != NULL 3496 && cur->priority > SEARCH_HL_PRIORITY) 3497 || cur == NULL)) 3452 3498 { 3453 s earch_attr = match_hl[i].attr_cur;3454 break;3499 shl = &search_hl; 3500 shl_flag = TRUE; 3455 3501 } 3502 else 3503 shl = &cur->hl; 3504 if (shl->attr_cur != 0) 3505 search_attr = shl->attr_cur; 3506 if (shl != &search_hl && cur != NULL) 3507 cur = cur->next; 3508 } 3456 3509 } 3457 3510 #endif 3458 3511 3459 3512 #ifdef FEAT_DIFF 3460 3513 if (diff_hlf != (hlf_T)0) 3461 3514 { 3462 if (diff_hlf == HLF_CHD && ptr - line >= change_start) 3515 if (diff_hlf == HLF_CHD && ptr - line >= change_start 3516 && n_extra == 0) 3463 3517 diff_hlf = HLF_TXD; /* changed text */ 3464 if (diff_hlf == HLF_TXD && ptr - line > change_end) 3518 if (diff_hlf == HLF_TXD && ptr - line > change_end 3519 && n_extra == 0) 3465 3520 diff_hlf = HLF_CHD; /* changed line */ 3466 3521 line_attr = hl_attr(diff_hlf); 3467 3522 } … … 3496 3551 * Get the next character to put on the screen. 3497 3552 */ 3498 3553 /* 3499 * The 'extra' array contains the extra stuff that is inserted to 3500 * represent special characters (non-printable stuff). When all 3501 * characters are the same, c_extra is used. 3554 * The "p_extra" points to the extra stuff that is inserted to 3555 * represent special characters (non-printable stuff) and other 3556 * things. When all characters are the same, c_extra is used. 3557 * "p_extra" must end in a NUL to avoid mb_ptr2len() reads past 3558 * "p_extra[n_extra]". 3502 3559 * For the '$' of the 'list' option, n_extra == 1, p_extra == "". 3503 3560 */ 3504 3561 if (n_extra > 0) … … 3611 3668 * Draw it as a space with a composing char. */ 3612 3669 if (utf_iscomposing(mb_c)) 3613 3670 { 3671 int i; 3672 3614 3673 for (i = Screen_mco - 1; i > 0; --i) 3615 3674 u8cc[i] = u8cc[i - 1]; 3616 3675 u8cc[0] = mb_c; … … 3621 3680 if ((mb_l == 1 && c >= 0x80) 3622 3681 || (mb_l >= 1 && mb_c == 0) 3623 3682 || (mb_l > 1 && (!vim_isprintc(mb_c) 3624 || mb_c >= 0x10000))) 3683 # ifdef UNICODE16 3684 || mb_c >= 0x10000 3685 # endif 3686 ))) 3625 3687 { 3626 3688 /* 3627 3689 * Illegal UTF-8 byte: display as <xx>. 3628 3690 * Non-BMP character : display as ? or fullwidth ?. 3629 3691 */ 3692 # ifdef UNICODE16 3630 3693 if (mb_c < 0x10000) 3694 # endif 3631 3695 { 3632 3696 transchar_hex(extra, mb_c); 3633 3697 # ifdef FEAT_RIGHTLEFT … … 3635 3699 rl_mirror(extra); 3636 3700 # endif 3637 3701 } 3702 # ifdef UNICODE16 3638 3703 else if (utf_char2cells(mb_c) != 2) 3639 3704 STRCPY(extra, "?"); 3640 3705 else 3641 3706 /* 0xff1f in UTF-8: full-width '?' */ 3642 3707 STRCPY(extra, "\357\274\237"); 3708 # endif 3643 3709 3644 3710 p_extra = extra; 3645 3711 c = *p_extra; … … 3752 3818 * a '<' in the first column. */ 3753 3819 if (n_skip > 0 && mb_l > 1) 3754 3820 { 3755 extra[0] = '<';3756 p_extra = extra;3757 3821 n_extra = 1; 3758 c_extra = NUL;3822 c_extra = '<'; 3759 3823 c = ' '; 3760 3824 if (area_attr == 0 && search_attr == 0) 3761 3825 { … … 4254 4318 * highlight match at end of line. If it's beyond the last 4255 4319 * char on the screen, just overwrite that one (tricky!) Not 4256 4320 * needed when a '$' was displayed for 'list'. */ 4321 #ifdef FEAT_SEARCH_EXTRA 4322 prevcol_hl_flag = FALSE; 4323 if (prevcol == (long)search_hl.startcol) 4324 prevcol_hl_flag = TRUE; 4325 else 4326 { 4327 cur = wp->w_match_head; 4328 while (cur != NULL) 4329 { 4330 if (prevcol == (long)cur->hl.startcol) 4331 { 4332 prevcol_hl_flag = TRUE; 4333 break; 4334 } 4335 cur = cur->next; 4336 } 4337 } 4338 #endif 4257 4339 if (lcs_eol == lcs_eol_one 4258 4340 && ((area_attr != 0 && vcol == fromcol && c == NUL) 4259 4341 #ifdef FEAT_SEARCH_EXTRA 4260 4342 /* highlight 'hlsearch' match at end of line */ 4261 || ((prevcol == (long)search_hl.startcol 4262 || prevcol == (long)match_hl[0].startcol 4263 || prevcol == (long)match_hl[1].startcol 4264 || prevcol == (long)match_hl[2].startcol) 4343 || (prevcol_hl_flag == TRUE 4265 4344 # if defined(LINE_ATTR) 4266 4345 && did_line_attr <= 1 4267 4346 # endif … … 4302 4381 #ifdef FEAT_SEARCH_EXTRA 4303 4382 if (area_attr == 0) 4304 4383 { 4305 for (i = 0; i <= 3; ++i) 4306 { 4307 if (i == 3) 4308 char_attr = search_hl.attr; 4309 else if ((ptr - line) - 1 == (long)match_hl[i].startcol) 4384 /* Use attributes from match with highest priority among 4385 * 'search_hl' and the match list. */ 4386 char_attr = search_hl.attr; 4387 cur = wp->w_match_head; 4388 shl_flag = FALSE; 4389 while (cur != NULL || shl_flag == FALSE) 4390 { 4391 if (shl_flag == FALSE 4392 && ((cur != NULL 4393 && cur->priority > SEARCH_HL_PRIORITY) 4394 || cur == NULL)) 4310 4395 { 4311 char_attr = match_hl[i].attr;4312 break;4396 shl = &search_hl; 4397 shl_flag = TRUE; 4313 4398 } 4399 else 4400 shl = &cur->hl; 4401 if ((ptr - line) - 1 == (long)shl->startcol) 4402 char_attr = shl->attr; 4403 if (shl != &search_hl && cur != NULL) 4404 cur = cur->next; 4314 4405 } 4315 4406 } 4316 4407 #endif … … 4460 4551 { 4461 4552 if (mb_utf8) 4462 4553 { 4554 int i; 4555 4463 4556 ScreenLinesUC[off] = mb_c; 4464 4557 if ((c & 0xff) == 0) 4465 4558 ScreenLines[off] = 0x80; /* avoid storing zero */ … … 4548 4641 4549 4642 /* 4550 4643 * At end of screen line and there is more to come: Display the line 4551 * so far. If there is no more to display it is ca tchedabove.4644 * so far. If there is no more to display it is caught above. 4552 4645 */ 4553 4646 if (( 4554 4647 #ifdef FEAT_RIGHTLEFT … … 4625 4718 #endif 4626 4719 #ifdef FEAT_MBYTE 4627 4720 && !(has_mbyte 4628 && ((*mb_off2cells)(LineOffset[screen_row]) == 2 4721 && ((*mb_off2cells)(LineOffset[screen_row], 4722 LineOffset[screen_row] + screen_Columns) 4723 == 2 4629 4724 || (*mb_off2cells)(LineOffset[screen_row - 1] 4630 + (int)Columns - 2) == 2)) 4725 + (int)Columns - 2, 4726 LineOffset[screen_row] + screen_Columns) 4727 == 2)) 4631 4728 #endif 4632 4729 ) 4633 4730 { … … 4787 4884 { 4788 4885 unsigned off_from; 4789 4886 unsigned off_to; 4887 #ifdef FEAT_MBYTE 4888 unsigned max_off_from; 4889 unsigned max_off_to; 4890 #endif 4790 4891 int col = 0; 4791 4892 #if defined(FEAT_GUI) || defined(UNIX) || defined(FEAT_VERTSPLIT) 4792 4893 int hl; … … 4813 4914 4814 4915 off_from = (unsigned)(current_ScreenLine - ScreenLines); 4815 4916 off_to = LineOffset[row] + coloff; 4917 #ifdef FEAT_MBYTE 4918 max_off_from = off_from + screen_Columns; 4919 max_off_to = LineOffset[row] + screen_Columns; 4920 #endif 4816 4921 4817 4922 #ifdef FEAT_RIGHTLEFT 4818 4923 if (rlflag) … … 4847 4952 { 4848 4953 #ifdef FEAT_MBYTE 4849 4954 if (has_mbyte && (col + 1 < endcol)) 4850 char_cells = (*mb_off2cells)(off_from );4955 char_cells = (*mb_off2cells)(off_from, max_off_from); 4851 4956 else 4852 4957 char_cells = 1; 4853 4958 #endif … … 4924 5029 * ScreenLinesUC[] is sufficient. */ 4925 5030 if (char_cells == 1 4926 5031 && col + 1 < endcol 4927 && (*mb_off2cells)(off_to ) > 1)5032 && (*mb_off2cells)(off_to, max_off_to) > 1) 4928 5033 { 4929 5034 /* Writing a single-cell character over a double-cell 4930 5035 * character: need to redraw the next cell. */ … … 4933 5038 } 4934 5039 else if (char_cells == 2 4935 5040 && col + 2 < endcol 4936 && (*mb_off2cells)(off_to ) == 14937 && (*mb_off2cells)(off_to + 1 ) > 1)5041 && (*mb_off2cells)(off_to, max_off_to) == 1 5042 && (*mb_off2cells)(off_to + 1, max_off_to) > 1) 4938 5043 { 4939 5044 /* Writing the second half of a double-cell character over 4940 5045 * a double-cell character: need to redraw the second … … 4953 5058 * char over the left halve of an existing one. */ 4954 5059 if (has_mbyte && col + char_cells == endcol 4955 5060 && ((char_cells == 1 4956 && (*mb_off2cells)(off_to ) > 1)5061 && (*mb_off2cells)(off_to, max_off_to) > 1) 4957 5062 || (char_cells == 2 4958 && (*mb_off2cells)(off_to ) == 14959 && (*mb_off2cells)(off_to + 1 ) > 1)))5063 && (*mb_off2cells)(off_to, max_off_to) == 1 5064 && (*mb_off2cells)(off_to + 1, max_off_to) > 1))) 4960 5065 clear_next = TRUE; 4961 5066 #endif 4962 5067 … … 5096 5201 /* find previous character by counting from first 5097 5202 * column and get its width. */ 5098 5203 unsigned off = LineOffset[row]; 5204 unsigned max_off = LineOffset[row] + screen_Columns; 5099 5205 5100 5206 while (off < off_to) 5101 5207 { 5102 prev_cells = (*mb_off2cells)(off );5208 prev_cells = (*mb_off2cells)(off, max_off); 5103 5209 off += prev_cells; 5104 5210 } 5105 5211 } … … 5285 5391 static int skip_status_match_char __ARGS((expand_T *xp, char_u *s)); 5286 5392 5287 5393 /* 5288 * Get the leng htof an item as it will be shown in the status line.5394 * Get the length of an item as it will be shown in the status line. 5289 5395 */ 5290 5396 static int 5291 5397 status_match_len(xp, s) … … 5351 5457 int row; 5352 5458 char_u *buf; 5353 5459 int len; 5354 int clen; /* leng htin screen cells */5460 int clen; /* length in screen cells */ 5355 5461 int fillchar; 5356 5462 int attr; 5357 5463 int i; … … 6103 6209 char_u *ptr = text; 6104 6210 int c; 6105 6211 #ifdef FEAT_MBYTE 6212 unsigned max_off; 6106 6213 int mbyte_blen = 1; 6107 6214 int mbyte_cells = 1; 6108 6215 int u8c = 0; … … 6119 6226 return; 6120 6227 6121 6228 off = LineOffset[row] + col; 6122 while (*ptr != NUL && col < screen_Columns 6123 && (len < 0 || (int)(ptr - text) < len)) 6229 #ifdef FEAT_MBYTE 6230 max_off = LineOffset[row] + screen_Columns; 6231 #endif 6232 while (col < screen_Columns 6233 && (len < 0 || (int)(ptr - text) < len) 6234 && *ptr != NUL) 6124 6235 { 6125 6236 c = *ptr; 6126 6237 #ifdef FEAT_MBYTE … … 6143 6254 else 6144 6255 u8c = utfc_ptr2char(ptr, u8cc); 6145 6256 mbyte_cells = utf_char2cells(u8c); 6257 # ifdef UNICODE16 6146 6258 /* Non-BMP character: display as ? or fullwidth ?. */ 6147 6259 if (u8c >= 0x10000) 6148 6260 { … … 6150 6262 if (attr == 0) 6151 6263 attr = hl_attr(HLF_8); 6152 6264 } 6265 # endif 6153 6266 # ifdef FEAT_ARABIC 6154 6267 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) 6155 6268 { … … 6241 6354 else if (has_mbyte 6242 6355 && (len < 0 ? ptr[mbyte_blen] == NUL 6243 6356 : ptr + mbyte_blen >= text + len) 6244 && ((mbyte_cells == 1 && (*mb_off2cells)(off ) > 1)6357 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1) 6245 6358 || (mbyte_cells == 2 6246 && (*mb_off2cells)(off ) == 16247 && (*mb_off2cells)(off + 1 ) > 1)))6359 && (*mb_off2cells)(off, max_off) == 1 6360 && (*mb_off2cells)(off + 1, max_off) > 1))) 6248 6361 clear_next_cell = TRUE; 6249 6362 6250 6363 /* Make sure we never leave a second byte of a double-byte behind, 6251 6364 * it confuses mb_off2cells(). */ 6252 6365 if (enc_dbcs 6253 && ((mbyte_cells == 1 && (*mb_off2cells)(off ) > 1)6366 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1) 6254 6367 || (mbyte_cells == 2 6255 && (*mb_off2cells)(off ) == 16256 && (*mb_off2cells)(off + 1 ) > 1)))6368 && (*mb_off2cells)(off, max_off) == 1 6369 && (*mb_off2cells)(off + 1, max_off) > 1))) 6257 6370 ScreenLines[off + mbyte_blen] = 0; 6258 6371 #endif 6259 6372 ScreenLines[off] = c; … … 6318 6431 6319 6432 #ifdef FEAT_SEARCH_EXTRA 6320 6433 /* 6321 * Prepare for ' searchhl' highlighting.6434 * Prepare for 'hlsearch' highlighting. 6322 6435 */ 6323 6436 static void 6324 6437 start_search_hl() … … 6331 6444 } 6332 6445 6333 6446 /* 6334 * Clean up for ' searchhl' highlighting.6447 * Clean up for 'hlsearch' highlighting. 6335 6448 */ 6336 6449 static void 6337 6450 end_search_hl() … … 6351 6464 win_T *wp; 6352 6465 linenr_T lnum; 6353 6466 { 6354 match_T *shl; /* points to search_hl or match_hl */ 6467 matchitem_T *cur; /* points to the match list */ 6468 match_T *shl; /* points to search_hl or a match */ 6469 int shl_flag; /* flag to indicate whether search_hl 6470 has been processed or not */ 6355 6471 int n; 6356 int i;6357 6472 6358 6473 /* 6359 6474 * When using a multi-line pattern, start searching at the top 6360 6475 * of the window or just after a closed fold. 6361 * Do this both for search_hl and match_hl[3].6476 * Do this both for search_hl and the match list. 6362 6477 */ 6363 for (i = 3; i >= 0; --i) 6478 cur = wp->w_match_head; 6479 shl_flag = FALSE; 6480 while (cur != NULL || shl_flag == FALSE) 6364 6481 { 6365 shl = (i == 3) ? &search_hl : &match_hl[i]; 6482 if (shl_flag == FALSE) 6483 { 6484 shl = &search_hl; 6485 shl_flag = TRUE; 6486 } 6487 else 6488 shl = &cur->hl; 6366 6489 if (shl->rm.regprog != NULL 6367 6490 && shl->lnum == 0 6368 6491 && re_multiline(shl->rm.regprog)) … … 6397 6520 } 6398 6521 } 6399 6522 } 6523 if (shl != &search_hl && cur != NULL) 6524 cur = cur->next; 6400 6525 } 6401 6526 } 6402 6527 6403 6528 /* 6404 * Search for a next ' searchl' or ":match"match.6529 * Search for a next 'hlsearch' or match. 6405 6530 * Uses shl->buf. 6406 6531 * Sets shl->lnum and shl->rm contents. 6407 6532 * Note: Assumes a previous match is always before "lnum", unless … … 6411 6536 static void 6412 6537 next_search_hl(win, shl, lnum, mincol) 6413 6538 win_T *win; 6414 match_T *shl; /* points to search_hl or match_hl*/6539 match_T *shl; /* points to search_hl or a match */ 6415 6540 linenr_T lnum; 6416 6541 colnr_T mincol; /* minimal column for a match */ 6417 6542 { … … 6479 6604 /* Error while handling regexp: stop using this regexp. */ 6480 6605 if (shl == &search_hl) 6481 6606 { 6482 /* don't free the regprog in match_hl[], it's a copy */6607 /* don't free regprog in the match list, it's a copy */ 6483 6608 vim_free(shl->rm.regprog); 6484 6609 no_hlsearch = TRUE; 6485 6610 } … … 6827 6952 { 6828 6953 int r, c; 6829 6954 int off; 6955 #ifdef FEAT_MBYTE 6956 int max_off; 6957 #endif 6830 6958 6831 6959 /* Can't use ScreenLines unless initialized */ 6832 6960 if (ScreenLines == NULL) … … 6837 6965 for (r = row; r < row + height; ++r) 6838 6966 { 6839 6967 off = LineOffset[r]; 6968 #ifdef FEAT_MBYTE 6969 max_off = off + screen_Columns; 6970 #endif 6840 6971 for (c = col; c < col + width; ++c) 6841 6972 { 6842 6973 #ifdef FEAT_MBYTE 6843 if (enc_dbcs != 0 && dbcs_off2cells(off + c ) > 1)6974 if (enc_dbcs != 0 && dbcs_off2cells(off + c, max_off) > 1) 6844 6975 { 6845 6976 screen_char_2(off + c, r, c); 6846 6977 ++c; … … 6850 6981 { 6851 6982 screen_char(off + c, r, c); 6852 6983 #ifdef FEAT_MBYTE 6853 if (utf_off2cells(off + c ) > 1)6984 if (utf_off2cells(off + c, max_off) > 1) 6854 6985 ++c; 6855 6986 #endif 6856 6987 } -
src/search.c
diff -Naur vim71.orig/src/search.c vim71/src/search.c
old new 101 101 static char_u *mr_pattern = NULL; /* pattern used by search_regcomp() */ 102 102 #ifdef FEAT_RIGHTLEFT 103 103 static int mr_pattern_alloced = FALSE; /* mr_pattern was allocated */ 104 static char_u *reverse_text __ARGS((char_u *s));105 104 #endif 106 105 107 106 #ifdef FEAT_FIND_ID … … 228 227 return mr_pattern; 229 228 } 230 229 231 #if def FEAT_RIGHTLEFT230 #if defined(FEAT_RIGHTLEFT) || defined(PROTO) 232 231 /* 233 232 * Reverse text into allocated memory. 234 233 * Returns the allocated string, NULL when out of memory. 235 234 */ 236 staticchar_u *235 char_u * 237 236 reverse_text(s) 238 237 char_u *s; 239 238 { … … 573 572 /* 574 573 * Start searching in current line, unless searching backwards and 575 574 * we're in column 0. 575 * If we are searching backwards, in column 0, and not including the 576 * current position, gain some efficiency by skipping back a line. 577 * Otherwise begin the search in the current line. 576 578 */ 577 if (dir == BACKWARD && start_pos.col == 0) 579 if (dir == BACKWARD && start_pos.col == 0 580 && (options & SEARCH_START) == 0) 578 581 { 579 582 lnum = pos->lnum - 1; 580 583 at_first_line = FALSE; … … 1894 1897 } 1895 1898 1896 1899 #ifdef FEAT_RIGHTLEFT 1897 /* This is just guessing: when 'rightleft' is set, search for a ma ching1900 /* This is just guessing: when 'rightleft' is set, search for a matching 1898 1901 * paren/brace in the other direction. */ 1899 1902 if (curwin->w_p_rl && vim_strchr((char_u *)"()[]{}<>", initc) != NULL) 1900 1903 backwards = !backwards; … … 2124 2127 else if (!backwards) 2125 2128 inquote = TRUE; 2126 2129 } 2130 2131 /* ml_get() only keeps one line, need to get linep again */ 2132 linep = ml_get(pos.lnum); 2127 2133 } 2128 2134 } 2129 2135 } … … 2795 2801 i = inc_cursor(); 2796 2802 if (i == -1 || (i >= 1 && last_line)) /* started at last char in file */ 2797 2803 return FAIL; 2798 if (i == 1 && eol && count == 0) /* started at last char in line */2804 if (i >= 1 && eol && count == 0) /* started at last char in line */ 2799 2805 return OK; 2800 2806 2801 2807 /* … … 3600 3606 { 3601 3607 oap->start = start_pos; 3602 3608 oap->motion_type = MCHAR; 3609 oap->inclusive = FALSE; 3603 3610 if (sol) 3604 {3605 3611 incl(&curwin->w_cursor); 3606 oap->inclusive = FALSE; 3607 } 3608 else 3612 else if (lt(start_pos, curwin->w_cursor)) 3613 /* Include the character under the cursor. */ 3609 3614 oap->inclusive = TRUE; 3615 else 3616 /* End is before the start (no text in between <>, [], etc.): don't 3617 * operate on any text. */ 3618 curwin->w_cursor = start_pos; 3610 3619 } 3611 3620 3612 3621 return OK; … … 3734 3743 3735 3744 if (in_html_tag(FALSE)) 3736 3745 { 3737 /* cursor on start tag, move to just after it*/3746 /* cursor on start tag, move to its '>' */ 3738 3747 while (*ml_get_cursor() != '>') 3739 3748 if (inc_cursor() < 0) 3740 3749 break; … … 3838 3847 /* Exclude the start tag. */ 3839 3848 curwin->w_cursor = start_pos; 3840 3849 while (inc_cursor() >= 0) 3841 if (*ml_get_cursor() == '>' && lt(curwin->w_cursor, end_pos))3850 if (*ml_get_cursor() == '>') 3842 3851 { 3843 3852 inc_cursor(); 3844 3853 start_pos = curwin->w_cursor; … … 3860 3869 #ifdef FEAT_VISUAL 3861 3870 if (VIsual_active) 3862 3871 { 3863 if (*p_sel == 'e') 3872 /* If the end is before the start there is no text between tags, select 3873 * the char under the cursor. */ 3874 if (lt(end_pos, start_pos)) 3875 curwin->w_cursor = start_pos; 3876 else if (*p_sel == 'e') 3864 3877 ++curwin->w_cursor.col; 3865 3878 VIsual = start_pos; 3866 3879 VIsual_mode = 'v'; … … 3872 3885 { 3873 3886 oap->start = start_pos; 3874 3887 oap->motion_type = MCHAR; 3875 oap->inclusive = TRUE; 3888 if (lt(end_pos, start_pos)) 3889 { 3890 /* End is before the start: there is no text between tags; operate 3891 * on an empty area. */ 3892 curwin->w_cursor = start_pos; 3893 oap->inclusive = FALSE; 3894 } 3895 else 3896 oap->inclusive = TRUE; 3876 3897 } 3877 3898 retval = OK; 3878 3899 -
src/spell.c
diff -Naur vim71.orig/src/spell.c vim71/src/spell.c
old new 7829 7829 # if (_MSC_VER <= 1200) 7830 7830 /* This line is required for VC6 without the service pack. Also see the 7831 7831 * matching #pragma below. */ 7832 /* # pragma optimize("", off) */ 7832 # pragma optimize("", off) 7833 7833 # endif 7834 7834 #endif 7835 7835 … … 7859 7859 7860 7860 #ifdef _MSC_VER 7861 7861 # if (_MSC_VER <= 1200) 7862 /* # pragma optimize("", on) */ 7862 # pragma optimize("", on) 7863 7863 # endif 7864 7864 #endif 7865 7865 … … 12182 12182 { 12183 12183 n = mb_cptr2len(p); 12184 12184 c = mb_ptr2char(p); 12185 if (!soundfold && !spell_iswordp(p + n, curbuf)) 12185 if (p[n] == NUL) 12186 c2 = NUL; 12187 else if (!soundfold && !spell_iswordp(p + n, curbuf)) 12186 12188 c2 = c; /* don't swap non-word char */ 12187 12189 else 12188 12190 c2 = mb_ptr2char(p + n); … … 12190 12192 else 12191 12193 #endif 12192 12194 { 12193 if (!soundfold && !spell_iswordp(p + 1, curbuf)) 12195 if (p[1] == NUL) 12196 c2 = NUL; 12197 else if (!soundfold && !spell_iswordp(p + 1, curbuf)) 12194 12198 c2 = c; /* don't swap non-word char */ 12195 12199 else 12196 12200 c2 = p[1]; 12197 12201 } 12198 12202 12203 /* When the second character is NUL we can't swap. */ 12204 if (c2 == NUL) 12205 { 12206 sp->ts_state = STATE_REP_INI; 12207 break; 12208 } 12209 12199 12210 /* When characters are identical, swap won't do anything. 12200 12211 * Also get here if the second char is not a word character. */ 12201 12212 if (c == c2) -
src/structs.h
diff -Naur vim71.orig/src/structs.h vim71/src/structs.h
old new 278 278 linenr_T ue_lcount; /* linecount when u_save called */ 279 279 char_u **ue_array; /* array of lines in undo block */ 280 280 long ue_size; /* number of lines in ue_array */ 281 #ifdef U_DEBUG 282 int ue_magic; /* magic number to check allocation */ 283 #endif 281 284 }; 282 285 283 286 struct u_header … … 300 303 visualinfo_T uh_visual; /* Visual areas before undo/after redo */ 301 304 #endif 302 305 time_t uh_time; /* timestamp when the change was made */ 306 #ifdef U_DEBUG 307 int uh_magic; /* magic number to check allocation */ 308 #endif 303 309 }; 304 310 305 311 /* values for uh_flags */ … … 1453 1459 #ifdef FEAT_MBYTE 1454 1460 char_u *b_start_fenc; /* 'fileencoding' when edit started or NULL */ 1455 1461 int b_bad_char; /* "++bad=" argument when edit started or 0 */ 1462 int b_start_bomb; /* 'bomb' when it was read */ 1456 1463 #endif 1457 1464 1458 1465 #ifdef FEAT_EVAL … … 1694 1701 #define FR_COL 2 /* frame with a column of windows */ 1695 1702 1696 1703 /* 1704 * Struct used for highlighting 'hlsearch' matches, matches defined by 1705 * ":match" and matches defined by match functions. 1706 * For 'hlsearch' there is one pattern for all windows. For ":match" and the 1707 * match functions there is a different pattern for each window. 1708 */ 1709 typedef struct 1710 { 1711 regmmatch_T rm; /* points to the regexp program; contains last found 1712 match (may continue in next line) */ 1713 buf_T *buf; /* the buffer to search for a match */ 1714 linenr_T lnum; /* the line to search for a match */ 1715 int attr; /* attributes to be used for a match */ 1716 int attr_cur; /* attributes currently active in win_line() */ 1717 linenr_T first_lnum; /* first lnum to search for multi-line pat */ 1718 colnr_T startcol; /* in win_line() points to char where HL starts */ 1719 colnr_T endcol; /* in win_line() points to char where HL ends */ 1720 } match_T; 1721 1722 /* 1723 * matchitem_T provides a linked list for storing match items for ":match" and 1724 * the match functions. 1725 */ 1726 typedef struct matchitem matchitem_T; 1727 struct matchitem 1728 { 1729 matchitem_T *next; 1730 int id; /* match ID */ 1731 int priority; /* match priority */ 1732 char_u *pattern; /* pattern to highlight */ 1733 int hlg_id; /* highlight group ID */ 1734 regmmatch_T match; /* regexp program for pattern */ 1735 match_T hl; /* struct for doing the actual highlighting */ 1736 }; 1737 1738 /* 1697 1739 * Structure which contains all information that belongs to a window 1698 1740 * 1699 1741 * All row numbers are relative to the start of the window, except w_winrow. … … 1934 1976 #endif 1935 1977 1936 1978 #ifdef FEAT_SEARCH_EXTRA 1937 regmmatch_T w_match[3]; /* regexp programs for ":match" */ 1938 char_u *(w_match_pat[3]); /* patterns for ":match" */ 1939 int w_match_id[3]; /* highlight IDs for ":match" */ 1979 matchitem_T *w_match_head; /* head of match list */ 1980 int w_next_match_id; /* next match ID */ 1940 1981 #endif 1941 1982 1942 1983 /* -
src/syntax.c
diff -Naur vim71.orig/src/syntax.c vim71/src/syntax.c
old new 66 66 #define HL_TABLE() ((struct hl_group *)((highlight_ga.ga_data))) 67 67 68 68 #ifdef FEAT_CMDL_COMPL 69 static int include_default = FALSE; /* include "default" for expansion */ 70 static int include_link = FALSE; /* include "link" for expansion */ 69 /* Flags to indicate an additional string for highlight name completion. */ 70 static int include_none = 0; /* when 1 include "None" */ 71 static int include_default = 0; /* when 1 include "default" */ 72 static int include_link = 0; /* when 2 include "link" and "clear" */ 71 73 #endif 72 74 73 75 /* … … 277 279 */ 278 280 typedef struct state_item 279 281 { 280 int si_idx; /* index of syntax pattern */ 282 int si_idx; /* index of syntax pattern or 283 KEYWORD_IDX */ 281 284 int si_id; /* highlight group ID for keywords */ 282 285 int si_trans_id; /* idem, transparancy removed */ 283 286 int si_m_lnum; /* lnum of the match */ … … 835 838 current_lnum = end_lnum; 836 839 break; 837 840 } 838 spp = &(SYN_ITEMS(syn_buf)[cur_si->si_idx]); 839 found_flags = spp->sp_flags; 840 found_match_idx = spp->sp_sync_idx; 841 if (cur_si->si_idx < 0) 842 { 843 /* Cannot happen? */ 844 found_flags = 0; 845 found_match_idx = KEYWORD_IDX; 846 } 847 else 848 { 849 spp = &(SYN_ITEMS(syn_buf)[cur_si->si_idx]); 850 found_flags = spp->sp_flags; 851 found_match_idx = spp->sp_sync_idx; 852 } 841 853 found_current_lnum = current_lnum; 842 854 found_current_col = current_col; 843 855 found_m_endpos = cur_si->si_m_endpos; … … 1725 1737 { 1726 1738 int attr = 0; 1727 1739 1740 if (can_spell != NULL) 1741 /* Default: Only do spelling when there is no @Spell cluster or when 1742 * ":syn spell toplevel" was used. */ 1743 *can_spell = syn_buf->b_syn_spell == SYNSPL_DEFAULT 1744 ? (syn_buf->b_spell_cluster_id == 0) 1745 : (syn_buf->b_syn_spell == SYNSPL_TOP); 1746 1728 1747 /* check for out of memory situation */ 1729 1748 if (syn_buf->b_sst_array == NULL) 1730 1749 return 0; … … 2524 2543 stateitem_T *sip = &CUR_STATE(idx); 2525 2544 synpat_T *spp; 2526 2545 2546 /* This should not happen... */ 2547 if (sip->si_idx < 0) 2548 return; 2549 2527 2550 spp = &(SYN_ITEMS(syn_buf)[sip->si_idx]); 2528 2551 if (sip->si_flags & HL_MATCH) 2529 2552 sip->si_id = spp->sp_syn_match_id; … … 2639 2662 lpos_T end_endpos; 2640 2663 int end_idx; 2641 2664 2665 /* return quickly for a keyword */ 2666 if (sip->si_idx < 0) 2667 return; 2668 2642 2669 /* Don't update when it's already done. Can be a match of an end pattern 2643 2670 * that started in a previous line. Watch out: can also be a "keepend" 2644 2671 * from a containing item. */ … … 2751 2778 char_u *line; 2752 2779 int had_match = FALSE; 2753 2780 2781 /* just in case we are invoked for a keyword */ 2782 if (idx < 0) 2783 return; 2784 2754 2785 /* 2755 2786 * Check for being called with a START pattern. 2756 2787 * Can happen with a match that continues to the next line, because it … … 3323 3354 { 3324 3355 vim_free(SYN_ITEMS(buf)[i].sp_cont_list); 3325 3356 vim_free(SYN_ITEMS(buf)[i].sp_next_list); 3357 vim_free(SYN_ITEMS(buf)[i].sp_syn.cont_in_list); 3326 3358 } 3327 3359 } 3328 3360 … … 4460 4492 current_syn_inc_tag = ++running_syn_inc_tag; 4461 4493 prev_toplvl_grp = curbuf->b_syn_topgrp; 4462 4494 curbuf->b_syn_topgrp = sgl_id; 4463 if (source ? do_source(eap->arg, FALSE, FALSE) == FAIL4464 : source_runtime(eap->arg, DOSO_NONE) == FAIL)4495 if (source ? do_source(eap->arg, FALSE, DOSO_NONE) == FAIL 4496 : source_runtime(eap->arg, TRUE) == FAIL) 4465 4497 EMSG2(_(e_notopen), eap->arg); 4466 4498 curbuf->b_syn_topgrp = prev_toplvl_grp; 4467 4499 current_syn_inc_tag = prev_syn_inc_tag; … … 5956 5988 { 5957 5989 return (buf->b_syn_patterns.ga_len != 0 5958 5990 || buf->b_syn_clusters.ga_len != 0 5959 || curbuf->b_keywtab.ht_used > 05960 || curbuf->b_keywtab_ic.ht_used > 0);5991 || buf->b_keywtab.ht_used > 0 5992 || buf->b_keywtab_ic.ht_used > 0); 5961 5993 } 5962 5994 5963 5995 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) … … 5968 6000 EXP_CASE /* expand ":syn case" arguments */ 5969 6001 } expand_what; 5970 6002 6003 /* 6004 * Reset include_link, include_default, include_none to 0. 6005 * Called when we are done expanding. 6006 */ 6007 void 6008 reset_expand_highlight() 6009 { 6010 include_link = include_default = include_none = 0; 6011 } 6012 6013 /* 6014 * Handle command line completion for :match and :echohl command: Add "None" 6015 * as highlight group. 6016 */ 6017 void 6018 set_context_in_echohl_cmd(xp, arg) 6019 expand_T *xp; 6020 char_u *arg; 6021 { 6022 xp->xp_context = EXPAND_HIGHLIGHT; 6023 xp->xp_pattern = arg; 6024 include_none = 1; 6025 } 5971 6026 5972 6027 /* 5973 6028 * Handle command line completion for :syntax command. … … 5983 6038 xp->xp_context = EXPAND_SYNTAX; 5984 6039 expand_what = EXP_SUBCMD; 5985 6040 xp->xp_pattern = arg; 5986 include_link = FALSE;5987 include_default = FALSE;6041 include_link = 0; 6042 include_default = 0; 5988 6043 5989 6044 /* (part of) subcommand already typed */ 5990 6045 if (*arg != NUL) … … 8479 8534 syn_id2name(id) 8480 8535 int id; 8481 8536 { 8482 if (id <= 0 || id > =highlight_ga.ga_len)8537 if (id <= 0 || id > highlight_ga.ga_len) 8483 8538 return (char_u *)""; 8484 8539 return HL_TABLE()[id - 1].sg_name; 8485 8540 } … … 8949 9004 return OK; 8950 9005 } 8951 9006 8952 #if def FEAT_CMDL_COMPL9007 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) 8953 9008 8954 9009 static void highlight_list __ARGS((void)); 8955 9010 static void highlight_list_two __ARGS((int cnt, int attr)); … … 8967 9022 /* Default: expand group names */ 8968 9023 xp->xp_context = EXPAND_HIGHLIGHT; 8969 9024 xp->xp_pattern = arg; 8970 include_link = TRUE;8971 include_default = TRUE;9025 include_link = 2; 9026 include_default = 1; 8972 9027 8973 9028 /* (part of) subcommand already typed */ 8974 9029 if (*arg != NUL) … … 8976 9031 p = skiptowhite(arg); 8977 9032 if (*p != NUL) /* past "default" or group name */ 8978 9033 { 8979 include_default = FALSE;9034 include_default = 0; 8980 9035 if (STRNCMP("default", arg, p - arg) == 0) 8981 9036 { 8982 9037 arg = skipwhite(p); … … 8985 9040 } 8986 9041 if (*p != NUL) /* past group name */ 8987 9042 { 8988 include_link = FALSE;9043 include_link = 0; 8989 9044 if (arg[1] == 'i' && arg[0] == 'N') 8990 9045 highlight_list(); 8991 9046 if (STRNCMP("link", arg, p - arg) == 0 … … 9045 9100 expand_T *xp; 9046 9101 int idx; 9047 9102 { 9048 if (idx == highlight_ga.ga_len9049 9103 #ifdef FEAT_CMDL_COMPL 9050 && include_link 9051 #endif 9052 ) 9104 if (idx == highlight_ga.ga_len && include_none != 0) 9105 return (char_u *)"none"; 9106 if (idx == highlight_ga.ga_len + include_none && include_default != 0) 9107 return (char_u *)"default"; 9108 if (idx == highlight_ga.ga_len + include_none + include_default 9109 && include_link != 0) 9053 9110 return (char_u *)"link"; 9054 if (idx == highlight_ga.ga_len + 1 9055 #ifdef FEAT_CMDL_COMPL 9056 && include_link 9057 #endif 9058 ) 9111 if (idx == highlight_ga.ga_len + include_none + include_default + 1 9112 && include_link != 0) 9059 9113 return (char_u *)"clear"; 9060 if (idx == highlight_ga.ga_len + 29061 #ifdef FEAT_CMDL_COMPL9062 && include_default9063 9114 #endif 9064 )9065 return (char_u *)"default";9066 9115 if (idx < 0 || idx >= highlight_ga.ga_len) 9067 9116 return NULL; 9068 9117 return HL_TABLE()[idx].sg_name; 9069 9118 } 9070 9119 #endif 9071 9120 9072 #if def FEAT_GUI9121 #if defined(FEAT_GUI) || defined(PROTO) 9073 9122 /* 9074 9123 * Free all the highlight group fonts. 9075 9124 * Used when quitting for systems which need it. -
src/term.c
diff -Naur vim71.orig/src/term.c vim71/src/term.c
old new 4809 4809 if (num_bytes == -1) 4810 4810 return -1; 4811 4811 current_tab = (int)bytes[0]; 4812 if (current_tab == 255) /* -1 in a byte gives 255 */ 4813 current_tab = -1; 4812 4814 slen += num_bytes; 4813 4815 } 4814 4816 else if (key_name[0] == (int)KS_TABMENU) -
src/termlib.c
diff -Naur vim71.orig/src/termlib.c vim71/src/termlib.c
old new 191 191 lbuf[0] == '\t' && 192 192 lbuf[1] == ':') 193 193 { 194 strcpy(lbuf, lbuf+2);194 mch_memmove(lbuf, lbuf + 2, strlen(lbuf + 2) + 1); 195 195 llen -= 2; 196 196 } 197 197 if (lbuf[llen-2] == '\\') /* and continuations */ -
src/testdir/Makefile
diff -Naur vim71.orig/src/testdir/Makefile vim71/src/testdir/Makefile
old new 1 1 # 2 # Makefile to run al tests for Vim2 # Makefile to run all tests for Vim 3 3 # 4 4 5 5 VIMPROG = ../vim 6 6 7 # Uncomment this line for using valgrind. 8 # The output goes into a file "valgrind.$PID" (sorry, no test number). 9 # VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --logfile=valgrind 10 7 11 SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ 8 12 test7.out test8.out test9.out test10.out test11.out \ 9 13 test12.out test13.out test14.out test15.out test17.out \ … … 15 19 test43.out test44.out test45.out test46.out test47.out \ 16 20 test48.out test49.out test51.out test52.out test53.out \ 17 21 test54.out test55.out test56.out test57.out test58.out \ 18 test59.out test60.out test61.out test62.out 22 test59.out test60.out test61.out test62.out test63.out \ 23 test64.out 19 24 20 25 SCRIPTS_GUI = test16.out 21 26 … … 34 39 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG) 35 40 36 41 clean: 37 -rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim test.ok X* v iminfo42 -rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim test.ok X* valgrind.pid* viminfo 38 43 39 44 test1.out: test1.in 40 45 -rm -f $*.failed tiny.vim small.vim mbyte.vim test.ok X* viminfo 41 $(V IMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in46 $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in 42 47 @/bin/sh -c "if diff test.out $*.ok; \ 43 48 then mv -f test.out $*.out; \ 44 49 else echo; \ … … 51 56 cp $*.ok test.ok 52 57 # Sleep a moment to avoid that the xterm title is messed up 53 58 @-sleep .2 54 -$(V IMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in59 -$(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in 55 60 @/bin/sh -c "if test -f test.out; then\ 56 61 if diff test.out $*.ok; \ 57 62 then mv -f test.out $*.out; \ … … 61 66 fi" 62 67 -rm -rf X* test.ok viminfo 63 68 69 test49.out: test49.vim 70 71 test60.out: test60.vim 72 64 73 nolog: 65 74 -echo Test results: >test.log -
src/testdir/test14.in
diff -Naur vim71.orig/src/testdir/test14.in vim71/src/testdir/test14.in
old new 18 18 : let tt = "o\<C-V>65\<C-V>x42\<C-V>o103 \<C-V>33a\<C-V>xfg\<C-V>o78\<Esc>" 19 19 :endif 20 20 :exe "normal " . tt 21 :unlet tt 21 22 :.w >>test.out 22 23 :set vb 23 24 /^Piece -
src/testdir/test26.in
diff -Naur vim71.orig/src/testdir/test26.in vim71/src/testdir/test26.in
old new 37 37 : endif 38 38 : endif 39 39 :endwhile 40 :unlet i j 40 41 :'t,$w! test.out 41 42 :qa! 42 43 ENDTEST -
src/testdir/test34.in
diff -Naur vim71.orig/src/testdir/test34.in vim71/src/testdir/test34.in
old new 52 52 ---*--- 53 53 (one 54 54 (two 55 [(one again:$-5,$wq! test.out 55 [(one again:$-5,$w! test.out 56 :delfunc Table 57 :delfunc Compute 58 :delfunc Expr1 59 :delfunc Expr2 60 :delfunc ListItem 61 :delfunc ListReset 62 :unlet retval counter 63 :q! 56 64 ENDTEST 57 65 58 66 here -
src/testdir/test45.in
diff -Naur vim71.orig/src/testdir/test45.in vim71/src/testdir/test45.in
old new 55 55 /kk$ 56 56 :call append("$", foldlevel(".")) 57 57 :/^last/+1,$w! test.out 58 :delfun Flvl 58 59 :qa! 59 60 ENDTEST 60 61 -
src/testdir/test47.in
diff -Naur vim71.orig/src/testdir/test47.in vim71/src/testdir/test47.in
old new 34 34 :call append("$", two) 35 35 :call append("$", three) 36 36 :$-2,$w! test.out 37 :unlet one two three 37 38 :qa! 38 39 ENDTEST 39 40 -
src/testdir/test49.in
diff -Naur vim71.orig/src/testdir/test49.in vim71/src/testdir/test49.in
old new 1 1 This is a test of the script language. 2 2 3 3 If after adding a new test, the test output doesn't appear properly in 4 test49.failed, try to add one ore more "G"s at the line before ENDTEST.4 test49.failed, try to add one ore more "G"s at the line ending in "test.out" 5 5 6 6 STARTTEST 7 7 :so small.vim 8 8 :se nocp nomore viminfo+=nviminfo 9 9 :so test49.vim 10 GGGGGGGGGG"rp:.-,$wq! test.out 10 GGGGGGGGGGGGGG"rp:.-,$w! test.out 11 :" 12 :" make valgrind happy 13 :redir => funclist 14 :silent func 15 :redir END 16 :for line in split(funclist, "\n") 17 : let name = matchstr(line, 'function \zs[A-Z]\w*\ze(') 18 : if name != '' 19 : exe "delfunc " . name 20 : endif 21 :endfor 22 :for v in keys(g:) 23 : silent! exe "unlet " . v 24 :endfor 25 :unlet v 26 :qa! 11 27 ENDTEST 12 28 13 29 Results of test49.vim: -
src/testdir/test55.in
diff -Naur vim71.orig/src/testdir/test55.in vim71/src/testdir/test55.in
old new 345 345 :endfun 346 346 :call Test(1, 2, [3, 4], {5: 6}) " This may take a while 347 347 :" 348 :delfunc Test 349 :unlet dict 350 :call garbagecollect(1) 351 :" 348 352 :/^start:/,$wq! test.out 349 353 ENDTEST 350 354 -
src/testdir/test56.in
diff -Naur vim71.orig/src/testdir/test56.in vim71/src/testdir/test56.in
old new 17 17 fun s:DoNothing() 18 18 call append(line('$'), "nothing line") 19 19 endfun 20 nnoremap <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()< cr>20 nnoremap <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()<bar>delfunc <SID>DoNothing<bar>delfunc <SID>DoLast<cr> 21 21 end: -
src/testdir/test58.in
diff -Naur vim71.orig/src/testdir/test58.in vim71/src/testdir/test58.in
old new 86 86 :$put =str 87 87 `m]s:let [str, a] = spellbadword() 88 88 :$put =str 89 :unlet str a 89 90 :" 90 91 :" Postponed prefixes 91 92 :call TestOne('2', '1') … … 100 101 :" NOSLITSUGS 101 102 :call TestOne('8', '8') 102 103 :" 104 :" clean up for valgrind 105 :delfunc TestOne 106 :set spl= enc=latin1 107 :" 103 108 gg:/^test output:/,$wq! test.out 104 109 ENDTEST 105 110 -
src/testdir/test59.in
diff -Naur vim71.orig/src/testdir/test59.in vim71/src/testdir/test59.in
old new 90 90 :$put =str 91 91 `m]s:let [str, a] = spellbadword() 92 92 :$put =str 93 :unlet str a 93 94 :" 94 95 :" Postponed prefixes 95 96 :call TestOne('2', '1') … … 101 102 :call TestOne('6', '6') 102 103 :call TestOne('7', '7') 103 104 :" 105 :" clean up for valgrind 106 :delfunc TestOne 107 :set spl= enc=latin1 108 :" 104 109 gg:/^test output:/,$wq! test.out 105 110 ENDTEST 106 111 -
src/testdir/test60.in
diff -Naur vim71.orig/src/testdir/test60.in vim71/src/testdir/test60.in
old new 569 569 redir END 570 570 endfunction 571 571 :call TestExists() 572 :delfunc TestExists 573 :delfunc RunTest 574 :delfunc TestFuncArg 572 575 :edit! test.out 573 576 :set ff=unix 574 577 :w -
src/testdir/test60.vim
diff -Naur vim71.orig/src/testdir/test60.vim vim71/src/testdir/test60.vim
old new 94 94 else 95 95 echo "FAILED" 96 96 endif 97 unlet str 97 98 -
src/testdir/test62.in
diff -Naur vim71.orig/src/testdir/test62.in vim71/src/testdir/test62.in
old new 7 7 :let nr = tabpagenr() 8 8 :q 9 9 :call append(line('$'), 'tab page ' . nr) 10 :unlet nr 10 11 :" 11 12 :" Open three tab pages and use ":tabdo" 12 13 :0tabnew … … 23 24 :q! 24 25 :call append(line('$'), line1) 25 26 :call append(line('$'), line2) 27 :unlet line1 line2 26 28 :" 27 29 :" 28 30 :/^Results/,$w! test.out -
src/testdir/test63.in
diff -Naur vim71.orig/src/testdir/test63.in vim71/src/testdir/test63.in
old new 1 Test for ":match", ":2match", ":3match", "clearmatches()", "getmatches()", 2 "matchadd()", "matcharg()", "matchdelete()", and "setmatches()". 3 4 STARTTEST 5 :so small.vim 6 :" --- Check that "matcharg()" returns the correct group and pattern if a match 7 :" --- is defined. 8 :let @r = "*** Test 1: " 9 :highlight MyGroup1 ctermbg=red 10 :highlight MyGroup2 ctermbg=green 11 :highlight MyGroup3 ctermbg=blue 12 :match MyGroup1 /TODO/ 13 :2match MyGroup2 /FIXME/ 14 :3match MyGroup3 /XXX/ 15 :if matcharg(1) == ['MyGroup1', 'TODO'] && matcharg(2) == ['MyGroup2', 'FIXME'] && matcharg(3) == ['MyGroup3', 'XXX'] 16 : let @r .= "OK\n" 17 :else 18 : let @r .= "FAILED\n" 19 :endif 20 :" --- Check that "matcharg()" returns an empty list if the argument is not 1, 21 :" --- 2 or 3 (only 0 and 4 are tested). 22 :let @r .= "*** Test 2: " 23 :if matcharg(0) == [] && matcharg(4) == [] 24 : let @r .= "OK\n" 25 :else 26 : let @r .= "FAILED\n" 27 :endif 28 :" --- Check that "matcharg()" returns ['', ''] if a match is not defined. 29 :let @r .= "*** Test 3: " 30 :match 31 :2match 32 :3match 33 :if matcharg(1) == ['', ''] && matcharg(2) == ['', ''] && matcharg(3) == ['', ''] 34 : let @r .= "OK\n" 35 :else 36 : let @r .= "FAILED\n" 37 :endif 38 :" --- Check that "matchadd()" and "getmatches()" agree on added matches and 39 :" --- that default values apply. 40 :let @r .= "*** Test 4: " 41 :let m1 = matchadd("MyGroup1", "TODO") 42 :let m2 = matchadd("MyGroup2", "FIXME", 42) 43 :let m3 = matchadd("MyGroup3", "XXX", 60, 17) 44 :if getmatches() == [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 4}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 42, 'id': 5}, {'group': 'MyGroup3', 'pattern': 'XXX', 'priority': 60, 'id': 17}] 45 : let @r .= "OK\n" 46 :else 47 : let @r .= "FAILED\n" 48 :endif 49 :" --- Check that "matchdelete()" deletes the matches defined in the previous 50 :" --- test correctly. 51 :let @r .= "*** Test 5: " 52 :call matchdelete(m1) 53 :call matchdelete(m2) 54 :call matchdelete(m3) 55 :unlet m1 56 :unlet m2 57 :unlet m3 58 :if getmatches() == [] 59 : let @r .= "OK\n" 60 :else 61 : let @r .= "FAILED\n" 62 :endif 63 :" --- Check that "matchdelete()" returns 0 if successful and otherwise -1. 64 :let @r .= "*** Test 6: " 65 :let m = matchadd("MyGroup1", "TODO") 66 :let r1 = matchdelete(m) 67 :let r2 = matchdelete(42) 68 :if r1 == 0 && r2 == -1 69 : let @r .= "OK\n" 70 :else 71 : let @r .= "FAILED\n" 72 :endif 73 :unlet m 74 :unlet r1 75 :unlet r2 76 :" --- Check that "clearmatches()" clears all matches defined by ":match" and 77 :" --- "matchadd()". 78 :let @r .= "*** Test 7: " 79 :let m1 = matchadd("MyGroup1", "TODO") 80 :let m2 = matchadd("MyGroup2", "FIXME", 42) 81 :let m3 = matchadd("MyGroup3", "XXX", 60, 17) 82 :match MyGroup1 /COFFEE/ 83 :2match MyGroup2 /HUMPPA/ 84 :3match MyGroup3 /VIM/ 85 :call clearmatches() 86 :if getmatches() == [] 87 : let @r .= "OK\n" 88 :else 89 : let @r .= "FAILED\n" 90 :endif 91 :unlet m1 92 :unlet m2 93 :unlet m3 94 :" --- Check that "setmatches()" restores a list of matches saved by 95 :" --- "getmatches()" without changes. (Matches with equal priority must also 96 :" --- remain in the same order.) 97 :let @r .= "*** Test 8: " 98 :let m1 = matchadd("MyGroup1", "TODO") 99 :let m2 = matchadd("MyGroup2", "FIXME", 42) 100 :let m3 = matchadd("MyGroup3", "XXX", 60, 17) 101 :match MyGroup1 /COFFEE/ 102 :2match MyGroup2 /HUMPPA/ 103 :3match MyGroup3 /VIM/ 104 :let ml = getmatches() 105 :call clearmatches() 106 :call setmatches(ml) 107 :if getmatches() == ml 108 : let @r .= "OK\n" 109 :else 110 : let @r .= "FAILED\n" 111 :endif 112 :call clearmatches() 113 :unlet m1 114 :unlet m2 115 :unlet m3 116 :unlet ml 117 :" --- Check that "setmatches()" will not add two matches with the same ID. The 118 :" --- expected behaviour (for now) is to add the first match but not the 119 :" --- second and to return 0 (even though it is a matter of debate whether 120 :" --- this can be considered successful behaviour). 121 :let @r .= "*** Test 9: " 122 :let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}]) 123 :if getmatches() == [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}] && r1 == 0 124 : let @r .= "OK\n" 125 :else 126 : let @r .= "FAILED\n" 127 :endif 128 :call clearmatches() 129 :unlet r1 130 :" --- Check that "setmatches()" returns 0 if successful and otherwise -1. 131 :" --- (A range of valid and invalid input values are tried out to generate the 132 :" --- return values.) 133 :let @r .= "*** Test 10: " 134 :let rs1 = setmatches([]) 135 :let rs2 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}]) 136 :call clearmatches() 137 :let rf1 = setmatches(0) 138 :let rf2 = setmatches([0]) 139 :let rf3 = setmatches([{'wrong key': 'wrong value'}]) 140 :if rs1 == 0 && rs2 == 0 && rf1 == -1 && rf2 == -1 && rf3 == -1 141 : let @r .= "OK\n" 142 :else 143 : let @r .= "FAILED\n" 144 :endif 145 :unlet rs1 146 :unlet rs2 147 :unlet rf1 148 :unlet rf2 149 :unlet rf3 150 :highlight clear MyGroup1 151 :highlight clear MyGroup2 152 :highlight clear MyGroup3 153 G"rp 154 :/^Results/,$wq! test.out 155 ENDTEST 156 157 Results of test63: -
src/testdir/test63.ok
diff -Naur vim71.orig/src/testdir/test63.ok vim71/src/testdir/test63.ok
old new 1 Results of test63: 2 *** Test 1: OK 3 *** Test 2: OK 4 *** Test 3: OK 5 *** Test 4: OK 6 *** Test 5: OK 7 *** Test 6: OK 8 *** Test 7: OK 9 *** Test 8: OK 10 *** Test 9: OK 11 *** Test 10: OK -
src/testdir/test64.in
diff -Naur vim71.orig/src/testdir/test64.in vim71/src/testdir/test64.in
old new 1 Test for regexp patterns. 2 3 A pattern that gives the expected result produces OK, so that we know it was 4 actually tried. 5 6 STARTTEST 7 :so small.vim 8 :" tl is a List of Lists with: 9 :" regexp pattern 10 :" text to test the pattern on 11 :" expected match (optional) 12 :" expected submatch 1 (optional) 13 :" expected submatch 2 (optional) 14 :" etc. 15 :" When there is no match use only the first two items. 16 :let tl = [] 17 :call add(tl, ['b', 'abcdef', 'b']) 18 :call add(tl, ['bc*', 'abccccdef', 'bcccc']) 19 :call add(tl, ['bc\{-}', 'abccccdef', 'b']) 20 :call add(tl, ['bc\{-}\(d\)', 'abccccdef', 'bccccd', 'd']) 21 :call add(tl, ['x', 'abcdef']) 22 :" 23 :for t in tl 24 : let l = matchlist(t[1], t[0]) 25 :" check the match itself 26 : if len(l) == 0 && len(t) > 2 27 : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", did not match, expected: \"' . t[2] . '\"' 28 : elseif len(l) > 0 && len(t) == 2 29 : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", match: \"' . l[0] . '\", expected no match' 30 : elseif len(t) > 2 && l[0] != t[2] 31 : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", match: \"' . l[0] . '\", expected: \"' . t[2] . '\"' 32 : else 33 : $put ='OK' 34 : endif 35 : if len(l) > 0 36 :" check all the nine submatches 37 : for i in range(1, 9) 38 : if len(t) <= i + 2 39 : let e = '' 40 : else 41 : let e = t[i + 2] 42 : endif 43 : if l[i] != e 44 : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"' 45 : endif 46 : endfor 47 : unlet i 48 : endif 49 :endfor 50 :unlet t tl e l 51 :/^Results/,$wq! test.out 52 ENDTEST 53 54 Results of test64: -
src/testdir/test64.ok
diff -Naur vim71.orig/src/testdir/test64.ok vim71/src/testdir/test64.ok
old new 1 Results of test64: 2 OK 3 OK 4 OK 5 OK 6 OK -
src/ui.c
diff -Naur vim71.orig/src/ui.c vim71/src/ui.c
old new 1603 1603 #if defined(FEAT_GUI) || defined(FEAT_MOUSE_GPM) \ 1604 1604 || defined(FEAT_XCLIPBOARD) || defined(VMS) \ 1605 1605 || defined(FEAT_SNIFF) || defined(FEAT_CLIENTSERVER) \ 1606 || (defined(FEAT_GUI) && (!defined(USE_ON_FLY_SCROLL) \1607 || defined(FEAT_MENU))) \1608 1606 || defined(PROTO) 1609 1607 /* 1610 1608 * Add the given bytes to the input buffer … … 1630 1628 } 1631 1629 #endif 1632 1630 1633 #if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) \ 1631 #if ((defined(FEAT_XIM) || defined(FEAT_DND)) && defined(FEAT_GUI_GTK)) \ 1632 || defined(FEAT_GUI_MSWIN) \ 1633 || defined(FEAT_GUI_MAC) \ 1634 1634 || (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) \ 1635 1635 || (defined(FEAT_GUI) && (!defined(USE_ON_FLY_SCROLL) \ 1636 1636 || defined(FEAT_MENU))) \ -
src/undo.c
diff -Naur vim71.orig/src/undo.c vim71/src/undo.c
old new 76 76 * buffer is unloaded. 77 77 */ 78 78 79 /* Uncomment the next line for including the u_check() function. This warns 80 * for errors in the debug information. */ 81 /* #define U_DEBUG 1 */ 82 #define UH_MAGIC 0x18dade /* value for uh_magic when in use */ 83 #define UE_MAGIC 0xabc123 /* value for ue_magic when in use */ 84 79 85 #include "vim.h" 80 86 81 87 /* See below: use malloc()/free() for memory management. */ … … 113 119 */ 114 120 static int undo_undoes = FALSE; 115 121 122 #ifdef U_DEBUG 123 /* 124 * Check the undo structures for being valid. Print a warning when something 125 * looks wrong. 126 */ 127 static int seen_b_u_curhead; 128 static int seen_b_u_newhead; 129 static int header_count; 130 131 static void 132 u_check_tree(u_header_T *uhp, 133 u_header_T *exp_uh_next, 134 u_header_T *exp_uh_alt_prev) 135 { 136 u_entry_T *uep; 137 138 if (uhp == NULL) 139 return; 140 ++header_count; 141 if (uhp == curbuf->b_u_curhead && ++seen_b_u_curhead > 1) 142 { 143 EMSG("b_u_curhead found twice (looping?)"); 144 return; 145 } 146 if (uhp == curbuf->b_u_newhead && ++seen_b_u_newhead > 1) 147 { 148 EMSG("b_u_newhead found twice (looping?)"); 149 return; 150 } 151 152 if (uhp->uh_magic != UH_MAGIC) 153 EMSG("uh_magic wrong (may be using freed memory)"); 154 else 155 { 156 /* Check pointers back are correct. */ 157 if (uhp->uh_next != exp_uh_next) 158 { 159 EMSG("uh_next wrong"); 160 smsg((char_u *)"expected: 0x%x, actual: 0x%x", 161 exp_uh_next, uhp->uh_next); 162 } 163 if (uhp->uh_alt_prev != exp_uh_alt_prev) 164 { 165 EMSG("uh_alt_prev wrong"); 166 smsg((char_u *)"expected: 0x%x, actual: 0x%x", 167 exp_uh_alt_prev, uhp->uh_alt_prev); 168 } 169 170 /* Check the undo tree at this header. */ 171 for (uep = uhp->uh_entry; uep != NULL; uep = uep->ue_next) 172 { 173 if (uep->ue_magic != UE_MAGIC) 174 { 175 EMSG("ue_magic wrong (may be using freed memory)"); 176 break; 177 } 178 } 179 180 /* Check the next alt tree. */ 181 u_check_tree(uhp->uh_alt_next, uhp->uh_next, uhp); 182 183 /* Check the next header in this branch. */ 184 u_check_tree(uhp->uh_prev, uhp, NULL); 185 } 186 } 187 188 void 189 u_check(int newhead_may_be_NULL) 190 { 191 seen_b_u_newhead = 0; 192 seen_b_u_curhead = 0; 193 header_count = 0; 194 195 u_check_tree(curbuf->b_u_oldhead, NULL, NULL); 196 197 if (seen_b_u_newhead == 0 && curbuf->b_u_oldhead != NULL 198 && !(newhead_may_be_NULL && curbuf->b_u_newhead == NULL)) 199 EMSGN("b_u_newhead invalid: 0x%x", curbuf->b_u_newhead); 200 if (curbuf->b_u_curhead != NULL && seen_b_u_curhead == 0) 201 EMSGN("b_u_curhead invalid: 0x%x", curbuf->b_u_curhead); 202 if (header_count != curbuf->b_u_numhead) 203 { 204 EMSG("b_u_numhead invalid"); 205 smsg((char_u *)"expected: %ld, actual: %ld", 206 (long)header_count, (long)curbuf->b_u_numhead); 207 } 208 } 209 #endif 210 116 211 /* 117 212 * Save the current line for both the "u" and "U" command. 118 213 * Returns OK or FAIL. … … 243 338 if (!undo_allowed()) 244 339 return FAIL; 245 340 341 #ifdef U_DEBUG 342 u_check(FALSE); 343 #endif 246 344 #ifdef FEAT_NETBEANS_INTG 247 345 /* 248 346 * Netbeans defines areas that cannot be modified. Bail out here when … … 294 392 uhp = (u_header_T *)U_ALLOC_LINE((unsigned)sizeof(u_header_T)); 295 393 if (uhp == NULL) 296 394 goto nomem; 395 #ifdef U_DEBUG 396 uhp->uh_magic = UH_MAGIC; 397 #endif 297 398 } 298 399 else 299 400 uhp = NULL; … … 316 417 { 317 418 u_header_T *uhfree = curbuf->b_u_oldhead; 318 419 319 /* If there is no branch only free one header. */ 320 if (uhfree->uh_alt_next == NULL) 420 if (uhfree == old_curhead) 421 /* Can't reconnect the branch, delete all of it. */ 422 u_freebranch(curbuf, uhfree, &old_curhead); 423 else if (uhfree->uh_alt_next == NULL) 424 /* There is no branch, only free one header. */ 321 425 u_freeheader(curbuf, uhfree, &old_curhead); 322 426 else 323 427 { … … 326 430 uhfree = uhfree->uh_alt_next; 327 431 u_freebranch(curbuf, uhfree, &old_curhead); 328 432 } 433 #ifdef U_DEBUG 434 u_check(TRUE); 435 #endif 329 436 } 330 437 331 438 if (uhp == NULL) /* no undo at all */ … … 478 585 uep = (u_entry_T *)U_ALLOC_LINE((unsigned)sizeof(u_entry_T)); 479 586 if (uep == NULL) 480 587 goto nomem; 588 #ifdef U_DEBUG 589 uep->ue_magic = UE_MAGIC; 590 #endif 481 591 482 592 uep->ue_size = size; 483 593 uep->ue_top = top; … … 525 635 curbuf->b_u_synced = FALSE; 526 636 undo_undoes = FALSE; 527 637 638 #ifdef U_DEBUG 639 u_check(FALSE); 640 #endif 528 641 return OK; 529 642 530 643 nomem: … … 955 1068 int empty_buffer; /* buffer became empty */ 956 1069 u_header_T *curhead = curbuf->b_u_curhead; 957 1070 1071 #ifdef U_DEBUG 1072 u_check(FALSE); 1073 #endif 958 1074 old_flags = curhead->uh_flags; 959 1075 new_flags = (curbuf->b_changed ? UH_CHANGED : 0) + 960 1076 ((curbuf->b_ml.ml_flags & ML_EMPTY) ? UH_EMPTYBUF : 0); … … 1186 1302 /* The timestamp can be the same for multiple changes, just use the one of 1187 1303 * the undone/redone change. */ 1188 1304 curbuf->b_u_seq_time = curhead->uh_time; 1305 #ifdef U_DEBUG 1306 u_check(FALSE); 1307 #endif 1189 1308 } 1190 1309 1191 1310 /* … … 1515 1634 } 1516 1635 1517 1636 /* 1518 * Free one header and its entry list and adjust the pointers.1637 * Free one header "uhp" and its entry list and adjust the pointers. 1519 1638 */ 1520 1639 static void 1521 1640 u_freeheader(buf, uhp, uhpp) … … 1523 1642 u_header_T *uhp; 1524 1643 u_header_T **uhpp; /* if not NULL reset when freeing this header */ 1525 1644 { 1645 u_header_T *uhap; 1646 1526 1647 /* When there is an alternate redo list free that branch completely, 1527 1648 * because we can never go there. */ 1528 1649 if (uhp->uh_alt_next != NULL) … … 1540 1661 if (uhp->uh_prev == NULL) 1541 1662 buf->b_u_newhead = uhp->uh_next; 1542 1663 else 1543 uhp->uh_prev->uh_next = uhp->uh_next; 1664 for (uhap = uhp->uh_prev; uhap != NULL; uhap = uhap->uh_alt_next) 1665 uhap->uh_next = uhp->uh_next; 1544 1666 1545 1667 u_freeentries(buf, uhp, uhpp); 1546 1668 } … … 1585 1707 /* Check for pointers to the header that become invalid now. */ 1586 1708 if (buf->b_u_curhead == uhp) 1587 1709 buf->b_u_curhead = NULL; 1710 if (buf->b_u_newhead == uhp) 1711 buf->b_u_newhead = NULL; /* freeing the newest entry */ 1588 1712 if (uhpp != NULL && uhp == *uhpp) 1589 1713 *uhpp = NULL; 1590 1714 … … 1594 1718 u_freeentry(uep, uep->ue_size); 1595 1719 } 1596 1720 1721 #ifdef U_DEBUG 1722 uhp->uh_magic = 0; 1723 #endif 1597 1724 U_FREE_LINE((char_u *)uhp); 1598 1725 --buf->b_u_numhead; 1599 1726 } … … 1609 1736 while (n > 0) 1610 1737 U_FREE_LINE(uep->ue_array[--n]); 1611 1738 U_FREE_LINE((char_u *)uep->ue_array); 1739 #ifdef U_DEBUG 1740 uep->ue_magic = 0; 1741 #endif 1612 1742 U_FREE_LINE((char_u *)uep); 1613 1743 } 1614 1744 -
src/version.c
diff -Naur vim71.orig/src/version.c vim71/src/version.c
old new 667 667 static int included_patches[] = 668 668 { /* Add new patch number below this line */ 669 669 /**/ 670 140, 671 /**/ 672 139, 673 /**/ 674 138, 675 /**/ 676 137, 677 /**/ 678 136, 679 /**/ 680 135, 681 /**/ 682 133, 683 /**/ 684 132, 685 /**/ 686 131, 687 /**/ 688 130, 689 /**/ 690 127, 691 /**/ 692 125, 693 /**/ 694 123, 695 /**/ 696 122, 697 /**/ 698 121, 699 /**/ 700 120, 701 /**/ 702 119, 703 /**/ 704 118, 705 /**/ 706 117, 707 /**/ 708 116, 709 /**/ 710 115, 711 /**/ 712 114, 713 /**/ 714 113, 715 /**/ 716 112, 717 /**/ 718 111, 719 /**/ 720 110, 721 /**/ 722 109, 723 /**/ 724 108, 725 /**/ 726 107, 727 /**/ 728 106, 729 /**/ 730 105, 731 /**/ 732 104, 733 /**/ 734 103, 735 /**/ 736 102, 737 /**/ 738 101, 739 /**/ 740 100, 741 /**/ 742 99, 743 /**/ 744 98, 745 /**/ 746 97, 747 /**/ 748 96, 749 /**/ 750 95, 751 /**/ 752 94, 753 /**/ 754 93, 755 /**/ 756 90, 757 /**/ 758 89, 759 /**/ 760 87, 761 /**/ 762 86, 763 /**/ 764 85, 765 /**/ 766 84, 767 /**/ 768 83, 769 /**/ 770 82, 771 /**/ 772 81, 773 /**/ 774 79, 775 /**/ 776 78, 777 /**/ 778 77, 779 /**/ 780 76, 781 /**/ 782 75, 783 /**/ 784 74, 785 /**/ 786 73, 787 /**/ 788 71, 789 /**/ 790 69, 791 /**/ 792 68, 793 /**/ 794 67, 795 /**/ 796 66, 797 /**/ 798 64, 799 /**/ 800 63, 801 /**/ 802 62, 803 /**/ 804 61, 805 /**/ 806 60, 807 /**/ 808 59, 809 /**/ 810 58, 811 /**/ 812 57, 813 /**/ 814 56, 815 /**/ 816 55, 817 /**/ 818 54, 819 /**/ 820 53, 821 /**/ 822 52, 823 /**/ 824 51, 825 /**/ 826 50, 827 /**/ 828 49, 829 /**/ 830 48, 831 /**/ 832 47, 833 /**/ 834 46, 835 /**/ 836 45, 837 /**/ 838 44, 839 /**/ 840 43, 841 /**/ 842 42, 843 /**/ 844 40, 845 /**/ 846 39, 847 /**/ 848 38, 849 /**/ 850 37, 851 /**/ 852 36, 853 /**/ 854 35, 855 /**/ 856 34, 857 /**/ 858 33, 859 /**/ 860 32, 861 /**/ 862 31, 863 /**/ 864 30, 865 /**/ 866 29, 867 /**/ 868 28, 869 /**/ 870 27, 871 /**/ 872 26, 873 /**/ 874 25, 875 /**/ 876 24, 877 /**/ 878 23, 879 /**/ 880 22, 881 /**/ 882 21, 883 /**/ 884 20, 885 /**/ 886 19, 887 /**/ 888 18, 889 /**/ 890 17, 891 /**/ 892 16, 893 /**/ 894 15, 895 /**/ 896 14, 897 /**/ 898 13, 899 /**/ 900 12, 901 /**/ 902 11, 903 /**/ 904 10, 905 /**/ 906 9, 907 /**/ 908 8, 909 /**/ 910 6, 911 /**/ 912 5, 913 /**/ 914 4, 915 /**/ 916 2, 917 /**/ 918 1, 919 /**/ 670 920 0 671 921 }; 672 922 -
src/vim.h
diff -Naur vim71.orig/src/vim.h vim71/src/vim.h
old new 1380 1380 #endif 1381 1381 1382 1382 #ifdef FEAT_MBYTE 1383 # define MB_STRICMP(d, s) (has_mbyte ? mb_strnicmp((char_u *)(d), (char_u *)(s), (int)MAXCOL) : STRICMP((d), (s))) 1384 # define MB_STRNICMP(d, s, n) (has_mbyte ? mb_strnicmp((char_u *)(d), (char_u *)(s), (int)(n)) : STRNICMP((d), (s), (n))) 1383 /* We need to call mb_stricmp() even when we aren't dealing with a multi-byte 1384 * encoding because mb_stricmp() takes care of all ascii and non-ascii 1385 * encodings, including characters with umluats in latin1, etc., while 1386 * STRICMP() only handles the system locale version, which often does not 1387 * handle non-ascii properly. */ 1388 1389 # define MB_STRICMP(d, s) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)MAXCOL) 1390 # define MB_STRNICMP(d, s, n) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)(n)) 1385 1391 #else 1386 1392 # define MB_STRICMP(d, s) STRICMP((d), (s)) 1387 1393 # define MB_STRNICMP(d, s, n) STRNICMP((d), (s), (n)) -
src/vimtutor
diff -Naur vim71.orig/src/vimtutor vim71/src/vimtutor
old new 39 39 # remove the copy of the tutor on exit 40 40 trap "rm -rf $TODELETE" 0 1 2 3 9 11 13 15 41 41 42 # Vim could be called "vim" or "vi". Also check for "vim6", for people who 43 # have Vim 5.x installed as "vim" and Vim 6.0 as "vim6". 44 testvim=`which vim6 2>/dev/null` 45 if test -f "$testvim"; then 46 VIM=vim6 47 else 48 testvim=`which vim` 42 # Vim could be called "vim" or "vi". Also check for "vimN", for people who 43 # have Vim installed with its version number. 44 # We anticipate up to a future Vim 8 version :-). 45 seq="vim vim8 vim75 vim74 vim73 vim72 vim71 vim70 vim7 vim6 vi" 46 for i in $seq; do 47 testvim=`which $i 2>/dev/null` 49 48 if test -f "$testvim"; then 50 VIM=vim 51 else 52 VIM=vi 49 VIM=$i 50 break 53 51 fi 52 done 53 54 # When no Vim version was found fall back to "vim", you'll get an error message 55 # below. 56 if test -z "$VIM"; then 57 VIM=vim 54 58 fi 55 59 56 60 # Use Vim to copy the tutor, it knows the value of $VIMRUNTIME -
src/window.c
diff -Naur vim71.orig/src/window.c vim71/src/window.c
old new 75 75 static win_T *restore_snapshot_rec __ARGS((frame_T *sn, frame_T *fr)); 76 76 77 77 #endif /* FEAT_WINDOWS */ 78 78 79 static win_T *win_alloc __ARGS((win_T *after)); 79 80 static void win_new_height __ARGS((win_T *, int)); 80 81 … … 583 584 ++no_mapping; 584 585 ++allow_keys; /* no mapping for xchar, but allow key codes */ 585 586 if (xchar == NUL) 586 xchar = safe_vgetc();587 xchar = plain_vgetc(); 587 588 #ifdef FEAT_LANGMAP 588 589 LANGMAP_ADJUST(xchar, TRUE); 589 590 #endif … … 732 733 if (flags & WSP_VERT) 733 734 { 734 735 layout = FR_ROW; 735 do_equal = (p_ea && new_size == 0 && *p_ead != 'v');736 736 737 737 /* 738 738 * Check if we are able to split the current window and compute its … … 769 769 * instead, if possible. */ 770 770 if (oldwin->w_p_wfw) 771 771 win_setwidth_win(oldwin->w_width + new_size, oldwin); 772 773 /* Only make all windows the same width if one of them (except oldwin) 774 * is wider than one of the split windows. */ 775 if (!do_equal && p_ea && size == 0 && *p_ead != 'v' 776 && oldwin->w_frame->fr_parent != NULL) 777 { 778 frp = oldwin->w_frame->fr_parent->fr_child; 779 while (frp != NULL) 780 { 781 if (frp->fr_win != oldwin && frp->fr_win != NULL 782 && (frp->fr_win->w_width > new_size 783 || frp->fr_win->w_width > oldwin->w_width 784 - new_size - STATUS_HEIGHT)) 785 { 786 do_equal = TRUE; 787 break; 788 } 789 frp = frp->fr_next; 790 } 791 } 772 792 } 773 793 else 774 794 #endif 775 795 { 776 796 layout = FR_COL; 777 do_equal = (p_ea && new_size == 0778 #ifdef FEAT_VERTSPLIT779 && *p_ead != 'h'780 #endif781 );782 797 783 798 /* 784 799 * Check if we are able to split the current window and compute its … … 831 846 if (need_status) 832 847 oldwin_height -= STATUS_HEIGHT; 833 848 } 849 850 /* Only make all windows the same height if one of them (except oldwin) 851 * is higher than one of the split windows. */ 852 if (!do_equal && p_ea && size == 0 853 #ifdef FEAT_VERTSPLIT 854 && *p_ead != 'h' 855 #endif 856 && oldwin->w_frame->fr_parent != NULL) 857 { 858 frp = oldwin->w_frame->fr_parent->fr_child; 859 while (frp != NULL) 860 { 861 if (frp->fr_win != oldwin && frp->fr_win != NULL 862 && (frp->fr_win->w_height > new_size 863 || frp->fr_win->w_height > oldwin_height - new_size 864 - STATUS_HEIGHT)) 865 { 866 do_equal = TRUE; 867 break; 868 } 869 frp = frp->fr_next; 870 } 871 } 834 872 } 835 873 836 874 /* … … 1253 1291 * Don't execute autocommands while creating the windows. Must do that 1254 1292 * when putting the buffers in the windows. 1255 1293 */ 1256 ++autocmd_block;1294 block_autocmds(); 1257 1295 #endif 1258 1296 1259 1297 /* todo is number of windows left to create */ … … 1275 1313 } 1276 1314 1277 1315 #ifdef FEAT_AUTOCMD 1278 --autocmd_block;1316 unblock_autocmds(); 1279 1317 #endif 1280 1318 1281 1319 /* return actual number of windows */ … … 2120 2158 if (wp->w_p_pvw || bt_quickfix(wp->w_buffer)) 2121 2159 { 2122 2160 /* 2123 * The cursor goes to the preview or the quickfix window, try2161 * If the cursor goes to the preview or the quickfix window, try 2124 2162 * finding another window to go to. 2125 2163 */ 2126 2164 for (;;) … … 2307 2345 frame_T *frp, *frp2, *frp3; 2308 2346 frame_T *frp_close = win->w_frame; 2309 2347 win_T *wp; 2310 int old_size = 0;2311 2348 2312 2349 /* 2313 2350 * If there is only one window there is nothing to remove. … … 2328 2365 if (frp_close->fr_parent->fr_layout == FR_COL) 2329 2366 { 2330 2367 #endif 2331 /* When 'winfixheight' is set, remember its old size and restore 2332 * it later (it's a simplistic solution...). Don't do this if the 2333 * window will occupy the full height of the screen. */ 2334 if (frp2->fr_win != NULL 2335 && (frp2->fr_next != NULL || frp2->fr_prev != NULL) 2336 && frp2->fr_win->w_p_wfh) 2337 old_size = frp2->fr_win->w_height; 2368 /* When 'winfixheight' is set, try to find another frame in the column 2369 * (as close to the closed frame as possible) to distribute the height 2370 * to. */ 2371 if (frp2->fr_win != NULL && frp2->fr_win->w_p_wfh) 2372 { 2373 frp = frp_close->fr_prev; 2374 frp3 = frp_close->fr_next; 2375 while (frp != NULL || frp3 != NULL) 2376 { 2377 if (frp != NULL) 2378 { 2379 if (frp->fr_win != NULL && !frp->fr_win->w_p_wfh) 2380 { 2381 frp2 = frp; 2382 wp = frp->fr_win; 2383 break; 2384 } 2385 frp = frp->fr_prev; 2386 } 2387 if (frp3 != NULL) 2388 { 2389 if (frp3->fr_win != NULL && !frp3->fr_win->w_p_wfh) 2390 { 2391 frp2 = frp3; 2392 wp = frp3->fr_win; 2393 break; 2394 } 2395 frp3 = frp3->fr_next; 2396 } 2397 } 2398 } 2338 2399 frame_new_height(frp2, frp2->fr_height + frp_close->fr_height, 2339 2400 frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE); 2340 if (old_size != 0)2341 win_setheight_win(old_size, frp2->fr_win);2342 2401 #ifdef FEAT_VERTSPLIT 2343 2402 *dirp = 'v'; 2344 2403 } 2345 2404 else 2346 2405 { 2347 /* When 'winfixwidth' is set, remember its old size and restore 2348 * it later (it's a simplistic solution...). Don't do this if the 2349 * window will occupy the full width of the screen. */ 2350 if (frp2->fr_win != NULL 2351 && (frp2->fr_next != NULL || frp2->fr_prev != NULL) 2352 && frp2->fr_win->w_p_wfw) 2353 old_size = frp2->fr_win->w_width; 2406 /* When 'winfixwidth' is set, try to find another frame in the column 2407 * (as close to the closed frame as possible) to distribute the width 2408 * to. */ 2409 if (frp2->fr_win != NULL && frp2->fr_win->w_p_wfw) 2410 { 2411 frp = frp_close->fr_prev; 2412 frp3 = frp_close->fr_next; 2413 while (frp != NULL || frp3 != NULL) 2414 { 2415 if (frp != NULL) 2416 { 2417 if (frp->fr_win != NULL && !frp->fr_win->w_p_wfw) 2418 { 2419 frp2 = frp; 2420 wp = frp->fr_win; 2421 break; 2422 } 2423 frp = frp->fr_prev; 2424 } 2425 if (frp3 != NULL) 2426 { 2427 if (frp3->fr_win != NULL && !frp3->fr_win->w_p_wfw) 2428 { 2429 frp2 = frp3; 2430 wp = frp3->fr_win; 2431 break; 2432 } 2433 frp3 = frp3->fr_next; 2434 } 2435 } 2436 } 2354 2437 frame_new_width(frp2, frp2->fr_width + frp_close->fr_width, 2355 2438 frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE); 2356 if (old_size != 0)2357 win_setwidth_win(old_size, frp2->fr_win);2358 2439 *dirp = 'h'; 2359 2440 } 2360 2441 #endif … … 3334 3415 * Don't execute autocommands while creating the tab pages. Must do that 3335 3416 * when putting the buffers in the windows. 3336 3417 */ 3337 ++autocmd_block;3418 block_autocmds(); 3338 3419 #endif 3339 3420 3340 3421 for (todo = count - 1; todo > 0; --todo) … … 3342 3423 break; 3343 3424 3344 3425 #ifdef FEAT_AUTOCMD 3345 --autocmd_block;3426 unblock_autocmds(); 3346 3427 #endif 3347 3428 3348 3429 /* return actual number of tab pages */ … … 4081 4162 /* Don't execute autocommands while the window is not properly 4082 4163 * initialized yet. gui_create_scrollbar() may trigger a FocusGained 4083 4164 * event. */ 4084 ++autocmd_block;4165 block_autocmds(); 4085 4166 #endif 4086 4167 /* 4087 4168 * link the window in the window list … … 4126 4207 foldInitWin(newwin); 4127 4208 #endif 4128 4209 #ifdef FEAT_AUTOCMD 4129 --autocmd_block; 4210 unblock_autocmds(); 4211 #endif 4212 #ifdef FEAT_SEARCH_EXTRA 4213 newwin->w_match_head = NULL; 4214 newwin->w_next_match_id = 4; 4130 4215 #endif 4131 4216 } 4132 4217 return newwin; … … 4147 4232 #ifdef FEAT_AUTOCMD 4148 4233 /* Don't execute autocommands while the window is halfway being deleted. 4149 4234 * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */ 4150 ++autocmd_block;4235 block_autocmds(); 4151 4236 #endif 4152 4237 4153 4238 #ifdef FEAT_MZSCHEME … … 4185 4270 vim_free(wp->w_tagstack[i].tagname); 4186 4271 4187 4272 vim_free(wp->w_localdir); 4273 4188 4274 #ifdef FEAT_SEARCH_EXTRA 4189 vim_free(wp->w_match[0].regprog); 4190 vim_free(wp->w_match[1].regprog); 4191 vim_free(wp->w_match[2].regprog); 4275 clear_matches(wp); 4192 4276 #endif 4277 4193 4278 #ifdef FEAT_JUMPLIST 4194 4279 free_jumplist(wp); 4195 4280 #endif … … 4210 4295 vim_free(wp); 4211 4296 4212 4297 #ifdef FEAT_AUTOCMD 4213 --autocmd_block;4298 unblock_autocmds(); 4214 4299 #endif 4215 4300 } 4216 4301 … … 5438 5523 { 5439 5524 EMSG(_(e_noroom)); 5440 5525 p_ch = old_p_ch; 5526 curtab->tp_ch_used = p_ch; 5441 5527 cmdline_row = Rows - p_ch; 5442 5528 break; 5443 5529 } … … 6174 6260 return FALSE; 6175 6261 } 6176 6262 #endif 6263 6264 #if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) 6265 /* 6266 * Add match to the match list of window 'wp'. The pattern 'pat' will be 6267 * highligted with the group 'grp' with priority 'prio'. 6268 * Optionally, a desired ID 'id' can be specified (greater than or equal to 1). 6269 * If no particular ID is desired, -1 must be specified for 'id'. 6270 * Return ID of added match, -1 on failure. 6271 */ 6272 int 6273 match_add(wp, grp, pat, prio, id) 6274 win_T *wp; 6275 char_u *grp; 6276 char_u *pat; 6277 int prio; 6278 int id; 6279 { 6280 matchitem_T *cur; 6281 matchitem_T *prev; 6282 matchitem_T *m; 6283 int hlg_id; 6284 regprog_T *regprog; 6285 6286 if (*grp == NUL || *pat == NUL) 6287 return -1; 6288 if (id < -1 || id == 0) 6289 { 6290 EMSGN("E799: Invalid ID: %ld (must be greater than or equal to 1)", id); 6291 return -1; 6292 } 6293 if (id != -1) 6294 { 6295 cur = wp->w_match_head; 6296 while (cur != NULL) 6297 { 6298 if (cur->id == id) 6299 { 6300 EMSGN("E801: ID already taken: %ld", id); 6301 return -1; 6302 } 6303 cur = cur->next; 6304 } 6305 } 6306 if ((hlg_id = syn_namen2id(grp, STRLEN(grp))) == 0) 6307 { 6308 EMSG2(_(e_nogroup), grp); 6309 return -1; 6310 } 6311 if ((regprog = vim_regcomp(pat, RE_MAGIC)) == NULL) 6312 { 6313 EMSG2(_(e_invarg2), pat); 6314 return -1; 6315 } 6316 6317 /* Find available match ID. */ 6318 while (id == -1) 6319 { 6320 cur = wp->w_match_head; 6321 while (cur != NULL && cur->id != wp->w_next_match_id) 6322 cur = cur->next; 6323 if (cur == NULL) 6324 id = wp->w_next_match_id; 6325 wp->w_next_match_id++; 6326 } 6327 6328 /* Build new match. */ 6329 m = (matchitem_T *)alloc(sizeof(matchitem_T)); 6330 m->id = id; 6331 m->priority = prio; 6332 m->pattern = vim_strsave(pat); 6333 m->hlg_id = hlg_id; 6334 m->match.regprog = regprog; 6335 m->match.rmm_ic = FALSE; 6336 m->match.rmm_maxcol = 0; 6337 6338 /* Insert new match. The match list is in ascending order with regard to 6339 * the match priorities. */ 6340 cur = wp->w_match_head; 6341 prev = cur; 6342 while (cur != NULL && prio >= cur->priority) 6343 { 6344 prev = cur; 6345 cur = cur->next; 6346 } 6347 if (cur == prev) 6348 wp->w_match_head = m; 6349 else 6350 prev->next = m; 6351 m->next = cur; 6352 6353 redraw_later(SOME_VALID); 6354 return id; 6355 } 6356 6357 /* 6358 * Delete match with ID 'id' in the match list of window 'wp'. 6359 * Print error messages if 'perr' is TRUE. 6360 */ 6361 int 6362 match_delete(wp, id, perr) 6363 win_T *wp; 6364 int id; 6365 int perr; 6366 { 6367 matchitem_T *cur = wp->w_match_head; 6368 matchitem_T *prev = cur; 6369 6370 if (id < 1) 6371 { 6372 if (perr == TRUE) 6373 EMSGN("E802: Invalid ID: %ld (must be greater than or equal to 1)", 6374 id); 6375 return -1; 6376 } 6377 while (cur != NULL && cur->id != id) 6378 { 6379 prev = cur; 6380 cur = cur->next; 6381 } 6382 if (cur == NULL) 6383 { 6384 if (perr == TRUE) 6385 EMSGN("E803: ID not found: %ld", id); 6386 return -1; 6387 } 6388 if (cur == prev) 6389 wp->w_match_head = cur->next; 6390 else 6391 prev->next = cur->next; 6392 vim_free(cur->match.regprog); 6393 vim_free(cur->pattern); 6394 vim_free(cur); 6395 redraw_later(SOME_VALID); 6396 return 0; 6397 } 6398 6399 /* 6400 * Delete all matches in the match list of window 'wp'. 6401 */ 6402 void 6403 clear_matches(wp) 6404 win_T *wp; 6405 { 6406 matchitem_T *m; 6407 6408 while (wp->w_match_head != NULL) 6409 { 6410 m = wp->w_match_head->next; 6411 vim_free(wp->w_match_head->match.regprog); 6412 vim_free(wp->w_match_head->pattern); 6413 vim_free(wp->w_match_head); 6414 wp->w_match_head = m; 6415 } 6416 redraw_later(SOME_VALID); 6417 } 6418 6419 /* 6420 * Get match from ID 'id' in window 'wp'. 6421 * Return NULL if match not found. 6422 */ 6423 matchitem_T * 6424 get_match(wp, id) 6425 win_T *wp; 6426 int id; 6427 { 6428 matchitem_T *cur = wp->w_match_head; 6429 6430 while (cur != NULL && cur->id != id) 6431 cur = cur->next; 6432 return cur; 6433 } 6434 #endif
Note:
See TracBrowser
for help on using the repository browser.