1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

/CLEAR -all - clear all windows.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@961 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-12-04 20:36:00 +00:00 committed by cras
parent e18d43cef7
commit e81fdd7307

View File

@ -434,7 +434,7 @@ static void gui_printtext(WINDOW_REC *window, void *fgcolor, void *bgcolor,
gui->last_subline += new_lines; gui->last_subline += new_lines;
} }
static void window_clear(GUI_WINDOW_REC *gui) static void window_clear_screen(GUI_WINDOW_REC *gui)
{ {
#ifdef USE_CURSES_WINDOWS #ifdef USE_CURSES_WINDOWS
wclear(gui->parent->curses_win); wclear(gui->parent->curses_win);
@ -450,15 +450,12 @@ static void window_clear(GUI_WINDOW_REC *gui)
#endif #endif
} }
/* SYNTAX: CLEAR */ static void window_clear(WINDOW_REC *window)
static void cmd_clear(void)
{ {
GUI_WINDOW_REC *gui; GUI_WINDOW_REC *gui = WINDOW_GUI(window);
gui = WINDOW_GUI(active_win); if (is_window_visible(window))
window_clear_screen(gui);
if (is_window_visible(active_win))
window_clear(gui);
gui->ypos = -1; gui->ypos = -1;
gui->bottom_startline = gui->startline = g_list_last(gui->lines); gui->bottom_startline = gui->startline = g_list_last(gui->lines);
@ -467,6 +464,25 @@ static void cmd_clear(void)
gui->bottom = TRUE; gui->bottom = TRUE;
} }
/* SYNTAX: CLEAR */
static void cmd_clear(const char *data)
{
GHashTable *optlist;
void *free_arg;
g_return_if_fail(data != NULL);
if (!cmd_get_params(data, &free_arg, PARAM_FLAG_OPTIONS,
"clear", &optlist)) return;
if (g_hash_table_lookup(optlist, "all") != NULL)
g_slist_foreach(windows, (GFunc) window_clear, NULL);
else
window_clear(active_win);
cmd_params_free(free_arg);
}
static void sig_printtext_finished(WINDOW_REC *window) static void sig_printtext_finished(WINDOW_REC *window)
{ {
GUI_WINDOW_REC *gui; GUI_WINDOW_REC *gui;
@ -548,6 +564,7 @@ void gui_printtext_init(void)
signal_add("print format", (SIGNAL_FUNC) sig_print_format); signal_add("print format", (SIGNAL_FUNC) sig_print_format);
signal_add("setup changed", (SIGNAL_FUNC) read_settings); signal_add("setup changed", (SIGNAL_FUNC) read_settings);
command_bind("clear", NULL, (SIGNAL_FUNC) cmd_clear); command_bind("clear", NULL, (SIGNAL_FUNC) cmd_clear);
command_set_options("clear", "all");
read_settings(); read_settings();
} }