client: Fix comparing current prompt against previous

We'd add the new command propmpt to history if it was different from
what current_history() returned which may not be the last command
executed, so we'd possibly add multiple identical commands to history
and skip some that were new.  Instead compare against
history_get(last index).
Also remove an always-true part of the condition on the next line.
This commit is contained in:
Andrew Zaborowski 2018-08-01 03:56:39 +02:00 committed by Denis Kenzior
parent f00c228665
commit f6aa2c7236
1 changed files with 2 additions and 4 deletions

View File

@ -446,10 +446,8 @@ static void readline_callback(char *prompt)
if (!strlen(prompt))
goto done;
previous_prompt = current_history();
if (!previous_prompt ||
(previous_prompt &&
strcmp(previous_prompt->line, prompt))) {
previous_prompt = history_get(history_base + history_length - 1);
if (!previous_prompt || strcmp(previous_prompt->line, prompt)) {
add_history(prompt);
}