tacme: scale window bodies on resize, not including tag space - plan9port - [fork] Plan 9 from user space
HTML git clone git://src.adamsgaard.dk/plan9port
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 4650064aa757c217fa72f8819a2cf67c689bcdef
DIR parent 92aa0e13ad8cec37936998a66eb728bfca88d689
HTML Author: Russ Cox <rsc@swtch.com>
Date: Mon, 30 Mar 2020 09:54:45 -0400
acme: scale window bodies on resize, not including tag space
This avoids reopening collapsed windows after a large vertical resize.
Diffstat:
M src/cmd/acme/cols.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
DIR diff --git a/src/cmd/acme/cols.c b/src/cmd/acme/cols.c
t@@ -232,7 +232,7 @@ colmousebut(Column *c)
void
colresize(Column *c, Rectangle r)
{
- int i;
+ int i, old, new;
Rectangle r1, r2;
Window *w;
t@@ -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;
t@@ -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);