commit 67bc1dd121eb560de38d2e96f7ac8443bcec983a
parent c961633676288365033c363d34f1618f5170e27d
Author: glenda <glenda@9front.local>
Date: Wed, 21 Jul 2021 12:50:48 +0000
add space for scrollbar
Diffstat:
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/richterm.c b/richterm.c
@@ -19,7 +19,7 @@ Fsctl *fsctl;
Fonts fonts;
-void generatepage(Rectangle, Rich *);
+void generatepage(Rich *);
void shutdown(void);
void send_interrupt(void);
void runcmd(void *);
@@ -114,8 +114,8 @@ threadmain(int argc, char **argv)
rich.page.scroll = ZP;
rich.page.view = nil;
-
- generatepage(screen->r, &rich);
+ rich.page.r = Rpt(addpt(screen->r.min, Pt(17, 1)), subpt(screen->r.max, Pt(1,1)));
+ generatepage(&rich);
draw(screen, screen->r, display->white, nil, ZP);
drawpage(screen, &rich.page);
@@ -143,7 +143,8 @@ threadmain(int argc, char **argv)
case RESIZE:
if (getwindow(display, Refnone) < 0)
sysfatal("resize failed: %r");
- generatepage(screen->r, &rich);
+ rich.page.r = Rpt(addpt(screen->r.min, Pt(17, 1)), subpt(screen->r.max, Pt(1,1)));
+ generatepage(&rich);
draw(screen, screen->r, display->white, nil, ZP);
drawpage(screen, &rich.page);
flushimage(display, 1);
@@ -176,7 +177,7 @@ threadmain(int argc, char **argv)
aux->data->p[aux->data->n - 1] = kv;
aux->data->p[aux->data->n] = 0;
}
- generatepage(screen->r, &rich);
+ generatepage(&rich);
draw(screen, screen->r, display->white, nil, ZP);
drawpage(screen, &rich.page);
flushimage(display, 1);
@@ -200,7 +201,7 @@ threadmain(int argc, char **argv)
obj->flink = createfile(obj->dir, "link", "richterm", 0666, auxlink);
obj->fimage = createfile(obj->dir, "image", "richterm", 0666, auximage);
- generatepage(screen->r, &rich);
+ generatepage(&rich);
draw(screen, screen->r, display->white, nil, ZP);
for (i = 0; i < rich.page.count; i++){
drawview(screen, &rich.page.view[i]);
@@ -232,10 +233,11 @@ drawview(Image *dst, View *v)
}
void
-generatepage(Rectangle r, Rich *rich)
+generatepage(Rich *rich)
{
#define BSIZE 4096
+ Rectangle r;
char *sp;
Object *obj;
int newline, tab, ymax;
@@ -247,6 +249,8 @@ generatepage(Rectangle r, Rich *rich)
page = &rich->page;
+ r = page->r;
+
page->count = 0;
page->scroll = rich->page.scroll;
pt = r.min;
diff --git a/richterm.h b/richterm.h
@@ -47,6 +47,7 @@ struct Page {
long count;
Point scroll;
Point max;
+ Rectangle r;
};
void drawview(Image *, View *);