This fixes $scroll to only scroll when the text length is greater than
the specified length; hopefully without breaking anything.
Signed-off-by: Brenden Matthews <brenden@diddyinc.com>
sd->step = 1;
}
sd->text = malloc(strlen(arg + n1) + sd->show + 1);
- for(n2 = 0; (unsigned int) n2 < sd->show; n2++) {
- sd->text[n2] = ' ';
+
+ if (strlen(arg) > sd->show) {
+ for(n2 = 0; (unsigned int) n2 < sd->show; n2++) {
+ sd->text[n2] = ' ';
+ }
+ sd->text[n2] = 0;
}
- sd->text[n2] = 0;
+ else
+ sd->text[0] = 0;
+
strcat(sd->text, arg + n1);
sd->start = 0;
obj->sub = malloc(sizeof(struct text_object));
free(pwithcolors);
//scroll
sd->start += sd->step;
- if(buf[sd->start] == 0){
+ if(buf[sd->start] == 0 || sd->start > strlen(buf)){
sd->start = 0;
}
#ifdef X11