From 940f1fd6af2c144d0db087fefa8478d2a36633d5 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 6 Jan 2023 12:03:22 -0500 Subject: [PATCH 01/17] page: scale ppi on high-res displays Also fix wording of -w warning. --- src/cmd/page/page.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cmd/page/page.c b/src/cmd/page/page.c index 01ad17ff..24a4b024 100644 --- a/src/cmd/page/page.c +++ b/src/cmd/page/page.c @@ -96,7 +96,6 @@ threadmain(int argc, char **argv) { Document *doc; Biobuf *b; - char *basename = argv[0]; enum { Ninput = 16 }; uchar buf[Ninput+1]; int readstdin; @@ -134,7 +133,7 @@ threadmain(int argc, char **argv) truetoboundingbox = 1; break; case 'w': - fprint(2, "%s: -w has only the effect of -R X11 systems\n", basename); + fprint(2, "warning: page -w only supported on x11 systems\n"); resizing = 1; break; case 'i': @@ -199,6 +198,13 @@ threadmain(int argc, char **argv) }else b = nil; + if(initdraw(0, 0, "page") < 0){ + fprint(2, "page: initdraw failed: %r\n"); + wexits("initdraw"); + } + display->locking = 1; + ppi = scalesize(display, ppi); + buf[Ninput] = '\0'; if(imagemode) doc = initgfx(nil, 0, nil, nil, 0); @@ -237,12 +243,6 @@ threadmain(int argc, char **argv) if(reverse == -1) /* neither cmdline nor ps reader set it */ reverse = 0; - if(initdraw(0, 0, "page") < 0){ - fprint(2, "page: initdraw failed: %r\n"); - wexits("initdraw"); - } - display->locking = 1; - truecolor = screen->depth > 8; viewer(doc); wexits(0); From 43f5af9c8da2c89948fd0b6858dfa8b79884adb8 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 6 Jan 2023 12:04:10 -0500 Subject: [PATCH 02/17] acme: allow larger paste amounts --- src/cmd/acme/dat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h index 8a81c97d..e540605a 100644 --- a/src/cmd/acme/dat.h +++ b/src/cmd/acme/dat.h @@ -28,7 +28,7 @@ enum enum { Blockincr = 256, - Maxblock = 8*1024, + Maxblock = 32*1024, NRange = 10, Infinity = 0x7FFFFFFF /* huge value for regexp address */ }; From 4938281a82eee558ff0a09741afee90addaf3f3b Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sat, 7 Jan 2023 17:44:26 +1100 Subject: [PATCH 03/17] Fix tyop --- man/man1/0intro.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man1/0intro.1 b/man/man1/0intro.1 index 780be91d..8c520d9d 100644 --- a/man/man1/0intro.1 +++ b/man/man1/0intro.1 @@ -169,7 +169,7 @@ The only way to write multithreaded programs is to use the library. .MR Rfork (3) exists but is not as capable as on Plan 9. -There are many unfortunate by necessary preprocessor +There are many unfortunate but necessary preprocessor diversions to make Plan 9 and Unix libraries coexist. See .MR intro (3) From e2a141ae0952c2d28a9f500bb9da6dc72e57be3c Mon Sep 17 00:00:00 2001 From: zhenya-1007 <102388922+zhenya-1007@users.noreply.github.com> Date: Mon, 23 Jan 2023 12:35:27 -0800 Subject: [PATCH 04/17] Fix a typo --- man/man7/plumb.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man7/plumb.7 b/man/man7/plumb.7 index 37b2385b..db95058b 100644 --- a/man/man7/plumb.7 +++ b/man/man7/plumb.7 @@ -254,7 +254,7 @@ port of the rule set or the entire rule set will be skipped. .B client If no application has the port open, the arguments to a .B plumb -.B start +.B client rule specify a shell program to run in response to the message. The message will be held, with the supposition that the program will eventually open the port to retrieve it. From 0392f49cfc9d0fc94282fdf85854b31c67b1cd02 Mon Sep 17 00:00:00 2001 From: zakkor Date: Thu, 29 Dec 2022 01:31:55 +0200 Subject: [PATCH 05/17] devdraw: Fix mouse wheel scrolling in 1-tick increments on macOS --- src/cmd/devdraw/mac-screen.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cmd/devdraw/mac-screen.m b/src/cmd/devdraw/mac-screen.m index 9e51eec6..f07054cf 100644 --- a/src/cmd/devdraw/mac-screen.m +++ b/src/cmd/devdraw/mac-screen.m @@ -601,12 +601,12 @@ rpc_resizewindow(Client *c, Rectangle r) - (void)scrollWheel:(NSEvent*)e { - NSInteger s; + CGFloat s; s = [e scrollingDeltaY]; - if(s > 0) + if(s > 0.0f) [self sendmouse:8]; - else if (s < 0) + else if (s < 0.0f) [self sendmouse:16]; } From 760cf867056b1ef1ca2bf23dbe477d066e6562fb Mon Sep 17 00:00:00 2001 From: Igor Burago Date: Wed, 27 Jul 2022 16:28:14 +0800 Subject: [PATCH 06/17] plumber: parametrize the number of stored match pattern subexpressions --- src/cmd/plumb/match.c | 17 +++++++++-------- src/cmd/plumb/plumber.h | 7 ++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/cmd/plumb/match.c b/src/cmd/plumb/match.c index 4cb32cc6..70d912a7 100644 --- a/src/cmd/plumb/match.c +++ b/src/cmd/plumb/match.c @@ -38,11 +38,11 @@ verbis(int obj, Plumbmsg *m, Rule *r) } static void -setvar(Resub rs[10], char *match[10]) +setvar(Resub rs[NMATCHSUBEXP], char *match[NMATCHSUBEXP]) { int i, n; - for(i=0; i<10; i++){ + for(i=0; iregex, alltext, rs, 10) || rs[0].s.sp!=alltext || rs[0].e.ep!=alltext+ntext) + if(!regexec(r->regex, alltext, rs, NMATCHSUBEXP) + || rs[0].s.sp!=alltext || rs[0].e.ep!=alltext+ntext) break; setvar(rs, e->match); return 1; @@ -300,7 +301,7 @@ freeexec(Exec *exec) return; free(exec->dir); free(exec->file); - for(i=0; i<10; i++) + for(i=0; imatch[i]); free(exec); } diff --git a/src/cmd/plumb/plumber.h b/src/cmd/plumb/plumber.h index 44700559..65d5d0ac 100644 --- a/src/cmd/plumb/plumber.h +++ b/src/cmd/plumb/plumber.h @@ -52,10 +52,15 @@ struct Ruleset char *port; }; +enum +{ + NMATCHSUBEXP = 10 +}; + struct Exec { Plumbmsg *msg; - char *match[10]; + char *match[NMATCHSUBEXP]; int p0; /* begin and end of match */ int p1; int clearclick; /* click was expanded; remove attribute */ From 6c0efecd1303f22f86194d6eee7038651582f086 Mon Sep 17 00:00:00 2001 From: Igor Burago Date: Wed, 27 Jul 2022 17:27:06 +0800 Subject: [PATCH 07/17] plumber: allow multi-digit subexpression match variable substitutions --- src/cmd/plumb/rules.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/cmd/plumb/rules.c b/src/cmd/plumb/rules.c index e1687d43..4bd02e44 100644 --- a/src/cmd/plumb/rules.c +++ b/src/cmd/plumb/rules.c @@ -254,15 +254,36 @@ filename(Exec *e, char *name) return cleanname(buf); } +static char* +subexpmatch(Exec *e, char *s, int *numlen) +{ + int n, d, ok; + char *t; + + n = 0; + ok = 1; + for(t = s; '0'<=*t && *t<='9'; t++) + if(ok){ + d = *t-'0'; + if(dmatch[n]; +} + char* dollar(Exec *e, char *s, int *namelen) { int n; static char *abuf; - *namelen = 1; if(e!=nil && '0'<=s[0] && s[0]<='9') - return nonnil(e->match[s[0]-'0']); + return nonnil(subexpmatch(e, s, namelen)); n = scanvarname(s)-s; *namelen = n; From 0790296f7313acc91cff47286e4f156304b2161c Mon Sep 17 00:00:00 2001 From: Igor Burago Date: Thu, 28 Jul 2022 17:02:43 +0800 Subject: [PATCH 08/17] plumber: increase NMATCHSUBEXP up to libregexp's NSUBEXP --- src/cmd/plumb/plumber.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/plumb/plumber.h b/src/cmd/plumb/plumber.h index 65d5d0ac..6b02cb61 100644 --- a/src/cmd/plumb/plumber.h +++ b/src/cmd/plumb/plumber.h @@ -54,7 +54,7 @@ struct Ruleset enum { - NMATCHSUBEXP = 10 + NMATCHSUBEXP = 32 /* bounded by ../../libregexp/regcomp.h:/NSUBEXP */ }; struct Exec From a4d35dc3fde82457d1998c89aec8127914913b61 Mon Sep 17 00:00:00 2001 From: Igor Burago Date: Wed, 12 Oct 2022 02:39:43 +0800 Subject: [PATCH 09/17] plumber: use strtoul to parse subexpression match variable substitutions --- src/cmd/plumb/rules.c | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/src/cmd/plumb/rules.c b/src/cmd/plumb/rules.c index 4bd02e44..b899231f 100644 --- a/src/cmd/plumb/rules.c +++ b/src/cmd/plumb/rules.c @@ -254,36 +254,21 @@ filename(Exec *e, char *name) return cleanname(buf); } -static char* -subexpmatch(Exec *e, char *s, int *numlen) -{ - int n, d, ok; - char *t; - - n = 0; - ok = 1; - for(t = s; '0'<=*t && *t<='9'; t++) - if(ok){ - d = *t-'0'; - if(dmatch[n]; -} - char* dollar(Exec *e, char *s, int *namelen) { int n; + ulong m; + char *t; static char *abuf; - if(e!=nil && '0'<=s[0] && s[0]<='9') - return nonnil(subexpmatch(e, s, namelen)); + if(e!=nil && '0'<=s[0] && s[0]<='9'){ + m = strtoul(s, &t, 10); + *namelen = t-s; + if(t==s || m>=NMATCHSUBEXP) + return ""; + return nonnil(e->match[m]); + } n = scanvarname(s)-s; *namelen = n; From 6eaa52d3f7d3835b5cf4c04c1994d6a8cc4ef610 Mon Sep 17 00:00:00 2001 From: Sevan Janiyan Date: Thu, 30 Mar 2023 20:03:26 +0100 Subject: [PATCH 10/17] README.md: Drop travis-ci badge Service is dead. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 631dde28..0c1850c1 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ for details on using Git. Status ------ -[![Build Status](https://travis-ci.org/9fans/plan9port.svg?branch=master)](https://travis-ci.org/9fans/plan9port) [![Coverity Scan Build Status](https://scan.coverity.com/projects/plan-9-from-user-space/badge.svg)](https://scan.coverity.com/projects/plan-9-from-user-space) From 4cd06ff66ca157d8450526963a004ebb5fd3cae0 Mon Sep 17 00:00:00 2001 From: Igor Burago Date: Fri, 14 Oct 2022 20:28:35 +0800 Subject: [PATCH 11/17] libregexp: allow up to 128 character classes in one regexp --- include/regexp9.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/regexp9.h b/include/regexp9.h index 20c0c3da..b93e7b8d 100644 --- a/include/regexp9.h +++ b/include/regexp9.h @@ -1,7 +1,7 @@ #ifndef _REGEXP9_H_ #define _REGEXP9_H_ 1 #if defined(__cplusplus) -extern "C" { +extern "C" { #endif #ifdef AUTOLIB @@ -61,7 +61,7 @@ struct Reinst{ */ struct Reprog{ Reinst *startinst; /* start pc */ - Reclass class[16]; /* .data */ + Reclass class[128]; /* .data */ Reinst firstinst[5]; /* .text */ }; From 727ce0e1235dec1fec65ab2b95469d5a276d006e Mon Sep 17 00:00:00 2001 From: Igor Burago Date: Fri, 31 Mar 2023 00:55:02 +0800 Subject: [PATCH 12/17] plumber: increase NMATCHSUBEXP up to 100 Thus up to two-digit subexpression match variables are supported ($1 through $99) in addition to the entire expression match ($0). --- src/cmd/plumb/plumber.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/plumb/plumber.h b/src/cmd/plumb/plumber.h index 6b02cb61..9ffe74d2 100644 --- a/src/cmd/plumb/plumber.h +++ b/src/cmd/plumb/plumber.h @@ -54,7 +54,7 @@ struct Ruleset enum { - NMATCHSUBEXP = 32 /* bounded by ../../libregexp/regcomp.h:/NSUBEXP */ + NMATCHSUBEXP = 100 /* bounded by ../../libregexp/regcomp.h:/NSUBEXP */ }; struct Exec From cc4571fec67407652b03d6603ada6580de2194dc Mon Sep 17 00:00:00 2001 From: Igor Burago Date: Fri, 14 Oct 2022 20:28:06 +0800 Subject: [PATCH 13/17] libregexp: allow up to 127 captured subexpressions in one regexp 128 counting with the entire expression match ($0). --- src/libregexp/regcomp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libregexp/regcomp.h b/src/libregexp/regcomp.h index 4b9a483b..0e03caa6 100644 --- a/src/libregexp/regcomp.h +++ b/src/libregexp/regcomp.h @@ -5,7 +5,7 @@ typedef unsigned char uchar; #define nelem(x) (sizeof(x)/sizeof((x)[0])) -#define NSUBEXP 32 +#define NSUBEXP 128 typedef struct Resublist Resublist; struct Resublist { From a36e66f0d200f99802ad32171c55d26ad44f501d Mon Sep 17 00:00:00 2001 From: matheuristic Date: Sun, 20 Aug 2023 20:57:39 -0400 Subject: [PATCH 14/17] libdraw: fix subfont scaling A subfont with n chars has n+1 Fontchars, so scalesubfont() needs to scale all n+1 info entries. --- src/libdraw/getsubfont.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libdraw/getsubfont.c b/src/libdraw/getsubfont.c index 1cc234ef..2b7cf5c6 100644 --- a/src/libdraw/getsubfont.c +++ b/src/libdraw/getsubfont.c @@ -122,7 +122,7 @@ scalesubfont(Subfont *f, int scale) f->height *= scale; f->ascent *= scale; - for(j=0; jn; j++) { + for(j=0; j<=f->n; j++) { f->info[j].x *= scale; f->info[j].top *= scale; f->info[j].bottom *= scale; From 65c090346a38a8c30cb242d345aa71060116340c Mon Sep 17 00:00:00 2001 From: japanoise Date: Wed, 23 Aug 2023 08:21:37 -0500 Subject: [PATCH 15/17] libframe: Match the color of tick Previously the vertical bar in tick was always black; fine if you use the standard black-on-white for everything, but any attempt to add a dark mode ran into trouble with the tick being half hard-coded black, half the new text color. --- src/libframe/frinit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libframe/frinit.c b/src/libframe/frinit.c index 90931f25..5e97ceb7 100644 --- a/src/libframe/frinit.c +++ b/src/libframe/frinit.c @@ -52,7 +52,7 @@ frinittick(Frame *f) /* background color */ draw(f->tick, f->tick->r, f->cols[BACK], nil, ZP); /* vertical line */ - draw(f->tick, Rect(f->tickscale*(FRTICKW/2), 0, f->tickscale*(FRTICKW/2+1), ft->height), f->display->black, nil, ZP); + draw(f->tick, Rect(f->tickscale*(FRTICKW/2), 0, f->tickscale*(FRTICKW/2+1), ft->height), f->cols[TEXT], nil, ZP); /* box on each end */ draw(f->tick, Rect(0, 0, f->tickscale*FRTICKW, f->tickscale*FRTICKW), f->cols[TEXT], nil, ZP); draw(f->tick, Rect(0, ft->height-f->tickscale*FRTICKW, f->tickscale*FRTICKW, ft->height), f->cols[TEXT], nil, ZP); From dfbafb68e22de866ab0a708862230acbac50910a Mon Sep 17 00:00:00 2001 From: matheuristic Date: Mon, 4 Sep 2023 13:47:37 -0400 Subject: [PATCH 16/17] acme: have Dump save both low and high DPI fontnames Instead of only saving a window's currently displayed font's name to the dump file, have Acme's Dump command save that window's combined low DPI and high DPI font names when both are available. See 9fans/plan9port#630 --- src/cmd/acme/rows.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/cmd/acme/rows.c b/src/cmd/acme/rows.c index 7a64fabf..8aee340f 100644 --- a/src/cmd/acme/rows.c +++ b/src/cmd/acme/rows.c @@ -319,7 +319,7 @@ rowdump(Row *row, char *file) int i, j, fd, m, n, start, dumped; uint q0, q1; Biobuf *b; - char *buf, *a, *fontname; + char *buf, *a, *fontname, *fontfmt, *fontnamelo, *fontnamehi; Rune *r; Column *c; Window *w, *w1; @@ -394,9 +394,17 @@ rowdump(Row *row, char *file) if(w1->nopen[QWevent]) goto Continue2; } - fontname = ""; - if(t->reffont->f != font) - fontname = t->reffont->f->name; + fontfmt = "%s"; + fontnamelo = ""; + fontnamehi = nil; + if(t->reffont->f != font){ + fontnamelo = t->reffont->f->lodpi->name; + if(t->reffont->f->hidpi != nil){ + fontfmt = "%s,%s"; + fontnamehi = t->reffont->f->hidpi->name; + } + } + fontname = smprint(fontfmt, fontnamelo, fontnamehi); if(t->file->nname) a = runetobyte(t->file->name, t->file->nname); else @@ -428,6 +436,7 @@ rowdump(Row *row, char *file) 100.0*(w->r.min.y-c->r.min.y)/Dy(c->r), w->body.file->b.nc, fontname); } + free(fontname); free(a); winctlprint(w, buf, 0); Bwrite(b, buf, strlen(buf)); From 984c2824e3569479bace65bdaf9e78a2eb36dd58 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 13 Sep 2023 10:47:40 -0400 Subject: [PATCH 17/17] page: fix viewing of graphics 940f1fd6af broke page on non-PDF files. --- src/cmd/page/page.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cmd/page/page.c b/src/cmd/page/page.c index 24a4b024..60846686 100644 --- a/src/cmd/page/page.c +++ b/src/cmd/page/page.c @@ -98,8 +98,9 @@ threadmain(int argc, char **argv) Biobuf *b; enum { Ninput = 16 }; uchar buf[Ninput+1]; - int readstdin; + int readstdin, haveppi; + haveppi = 0; ARGBEGIN{ /* "temporary" debugging options */ case 'P': @@ -127,6 +128,7 @@ threadmain(int argc, char **argv) reverse = 1; break; case 'p': + haveppi = 1; ppi = atoi(EARGF(usage())); break; case 'b': @@ -223,7 +225,7 @@ threadmain(int argc, char **argv) else if(strncmp((char*)buf, "x T ", 4) == 0) doc = inittroff(b, argc, argv, buf, Ninput); else { - if(ppi != 100) { + if(haveppi) { fprint(2, "page: you can't specify -p with graphic files\n"); wexits("-p and graphics"); }