|
|
1.1 ! root 1: #include <jerq.h> ! 2: #include "frame.h" ! 3: ! 4: deltext(t, s1, s2) ! 5: register Frame *t; ! 6: { ! 7: register char *p, *q, *r; ! 8: register n, y1, y2; ! 9: Point pt; ! 10: frameop(t, opclear, ptofchar(t, s1), t->str.s+s1, s2-s1); ! 11: p=t->str.s+s2; ! 12: r=t->str.s+t->str.n; ! 13: for(n=0,q=p; q<r && *q!='\n'; q++) ! 14: n++; ! 15: /* Found the '\n' at the end of this line; clear out */ ! 16: frameop(t, opclear, ptofchar(t, s2), p, n); ! 17: y1=endpoint.y; /* current y position of '\n' at p[n] */ ! 18: /* Draw rest of line at new place */ ! 19: pt=ptofchar(t, s1); ! 20: draw(t, pt, p, n); ! 21: y2=endpoint.y; ! 22: if(y1 != y2){ /* More housekeeping */ ! 23: /* NOTE: y1 > y2 */ ! 24: y1+=newlnsz; ! 25: y2+=newlnsz; ! 26: /* Scroll up */ ! 27: bitblt(D, Rect(t->rect.origin.x, y1, ! 28: t->rect.corner.x, t->rect.corner.y), ! 29: D, Pt(t->rect.origin.x, y2), F_STORE); ! 30: /* Clear the rest */ ! 31: clear(Rpt(Pt(t->rect.origin.x, t->rect.corner.y-(y1-y2)), ! 32: t->rect.corner), 1); ! 33: y1-=newlnsz; ! 34: y2-=newlnsz; ! 35: } ! 36: y1=lineno(t, y1); ! 37: y2=lineno(t, y2); ! 38: delstring(&t->str, s1, s2); ! 39: if(y1 == y2) ! 40: setcpl(t, lineno(t, pt.y), y1); ! 41: else ! 42: setcpl(t, 0, t->nlines-1); /* SLOW, correct */ ! 43: if(y1 != y2){ ! 44: n=charofpt(t, Pt(0, (t->nlines-(y1-y2)) ! 45: *newlnsz+t->rect.origin.y)); /* Re-use of n */ ! 46: /* n is last visible char */ ! 47: draw(t, ptofchar(t, n), t->str.s+n, t->str.n-n); ! 48: if(complete) ! 49: return TRUE; ! 50: } ! 51: return FALSE; ! 52: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.