summaryrefslogtreecommitdiff
path: root/src/fe-common/core/window-commands.c
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2015-12-15 01:52:44 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2016-01-08 15:19:13 +0100
commit4659cea65a663b11f3cc16e1d03c9955a4135238 (patch)
treed3966d97a49c08b8bbc9c98759e25819824a0db0 /src/fe-common/core/window-commands.c
parentbe6d7629e3e58102e5c7599943974cc39c9b172c (diff)
downloadirssi-4659cea65a663b11f3cc16e1d03c9955a4135238.zip
option to clear the history
Diffstat (limited to 'src/fe-common/core/window-commands.c')
-rw-r--r--src/fe-common/core/window-commands.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c
index c6ab68c0..e5005144 100644
--- a/src/fe-common/core/window-commands.c
+++ b/src/fe-common/core/window-commands.c
@@ -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)