aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/acme
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2020-03-30 09:54:45 -0400
committerRuss Cox <rsc@swtch.com>2020-03-30 09:56:50 -0400
commit4650064aa757c217fa72f8819a2cf67c689bcdef (patch)
treedee3a8c4ffc2d1b3c9111183e0492fbc7a5f1947 /src/cmd/acme
parent92aa0e13ad8cec37936998a66eb728bfca88d689 (diff)
downloadplan9port-4650064aa757c217fa72f8819a2cf67c689bcdef.tar.gz
plan9port-4650064aa757c217fa72f8819a2cf67c689bcdef.tar.bz2
plan9port-4650064aa757c217fa72f8819a2cf67c689bcdef.zip
acme: scale window bodies on resize, not including tag space
This avoids reopening collapsed windows after a large vertical resize.
Diffstat (limited to 'src/cmd/acme')
-rw-r--r--src/cmd/acme/cols.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cmd/acme/cols.c b/src/cmd/acme/cols.c
index 63c33ac1..63247a84 100644
--- a/src/cmd/acme/cols.c
+++ b/src/cmd/acme/cols.c
@@ -232,7 +232,7 @@ colmousebut(Column *c)
void
colresize(Column *c, Rectangle r)
{
- int i;
+ int i, old, new;
Rectangle r1, r2;
Window *w;
@@ -245,6 +245,8 @@ colresize(Column *c, Rectangle r)
r1.max.y += Border;
draw(screen, r1, display->black, nil, ZP);
r1.max.y = r.max.y;
+ new = Dy(r) - c->nw*(Border + font->height);
+ old = Dy(c->r) - c->nw*(Border + font->height);
for(i=0; i<c->nw; i++){
w = c->w[i];
w->maxlines = 0;
@@ -252,8 +254,8 @@ colresize(Column *c, Rectangle r)
r1.max.y = r.max.y;
else{
r1.max.y = r1.min.y;
- if(Dy(c->r) != 0){
- r1.max.y += (Dy(w->r)+Border)*Dy(r)/Dy(c->r);
+ 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;
}
}
r1.max.y = max(r1.max.y, r1.min.y + Border+font->height);