Fix an overflow and another glitch in ascii graphs

This commit is contained in:
pancake 2014-08-01 01:09:05 +02:00
parent 3fc1e58bc3
commit 85277d7f0c

View File

@ -98,13 +98,17 @@ R_API void r_cons_canvas_write(RConsCanvas *c, const char *_s) {
char *line, *n;
str = s = strdup (_s);
for (i=0;;i++) {
for (i=0; ; i++) {
line = getrow (s, &n);
p = prefixline (c, &left);
slen = R_MIN (left, strlen (line));
if (slen<1)
break;
if (!G (c->x-c->sx+slen, c->y-c->sy)) {
// TODO : chop slen
slen = (c->w - (c->x-c->sx));
if (slen<1)
break;
continue;
}
if (!G (c->x-c->sx-slen, c->y-c->sy))