From: Eric Davis Date: Sun, 31 Jan 2016 00:23:22 +0000 (+0000) Subject: fix width calculation X-Git-Tag: neomutt-20160404~18^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a9886f62242e00ad994470c04c8cf3c60e42bdb;p=neomutt fix width calculation fixed right alignment on the index line the printed string width computation did not account for special index coloring sequences --- diff --git a/curs_lib.c b/curs_lib.c index 9e860b813..51fcd78f1 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -1041,6 +1041,13 @@ int mutt_strwidth (const char *s) memset (&mbstate, 0, sizeof (mbstate)); for (w=0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) { + if (*s == M_SPECIAL_INDEX) + { + s += 2; /* skip the index coloring sequence */ + k = 0; + continue; + } + if (k == (size_t)(-1) || k == (size_t)(-2)) { k = (k == (size_t)(-1)) ? 1 : n;