/* 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, 1 | PARAM_FLAG_OPTIONS, "clear", &optlist, &refnum)) return; 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); }
/* Remove all lines from buffer. */ void textbuffer_view_remove_all_lines(TEXT_BUFFER_VIEW_REC *view) { g_return_if_fail(view != NULL); textbuffer_remove_all_lines(view->buffer); g_hash_table_foreach_remove(view->bookmarks, (GHRFunc) g_free_true, NULL); view_reset_cache(view); textbuffer_view_clear(view); g_slist_foreach(view->siblings, (GFunc) textbuffer_view_clear, NULL); }