Annotation of researchv10dc/630/src/deltext.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.