mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
status2d: improving cut status line protection, dwm will still exit if an invalid color code comes through (there is an explicit die call in drw_clr_create)
This commit is contained in:
parent
23c76d13b5
commit
a7dfcc17d5
@ -118,8 +118,9 @@ drawstatusbar(BarArg *a, char* stext)
|
|||||||
while (text[++i] != '^') {
|
while (text[++i] != '^') {
|
||||||
if (text[i] == 'c') {
|
if (text[i] == 'c') {
|
||||||
char buf[8];
|
char buf[8];
|
||||||
if (i + 7 > len) {
|
if (i + 7 >= len) {
|
||||||
i += 7;
|
i += 7;
|
||||||
|
len = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memcpy(buf, (char*)text+i+1, 7);
|
memcpy(buf, (char*)text+i+1, 7);
|
||||||
@ -134,8 +135,9 @@ drawstatusbar(BarArg *a, char* stext)
|
|||||||
i += 7;
|
i += 7;
|
||||||
} else if (text[i] == 'b') {
|
} else if (text[i] == 'b') {
|
||||||
char buf[8];
|
char buf[8];
|
||||||
if (i + 7 > len) {
|
if (i + 7 >= len) {
|
||||||
i += 7;
|
i += 7;
|
||||||
|
len = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memcpy(buf, (char*)text+i+1, 7);
|
memcpy(buf, (char*)text+i+1, 7);
|
||||||
@ -204,11 +206,13 @@ drawstatusbar(BarArg *a, char* stext)
|
|||||||
|
|
||||||
text = text + i + 1;
|
text = text + i + 1;
|
||||||
len -= i + 1;
|
len -= i + 1;
|
||||||
i=-1;
|
i = -1;
|
||||||
isCode = 0;
|
isCode = 0;
|
||||||
|
if (len <= 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isCode) {
|
if (!isCode && len > 0) {
|
||||||
w = TEXTWM(text) - lrpad;
|
w = TEXTWM(text) - lrpad;
|
||||||
drw_text(drw, x, y, w, bh, 0, text, 0, True);
|
drw_text(drw, x, y, w, bh, 0, text, 0, True);
|
||||||
x += w;
|
x += w;
|
||||||
@ -216,7 +220,7 @@ drawstatusbar(BarArg *a, char* stext)
|
|||||||
free(p);
|
free(p);
|
||||||
|
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
return len - 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user