rem: beforecrlf = strcspn(text, "\n\r");
add: beforecrlf = strcspn(text, "\n");
context: fitText(char *text, WMFont *font, int width, int wrap){    int i, w, beforecrlf, word1, word2;    /* text length before first cr/lf */    beforecrlf = strcspn(text, "\n\r");    if (!wrap || beforecrlf==0)        return beforecrlf;    w = WMWidthOfString(font, text, beforecrlf);    if (w <= width) {        /* text up to first crlf fits */        return beforecrlf;    }    word1 = 0;    while (1) {        word2 = word1 + findNextWord(text+word1, beforecrlf-word1);        if (word2 >= beforecrlf)            break;        w = WMWidthOfString(font, text, word2);        if (w > width)            break;        word1 = word2;    }    for (i=word1; i<word2; i++) {        w = WMWidthOfString(font, text, i);        if (w > width) {            break;        }    }    /* keep words complete if possible */    if (!isspace(text[i]) && word1>0) {        i = word1;    } else if (isspace(text[i]) && i<beforecrlf) {        /* keep space on current row, so new row has next word in column 1 */        i++;    }    return i;}