shithub: riscv

Download patch

ref: 0256a34560a58c7fffe4a83476efd03d64c9a783
parent: a90a801685553329a8626237bf250421f9e1249c
author: Ori Bernstein <[email protected]>
date: Wed Apr 14 16:30:24 EDT 2021

acme: fix border size, autoindent undo: imported from plan9port (thanks jxy)

origin:

https://github.com/9fans/plan9port/pull/493
https://github.com/9fans/plan9port/pull/489
https://github.com/9fans/plan9port/pull/461

--- a/sys/src/cmd/acme/cols.c
+++ b/sys/src/cmd/acme/cols.c
@@ -208,8 +208,8 @@
 			r1.max.y = r.max.y;
 		else {
 			r1.max.y = r1.min.y;
-			if(new > 0 && old > 0 && Dy(w->r) > Border+font->height)
-				r1.max.y += (Dy(w->r)-Border-font->height)*new/old + Border + font->height;
+			if(new > 0 && old > 0 && Dy(w->r) > font->height)
+				r1.max.y += (Dy(w->r)-font->height)*new/old + Border + font->height;
 		}
 		r2 = r1;
 		r2.max.y = r2.min.y+Border;
@@ -422,7 +422,7 @@
 		}
 		if(j < c->nw-1){	/* no border on last window */
 			r.min.y = v->r.max.y;
-			r.max.y += Border;
+			r.max.y = r.min.y + Border;
 			draw(screen, r, display->black, nil, ZP);
 		}
 		y1 = r.max.y;
--- a/sys/src/cmd/acme/look.c
+++ b/sys/src/cmd/acme/look.c
@@ -314,7 +314,7 @@
 {
 	if(isalnum(r))
 		return TRUE;
-	if(runestrchr(L".-+/:", r))
+	if(runestrchr(L".-+/:@", r))
 		return TRUE;
 	return FALSE;
 }
--- a/sys/src/cmd/acme/text.c
+++ b/sys/src/cmd/acme/text.c
@@ -664,6 +664,7 @@
 	uint q0, q1;
 	int nnb, nb, n, i;
 	int nr;
+	Rune rr;
 	Rune *rp;
 	Text *u;
 
@@ -818,10 +819,10 @@
 			nr = 0;
 			rp[nr++] = r;
 			for(i=0; i<nnb; i++){
-				r = textreadc(t, t->q0-nnb+i);
-				if(r != ' ' && r != '\t')
+				rr = textreadc(t, t->q0-nnb+i);
+				if(rr != ' ' && rr != '\t')
 					break;
-				rp[nr++] = r;
+				rp[nr++] = rr;
 			}
 		}
 		break; /* fall through to normal code */