1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added /clear command to clear current window

This commit is contained in:
James Booth 2013-03-02 21:55:55 +00:00
parent 18b615c62f
commit be379afa5d
3 changed files with 24 additions and 0 deletions

View File

@ -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_msg(gchar **args, struct cmd_help_t help);
static gboolean _cmd_tiny(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_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_join(gchar **args, struct cmd_help_t help);
static gboolean _cmd_set_beep(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); 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.", "If in a chat room, you will leave the room.",
NULL } } }, NULL } } },
{ "/clear",
_cmd_clear, parse_args, 0, 0,
{ "/clear", "Clear current window.",
{ "/clear",
"------",
"Clear the current window.",
NULL } } },
{ "/quit", { "/quit",
_cmd_quit, parse_args, 0, 0, _cmd_quit, parse_args, 0, 0,
{ "/quit", "Quit Profanity.", { "/quit", "Quit Profanity.",
@ -2100,6 +2109,13 @@ _cmd_tiny(gchar **args, struct cmd_help_t help)
return TRUE; return TRUE;
} }
static gboolean
_cmd_clear(gchar **args, struct cmd_help_t help)
{
win_current_clear();
return TRUE;
}
static gboolean static gboolean
_cmd_close(gchar **args, struct cmd_help_t help) _cmd_close(gchar **args, struct cmd_help_t help)
{ {

View File

@ -99,6 +99,7 @@ void title_bar_draw(void);
// current window actions // current window actions
void win_current_close(void); void win_current_close(void);
void win_current_clear(void);
int win_current_is_console(void); int win_current_is_console(void);
int win_current_is_chat(void); int win_current_is_chat(void);
int win_current_is_groupchat(void); int win_current_is_groupchat(void);

View File

@ -550,6 +550,13 @@ ui_switch_win(const int i)
dirty = TRUE; dirty = TRUE;
} }
void
win_current_clear(void)
{
wclear(current->win);
dirty = TRUE;
}
void void
win_current_close(void) win_current_close(void)
{ {