fix scrolling

This commit is contained in:
rsc 2004-06-20 16:29:19 +00:00
parent 3f23048f7b
commit 64055489f6

View file

@ -637,6 +637,7 @@ texttype(Text *t, Rune r)
int nr; int nr;
Rune *rp; Rune *rp;
Text *u; Text *u;
int precise;
if(t->what!=Body && r=='\n') if(t->what!=Body && r=='\n')
return; return;
@ -659,7 +660,7 @@ texttype(Text *t, Rune r)
n = t->fr.maxlines/3; n = t->fr.maxlines/3;
goto case_Down; goto case_Down;
case Kscrollonedown: case Kscrollonedown:
n = mousescrollsize(t->fr.maxlines)-1; /* -1 counters a bug somewhere else */ n = mousescrollsize(t->fr.maxlines);
if(n <= 0) if(n <= 0)
n = 1; n = 1;
goto case_Down; goto case_Down;
@ -667,19 +668,19 @@ texttype(Text *t, Rune r)
n = 2*t->fr.maxlines/3; n = 2*t->fr.maxlines/3;
case_Down: case_Down:
q0 = t->org+frcharofpt(&t->fr, Pt(t->fr.r.min.x, t->fr.r.min.y+n*t->fr.font->height)); q0 = t->org+frcharofpt(&t->fr, Pt(t->fr.r.min.x, t->fr.r.min.y+n*t->fr.font->height));
textsetorigin(t, q0, FALSE); textsetorigin(t, q0, TRUE);
return; return;
case Kup: case Kup:
n = t->fr.maxlines/3; n = t->fr.maxlines/3;
goto case_Up; goto case_Up;
case Kscrolloneup: case Kscrolloneup:
n = mousescrollsize(t->fr.maxlines)+1; /* +1 counters a bug somewhere else */ n = mousescrollsize(t->fr.maxlines);
goto case_Up; goto case_Up;
case Kpgup: case Kpgup:
n = 2*t->fr.maxlines/3; n = 2*t->fr.maxlines/3;
case_Up: case_Up:
q0 = textbacknl(t, t->org, n); q0 = textbacknl(t, t->org, n);
textsetorigin(t, q0, FALSE); textsetorigin(t, q0, TRUE);
return; return;
case Khome: case Khome:
textshow(t, 0, 0, FALSE); textshow(t, 0, 0, FALSE);