It looks like me code had a bug. See my change below. Also, the first call to gotoXY the parameter y equals -1 is that a bug?
char* maxline(char* p, uint8_t max_width) { //(NOT) make a string that is one line long -----------
for (uint8_t w = lengte[*p - 0x20]; *p && w < max_width; p++)
w += lengte[*p - 0x20]+1; // should the +1 be here?
return p;
}