]>
Commit | Line | Data |
---|---|---|
05b5d6bc AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.349 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 6.2.349 | |
11 | Problem: Finding a match using 'matchpairs' may cause a crash. | |
12 | 'matchpairs' is not used for 'showmatch'. | |
13 | Solution: Don't look past the NUL in 'matchpairs'. Use 'matchpairs' for | |
14 | 'showmatch'. (Dave Olszewkski) | |
15 | Files: src/misc1.c, src/normal.c, src/proto/search.pro, src/search.c | |
16 | ||
17 | ||
18 | *** ../vim-6.2.348/src/misc1.c Mon Mar 8 12:27:39 2004 | |
19 | --- src/misc1.c Fri Mar 12 11:45:19 2004 | |
20 | *************** | |
21 | *** 1943,1958 **** | |
22 | #ifdef FEAT_MBYTE | |
23 | && charlen == 1 | |
24 | #endif | |
25 | ! #ifdef FEAT_RIGHTLEFT | |
26 | ! && ((!(curwin->w_p_rl ^ p_ri) | |
27 | ! && (c == ')' || c == '}' || c == ']')) | |
28 | ! || ((curwin->w_p_rl ^ p_ri) | |
29 | ! && (c == '(' || c == '{' || c == '['))) | |
30 | ! #else | |
31 | ! && (c == ')' || c == '}' || c == ']') | |
32 | ! #endif | |
33 | ! ) | |
34 | ! showmatch(); | |
35 | ||
36 | #ifdef FEAT_RIGHTLEFT | |
37 | if (!p_ri || (State & REPLACE_FLAG)) | |
38 | --- 1943,1950 ---- | |
39 | #ifdef FEAT_MBYTE | |
40 | && charlen == 1 | |
41 | #endif | |
42 | ! ) | |
43 | ! showmatch(c); | |
44 | ||
45 | #ifdef FEAT_RIGHTLEFT | |
46 | if (!p_ri || (State & REPLACE_FLAG)) | |
47 | *** ../vim-6.2.348/src/normal.c Tue Mar 9 19:49:08 2004 | |
48 | --- src/normal.c Fri Mar 12 11:46:51 2004 | |
49 | *************** | |
50 | *** 6188,6199 **** | |
51 | */ | |
52 | ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE); | |
53 | ptr[curwin->w_cursor.col] = cap->nchar; | |
54 | ! if ( p_sm | |
55 | ! && msg_silent == 0 | |
56 | ! && (cap->nchar == ')' | |
57 | ! || cap->nchar == '}' | |
58 | ! || cap->nchar == ']')) | |
59 | ! showmatch(); | |
60 | ++curwin->w_cursor.col; | |
61 | } | |
62 | #ifdef FEAT_NETBEANS_INTG | |
63 | --- 6191,6198 ---- | |
64 | */ | |
65 | ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE); | |
66 | ptr[curwin->w_cursor.col] = cap->nchar; | |
67 | ! if (p_sm && msg_silent == 0) | |
68 | ! showmatch(cap->nchar); | |
69 | ++curwin->w_cursor.col; | |
70 | } | |
71 | #ifdef FEAT_NETBEANS_INTG | |
72 | *** ../vim-6.2.348/src/proto/search.pro Sun Jun 1 12:26:19 2003 | |
73 | --- src/proto/search.pro Fri Mar 12 11:54:07 2004 | |
74 | *************** | |
75 | *** 14,20 **** | |
76 | int searchc __ARGS((cmdarg_T *cap, int t_cmd)); | |
77 | pos_T *findmatch __ARGS((oparg_T *oap, int initc)); | |
78 | pos_T *findmatchlimit __ARGS((oparg_T *oap, int initc, int flags, int maxtravel)); | |
79 | ! void showmatch __ARGS((void)); | |
80 | int findsent __ARGS((int dir, long count)); | |
81 | int findpar __ARGS((oparg_T *oap, int dir, long count, int what, int both)); | |
82 | int startPS __ARGS((linenr_T lnum, int para, int both)); | |
83 | --- 14,20 ---- | |
84 | int searchc __ARGS((cmdarg_T *cap, int t_cmd)); | |
85 | pos_T *findmatch __ARGS((oparg_T *oap, int initc)); | |
86 | pos_T *findmatchlimit __ARGS((oparg_T *oap, int initc, int flags, int maxtravel)); | |
87 | ! void showmatch __ARGS((int c)); | |
88 | int findsent __ARGS((int dir, long count)); | |
89 | int findpar __ARGS((oparg_T *oap, int dir, long count, int what, int both)); | |
90 | int startPS __ARGS((linenr_T lnum, int para, int both)); | |
91 | *** ../vim-6.2.348/src/search.c Sun Feb 15 13:49:38 2004 | |
92 | --- src/search.c Fri Mar 12 20:48:34 2004 | |
93 | *************** | |
94 | *** 1580,1585 **** | |
95 | --- 1580,1587 ---- | |
96 | backwards = FALSE; | |
97 | break; | |
98 | } | |
99 | + if (ptr[1] != ',') | |
100 | + break; | |
101 | } | |
102 | if (!findc) /* invalid initc! */ | |
103 | return NULL; | |
104 | *************** | |
105 | *** 2143,2159 **** | |
106 | * If there isn't a match, then beep. | |
107 | */ | |
108 | void | |
109 | ! showmatch() | |
110 | { | |
111 | ! pos_T *lpos, save_cursor; | |
112 | ! pos_T mpos; | |
113 | ! colnr_T vcol; | |
114 | ! long save_so; | |
115 | ! long save_siso; | |
116 | #ifdef CURSOR_SHAPE | |
117 | ! int save_state; | |
118 | #endif | |
119 | ! colnr_T save_dollar_vcol; | |
120 | ||
121 | if ((lpos = findmatch(NULL, NUL)) == NULL) /* no match, so beep */ | |
122 | vim_beep(); | |
123 | --- 2145,2184 ---- | |
124 | * If there isn't a match, then beep. | |
125 | */ | |
126 | void | |
127 | ! showmatch(c) | |
128 | ! int c; /* char to show match for */ | |
129 | { | |
130 | ! pos_T *lpos, save_cursor; | |
131 | ! pos_T mpos; | |
132 | ! colnr_T vcol; | |
133 | ! long save_so; | |
134 | ! long save_siso; | |
135 | #ifdef CURSOR_SHAPE | |
136 | ! int save_state; | |
137 | ! #endif | |
138 | ! colnr_T save_dollar_vcol; | |
139 | ! char_u *p; | |
140 | ! | |
141 | ! /* | |
142 | ! * Only show match for chars in the 'matchpairs' option. | |
143 | ! */ | |
144 | ! /* 'matchpairs' is "x:y,x:y" */ | |
145 | ! for (p = curbuf->b_p_mps; *p != NUL; p += 2) | |
146 | ! { | |
147 | ! #ifdef FEAT_RIGHTLEFT | |
148 | ! if (*p == c && (curwin->w_p_rl ^ p_ri)) | |
149 | ! break; | |
150 | ! #endif | |
151 | ! p += 2; | |
152 | ! if (*p == c | |
153 | ! #ifdef FEAT_RIGHTLEFT | |
154 | ! && !(curwin->w_p_rl ^ p_ri) | |
155 | #endif | |
156 | ! ) | |
157 | ! break; | |
158 | ! if (p[1] != ',') | |
159 | ! return; | |
160 | ! } | |
161 | ||
162 | if ((lpos = findmatch(NULL, NUL)) == NULL) /* no match, so beep */ | |
163 | vim_beep(); | |
164 | *** ../vim-6.2.348/src/version.c Fri Mar 12 20:42:24 2004 | |
165 | --- src/version.c Fri Mar 12 21:09:02 2004 | |
166 | *************** | |
167 | *** 639,640 **** | |
168 | --- 639,642 ---- | |
169 | { /* Add new patch number below this line */ | |
170 | + /**/ | |
171 | + 349, | |
172 | /**/ | |
173 | ||
174 | -- | |
175 | hundred-and-one symptoms of being an internet addict: | |
176 | 22. You've already visited all the links at Yahoo and you're halfway through | |
177 | Lycos. | |
178 | ||
179 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
180 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
181 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
182 | \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html /// |