1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

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
This commit is contained in:
Timo Sirainen 2001-03-04 03:35:12 +00:00 committed by cras
parent cf376ba806
commit a1842e6baa

View File

@ -34,6 +34,7 @@ void statusbar_items_deinit(void);
static GSList *statusbars; static GSList *statusbars;
static int sbar_uppest, sbar_lowest, sbars_up, sbars_down; static int sbar_uppest, sbar_lowest, sbars_up, sbars_down;
static int item_max_size;
static void statusbar_item_destroy(SBAR_ITEM_REC *rec) static void statusbar_item_destroy(SBAR_ITEM_REC *rec)
{ {
@ -66,6 +67,7 @@ static void statusbar_redraw_line(STATUSBAR_REC *bar)
if (rec->shrinked) if (rec->shrinked)
rec->size = COLS-1-xpos; rec->size = COLS-1-xpos;
item_max_size = COLS-1-xpos;
func = (STATUSBAR_FUNC) rec->func; func = (STATUSBAR_FUNC) rec->func;
func(rec, bar->ypos); func(rec, bar->ypos);
@ -81,6 +83,7 @@ static void statusbar_redraw_line(STATUSBAR_REC *bar)
if (rec->right_justify && rxpos-rec->size > xpos) { if (rec->right_justify && rxpos-rec->size > xpos) {
rec->xpos = rxpos-rec->size; rec->xpos = rxpos-rec->size;
item_max_size = rxpos-xpos;
func = (STATUSBAR_FUNC) rec->func; func = (STATUSBAR_FUNC) rec->func;
func(rec, bar->ypos); func(rec, bar->ypos);
@ -232,8 +235,10 @@ void statusbar_item_resize(SBAR_ITEM_REC *item, int size)
{ {
g_return_if_fail(item != NULL); g_return_if_fail(item != NULL);
if (size <= item_max_size) {
item->size = size; item->size = size;
statusbar_redraw_all(); statusbar_redraw_all();
}
} }
void statusbar_item_remove(SBAR_ITEM_REC *item) void statusbar_item_remove(SBAR_ITEM_REC *item)