mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
/CLEAR <refnum> now clears specified window.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2633 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
753f3666aa
commit
650292613e
@ -31,28 +31,35 @@
|
|||||||
#include "gui-windows.h"
|
#include "gui-windows.h"
|
||||||
#include "textbuffer-reformat.h"
|
#include "textbuffer-reformat.h"
|
||||||
|
|
||||||
/* SYNTAX: CLEAR */
|
/* SYNTAX: CLEAR [-all] [<refnum>] */
|
||||||
static void cmd_clear(const char *data)
|
static void cmd_clear(const char *data)
|
||||||
{
|
{
|
||||||
|
WINDOW_REC *window;
|
||||||
GHashTable *optlist;
|
GHashTable *optlist;
|
||||||
|
char *refnum;
|
||||||
void *free_arg;
|
void *free_arg;
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
|
|
||||||
g_return_if_fail(data != NULL);
|
g_return_if_fail(data != NULL);
|
||||||
|
|
||||||
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_OPTIONS,
|
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
|
||||||
"clear", &optlist)) return;
|
"clear", &optlist, &refnum)) return;
|
||||||
|
|
||||||
if (g_hash_table_lookup(optlist, "all") == NULL) {
|
if (g_hash_table_lookup(optlist, "all") != NULL) {
|
||||||
/* clear active window */
|
|
||||||
textbuffer_view_clear(WINDOW_GUI(active_win)->view);
|
|
||||||
} else {
|
|
||||||
/* clear all windows */
|
/* clear all windows */
|
||||||
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
||||||
WINDOW_REC *window = tmp->data;
|
WINDOW_REC *window = tmp->data;
|
||||||
|
|
||||||
textbuffer_view_clear(WINDOW_GUI(window)->view);
|
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);
|
cmd_params_free(free_arg);
|
||||||
|
Loading…
Reference in New Issue
Block a user