patches by Rostislav Beneš: mc-18-option

Correctly calculate length of utf-8 strings.
This commit is contained in:
Slava Zanko 2008-12-29 01:05:35 +02:00
parent 511fddabb9
commit eaa2fd4e20

View File

@ -35,6 +35,7 @@
#include "setup.h" /* For save_setup() */
#include "main.h"
#include "profile.h" /* For sync_profiles */
#include "strutil.h"
#include "panel.h" /* Needed for the externs */
#include "file.h" /* safe_delete */
@ -124,12 +125,12 @@ init_configure (void)
title2 = _(" Pause after run... ");
title3 = _(" Other options ");
first_width = strlen (title1) + 1;
second_width = strlen (title3) + 1;
first_width = str_term_width1 (title1) + 1;
second_width = str_term_width1 (title3) + 1;
for (i = 0; check_options[i].text; i++) {
check_options[i].text = _(check_options[i].text);
l1 = strlen (check_options[i].text) + 7;
l1 = str_term_width1 (check_options[i].text) + 7;
if (i >= OTHER_OPTIONS) {
if (l1 > first_width)
first_width = l1;
@ -142,23 +143,23 @@ init_configure (void)
i = PAUSE_OPTIONS;
while (i--) {
pause_options[i] = _(pause_options[i]);
l1 = strlen (pause_options[i]) + 7;
l1 = str_term_width1 (pause_options[i]) + 7;
if (l1 > first_width)
first_width = l1;
}
l1 = strlen (title2) + 1;
l1 = str_term_width1 (title2) + 1;
if (l1 > first_width)
first_width = l1;
l1 = 11 + strlen (ok_button)
+ strlen (save_button)
+ strlen (cancel_button);
l1 = 11 + str_term_width1 (ok_button)
+ str_term_width1 (save_button)
+ str_term_width1 (cancel_button);
i = (first_width + second_width - l1) / 4;
b1 = 5 + i;
b2 = b1 + strlen (ok_button) + i + 6;
b3 = b2 + strlen (save_button) + i + 4;
b2 = b1 + str_term_width1 (ok_button) + i + 6;
b3 = b2 + str_term_width1 (save_button) + i + 4;
i18n_config_flag = 1;
}