rem: if(type == 1 && item.chunk->type == ctText) {   lm = 2+WMGetRulerMargins(tPtr->ruler, WRulerDocLeft);  if(		(item.x+j+lm >= tPtr->sRect.pos.x && item.x+j+lm <= tPtr->sRect.pos.x+tPtr->sRect.size.width) ||	(item.x+j+lm >= tPtr->sRect.pos.x+tPtr->sRect.size.width &&	y+para->top+rh+lh <= tPtr->sRect.pos.y+tPtr->sRect.size.height) ||	(tPtr->sRect.pos.y < y+para->top+rh &&	tPtr->sRect.pos.x+tPtr->sRect.size.width > item.x+j+lm)   ){ rect.size.width = w; rect.pos.x = item.x+j; item.chunk->selected = True; if(item.chunk->chars > 6) { item.chunk->sStart = 3; item.chunk->sEnd = item.chunk->chars; } else { item.chunk->sStart = 0; item.chunk->sEnd = item.chunk->chars; } } } else if(type == 2) { rect.pos.x = item.x+j; item.chunk->selected = True; if(item.chunk->type == ctText) { item.chunk->sStart = 0; item.chunk->sStart = item.chunk->chars; rect.size.width = WMWidthOfString(font, item.text, item.chars); } else { rect.size.width = item.chunk->pixmap->width; }
add: if (type == 1 && item.chunk->type == ctText) {	 lm = 2 + WMGetRulerMargin(tPtr->ruler, WRulerDocLeft);  if ((item.x + j + lm >= tPtr->sRect.pos.x && item.x + j + lm <= tPtr->sRect.pos.x + tPtr->sRect.size.width) || (item.x + j + lm >= tPtr->sRect.pos.x + tPtr->sRect.size.width && y + para->top + rh + lh <= tPtr->sRect.pos.y + tPtr->sRect.size.height) || (tPtr->sRect.pos.y < y + para->top + rh && tPtr->sRect.pos.x + tPtr->sRect.size.width > item.x + j + lm)) { rect.size.width = w; rect.pos.x = item.x + j; item.chunk->selected = True; if (item.chunk->chars > 6) { item.chunk->sStart = 3; item.chunk->sEnd = item.chunk->chars; } else { item.chunk->sStart = 0; item.chunk->sEnd = item.chunk->chars; } } } else if (type == 2) { rect.pos.x = item.x + j; item.chunk->selected = True; if (item.chunk->type == ctText) { item.chunk->sStart = 0; item.chunk->sStart = item.chunk->chars; rect.size.width = WMWidthOfString(font, item.text, item.chars); } else { rect.size.width = item.chunk->pixmap->width; }
context: chunkSelectionRect(Text *tPtr, Paragraph *para, MyTextItems item,                   short y, short j, short lh){    WMRect rect;    short type=0;  /* 0:none 1:partial: 2:all */    short rh=(tPtr->rulerShown)?45:5;    short w, lm;    WMFont *font = (tPtr->monoFont || item.chunk->type != ctText)?        tPtr->dFont:item.chunk->font;    rect.pos.x = -23;    if(y+para->top+rh > tPtr->sRect.pos.y+tPtr->sRect.size.height       || y+para->top+rh+lh < tPtr->sRect.pos.y)        return rect;    if(item.chunk->type == ctText)        w = WMWidthOfString(font, item.text, item.chars);    else w = item.chunk->pixmap->width;    if(y+para->top+rh >= tPtr->sRect.pos.y && (y+para->top+rh+lh                                               <=  tPtr->sRect.pos.y+tPtr->sRect.size.height))        //&& item.x+j >= tPtr->sRect.pos.x+tPtr->sRect.size.width))        type = 2;    else type = 1;#if 0    if(item.x+j >= tPtr->sRect.pos.x &&       item.x+j+w < tPtr->sRect.pos.x+tPtr->sRect.size.width)        type = 2;    if(type == 1 &&  y+para->top+rh+lh <=       tPtr->sRect.pos.y+tPtr->sRect.size.height)        type = 2;#endif    if(type == 1 && item.chunk->type == ctText) {  /* partial coverage */        lm = 2+WMGetRulerMargins(tPtr->ruler, WRulerDocLeft);        /* even I am still confused, so don't ask please */        if(		(item.x+j+lm >= tPtr->sRect.pos.x &&                         item.x+j+lm <= tPtr->sRect.pos.x+tPtr->sRect.size.width)                        ||	(item.x+j+lm >= tPtr->sRect.pos.x+tPtr->sRect.size.width                                 &&	y+para->top+rh+lh <=                                 tPtr->sRect.pos.y+tPtr->sRect.size.height)                        ||	(tPtr->sRect.pos.y < y+para->top+rh                                 &&	tPtr->sRect.pos.x+tPtr->sRect.size.width >                                 item.x+j+lm)   ){            rect.size.width = w;            rect.pos.x = item.x+j;            item.chunk->selected = True;            if(item.chunk->chars > 6) {                item.chunk->sStart = 3;                item.chunk->sEnd = item.chunk->chars;            } else {                item.chunk->sStart = 0;                item.chunk->sEnd = item.chunk->chars;            }        }    } else if(type == 2) {        rect.pos.x = item.x+j;        item.chunk->selected = True;        if(item.chunk->type == ctText) {            item.chunk->sStart = 0;            item.chunk->sStart = item.chunk->chars;            rect.size.width = WMWidthOfString(font,                                              item.text, item.chars);        } else {            rect.size.width = item.chunk->pixmap->width;        }    }    rect.pos.y = y;    rect.size.height = lh;    return rect;}