forked from PsychoticNinja/irssi
reorder history add and fixes
This commit is contained in:
parent
4659cea65a
commit
ad842ea8a6
@ -33,7 +33,6 @@
|
|||||||
static HISTORY_REC *global_history;
|
static HISTORY_REC *global_history;
|
||||||
static int window_history;
|
static int window_history;
|
||||||
static GSList *histories;
|
static GSList *histories;
|
||||||
static HISTORY_REC *last_cleared_history;
|
|
||||||
|
|
||||||
void command_history_add(HISTORY_REC *history, const char *text)
|
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(history != NULL);
|
||||||
g_return_if_fail(text != 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);
|
link = g_list_last(history->list);
|
||||||
if (link != NULL && g_strcmp0(link->data, text) == 0)
|
if (link != NULL && g_strcmp0(link->data, text) == 0)
|
||||||
return; /* same as previous entry */
|
return; /* same as previous entry */
|
||||||
@ -195,7 +187,6 @@ void command_history_clear(HISTORY_REC *history)
|
|||||||
g_list_free(history->list);
|
g_list_free(history->list);
|
||||||
history->list = NULL;
|
history->list = NULL;
|
||||||
history->lines = 0;
|
history->lines = 0;
|
||||||
last_cleared_history = history;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void command_history_destroy(HISTORY_REC *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);
|
histories = g_slist_remove(histories, history);
|
||||||
command_history_clear(history);
|
command_history_clear(history);
|
||||||
last_cleared_history = NULL; /* was destroyed */
|
|
||||||
|
|
||||||
g_free_not_null(history->name);
|
g_free_not_null(history->name);
|
||||||
g_free(history);
|
g_free(history);
|
||||||
|
@ -623,7 +623,7 @@ void cmd_window_history(const char *data)
|
|||||||
char *name;
|
char *name;
|
||||||
void *free_arg;
|
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))
|
"window history", &optlist, &name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -456,22 +456,21 @@ static void key_send_line(void)
|
|||||||
add_history = *str != '\0';
|
add_history = *str != '\0';
|
||||||
history = command_history_current(active_win);
|
history = command_history_current(active_win);
|
||||||
|
|
||||||
|
if (redir != NULL && redir->flags & ENTRY_REDIRECT_FLAG_HIDDEN)
|
||||||
|
add_history = 0;
|
||||||
|
|
||||||
|
if (add_history && history != NULL) {
|
||||||
|
command_history_add(history, str);
|
||||||
|
}
|
||||||
|
|
||||||
if (redir == NULL) {
|
if (redir == NULL) {
|
||||||
signal_emit("send command", 3, str,
|
signal_emit("send command", 3, str,
|
||||||
active_win->active_server,
|
active_win->active_server,
|
||||||
active_win->active);
|
active_win->active);
|
||||||
} else {
|
} else {
|
||||||
if (redir->flags & ENTRY_REDIRECT_FLAG_HIDDEN)
|
|
||||||
add_history = 0;
|
|
||||||
handle_entry_redirect(str);
|
handle_entry_redirect(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (add_history) {
|
|
||||||
history = command_history_find(history);
|
|
||||||
if (history != NULL)
|
|
||||||
command_history_add(history, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (active_entry != NULL)
|
if (active_entry != NULL)
|
||||||
gui_entry_set_text(active_entry, "");
|
gui_entry_set_text(active_entry, "");
|
||||||
command_history_clear_pos(active_win);
|
command_history_clear_pos(active_win);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user