Fix format_real_length to return the correct length when the input string

includes a trailing wide char.
Change statusbar_item_default_handler to compute padding also when
item->size < item->min_size, needed after the fix to format_real_length.
Patch by Yi-Hsuan Hsin, bug #452.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4416 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2007-02-14 10:59:27 +00:00 committed by exg
commit c536d1f19c
2 changed files with 5 additions and 2 deletions

View file

@ -366,6 +366,7 @@ int format_real_length(const char *str, int len)
GString *tmp;
const char *start;
#ifdef HAVE_GLIB2
const char *oldstr;
gboolean utf8;
#endif
g_return_val_if_fail(str != NULL, 0);
@ -394,7 +395,10 @@ int format_real_length(const char *str, int len)
}
#ifdef HAVE_GLIB2
oldstr = str;
len -= advance(&str, utf8);
if (len < 0)
str = oldstr;
#else
len--;
str++;