summaryrefslogtreecommitdiff
path: root/src/fe-text
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-05-13 16:05:30 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-05-13 16:05:30 +0000
commit9a435e68f9fb681e297257063a2d7aca6b6665c7 (patch)
tree2a7d78818a0356d19824df626c0e6efd079964c0 /src/fe-text
parent9d9ac40cad461060e91b78f7657fddd38a1e6ae1 (diff)
downloadirssi-9a435e68f9fb681e297257063a2d7aca6b6665c7.zip
make sure the statusbar item fills the space it's given, so it won't corrupt
the statusbar. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2786 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text')
-rw-r--r--src/fe-text/statusbar.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c
index 5ad86998..ef620379 100644
--- a/src/fe-text/statusbar.c
+++ b/src/fe-text/statusbar.c
@@ -731,6 +731,22 @@ void statusbar_item_default_handler(SBAR_ITEM_REC *item, int get_size_only,
/* they're forcing us smaller than minimum size.. */
len = format_real_length(tmpstr, item->size);
tmpstr[len] = '\0';
+ } else {
+ /* make sure the str is big enough to fill the
+ requested size, so it won't corrupt screen */
+ len = format_get_length(tmpstr);
+ if (len < item->size) {
+ char *fill;
+
+ len = item->size-len;
+ fill = g_malloc(len + 1);
+ memset(fill, ' ', len); fill[len] = '\0';
+
+ tmpstr2 = g_strconcat(tmpstr, fill, NULL);
+ g_free(fill);
+ g_free(tmpstr);
+ tmpstr = tmpstr2;
+ }
}
tmpstr2 = update_statusbar_bg(tmpstr, item->bar->color);