richterm

"terminal emulator" with support for text fonts and images for plan9
git clone git://nsmpr.xyz/richterm.git
Log | Files | Refs | README

commit f56f7fdca4c1f63604be5ab43bd5bb941c72b371
parent 3aa5d22e90f2544ce38d5cc743eaf5bf47da2434
Author: Pavel Renev <an2qzavok@gmail.com>
Date:   Mon, 26 Jul 2021 12:04:02 +0000

generatepage(): make buf malloc-able

Diffstat:
Mrichterm.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/richterm.c b/richterm.c @@ -158,7 +158,7 @@ generatepage(Rich *rich) #define BSIZE 4096 Rectangle r; - char *sp, buf[1024]; + char *sp, *buf; Object *obj; int newline, tab, ymax; Point pt; @@ -192,11 +192,13 @@ generatepage(Rich *rich) v->color = display->black; if (((Faux *)obj->flink->aux)->data->n > 0) v->color = Ilink; v->page = &rich->page; - /* TODO: check if font->data->n is too long */ + + buf = mallocz(((Faux *)obj->ffont->aux)->data->n + 1, 1); memcpy(buf, ((Faux *)obj->ffont->aux)->data->p, ((Faux *)obj->ffont->aux)->data->n); buf[((Faux *)obj->ffont->aux)->data->n] = '\0'; v->font = getfont(&fonts, buf); - + free(buf); + v->dp = sp; v->length = aux->data->n;