Patch for utf8 strings issue

Hello.

This patch fixes a problem with utf8 strings. If the string was utf8
and utf8 wasn't enabled, the highlighted line would be longer than the
frame limits writing spaces over other elements on the screen.

Best regards

Nuno Cardoso

Index: utf8.c
===================================================================
--- utf8.c (revision 2236)
+++ utf8.c (working copy)
@@ -405,17 +405,24 @@
size_t strwidth (const char *s)
{
wchar_t *ucs;
+ char * no_utf8=NULL;
size_t size;
size_t width;

assert (s != NULL);

size = xmbstowcs (NULL, s, -1, NULL) + 1;
+ if (!using_utf8)
+ s = no_utf8 = iconv_str (iconv_desc, s);
+
ucs = (wchar_t *)xmalloc (sizeof(wchar_t) * size);
xmbstowcs (ucs, s, size, NULL);
width = wcswidth (ucs, WIDTH_MAX);
free (ucs);
+ if (no_utf8 != NULL)
+ free(no_utf8);

+
return width;
}