Annotation of researchv9/jerq/src/mux/term/frame/instext.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: int inscomplete;
                      7: #define        MAXEXTRA        1024    /* max # chars off end of screen */
                      8: instext(t, s, sn)
                      9:        register Frame *t;
                     10:        register String *s;
                     11:        register sn;    /* char number at which to insert */
                     12: {
                     13:        register char *p, *q, *r;
                     14:        register n, y1, y2;
                     15:        Point sp;       /* point on screen */
                     16:        sp=ptofchar(t, sn);
                     17:        p=t->str.s+sn;
                     18:        r=t->str.s+t->str.n;
                     19:        for(n=0,q=p; q<r && *q!='\n'; q++)
                     20:                n++;
                     21:        /* n is #chars to next '\n' */
                     22:        frameop(t, opnull, sp, s->s, s->n);
                     23:        frameop(t, opnull, endpoint, p, n);
                     24:        y2=endpoint.y;          /* where p[n] will end up */
                     25:        draw(t, sp, p, n);      /* undraws, leaves endpoint */
                     26:        y1=endpoint.y;          /* where p[n] is now */
                     27:        insstring(&t->str, sn, s);      /* build new string */
                     28:        if(y1 != y2){           /* bitblt up a hole */
                     29:                y1+=newlnsz;    /* BOTTOM of char */
                     30:                y2+=newlnsz;
                     31:                Ubitblt(D, Rect(t->rect.origin.x, y1,
                     32:                        t->rect.corner.x, t->rect.corner.y-(y2-y1)),
                     33:                        D, Pt(t->rect.origin.x, y2), F_STORE);
                     34:                clear(Rect(t->rect.origin.x, y1, t->rect.corner.x, y2), 1);
                     35:                y1=(y1-t->rect.origin.y)/newlnsz-1;
                     36:                y2=(y2-t->rect.origin.y)/newlnsz-1;
                     37:                scrollcpl(t, t->nlines-1-(y2-y1), y1, y2-y1);
                     38:        }else
                     39:                y2=(y2-t->rect.origin.y)/newlnsz;
                     40:        draw(t, sp, t->str.s+sn, n+s->n);       /* redraw this line */
                     41:        inscomplete=complete;   /* cough! */
                     42:        setcpl(t, (ptofchar(t, sn).y-t->rect.origin.y)/newlnsz, y2);
                     43: #ifdef garbage
                     44:        n=charofpt(t, Pt(XMAX, YMAX));  /* Re-use of n */
                     45:        if(t->str.n-n > MAXEXTRA)
                     46:                delstring(&t->str, n+MAXEXTRA/2, t->str.n);
                     47: #endif
                     48: }

unix.superglobalmegacorp.com

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