summaryrefslogtreecommitdiff
path: root/src/fe-text
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-03-04 03:52:17 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-03-04 03:52:17 +0000
commit24e36e008111337c12a50aae0c8614947520d828 (patch)
treee5a0bbc47fe81dc17fb8c373e9e40a84ba2a5138 /src/fe-text
parenta1842e6baa56e1dda9729458f537236485348388 (diff)
downloadirssi-24e36e008111337c12a50aae0c8614947520d828.zip
More statusbar size fixes. Shouldn't corrupt entry line anymore.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1343 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text')
-rw-r--r--src/fe-text/statusbar-items.c8
-rw-r--r--src/fe-text/statusbar.c17
-rw-r--r--src/fe-text/statusbar.h2
3 files changed, 16 insertions, 11 deletions
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index 7d0c092e..554ac129 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -403,8 +403,8 @@ static void statusbar_activity(SBAR_ITEM_REC *item, int ypos)
if (!item->shrinked && item->size != size_needed)
{
/* we need more (or less..) space! */
- statusbar_item_resize(item, size_needed);
- return;
+ if (statusbar_item_resize(item, size_needed))
+ return;
}
if (item->size <= 7)
@@ -412,9 +412,9 @@ static void statusbar_activity(SBAR_ITEM_REC *item, int ypos)
move(ypos, item->xpos);
set_color(stdscr, sbar_color_dim); addch('[');
- if (act) draw_activity("Act: ", TRUE, !det, item->size-1);
+ if (act) draw_activity("Act: ", TRUE, !det, item->size-7);
if (act && det) addch(' ');
- if (det) draw_activity("Det: ", FALSE, TRUE, item->size-1);
+ if (det) draw_activity("Det: ", FALSE, TRUE, item->size-7);
set_color(stdscr, sbar_color_dim); addch(']');
screen_refresh(NULL);
diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c
index 99c739ea..25cdd910 100644
--- a/src/fe-text/statusbar.c
+++ b/src/fe-text/statusbar.c
@@ -231,14 +231,19 @@ SBAR_ITEM_REC *statusbar_item_create(STATUSBAR_REC *bar, int size, int right_jus
return rec;
}
-void statusbar_item_resize(SBAR_ITEM_REC *item, int size)
+int statusbar_item_resize(SBAR_ITEM_REC *item, int size)
{
- g_return_if_fail(item != NULL);
+ g_return_val_if_fail(item != NULL, FALSE);
- if (size <= item_max_size) {
- item->size = size;
- statusbar_redraw_all();
- }
+ if (item->size >= item_max_size)
+ return FALSE;
+
+ if (size > item_max_size)
+ size = item_max_size;
+
+ item->size = size;
+ statusbar_redraw_all();
+ return TRUE;
}
void statusbar_item_remove(SBAR_ITEM_REC *item)
diff --git a/src/fe-text/statusbar.h b/src/fe-text/statusbar.h
index d49984fa..cfca8414 100644
--- a/src/fe-text/statusbar.h
+++ b/src/fe-text/statusbar.h
@@ -33,7 +33,7 @@ void statusbar_destroy(STATUSBAR_REC *bar);
STATUSBAR_REC *statusbar_find(int pos, int line);
SBAR_ITEM_REC *statusbar_item_create(STATUSBAR_REC *bar, int size, gboolean right_justify, STATUSBAR_FUNC func);
-void statusbar_item_resize(SBAR_ITEM_REC *item, int size);
+int statusbar_item_resize(SBAR_ITEM_REC *item, int size);
void statusbar_item_remove(SBAR_ITEM_REC *item);
/* redraw statusbar, NULL = all */