option to clear the history

This commit is contained in:
ailin-nemui 2015-12-15 01:52:44 +01:00
commit e4e040929b
5 changed files with 66 additions and 9 deletions

View file

@ -33,6 +33,7 @@
#include "window-items.h"
#include "windows-layout.h"
#include "printtext.h"
#include "command-history.h"
static void window_print_binds(WINDOW_REC *win)
{
@ -615,10 +616,25 @@ static void cmd_window_name(const char *data)
}
}
/* SYNTAX: WINDOW HISTORY <name> */
/* SYNTAX: WINDOW HISTORY [-clear] <name> */
void cmd_window_history(const char *data)
{
window_set_history(active_win, data);
GHashTable *optlist;
char *name;
void *free_arg;
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
"window history", &optlist, &name))
return;
if (g_hash_table_lookup(optlist, "clear") != NULL) {
signal_continue(1, data);
window_clear_history(active_win, name);
} else {
window_set_history(active_win, name);
}
cmd_params_free(free_arg);
}
/* we're moving the first window to last - move the first contiguous block
@ -883,6 +899,7 @@ void window_commands_init(void)
command_set_options("window number", "sticky");
command_set_options("window server", "sticky unsticky");
command_set_options("window theme", "delete");
command_set_options("window history", "clear");
}
void window_commands_deinit(void)