This should close sf #2850092.
Basically, before this change, for strings which includes
SECRIT_MULTILINE_CHAR the computed maximum substring width was getting
summed to the width of the last substring.
The old behaviour is kept but for the case of strings including
SECRIT_MULTILINE_CHAR, for which now the maximum width of all substrings
is taken.
I don't think this will break anything else but blame me if it does ...
(cherry picked from commit
72bbe51a8c323702db76094e27266e67cc1ba5b5)
static int text_size_updater(char *s, int special_index)
{
int w = 0;
+ int lw;
+ int contain_SECRIT_MULTILINE_CHAR = 0;
char *p;
if ((output_methods & TO_X) == 0)
special_index++;
s = p + 1;
} else if (*p == SECRIT_MULTILINE_CHAR) {
- int lw;
+ contain_SECRIT_MULTILINE_CHAR = 1;
*p = '\0';
lw = get_string_width(s);
*p = SECRIT_MULTILINE_CHAR;
}
p++;
}
- w += get_string_width(s);
+ /* Check also last substring if string contains SECRIT_MULTILINE_CHAR */
+ if (contain_SECRIT_MULTILINE_CHAR) {
+ lw = get_string_width(s);
+ w = lw > w ? lw : w;
+ } else {
+ w += get_string_width(s);
+ }
if (w > text_width) {
text_width = w;
}