tooltip: Don't play games with max-width-chars

Setting max-width-chars to the number of characters
in the string works ok only as long as the average
char width we get from Pango matches reality. Sadly
that seems not always the case, and this code was
causing short Chinese tooltips to always be broken
into two lines.

Fixes: #4470
This commit is contained in:
Matthias Clasen
2023-01-28 10:30:04 -05:00
parent 56c1c4152f
commit 4b6a9d2fb5

View File

@@ -413,11 +413,7 @@ update_label_width (GtkLabel *label)
}
else
{
int len;
len = g_utf8_strlen (text, -1);
gtk_label_set_max_width_chars (label, MIN (len, 50));
gtk_label_set_max_width_chars (label, 50);
gtk_label_set_wrap (label, TRUE);
}
}