diff options
author | Timo Sirainen <cras@irssi.org> | 2002-03-19 17:24:28 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-03-19 17:24:28 +0000 |
commit | 650292613e4ff635d1746b2790db8b787e9f109b (patch) | |
tree | 9eca11bc38692d439322f0e0cd9199f6fabdbce9 /src/fe-text | |
parent | 753f3666aaaa00f6fee041819943a0f60ffd0560 (diff) | |
download | irssi-650292613e4ff635d1746b2790db8b787e9f109b.zip |
/CLEAR <refnum> now clears specified window.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2633 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text')
-rw-r--r-- | src/fe-text/textbuffer-commands.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/fe-text/textbuffer-commands.c b/src/fe-text/textbuffer-commands.c index db5bc782..61350a3e 100644 --- a/src/fe-text/textbuffer-commands.c +++ b/src/fe-text/textbuffer-commands.c @@ -31,28 +31,35 @@ #include "gui-windows.h" #include "textbuffer-reformat.h" -/* SYNTAX: CLEAR */ +/* SYNTAX: CLEAR [-all] [<refnum>] */ static void cmd_clear(const char *data) { + WINDOW_REC *window; GHashTable *optlist; + char *refnum; void *free_arg; GSList *tmp; g_return_if_fail(data != NULL); - if (!cmd_get_params(data, &free_arg, PARAM_FLAG_OPTIONS, - "clear", &optlist)) return; + if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS, + "clear", &optlist, &refnum)) return; - if (g_hash_table_lookup(optlist, "all") == NULL) { - /* clear active window */ - textbuffer_view_clear(WINDOW_GUI(active_win)->view); - } else { + if (g_hash_table_lookup(optlist, "all") != NULL) { /* clear all windows */ for (tmp = windows; tmp != NULL; tmp = tmp->next) { WINDOW_REC *window = tmp->data; textbuffer_view_clear(WINDOW_GUI(window)->view); } + } else if (*refnum != '\0') { + /* clear specified window */ + window = window_find_refnum(atoi(refnum)); + if (window != NULL) + textbuffer_view_clear(WINDOW_GUI(window)->view); + } else { + /* clear active window */ + textbuffer_view_clear(WINDOW_GUI(active_win)->view); } cmd_params_free(free_arg); |