1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00

The HAPPY NEW YEAR commit

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 72bbe51a8c)
This commit is contained in:
Cesare Tirabassi 2009-12-31 23:49:02 +01:00
parent 6ea81f0001
commit 9ba34190c7

View File

@ -2619,6 +2619,8 @@ static long current_color;
static int text_size_updater(char *s, int special_index) static int text_size_updater(char *s, int special_index)
{ {
int w = 0; int w = 0;
int lw;
int contain_SECRIT_MULTILINE_CHAR = 0;
char *p; char *p;
if ((output_methods & TO_X) == 0) if ((output_methods & TO_X) == 0)
@ -2667,7 +2669,7 @@ static int text_size_updater(char *s, int special_index)
special_index++; special_index++;
s = p + 1; s = p + 1;
} else if (*p == SECRIT_MULTILINE_CHAR) { } else if (*p == SECRIT_MULTILINE_CHAR) {
int lw; contain_SECRIT_MULTILINE_CHAR = 1;
*p = '\0'; *p = '\0';
lw = get_string_width(s); lw = get_string_width(s);
*p = SECRIT_MULTILINE_CHAR; *p = SECRIT_MULTILINE_CHAR;
@ -2677,7 +2679,13 @@ static int text_size_updater(char *s, int special_index)
} }
p++; 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) { if (w > text_width) {
text_width = w; text_width = w;
} }