未验证 提交 832d8b4e 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #927 from armink/fix_shell

[Finsh] Fix an auto complete history bug.
...@@ -372,7 +372,7 @@ static void shell_push_history(struct finsh_shell *shell) ...@@ -372,7 +372,7 @@ static void shell_push_history(struct finsh_shell *shell)
if (shell->history_count >= FINSH_HISTORY_LINES) if (shell->history_count >= FINSH_HISTORY_LINES)
{ {
/* if current cmd is same as last cmd, don't push */ /* if current cmd is same as last cmd, don't push */
if (memcmp(&shell->cmd_history[FINSH_HISTORY_LINES - 1], shell->line, shell->line_position)) if (memcmp(&shell->cmd_history[FINSH_HISTORY_LINES - 1], shell->line, FINSH_CMD_SIZE))
{ {
/* move history */ /* move history */
int index; int index;
...@@ -391,7 +391,7 @@ static void shell_push_history(struct finsh_shell *shell) ...@@ -391,7 +391,7 @@ static void shell_push_history(struct finsh_shell *shell)
else else
{ {
/* if current cmd is same as last cmd, don't push */ /* if current cmd is same as last cmd, don't push */
if (shell->history_count == 0 || memcmp(&shell->cmd_history[shell->history_count - 1], shell->line, shell->line_position)) if (shell->history_count == 0 || memcmp(&shell->cmd_history[shell->history_count - 1], shell->line, FINSH_CMD_SIZE))
{ {
shell->current_history = shell->history_count; shell->current_history = shell->history_count;
memset(&shell->cmd_history[shell->history_count][0], 0, FINSH_CMD_SIZE); memset(&shell->cmd_history[shell->history_count][0], 0, FINSH_CMD_SIZE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册