acme: scale window bodies on resize, not including tag space

This avoids reopening collapsed windows after a large vertical resize.
This commit is contained in:
Russ Cox 2020-03-30 09:54:45 -04:00
parent 92aa0e13ad
commit 4650064aa7

View file

@ -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);