[readline] dedupe history

This commit is contained in:
Timothy Stack 2013-07-06 14:37:07 -07:00
parent 275724e912
commit 7e8118513e

View File

@ -89,7 +89,6 @@ static void sigterm(int sig)
static void line_ready_tramp(char *line)
{
child_this->line_ready(line);
add_history(line);
got_line = 1;
rl_callback_handler_remove();
}
@ -497,6 +496,17 @@ void readline_curses::line_ready(const char *line)
perror("line_ready: write failed");
exit(1);
}
{
HIST_ENTRY *entry;
if (line[0] != '\0' && (
history_length == 0 ||
(entry = history_get(history_base + history_length - 1)) == NULL ||
strcmp(entry->line, line) != 0)) {
add_history(line);
}
}
}
void readline_curses::check_fd_set(fd_set &ready_rfds)