rem: if(*text == '\n') { int new_top=0; if(chunk) {  int current = WMGetTextCurrentChunk(tPtr); if(tPtr->tpos <=0) {  if(current<1) {  newchunk = para->chunks; para->chunks = NULL; putParagraphOnPixmap(tPtr, para, True); } else {  printf("cut me out \n"); } } else if(tPtr->tpos < chunk->chars && chunk->type == ctText) {  char text[chunk->chars-tPtr->tpos+1]; int i=0; do { text[i] = chunk->text[tPtr->tpos+i]; } while(++i < chunk->chars-tPtr->tpos); chunk->chars -= i; newchunk = (tPtr->funcs.createTChunk) (text, i, chunk->font, chunk->color, chunk->script, chunk->ul); newchunk->next = chunk->next; chunk->next = NULL;   para->height = putParagraphOnPixmap(tPtr, para, True);  } else if(tPtr->tpos >= chunk->chars) { Chunk *prev; WMSetTextCurrentChunk(tPtr, current-1); prev = tPtr->currentChunk; if(!prev) return; newchunk = prev->next; prev->next = NULL; putParagraphOnPixmap(tPtr, para, True); } } else newchunk = NULL;
add: if (*text == '\n') { int new_top = 0; if (chunk) {		 int current = WMGetTextCurrentChunk(tPtr); if (tPtr->tpos <= 0) {	 if (current < 1) {	 newchunk = para->chunks; para->chunks = NULL; putParagraphOnPixmap(tPtr, para, True); } else {	 printf("cut me out \n"); } } else if (tPtr->tpos < chunk->chars && chunk->type == ctText) {  char text[chunk->chars - tPtr->tpos + 1]; int i = 0;
context: insertTextInteractively(Text *tPtr, char *text){    Paragraph *para=NULL;    Chunk *chunk=NULL, *newchunk=NULL;    int height = -23; /* should only be changed upon newline */    short w=0,h=0;    WMFont *font;    if(!tPtr->editable) return;    if(*text == '\n' && tPtr->ignoreNewLine)        return;    para = tPtr->currentPara;    chunk = tPtr->currentChunk;    font = (tPtr->monoFont || !chunk)?tPtr->dFont:chunk->font;    if(*text == '\n') {        int new_top=0;        if(chunk) { /* there's a chunk (or part of it) to detach from old */            int current = WMGetTextCurrentChunk(tPtr);            if(tPtr->tpos <=0) { /* at start of chunk */                if(current<1) { /* the first chunk... make old para blank */                    newchunk = para->chunks;                    para->chunks = NULL;                    putParagraphOnPixmap(tPtr, para, True);                } else { /* not first chunk... */                    printf("cut me out \n");                }            } else if(tPtr->tpos < chunk->chars && chunk->type == ctText) {                /* not at start of chunk */                char text[chunk->chars-tPtr->tpos+1];                int i=0;                do {                    text[i] = chunk->text[tPtr->tpos+i];                } while(++i < chunk->chars-tPtr->tpos);                chunk->chars -= i;                newchunk = (tPtr->funcs.createTChunk) (text, i, chunk->font,                                                       chunk->color, chunk->script, chunk->ul);                newchunk->next = chunk->next;                chunk->next = NULL;                /* might want to demalloc for LARGE cuts */                //calcParaExtents(tPtr, para);                para->height = putParagraphOnPixmap(tPtr, para, True);                //putParagraphOnPixmap(tPtr, para, True);            } else if(tPtr->tpos >= chunk->chars) {                Chunk *prev;                WMSetTextCurrentChunk(tPtr, current-1);                prev = tPtr->currentChunk;                if(!prev) return;                newchunk = prev->next;                prev->next = NULL;                putParagraphOnPixmap(tPtr, para, True);            }        } else newchunk = NULL;        if(para)  /* the preceeding one */            new_top = para->bottom;        WMAppendTextStream(tPtr, "\n");        para = tPtr->currentPara;        if(!para) return;        para->chunks = newchunk;        tPtr->currentChunk = newchunk;        tPtr->tpos = 0;        para->top = new_top;        calcParaExtents(tPtr, para);        height = para->height;    } else {        if(!para) {            WMAppendTextStream(tPtr, text);            para = tPtr->currentPara;        } else if(!para->chunks || !chunk) {            //WMPrependTextStream(tPtr, text);            WMAppendTextStream(tPtr, text);        } else if(chunk->type == ctImage) {            WMPrependTextStream(tPtr, text);            printf("\n\nprepe\n\n");        } else {            if(tPtr->tpos > chunk->chars) {                printf("\n\nmore\n\n");                tPtr->tpos = chunk->chars;            }            if(chunk->chars+1 >= chunk->mallocedSize) {                chunk->mallocedSize = reqBlockSize(chunk->chars+1);                chunk->text = wrealloc(chunk->text, chunk->mallocedSize);            }            memmove(&(chunk->text[tPtr->tpos+1]), &chunk->text[tPtr->tpos],                    chunk->chars-tPtr->tpos+1);            w = WMWidthOfString(font, text, 1);            memmove(&chunk->text[tPtr->tpos], text, 1);            chunk->chars++;            tPtr->tpos++;            //doc->clickstart.cursor.x +=            //WMWidthOfString(chunk->fmt->font, text,len);        }    }    if(para) {        affectNextParas(tPtr, para, height);        putParagraphOnPixmap(tPtr, para, True);        drawDocumentPartsOnPixmap(tPtr, False);        updateScrollers(tPtr);        paintText(tPtr);        //cursorToTextPosition(tPtr, tPtr->clicked.x+w, tPtr->clicked.y);        //check for "sneppah tahw" with blank paras...        //paintText(tPtr);    }}