system/readline/readline_common.c: Don't save the command again in the
history buffer if it's the one at the top.
@@ -693,6 +693,12 @@ ssize_t readline_common(FAR struct rl_common_s *vtbl, FAR char *buf,
*/
if (nch >= 1)
+ {
+ /* If this command is the one at the top of the circular
+ * buffer, don't save it again.
+ */
+
+ if (strncmp(buf, g_cmdhist.buf[g_cmdhist.head], nch) != 0)
{
g_cmdhist.head = (g_cmdhist.head + 1) % RL_CMDHIST_LEN;
@@ -709,6 +715,7 @@ ssize_t readline_common(FAR struct rl_common_s *vtbl, FAR char *buf,
g_cmdhist.len++;
}
}
+ }
#endif /* CONFIG_READLINE_CMD_HISTORY */
/* The newline is stored in the buffer along with the null
