reorder history add and fixes

This commit is contained in:
ailin-nemui 2016-01-08 15:42:59 +01:00
commit ad842ea8a6
3 changed files with 9 additions and 20 deletions

View file

@ -33,7 +33,6 @@
static HISTORY_REC *global_history;
static int window_history;
static GSList *histories;
static HISTORY_REC *last_cleared_history;
void command_history_add(HISTORY_REC *history, const char *text)
{
@ -42,13 +41,6 @@ void command_history_add(HISTORY_REC *history, const char *text)
g_return_if_fail(history != NULL);
g_return_if_fail(text != NULL);
if (last_cleared_history == history) {
last_cleared_history = NULL;
return; /* ignore this history addition, we just
cleared it */
}
last_cleared_history = NULL;
link = g_list_last(history->list);
if (link != NULL && g_strcmp0(link->data, text) == 0)
return; /* same as previous entry */
@ -195,7 +187,6 @@ void command_history_clear(HISTORY_REC *history)
g_list_free(history->list);
history->list = NULL;
history->lines = 0;
last_cleared_history = history;
}
void command_history_destroy(HISTORY_REC *history)
@ -207,7 +198,6 @@ void command_history_destroy(HISTORY_REC *history)
histories = g_slist_remove(histories, history);
command_history_clear(history);
last_cleared_history = NULL; /* was destroyed */
g_free_not_null(history->name);
g_free(history);

View file

@ -620,10 +620,10 @@ static void cmd_window_name(const char *data)
void cmd_window_history(const char *data)
{
GHashTable *optlist;
char *name;
char *name;
void *free_arg;
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS | PARAM_FLAG_STRIP_TRAILING_WS,
"window history", &optlist, &name))
return;