while (len && (k = mbrtowc (&wc, s, len, &mbstate)))
for (; len && (k = mbrtowc (&wc, s, len, &mbstate)); s += k, len -= k)
void mutt_paddstr (int n, const char *s){  wchar_t wc;  int w;  size_t k;  size_t len = mutt_strlen (s);  mbstate_t mbstate;  memset (&mbstate, 0, sizeof (mbstate));  while (len && (k = mbrtowc (&wc, s, len, &mbstate)))  {    if (k == (size_t)(-1) || k == (size_t)(-2))    {      ++s, --len; /* skip ill-formed character */      continue;    }    if ((w = wcwidth (wc)) >= 0)    {      if (w > n)	break;      addnstr ((char *)s, k);      n -= w;    }    s += k, len -= k;  }  while (n-- > 0)    addch (' ');}