diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2017-10-06 15:31:52 +0200 |
---|---|---|
committer | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2017-10-06 15:31:52 +0200 |
commit | deac66f33c0fb1d6914d15ce63bde3f030a9c06d (patch) | |
tree | 921ad9923b204c5b96d932e4d7a949061dc8e5f4 /src/fe-common | |
parent | 16d68a86ca75b73c53aa81fe6d3d36361cb35b99 (diff) | |
download | irssi-deac66f33c0fb1d6914d15ce63bde3f030a9c06d.zip |
add a key binding to erase history entries
it is possible to delete the current history entry using the
erase_history_entry key binding
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/core/command-history.c | 17 | ||||
-rw-r--r-- | src/fe-common/core/command-history.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/fe-common/core/command-history.c b/src/fe-common/core/command-history.c index a6a800d3..32d7adaa 100644 --- a/src/fe-common/core/command-history.c +++ b/src/fe-common/core/command-history.c @@ -307,6 +307,23 @@ const char *command_global_history_next(WINDOW_REC *window, const char *text) return command_history_next_int(window, text, TRUE); } +const char *command_history_delete_current(WINDOW_REC *window, const char *text) +{ + HISTORY_REC *history; + GList *pos; + + history = command_history_current(window); + pos = history->pos; + + if (pos != NULL && g_strcmp0(((HISTORY_ENTRY_REC *)pos->data)->text, text) == 0) { + ((HISTORY_ENTRY_REC *)pos->data)->history->lines--; + history_list_delete_link_and_destroy(pos); + } + + history->redo = 0; + return history->pos == NULL ? "" : ((HISTORY_ENTRY_REC *)history->pos->data)->text; +} + void command_history_clear_pos_func(HISTORY_REC *history, gpointer user_data) { history->pos = NULL; diff --git a/src/fe-common/core/command-history.h b/src/fe-common/core/command-history.h index dc4d46da..ed093415 100644 --- a/src/fe-common/core/command-history.h +++ b/src/fe-common/core/command-history.h @@ -40,6 +40,7 @@ const char *command_history_prev(WINDOW_REC *window, const char *text); const char *command_history_next(WINDOW_REC *window, const char *text); const char *command_global_history_prev(WINDOW_REC *window, const char *text); const char *command_global_history_next(WINDOW_REC *window, const char *text); +const char *command_history_delete_current(WINDOW_REC *window, const char *text); void command_history_clear_pos(WINDOW_REC *window); |