1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

patch by petteri_ to enable bash-like editing of window history

This commit is contained in:
vague666 2023-08-14 11:35:06 +02:00
parent f9c9485d15
commit 96dbcef166

View File

@ -261,8 +261,13 @@ static const char *command_history_prev_int(WINDOW_REC *window, const char *text
if (*text != '\0' &&
(pos == NULL || g_strcmp0(((HISTORY_ENTRY_REC *)pos->data)->text, text) != 0)) {
/* save the old entry to history */
if (pos != NULL && settings_get_bool("command_history_editable")) {
history_entry_destroy(pos->data);
pos->data = history_entry_new(history, text);
} else {
command_history_add(history, text);
}
}
return history->pos == NULL ? text : ((HISTORY_ENTRY_REC *)history->pos->data)->text;
}
@ -292,8 +297,13 @@ static const char *command_history_next_int(WINDOW_REC *window, const char *text
if (*text != '\0' &&
(pos == NULL || g_strcmp0(((HISTORY_ENTRY_REC *)pos->data)->text, text) != 0)) {
/* save the old entry to history */
if (pos != NULL && settings_get_bool("command_history_editable")) {
history_entry_destroy(pos->data);
pos->data = history_entry_new(history, text);
} else {
command_history_add(history, text);
}
}
return history->pos == NULL ? "" : ((HISTORY_ENTRY_REC *)history->pos->data)->text;
}
@ -467,6 +477,7 @@ void command_history_init(void)
{
settings_add_int("history", "max_command_history", 100);
settings_add_bool("history", "window_history", FALSE);
settings_add_bool("history", "command_history_editable", FALSE);
special_history_func_set(special_history_func);