better scrolling

This commit is contained in:
rsc 2005-03-18 19:33:26 +00:00
parent 4b12db1171
commit f334d75632
2 changed files with 37 additions and 41 deletions

View file

@ -541,6 +541,9 @@ colwhich(Column *c, Point p)
return &w->tag; return &w->tag;
return &w->body; return &w->body;
} }
/* scrollr drops below w->r on low windows */
if(ptinrect(p, w->body.scrollr))
return &w->body;
} }
return nil; return nil;
} }

View file

@ -117,9 +117,6 @@ textscroll(Text *t, int but)
first = TRUE; first = TRUE;
do{ do{
flushimage(display, 1); flushimage(display, 1);
if(mouse->xy.x<s.min.x || s.max.x<=mouse->xy.x){
readmouse(mousectl);
}else{
my = mouse->xy.y; my = mouse->xy.y;
if(my < s.min.y) if(my < s.min.y)
my = s.min.y; my = s.min.y;
@ -131,12 +128,9 @@ textscroll(Text *t, int but)
} }
if(but == 2){ if(but == 2){
y = my; y = my;
if(y > s.max.y-2) p0 = (vlong)t->file->b.nc*(y-s.min.y)/h;
y = s.max.y-2; if(p0 >= t->q1)
if(t->file->b.nc > 1024*1024) p0 = textbacknl(t, p0, 2);
p0 = ((t->file->b.nc>>10)*(y-s.min.y)/h)<<10;
else
p0 = t->file->b.nc*(y-s.min.y)/h;
if(oldp0 != p0) if(oldp0 != p0)
textsetorigin(t, p0, FALSE); textsetorigin(t, p0, FALSE);
oldp0 = p0; oldp0 = p0;
@ -158,7 +152,6 @@ textscroll(Text *t, int but)
first = FALSE; first = FALSE;
} }
scrsleep(80); scrsleep(80);
}
}while(mouse->buttons & (1<<(but-1))); }while(mouse->buttons & (1<<(but-1)));
while(mouse->buttons) while(mouse->buttons)
readmouse(mousectl); readmouse(mousectl);