18 scrpos(Rectangle r, uint p0, uint p1, uint tot)
35 q.max.y -= h*(tot-p1)/tot;
36 if(q.max.y < q.min.y+2){
37 if(q.min.y+2 <= r.max.y)
49 scrtmp = allocimage(display, Rect(0, 0, 32, screen->r.max.y), screen->chan, 0, DNofill);
51 error("scroll alloc");
60 if(t->w==nil || t!=&t->w->body)
69 r2 = scrpos(r1, t->org, t->org+t->nchars, t->file->nc);
70 if(!eqrect(r2, t->lastsr)){
72 draw(b, r1, t->cols[BORD], nil, ZP);
73 draw(b, r2, t->cols[BACK], nil, ZP);
74 r2.min.x = r2.max.x-1;
75 draw(b, r2, t->cols[BORD], nil, ZP);
76 draw(t->b, r, b, nil, Pt(0, r1.min.y));
77 /*flushimage(display, 1);/*BUG?*/
87 timer = timerstart(dt);
91 alts[1].c = mousectl->c;
92 alts[1].v = &mousectl->Mouse;
107 textscroll(Text *t, int but)
113 s = insetrect(t->scrollr, 1);
118 flushimage(display, 1);
126 p0 = (vlong)t->file->nc*(y-s.min.y)/h;
128 p0 = textbacknl(t, p0, 2);
130 textsetorigin(t, p0, FALSE);
136 p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height);
138 p0 = t->org+frcharofpt(t, Pt(s.max.x, my));
140 textsetorigin(t, p0, TRUE);
144 flushimage(display, 1);
146 nbrecv(mousectl->c, &mousectl->Mouse);
150 }while(mouse->buttons & (1<<(but-1)));
151 while(mouse->buttons)