acme: fix directory resize bug

This commit is contained in:
Russ Cox 2008-03-07 07:47:54 -05:00
parent 5e22f11b97
commit 0cd1385d9f

View file

@ -71,17 +71,20 @@ textredraw(Text *t, Rectangle r, Font *f, Image *b, int odx)
int int
textresize(Text *t, Rectangle r, int keepextra) textresize(Text *t, Rectangle r, int keepextra)
{ {
int odx;
if(Dy(r) <= 0) if(Dy(r) <= 0)
r.max.y = r.min.y; r.max.y = r.min.y;
if(!keepextra) if(!keepextra)
r.max.y -= Dy(r)%t->fr.font->height; r.max.y -= Dy(r)%t->fr.font->height;
odx = Dx(t->all);
t->all = r; t->all = r;
t->scrollr = r; t->scrollr = r;
t->scrollr.max.x = r.min.x+Scrollwid; t->scrollr.max.x = r.min.x+Scrollwid;
t->lastsr = nullrect; t->lastsr = nullrect;
r.min.x += Scrollwid+Scrollgap; r.min.x += Scrollwid+Scrollgap;
frclear(&t->fr, 0); frclear(&t->fr, 0);
textredraw(t, r, t->fr.font, screen, Dx(t->all)); textredraw(t, r, t->fr.font, screen, odx);
if(keepextra && t->fr.r.max.y < t->all.max.y){ if(keepextra && t->fr.r.max.y < t->all.max.y){
r.min.x -= Scrollgap; r.min.x -= Scrollgap;
r.min.y = t->fr.r.max.y; r.min.y = t->fr.r.max.y;