diff --git a/src/command/command.c b/src/command/command.c index 4324c7f5..c63a2cb3 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -99,6 +99,7 @@ static gboolean _cmd_sub(gchar **args, struct cmd_help_t help); static gboolean _cmd_msg(gchar **args, struct cmd_help_t help); static gboolean _cmd_tiny(gchar **args, struct cmd_help_t help); static gboolean _cmd_close(gchar **args, struct cmd_help_t help); +static gboolean _cmd_clear(gchar **args, struct cmd_help_t help); static gboolean _cmd_join(gchar **args, struct cmd_help_t help); static gboolean _cmd_set_beep(gchar **args, struct cmd_help_t help); static gboolean _cmd_set_notify(gchar **args, struct cmd_help_t help); @@ -393,6 +394,14 @@ static struct cmd_t main_commands[] = "If in a chat room, you will leave the room.", NULL } } }, + { "/clear", + _cmd_clear, parse_args, 0, 0, + { "/clear", "Clear current window.", + { "/clear", + "------", + "Clear the current window.", + NULL } } }, + { "/quit", _cmd_quit, parse_args, 0, 0, { "/quit", "Quit Profanity.", @@ -2100,6 +2109,13 @@ _cmd_tiny(gchar **args, struct cmd_help_t help) return TRUE; } +static gboolean +_cmd_clear(gchar **args, struct cmd_help_t help) +{ + win_current_clear(); + return TRUE; +} + static gboolean _cmd_close(gchar **args, struct cmd_help_t help) { diff --git a/src/ui/ui.h b/src/ui/ui.h index 11c32b8f..3752fbd7 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -99,6 +99,7 @@ void title_bar_draw(void); // current window actions void win_current_close(void); +void win_current_clear(void); int win_current_is_console(void); int win_current_is_chat(void); int win_current_is_groupchat(void); diff --git a/src/ui/windows.c b/src/ui/windows.c index 4e5bf461..2ed2e902 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -550,6 +550,13 @@ ui_switch_win(const int i) dirty = TRUE; } +void +win_current_clear(void) +{ + wclear(current->win); + dirty = TRUE; +} + void win_current_close(void) {