ref: 4ac3a0224ed9d54818f858fba69c8e94f38f2c12
dir: /9front/559725a4c1048cb88e44cbb7a15d1c7990d2e465.patch/
From: Romano <me+git@fallglow.com> Date: Sun, 30 Jun 2024 06:30:18 +0000 Subject: [PATCH] merge 9front --- diff 2350b084010b853275b822dddc3385d6ea876030 559725a4c1048cb88e44cbb7a15d1c7990d2e465 --- a/sys/src/cmd/rio/dat.h +++ b/sys/src/cmd/rio/dat.h @@ -46,11 +46,11 @@ enum { - Selborder = 4, /* border of selected window */ - Unselborder = 1, /* border of unselected window */ - Scrollwid = 12, /* width of scroll bar */ - Scrollgap = 4, /* gap right of scroll bar */ - BIG = 3, /* factor by which window dimension can exceed screen */ + Minselborder = 4, /* minimum border of selected window */ + Minunselborder = 1, /* minimum border of unselected window */ + Minscrollwid = 12, /* minimum width of scroll bar */ + Minscrollgap = 4, /* minimum gap right of scroll bar */ + BIG = 3, /* factor by which window dimension can exceed screen */ TRUE = 1, FALSE = 0, }; @@ -341,3 +341,8 @@ int messagesize; /* negotiated in 9P version setup */ int shiftdown; int debug; +int Borderwid; /* border width of window */ +int Selborder; /* border of selected window */ +int Unselborder; /* border of unselected window */ +int Scrollwid; /* width of scroll bar */ +int Scrollgap; /* gap right of scroll bar */ --- a/sys/src/cmd/rio/data.c +++ b/sys/src/cmd/rio/data.c @@ -185,6 +185,16 @@ }; void +fontinit(void) +{ + Borderwid = ceil(stringwidth(font, "0") / 4) > Borderwidth ? ceil(stringwidth(font, "0") / 4) : Borderwidth; + Selborder = ceil(stringwidth(font, "0") / 2) > Minselborder ? ceil(stringwidth(font, "0") / 2) : Minselborder; + Unselborder = ceil(stringwidth(font, "0") / 8) > Minunselborder ? ceil(stringwidth(font, "0") / 8) : Minunselborder; + Scrollwid = ceil(stringwidth(font, "0") * 1.5) > Minscrollwid ? ceil(stringwidth(font, "0") * 1.5) : Minscrollwid; + Scrollgap = ceil(stringwidth(font, "0") / 2) > Minscrollgap ? ceil(stringwidth(font, "0") / 2) : Minscrollgap; +} + +void iconinit(void) { background = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x777777FF); --- a/sys/src/cmd/rio/fns.h +++ b/sys/src/cmd/rio/fns.h @@ -16,6 +16,7 @@ void error(char*); void killprocs(void); int shutdown(void*, char*); +void fontinit(void); void iconinit(void); void *erealloc(void*, uint); void *emalloc(uint); --- a/sys/src/cmd/rio/rio.c +++ b/sys/src/cmd/rio/rio.c @@ -182,6 +182,7 @@ fprint(2, "rio: can't open display: %r\n"); exits("display open"); } + fontinit(); iconinit(); exitchan = chancreate(sizeof(int), 0); @@ -951,10 +952,10 @@ } if(col != nil){ r = canonrect(r); - drawedge(&b[0], col, Rect(r.min.x, r.min.y, r.min.x+Borderwidth, r.max.y)); - drawedge(&b[1], col, Rect(r.min.x+Borderwidth, r.min.y, r.max.x-Borderwidth, r.min.y+Borderwidth)); - drawedge(&b[2], col, Rect(r.max.x-Borderwidth, r.min.y, r.max.x, r.max.y)); - drawedge(&b[3], col, Rect(r.min.x+Borderwidth, r.max.y-Borderwidth, r.max.x-Borderwidth, r.max.y)); + drawedge(&b[0], col, Rect(r.min.x, r.min.y, r.min.x+Borderwid, r.max.y)); + drawedge(&b[1], col, Rect(r.min.x+Borderwid, r.min.y, r.max.x-Borderwid, r.min.y+Borderwid)); + drawedge(&b[2], col, Rect(r.max.x-Borderwid, r.min.y, r.max.x, r.max.y)); + drawedge(&b[3], col, Rect(r.min.x+Borderwid, r.max.y-Borderwid, r.max.x-Borderwid, r.max.y)); } lastcol = col; } --- a/sys/src/cmd/rio/wctl.c +++ b/sys/src/cmd/rio/wctl.c @@ -100,13 +100,13 @@ * that includes the border on each side with an extra pixel * so that the text is still drawn */ - if(Dx(r) < 100 || Dy(r) < 2*(Borderwidth+1)+font->height) + if(Dx(r) < 100 || Dy(r) < 2*(Borderwid+Unselborder)+font->height) return 0; /* window must be on screen */ if(!rectXrect(screen->r, r)) return 0; /* must have some screen and border visible so we can move it out of the way */ - if(rectinrect(screen->r, insetrect(r, Borderwidth))) + if(rectinrect(screen->r, insetrect(r, Borderwid))) return 0; return 1; } @@ -148,8 +148,8 @@ static int i = 0; int minx, miny, dx, dy; - dx = min(600, Dx(screen->r) - 2*Borderwidth); - dy = min(400, Dy(screen->r) - 2*Borderwidth); + dx = min(600, Dx(screen->r) - 2*Borderwid); + dy = min(400, Dy(screen->r) - 2*Borderwid); minx = 32 + 16*i; miny = 32 + 16*i; i++; --- a/sys/src/cmd/rio/wind.c +++ b/sys/src/cmd/rio/wind.c @@ -353,7 +353,7 @@ w->i = i; w->mc.image = i; - r = insetrect(i->r, Selborder+1); + r = insetrect(i->r, Selborder+Unselborder); w->scrollr = r; w->scrollr.max.x = r.min.x+Scrollwid; w->lastsr = ZR; @@ -1249,7 +1249,7 @@ w = emalloc(sizeof(Window)); w->screenr = i->r; - r = insetrect(i->r, Selborder+1); + r = insetrect(i->r,Selborder+Unselborder); w->i = i; w->mc = *mc; w->ck = ck; --- a/sys/src/cmd/upas/send/message.c +++ b/sys/src/cmd/upas/send/message.c @@ -1,6 +1,7 @@ #include "common.h" #include "send.h" #include <regexp.h> +#include <ctype.h> #include "../smtp/smtp.h" #include "../smtp/rfc822.tab.h" @@ -18,6 +19,23 @@ static String* getstring(Node *p); static String* getaddr(Node *p); +char * +userfrom(char *cp) +{ + char *s; + int n; + + if((n = strlen(cp)) > 4 && cp[n-1] == '>'){ + if((s = strrchr(cp, '<')) != nil && s != cp && isspace(s[-1])) { + s++; + cp[n-1] = '\0'; + strcpy(cp, s); + } + } + + return cp; +} + int default_from(message *mp) { @@ -32,7 +50,7 @@ return -1; } if(cp && *cp) - s_append(mp->sender, cp); + s_append(mp->sender, userfrom(cp)); else s_append(mp->sender, lp); free(cp);