shithub: fork

Download patch

ref: fb8cac73ad28e6ae80bdc837ba16e1c14ed1cb07
parent: d9c7f0cfd403e58587e784db42d408ff193cbbf5
author: qwx <qwx@sciops.net>
date: Wed Jan 7 05:27:37 EST 2026

jamterm: sync with 9front samterm

--- a/sys/src/cmd/jamterm/main.c
+++ b/sys/src/cmd/jamterm/main.c
@@ -385,18 +385,7 @@
 int
 alnum(int c)
 {
-	/*
-	 * Hard to get absolutely right.  Use what we know about ASCII
-	 * and assume anything above the Latin control characters is
-	 * potentially an alphanumeric.
-	 */
-	if(c<=' ')
-		return 0;
-	if(0x7F<=c && c<=0xA0)
-		return 0;
-	if(utfrune("!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", c))
-		return 0;
-	return 1;
+	return isalpharune(c) || isdigitrune(c);
 }
 
 int
--- a/sys/src/cmd/jamterm/menu.c
+++ b/sys/src/cmd/jamterm/menu.c
@@ -149,6 +149,12 @@
 }
 
 void
+setmenuhit(int m)
+{
+	menu3.lasthit = m + NMENU3;
+}
+
+void
 menu3hit(void)
 {
 	Rectangle r;
@@ -276,7 +282,7 @@
 	name[n][0] = m;
 	strcpy((char*)name[n]+1, (char*)s);
 	nname++;
-	menu3.lasthit = n+NMENU3;
+	setmenuhit(n);
 }
 
 void
--- a/sys/src/cmd/jamterm/mesg.c
+++ b/sys/src/cmd/jamterm/mesg.c
@@ -97,7 +97,7 @@
 inmesg(Hmesg type, int count)
 {
 	Text *t;
-	int i, m;
+	int i, m, menu;
 	long l;
 	vlong vl;
 	Flayer *lp;
@@ -130,7 +130,7 @@
 		break;
 
 	case Hcurrent:
-		if(whichmenu(m) < 0)
+		if((menu=whichmenu(m))<0)
 			break;
 		if((t = whichtext(m)) == nil
 		&& (t = sweeptext(0, m)) == nil)
@@ -141,6 +141,7 @@
 		if(which != nil && ((Text *)which->user1) == &cmd && m != cmd.tag){
 			flupfront(lp);
 			flborder(lp, 0);
+			setmenuhit(menu);
 			work = lp;
 		}else
 			current(lp, 1, 1);
--- a/sys/src/cmd/jamterm/rasp.c
+++ b/sys/src/cmd/jamterm/rasp.c
@@ -89,7 +89,7 @@
 		s->next->text = 0;
 	else{
 		s->next->text = alloc(RUNESIZE*(TBLOCKSIZE+1));
-		Strcpy(s->next->text, s->text+n0);
+		runestrcpy(s->next->text, s->text+n0);
 		s->text[n0] = 0;
 	}
 	s->next->nrunes = s->nrunes-n0;
@@ -161,17 +161,11 @@
 			if(s->text){
 				if(s->nrunes+s->next->nrunes>TBLOCKSIZE)
 					break;
-				Strcpy(s->text+s->nrunes, s->next->text);
+				runestrcpy(s->text+s->nrunes, s->next->text);
 			}
 			s->nrunes += s->next->nrunes;
 			rsdelete(r, s->next);
 		}
-}
-
-void
-Strcpy(Rune *to, Rune *from)
-{
-	do; while(*to++ = *from++);
 }
 
 Rune*
--- a/sys/src/cmd/jamterm/samterm.h
+++ b/sys/src/cmd/jamterm/samterm.h
@@ -146,6 +146,7 @@
 Rune	*rload(Rasp*, ulong, ulong, ulong*);
 void	menuins(int, uchar*, Text*, int, int);
 void	menudel(int);
+void	setmenuhit(int);
 Rectangle	expandempty(Point, Flayer*, int);
 Text	*sweeptext(int, int);
 void	setpat(char*);
@@ -159,8 +160,6 @@
 long	scrtotal(Flayer*);
 void	flnewlyvisible(Flayer*);
 char	*rcvstring(void);
-void	Strcpy(Rune*, Rune*);
-void	Strncpy(Rune*, Rune*, long);
 void	flushtyping(int);
 void	dumperrmsg(int, int, int, int);
 int	screensize(int*,int*);
--