mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
Ticket #2841: adjust i18n label sizes in learn key dialog.
Learn keys dialogue shows "smaller buttons" when localized key names include special chars (as the "á" in "Avanzar página" for es_ES locale). "%Ns" formats for g_snprintf are not reliable for multibyte encodings. For larger buttons (> 16 characters), padding size must be zero. Thanks David Martin for the original patch. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
f25feaab1f
commit
368e250102
@ -296,10 +296,17 @@ init_learn (void)
|
||||
for (i = 0; i < learn_total; i++)
|
||||
{
|
||||
char buffer[BUF_TINY];
|
||||
char *label;
|
||||
int padding;
|
||||
|
||||
learnkeys[i].ok = FALSE;
|
||||
learnkeys[i].sequence = NULL;
|
||||
g_snprintf (buffer, sizeof (buffer), "%-16s", _(key_name_conv_tab[i].longname));
|
||||
|
||||
label = _(key_name_conv_tab[i].longname);
|
||||
padding = 16 - str_term_width1 (label);
|
||||
padding = max (0, padding);
|
||||
g_snprintf (buffer, sizeof (buffer), "%s%*s", label, padding, "");
|
||||
|
||||
learnkeys[i].button =
|
||||
WIDGET (button_new (y, x, B_USER + i, NARROW_BUTTON, buffer, learn_button));
|
||||
learnkeys[i].label = WIDGET (label_new (y, x + 19, ""));
|
||||
|
Loading…
Reference in New Issue
Block a user