rem: tPtr->flags.ownsSelection = True;
add: if (!tPtr->flags.ownsSelection) { WMCreateSelectionHandler(tPtr->view, XA_PRIMARY, tPtr->lastClickTime, &selectionHandler, NULL); tPtr->flags.ownsSelection = True; }
context: autoSelectText(Text *tPtr, int clicks) {    int x, start;    TextBlock *tb;    char *mark = NULL, behind, ahead;    if(!(tb = tPtr->currentTextBlock))        return;     if(clicks == 2) {                switch(tb->text[tPtr->tpos]) {            case ' ': return;/*            case '<': case '>': behind = '<'; ahead = '>'; break;            case '{': case '}': behind = '{'; ahead = '}'; break;            case '[': case ']': behind = '['; ahead = ']'; break;*/            default: behind = ahead = ' ';        }        tPtr->sel.y = tPtr->cursor.y+5;        tPtr->sel.h = 6;/*tPtr->cursor.h-10;*/        if(tb->graphic) {             tPtr->sel.x = tb->sections[0].x;            tPtr->sel.w = tb->sections[0].w;        } else {            WMFont *font = tPtr->flags.monoFont?tPtr->dFont:tb->d.font;            start = tPtr->tpos;            while(start > 0 &&  tb->text[start-1] != behind)                start--;            x = tPtr->cursor.x;            if(tPtr->tpos > start){                 x -= WMWidthOfString(font, &tb->text[start],                 tPtr->tpos - start);            }            tPtr->sel.x = (x<0?0:x)+1;            if((mark = strchr(&tb->text[start], ahead))) {                 tPtr->sel.w = WMWidthOfString(font, &tb->text[start],                    (int)(mark - &tb->text[start]));            } else if(tb->used > start)  {                tPtr->sel.w = WMWidthOfString(font, &tb->text[start],                    tb->used - start);            }        }    } else if(clicks == 3) {           TextBlock *cur = tb;                   while(tb && !tb->first) {              tb = tb->prior;          }          tPtr->sel.y = tb->sections[0]._y;                    tb = cur;          while(tb->next && !tb->next->first) {               tb = tb->next;          }          tPtr->sel.h = tb->sections[tb->nsections-1]._y               + 5 - tPtr->sel.y;          tPtr->sel.x = 0;          tPtr->sel.w = tPtr->docWidth;          tPtr->clicked.x = 0; /* only for now, fix sel. code */    }    tPtr->flags.ownsSelection = True;    paintText(tPtr);}