1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Merge pull request #1829 from H3rnand3zzz/fix/readline-history

Don't add the same command twice to history
This commit is contained in:
Michael Vetter 2023-04-18 09:38:12 +02:00 committed by GitHub
commit f51dc019bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -568,12 +568,15 @@ _inp_rl_startup_hook(void)
static void
_inp_rl_linehandler(char* line)
{
if (line && *line) {
if (!get_password) {
add_history(line);
}
}
inp_line = line;
if (!line || !*line || get_password) {
return;
}
HISTORY_STATE* history = history_get_history_state();
HIST_ENTRY* last = history->length > 0 ? history->entries[history->length - 1] : NULL;
if (last == NULL || strcmp(last->line, line) != 0) {
add_history(line);
}
}
static gboolean shift_tab = FALSE;