rem: if (range.position < 0) { range.count += range.position; range.count = (range.count < 0) ? 0 : range.count; range.position = 0; } else if (range.position > tPtr->textLen) { range.position = tPtr->textLen; range.count = 0; }  if (range.position + range.count > tPtr->textLen) range.count = tPtr->textLen - range.position;  tPtr->prevselection = tPtr->selection;
add: normalizeRange(tPtr, &range);
context: WMSelectTextFieldRange(WMTextField *tPtr, WMRange range){    if (tPtr->flags.enabled) {        if (range.position < 0) {            range.count += range.position;            range.count = (range.count < 0) ? 0 : range.count;            range.position = 0;        } else if (range.position > tPtr->textLen) {            range.position = tPtr->textLen;            range.count = 0;        }        if (range.position + range.count > tPtr->textLen)            range.count = tPtr->textLen - range.position;        tPtr->prevselection = tPtr->selection; /* check if this is needed */        tPtr->selection = range;        if (tPtr->view->flags.realized) {            paintTextField(tPtr);        }    }}