summaryrefslogtreecommitdiff
path: root/src/fe-text/statusbar-items.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-01-31 11:23:29 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-01-31 11:23:29 +0000
commit2a31ecaa32439f440d8a5cce81b9809b61658e3b (patch)
tree6582e5409d9861f43aeac0468bd4f1303b7ff24c /src/fe-text/statusbar-items.c
parent8acf2cd5f97906877107b6a547bc939d134beaa2 (diff)
downloadirssi-2a31ecaa32439f440d8a5cce81b9809b61658e3b.zip
Ugly quick hack to make act: never disappear but print as much activity
to statusbar as fits. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1172 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/statusbar-items.c')
-rw-r--r--src/fe-text/statusbar-items.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index 7b3294be..8243a9ac 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -314,7 +314,7 @@ static void sig_statusbar_channel_redraw_window_item(WI_ITEM_REC *item)
statusbar_item_redraw(channel_item);
}
-static void draw_activity(gchar *title, gboolean act, gboolean det)
+static void draw_activity(gchar *title, gboolean act, gboolean det, int size)
{
WINDOW_REC *window;
GList *tmp;
@@ -324,7 +324,7 @@ static void draw_activity(gchar *title, gboolean act, gboolean det)
set_color(stdscr, sbar_color_normal); addstr(title);
first = TRUE;
- for (tmp = activity_list; tmp != NULL; tmp = tmp->next)
+ for (tmp = activity_list; tmp != NULL && size > 0; tmp = tmp->next)
{
window = tmp->data;
@@ -338,6 +338,7 @@ static void draw_activity(gchar *title, gboolean act, gboolean det)
{
set_color(stdscr, sbar_color_dim);
addch(',');
+ size--;
}
ltoa(str, window->refnum);
@@ -358,11 +359,17 @@ static void draw_activity(gchar *title, gboolean act, gboolean det)
set_color(stdscr, sbar_color_act_highlight);
break;
}
+ if (strlen(str) > size)
+ break;
+
+ size -= strlen(str);
addstr(str);
}
}
-/* redraw activity */
+/* redraw activity, FIXME: if we didn't get enough size, this gets buggy.
+ At least "Det:" isn't printed properly. also we should rearrange the
+ act list so that the highest priority items comes first. */
static void statusbar_activity(SBAR_ITEM_REC *item, int ypos)
{
WINDOW_REC *window;
@@ -388,21 +395,21 @@ static void statusbar_activity(SBAR_ITEM_REC *item, int ypos)
if (det) size_needed += 6; /* [Det: ], -1 */
if (act && det) size_needed--;
- if (item->size != size_needed)
+ if (!item->shrinked && item->size != size_needed)
{
/* we need more (or less..) space! */
statusbar_item_resize(item, size_needed);
return;
}
- if (item->size == 0)
+ if (item->size <= 7)
return;
move(ypos, item->xpos);
set_color(stdscr, sbar_color_dim); addch('[');
- if (act) draw_activity("Act: ", TRUE, !det);
+ if (act) draw_activity("Act: ", TRUE, !det, item->size-1);
if (act && det) addch(' ');
- if (det) draw_activity("Det: ", FALSE, TRUE);
+ if (det) draw_activity("Det: ", FALSE, TRUE, item->size-1);
set_color(stdscr, sbar_color_dim); addch(']');
screen_refresh(NULL);