From b24243e45af87455b2fdfdfba545e06871aefca9 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 31 Jan 2001 20:11:47 +0000 Subject: [PATCH] /SB STATUS: for debugging mostly, displays number of lines and used kBs of memory per window and totally git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1173 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/gui-textwidget.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/fe-text/gui-textwidget.c b/src/fe-text/gui-textwidget.c index ac8470d4..0e58a47d 100644 --- a/src/fe-text/gui-textwidget.c +++ b/src/fe-text/gui-textwidget.c @@ -437,6 +437,30 @@ static void cmd_scrollback_redraw(void) screen_refresh_thaw(); } +static void cmd_scrollback_status(void) +{ + GSList *tmp; + int window_kb, total_lines, total_kb; + + total_lines = 0; total_kb = 0; + for (tmp = windows; tmp != NULL; tmp = tmp->next) { + WINDOW_REC *window = tmp->data; + GUI_WINDOW_REC *gui = WINDOW_GUI(window); + + window_kb = g_slist_length(gui->text_chunks)* + LINE_TEXT_CHUNK_SIZE/1024; + total_lines += window->lines; + total_kb += window_kb; + printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP, + "Window %d: %d lines, %dkB of data", + window->refnum, window->lines, window_kb); + } + + printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP, + "Total: %d lines, %dkB of data", + total_lines, total_kb); +} + static void sig_away_changed(IRC_SERVER_REC *server) { GSList *tmp; @@ -461,6 +485,7 @@ void gui_textwidget_init(void) command_bind("scrollback home", NULL, (SIGNAL_FUNC) cmd_scrollback_home); command_bind("scrollback end", NULL, (SIGNAL_FUNC) cmd_scrollback_end); command_bind("scrollback redraw", NULL, (SIGNAL_FUNC) cmd_scrollback_redraw); + command_bind("scrollback status", NULL, (SIGNAL_FUNC) cmd_scrollback_status); command_set_options("lastlog", "!- new away word regexp"); signal_add("away mode changed", (SIGNAL_FUNC) sig_away_changed); @@ -475,6 +500,7 @@ void gui_textwidget_deinit(void) command_unbind("scrollback home", (SIGNAL_FUNC) cmd_scrollback_home); command_unbind("scrollback end", (SIGNAL_FUNC) cmd_scrollback_end); command_unbind("scrollback redraw", (SIGNAL_FUNC) cmd_scrollback_redraw); + command_unbind("scrollback status", (SIGNAL_FUNC) cmd_scrollback_status); signal_remove("away mode changed", (SIGNAL_FUNC) sig_away_changed); }