For example, after entering 200 ds, the line will not be able to break.
I did some rough debugging and found that the problem is that the line break penalty value is set to HYPH_INVALID. If it is changed to HYPH_PANIC, this problem will not occur. I would like to ask whether this change is appropriate.
Taking code typesetting as an example, we only need to modify it like this to solve the problem of automatic line wrapping
array<int>
prog_language_rep::get_hyphens (string s) {
int i;
array<int> penalty (N (s) + 1);
penalty[0]= HYPH_INVALID;
int len = N (s);
for (i= 1; i < len; i++)
if (s[i - 1] == '-' && is_alpha (s[i])) penalty[i]= HYPH_STD;
else penalty[i]= HYPH_INVALID;
penalty[i]= HYPH_INVALID;
return penalty;
}
to:
array<int>
prog_language_rep::get_hyphens (string s) {
int i;
array<int> penalty (N (s) + 1);
penalty[0]= HYPH_PANIC;
int len = N (s);
for (i= 1; i < len; i++)
if (s[i - 1] == '-' && is_alpha (s[i])) penalty[i]= HYPH_STD;
else penalty[i]= HYPH_PANIC;
penalty[i]= HYPH_PANIC;
return penalty;
}