diff options
Diffstat (limited to 'src/pacman/package.c')
-rw-r--r-- | src/pacman/package.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/pacman/package.c b/src/pacman/package.c index cc4be139..7019e7e6 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -24,6 +24,7 @@ #include <string.h> #include <limits.h> #include <sys/stat.h> +#include <wchar.h> #include <alpm.h> #include <alpm_list.h> @@ -48,6 +49,8 @@ void dump_pkg_full(pmpkg_t *pkg, int level) char bdatestr[50] = "", idatestr[50] = ""; const alpm_list_t *i; alpm_list_t *requiredby = NULL, *depstrings = NULL; + wchar_t *wcstr; + int len; if(pkg == NULL) { return; @@ -86,8 +89,6 @@ void dump_pkg_full(pmpkg_t *pkg, int level) requiredby = alpm_pkg_compute_requiredby(pkg); } - descheader = _("Description : "); - /* actual output */ if(level == 0) { string_display(_("Filename :"), alpm_pkg_get_filename(pkg)); @@ -136,8 +137,16 @@ void dump_pkg_full(pmpkg_t *pkg, int level) } /* printed using a variable to make i18n safe */ + descheader = _("Description : "); + /* len goes from # bytes -> # chars -> # cols */ + len = strlen(descheader) + 1; + wcstr = calloc(len, sizeof(wchar_t)); + len = mbstowcs(wcstr, descheader, len); + len = wcswidth(wcstr, len); + free(wcstr); + /* we can finally print the darn thing */ printf("%s", descheader); - indentprint(alpm_pkg_get_desc(pkg), mbstowcs(NULL, descheader, 0)); + indentprint(alpm_pkg_get_desc(pkg), len); printf("\n\n"); /* Print additional package info if info flag passed more than once */ |