diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 2000-10-07 18:06:24 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 2000-10-07 18:06:24 +0000 |
commit | a080fd35226893ed18194ffb77d2190d17ee38e4 (patch) | |
tree | cd23c840bc1cdcc7fb7046689db690bc274cd719 /help.c | |
parent | fe7d2cb2e0f9817ce1b03a6f860b48cbc967aa43 (diff) |
Display fixes from EGE.
Diffstat (limited to 'help.c')
-rw-r--r-- | help.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -95,11 +95,15 @@ static int print_macro (FILE *f, int maxwidth, const char **macro) memset (&mbstate1, 0, sizeof (mbstate1)); memset (&mbstate2, 0, sizeof (mbstate2)); - for (; (k = mbrtowc (&wc, *macro, len, &mbstate1)); *macro += k, len -= k) + for (; len && (k = mbrtowc (&wc, *macro, len, &mbstate1)); *macro += k, len -= k) { if (k == (size_t)(-1) || k == (size_t)(-2)) - break; - if ((w = wcwidth (wc)) >= 0) + { + k = (k == (size_t)(-1)) ? 1 : len; + wc = replacement_char (); + } + /* glibc-2.1.3's wcwidth() returns 1 for unprintable chars! */ + if (IsWPrint (wc) && (w = wcwidth (wc)) >= 0) { if (w > n) break; |