From a1842e6baa56e1dda9729458f537236485348388 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 4 Mar 2001 03:35:12 +0000 Subject: [PATCH] Statusbar could have gotten to endless loop trying to grow size of some item when there was no space left. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1342 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/statusbar.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c index 775bc87a..99c739ea 100644 --- a/src/fe-text/statusbar.c +++ b/src/fe-text/statusbar.c @@ -34,6 +34,7 @@ void statusbar_items_deinit(void); static GSList *statusbars; static int sbar_uppest, sbar_lowest, sbars_up, sbars_down; +static int item_max_size; static void statusbar_item_destroy(SBAR_ITEM_REC *rec) { @@ -66,6 +67,7 @@ static void statusbar_redraw_line(STATUSBAR_REC *bar) if (rec->shrinked) rec->size = COLS-1-xpos; + item_max_size = COLS-1-xpos; func = (STATUSBAR_FUNC) rec->func; func(rec, bar->ypos); @@ -81,6 +83,7 @@ static void statusbar_redraw_line(STATUSBAR_REC *bar) if (rec->right_justify && rxpos-rec->size > xpos) { rec->xpos = rxpos-rec->size; + item_max_size = rxpos-xpos; func = (STATUSBAR_FUNC) rec->func; func(rec, bar->ypos); @@ -232,8 +235,10 @@ void statusbar_item_resize(SBAR_ITEM_REC *item, int size) { g_return_if_fail(item != NULL); - item->size = size; - statusbar_redraw_all(); + if (size <= item_max_size) { + item->size = size; + statusbar_redraw_all(); + } } void statusbar_item_remove(SBAR_ITEM_REC *item)