diff --git a/include/strings.cpp b/include/strings.cpp index c4d7c0b8b..b19125f5b 100755 --- a/include/strings.cpp +++ b/include/strings.cpp @@ -1418,6 +1418,7 @@ const TString& TParagraph_string::operator =(const char* s) void TParagraph_string::tokenize() { + int last_space = 0, last_start = 0; int num_chars = 0; const int l = len(); @@ -1432,7 +1433,7 @@ void TParagraph_string::tokenize() default : num_chars++; break; } - if (num_chars == _width) + if (num_chars == _width && (start < l-1)) { int num_of_chars_in_row = (last_space+1) - last_start; if (num_of_chars_in_row <= 0) num_of_chars_in_row = _width; // Se non ci sono spazi tronca la stringa a 25 @@ -1445,6 +1446,10 @@ void TParagraph_string::tokenize() } start++; } + swork=sstr.mid(last_start,l-last_start); + swork.trim(); + stmp << swork; + if (stmp.empty()) stmp = sstr; TToken_string::operator=(stmp); }