From 0256a34560a58c7fffe4a83476efd03d64c9a783 Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Wed, 14 Apr 2021 20:30:24 -0700 Subject: [PATCH] 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 --- sys/src/cmd/acme/cols.c | 6 +++--- sys/src/cmd/acme/look.c | 2 +- sys/src/cmd/acme/text.c | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/src/cmd/acme/cols.c b/sys/src/cmd/acme/cols.c index 7ac1e1500..8518f1e9c 100644 --- a/sys/src/cmd/acme/cols.c +++ b/sys/src/cmd/acme/cols.c @@ -208,8 +208,8 @@ colresize(Column *c, Rectangle r) 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 @@ colgrow(Column *c, Window *w, int but) } 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; diff --git a/sys/src/cmd/acme/look.c b/sys/src/cmd/acme/look.c index ff0125300..42b449c74 100644 --- a/sys/src/cmd/acme/look.c +++ b/sys/src/cmd/acme/look.c @@ -314,7 +314,7 @@ isfilec(Rune r) { if(isalnum(r)) return TRUE; - if(runestrchr(L".-+/:", r)) + if(runestrchr(L".-+/:@", r)) return TRUE; return FALSE; } diff --git a/sys/src/cmd/acme/text.c b/sys/src/cmd/acme/text.c index 484ec3de1..b313ed4a4 100644 --- a/sys/src/cmd/acme/text.c +++ b/sys/src/cmd/acme/text.c @@ -664,6 +664,7 @@ texttype(Text *t, Rune r) uint q0, q1; int nnb, nb, n, i; int nr; + Rune rr; Rune *rp; Text *u; @@ -818,10 +819,10 @@ texttype(Text *t, Rune r) nr = 0; rp[nr++] = r; for(i=0; iq0-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 */