Fix duplicate line checking bug in readline processing

This commit is contained in:
yabu76 2026-04-25 10:26:13 +09:00
parent e3b8724479
commit 035b661bb8

View file

@ -140,7 +140,9 @@ static void readline_input_cr(readline_t *rl)
{ {
// Different line only // Different line only
if (rl->history_count == 0 || if (rl->history_count == 0 ||
(rl->history_count > 0 && strncmp(rl->history[rl->history_count - 1], rl->line, rl->line_length) != 0)) (rl->history_count > 0 &&
! (rl->history[rl->history_count - 1][rl->line_length] == '\0' &&
strncmp(rl->history[rl->history_count - 1], rl->line, rl->line_length) == 0)) )
{ {
// Save to history // Save to history
if (rl->history_count < RL_HISTORY_MAX) if (rl->history_count < RL_HISTORY_MAX)