forked from bartvdbraak/blender
Bug fix #3052
Syntax highlight in Text Window crashed with lines > 2000 chars. I now just skip the highlighting code for these cases, it remains a bit weak code...
This commit is contained in:
parent
3ef1f0f3e3
commit
256a59c36e
@ -202,7 +202,15 @@ void get_format_string(void)
|
|||||||
|
|
||||||
while(tmp) {
|
while(tmp) {
|
||||||
in_line = tmp->line;
|
in_line = tmp->line;
|
||||||
|
|
||||||
len = strlen(in_line);
|
len = strlen(in_line);
|
||||||
|
/* weak code... but we dont want crashes (ton) */
|
||||||
|
if(len>2000-1) {
|
||||||
|
if (tmp->format) MEM_freeN(tmp->format);
|
||||||
|
tmp->format= NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
spot = 0;
|
spot = 0;
|
||||||
tabs = 0;
|
tabs = 0;
|
||||||
//see how many tabs we have
|
//see how many tabs we have
|
||||||
@ -518,6 +526,8 @@ void get_format_string(void)
|
|||||||
}
|
}
|
||||||
format[spot] = '\0';
|
format[spot] = '\0';
|
||||||
memcpy(tmp->format, format, strlen(format));
|
memcpy(tmp->format, format, strlen(format));
|
||||||
|
}
|
||||||
|
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,7 +545,7 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra
|
|||||||
w= w-cshift;
|
w= w-cshift;
|
||||||
|
|
||||||
if (draw) {
|
if (draw) {
|
||||||
if(st->showsyntax) {
|
if(st->showsyntax && format) {
|
||||||
int amount, a;
|
int amount, a;
|
||||||
char out[2];
|
char out[2];
|
||||||
format = format+cshift;
|
format = format+cshift;
|
||||||
|
Loading…
Reference in New Issue
Block a user