Don't add the same command twice to history
Expected behaviour When you type /command /command it should be just 1 entry in the history. Behaviour All the entries were saved. Behaviour is changed by introducing check. Before adding to history, entry now is compared to the last history entry.
This commit is contained in:
@@ -568,12 +568,15 @@ _inp_rl_startup_hook(void)
|
|||||||
static void
|
static void
|
||||||
_inp_rl_linehandler(char* line)
|
_inp_rl_linehandler(char* line)
|
||||||
{
|
{
|
||||||
if (line && *line) {
|
inp_line = line;
|
||||||
if (!get_password) {
|
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);
|
add_history(line);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
inp_line = line;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean shift_tab = FALSE;
|
static gboolean shift_tab = FALSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user