Corretta TParagraph_string::tokenize().

git-svn-id: svn://10.65.10.50/trunk@3924 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1996-11-23 10:36:33 +00:00
parent 59431cf055
commit 5df598f64f

View File

@ -1418,6 +1418,7 @@ const TString& TParagraph_string::operator =(const char* s)
void TParagraph_string::tokenize() void TParagraph_string::tokenize()
{ {
int last_space = 0, last_start = 0; int last_space = 0, last_start = 0;
int num_chars = 0; int num_chars = 0;
const int l = len(); const int l = len();
@ -1432,7 +1433,7 @@ void TParagraph_string::tokenize()
default : num_chars++; break; 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; 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 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++; start++;
} }
swork=sstr.mid(last_start,l-last_start);
swork.trim();
stmp << swork;
if (stmp.empty()) stmp = sstr;
TToken_string::operator=(stmp); TToken_string::operator=(stmp);
} }