summaryrefslogtreecommitdiff
path: root/src/fe-text
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-01-31 20:11:47 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-01-31 20:11:47 +0000
commitb24243e45af87455b2fdfdfba545e06871aefca9 (patch)
tree8e4aba1a3aa9c604859ffc4d327107f9f140c4ea /src/fe-text
parent2a31ecaa32439f440d8a5cce81b9809b61658e3b (diff)
downloadirssi-b24243e45af87455b2fdfdfba545e06871aefca9.zip
/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
Diffstat (limited to 'src/fe-text')
-rw-r--r--src/fe-text/gui-textwidget.c26
1 files changed, 26 insertions, 0 deletions
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);
}