From 4247cac9705474a9fbfb6bf44e2f32acd95cf431 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Sat, 23 Jul 2022 14:07:20 +0800 Subject: [PATCH] shell: fix shell history error --- tools/shell/src/shellCommand.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/shell/src/shellCommand.c b/tools/shell/src/shellCommand.c index ce3718e001..1af6ee4c06 100644 --- a/tools/shell/src/shellCommand.c +++ b/tools/shell/src/shellCommand.c @@ -524,10 +524,8 @@ int32_t shellReadCommand(char *command) { c = taosGetConsoleChar(); switch (c) { case 'A': // Up arrow - if (hist_counter != pHistory->hstart) { - hist_counter = (hist_counter + SHELL_MAX_HISTORY_SIZE - 1) % SHELL_MAX_HISTORY_SIZE; - shellResetCommand(&cmd, (pHistory->hist[hist_counter] == NULL) ? "" : pHistory->hist[hist_counter]); - } + hist_counter = (hist_counter + SHELL_MAX_HISTORY_SIZE - 1) % SHELL_MAX_HISTORY_SIZE; + shellResetCommand(&cmd, (pHistory->hist[hist_counter] == NULL) ? "" : pHistory->hist[hist_counter]); break; case 'B': // Down arrow if (hist_counter != pHistory->hend) {