commit f6aa2c72360ea298c1150766c1994190a3e00e1d
parent f00c2286655ffa83e5c3f0c3994e4a84aef6bf6d
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Wed, 1 Aug 2018 03:56:39 +0200
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.
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/client/display.c b/client/display.c
@@ -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);
}