From 7fe4345d0deb33a464b0c08c08ef36b35c94536e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Tue, 28 May 2013 09:21:02 +0200 Subject: [PATCH] cli: print_required_fields() - fix non-ASCII strings alignment in multiline --- cli/src/utils.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cli/src/utils.c b/cli/src/utils.c index f311f4348..6c20bf5a3 100644 --- a/cli/src/utils.c +++ b/cli/src/utils.c @@ -697,7 +697,10 @@ print_required_fields (NmCli *nmc, const NmcOutputField field_values[]) section_prefix ? "." : "", _(field_values[idx].name_l10n), j); - printf ("%-*s%s\n", terse ? 0 : ML_VALUE_INDENT, tmp, *p ? *p : not_set_str); + width1 = strlen (tmp); + width2 = nmc_string_screen_width (tmp, NULL); + printf ("%-*s%s\n", terse ? 0 : ML_VALUE_INDENT+width1-width2, tmp, + *p ? *p : not_set_str); g_free (tmp); } } else { @@ -709,7 +712,10 @@ print_required_fields (NmCli *nmc, const NmcOutputField field_values[]) section_prefix ? hdr_name : "", section_prefix ? "." : "", _(field_values[idx].name_l10n)); - printf ("%-*s%s\n", terse ? 0 : ML_VALUE_INDENT, tmp, val ? val : not_set_str); + width1 = strlen (tmp); + width2 = nmc_string_screen_width (tmp, NULL); + printf ("%-*s%s\n", terse ? 0 : ML_VALUE_INDENT+width1-width2, tmp, + val ? val : not_set_str); g_free (tmp); } }