source:
patches/vim-7.1-fixes-3.patch@
5a90148
Last change on this file since 5a90148 was ba61c16, checked in by , 17 years ago | |
---|---|
|
|
File size: 172.9 KB |
-
runtime/doc/change.txt
Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 09-03-2007 Initial Package Version: 7.1 Origin: Upstream Upstream Status: Applied Description: Contains all upstream patches up to 7.1.094 The following patches were skipped 0 003 007 041 065 070 072 080 088 091 092 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 Jul 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 … … 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()|. … … 2824 2838 given file {fname}. 2825 2839 If {fname} is a directory, 0 is returned. 2826 2840 If the file {fname} can't be found, -1 is returned. 2841 If the size of {fname} is too big to fit in a Number then -2 2842 is returned. 2827 2843 2828 2844 getfontname([{name}]) *getfontname()* 2829 2845 Without an argument returns the name of the normal font being … … 2912 2928 returned. For an invalid window number {nr}, an empty list is 2913 2929 returned. Otherwise, same as getqflist(). 2914 2930 2931 getmatches() *getmatches()* 2932 Returns a |List| with all matches previously defined by 2933 |matchadd()| and the |:match| commands. |getmatches()| is 2934 useful in combination with |setmatches()|, as |setmatches()| 2935 can restore a list of matches saved by |getmatches()|. 2936 Example: > 2937 :echo getmatches() 2938 < [{'group': 'MyGroup1', 'pattern': 'TODO', 2939 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 2940 'pattern': 'FIXME', 'priority': 10, 'id': 2}] > 2941 :let m = getmatches() 2942 :call clearmatches() 2943 :echo getmatches() 2944 < [] > 2945 :call setmatches(m) 2946 :echo getmatches() 2947 < [{'group': 'MyGroup1', 'pattern': 'TODO', 2948 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 2949 'pattern': 'FIXME', 'priority': 10, 'id': 2}] > 2950 :unlet m 2951 < 2952 2915 2953 getqflist() *getqflist()* 2916 2954 Returns a list with all the current quickfix errors. Each 2917 2955 list item is a dictionary with these entries: … … 3616 3654 the pattern. 'smartcase' is NOT used. The matching is always 3617 3655 done like 'magic' is set and 'cpoptions' is empty. 3618 3656 3657 *matchadd()* *E798* *E799* *E801* 3658 matchadd({group}, {pattern}[, {priority}[, {id}]]) 3659 Defines a pattern to be highlighted in the current window (a 3660 "match"). It will be highlighted with {group}. Returns an 3661 identification number (ID), which can be used to delete the 3662 match using |matchdelete()|. 3663 3664 The optional {priority} argument assigns a priority to the 3665 match. A match with a high priority will have its 3666 highlighting overrule that of a match with a lower priority. 3667 A priority is specified as an integer (negative numbers are no 3668 exception). If the {priority} argument is not specified, the 3669 default priority is 10. The priority of 'hlsearch' is zero, 3670 hence all matches with a priority greater than zero will 3671 overrule it. Syntax highlighting (see 'syntax') is a separate 3672 mechanism, and regardless of the chosen priority a match will 3673 always overrule syntax highlighting. 3674 3675 The optional {id} argument allows the request for a specific 3676 match ID. If a specified ID is already taken, an error 3677 message will appear and the match will not be added. An ID 3678 is specified as a positive integer (zero excluded). IDs 1, 2 3679 and 3 are reserved for |:match|, |:2match| and |:3match|, 3680 respectively. If the {id} argument is not specified, 3681 |matchadd()| automatically chooses a free ID. 3682 3683 The number of matches is not limited, as it is the case with 3684 the |:match| commands. 3685 3686 Example: > 3687 :highlight MyGroup ctermbg=green guibg=green 3688 :let m = matchadd("MyGroup", "TODO") 3689 < Deletion of the pattern: > 3690 :call matchdelete(m) 3691 3692 < A list of matches defined by |matchadd()| and |:match| are 3693 available from |getmatches()|. All matches can be deleted in 3694 one operation by |clearmatches()|. 3619 3695 3620 3696 matcharg({nr}) *matcharg()* 3621 3697 Selects the {nr} match item, as set with a |:match|, … … 3625 3701 The pattern used. 3626 3702 When {nr} is not 1, 2 or 3 returns an empty |List|. 3627 3703 When there is no match item set returns ['', '']. 3628 This is usef to save and restore a |:match|. 3629 3704 This is useful to save and restore a |:match|. 3705 Highlighting matches using the |:match| commands are limited 3706 to three matches. |matchadd()| does not have this limitation. 3707 3708 matchdelete({id}) *matchdelete()* *E802* *E803* 3709 Deletes a match with ID {id} previously defined by |matchadd()| 3710 or one of the |:match| commands. Returns 0 if succesfull, 3711 otherwise -1. See example for |matchadd()|. All matches can 3712 be deleted in one operation by |clearmatches()|. 3630 3713 3631 3714 matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()* 3632 3715 Same as match(), but return the index of first character after … … 4379 4462 When {nr} is zero the current window is used. For a location 4380 4463 list window, the displayed location list is modified. For an 4381 4464 invalid window number {nr}, -1 is returned. 4382 Otherwise, same as setqflist(). 4465 Otherwise, same as |setqflist()|. 4466 Also see |location-list|. 4467 4468 setmatches({list}) *setmatches()* 4469 Restores a list of matches saved by |getmatches()|. Returns 0 4470 if succesfull, otherwise -1. All current matches are cleared 4471 before the list is restored. See example for |getmatches()|. 4383 4472 4384 4473 *setpos()* 4385 4474 setpos({expr}, {list}) … … 5022 5111 position, the returned Number will be the column at the end of 5023 5112 the <Tab>. For example, for a <Tab> in column 1, with 'ts' 5024 5113 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 5114 For the byte position use |col()|. 5115 For the use of {expr} see |col()|. 5116 When 'virtualedit' is used {expr} can be [lnum, col, off], where 5029 5117 "off" is the offset in screen columns from the start of the 5030 5118 character. E.g., a position within a <Tab> or after the last 5031 5119 character. 5032 For the byte position use |col()|.5033 5120 When Virtual editing is active in the current mode, a position 5034 5121 beyond the end of the line can be returned. |'virtualedit'| 5035 5122 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 */ … … 4853 4861 */ 4854 4862 for (e = s; *e != ':' && *e != NUL; ++e) 4855 4863 if (e[0] == '\\' && e[1] == ':') 4856 STRCPY(e, e + 1);4864 mch_memmove(e, e + 1, STRLEN(e)); 4857 4865 if (*e == NUL) 4858 4866 end = TRUE; 4859 4867 -
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/digraph.c
diff -Naur vim71.orig/src/digraph.c vim71/src/digraph.c
old new 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_unload, 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 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) 2101 { 2102 p = compl_orig_text; 2103 actual_compl_length = 0; 2104 while (*p != NUL) 2105 { 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) 2102 2117 { 2103 for (idx = 0; idx < compl_length; ++idx) 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) 2104 2130 { 2105 if (was_letter && isupper(compl_orig_text[idx]) 2106 && islower(IObuff[idx])) 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) … … 7215 7311 p = ml_get_curline(); 7216 7312 if (cin_iscase(p) || cin_isscopedecl(p) || cin_islabel(30)) 7217 7313 return TRUE; 7314 /* Need to get the line again after cin_islabel(). */ 7315 p = ml_get_curline(); 7218 7316 if (curwin->w_cursor.col > 2 7219 7317 && p[curwin->w_cursor.col - 1] == ':' 7220 7318 && p[curwin->w_cursor.col - 2] == ':') … … 7998 8096 /* 7999 8097 * 0^D and ^^D: remove all indent. 8000 8098 */ 8001 if ((lastc == '0' || lastc == '^') && curwin->w_cursor.col) 8099 if (c == Ctrl_D && (lastc == '0' || lastc == '^') 8100 && curwin->w_cursor.col > 0) 8002 8101 { 8003 8102 --curwin->w_cursor.col; 8004 8103 (void)del_char(FALSE); /* delete the '^' or '0' */ -
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(); … … 1411 1416 } 1412 1417 1413 1418 1414 #if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO) 1419 #if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) \ 1420 || defined(FEAT_COMPL_FUNC) || defined(PROTO) 1415 1421 /* 1416 1422 * Call some vimL function and return the result in "*rettv". 1417 1423 * Uses argv[argc] for the function arguments. … … 1484 1490 return ret; 1485 1491 } 1486 1492 1493 # if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO) 1487 1494 /* 1488 1495 * Call vimL function "func" and return the result as a string. 1489 1496 * Returns NULL when calling the function fails. … … 1506 1513 clear_tv(&rettv); 1507 1514 return retval; 1508 1515 } 1516 # endif 1509 1517 1510 # if defined(FEAT_COMPL_FUNC) || defined(PROTO)1518 # if defined(FEAT_COMPL_FUNC) || defined(PROTO) 1511 1519 /* 1512 1520 * Call vimL function "func" and return the result as a number. 1513 1521 * Returns -1 when calling the function fails. … … 1530 1538 clear_tv(&rettv); 1531 1539 return retval; 1532 1540 } 1533 # endif1541 # endif 1534 1542 1535 1543 /* 1536 1544 * Call vimL function "func" and return the result as a list … … 1556 1564 1557 1565 return rettv.vval.v_list; 1558 1566 } 1559 1560 1567 #endif 1561 1568 1569 1562 1570 /* 1563 1571 * Save the current function call pointer, and set it to NULL. 1564 1572 * Used when executing autocommands and for ":source". … … 1691 1699 int semicolon = 0; 1692 1700 char_u op[2]; 1693 1701 char_u *argend; 1702 int first = TRUE; 1694 1703 1695 1704 argend = skip_var_list(arg, &var_count, &semicolon); 1696 1705 if (argend == NULL) … … 1707 1716 EMSG(_(e_invarg)); 1708 1717 else if (!ends_excmd(*arg)) 1709 1718 /* ":let var1 var2" */ 1710 arg = list_arg_vars(eap, arg );1719 arg = list_arg_vars(eap, arg, &first); 1711 1720 else if (!eap->skip) 1712 1721 { 1713 1722 /* ":let" */ 1714 list_glob_vars( );1715 list_buf_vars( );1716 list_win_vars( );1723 list_glob_vars(&first); 1724 list_buf_vars(&first); 1725 list_win_vars(&first); 1717 1726 #ifdef FEAT_WINDOWS 1718 list_tab_vars( );1727 list_tab_vars(&first); 1719 1728 #endif 1720 list_script_vars( );1721 list_func_vars( );1722 list_vim_vars( );1729 list_script_vars(&first); 1730 list_func_vars(&first); 1731 list_vim_vars(&first); 1723 1732 } 1724 1733 eap->nextcmd = check_nextcmd(arg); 1725 1734 } … … 1924 1933 * If "empty" is TRUE also list NULL strings as empty strings. 1925 1934 */ 1926 1935 static void 1927 list_hashtable_vars(ht, prefix, empty )1936 list_hashtable_vars(ht, prefix, empty, first) 1928 1937 hashtab_T *ht; 1929 1938 char_u *prefix; 1930 1939 int empty; 1940 int *first; 1931 1941 { 1932 1942 hashitem_T *hi; 1933 1943 dictitem_T *di; … … 1942 1952 di = HI2DI(hi); 1943 1953 if (empty || di->di_tv.v_type != VAR_STRING 1944 1954 || di->di_tv.vval.v_string != NULL) 1945 list_one_var(di, prefix );1955 list_one_var(di, prefix, first); 1946 1956 } 1947 1957 } 1948 1958 } … … 1951 1961 * List global variables. 1952 1962 */ 1953 1963 static void 1954 list_glob_vars() 1964 list_glob_vars(first) 1965 int *first; 1955 1966 { 1956 list_hashtable_vars(&globvarht, (char_u *)"", TRUE );1967 list_hashtable_vars(&globvarht, (char_u *)"", TRUE, first); 1957 1968 } 1958 1969 1959 1970 /* 1960 1971 * List buffer variables. 1961 1972 */ 1962 1973 static void 1963 list_buf_vars() 1974 list_buf_vars(first) 1975 int *first; 1964 1976 { 1965 1977 char_u numbuf[NUMBUFLEN]; 1966 1978 1967 list_hashtable_vars(&curbuf->b_vars.dv_hashtab, (char_u *)"b:", TRUE); 1979 list_hashtable_vars(&curbuf->b_vars.dv_hashtab, (char_u *)"b:", 1980 TRUE, first); 1968 1981 1969 1982 sprintf((char *)numbuf, "%ld", (long)curbuf->b_changedtick); 1970 list_one_var_a((char_u *)"b:", (char_u *)"changedtick", VAR_NUMBER, numbuf); 1983 list_one_var_a((char_u *)"b:", (char_u *)"changedtick", VAR_NUMBER, 1984 numbuf, first); 1971 1985 } 1972 1986 1973 1987 /* 1974 1988 * List window variables. 1975 1989 */ 1976 1990 static void 1977 list_win_vars() 1991 list_win_vars(first) 1992 int *first; 1978 1993 { 1979 list_hashtable_vars(&curwin->w_vars.dv_hashtab, (char_u *)"w:", TRUE); 1994 list_hashtable_vars(&curwin->w_vars.dv_hashtab, 1995 (char_u *)"w:", TRUE, first); 1980 1996 } 1981 1997 1982 1998 #ifdef FEAT_WINDOWS … … 1984 2000 * List tab page variables. 1985 2001 */ 1986 2002 static void 1987 list_tab_vars() 2003 list_tab_vars(first) 2004 int *first; 1988 2005 { 1989 list_hashtable_vars(&curtab->tp_vars.dv_hashtab, (char_u *)"t:", TRUE); 2006 list_hashtable_vars(&curtab->tp_vars.dv_hashtab, 2007 (char_u *)"t:", TRUE, first); 1990 2008 } 1991 2009 #endif 1992 2010 … … 1994 2012 * List Vim variables. 1995 2013 */ 1996 2014 static void 1997 list_vim_vars() 2015 list_vim_vars(first) 2016 int *first; 1998 2017 { 1999 list_hashtable_vars(&vimvarht, (char_u *)"v:", FALSE );2018 list_hashtable_vars(&vimvarht, (char_u *)"v:", FALSE, first); 2000 2019 } 2001 2020 2002 2021 /* 2003 2022 * List script-local variables, if there is a script. 2004 2023 */ 2005 2024 static void 2006 list_script_vars() 2025 list_script_vars(first) 2026 int *first; 2007 2027 { 2008 2028 if (current_SID > 0 && current_SID <= ga_scripts.ga_len) 2009 list_hashtable_vars(&SCRIPT_VARS(current_SID), (char_u *)"s:", FALSE); 2029 list_hashtable_vars(&SCRIPT_VARS(current_SID), 2030 (char_u *)"s:", FALSE, first); 2010 2031 } 2011 2032 2012 2033 /* 2013 2034 * List function variables, if there is a function. 2014 2035 */ 2015 2036 static void 2016 list_func_vars() 2037 list_func_vars(first) 2038 int *first; 2017 2039 { 2018 2040 if (current_funccal != NULL) 2019 2041 list_hashtable_vars(¤t_funccal->l_vars.dv_hashtab, 2020 (char_u *)"l:", FALSE);2042 (char_u *)"l:", FALSE, first); 2021 2043 } 2022 2044 2023 2045 /* 2024 2046 * List variables in "arg". 2025 2047 */ 2026 2048 static char_u * 2027 list_arg_vars(eap, arg )2049 list_arg_vars(eap, arg, first) 2028 2050 exarg_T *eap; 2029 2051 char_u *arg; 2052 int *first; 2030 2053 { 2031 2054 int error = FALSE; 2032 2055 int len; … … 2083 2106 { 2084 2107 switch (*name) 2085 2108 { 2086 case 'g': list_glob_vars( ); break;2087 case 'b': list_buf_vars( ); break;2088 case 'w': list_win_vars( ); break;2109 case 'g': list_glob_vars(first); break; 2110 case 'b': list_buf_vars(first); break; 2111 case 'w': list_win_vars(first); break; 2089 2112 #ifdef FEAT_WINDOWS 2090 case 't': list_tab_vars( ); break;2113 case 't': list_tab_vars(first); break; 2091 2114 #endif 2092 case 'v': list_vim_vars( ); break;2093 case 's': list_script_vars( ); break;2094 case 'l': list_func_vars( ); break;2115 case 'v': list_vim_vars(first); break; 2116 case 's': list_script_vars(first); break; 2117 case 'l': list_func_vars(first); break; 2095 2118 default: 2096 2119 EMSG2(_("E738: Can't list variables for %s"), name); 2097 2120 } … … 2108 2131 *arg = NUL; 2109 2132 list_one_var_a((char_u *)"", 2110 2133 arg == arg_subsc ? name : name_start, 2111 tv.v_type, s == NULL ? (char_u *)"" : s); 2134 tv.v_type, 2135 s == NULL ? (char_u *)"" : s, 2136 first); 2112 2137 *arg = c; 2113 2138 vim_free(tf); 2114 2139 } … … 6794 6819 * "numbuf" is used for a number. 6795 6820 * Does not put quotes around strings, as ":echo" displays values. 6796 6821 * When "copyID" is not NULL replace recursive lists and dicts with "...". 6797 * May return NULL ;6822 * May return NULL. 6798 6823 */ 6799 6824 static char_u * 6800 6825 echo_string(tv, tofree, numbuf, copyID) … … 6879 6904 * If the memory is allocated "tofree" is set to it, otherwise NULL. 6880 6905 * "numbuf" is used for a number. 6881 6906 * Puts quotes around strings, so that they can be parsed back by eval(). 6882 * May return NULL ;6907 * May return NULL. 6883 6908 */ 6884 6909 static char_u * 6885 6910 tv2string(tv, tofree, numbuf, copyID) … … 7043 7068 {"changenr", 0, 0, f_changenr}, 7044 7069 {"char2nr", 1, 1, f_char2nr}, 7045 7070 {"cindent", 1, 1, f_cindent}, 7071 {"clearmatches", 0, 0, f_clearmatches}, 7046 7072 {"col", 1, 1, f_col}, 7047 7073 #if defined(FEAT_INS_EXPAND) 7048 7074 {"complete", 2, 2, f_complete}, … … 7099 7125 {"getftype", 1, 1, f_getftype}, 7100 7126 {"getline", 1, 2, f_getline}, 7101 7127 {"getloclist", 1, 1, f_getqflist}, 7128 {"getmatches", 0, 0, f_getmatches}, 7102 7129 {"getpos", 1, 1, f_getpos}, 7103 7130 {"getqflist", 0, 0, f_getqflist}, 7104 7131 {"getreg", 0, 2, f_getreg}, … … 7149 7176 {"maparg", 1, 3, f_maparg}, 7150 7177 {"mapcheck", 1, 3, f_mapcheck}, 7151 7178 {"match", 2, 4, f_match}, 7179 {"matchadd", 2, 4, f_matchadd}, 7152 7180 {"matcharg", 1, 1, f_matcharg}, 7181 {"matchdelete", 1, 1, f_matchdelete}, 7153 7182 {"matchend", 2, 4, f_matchend}, 7154 7183 {"matchlist", 2, 4, f_matchlist}, 7155 7184 {"matchstr", 2, 4, f_matchstr}, … … 7190 7219 {"setcmdpos", 1, 1, f_setcmdpos}, 7191 7220 {"setline", 2, 2, f_setline}, 7192 7221 {"setloclist", 2, 3, f_setloclist}, 7222 {"setmatches", 1, 1, f_setmatches}, 7193 7223 {"setpos", 2, 2, f_setpos}, 7194 7224 {"setqflist", 1, 2, f_setqflist}, 7195 7225 {"setreg", 2, 3, f_setreg}, … … 8240 8270 } 8241 8271 8242 8272 /* 8273 * "clearmatches()" function 8274 */ 8275 /*ARGSUSED*/ 8276 static void 8277 f_clearmatches(argvars, rettv) 8278 typval_T *argvars; 8279 typval_T *rettv; 8280 { 8281 #ifdef FEAT_SEARCH_EXTRA 8282 clear_matches(curwin); 8283 #endif 8284 } 8285 8286 /* 8243 8287 * "col(string)" function 8244 8288 */ 8245 8289 static void … … 10136 10180 if (mch_isdir(fname)) 10137 10181 rettv->vval.v_number = 0; 10138 10182 else 10183 { 10139 10184 rettv->vval.v_number = (varnumber_T)st.st_size; 10185 10186 /* non-perfect check for overflow */ 10187 if ((off_t)rettv->vval.v_number != (off_t)st.st_size) 10188 rettv->vval.v_number = -2; 10189 } 10140 10190 } 10141 10191 else 10142 10192 rettv->vval.v_number = -1; … … 10269 10319 } 10270 10320 10271 10321 /* 10322 * "getmatches()" function 10323 */ 10324 /*ARGSUSED*/ 10325 static void 10326 f_getmatches(argvars, rettv) 10327 typval_T *argvars; 10328 typval_T *rettv; 10329 { 10330 #ifdef FEAT_SEARCH_EXTRA 10331 dict_T *dict; 10332 matchitem_T *cur = curwin->w_match_head; 10333 10334 rettv->vval.v_number = 0; 10335 10336 if (rettv_list_alloc(rettv) == OK) 10337 { 10338 while (cur != NULL) 10339 { 10340 dict = dict_alloc(); 10341 if (dict == NULL) 10342 return; 10343 ++dict->dv_refcount; 10344 dict_add_nr_str(dict, "group", 0L, syn_id2name(cur->hlg_id)); 10345 dict_add_nr_str(dict, "pattern", 0L, cur->pattern); 10346 dict_add_nr_str(dict, "priority", (long)cur->priority, NULL); 10347 dict_add_nr_str(dict, "id", (long)cur->id, NULL); 10348 list_append_dict(rettv->vval.v_list, dict); 10349 cur = cur->next; 10350 } 10351 } 10352 #endif 10353 } 10354 10355 /* 10272 10356 * "getpos(string)" function 10273 10357 */ 10274 10358 static void … … 12439 12523 } 12440 12524 12441 12525 /* 12526 * "matchadd()" function 12527 */ 12528 static void 12529 f_matchadd(argvars, rettv) 12530 typval_T *argvars; 12531 typval_T *rettv; 12532 { 12533 #ifdef FEAT_SEARCH_EXTRA 12534 char_u buf[NUMBUFLEN]; 12535 char_u *grp = get_tv_string_buf_chk(&argvars[0], buf); /* group */ 12536 char_u *pat = get_tv_string_buf_chk(&argvars[1], buf); /* pattern */ 12537 int prio = 10; /* default priority */ 12538 int id = -1; 12539 int error = FALSE; 12540 12541 rettv->vval.v_number = -1; 12542 12543 if (grp == NULL || pat == NULL) 12544 return; 12545 if (argvars[2].v_type != VAR_UNKNOWN) 12546 { 12547 prio = get_tv_number_chk(&argvars[2], &error); 12548 if (argvars[3].v_type != VAR_UNKNOWN) 12549 id = get_tv_number_chk(&argvars[3], &error); 12550 } 12551 if (error == TRUE) 12552 return; 12553 if (id >= 1 && id <= 3) 12554 { 12555 EMSGN("E798: ID is reserved for \":match\": %ld", id); 12556 return; 12557 } 12558 12559 rettv->vval.v_number = match_add(curwin, grp, pat, prio, id); 12560 #endif 12561 } 12562 12563 /* 12442 12564 * "matcharg()" function 12443 12565 */ 12444 12566 static void … … 12449 12571 if (rettv_list_alloc(rettv) == OK) 12450 12572 { 12451 12573 #ifdef FEAT_SEARCH_EXTRA 12452 int mi = get_tv_number(&argvars[0]); 12574 int id = get_tv_number(&argvars[0]); 12575 matchitem_T *m; 12453 12576 12454 if ( mi >= 1 && mi<= 3)12577 if (id >= 1 && id <= 3) 12455 12578 { 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); 12579 if ((m = (matchitem_T *)get_match(curwin, id)) != NULL) 12580 { 12581 list_append_string(rettv->vval.v_list, 12582 syn_id2name(m->hlg_id), -1); 12583 list_append_string(rettv->vval.v_list, m->pattern, -1); 12584 } 12585 else 12586 { 12587 list_append_string(rettv->vval.v_list, NUL, -1); 12588 list_append_string(rettv->vval.v_list, NUL, -1); 12589 } 12460 12590 } 12461 12591 #endif 12462 12592 } 12463 12593 } 12464 12594 12465 12595 /* 12596 * "matchdelete()" function 12597 */ 12598 static void 12599 f_matchdelete(argvars, rettv) 12600 typval_T *argvars; 12601 typval_T *rettv; 12602 { 12603 #ifdef FEAT_SEARCH_EXTRA 12604 rettv->vval.v_number = match_delete(curwin, 12605 (int)get_tv_number(&argvars[0]), TRUE); 12606 #endif 12607 } 12608 12609 /* 12466 12610 * "matchend()" function 12467 12611 */ 12468 12612 static void … … 13680 13824 } 13681 13825 /* Shorten "remain". */ 13682 13826 if (*q != NUL) 13683 STRCPY(remain, q -1);13827 mch_memmove(remain, q - 1, STRLEN(q - 1) + 1); 13684 13828 else 13685 13829 { 13686 13830 vim_free(remain); … … 13919 14063 /* If 'n' flag is used: restore cursor position. */ 13920 14064 if (flags & SP_NOMOVE) 13921 14065 curwin->w_cursor = save_cursor; 14066 else 14067 curwin->w_set_curswant = TRUE; 13922 14068 theend: 13923 14069 p_ws = save_p_ws; 13924 14070 … … 14498 14644 } 14499 14645 14500 14646 /* 14647 * "setmatches()" function 14648 */ 14649 static void 14650 f_setmatches(argvars, rettv) 14651 typval_T *argvars; 14652 typval_T *rettv; 14653 { 14654 #ifdef FEAT_SEARCH_EXTRA 14655 list_T *l; 14656 listitem_T *li; 14657 dict_T *d; 14658 14659 rettv->vval.v_number = -1; 14660 if (argvars[0].v_type != VAR_LIST) 14661 { 14662 EMSG(_(e_listreq)); 14663 return; 14664 } 14665 if ((l = argvars[0].vval.v_list) != NULL) 14666 { 14667 14668 /* To some extent make sure that we are dealing with a list from 14669 * "getmatches()". */ 14670 li = l->lv_first; 14671 while (li != NULL) 14672 { 14673 if (li->li_tv.v_type != VAR_DICT 14674 || (d = li->li_tv.vval.v_dict) == NULL) 14675 { 14676 EMSG(_(e_invarg)); 14677 return; 14678 } 14679 if (!(dict_find(d, (char_u *)"group", -1) != NULL 14680 && dict_find(d, (char_u *)"pattern", -1) != NULL 14681 && dict_find(d, (char_u *)"priority", -1) != NULL 14682 && dict_find(d, (char_u *)"id", -1) != NULL)) 14683 { 14684 EMSG(_(e_invarg)); 14685 return; 14686 } 14687 li = li->li_next; 14688 } 14689 14690 clear_matches(curwin); 14691 li = l->lv_first; 14692 while (li != NULL) 14693 { 14694 d = li->li_tv.vval.v_dict; 14695 match_add(curwin, get_dict_string(d, (char_u *)"group", FALSE), 14696 get_dict_string(d, (char_u *)"pattern", FALSE), 14697 (int)get_dict_number(d, (char_u *)"priority"), 14698 (int)get_dict_number(d, (char_u *)"id")); 14699 li = li->li_next; 14700 } 14701 rettv->vval.v_number = 0; 14702 } 14703 #endif 14704 } 14705 14706 /* 14501 14707 * "setpos()" function 14502 14708 */ 14503 14709 /*ARGSUSED*/ … … 14785 14991 14786 14992 p1 = tv2string(&(*(listitem_T **)s1)->li_tv, &tofree1, numbuf1, 0); 14787 14993 p2 = tv2string(&(*(listitem_T **)s2)->li_tv, &tofree2, numbuf2, 0); 14994 if (p1 == NULL) 14995 p1 = (char_u *)""; 14996 if (p2 == NULL) 14997 p2 = (char_u *)""; 14788 14998 if (item_compare_ic) 14789 14999 res = STRICMP(p1, p2); 14790 15000 else … … 15274 15484 15275 15485 rettv->v_type = VAR_STRING; 15276 15486 rettv->vval.v_string = tv2string(&argvars[0], &tofree, numbuf, 0); 15277 if (tofree == NULL) 15487 /* Make a copy if we have a value but it's not in allocate memory. */ 15488 if (rettv->vval.v_string != NULL && tofree == NULL) 15278 15489 rettv->vval.v_string = vim_strsave(rettv->vval.v_string); 15279 15490 } 15280 15491 … … 16497 16708 * Returns NULL when there is an error. 16498 16709 */ 16499 16710 static pos_T * 16500 var2fpos(varp, lnum, fnum)16711 var2fpos(varp, dollar_lnum, fnum) 16501 16712 typval_T *varp; 16502 int lnum;/* TRUE when $ is last line */16713 int dollar_lnum; /* TRUE when $ is last line */ 16503 16714 int *fnum; /* set to fnum for '0, 'A, etc. */ 16504 16715 { 16505 16716 char_u *name; … … 16512 16723 list_T *l; 16513 16724 int len; 16514 16725 int error = FALSE; 16726 listitem_T *li; 16515 16727 16516 16728 l = varp->vval.v_list; 16517 16729 if (l == NULL) … … 16527 16739 if (error) 16528 16740 return NULL; 16529 16741 len = (long)STRLEN(ml_get(pos.lnum)); 16742 16743 /* We accept "$" for the column number: last column. */ 16744 li = list_find(l, 1L); 16745 if (li != NULL && li->li_tv.v_type == VAR_STRING 16746 && li->li_tv.vval.v_string != NULL 16747 && STRCMP(li->li_tv.vval.v_string, "$") == 0) 16748 pos.col = len + 1; 16749 16530 16750 /* Accept a position up to the NUL after the line. */ 16531 16751 if (pos.col == 0 || (int)pos.col > len + 1) 16532 16752 return NULL; /* invalid column number */ … … 16559 16779 pos.coladd = 0; 16560 16780 #endif 16561 16781 16562 if (name[0] == 'w' && lnum)16782 if (name[0] == 'w' && dollar_lnum) 16563 16783 { 16564 16784 pos.col = 0; 16565 16785 if (name[1] == '0') /* "w0": first visible line */ … … 16577 16797 } 16578 16798 else if (name[0] == '$') /* last column or line */ 16579 16799 { 16580 if ( lnum)16800 if (dollar_lnum) 16581 16801 { 16582 16802 pos.lnum = curbuf->b_ml.ml_line_count; 16583 16803 pos.col = 0; … … 17798 18018 * List the value of one internal variable. 17799 18019 */ 17800 18020 static void 17801 list_one_var(v, prefix )18021 list_one_var(v, prefix, first) 17802 18022 dictitem_T *v; 17803 18023 char_u *prefix; 18024 int *first; 17804 18025 { 17805 18026 char_u *tofree; 17806 18027 char_u *s; … … 17808 18029 17809 18030 s = echo_string(&v->di_tv, &tofree, numbuf, ++current_copyID); 17810 18031 list_one_var_a(prefix, v->di_key, v->di_tv.v_type, 17811 s == NULL ? (char_u *)"" : s);18032 s == NULL ? (char_u *)"" : s, first); 17812 18033 vim_free(tofree); 17813 18034 } 17814 18035 17815 18036 static void 17816 list_one_var_a(prefix, name, type, string )18037 list_one_var_a(prefix, name, type, string, first) 17817 18038 char_u *prefix; 17818 18039 char_u *name; 17819 18040 int type; 17820 18041 char_u *string; 18042 int *first; /* when TRUE clear rest of screen and set to FALSE */ 17821 18043 { 17822 msg_attr(prefix, 0); /* don't use msg(), it overwrites "v:statusmsg" */ 18044 /* don't use msg() or msg_attr() to avoid overwriting "v:statusmsg" */ 18045 msg_start(); 18046 msg_puts(prefix); 17823 18047 if (name != NULL) /* "a:" vars don't have a name stored */ 17824 18048 msg_puts(name); 17825 18049 msg_putchar(' '); … … 17847 18071 17848 18072 if (type == VAR_FUNC) 17849 18073 msg_puts((char_u *)"()"); 18074 if (*first) 18075 { 18076 msg_clr_eos(); 18077 *first = FALSE; 18078 } 17850 18079 } 17851 18080 17852 18081 /* … … 19969 20198 char_u buf[MSG_BUF_LEN]; 19970 20199 char_u numbuf2[NUMBUFLEN]; 19971 20200 char_u *tofree; 20201 char_u *s; 19972 20202 19973 20203 msg_puts((char_u *)"("); 19974 20204 for (i = 0; i < argcount; ++i) … … 19979 20209 msg_outnum((long)argvars[i].vval.v_number); 19980 20210 else 19981 20211 { 19982 trunc_string(tv2string(&argvars[i], &tofree, 19983 numbuf2, 0), buf, MSG_BUF_CLEN); 19984 msg_puts(buf); 19985 vim_free(tofree); 20212 s = tv2string(&argvars[i], &tofree, numbuf2, 0); 20213 if (s != NULL) 20214 { 20215 trunc_string(s, buf, MSG_BUF_CLEN); 20216 msg_puts(buf); 20217 vim_free(tofree); 20218 } 19986 20219 } 19987 20220 } 19988 20221 msg_puts((char_u *)")"); … … 20060 20293 char_u buf[MSG_BUF_LEN]; 20061 20294 char_u numbuf2[NUMBUFLEN]; 20062 20295 char_u *tofree; 20296 char_u *s; 20063 20297 20064 20298 /* The value may be very long. Skip the middle part, so that we 20065 20299 * have some idea how it starts and ends. smsg() would always 20066 20300 * 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); 20301 s = tv2string(fc.rettv, &tofree, numbuf2, 0); 20302 if (s != NULL) 20303 { 20304 trunc_string(s, buf, MSG_BUF_CLEN); 20305 smsg((char_u *)_("%s returning %s"), sourcing_name, buf); 20306 vim_free(tofree); 20307 } 20071 20308 } 20072 20309 msg_puts((char_u *)"\n"); /* don't overwrite this either */ 20073 20310 -
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) … … 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. … … 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 */ … … 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) … … 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) … … 4148 4153 4149 4154 #ifdef FEAT_EVAL 4150 4155 if (ccline.cmdfirstc == '=') 4156 { 4157 # ifdef FEAT_CMDL_COMPL 4151 4158 /* pass CMD_SIZE because there is no real command */ 4152 4159 set_context_for_expression(xp, str, CMD_SIZE); 4160 # endif 4161 } 4153 4162 else if (ccline.input_fn) 4154 4163 { 4155 4164 xp->xp_context = ccline.xp_context; 4156 4165 xp->xp_pattern = ccline.cmdbuff; 4166 # if defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL) 4157 4167 xp->xp_arg = ccline.xp_arg; 4168 # endif 4158 4169 } 4159 4170 else 4160 4171 #endif … … 4295 4306 && pat[i + 1] == '\\' 4296 4307 && pat[i + 2] == '\\' 4297 4308 && pat[i + 3] == ' ') 4298 STRCPY(pat + i, pat + i + 3); 4309 mch_memmove(pat + i, pat + i + 3, 4310 STRLEN(pat + i + 3) + 1); 4299 4311 if (xp->xp_backslash == XP_BS_ONE 4300 4312 && pat[i + 1] == ' ') 4301 STRCPY(pat + i, pat + i + 1);4313 mch_memmove(pat + i, pat + i + 1, STRLEN(pat + i)); 4302 4314 } 4303 4315 } 4304 4316 … … 4502 4514 if (xp->xp_context != EXPAND_MENUNAMES && xp->xp_context != EXPAND_MENUS) 4503 4515 sort_strings(*file, *num_file); 4504 4516 4517 #ifdef FEAT_CMDL_COMPL 4518 /* Reset the variables used for special highlight names expansion, so that 4519 * they don't show up when getting normal highlight names by ID. */ 4520 reset_expand_highlight(); 4521 #endif 4522 4505 4523 return OK; 4506 4524 } 4507 4525 … … 4535 4553 pat = vim_strsave(filepat); 4536 4554 for (i = 0; pat[i]; ++i) 4537 4555 if (pat[i] == '\\' && pat[i + 1] == ' ') 4538 STRCPY(pat + i, pat + i + 1);4556 mch_memmove(pat + i, pat + i + 1, STRLEN(pat + i)); 4539 4557 4540 4558 flags |= EW_FILE | EW_EXEC; 4541 4559 -
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) -
src/globals.h
diff -Naur vim71.orig/src/globals.h vim71/src/globals.h
old new 801 801 EXTERN int (*mb_char2bytes) __ARGS((int c, char_u *buf)) INIT(= latin_char2bytes); 802 802 EXTERN int (*mb_ptr2cells) __ARGS((char_u *p)) INIT(= latin_ptr2cells); 803 803 EXTERN int (*mb_char2cells) __ARGS((int c)) INIT(= latin_char2cells); 804 EXTERN int (*mb_off2cells) __ARGS((unsigned off )) INIT(= latin_off2cells);804 EXTERN int (*mb_off2cells) __ARGS((unsigned off, unsigned max_off)) INIT(= latin_off2cells); 805 805 EXTERN int (*mb_ptr2char) __ARGS((char_u *p)) INIT(= latin_ptr2char); 806 806 EXTERN int (*mb_head_off) __ARGS((char_u *base, char_u *p)) INIT(= latin_head_off); 807 807 -
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 … … 5117 5118 p = vim_strsave_escaped(fnames[i], (char_u *)"\\ \t\"|"); 5118 5119 # endif 5119 5120 if (p != NULL) 5120 add_to_input_buf (p, (int)STRLEN(p));5121 add_to_input_buf_csi(p, (int)STRLEN(p)); 5121 5122 vim_free(p); 5122 5123 vim_free(fnames[i]); 5123 5124 } -
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 */ … … 2188 2188 escaped_filename = vim_strsave_escaped(filename, escape_chars); 2189 2189 if (escaped_filename == NULL) 2190 2190 return FALSE; 2191 mksession_cmdline = g_strconcat("mksession ", (char *)escaped_filename, NULL); 2191 mksession_cmdline = g_strconcat("mksession ", (char *)escaped_filename, 2192 NULL); 2192 2193 vim_free(escaped_filename); 2194 2193 2195 /* 2194 2196 * Use a reasonable hardcoded set of 'sessionoptions' flags to avoid 2195 2197 * unpredictable effects when the session is saved automatically. Also, … … 2199 2201 */ 2200 2202 save_ssop_flags = ssop_flags; 2201 2203 ssop_flags = (SSOP_BLANK|SSOP_CURDIR|SSOP_FOLDS|SSOP_GLOBALS 2202 |SSOP_HELP|SSOP_OPTIONS|SSOP_WINSIZE );2204 |SSOP_HELP|SSOP_OPTIONS|SSOP_WINSIZE|SSOP_TABPAGES); 2203 2205 2204 2206 do_cmdline_cmd((char_u *)"let Save_VV_this_session = v:this_session"); 2205 2207 failed = (do_cmdline_cmd((char_u *)mksession_cmdline) == FAIL); -
src/if_cscope.c
diff -Naur vim71.orig/src/if_cscope.c vim71/src/if_cscope.c
old new 73 73 74 74 75 75 static csinfo_T csinfo[CSCOPE_MAX_CONNECTIONS]; 76 static int eap_arg_len; /* length of eap->arg, set in 77 cs_lookup_cmd() */ 76 78 static cscmd_T cs_cmds[] = 77 79 { 78 80 { "add", cs_add, … … 260 262 261 263 if ((p = cs_manage_matches(NULL, NULL, -1, Get)) == NULL) 262 264 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); 265 vim_strncpy(buf, (char_u *)p, size - 1); 271 266 272 267 return FALSE; 273 268 } /* cs_fgets */ … … 386 381 * PRIVATE: cs_add 387 382 * 388 383 * add cscope database or a directory name (to look for cscope.out) 389 * t hethe cscope connection list384 * to the cscope connection list 390 385 * 391 386 * MAXPATHL 256 392 387 */ … … 966 961 } 967 962 968 963 pat = opt + strlen(opt) + 1; 969 if (pat == NULL || (pat != NULL && pat[0] == '\0'))964 if (pat >= (char *)eap->arg + eap_arg_len) 970 965 { 971 966 cs_usage_msg(Find); 972 967 return FALSE; … … 1317 1312 #else 1318 1313 /* compare pathnames first */ 1319 1314 && ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME) 1320 /* if not Windows 9x, test index file at ributes too */1315 /* if not Windows 9x, test index file attributes too */ 1321 1316 || (!mch_windows95() 1322 1317 && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber 1323 1318 && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh … … 1401 1396 if (eap->arg == NULL) 1402 1397 return NULL; 1403 1398 1399 /* Store length of eap->arg before it gets modified by strtok(). */ 1400 eap_arg_len = STRLEN(eap->arg); 1401 1404 1402 if ((stok = strtok((char *)(eap->arg), (const char *)" ")) == NULL) 1405 1403 return NULL; 1406 1404 … … 2195 2193 cs_add_common(dblist[i], pplist[i], fllist[i]); 2196 2194 if (p_csverbose) 2197 2195 { 2198 /* don t' use smsg_attr because want to display2196 /* don't use smsg_attr() because we want to display the 2199 2197 * connection number in the same line as 2200 2198 * "Added cscope database..." 2201 2199 */ -
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/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.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; … … 1360 1381 p = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); 1361 1382 if (p != NULL && *p != NUL) 1362 1383 { 1363 STRCPY(NameBuff, p); 1364 STRCAT(NameBuff, "/lang"); 1384 vim_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p); 1365 1385 bindtextdomain(VIMPACKAGE, (char *)NameBuff); 1366 1386 } 1367 1387 if (mustfree) -
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 1842 1842 int wrap; 1843 1843 1844 1844 did_wait_return = FALSE; 1845 while ( *s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))1845 while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL) 1846 1846 { 1847 1847 /* 1848 1848 * We are at the end of the screen line when: … … 1878 1878 /* output postponed text */ 1879 1879 t_puts(&t_col, t_s, s, attr); 1880 1880 1881 /* When no more prompt an no more room, truncate here */1881 /* When no more prompt and no more room, truncate here */ 1882 1882 if (msg_no_more && lines_left == 0) 1883 1883 break; 1884 1884 … … 1927 1927 * If screen is completely filled and 'more' is set then wait 1928 1928 * for a character. 1929 1929 */ 1930 --lines_left; 1930 if (lines_left > 0) 1931 --lines_left; 1931 1932 if (p_more && lines_left == 0 && State != HITRETURN 1932 1933 && !msg_no_more && !exmode_active) 1933 1934 { … … 2234 2235 { 2235 2236 msgchunk_T *mp; 2236 2237 2237 /* Only show somethi gnif there is more than one line, otherwise it looks2238 /* Only show something if there is more than one line, otherwise it looks 2238 2239 * weird, typing a command without output results in one line. */ 2239 2240 mp = msg_sb_start(last_msgchunk); 2240 2241 if (mp == NULL || mp->sb_prev == NULL) … … 2622 2623 } 2623 2624 } 2624 2625 2625 if (scroll < 0 || (scroll == 0 && mp_last != NULL))2626 if (scroll <= 0) 2626 2627 { 2627 2628 /* displayed the requested text, more prompt again */ 2628 2629 screen_fill((int)Rows - 1, (int)Rows, 0, … … 3456 3457 /* advance to next hotkey and set default hotkey */ 3457 3458 #ifdef FEAT_MBYTE 3458 3459 if (has_mbyte) 3459 hotkp += (*mb_ptr2len)(hotkp);3460 hotkp += STRLEN(hotkp); 3460 3461 else 3461 3462 #endif 3462 3463 ++hotkp; 3463 (void)copy_char(r + 1, hotkp, TRUE);3464 hotkp[copy_char(r + 1, hotkp, TRUE)] = NUL; 3464 3465 if (dfltbutton) 3465 3466 --dfltbutton; 3466 3467 … … 3493 3494 *msgp++ = (dfltbutton == 1) ? ']' : ')'; 3494 3495 3495 3496 /* redefine hotkey */ 3496 (void)copy_char(r, hotkp, TRUE);3497 hotkp[copy_char(r, hotkp, TRUE)] = NUL; 3497 3498 } 3498 3499 } 3499 3500 else … … 3519 3520 *msgp++ = ':'; 3520 3521 *msgp++ = ' '; 3521 3522 *msgp = NUL; 3522 mb_ptr_adv(hotkp);3523 *hotkp = NUL;3524 3523 } 3525 3524 else 3526 3525 { … … 3555 3554 msgp = confirm_msg + 1 + STRLEN(message); 3556 3555 hotkp = hotk; 3557 3556 3558 /* define first default hotkey */ 3559 (void)copy_char(buttons, hotkp, TRUE); 3557 /* Define first default hotkey. Keep the hotkey string NUL 3558 * terminated to avoid reading past the end. */ 3559 hotkp[copy_char(buttons, hotkp, TRUE)] = NUL; 3560 3560 3561 3561 /* Remember where the choices start, displaying starts here when 3562 3562 * "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 … … 4786 4824 static int cin_iswhileofdo __ARGS((char_u *, linenr_T, int)); 4787 4825 static int cin_iswhileofdo_end __ARGS((int terminated, int ind_maxparen, int ind_maxcomment)); 4788 4826 static int cin_isbreak __ARGS((char_u *)); 4789 static int cin_is_cpp_baseclass __ARGS((c har_u *line, colnr_T *col));4827 static int cin_is_cpp_baseclass __ARGS((colnr_T *col)); 4790 4828 static int get_baseclass_amount __ARGS((int col, int ind_maxparen, int ind_maxcomment, int ind_cpp_baseclass)); 4791 4829 static int cin_ends_in __ARGS((char_u *, char_u *, char_u *)); 4792 4830 static int cin_skip2pos __ARGS((pos_T *trypos)); … … 5551 5589 * This is a lot of guessing. Watch out for "cond ? func() : foo". 5552 5590 */ 5553 5591 static int 5554 cin_is_cpp_baseclass(line, col) 5555 char_u *line; 5592 cin_is_cpp_baseclass(col) 5556 5593 colnr_T *col; /* return: column to align with */ 5557 5594 { 5558 5595 char_u *s; 5559 5596 int class_or_struct, lookfor_ctor_init, cpp_base_class; 5560 5597 linenr_T lnum = curwin->w_cursor.lnum; 5598 char_u *line = ml_get_curline(); 5561 5599 5562 5600 *col = 0; 5563 5601 … … 5585 5623 */ 5586 5624 while (lnum > 1) 5587 5625 { 5588 s = skipwhite(ml_get(lnum - 1)); 5626 line = ml_get(lnum - 1); 5627 s = skipwhite(line); 5589 5628 if (*s == '#' || *s == NUL) 5590 5629 break; 5591 5630 while (*s != NUL) … … 5602 5641 --lnum; 5603 5642 } 5604 5643 5605 s = cin_skipcomment(ml_get(lnum)); 5644 line = ml_get(lnum); 5645 s = cin_skipcomment(line); 5606 5646 for (;;) 5607 5647 { 5608 5648 if (*s == NUL) … … 5610 5650 if (lnum == curwin->w_cursor.lnum) 5611 5651 break; 5612 5652 /* Continue in the cursor line. */ 5613 s = cin_skipcomment(ml_get(++lnum)); 5653 line = ml_get(++lnum); 5654 s = cin_skipcomment(line); 5655 if (*s == NUL) 5656 continue; 5614 5657 } 5615 5658 5616 5659 if (s[0] == ':') … … 7079 7122 n = FALSE; 7080 7123 if (lookfor != LOOKFOR_TERM && ind_cpp_baseclass > 0) 7081 7124 { 7082 n = cin_is_cpp_baseclass( l,&col);7125 n = cin_is_cpp_baseclass(&col); 7083 7126 l = ml_get_curline(); 7084 7127 } 7085 7128 if (n) … … 7670 7713 n = FALSE; 7671 7714 if (ind_cpp_baseclass != 0 && theline[0] != '{') 7672 7715 { 7673 n = cin_is_cpp_baseclass( l,&col);7716 n = cin_is_cpp_baseclass(&col); 7674 7717 l = ml_get_curline(); 7675 7718 } 7676 7719 if (n) … … 8596 8639 for (p = buf + wildoff; p < s; ++p) 8597 8640 if (rem_backslash(p)) 8598 8641 { 8599 STRCPY(p, p + 1);8642 mch_memmove(p, p + 1, STRLEN(p)); 8600 8643 --e; 8601 8644 --s; 8602 8645 } … … 8897 8940 for (p = buf + wildoff; p < s; ++p) 8898 8941 if (rem_backslash(p)) 8899 8942 { 8900 STRCPY(p, p + 1);8943 mch_memmove(p, p + 1, STRLEN(p)); 8901 8944 --e; 8902 8945 --s; 8903 8946 } -
src/normal.c
diff -Naur vim71.orig/src/normal.c vim71/src/normal.c
old new 889 889 890 890 ++no_mapping; 891 891 ++allow_keys; /* no mapping for nchar, but allow key codes */ 892 #ifdef FEAT_AUTOCMD 893 /* Don't generate a CursorHold event here, most commands can't handle 894 * it, e.g., nv_replace(), nv_csearch(). */ 895 did_cursorhold = TRUE; 896 #endif 892 897 if (ca.cmdchar == 'g') 893 898 { 894 899 /* … … 3755 3760 extra_len = (int)STRLEN(p); 3756 3761 overflow = old_len + extra_len - SHOWCMD_COLS; 3757 3762 if (overflow > 0) 3758 STRCPY(showcmd_buf, showcmd_buf + overflow); 3763 mch_memmove(showcmd_buf, showcmd_buf + overflow, 3764 old_len - overflow + 1); 3759 3765 STRCAT(showcmd_buf, p); 3760 3766 3761 3767 if (char_avail()) … … 6379 6385 */ 6380 6386 else if (cap->nchar == 'p' || cap->nchar == 'P') 6381 6387 { 6382 if (!checkclearop q(cap->oap))6388 if (!checkclearop(cap->oap)) 6383 6389 { 6384 6390 prep_redo_cmd(cap); 6385 6391 do_put(cap->oap->regname, … … 6662 6668 else 6663 6669 had_ctrl_v = NUL; 6664 6670 6671 /* Abort if the character is a special key. */ 6672 if (IS_SPECIAL(cap->nchar)) 6673 { 6674 clearopbeep(cap->oap); 6675 return; 6676 } 6677 6665 6678 #ifdef FEAT_VISUAL 6666 6679 /* Visual mode "r" */ 6667 6680 if (VIsual_active) … … 6688 6701 } 6689 6702 #endif 6690 6703 6691 /* 6692 * Check for a special key or not enough characters to replace. 6693 */ 6704 /* Abort if not enough characters to replace. */ 6694 6705 ptr = ml_get_cursor(); 6695 if ( IS_SPECIAL(cap->nchar) ||STRLEN(ptr) < (unsigned)cap->count16706 if (STRLEN(ptr) < (unsigned)cap->count1 6696 6707 #ifdef FEAT_MBYTE 6697 6708 || (has_mbyte && mb_charlen(ptr) < cap->count1) 6698 6709 #endif -
src/ops.c
diff -Naur vim71.orig/src/ops.c vim71/src/ops.c
old new 3404 3404 3405 3405 #ifdef FEAT_VIRTUALEDIT 3406 3406 col += curwin->w_cursor.coladd; 3407 if (ve_flags == VE_ALL && curwin->w_cursor.coladd > 0) 3407 if (ve_flags == VE_ALL 3408 && (curwin->w_cursor.coladd > 0 3409 || endcol2 == curwin->w_cursor.col)) 3408 3410 { 3409 3411 if (dir == FORWARD && c == NUL) 3410 3412 ++col; -
src/option.c
diff -Naur vim71.orig/src/option.c vim71/src/option.c
old new 4628 4628 if ((!(flags & P_COMMA) || *s != ',') 4629 4629 && vim_strchr(s + 1, *s) != NULL) 4630 4630 { 4631 STRCPY(s, s + 1);4631 mch_memmove(s, s + 1, STRLEN(s)); 4632 4632 --s; 4633 4633 } 4634 4634 } … … 7118 7118 /* when 'endofline' is changed, redraw the window title */ 7119 7119 else if ((int *)varp == &curbuf->b_p_eol) 7120 7120 need_maketitle = TRUE; 7121 #ifdef FEAT_MBYTE 7122 /* when 'bomb' is changed, redraw the window title */ 7123 else if ((int *)varp == &curbuf->b_p_bomb) 7124 need_maketitle = TRUE; 7125 #endif 7121 7126 #endif 7122 7127 7123 7128 /* when 'bin' is set also set some other options */ … … 8219 8224 varp = get_varp(&options[opt_idx]); 8220 8225 if (varp != NULL) /* hidden option is not changed */ 8221 8226 { 8227 if (number == 0 && string != NULL) 8228 { 8229 int index; 8230 8231 /* Either we are given a string or we are setting option 8232 * to zero. */ 8233 for (index = 0; string[index] == '0'; ++index) 8234 ; 8235 if (string[index] != NUL || index == 0) 8236 { 8237 /* There's another character after zeros or the string 8238 * is empty. In both cases, we are trying to set a 8239 * num option using a string. */ 8240 EMSG3(_("E521: Number required: &%s = '%s'"), 8241 name, string); 8242 return; /* do nothing as we hit an error */ 8243 8244 } 8245 } 8222 8246 if (flags & P_NUM) 8223 8247 (void)set_num_option(opt_idx, varp, number, 8224 8248 NULL, 0, opt_flags); … … 10585 10609 buf->b_start_ffc = *buf->b_p_ff; 10586 10610 buf->b_start_eol = buf->b_p_eol; 10587 10611 #ifdef FEAT_MBYTE 10612 buf->b_start_bomb = buf->b_p_bomb; 10613 10588 10614 /* Only use free/alloc when necessary, they take time. */ 10589 10615 if (buf->b_start_fenc == NULL 10590 10616 || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) … … 10598 10624 /* 10599 10625 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value 10600 10626 * from when editing started (save_file_ff() called). 10601 * Also when 'endofline' was changed and 'binary' is set. 10627 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was 10628 * changed and 'binary' is not set. 10602 10629 * Don't consider a new, empty buffer to be changed. 10603 10630 */ 10604 10631 int 10605 10632 file_ff_differs(buf) 10606 10633 buf_T *buf; 10607 10634 { 10635 /* In a buffer that was never loaded the options are not valid. */ 10636 if (buf->b_flags & BF_NEVERLOADED) 10637 return FALSE; 10608 10638 if ((buf->b_flags & BF_NEW) 10609 10639 && buf->b_ml.ml_line_count == 1 10610 10640 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL) … … 10614 10644 if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol) 10615 10645 return TRUE; 10616 10646 #ifdef FEAT_MBYTE 10647 if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb) 10648 return TRUE; 10617 10649 if (buf->b_start_fenc == NULL) 10618 10650 return (*buf->b_p_fenc != NUL); 10619 10651 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)); -
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/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 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 -
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 { … … 2542 2555 2543 2556 char_u extra[18]; /* "%ld" and 'fdc' must fit in here */ 2544 2557 int n_extra = 0; /* number of extra chars */ 2545 char_u *p_extra = NULL; /* string of extra chars */2558 char_u *p_extra = NULL; /* string of extra chars, plus NUL */ 2546 2559 int c_extra = NUL; /* extra chars, all the same */ 2547 2560 int extra_attr = 0; /* attributes when n_extra != 0 */ 2548 2561 static char_u *at_end_str = (char_u *)""; /* used for p_extra when … … 2626 2639 int line_attr = 0; /* atrribute for the whole line */ 2627 2640 #endif 2628 2641 #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; 2642 matchitem_T *cur; /* points to the match list */ 2643 match_T *shl; /* points to search_hl or a match */ 2644 int shl_flag; /* flag to indicate whether search_hl 2645 has been processed or not */ 2646 int prevcol_hl_flag; /* flag to indicate whether prevcol 2647 equals startcol of search_hl or one 2648 of the matches */ 2633 2649 #endif 2634 2650 #ifdef FEAT_ARABIC 2635 2651 int prev_c = 0; /* previous Arabic character */ … … 3074 3090 3075 3091 #ifdef FEAT_SEARCH_EXTRA 3076 3092 /* 3077 * Handle highlighting the last used search pattern and ":match".3078 * Do this for both search_hl and match_hl[3].3093 * Handle highlighting the last used search pattern and matches. 3094 * Do this for both search_hl and the match list. 3079 3095 */ 3080 for (i = 3; i >= 0; --i) 3096 cur = wp->w_match_head; 3097 shl_flag = FALSE; 3098 while (cur != NULL || shl_flag == FALSE) 3081 3099 { 3082 shl = (i == 3) ? &search_hl : &match_hl[i]; 3100 if (shl_flag == FALSE) 3101 { 3102 shl = &search_hl; 3103 shl_flag = TRUE; 3104 } 3105 else 3106 shl = &cur->hl; 3083 3107 shl->startcol = MAXCOL; 3084 3108 shl->endcol = MAXCOL; 3085 3109 shl->attr_cur = 0; … … 3122 3146 area_highlighting = TRUE; 3123 3147 } 3124 3148 } 3149 if (shl != &search_hl && cur != NULL) 3150 cur = cur->next; 3125 3151 } 3126 3152 #endif 3127 3153 … … 3163 3189 if (cmdwin_type != 0 && wp == curwin) 3164 3190 { 3165 3191 /* Draw the cmdline character. */ 3166 *extra = cmdwin_type;3167 3192 n_extra = 1; 3168 p_extra = extra; 3169 c_extra = NUL; 3193 c_extra = cmdwin_type; 3170 3194 char_attr = hl_attr(HLF_AT); 3171 3195 } 3172 3196 } … … 3182 3206 fill_foldcolumn(extra, wp, FALSE, lnum); 3183 3207 n_extra = wp->w_p_fdc; 3184 3208 p_extra = extra; 3209 p_extra[n_extra] = NUL; 3185 3210 c_extra = NUL; 3186 3211 char_attr = hl_attr(HLF_FC); 3187 3212 } … … 3388 3413 * After end, check for start/end of next match. 3389 3414 * When another match, have to check for start again. 3390 3415 * Watch out for matching an empty string! 3391 * Do this f irst for search_hl, then for match_hl, so that3392 * ":match" overrules 'hlsearch'.3416 * Do this for 'search_hl' and the match list (ordered by 3417 * priority). 3393 3418 */ 3394 3419 v = (long)(ptr - line); 3395 for (i = 3; i >= 0; --i) 3396 { 3397 shl = (i == 3) ? &search_hl : &match_hl[i]; 3420 cur = wp->w_match_head; 3421 shl_flag = FALSE; 3422 while (cur != NULL || shl_flag == FALSE) 3423 { 3424 if (shl_flag == FALSE 3425 && ((cur != NULL 3426 && cur->priority > SEARCH_HL_PRIORITY) 3427 || cur == NULL)) 3428 { 3429 shl = &search_hl; 3430 shl_flag = TRUE; 3431 } 3432 else 3433 shl = &cur->hl; 3398 3434 while (shl->rm.regprog != NULL) 3399 3435 { 3400 3436 if (shl->startcol != MAXCOL … … 3442 3478 } 3443 3479 break; 3444 3480 } 3481 if (shl != &search_hl && cur != NULL) 3482 cur = cur->next; 3445 3483 } 3446 3484 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) 3485 /* Use attributes from match with highest priority among 3486 * 'search_hl' and the match list. */ 3487 search_attr = search_hl.attr_cur; 3488 cur = wp->w_match_head; 3489 shl_flag = FALSE; 3490 while (cur != NULL || shl_flag == FALSE) 3491 { 3492 if (shl_flag == FALSE 3493 && ((cur != NULL 3494 && cur->priority > SEARCH_HL_PRIORITY) 3495 || cur == NULL)) 3452 3496 { 3453 s earch_attr = match_hl[i].attr_cur;3454 break;3497 shl = &search_hl; 3498 shl_flag = TRUE; 3455 3499 } 3500 else 3501 shl = &cur->hl; 3502 if (shl->attr_cur != 0) 3503 search_attr = shl->attr_cur; 3504 if (shl != &search_hl && cur != NULL) 3505 cur = cur->next; 3506 } 3456 3507 } 3457 3508 #endif 3458 3509 3459 3510 #ifdef FEAT_DIFF 3460 3511 if (diff_hlf != (hlf_T)0) 3461 3512 { 3462 if (diff_hlf == HLF_CHD && ptr - line >= change_start) 3513 if (diff_hlf == HLF_CHD && ptr - line >= change_start 3514 && n_extra == 0) 3463 3515 diff_hlf = HLF_TXD; /* changed text */ 3464 if (diff_hlf == HLF_TXD && ptr - line > change_end) 3516 if (diff_hlf == HLF_TXD && ptr - line > change_end 3517 && n_extra == 0) 3465 3518 diff_hlf = HLF_CHD; /* changed line */ 3466 3519 line_attr = hl_attr(diff_hlf); 3467 3520 } … … 3496 3549 * Get the next character to put on the screen. 3497 3550 */ 3498 3551 /* 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. 3552 * The "p_extra" points to the extra stuff that is inserted to 3553 * represent special characters (non-printable stuff) and other 3554 * things. When all characters are the same, c_extra is used. 3555 * "p_extra" must end in a NUL to avoid mb_ptr2len() reads past 3556 * "p_extra[n_extra]". 3502 3557 * For the '$' of the 'list' option, n_extra == 1, p_extra == "". 3503 3558 */ 3504 3559 if (n_extra > 0) … … 3611 3666 * Draw it as a space with a composing char. */ 3612 3667 if (utf_iscomposing(mb_c)) 3613 3668 { 3669 int i; 3670 3614 3671 for (i = Screen_mco - 1; i > 0; --i) 3615 3672 u8cc[i] = u8cc[i - 1]; 3616 3673 u8cc[0] = mb_c; … … 3752 3809 * a '<' in the first column. */ 3753 3810 if (n_skip > 0 && mb_l > 1) 3754 3811 { 3755 extra[0] = '<';3756 p_extra = extra;3757 3812 n_extra = 1; 3758 c_extra = NUL;3813 c_extra = '<'; 3759 3814 c = ' '; 3760 3815 if (area_attr == 0 && search_attr == 0) 3761 3816 { … … 4254 4309 * highlight match at end of line. If it's beyond the last 4255 4310 * char on the screen, just overwrite that one (tricky!) Not 4256 4311 * needed when a '$' was displayed for 'list'. */ 4312 #ifdef FEAT_SEARCH_EXTRA 4313 prevcol_hl_flag = FALSE; 4314 if (prevcol == (long)search_hl.startcol) 4315 prevcol_hl_flag = TRUE; 4316 else 4317 { 4318 cur = wp->w_match_head; 4319 while (cur != NULL) 4320 { 4321 if (prevcol == (long)cur->hl.startcol) 4322 { 4323 prevcol_hl_flag = TRUE; 4324 break; 4325 } 4326 cur = cur->next; 4327 } 4328 } 4329 #endif 4257 4330 if (lcs_eol == lcs_eol_one 4258 4331 && ((area_attr != 0 && vcol == fromcol && c == NUL) 4259 4332 #ifdef FEAT_SEARCH_EXTRA 4260 4333 /* 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) 4334 || (prevcol_hl_flag == TRUE 4265 4335 # if defined(LINE_ATTR) 4266 4336 && did_line_attr <= 1 4267 4337 # endif … … 4302 4372 #ifdef FEAT_SEARCH_EXTRA 4303 4373 if (area_attr == 0) 4304 4374 { 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) 4375 /* Use attributes from match with highest priority among 4376 * 'search_hl' and the match list. */ 4377 char_attr = search_hl.attr; 4378 cur = wp->w_match_head; 4379 shl_flag = FALSE; 4380 while (cur != NULL || shl_flag == FALSE) 4381 { 4382 if (shl_flag == FALSE 4383 && ((cur != NULL 4384 && cur->priority > SEARCH_HL_PRIORITY) 4385 || cur == NULL)) 4310 4386 { 4311 char_attr = match_hl[i].attr;4312 break;4387 shl = &search_hl; 4388 shl_flag = TRUE; 4313 4389 } 4390 else 4391 shl = &cur->hl; 4392 if ((ptr - line) - 1 == (long)shl->startcol) 4393 char_attr = shl->attr; 4394 if (shl != &search_hl && cur != NULL) 4395 cur = cur->next; 4314 4396 } 4315 4397 } 4316 4398 #endif … … 4460 4542 { 4461 4543 if (mb_utf8) 4462 4544 { 4545 int i; 4546 4463 4547 ScreenLinesUC[off] = mb_c; 4464 4548 if ((c & 0xff) == 0) 4465 4549 ScreenLines[off] = 0x80; /* avoid storing zero */ … … 4548 4632 4549 4633 /* 4550 4634 * 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.4635 * so far. If there is no more to display it is caught above. 4552 4636 */ 4553 4637 if (( 4554 4638 #ifdef FEAT_RIGHTLEFT … … 4625 4709 #endif 4626 4710 #ifdef FEAT_MBYTE 4627 4711 && !(has_mbyte 4628 && ((*mb_off2cells)(LineOffset[screen_row]) == 2 4712 && ((*mb_off2cells)(LineOffset[screen_row], 4713 LineOffset[screen_row] + screen_Columns) 4714 == 2 4629 4715 || (*mb_off2cells)(LineOffset[screen_row - 1] 4630 + (int)Columns - 2) == 2)) 4716 + (int)Columns - 2, 4717 LineOffset[screen_row] + screen_Columns) 4718 == 2)) 4631 4719 #endif 4632 4720 ) 4633 4721 { … … 4787 4875 { 4788 4876 unsigned off_from; 4789 4877 unsigned off_to; 4878 #ifdef FEAT_MBYTE 4879 unsigned max_off_from; 4880 unsigned max_off_to; 4881 #endif 4790 4882 int col = 0; 4791 4883 #if defined(FEAT_GUI) || defined(UNIX) || defined(FEAT_VERTSPLIT) 4792 4884 int hl; … … 4813 4905 4814 4906 off_from = (unsigned)(current_ScreenLine - ScreenLines); 4815 4907 off_to = LineOffset[row] + coloff; 4908 #ifdef FEAT_MBYTE 4909 max_off_from = off_from + screen_Columns; 4910 max_off_to = LineOffset[row] + screen_Columns; 4911 #endif 4816 4912 4817 4913 #ifdef FEAT_RIGHTLEFT 4818 4914 if (rlflag) … … 4847 4943 { 4848 4944 #ifdef FEAT_MBYTE 4849 4945 if (has_mbyte && (col + 1 < endcol)) 4850 char_cells = (*mb_off2cells)(off_from );4946 char_cells = (*mb_off2cells)(off_from, max_off_from); 4851 4947 else 4852 4948 char_cells = 1; 4853 4949 #endif … … 4924 5020 * ScreenLinesUC[] is sufficient. */ 4925 5021 if (char_cells == 1 4926 5022 && col + 1 < endcol 4927 && (*mb_off2cells)(off_to ) > 1)5023 && (*mb_off2cells)(off_to, max_off_to) > 1) 4928 5024 { 4929 5025 /* Writing a single-cell character over a double-cell 4930 5026 * character: need to redraw the next cell. */ … … 4933 5029 } 4934 5030 else if (char_cells == 2 4935 5031 && col + 2 < endcol 4936 && (*mb_off2cells)(off_to ) == 14937 && (*mb_off2cells)(off_to + 1 ) > 1)5032 && (*mb_off2cells)(off_to, max_off_to) == 1 5033 && (*mb_off2cells)(off_to + 1, max_off_to) > 1) 4938 5034 { 4939 5035 /* Writing the second half of a double-cell character over 4940 5036 * a double-cell character: need to redraw the second … … 4953 5049 * char over the left halve of an existing one. */ 4954 5050 if (has_mbyte && col + char_cells == endcol 4955 5051 && ((char_cells == 1 4956 && (*mb_off2cells)(off_to ) > 1)5052 && (*mb_off2cells)(off_to, max_off_to) > 1) 4957 5053 || (char_cells == 2 4958 && (*mb_off2cells)(off_to ) == 14959 && (*mb_off2cells)(off_to + 1 ) > 1)))5054 && (*mb_off2cells)(off_to, max_off_to) == 1 5055 && (*mb_off2cells)(off_to + 1, max_off_to) > 1))) 4960 5056 clear_next = TRUE; 4961 5057 #endif 4962 5058 … … 5096 5192 /* find previous character by counting from first 5097 5193 * column and get its width. */ 5098 5194 unsigned off = LineOffset[row]; 5195 unsigned max_off = LineOffset[row] + screen_Columns; 5099 5196 5100 5197 while (off < off_to) 5101 5198 { 5102 prev_cells = (*mb_off2cells)(off );5199 prev_cells = (*mb_off2cells)(off, max_off); 5103 5200 off += prev_cells; 5104 5201 } 5105 5202 } … … 5285 5382 static int skip_status_match_char __ARGS((expand_T *xp, char_u *s)); 5286 5383 5287 5384 /* 5288 * Get the leng htof an item as it will be shown in the status line.5385 * Get the length of an item as it will be shown in the status line. 5289 5386 */ 5290 5387 static int 5291 5388 status_match_len(xp, s) … … 5351 5448 int row; 5352 5449 char_u *buf; 5353 5450 int len; 5354 int clen; /* leng htin screen cells */5451 int clen; /* length in screen cells */ 5355 5452 int fillchar; 5356 5453 int attr; 5357 5454 int i; … … 6103 6200 char_u *ptr = text; 6104 6201 int c; 6105 6202 #ifdef FEAT_MBYTE 6203 unsigned max_off; 6106 6204 int mbyte_blen = 1; 6107 6205 int mbyte_cells = 1; 6108 6206 int u8c = 0; … … 6119 6217 return; 6120 6218 6121 6219 off = LineOffset[row] + col; 6122 while (*ptr != NUL && col < screen_Columns 6123 && (len < 0 || (int)(ptr - text) < len)) 6220 #ifdef FEAT_MBYTE 6221 max_off = LineOffset[row] + screen_Columns; 6222 #endif 6223 while (col < screen_Columns 6224 && (len < 0 || (int)(ptr - text) < len) 6225 && *ptr != NUL) 6124 6226 { 6125 6227 c = *ptr; 6126 6228 #ifdef FEAT_MBYTE … … 6241 6343 else if (has_mbyte 6242 6344 && (len < 0 ? ptr[mbyte_blen] == NUL 6243 6345 : ptr + mbyte_blen >= text + len) 6244 && ((mbyte_cells == 1 && (*mb_off2cells)(off ) > 1)6346 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1) 6245 6347 || (mbyte_cells == 2 6246 && (*mb_off2cells)(off ) == 16247 && (*mb_off2cells)(off + 1 ) > 1)))6348 && (*mb_off2cells)(off, max_off) == 1 6349 && (*mb_off2cells)(off + 1, max_off) > 1))) 6248 6350 clear_next_cell = TRUE; 6249 6351 6250 6352 /* Make sure we never leave a second byte of a double-byte behind, 6251 6353 * it confuses mb_off2cells(). */ 6252 6354 if (enc_dbcs 6253 && ((mbyte_cells == 1 && (*mb_off2cells)(off ) > 1)6355 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1) 6254 6356 || (mbyte_cells == 2 6255 && (*mb_off2cells)(off ) == 16256 && (*mb_off2cells)(off + 1 ) > 1)))6357 && (*mb_off2cells)(off, max_off) == 1 6358 && (*mb_off2cells)(off + 1, max_off) > 1))) 6257 6359 ScreenLines[off + mbyte_blen] = 0; 6258 6360 #endif 6259 6361 ScreenLines[off] = c; … … 6318 6420 6319 6421 #ifdef FEAT_SEARCH_EXTRA 6320 6422 /* 6321 * Prepare for ' searchhl' highlighting.6423 * Prepare for 'hlsearch' highlighting. 6322 6424 */ 6323 6425 static void 6324 6426 start_search_hl() … … 6331 6433 } 6332 6434 6333 6435 /* 6334 * Clean up for ' searchhl' highlighting.6436 * Clean up for 'hlsearch' highlighting. 6335 6437 */ 6336 6438 static void 6337 6439 end_search_hl() … … 6351 6453 win_T *wp; 6352 6454 linenr_T lnum; 6353 6455 { 6354 match_T *shl; /* points to search_hl or match_hl */ 6456 matchitem_T *cur; /* points to the match list */ 6457 match_T *shl; /* points to search_hl or a match */ 6458 int shl_flag; /* flag to indicate whether search_hl 6459 has been processed or not */ 6355 6460 int n; 6356 int i;6357 6461 6358 6462 /* 6359 6463 * When using a multi-line pattern, start searching at the top 6360 6464 * of the window or just after a closed fold. 6361 * Do this both for search_hl and match_hl[3].6465 * Do this both for search_hl and the match list. 6362 6466 */ 6363 for (i = 3; i >= 0; --i) 6467 cur = wp->w_match_head; 6468 shl_flag = FALSE; 6469 while (cur != NULL || shl_flag == FALSE) 6364 6470 { 6365 shl = (i == 3) ? &search_hl : &match_hl[i]; 6471 if (shl_flag == FALSE) 6472 { 6473 shl = &search_hl; 6474 shl_flag = TRUE; 6475 } 6476 else 6477 shl = &cur->hl; 6366 6478 if (shl->rm.regprog != NULL 6367 6479 && shl->lnum == 0 6368 6480 && re_multiline(shl->rm.regprog)) … … 6397 6509 } 6398 6510 } 6399 6511 } 6512 if (shl != &search_hl && cur != NULL) 6513 cur = cur->next; 6400 6514 } 6401 6515 } 6402 6516 6403 6517 /* 6404 * Search for a next ' searchl' or ":match"match.6518 * Search for a next 'hlsearch' or match. 6405 6519 * Uses shl->buf. 6406 6520 * Sets shl->lnum and shl->rm contents. 6407 6521 * Note: Assumes a previous match is always before "lnum", unless … … 6411 6525 static void 6412 6526 next_search_hl(win, shl, lnum, mincol) 6413 6527 win_T *win; 6414 match_T *shl; /* points to search_hl or match_hl*/6528 match_T *shl; /* points to search_hl or a match */ 6415 6529 linenr_T lnum; 6416 6530 colnr_T mincol; /* minimal column for a match */ 6417 6531 { … … 6479 6593 /* Error while handling regexp: stop using this regexp. */ 6480 6594 if (shl == &search_hl) 6481 6595 { 6482 /* don't free the regprog in match_hl[], it's a copy */6596 /* don't free regprog in the match list, it's a copy */ 6483 6597 vim_free(shl->rm.regprog); 6484 6598 no_hlsearch = TRUE; 6485 6599 } … … 6827 6941 { 6828 6942 int r, c; 6829 6943 int off; 6944 #ifdef FEAT_MBYTE 6945 int max_off; 6946 #endif 6830 6947 6831 6948 /* Can't use ScreenLines unless initialized */ 6832 6949 if (ScreenLines == NULL) … … 6837 6954 for (r = row; r < row + height; ++r) 6838 6955 { 6839 6956 off = LineOffset[r]; 6957 #ifdef FEAT_MBYTE 6958 max_off = off + screen_Columns; 6959 #endif 6840 6960 for (c = col; c < col + width; ++c) 6841 6961 { 6842 6962 #ifdef FEAT_MBYTE 6843 if (enc_dbcs != 0 && dbcs_off2cells(off + c ) > 1)6963 if (enc_dbcs != 0 && dbcs_off2cells(off + c, max_off) > 1) 6844 6964 { 6845 6965 screen_char_2(off + c, r, c); 6846 6966 ++c; … … 6850 6970 { 6851 6971 screen_char(off + c, r, c); 6852 6972 #ifdef FEAT_MBYTE 6853 if (utf_off2cells(off + c ) > 1)6973 if (utf_off2cells(off + c, max_off) > 1) 6854 6974 ++c; 6855 6975 #endif 6856 6976 } -
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 1453 1453 #ifdef FEAT_MBYTE 1454 1454 char_u *b_start_fenc; /* 'fileencoding' when edit started or NULL */ 1455 1455 int b_bad_char; /* "++bad=" argument when edit started or 0 */ 1456 int b_start_bomb; /* 'bomb' when it was read */ 1456 1457 #endif 1457 1458 1458 1459 #ifdef FEAT_EVAL … … 1694 1695 #define FR_COL 2 /* frame with a column of windows */ 1695 1696 1696 1697 /* 1698 * Struct used for highlighting 'hlsearch' matches, matches defined by 1699 * ":match" and matches defined by match functions. 1700 * For 'hlsearch' there is one pattern for all windows. For ":match" and the 1701 * match functions there is a different pattern for each window. 1702 */ 1703 typedef struct 1704 { 1705 regmmatch_T rm; /* points to the regexp program; contains last found 1706 match (may continue in next line) */ 1707 buf_T *buf; /* the buffer to search for a match */ 1708 linenr_T lnum; /* the line to search for a match */ 1709 int attr; /* attributes to be used for a match */ 1710 int attr_cur; /* attributes currently active in win_line() */ 1711 linenr_T first_lnum; /* first lnum to search for multi-line pat */ 1712 colnr_T startcol; /* in win_line() points to char where HL starts */ 1713 colnr_T endcol; /* in win_line() points to char where HL ends */ 1714 } match_T; 1715 1716 /* 1717 * matchitem_T provides a linked list for storing match items for ":match" and 1718 * the match functions. 1719 */ 1720 typedef struct matchitem matchitem_T; 1721 struct matchitem 1722 { 1723 matchitem_T *next; 1724 int id; /* match ID */ 1725 int priority; /* match priority */ 1726 char_u *pattern; /* pattern to highlight */ 1727 int hlg_id; /* highlight group ID */ 1728 regmmatch_T match; /* regexp program for pattern */ 1729 match_T hl; /* struct for doing the actual highlighting */ 1730 }; 1731 1732 /* 1697 1733 * Structure which contains all information that belongs to a window 1698 1734 * 1699 1735 * All row numbers are relative to the start of the window, except w_winrow. … … 1934 1970 #endif 1935 1971 1936 1972 #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" */ 1973 matchitem_T *w_match_head; /* head of match list */ 1974 int w_next_match_id; /* next match ID */ 1940 1975 #endif 1941 1976 1942 1977 /* -
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 … … 4460 4491 current_syn_inc_tag = ++running_syn_inc_tag; 4461 4492 prev_toplvl_grp = curbuf->b_syn_topgrp; 4462 4493 curbuf->b_syn_topgrp = sgl_id; 4463 if (source ? do_source(eap->arg, FALSE, FALSE) == FAIL4464 : source_runtime(eap->arg, DOSO_NONE) == FAIL)4494 if (source ? do_source(eap->arg, FALSE, DOSO_NONE) == FAIL 4495 : source_runtime(eap->arg, TRUE) == FAIL) 4465 4496 EMSG2(_(e_notopen), eap->arg); 4466 4497 curbuf->b_syn_topgrp = prev_toplvl_grp; 4467 4498 current_syn_inc_tag = prev_syn_inc_tag; … … 5956 5987 { 5957 5988 return (buf->b_syn_patterns.ga_len != 0 5958 5989 || buf->b_syn_clusters.ga_len != 0 5959 || curbuf->b_keywtab.ht_used > 05960 || curbuf->b_keywtab_ic.ht_used > 0);5990 || buf->b_keywtab.ht_used > 0 5991 || buf->b_keywtab_ic.ht_used > 0); 5961 5992 } 5962 5993 5963 5994 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) … … 5968 5999 EXP_CASE /* expand ":syn case" arguments */ 5969 6000 } expand_what; 5970 6001 6002 /* 6003 * Reset include_link, include_default, include_none to 0. 6004 * Called when we are done expanding. 6005 */ 6006 void 6007 reset_expand_highlight() 6008 { 6009 include_link = include_default = include_none = 0; 6010 } 6011 6012 /* 6013 * Handle command line completion for :match and :echohl command: Add "None" 6014 * as highlight group. 6015 */ 6016 void 6017 set_context_in_echohl_cmd(xp, arg) 6018 expand_T *xp; 6019 char_u *arg; 6020 { 6021 xp->xp_context = EXPAND_HIGHLIGHT; 6022 xp->xp_pattern = arg; 6023 include_none = 1; 6024 } 5971 6025 5972 6026 /* 5973 6027 * Handle command line completion for :syntax command. … … 5983 6037 xp->xp_context = EXPAND_SYNTAX; 5984 6038 expand_what = EXP_SUBCMD; 5985 6039 xp->xp_pattern = arg; 5986 include_link = FALSE;5987 include_default = FALSE;6040 include_link = 0; 6041 include_default = 0; 5988 6042 5989 6043 /* (part of) subcommand already typed */ 5990 6044 if (*arg != NUL) … … 8479 8533 syn_id2name(id) 8480 8534 int id; 8481 8535 { 8482 if (id <= 0 || id > =highlight_ga.ga_len)8536 if (id <= 0 || id > highlight_ga.ga_len) 8483 8537 return (char_u *)""; 8484 8538 return HL_TABLE()[id - 1].sg_name; 8485 8539 } … … 8949 9003 return OK; 8950 9004 } 8951 9005 8952 #if def FEAT_CMDL_COMPL9006 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) 8953 9007 8954 9008 static void highlight_list __ARGS((void)); 8955 9009 static void highlight_list_two __ARGS((int cnt, int attr)); … … 8967 9021 /* Default: expand group names */ 8968 9022 xp->xp_context = EXPAND_HIGHLIGHT; 8969 9023 xp->xp_pattern = arg; 8970 include_link = TRUE;8971 include_default = TRUE;9024 include_link = 2; 9025 include_default = 1; 8972 9026 8973 9027 /* (part of) subcommand already typed */ 8974 9028 if (*arg != NUL) … … 8976 9030 p = skiptowhite(arg); 8977 9031 if (*p != NUL) /* past "default" or group name */ 8978 9032 { 8979 include_default = FALSE;9033 include_default = 0; 8980 9034 if (STRNCMP("default", arg, p - arg) == 0) 8981 9035 { 8982 9036 arg = skipwhite(p); … … 8985 9039 } 8986 9040 if (*p != NUL) /* past group name */ 8987 9041 { 8988 include_link = FALSE;9042 include_link = 0; 8989 9043 if (arg[1] == 'i' && arg[0] == 'N') 8990 9044 highlight_list(); 8991 9045 if (STRNCMP("link", arg, p - arg) == 0 … … 9045 9099 expand_T *xp; 9046 9100 int idx; 9047 9101 { 9048 if (idx == highlight_ga.ga_len9049 9102 #ifdef FEAT_CMDL_COMPL 9050 && include_link 9051 #endif 9052 ) 9103 if (idx == highlight_ga.ga_len && include_none != 0) 9104 return (char_u *)"none"; 9105 if (idx == highlight_ga.ga_len + include_none && include_default != 0) 9106 return (char_u *)"default"; 9107 if (idx == highlight_ga.ga_len + include_none + include_default 9108 && include_link != 0) 9053 9109 return (char_u *)"link"; 9054 if (idx == highlight_ga.ga_len + 1 9055 #ifdef FEAT_CMDL_COMPL 9056 && include_link 9057 #endif 9058 ) 9110 if (idx == highlight_ga.ga_len + include_none + include_default + 1 9111 && include_link != 0) 9059 9112 return (char_u *)"clear"; 9060 if (idx == highlight_ga.ga_len + 29061 #ifdef FEAT_CMDL_COMPL9062 && include_default9063 9113 #endif 9064 )9065 return (char_u *)"default";9066 9114 if (idx < 0 || idx >= highlight_ga.ga_len) 9067 9115 return NULL; 9068 9116 return HL_TABLE()[idx].sg_name; 9069 9117 } 9070 9118 #endif 9071 9119 9072 #if def FEAT_GUI9120 #if defined(FEAT_GUI) || defined(PROTO) 9073 9121 /* 9074 9122 * Free all the highlight group fonts. 9075 9123 * Used when quitting for systems which need it. -
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 --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 … … 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; \ -
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 succesfull 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 succesfull 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 succesfull 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 : endif 48 :endfor 49 :/^Results/,$wq! test.out 50 ENDTEST 51 52 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/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 94, 671 /**/ 672 93, 673 /**/ 674 90, 675 /**/ 676 89, 677 /**/ 678 87, 679 /**/ 680 86, 681 /**/ 682 85, 683 /**/ 684 84, 685 /**/ 686 83, 687 /**/ 688 82, 689 /**/ 690 81, 691 /**/ 692 79, 693 /**/ 694 78, 695 /**/ 696 77, 697 /**/ 698 76, 699 /**/ 700 75, 701 /**/ 702 74, 703 /**/ 704 73, 705 /**/ 706 71, 707 /**/ 708 69, 709 /**/ 710 68, 711 /**/ 712 67, 713 /**/ 714 66, 715 /**/ 716 64, 717 /**/ 718 63, 719 /**/ 720 62, 721 /**/ 722 61, 723 /**/ 724 60, 725 /**/ 726 59, 727 /**/ 728 58, 729 /**/ 730 57, 731 /**/ 732 56, 733 /**/ 734 55, 735 /**/ 736 54, 737 /**/ 738 53, 739 /**/ 740 52, 741 /**/ 742 51, 743 /**/ 744 50, 745 /**/ 746 49, 747 /**/ 748 48, 749 /**/ 750 47, 751 /**/ 752 46, 753 /**/ 754 45, 755 /**/ 756 44, 757 /**/ 758 43, 759 /**/ 760 42, 761 /**/ 762 40, 763 /**/ 764 39, 765 /**/ 766 38, 767 /**/ 768 37, 769 /**/ 770 36, 771 /**/ 772 35, 773 /**/ 774 34, 775 /**/ 776 33, 777 /**/ 778 32, 779 /**/ 780 31, 781 /**/ 782 30, 783 /**/ 784 29, 785 /**/ 786 28, 787 /**/ 788 27, 789 /**/ 790 26, 791 /**/ 792 25, 793 /**/ 794 24, 795 /**/ 796 23, 797 /**/ 798 22, 799 /**/ 800 21, 801 /**/ 802 20, 803 /**/ 804 19, 805 /**/ 806 18, 807 /**/ 808 17, 809 /**/ 810 16, 811 /**/ 812 15, 813 /**/ 814 14, 815 /**/ 816 13, 817 /**/ 818 12, 819 /**/ 820 11, 821 /**/ 822 10, 823 /**/ 824 9, 825 /**/ 826 8, 827 /**/ 828 6, 829 /**/ 830 5, 831 /**/ 832 4, 833 /**/ 834 2, 835 /**/ 836 1, 837 /**/ 670 838 0 671 839 }; 672 840 -
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 … … 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 /* … … 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 … … 4128 4209 #ifdef FEAT_AUTOCMD 4129 4210 --autocmd_block; 4130 4211 #endif 4212 #ifdef FEAT_SEARCH_EXTRA 4213 newwin->w_match_head = NULL; 4214 newwin->w_next_match_id = 4; 4215 #endif 4131 4216 } 4132 4217 return newwin; 4133 4218 } … … 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 … … 6174 6259 return FALSE; 6175 6260 } 6176 6261 #endif 6262 6263 #if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) 6264 /* 6265 * Add match to the match list of window 'wp'. The pattern 'pat' will be 6266 * highligted with the group 'grp' with priority 'prio'. 6267 * Optionally, a desired ID 'id' can be specified (greater than or equal to 1). 6268 * If no particular ID is desired, -1 must be specified for 'id'. 6269 * Return ID of added match, -1 on failure. 6270 */ 6271 int 6272 match_add(wp, grp, pat, prio, id) 6273 win_T *wp; 6274 char_u *grp; 6275 char_u *pat; 6276 int prio; 6277 int id; 6278 { 6279 matchitem_T *cur; 6280 matchitem_T *prev; 6281 matchitem_T *m; 6282 int hlg_id; 6283 regprog_T *regprog; 6284 6285 if (*grp == NUL || *pat == NUL) 6286 return -1; 6287 if (id < -1 || id == 0) 6288 { 6289 EMSGN("E799: Invalid ID: %ld (must be greater than or equal to 1)", id); 6290 return -1; 6291 } 6292 if (id != -1) 6293 { 6294 cur = wp->w_match_head; 6295 while (cur != NULL) 6296 { 6297 if (cur->id == id) 6298 { 6299 EMSGN("E801: ID already taken: %ld", id); 6300 return -1; 6301 } 6302 cur = cur->next; 6303 } 6304 } 6305 if ((hlg_id = syn_namen2id(grp, STRLEN(grp))) == 0) 6306 { 6307 EMSG2(_(e_nogroup), grp); 6308 return -1; 6309 } 6310 if ((regprog = vim_regcomp(pat, RE_MAGIC)) == NULL) 6311 { 6312 EMSG2(_(e_invarg2), pat); 6313 return -1; 6314 } 6315 6316 /* Find available match ID. */ 6317 while (id == -1) 6318 { 6319 cur = wp->w_match_head; 6320 while (cur != NULL && cur->id != wp->w_next_match_id) 6321 cur = cur->next; 6322 if (cur == NULL) 6323 id = wp->w_next_match_id; 6324 wp->w_next_match_id++; 6325 } 6326 6327 /* Build new match. */ 6328 m = (matchitem_T *)alloc(sizeof(matchitem_T)); 6329 m->id = id; 6330 m->priority = prio; 6331 m->pattern = vim_strsave(pat); 6332 m->hlg_id = hlg_id; 6333 m->match.regprog = regprog; 6334 m->match.rmm_ic = FALSE; 6335 m->match.rmm_maxcol = 0; 6336 6337 /* Insert new match. The match list is in ascending order with regard to 6338 * the match priorities. */ 6339 cur = wp->w_match_head; 6340 prev = cur; 6341 while (cur != NULL && prio >= cur->priority) 6342 { 6343 prev = cur; 6344 cur = cur->next; 6345 } 6346 if (cur == prev) 6347 wp->w_match_head = m; 6348 else 6349 prev->next = m; 6350 m->next = cur; 6351 6352 redraw_later(SOME_VALID); 6353 return id; 6354 } 6355 6356 /* 6357 * Delete match with ID 'id' in the match list of window 'wp'. 6358 * Print error messages if 'perr' is TRUE. 6359 */ 6360 int 6361 match_delete(wp, id, perr) 6362 win_T *wp; 6363 int id; 6364 int perr; 6365 { 6366 matchitem_T *cur = wp->w_match_head; 6367 matchitem_T *prev = cur; 6368 6369 if (id < 1) 6370 { 6371 if (perr == TRUE) 6372 EMSGN("E802: Invalid ID: %ld (must be greater than or equal to 1)", 6373 id); 6374 return -1; 6375 } 6376 while (cur != NULL && cur->id != id) 6377 { 6378 prev = cur; 6379 cur = cur->next; 6380 } 6381 if (cur == NULL) 6382 { 6383 if (perr == TRUE) 6384 EMSGN("E803: ID not found: %ld", id); 6385 return -1; 6386 } 6387 if (cur == prev) 6388 wp->w_match_head = cur->next; 6389 else 6390 prev->next = cur->next; 6391 vim_free(cur->match.regprog); 6392 vim_free(cur->pattern); 6393 vim_free(cur); 6394 redraw_later(SOME_VALID); 6395 return 0; 6396 } 6397 6398 /* 6399 * Delete all matches in the match list of window 'wp'. 6400 */ 6401 void 6402 clear_matches(wp) 6403 win_T *wp; 6404 { 6405 matchitem_T *m; 6406 6407 while (wp->w_match_head != NULL) 6408 { 6409 m = wp->w_match_head->next; 6410 vim_free(wp->w_match_head->match.regprog); 6411 vim_free(wp->w_match_head->pattern); 6412 vim_free(wp->w_match_head); 6413 wp->w_match_head = m; 6414 } 6415 redraw_later(SOME_VALID); 6416 } 6417 6418 /* 6419 * Get match from ID 'id' in window 'wp'. 6420 * Return NULL if match not found. 6421 */ 6422 matchitem_T * 6423 get_match(wp, id) 6424 win_T *wp; 6425 int id; 6426 { 6427 matchitem_T *cur = wp->w_match_head; 6428 6429 while (cur != NULL && cur->id != id) 6430 cur = cur->next; 6431 return cur; 6432 } 6433 #endif
Note:
See TracBrowser
for help on using the repository browser.