Annotation of researchv9/jtools/src/sux/instext.c, revision 1.1.1.1

1.1       root        1: #include <jerq.h>
                      2: #include "frame.h"
                      3: int inscomplete;
                      4: instext(t, s, sn)
                      5:        register Frame *t;
                      6:        register String *s;
                      7:        register sn;    /* char number at which to insert */
                      8: {
                      9:        register char *p, *q, *r;
                     10:        register n, y1, y2;
                     11:        Point sp;       /* point on screen */
                     12:        sp=ptofchar(t, sn);
                     13:        p=t->str.s+sn;
                     14:        r=t->str.s+t->str.n;
                     15:        for(n=0,q=p; q<r && *q!='\n'; q++)
                     16:                n++;
                     17:        /* n is #chars to next '\n' */
                     18:        frameop(t, opnull, sp, s->s, s->n);
                     19:        frameop(t, opnull, endpoint, p, n);
                     20:        y2=endpoint.y;          /* where p[n] will end up */
                     21:        draw(t, sp, p, n);      /* undraws, leaves endpoint */
                     22:        y1=endpoint.y;          /* where p[n] is now */
                     23:        insstring(&t->str, sn, s);      /* build new string */
                     24:        if(y1 != y2){           /* bitblt up a hole */
                     25:                y1+=newlnsz;    /* BOTTOM of char */
                     26:                y2+=newlnsz;
                     27:                bitblt(D, Rect(t->rect.origin.x, y1,
                     28:                        t->rect.corner.x, t->rect.corner.y-(y2-y1)),
                     29:                        D, Pt(t->rect.origin.x, y2), F_STORE);
                     30:                clear(Rect(t->rect.origin.x, y1, t->rect.corner.x, y2), 1);
                     31:                y1=(y1-t->rect.origin.y)/newlnsz-1;
                     32:                y2=(y2-t->rect.origin.y)/newlnsz-1;
                     33:                scrollcpl(t, t->nlines-1-(y2-y1), y1, y2-y1);
                     34:        }else
                     35:                y2=(y2-t->rect.origin.y)/newlnsz;
                     36:        draw(t, sp, t->str.s+sn, n+s->n);       /* redraw this line */
                     37:        inscomplete=complete;   /* cough! */
                     38:        sp = ptofchar(t, sn);
                     39:        setcpl(t, (sp.y-t->rect.origin.y)/newlnsz, y2);
                     40: }

unix.superglobalmegacorp.com

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