165_uppsrc.diff
uppsrc/CodeEditor/CodeEditor.cpp 2011-11-15 10:43:59 +0600 | ||
---|---|---|
34 | 34 |
return isbrkt(c); |
35 | 35 |
} |
36 | 36 |
|
37 |
void CodeEditor::CheckBraces(const WString& text) |
|
38 |
{ |
|
39 |
for(const wchar *s = text; *s; s++) |
|
40 |
if(*s == '{' || *s == '(' || *s == '[' || *s == '/' || *s == '*' || |
|
41 |
*s == '}' || *s == ')' || *s == ']') { |
|
42 |
Refresh(); |
|
43 |
break; |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 | 37 |
void CodeEditor::PostInsert(int pos, const WString& text) { |
48 | 38 |
if(check_edited) |
49 | 39 |
bar.SetEdited(GetLine(pos)); |
50 | 40 |
if(IsFullRefresh()) return; |
51 |
if(text.GetCount() > 200) |
|
52 |
Refresh(); |
|
53 |
else |
|
54 |
CheckBraces(text); |
|
55 |
// Following code is probable not needed anymore... |
|
56 | 41 |
if(!ScanSyntax(GetLine(pos + text.GetLength()) + 1).MatchHilite(rm_ins)) { |
57 | 42 |
if(text.GetLength() == 1 && *text == '(' || *text == '[' || *text == ']' || *text == ')') |
58 | 43 |
RefreshChars(RBR); |
... | ... | |
64 | 49 |
|
65 | 50 |
void CodeEditor::PreRemove(int pos, int size) { |
66 | 51 |
if(IsFullRefresh()) return; |
67 |
if(size > 200) |
|
68 |
Refresh(); |
|
69 |
else |
|
70 |
CheckBraces(GetW(pos, size)); |
|
71 |
// Following code is probable not needed anymore... |
|
72 | 52 |
if(size == 1) |
73 | 53 |
rmb = Get(pos, 1)[0]; |
74 | 54 |
else |
... | ... | |
80 | 60 |
if(check_edited) |
81 | 61 |
bar.SetEdited(GetLine(pos)); |
82 | 62 |
if(IsFullRefresh()) return; |
83 |
// Following code is probable not needed anymore... |
|
84 | 63 |
if(!ScanSyntax(GetLine(pos) + 1).MatchHilite(rm_ins)) { |
85 | 64 |
if(rmb == '(' || rmb == '[' || rmb == ']' || rmb == ')') |
86 | 65 |
RefreshChars(RBR); |
... | ... | |
168 | 147 |
} |
169 | 148 |
if(islbrkt(c)) |
170 | 149 |
lvl += d; |
171 |
if(isrbrkt(c)) |
|
150 |
else if(isrbrkt(c))
|
|
172 | 151 |
lvl -= d; |
173 | 152 |
if(lvl <= 0) { |
174 | 153 |
highlight_bracket_pos0 = pos0; |
... | ... | |
203 | 182 |
int ppos = pos; |
204 | 183 |
int li = GetLinePos(pos); |
205 | 184 |
WString ln = GetWLine(li); |
206 |
int c = ln[pos]; |
|
207 |
if(c == ')' || c == '}' || c == ']') |
|
185 |
if(isrbrkt(ln[pos])) |
|
208 | 186 |
CheckBracket(li, pos, ppos, ppos, ln, -1, max(li - 3000, 0)); |
209 | 187 |
} |
210 | 188 |
|
uppsrc/CodeEditor/CodeEditor.h 2011-11-15 10:49:11 +0600 | ||
---|---|---|
343 | 343 |
void FindWildcard(); |
344 | 344 |
void ReplaceWildcard(); |
345 | 345 |
void InsertWildcard(int c); |
346 |
void CheckBraces(const WString& text); |
|
347 | 346 |
|
348 | 347 |
void SetFound(int fi, int type, const WString& text); |
349 | 348 |
|
uppsrc/CodeEditor/Syntax.cpp 2011-11-15 10:48:15 +0600 | ||
---|---|---|
306 | 306 |
} |
307 | 307 |
else |
308 | 308 |
if(c == ')') { |
309 |
if(brk.GetCount()) { |
|
309 |
if(brk.GetCount() && brk.Top() == c) {
|
|
310 | 310 |
pl--; |
311 | 311 |
brk.Drop(); |
312 |
|
|
313 |
if(par.GetCount()) |
|
314 |
par.Drop(); |
|
315 |
spar--; |
|
312 | 316 |
} |
313 |
if(par.GetCount()) |
|
314 |
par.Drop(); |
|
315 |
spar--; |
|
316 | 317 |
} |
317 | 318 |
else |
318 | 319 |
if(c == ']') { |
319 |
if(brk.GetCount()) { |
|
320 |
if(brk.GetCount() && brk.Top() == c) {
|
|
320 | 321 |
bl--; |
321 | 322 |
brk.Drop(); |
323 |
|
|
324 |
if(par.GetCount()) |
|
325 |
par.Drop(); |
|
326 |
spar--; |
|
322 | 327 |
} |
323 |
if(par.GetCount()) |
|
324 |
par.Drop(); |
|
325 |
spar--; |
|
326 | 328 |
} |
327 | 329 |
pc = c; |
328 | 330 |
} |