shithub: fork

Download patch

ref: da15aca4c4347a183be5d4eae659aec7cb40b41d
parent: dc8c14d39b50adb0261299e5d8cc747e2ad78b6d
author: qwx <qwx@sciops.net>
date: Mon Feb 24 13:13:50 EST 2025

jam, jamterm: sync with upstream

--- a/sys/src/cmd/jam/sam.c
+++ b/sys/src/cmd/jam/sam.c
@@ -39,6 +39,8 @@
 	String *t;
 	char *termargs[10], **ap;
 	
+	rfork(RFENVG|RFNAMEG);
+
 	ap = termargs;
 	*ap++ = "jamterm";
 	ARGBEGIN{
--- a/sys/src/cmd/jamterm/main.c
+++ b/sys/src/cmd/jamterm/main.c
@@ -38,6 +38,8 @@
 	Flayer *nwhich;
 	ulong p;
 
+	rfork(RFENVG|RFNAMEG);
+
 	getscreen(argc, argv);
 	iconinit();
 	initio();
@@ -639,7 +641,7 @@
 		scrorigin(l, 1, Dy(l->scroll)/l->f.font->height);
 	}else if(c == Kright){
 		flushtyping(0);
-		a0 = l->p0;
+		a0 = l->p1;
 		if(a0 < t->rasp.nrunes)
 			a0++;
 		flsetselect(l, a0, a0);
--- a/sys/src/cmd/jamterm/plan9.c
+++ b/sys/src/cmd/jamterm/plan9.c
@@ -26,6 +26,7 @@
 getscreen(int argc, char **argv)
 {
 	char *t;
+	uint tlen;
 
 	ARGBEGIN{
 	case 'A':
@@ -43,8 +44,8 @@
 		threadexitsall("init");
 	}
 	t = getenv("tabstop");
-	if(t != nil)
-		maxtab = strtoul(t, nil, 0);
+	if(t != nil && (tlen = strtoul(t, nil, 0)) > 0)
+		maxtab = tlen;
 	free(t);
 	flstart(screen->clipr);
 	draw(screen, screen->clipr, maincols[BACK], nil, ZP);
--- a/sys/src/cmd/jamterm/win.c
+++ b/sys/src/cmd/jamterm/win.c
@@ -182,8 +182,8 @@
 		*rp = r;
 		return 0;
 	/* around the minimum for libframe to not choke */
-	}else if(Dx(r) < 2 * stringwidth(font, "0") + 2 * FLMARGIN
-	|| Dy(r) < font->height + 2 * FLMARGIN){
+	}else if(Dx(r) < 4 * stringwidth(font, "0") + 2 * FLMARGIN
+	|| Dy(r) < font->height + 4 * FLMARGIN){
 		p = r.min;	/* mousep->xy == r.max */
 		if(!ptinrect(p, screen->r))
 			return 0;